aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS11
-rw-r--r--Documentation/DMA-API.txt9
-rw-r--r--Documentation/accounting/getdelays.c4
-rw-r--r--Documentation/cgroups/cgroups.txt5
-rw-r--r--Documentation/cgroups/cpuacct.txt (renamed from Documentation/controllers/cpuacct.txt)0
-rw-r--r--Documentation/cgroups/cpusets.txt (renamed from Documentation/cpusets.txt)0
-rw-r--r--Documentation/cgroups/devices.txt (renamed from Documentation/controllers/devices.txt)0
-rw-r--r--Documentation/cgroups/memcg_test.txt (renamed from Documentation/controllers/memcg_test.txt)2
-rw-r--r--Documentation/cgroups/memory.txt (renamed from Documentation/controllers/memory.txt)0
-rw-r--r--Documentation/cgroups/resource_counter.txt (renamed from Documentation/controllers/resource_counter.txt)0
-rw-r--r--Documentation/filesystems/proc.txt288
-rw-r--r--Documentation/hwmon/adt747587
-rw-r--r--Documentation/hwmon/lis3lv02d30
-rw-r--r--Documentation/mips/AU1xxx_IDE.README6
-rw-r--r--Documentation/scheduler/sched-design-CFS.txt2
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt12
-rw-r--r--Documentation/sysctl/vm.txt619
-rw-r--r--Documentation/sysrq.txt19
-rw-r--r--MAINTAINERS19
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/byteorder.h1
-rw-r--r--arch/alpha/include/asm/machvec.h4
-rw-r--r--arch/alpha/include/asm/pgalloc.h7
-rw-r--r--arch/alpha/include/asm/rtc.h12
-rw-r--r--arch/alpha/kernel/.gitignore1
-rw-r--r--arch/alpha/kernel/core_marvel.c10
-rw-r--r--arch/alpha/kernel/entry.S8
-rw-r--r--arch/alpha/kernel/irq_srm.c2
-rw-r--r--arch/alpha/kernel/machvec_impl.h5
-rw-r--r--arch/alpha/kernel/proto.h2
-rw-r--r--arch/alpha/kernel/sys_jensen.c2
-rw-r--r--arch/alpha/kernel/sys_marvel.c56
-rw-r--r--arch/alpha/kernel/sys_nautilus.c4
-rw-r--r--arch/alpha/kernel/systbls.S2
-rw-r--r--arch/alpha/kernel/time.c10
-rw-r--r--arch/alpha/mm/init.c7
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/byteorder.h2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/mach-imx/clock.c2
-rw-r--r--arch/arm/mach-imx/generic.c6
-rw-r--r--arch/arm/mach-imx/include/mach/imx-regs.h106
-rw-r--r--arch/arm/mach-w90x900/mach-w90p910evb.c1
-rw-r--r--arch/arm/mach-w90x900/time.c1
-rw-r--r--arch/arm/mm/proc-syms.c1
-rw-r--r--arch/avr32/include/asm/Kbuild1
-rw-r--r--arch/avr32/include/asm/byteorder.h1
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/byteorder.h1
-rw-r--r--arch/cris/arch-v10/kernel/entry.S2
-rw-r--r--arch/cris/arch-v32/kernel/entry.S2
-rw-r--r--arch/cris/include/arch-v10/arch/swab.h (renamed from arch/cris/include/arch-v10/arch/byteorder.h)16
-rw-r--r--arch/cris/include/arch-v32/arch/byteorder.h20
-rw-r--r--arch/cris/include/arch-v32/arch/swab.h24
-rw-r--r--arch/cris/include/asm/byteorder.h19
-rw-r--r--arch/cris/include/asm/swab.h8
-rw-r--r--arch/h8300/include/asm/Kbuild1
-rw-r--r--arch/h8300/include/asm/byteorder.h1
-rw-r--r--arch/h8300/kernel/syscalls.S2
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/configs/generic_defconfig2
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/byteorder.h1
-rw-r--r--arch/ia64/include/asm/dma-mapping.h2
-rw-r--r--arch/ia64/include/asm/machvec.h7
-rw-r--r--arch/ia64/include/asm/machvec_init.h1
-rw-r--r--arch/ia64/include/asm/machvec_sn2.h2
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/sys_ia64.c2
-rw-r--r--arch/ia64/kernel/unaligned.c6
-rw-r--r--arch/ia64/pci/pci.c27
-rw-r--r--arch/ia64/sn/pci/pci_dma.c6
-rw-r--r--arch/ia64/xen/time.c4
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68knommu/include/asm/Kbuild2
-rw-r--r--arch/m68knommu/include/asm/byteorder.h1
-rw-r--r--arch/m68knommu/kernel/syscalltable.S2
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/byteorder.h2
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mn10300/kernel/entry.S2
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/byteorder.h1
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts2
-rw-r--r--arch/powerpc/configs/ppc64_defconfig26
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/byteorder.h2
-rw-r--r--arch/powerpc/include/asm/ps3.h8
-rw-r--r--arch/powerpc/include/asm/qe.h19
-rw-r--r--arch/powerpc/include/asm/rtas.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/include/asm/types.h7
-rw-r--r--arch/powerpc/kernel/asm-offsets.c7
-rw-r--r--arch/powerpc/kernel/cacheinfo.c10
-rw-r--r--arch/powerpc/kernel/dma-iommu.c4
-rw-r--r--arch/powerpc/kernel/head_64.S9
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S8
-rw-r--r--arch/powerpc/kernel/iommu.c12
-rw-r--r--arch/powerpc/kernel/lparcfg.c10
-rw-r--r--arch/powerpc/kernel/machine_kexec.c25
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/powerpc/kernel/prom.c5
-rw-r--r--arch/powerpc/kernel/setup_64.c6
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S4
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c9
-rw-r--r--arch/powerpc/mm/mmu_decl.h11
-rw-r--r--arch/powerpc/mm/slice.c11
-rw-r--r--arch/powerpc/mm/stab.c4
-rw-r--r--arch/powerpc/oprofile/op_model_pa6t.c6
-rw-r--r--arch/powerpc/platforms/512x/clock.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c3
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c8
-rw-r--r--arch/powerpc/platforms/83xx/Makefile1
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c (renamed from drivers/i2c/chips/mcu_mpc8349emitx.c)0
-rw-r--r--arch/powerpc/platforms/Kconfig11
-rw-r--r--arch/powerpc/platforms/cell/beat_interrupt.c2
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_epci.c4
-rw-r--r--arch/powerpc/platforms/cell/iommu.c4
-rw-r--r--arch/powerpc/platforms/cell/ras.c8
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c4
-rw-r--r--arch/powerpc/platforms/cell/spu_callbacks.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c6
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c1
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c26
-rw-r--r--arch/powerpc/platforms/ps3/htab.c2
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c28
-rw-r--r--arch/powerpc/platforms/ps3/mm.c97
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c2
-rw-r--r--arch/powerpc/platforms/ps3/repository.c22
-rw-r--r--arch/powerpc/platforms/ps3/setup.c2
-rw-r--r--arch/powerpc/platforms/ps3/spu.c12
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c14
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c35
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c107
-rw-r--r--arch/powerpc/sysdev/mpic.c2
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/byteorder.h1
-rw-r--r--arch/s390/kernel/compat_wrapper.S4
-rw-r--r--arch/s390/kernel/entry.h16
-rw-r--r--arch/s390/kernel/process.c9
-rw-r--r--arch/s390/kernel/signal.c19
-rw-r--r--arch/s390/kernel/sys_s390.c35
-rw-r--r--arch/s390/kernel/syscalls.S12
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/byteorder.h2
-rw-r--r--arch/sh/include/asm/syscalls_32.h6
-rw-r--r--arch/sh/kernel/sys_sh32.c2
-rw-r--r--arch/sh/kernel/syscalls_32.S4
-rw-r--r--arch/sh/kernel/syscalls_64.S2
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/byteorder.h1
-rw-r--r--arch/sparc/kernel/entry.S4
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c11
-rw-r--r--arch/sparc/kernel/syscalls.S2
-rw-r--r--arch/sparc/kernel/systbls_32.S4
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/x86/include/asm/Kbuild1
-rw-r--r--arch/x86/include/asm/byteorder.h1
-rw-r--r--arch/x86/include/asm/pgtable.h19
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/syscall_table_32.S2
-rw-r--r--arch/x86/mm/pat.c45
-rw-r--r--arch/x86/pci/i386.c12
-rw-r--r--arch/xtensa/include/asm/Kbuild2
-rw-r--r--arch/xtensa/include/asm/byteorder.h2
-rw-r--r--drivers/ata/Kconfig9
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/libata-core.c73
-rw-r--r--drivers/ata/libata-scsi.c17
-rw-r--r--drivers/ata/libata-sff.c9
-rw-r--r--drivers/ata/pata_ali.c28
-rw-r--r--drivers/ata/pata_atiixp.c32
-rw-r--r--drivers/ata/pata_it821x.c17
-rw-r--r--drivers/ata/pata_octeon_cf.c965
-rw-r--r--drivers/ata/sata_fsl.c2
-rw-r--r--drivers/ata/sata_via.c2
-rw-r--r--drivers/block/nbd.c4
-rw-r--r--drivers/block/ps3disk.c18
-rw-r--r--drivers/block/xsysace.c1
-rw-r--r--drivers/char/bsr.c2
-rw-r--r--drivers/char/hvc_console.c12
-rw-r--r--drivers/char/hvc_irq.c2
-rw-r--r--drivers/char/ps3flash.c18
-rw-r--r--drivers/char/synclink_gt.c16
-rw-r--r--drivers/char/sysrq.c6
-rw-r--r--drivers/char/tty_ioctl.c2
-rw-r--r--drivers/gpio/max7301.c6
-rw-r--r--drivers/gpio/max732x.c6
-rw-r--r--drivers/gpio/mcp23s08.c6
-rw-r--r--drivers/gpio/pca953x.c6
-rw-r--r--drivers/gpio/pcf857x.c12
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c175
-rw-r--r--drivers/gpu/drm/drm_irq.c18
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c10
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h23
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c189
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c6
-rw-r--r--drivers/gpu/drm/i915/intel_display.c43
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c7
-rw-r--r--drivers/hwmon/Kconfig24
-rw-r--r--drivers/hwmon/Makefile2
-rw-r--r--drivers/hwmon/abituguru3.c24
-rw-r--r--drivers/hwmon/adt7475.c1221
-rw-r--r--drivers/hwmon/applesmc.c5
-rw-r--r--drivers/hwmon/hp_accel.c75
-rw-r--r--drivers/hwmon/k8temp.c55
-rw-r--r--drivers/i2c/chips/Kconfig11
-rw-r--r--drivers/i2c/chips/Makefile1
-rw-r--r--drivers/ide/Kconfig5
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/ide/ide-pm.c12
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/it821x.c15
-rw-r--r--drivers/ide/sl82c105.c4
-rw-r--r--drivers/ide/tx4938ide.c1
-rw-r--r--drivers/ide/via82cxxx.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c2
-rw-r--r--drivers/infiniband/hw/mlx4/main.c13
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c12
-rw-r--r--drivers/infiniband/hw/nes/nes_utils.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c38
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c3
-rw-r--r--drivers/infiniband/ulp/iser/Kconfig2
-rw-r--r--drivers/leds/Kconfig7
-rw-r--r--drivers/leds/Makefile1
-rw-r--r--drivers/leds/leds-hp-disk.c137
-rw-r--r--drivers/message/fusion/lsi/mpi.h7
-rw-r--r--drivers/message/fusion/lsi/mpi_cnfg.h47
-rw-r--r--drivers/message/fusion/lsi/mpi_fc.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_history.txt86
-rw-r--r--drivers/message/fusion/lsi/mpi_init.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_ioc.h22
-rw-r--r--drivers/message/fusion/lsi/mpi_lan.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_log_fc.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_log_sas.h37
-rw-r--r--drivers/message/fusion/lsi/mpi_raid.h11
-rw-r--r--drivers/message/fusion/lsi/mpi_sas.h18
-rw-r--r--drivers/message/fusion/lsi/mpi_targ.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_tool.h2
-rw-r--r--drivers/message/fusion/lsi/mpi_type.h4
-rw-r--r--drivers/message/fusion/mptbase.c87
-rw-r--r--drivers/message/fusion/mptbase.h3
-rw-r--r--drivers/message/fusion/mptscsih.c3
-rw-r--r--drivers/mfd/twl4030-core.c8
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c2
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/ehea/ehea_qmr.c18
-rw-r--r--drivers/net/ibmveth.c16
-rw-r--r--drivers/net/iseries_veth.c2
-rw-r--r--drivers/net/mlx4/main.c4
-rw-r--r--drivers/net/pasemi_mac.c6
-rw-r--r--drivers/net/usb/hso.c8
-rw-r--r--drivers/of/of_i2c.c19
-rw-r--r--drivers/parisc/superio.c1
-rw-r--r--drivers/pci/intel-iommu.c3
-rw-r--r--drivers/pci/pci.c8
-rw-r--r--drivers/pci/syscall.c12
-rw-r--r--drivers/pcmcia/electra_cf.c2
-rw-r--r--drivers/ps3/ps3-lpm.c16
-rw-r--r--drivers/ps3/ps3-vuart.c32
-rw-r--r--drivers/ps3/ps3stor_lib.c14
-rw-r--r--drivers/rtc/rtc-pxa.c2
-rw-r--r--drivers/rtc/rtc-twl4030.c49
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c14
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c12
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/scsi/libiscsi_tcp.c3
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c2
-rw-r--r--drivers/scsi/ps3rom.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c58
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c7
-rw-r--r--drivers/scsi/scsi.c5
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/8250_pci.c8
-rw-r--r--drivers/serial/8250_pnp.c2
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/of_serial.c1
-rw-r--r--drivers/serial/pnx8xxx_uart.c23
-rw-r--r--drivers/spi/atmel_spi.c3
-rw-r--r--drivers/spi/xilinx_spi.c137
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/video/bf54x-lq043fb.c15
-rw-r--r--drivers/video/bfin-t350mcqb-fb.c15
-rw-r--r--drivers/video/ps3fb.c4
-rw-r--r--fs/aio.c22
-rw-r--r--fs/btrfs/ioctl.h14
-rw-r--r--fs/btrfs/super.c5
-rw-r--r--fs/btrfs/volumes.c1
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/compat.c6
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/dcookies.c10
-rw-r--r--fs/eventfd.c5
-rw-r--r--fs/eventpoll.c18
-rw-r--r--fs/exec.c2
-rw-r--r--fs/ext2/dir.c7
-rw-r--r--fs/fcntl.c11
-rw-r--r--fs/filesystems.c2
-rw-r--r--fs/ioctl.c2
-rw-r--r--fs/ioprio.c5
-rw-r--r--fs/locks.c2
-rw-r--r--fs/namei.c35
-rw-r--r--fs/namespace.c13
-rw-r--r--fs/nfsctl.c4
-rw-r--r--fs/notify/inotify/inotify_user.c9
-rw-r--r--fs/open.c82
-rw-r--r--fs/pipe.c4
-rw-r--r--fs/quota.c3
-rw-r--r--fs/read_write.c49
-rw-r--r--fs/readdir.c9
-rw-r--r--fs/select.c29
-rw-r--r--fs/signalfd.c8
-rw-r--r--fs/splice.c12
-rw-r--r--fs/squashfs/squashfs_fs.h1
-rw-r--r--fs/squashfs/super.c1
-rw-r--r--fs/stat.c38
-rw-r--r--fs/super.c2
-rw-r--r--fs/sync.c32
-rw-r--r--fs/timerfd.c10
-rw-r--r--fs/utimes.c11
-rw-r--r--fs/xattr.c53
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c79
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c23
-rw-r--r--fs/xfs/xfs_acl.h1
-rw-r--r--fs/xfs/xfs_ag.h2
-rw-r--r--fs/xfs/xfs_attr_leaf.c72
-rw-r--r--fs/xfs/xfs_attr_leaf.h12
-rw-r--r--fs/xfs/xfs_bit.h10
-rw-r--r--fs/xfs/xfs_bmap_btree.c84
-rw-r--r--fs/xfs/xfs_btree.c4
-rw-r--r--fs/xfs/xfs_dir2_block.c7
-rw-r--r--fs/xfs/xfs_dir2_leaf.c6
-rw-r--r--fs/xfs/xfs_dir2_sf.c15
-rw-r--r--fs/xfs/xfs_types.h4
-rw-r--r--include/asm-frv/Kbuild1
-rw-r--r--include/asm-frv/byteorder.h1
-rw-r--r--include/asm-generic/Kbuild.asm1
-rw-r--r--include/asm-generic/pgtable.h4
-rw-r--r--include/asm-generic/rtc.h14
-rw-r--r--include/asm-m32r/Kbuild1
-rw-r--r--include/asm-m32r/byteorder.h2
-rw-r--r--include/asm-m68k/Kbuild1
-rw-r--r--include/asm-m68k/byteorder.h1
-rw-r--r--include/asm-mn10300/Kbuild1
-rw-r--r--include/asm-mn10300/byteorder.h1
-rw-r--r--include/drm/drm_crtc.h2
-rw-r--r--include/drm/drm_crtc_helper.h2
-rw-r--r--include/linux/agpgart.h1
-rw-r--r--include/linux/atm_idt77105.h2
-rw-r--r--include/linux/capi.h2
-rw-r--r--include/linux/compat.h13
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cyclades.h2
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/if_pppol2tp.h2
-rw-r--r--include/linux/if_pppox.h2
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ioport.h3
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/joystick.h2
-rw-r--r--include/linux/kvm.h2
-rw-r--r--include/linux/libata.h11
-rw-r--r--include/linux/loop.h2
-rw-r--r--include/linux/magic.h2
-rw-r--r--include/linux/matroxfb.h2
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/of_i2c.h3
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/phantom.h2
-rw-r--r--include/linux/radeonfb.h2
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/swab.h2
-rw-r--r--include/linux/syscalls.h169
-rw-r--r--include/scsi/libiscsi_tcp.h1
-rw-r--r--init/Kconfig65
-rw-r--r--ipc/mqueue.c28
-rw-r--r--ipc/msg.c12
-rw-r--r--ipc/sem.c18
-rw-r--r--ipc/shm.c8
-rw-r--r--kernel/Makefile5
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/capability.c4
-rw-r--r--kernel/cpuset.c2
-rw-r--r--kernel/exec_domain.c3
-rw-r--r--kernel/exit.c17
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/futex.c17
-rw-r--r--kernel/hrtimer.c4
-rw-r--r--kernel/itimer.c7
-rw-r--r--kernel/kexec.c5
-rw-r--r--kernel/module.c10
-rw-r--r--kernel/posix-timers.c43
-rw-r--r--kernel/printk.c7
-rw-r--r--kernel/ptrace.c2
-rw-r--r--kernel/resource.c1
-rw-r--r--kernel/sched.c43
-rw-r--r--kernel/sched_fair.c37
-rw-r--r--kernel/signal.c59
-rw-r--r--kernel/sys.c70
-rw-r--r--kernel/sys_ni.c1
-rw-r--r--kernel/sysctl.c13
-rw-r--r--kernel/time.c14
-rw-r--r--kernel/timer.c18
-rw-r--r--kernel/uid16.c39
-rw-r--r--kernel/up.c1
-rw-r--r--lib/idr.c14
-rw-r--r--mm/fadvise.c18
-rw-r--r--mm/filemap.c9
-rw-r--r--mm/fremap.c4
-rw-r--r--mm/madvise.c2
-rw-r--r--mm/memcontrol.c130
-rw-r--r--mm/memory.c24
-rw-r--r--mm/mempolicy.c24
-rw-r--r--mm/migrate.c8
-rw-r--r--mm/mincore.c4
-rw-r--r--mm/mlock.c8
-rw-r--r--mm/mmap.c4
-rw-r--r--mm/mprotect.c4
-rw-r--r--mm/mremap.c6
-rw-r--r--mm/msync.c2
-rw-r--r--mm/nommu.c11
-rw-r--r--mm/swapfile.c4
-rw-r--r--mm/vmalloc.c20
-rw-r--r--net/9p/Kconfig2
-rw-r--r--net/socket.c63
-rwxr-xr-xscripts/checkpatch.pl28
-rw-r--r--security/keys/keyctl.c22
-rw-r--r--sound/pci/hda/hda_codec.c63
-rw-r--r--sound/pci/hda/hda_local.h3
-rw-r--r--sound/pci/hda/patch_nvhdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c159
-rw-r--r--sound/pci/oxygen/virtuoso.c17
-rw-r--r--sound/ppc/snd_ps3.c4
-rw-r--r--sound/soc/soc-dapm.c3
-rw-r--r--sound/usb/usbquirks.h8
456 files changed, 6293 insertions, 2808 deletions
diff --git a/CREDITS b/CREDITS
index 939da46a87fb..2b39168c06aa 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3786,14 +3786,11 @@ S: The Netherlands
3786 3786
3787N: David Woodhouse 3787N: David Woodhouse
3788E: dwmw2@infradead.org 3788E: dwmw2@infradead.org
3789D: ARCnet stuff, Applicom board driver, SO_BINDTODEVICE, 3789D: JFFS2 file system, Memory Technology Device subsystem,
3790D: some Alpha platform porting from 2.0, Memory Technology Devices,
3791D: Acquire watchdog timer, PC speaker driver maintenance,
3792D: various other stuff that annoyed me by not working. 3790D: various other stuff that annoyed me by not working.
3793S: c/o Red Hat Engineering 3791S: c/o Intel Corporation
3794S: Rustat House 3792S: Pipers Way
3795S: 60 Clifton Road 3793S: Swindon. SN3 1RJ
3796S: Cambridge. CB1 7EG
3797S: England 3794S: England
3798 3795
3799N: Chris Wright 3796N: Chris Wright
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index b462bb149543..52441694fe03 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -170,16 +170,15 @@ Returns: 0 if successful and a negative error if not.
170u64 170u64
171dma_get_required_mask(struct device *dev) 171dma_get_required_mask(struct device *dev)
172 172
173After setting the mask with dma_set_mask(), this API returns the 173This API returns the mask that the platform requires to
174actual mask (within that already set) that the platform actually 174operate efficiently. Usually this means the returned mask
175requires to operate efficiently. Usually this means the returned mask
176is the minimum required to cover all of memory. Examining the 175is the minimum required to cover all of memory. Examining the
177required mask gives drivers with variable descriptor sizes the 176required mask gives drivers with variable descriptor sizes the
178opportunity to use smaller descriptors as necessary. 177opportunity to use smaller descriptors as necessary.
179 178
180Requesting the required mask does not alter the current mask. If you 179Requesting the required mask does not alter the current mask. If you
181wish to take advantage of it, you should issue another dma_set_mask() 180wish to take advantage of it, you should issue a dma_set_mask()
182call to lower the mask again. 181call to set the mask to the value returned.
183 182
184 183
185Part Id - Streaming DMA mappings 184Part Id - Streaming DMA mappings
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cc49400b4af8..7ea231172c85 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -392,6 +392,10 @@ int main(int argc, char *argv[])
392 goto err; 392 goto err;
393 } 393 }
394 } 394 }
395 if (!maskset && !tid && !containerset) {
396 usage();
397 goto err;
398 }
395 399
396 do { 400 do {
397 int i; 401 int i;
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index e33ee74eee77..d9e5d6f41b92 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -1,7 +1,8 @@
1 CGROUPS 1 CGROUPS
2 ------- 2 -------
3 3
4Written by Paul Menage <menage@google.com> based on Documentation/cpusets.txt 4Written by Paul Menage <menage@google.com> based on
5Documentation/cgroups/cpusets.txt
5 6
6Original copyright statements from cpusets.txt: 7Original copyright statements from cpusets.txt:
7Portions Copyright (C) 2004 BULL SA. 8Portions Copyright (C) 2004 BULL SA.
@@ -68,7 +69,7 @@ On their own, the only use for cgroups is for simple job
68tracking. The intention is that other subsystems hook into the generic 69tracking. The intention is that other subsystems hook into the generic
69cgroup support to provide new attributes for cgroups, such as 70cgroup support to provide new attributes for cgroups, such as
70accounting/limiting the resources which processes in a cgroup can 71accounting/limiting the resources which processes in a cgroup can
71access. For example, cpusets (see Documentation/cpusets.txt) allows 72access. For example, cpusets (see Documentation/cgroups/cpusets.txt) allows
72you to associate a set of CPUs and a set of memory nodes with the 73you to associate a set of CPUs and a set of memory nodes with the
73tasks in each cgroup. 74tasks in each cgroup.
74 75
diff --git a/Documentation/controllers/cpuacct.txt b/Documentation/cgroups/cpuacct.txt
index bb775fbe43d7..bb775fbe43d7 100644
--- a/Documentation/controllers/cpuacct.txt
+++ b/Documentation/cgroups/cpuacct.txt
diff --git a/Documentation/cpusets.txt b/Documentation/cgroups/cpusets.txt
index 5c86c258c791..5c86c258c791 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cgroups/cpusets.txt
diff --git a/Documentation/controllers/devices.txt b/Documentation/cgroups/devices.txt
index 7cc6e6a60672..7cc6e6a60672 100644
--- a/Documentation/controllers/devices.txt
+++ b/Documentation/cgroups/devices.txt
diff --git a/Documentation/controllers/memcg_test.txt b/Documentation/cgroups/memcg_test.txt
index 08d4d3ea0d79..19533f93b7a2 100644
--- a/Documentation/controllers/memcg_test.txt
+++ b/Documentation/cgroups/memcg_test.txt
@@ -6,7 +6,7 @@ Because VM is getting complex (one of reasons is memcg...), memcg's behavior
6is complex. This is a document for memcg's internal behavior. 6is complex. This is a document for memcg's internal behavior.
7Please note that implementation details can be changed. 7Please note that implementation details can be changed.
8 8
9(*) Topics on API should be in Documentation/controllers/memory.txt) 9(*) Topics on API should be in Documentation/cgroups/memory.txt)
10 10
110. How to record usage ? 110. How to record usage ?
12 2 objects are used. 12 2 objects are used.
diff --git a/Documentation/controllers/memory.txt b/Documentation/cgroups/memory.txt
index e1501964df1e..e1501964df1e 100644
--- a/Documentation/controllers/memory.txt
+++ b/Documentation/cgroups/memory.txt
diff --git a/Documentation/controllers/resource_counter.txt b/Documentation/cgroups/resource_counter.txt
index f196ac1d7d25..f196ac1d7d25 100644
--- a/Documentation/controllers/resource_counter.txt
+++ b/Documentation/cgroups/resource_counter.txt
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index d105eb45282a..bbebc3a43ac0 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1371,292 +1371,8 @@ auto_msgmni default value is 1.
13712.4 /proc/sys/vm - The virtual memory subsystem 13712.4 /proc/sys/vm - The virtual memory subsystem
1372----------------------------------------------- 1372-----------------------------------------------
1373 1373
1374The files in this directory can be used to tune the operation of the virtual 1374Please see: Documentation/sysctls/vm.txt for a description of these
1375memory (VM) subsystem of the Linux kernel. 1375entries.
1376
1377vfs_cache_pressure
1378------------------
1379
1380Controls the tendency of the kernel to reclaim the memory which is used for
1381caching of directory and inode objects.
1382
1383At the default value of vfs_cache_pressure=100 the kernel will attempt to
1384reclaim dentries and inodes at a "fair" rate with respect to pagecache and
1385swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer
1386to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100
1387causes the kernel to prefer to reclaim dentries and inodes.
1388
1389dirty_background_bytes
1390----------------------
1391
1392Contains the amount of dirty memory at which the pdflush background writeback
1393daemon will start writeback.
1394
1395If dirty_background_bytes is written, dirty_background_ratio becomes a function
1396of its value (dirty_background_bytes / the amount of dirtyable system memory).
1397
1398dirty_background_ratio
1399----------------------
1400
1401Contains, as a percentage of the dirtyable system memory (free pages + mapped
1402pages + file cache, not including locked pages and HugePages), the number of
1403pages at which the pdflush background writeback daemon will start writing out
1404dirty data.
1405
1406If dirty_background_ratio is written, dirty_background_bytes becomes a function
1407of its value (dirty_background_ratio * the amount of dirtyable system memory).
1408
1409dirty_bytes
1410-----------
1411
1412Contains the amount of dirty memory at which a process generating disk writes
1413will itself start writeback.
1414
1415If dirty_bytes is written, dirty_ratio becomes a function of its value
1416(dirty_bytes / the amount of dirtyable system memory).
1417
1418dirty_ratio
1419-----------
1420
1421Contains, as a percentage of the dirtyable system memory (free pages + mapped
1422pages + file cache, not including locked pages and HugePages), the number of
1423pages at which a process which is generating disk writes will itself start
1424writing out dirty data.
1425
1426If dirty_ratio is written, dirty_bytes becomes a function of its value
1427(dirty_ratio * the amount of dirtyable system memory).
1428
1429dirty_writeback_centisecs
1430-------------------------
1431
1432The pdflush writeback daemons will periodically wake up and write `old' data
1433out to disk. This tunable expresses the interval between those wakeups, in
1434100'ths of a second.
1435
1436Setting this to zero disables periodic writeback altogether.
1437
1438dirty_expire_centisecs
1439----------------------
1440
1441This tunable is used to define when dirty data is old enough to be eligible
1442for writeout by the pdflush daemons. It is expressed in 100'ths of a second.
1443Data which has been dirty in-memory for longer than this interval will be
1444written out next time a pdflush daemon wakes up.
1445
1446highmem_is_dirtyable
1447--------------------
1448
1449Only present if CONFIG_HIGHMEM is set.
1450
1451This defaults to 0 (false), meaning that the ratios set above are calculated
1452as a percentage of lowmem only. This protects against excessive scanning
1453in page reclaim, swapping and general VM distress.
1454
1455Setting this to 1 can be useful on 32 bit machines where you want to make
1456random changes within an MMAPed file that is larger than your available
1457lowmem without causing large quantities of random IO. Is is safe if the
1458behavior of all programs running on the machine is known and memory will
1459not be otherwise stressed.
1460
1461legacy_va_layout
1462----------------
1463
1464If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
1465will use the legacy (2.4) layout for all processes.
1466
1467lowmem_reserve_ratio
1468---------------------
1469
1470For some specialised workloads on highmem machines it is dangerous for
1471the kernel to allow process memory to be allocated from the "lowmem"
1472zone. This is because that memory could then be pinned via the mlock()
1473system call, or by unavailability of swapspace.
1474
1475And on large highmem machines this lack of reclaimable lowmem memory
1476can be fatal.
1477
1478So the Linux page allocator has a mechanism which prevents allocations
1479which _could_ use highmem from using too much lowmem. This means that
1480a certain amount of lowmem is defended from the possibility of being
1481captured into pinned user memory.
1482
1483(The same argument applies to the old 16 megabyte ISA DMA region. This
1484mechanism will also defend that region from allocations which could use
1485highmem or lowmem).
1486
1487The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
1488in defending these lower zones.
1489
1490If you have a machine which uses highmem or ISA DMA and your
1491applications are using mlock(), or if you are running with no swap then
1492you probably should change the lowmem_reserve_ratio setting.
1493
1494The lowmem_reserve_ratio is an array. You can see them by reading this file.
1495-
1496% cat /proc/sys/vm/lowmem_reserve_ratio
1497256 256 32
1498-
1499Note: # of this elements is one fewer than number of zones. Because the highest
1500 zone's value is not necessary for following calculation.
1501
1502But, these values are not used directly. The kernel calculates # of protection
1503pages for each zones from them. These are shown as array of protection pages
1504in /proc/zoneinfo like followings. (This is an example of x86-64 box).
1505Each zone has an array of protection pages like this.
1506
1507-
1508Node 0, zone DMA
1509 pages free 1355
1510 min 3
1511 low 3
1512 high 4
1513 :
1514 :
1515 numa_other 0
1516 protection: (0, 2004, 2004, 2004)
1517 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1518 pagesets
1519 cpu: 0 pcp: 0
1520 :
1521-
1522These protections are added to score to judge whether this zone should be used
1523for page allocation or should be reclaimed.
1524
1525In this example, if normal pages (index=2) are required to this DMA zone and
1526pages_high is used for watermark, the kernel judges this zone should not be
1527used because pages_free(1355) is smaller than watermark + protection[2]
1528(4 + 2004 = 2008). If this protection value is 0, this zone would be used for
1529normal page requirement. If requirement is DMA zone(index=0), protection[0]
1530(=0) is used.
1531
1532zone[i]'s protection[j] is calculated by following expression.
1533
1534(i < j):
1535 zone[i]->protection[j]
1536 = (total sums of present_pages from zone[i+1] to zone[j] on the node)
1537 / lowmem_reserve_ratio[i];
1538(i = j):
1539 (should not be protected. = 0;
1540(i > j):
1541 (not necessary, but looks 0)
1542
1543The default values of lowmem_reserve_ratio[i] are
1544 256 (if zone[i] means DMA or DMA32 zone)
1545 32 (others).
1546As above expression, they are reciprocal number of ratio.
1547256 means 1/256. # of protection pages becomes about "0.39%" of total present
1548pages of higher zones on the node.
1549
1550If you would like to protect more pages, smaller values are effective.
1551The minimum value is 1 (1/1 -> 100%).
1552
1553page-cluster
1554------------
1555
1556page-cluster controls the number of pages which are written to swap in
1557a single attempt. The swap I/O size.
1558
1559It is a logarithmic value - setting it to zero means "1 page", setting
1560it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
1561
1562The default value is three (eight pages at a time). There may be some
1563small benefits in tuning this to a different value if your workload is
1564swap-intensive.
1565
1566overcommit_memory
1567-----------------
1568
1569Controls overcommit of system memory, possibly allowing processes
1570to allocate (but not use) more memory than is actually available.
1571
1572
15730 - Heuristic overcommit handling. Obvious overcommits of
1574 address space are refused. Used for a typical system. It
1575 ensures a seriously wild allocation fails while allowing
1576 overcommit to reduce swap usage. root is allowed to
1577 allocate slightly more memory in this mode. This is the
1578 default.
1579
15801 - Always overcommit. Appropriate for some scientific
1581 applications.
1582
15832 - Don't overcommit. The total address space commit
1584 for the system is not permitted to exceed swap plus a
1585 configurable percentage (default is 50) of physical RAM.
1586 Depending on the percentage you use, in most situations
1587 this means a process will not be killed while attempting
1588 to use already-allocated memory but will receive errors
1589 on memory allocation as appropriate.
1590
1591overcommit_ratio
1592----------------
1593
1594Percentage of physical memory size to include in overcommit calculations
1595(see above.)
1596
1597Memory allocation limit = swapspace + physmem * (overcommit_ratio / 100)
1598
1599 swapspace = total size of all swap areas
1600 physmem = size of physical memory in system
1601
1602nr_hugepages and hugetlb_shm_group
1603----------------------------------
1604
1605nr_hugepages configures number of hugetlb page reserved for the system.
1606
1607hugetlb_shm_group contains group id that is allowed to create SysV shared
1608memory segment using hugetlb page.
1609
1610hugepages_treat_as_movable
1611--------------------------
1612
1613This parameter is only useful when kernelcore= is specified at boot time to
1614create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
1615are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
1616value written to hugepages_treat_as_movable allows huge pages to be allocated
1617from ZONE_MOVABLE.
1618
1619Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
1620pages pool can easily grow or shrink within. Assuming that applications are
1621not running that mlock() a lot of memory, it is likely the huge pages pool
1622can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
1623into nr_hugepages and triggering page reclaim.
1624
1625laptop_mode
1626-----------
1627
1628laptop_mode is a knob that controls "laptop mode". All the things that are
1629controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt.
1630
1631block_dump
1632----------
1633
1634block_dump enables block I/O debugging when set to a nonzero value. More
1635information on block I/O debugging is in Documentation/laptops/laptop-mode.txt.
1636
1637swap_token_timeout
1638------------------
1639
1640This file contains valid hold time of swap out protection token. The Linux
1641VM has token based thrashing control mechanism and uses the token to prevent
1642unnecessary page faults in thrashing situation. The unit of the value is
1643second. The value would be useful to tune thrashing behavior.
1644
1645drop_caches
1646-----------
1647
1648Writing to this will cause the kernel to drop clean caches, dentries and
1649inodes from memory, causing that memory to become free.
1650
1651To free pagecache:
1652 echo 1 > /proc/sys/vm/drop_caches
1653To free dentries and inodes:
1654 echo 2 > /proc/sys/vm/drop_caches
1655To free pagecache, dentries and inodes:
1656 echo 3 > /proc/sys/vm/drop_caches
1657
1658As this is a non-destructive operation and dirty objects are not freeable, the
1659user should run `sync' first.
1660 1376
1661 1377
16622.5 /proc/sys/dev - Device specific parameters 13782.5 /proc/sys/dev - Device specific parameters
diff --git a/Documentation/hwmon/adt7475 b/Documentation/hwmon/adt7475
new file mode 100644
index 000000000000..a2b1abec850e
--- /dev/null
+++ b/Documentation/hwmon/adt7475
@@ -0,0 +1,87 @@
1This describes the interface for the ADT7475 driver:
2
3(there are 4 fans, numbered fan1 to fan4):
4
5fanX_input Read the current speed of the fan (in RPMs)
6fanX_min Read/write the minimum speed of the fan. Dropping
7 below this sets an alarm.
8
9(there are three PWMs, numbered pwm1 to pwm3):
10
11pwmX Read/write the current duty cycle of the PWM. Writes
12 only have effect when auto mode is turned off (see
13 below). Range is 0 - 255.
14
15pwmX_enable Fan speed control method:
16
17 0 - No control (fan at full speed)
18 1 - Manual fan speed control (using pwm[1-*])
19 2 - Automatic fan speed control
20
21pwmX_auto_channels_temp Select which channels affect this PWM
22
23 1 - TEMP1 controls PWM
24 2 - TEMP2 controls PWM
25 4 - TEMP3 controls PWM
26 6 - TEMP2 and TEMP3 control PWM
27 7 - All three inputs control PWM
28
29pwmX_freq Read/write the PWM frequency in Hz. The number
30 should be one of the following:
31
32 11 Hz
33 14 Hz
34 22 Hz
35 29 Hz
36 35 Hz
37 44 Hz
38 58 Hz
39 88 Hz
40
41pwmX_auto_point1_pwm Read/write the minimum PWM duty cycle in automatic mode
42
43pwmX_auto_point2_pwm Read/write the maximum PWM duty cycle in automatic mode
44
45(there are three temperature settings numbered temp1 to temp3):
46
47tempX_input Read the current temperature. The value is in milli
48 degrees of Celsius.
49
50tempX_max Read/write the upper temperature limit - exceeding this
51 will cause an alarm.
52
53tempX_min Read/write the lower temperature limit - exceeding this
54 will cause an alarm.
55
56tempX_offset Read/write the temperature adjustment offset
57
58tempX_crit Read/write the THERM limit for remote1.
59
60tempX_crit_hyst Set the temperature value below crit where the
61 fans will stay on - this helps drive the temperature
62 low enough so it doesn't stay near the edge and
63 cause THERM to keep tripping.
64
65tempX_auto_point1_temp Read/write the minimum temperature where the fans will
66 turn on in automatic mode.
67
68tempX_auto_point2_temp Read/write the maximum temperature over which the fans
69 will run in automatic mode. tempX_auto_point1_temp
70 and tempX_auto_point2_temp together define the
71 range of automatic control.
72
73tempX_alarm Read a 1 if the max/min alarm is set
74tempX_fault Read a 1 if either temp1 or temp3 diode has a fault
75
76(There are two voltage settings, in1 and in2):
77
78inX_input Read the current voltage on VCC. Value is in
79 millivolts.
80
81inX_min read/write the minimum voltage limit.
82 Dropping below this causes an alarm.
83
84inX_max read/write the maximum voltage limit.
85 Exceeding this causes an alarm.
86
87inX_alarm Read a 1 if the max/min alarm is set.
diff --git a/Documentation/hwmon/lis3lv02d b/Documentation/hwmon/lis3lv02d
index 65dfb0c0fd67..0fcfc4a7ccdc 100644
--- a/Documentation/hwmon/lis3lv02d
+++ b/Documentation/hwmon/lis3lv02d
@@ -13,18 +13,21 @@ Author:
13Description 13Description
14----------- 14-----------
15 15
16This driver provides support for the accelerometer found in various HP laptops 16This driver provides support for the accelerometer found in various HP
17sporting the feature officially called "HP Mobile Data Protection System 3D" or 17laptops sporting the feature officially called "HP Mobile Data
18"HP 3D DriveGuard". It detect automatically laptops with this sensor. Known models 18Protection System 3D" or "HP 3D DriveGuard". It detect automatically
19(for now the HP 2133, nc6420, nc2510, nc8510, nc84x0, nw9440 and nx9420) will 19laptops with this sensor. Known models (for now the HP 2133, nc6420,
20have their axis automatically oriented on standard way (eg: you can directly 20nc2510, nc8510, nc84x0, nw9440 and nx9420) will have their axis
21play neverball). The accelerometer data is readable via 21automatically oriented on standard way (eg: you can directly play
22neverball). The accelerometer data is readable via
22/sys/devices/platform/lis3lv02d. 23/sys/devices/platform/lis3lv02d.
23 24
24Sysfs attributes under /sys/devices/platform/lis3lv02d/: 25Sysfs attributes under /sys/devices/platform/lis3lv02d/:
25position - 3D position that the accelerometer reports. Format: "(x,y,z)" 26position - 3D position that the accelerometer reports. Format: "(x,y,z)"
26calibrate - read: values (x, y, z) that are used as the base for input class device operation. 27calibrate - read: values (x, y, z) that are used as the base for input
27 write: forces the base to be recalibrated with the current position. 28 class device operation.
29 write: forces the base to be recalibrated with the current
30 position.
28rate - reports the sampling rate of the accelerometer device in HZ 31rate - reports the sampling rate of the accelerometer device in HZ
29 32
30This driver also provides an absolute input class device, allowing 33This driver also provides an absolute input class device, allowing
@@ -39,11 +42,12 @@ the accelerometer are converted into a "standard" organisation of the axes
39 * When the laptop is horizontal the position reported is about 0 for X and Y 42 * When the laptop is horizontal the position reported is about 0 for X and Y
40and a positive value for Z 43and a positive value for Z
41 * If the left side is elevated, X increases (becomes positive) 44 * If the left side is elevated, X increases (becomes positive)
42 * If the front side (where the touchpad is) is elevated, Y decreases (becomes negative) 45 * If the front side (where the touchpad is) is elevated, Y decreases
46 (becomes negative)
43 * If the laptop is put upside-down, Z becomes negative 47 * If the laptop is put upside-down, Z becomes negative
44 48
45If your laptop model is not recognized (cf "dmesg"), you can send an email to the 49If your laptop model is not recognized (cf "dmesg"), you can send an
46authors to add it to the database. When reporting a new laptop, please include 50email to the authors to add it to the database. When reporting a new
47the output of "dmidecode" plus the value of /sys/devices/platform/lis3lv02d/position 51laptop, please include the output of "dmidecode" plus the value of
48in these four cases. 52/sys/devices/platform/lis3lv02d/position in these four cases.
49 53
diff --git a/Documentation/mips/AU1xxx_IDE.README b/Documentation/mips/AU1xxx_IDE.README
index f54962aea84d..8ace35ebdcd5 100644
--- a/Documentation/mips/AU1xxx_IDE.README
+++ b/Documentation/mips/AU1xxx_IDE.README
@@ -52,14 +52,12 @@ Two files are introduced:
52 b) 'drivers/ide/mips/au1xxx-ide.c' 52 b) 'drivers/ide/mips/au1xxx-ide.c'
53 contains the functionality of the AU1XXX IDE driver 53 contains the functionality of the AU1XXX IDE driver
54 54
55Four configs variables are introduced: 55Following extra configs variables are introduced:
56 56
57 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - enable the PIO+DBDMA mode 57 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - enable the PIO+DBDMA mode
58 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - enable the MWDMA mode 58 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - enable the MWDMA mode
59 CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - set Burstable FIFO in DBDMA 59 CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - set Burstable FIFO in DBDMA
60 controller 60 controller
61 CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ - maximum transfer size
62 per descriptor
63 61
64 62
65SUPPORTED IDE MODES 63SUPPORTED IDE MODES
@@ -87,7 +85,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
87CONFIG_IDEDMA_PCI_AUTO=y 85CONFIG_IDEDMA_PCI_AUTO=y
88CONFIG_BLK_DEV_IDE_AU1XXX=y 86CONFIG_BLK_DEV_IDE_AU1XXX=y
89CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y 87CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
90CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
91CONFIG_BLK_DEV_IDEDMA=y 88CONFIG_BLK_DEV_IDEDMA=y
92CONFIG_IDEDMA_AUTO=y 89CONFIG_IDEDMA_AUTO=y
93 90
@@ -105,7 +102,6 @@ CONFIG_BLK_DEV_IDEDMA_PCI=y
105CONFIG_IDEDMA_PCI_AUTO=y 102CONFIG_IDEDMA_PCI_AUTO=y
106CONFIG_BLK_DEV_IDE_AU1XXX=y 103CONFIG_BLK_DEV_IDE_AU1XXX=y
107CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y 104CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA=y
108CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
109CONFIG_BLK_DEV_IDEDMA=y 105CONFIG_BLK_DEV_IDEDMA=y
110CONFIG_IDEDMA_AUTO=y 106CONFIG_IDEDMA_AUTO=y
111 107
diff --git a/Documentation/scheduler/sched-design-CFS.txt b/Documentation/scheduler/sched-design-CFS.txt
index 8398ca4ff4ed..6f33593e59e2 100644
--- a/Documentation/scheduler/sched-design-CFS.txt
+++ b/Documentation/scheduler/sched-design-CFS.txt
@@ -231,7 +231,7 @@ CPU bandwidth control purposes:
231 231
232 This options needs CONFIG_CGROUPS to be defined, and lets the administrator 232 This options needs CONFIG_CGROUPS to be defined, and lets the administrator
233 create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See 233 create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See
234 Documentation/cgroups.txt for more information about this filesystem. 234 Documentation/cgroups/cgroups.txt for more information about this filesystem.
235 235
236Only one of these options to group tasks can be chosen and not both. 236Only one of these options to group tasks can be chosen and not both.
237 237
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index 4b7ac21ea9eb..64eb1100eec1 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -275,7 +275,8 @@ STAC9200
275 dell-m25 Dell Inspiron E1505n 275 dell-m25 Dell Inspiron E1505n
276 dell-m26 Dell Inspiron 1501 276 dell-m26 Dell Inspiron 1501
277 dell-m27 Dell Inspiron E1705/9400 277 dell-m27 Dell Inspiron E1705/9400
278 gateway Gateway laptops with EAPD control 278 gateway-m4 Gateway laptops with EAPD control
279 gateway-m4-2 Gateway laptops with EAPD control
279 panasonic Panasonic CF-74 280 panasonic Panasonic CF-74
280 281
281STAC9205/9254 282STAC9205/9254
@@ -302,6 +303,7 @@ STAC9220/9221
302 macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3) 303 macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3)
303 imac-intel Intel iMac (eq. type 2) 304 imac-intel Intel iMac (eq. type 2)
304 imac-intel-20 Intel iMac (newer version) (eq. type 3) 305 imac-intel-20 Intel iMac (newer version) (eq. type 3)
306 ecs202 ECS/PC chips
305 dell-d81 Dell (unknown) 307 dell-d81 Dell (unknown)
306 dell-d82 Dell (unknown) 308 dell-d82 Dell (unknown)
307 dell-m81 Dell (unknown) 309 dell-m81 Dell (unknown)
@@ -310,9 +312,13 @@ STAC9220/9221
310STAC9202/9250/9251 312STAC9202/9250/9251
311================== 313==================
312 ref Reference board, base config 314 ref Reference board, base config
315 m1 Some Gateway MX series laptops (NX560XL)
316 m1-2 Some Gateway MX series laptops (MX6453)
317 m2 Some Gateway MX series laptops (M255)
313 m2-2 Some Gateway MX series laptops 318 m2-2 Some Gateway MX series laptops
319 m3 Some Gateway MX series laptops
320 m5 Some Gateway MX series laptops (MP6954)
314 m6 Some Gateway NX series laptops 321 m6 Some Gateway NX series laptops
315 pa6 Gateway NX860 series
316 322
317STAC9227/9228/9229/927x 323STAC9227/9228/9229/927x
318======================= 324=======================
@@ -329,6 +335,7 @@ STAC92HD71B*
329 dell-m4-1 Dell desktops 335 dell-m4-1 Dell desktops
330 dell-m4-2 Dell desktops 336 dell-m4-2 Dell desktops
331 dell-m4-3 Dell desktops 337 dell-m4-3 Dell desktops
338 hp-m4 HP dv laptops
332 339
333STAC92HD73* 340STAC92HD73*
334=========== 341===========
@@ -337,6 +344,7 @@ STAC92HD73*
337 dell-m6-amic Dell desktops/laptops with analog mics 344 dell-m6-amic Dell desktops/laptops with analog mics
338 dell-m6-dmic Dell desktops/laptops with digital mics 345 dell-m6-dmic Dell desktops/laptops with digital mics
339 dell-m6 Dell desktops/laptops with both type of mics 346 dell-m6 Dell desktops/laptops with both type of mics
347 dell-eq Dell desktops/laptops
340 348
341STAC92HD83* 349STAC92HD83*
342=========== 350===========
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index a3415070bcac..3197fc83bc51 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -1,12 +1,13 @@
1Documentation for /proc/sys/vm/* kernel version 2.2.10 1Documentation for /proc/sys/vm/* kernel version 2.6.29
2 (c) 1998, 1999, Rik van Riel <riel@nl.linux.org> 2 (c) 1998, 1999, Rik van Riel <riel@nl.linux.org>
3 (c) 2008 Peter W. Morreale <pmorreale@novell.com>
3 4
4For general info and legal blurb, please look in README. 5For general info and legal blurb, please look in README.
5 6
6============================================================== 7==============================================================
7 8
8This file contains the documentation for the sysctl files in 9This file contains the documentation for the sysctl files in
9/proc/sys/vm and is valid for Linux kernel version 2.2. 10/proc/sys/vm and is valid for Linux kernel version 2.6.29.
10 11
11The files in this directory can be used to tune the operation 12The files in this directory can be used to tune the operation
12of the virtual memory (VM) subsystem of the Linux kernel and 13of the virtual memory (VM) subsystem of the Linux kernel and
@@ -16,180 +17,274 @@ Default values and initialization routines for most of these
16files can be found in mm/swap.c. 17files can be found in mm/swap.c.
17 18
18Currently, these files are in /proc/sys/vm: 19Currently, these files are in /proc/sys/vm:
19- overcommit_memory 20
20- page-cluster 21- block_dump
21- dirty_ratio 22- dirty_background_bytes
22- dirty_background_ratio 23- dirty_background_ratio
24- dirty_bytes
23- dirty_expire_centisecs 25- dirty_expire_centisecs
26- dirty_ratio
24- dirty_writeback_centisecs 27- dirty_writeback_centisecs
25- highmem_is_dirtyable (only if CONFIG_HIGHMEM set) 28- drop_caches
29- hugepages_treat_as_movable
30- hugetlb_shm_group
31- laptop_mode
32- legacy_va_layout
33- lowmem_reserve_ratio
26- max_map_count 34- max_map_count
27- min_free_kbytes 35- min_free_kbytes
28- laptop_mode
29- block_dump
30- drop-caches
31- zone_reclaim_mode
32- min_unmapped_ratio
33- min_slab_ratio 36- min_slab_ratio
34- panic_on_oom 37- min_unmapped_ratio
35- oom_dump_tasks 38- mmap_min_addr
36- oom_kill_allocating_task
37- mmap_min_address
38- numa_zonelist_order
39- nr_hugepages 39- nr_hugepages
40- nr_overcommit_hugepages 40- nr_overcommit_hugepages
41- nr_trim_pages (only if CONFIG_MMU=n) 41- nr_pdflush_threads
42- nr_trim_pages (only if CONFIG_MMU=n)
43- numa_zonelist_order
44- oom_dump_tasks
45- oom_kill_allocating_task
46- overcommit_memory
47- overcommit_ratio
48- page-cluster
49- panic_on_oom
50- percpu_pagelist_fraction
51- stat_interval
52- swappiness
53- vfs_cache_pressure
54- zone_reclaim_mode
55
42 56
43============================================================== 57==============================================================
44 58
45dirty_bytes, dirty_ratio, dirty_background_bytes, 59block_dump
46dirty_background_ratio, dirty_expire_centisecs,
47dirty_writeback_centisecs, highmem_is_dirtyable,
48vfs_cache_pressure, laptop_mode, block_dump, swap_token_timeout,
49drop-caches, hugepages_treat_as_movable:
50 60
51See Documentation/filesystems/proc.txt 61block_dump enables block I/O debugging when set to a nonzero value. More
62information on block I/O debugging is in Documentation/laptops/laptop-mode.txt.
52 63
53============================================================== 64==============================================================
54 65
55overcommit_memory: 66dirty_background_bytes
56 67
57This value contains a flag that enables memory overcommitment. 68Contains the amount of dirty memory at which the pdflush background writeback
69daemon will start writeback.
58 70
59When this flag is 0, the kernel attempts to estimate the amount 71If dirty_background_bytes is written, dirty_background_ratio becomes a function
60of free memory left when userspace requests more memory. 72of its value (dirty_background_bytes / the amount of dirtyable system memory).
61 73
62When this flag is 1, the kernel pretends there is always enough 74==============================================================
63memory until it actually runs out.
64 75
65When this flag is 2, the kernel uses a "never overcommit" 76dirty_background_ratio
66policy that attempts to prevent any overcommit of memory.
67 77
68This feature can be very useful because there are a lot of 78Contains, as a percentage of total system memory, the number of pages at which
69programs that malloc() huge amounts of memory "just-in-case" 79the pdflush background writeback daemon will start writing out dirty data.
70and don't use much of it.
71 80
72The default value is 0. 81==============================================================
73 82
74See Documentation/vm/overcommit-accounting and 83dirty_bytes
75security/commoncap.c::cap_vm_enough_memory() for more information. 84
85Contains the amount of dirty memory at which a process generating disk writes
86will itself start writeback.
87
88If dirty_bytes is written, dirty_ratio becomes a function of its value
89(dirty_bytes / the amount of dirtyable system memory).
76 90
77============================================================== 91==============================================================
78 92
79overcommit_ratio: 93dirty_expire_centisecs
80 94
81When overcommit_memory is set to 2, the committed address 95This tunable is used to define when dirty data is old enough to be eligible
82space is not permitted to exceed swap plus this percentage 96for writeout by the pdflush daemons. It is expressed in 100'ths of a second.
83of physical RAM. See above. 97Data which has been dirty in-memory for longer than this interval will be
98written out next time a pdflush daemon wakes up.
99
100==============================================================
101
102dirty_ratio
103
104Contains, as a percentage of total system memory, the number of pages at which
105a process which is generating disk writes will itself start writing out dirty
106data.
84 107
85============================================================== 108==============================================================
86 109
87page-cluster: 110dirty_writeback_centisecs
88 111
89The Linux VM subsystem avoids excessive disk seeks by reading 112The pdflush writeback daemons will periodically wake up and write `old' data
90multiple pages on a page fault. The number of pages it reads 113out to disk. This tunable expresses the interval between those wakeups, in
91is dependent on the amount of memory in your machine. 114100'ths of a second.
92 115
93The number of pages the kernel reads in at once is equal to 116Setting this to zero disables periodic writeback altogether.
942 ^ page-cluster. Values above 2 ^ 5 don't make much sense
95for swap because we only cluster swap data in 32-page groups.
96 117
97============================================================== 118==============================================================
98 119
99max_map_count: 120drop_caches
100 121
101This file contains the maximum number of memory map areas a process 122Writing to this will cause the kernel to drop clean caches, dentries and
102may have. Memory map areas are used as a side-effect of calling 123inodes from memory, causing that memory to become free.
103malloc, directly by mmap and mprotect, and also when loading shared
104libraries.
105 124
106While most applications need less than a thousand maps, certain 125To free pagecache:
107programs, particularly malloc debuggers, may consume lots of them, 126 echo 1 > /proc/sys/vm/drop_caches
108e.g., up to one or two maps per allocation. 127To free dentries and inodes:
128 echo 2 > /proc/sys/vm/drop_caches
129To free pagecache, dentries and inodes:
130 echo 3 > /proc/sys/vm/drop_caches
109 131
110The default value is 65536. 132As this is a non-destructive operation and dirty objects are not freeable, the
133user should run `sync' first.
111 134
112============================================================== 135==============================================================
113 136
114min_free_kbytes: 137hugepages_treat_as_movable
115 138
116This is used to force the Linux VM to keep a minimum number 139This parameter is only useful when kernelcore= is specified at boot time to
117of kilobytes free. The VM uses this number to compute a pages_min 140create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
118value for each lowmem zone in the system. Each lowmem zone gets 141are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
119a number of reserved free pages based proportionally on its size. 142value written to hugepages_treat_as_movable allows huge pages to be allocated
143from ZONE_MOVABLE.
120 144
121Some minimal amount of memory is needed to satisfy PF_MEMALLOC 145Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
122allocations; if you set this to lower than 1024KB, your system will 146pages pool can easily grow or shrink within. Assuming that applications are
123become subtly broken, and prone to deadlock under high loads. 147not running that mlock() a lot of memory, it is likely the huge pages pool
124 148can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
125Setting this too high will OOM your machine instantly. 149into nr_hugepages and triggering page reclaim.
126 150
127============================================================== 151==============================================================
128 152
129percpu_pagelist_fraction 153hugetlb_shm_group
130 154
131This is the fraction of pages at most (high mark pcp->high) in each zone that 155hugetlb_shm_group contains group id that is allowed to create SysV
132are allocated for each per cpu page list. The min value for this is 8. It 156shared memory segment using hugetlb page.
133means that we don't allow more than 1/8th of pages in each zone to be
134allocated in any single per_cpu_pagelist. This entry only changes the value
135of hot per cpu pagelists. User can specify a number like 100 to allocate
1361/100th of each zone to each per cpu page list.
137 157
138The batch value of each per cpu pagelist is also updated as a result. It is 158==============================================================
139set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
140 159
141The initial value is zero. Kernel does not use this value at boot time to set 160laptop_mode
142the high water marks for each per cpu page list.
143 161
144=============================================================== 162laptop_mode is a knob that controls "laptop mode". All the things that are
163controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt.
145 164
146zone_reclaim_mode: 165==============================================================
147 166
148Zone_reclaim_mode allows someone to set more or less aggressive approaches to 167legacy_va_layout
149reclaim memory when a zone runs out of memory. If it is set to zero then no
150zone reclaim occurs. Allocations will be satisfied from other zones / nodes
151in the system.
152 168
153This is value ORed together of 169If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
170will use the legacy (2.4) layout for all processes.
154 171
1551 = Zone reclaim on 172==============================================================
1562 = Zone reclaim writes dirty pages out
1574 = Zone reclaim swaps pages
158 173
159zone_reclaim_mode is set during bootup to 1 if it is determined that pages 174lowmem_reserve_ratio
160from remote zones will cause a measurable performance reduction. The 175
161page allocator will then reclaim easily reusable pages (those page 176For some specialised workloads on highmem machines it is dangerous for
162cache pages that are currently not used) before allocating off node pages. 177the kernel to allow process memory to be allocated from the "lowmem"
178zone. This is because that memory could then be pinned via the mlock()
179system call, or by unavailability of swapspace.
180
181And on large highmem machines this lack of reclaimable lowmem memory
182can be fatal.
183
184So the Linux page allocator has a mechanism which prevents allocations
185which _could_ use highmem from using too much lowmem. This means that
186a certain amount of lowmem is defended from the possibility of being
187captured into pinned user memory.
188
189(The same argument applies to the old 16 megabyte ISA DMA region. This
190mechanism will also defend that region from allocations which could use
191highmem or lowmem).
192
193The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
194in defending these lower zones.
195
196If you have a machine which uses highmem or ISA DMA and your
197applications are using mlock(), or if you are running with no swap then
198you probably should change the lowmem_reserve_ratio setting.
199
200The lowmem_reserve_ratio is an array. You can see them by reading this file.
201-
202% cat /proc/sys/vm/lowmem_reserve_ratio
203256 256 32
204-
205Note: # of this elements is one fewer than number of zones. Because the highest
206 zone's value is not necessary for following calculation.
207
208But, these values are not used directly. The kernel calculates # of protection
209pages for each zones from them. These are shown as array of protection pages
210in /proc/zoneinfo like followings. (This is an example of x86-64 box).
211Each zone has an array of protection pages like this.
212
213-
214Node 0, zone DMA
215 pages free 1355
216 min 3
217 low 3
218 high 4
219 :
220 :
221 numa_other 0
222 protection: (0, 2004, 2004, 2004)
223 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
224 pagesets
225 cpu: 0 pcp: 0
226 :
227-
228These protections are added to score to judge whether this zone should be used
229for page allocation or should be reclaimed.
230
231In this example, if normal pages (index=2) are required to this DMA zone and
232pages_high is used for watermark, the kernel judges this zone should not be
233used because pages_free(1355) is smaller than watermark + protection[2]
234(4 + 2004 = 2008). If this protection value is 0, this zone would be used for
235normal page requirement. If requirement is DMA zone(index=0), protection[0]
236(=0) is used.
237
238zone[i]'s protection[j] is calculated by following expression.
239
240(i < j):
241 zone[i]->protection[j]
242 = (total sums of present_pages from zone[i+1] to zone[j] on the node)
243 / lowmem_reserve_ratio[i];
244(i = j):
245 (should not be protected. = 0;
246(i > j):
247 (not necessary, but looks 0)
248
249The default values of lowmem_reserve_ratio[i] are
250 256 (if zone[i] means DMA or DMA32 zone)
251 32 (others).
252As above expression, they are reciprocal number of ratio.
253256 means 1/256. # of protection pages becomes about "0.39%" of total present
254pages of higher zones on the node.
255
256If you would like to protect more pages, smaller values are effective.
257The minimum value is 1 (1/1 -> 100%).
163 258
164It may be beneficial to switch off zone reclaim if the system is 259==============================================================
165used for a file server and all of memory should be used for caching files
166from disk. In that case the caching effect is more important than
167data locality.
168 260
169Allowing zone reclaim to write out pages stops processes that are 261max_map_count:
170writing large amounts of data from dirtying pages on other nodes. Zone
171reclaim will write out dirty pages if a zone fills up and so effectively
172throttle the process. This may decrease the performance of a single process
173since it cannot use all of system memory to buffer the outgoing writes
174anymore but it preserve the memory on other nodes so that the performance
175of other processes running on other nodes will not be affected.
176 262
177Allowing regular swap effectively restricts allocations to the local 263This file contains the maximum number of memory map areas a process
178node unless explicitly overridden by memory policies or cpuset 264may have. Memory map areas are used as a side-effect of calling
179configurations. 265malloc, directly by mmap and mprotect, and also when loading shared
266libraries.
180 267
181============================================================= 268While most applications need less than a thousand maps, certain
269programs, particularly malloc debuggers, may consume lots of them,
270e.g., up to one or two maps per allocation.
182 271
183min_unmapped_ratio: 272The default value is 65536.
184 273
185This is available only on NUMA kernels. 274==============================================================
186 275
187A percentage of the total pages in each zone. Zone reclaim will only 276min_free_kbytes:
188occur if more than this percentage of pages are file backed and unmapped.
189This is to insure that a minimal amount of local pages is still available for
190file I/O even if the node is overallocated.
191 277
192The default is 1 percent. 278This is used to force the Linux VM to keep a minimum number
279of kilobytes free. The VM uses this number to compute a pages_min
280value for each lowmem zone in the system. Each lowmem zone gets
281a number of reserved free pages based proportionally on its size.
282
283Some minimal amount of memory is needed to satisfy PF_MEMALLOC
284allocations; if you set this to lower than 1024KB, your system will
285become subtly broken, and prone to deadlock under high loads.
286
287Setting this too high will OOM your machine instantly.
193 288
194============================================================= 289=============================================================
195 290
@@ -211,82 +306,73 @@ and may not be fast.
211 306
212============================================================= 307=============================================================
213 308
214panic_on_oom 309min_unmapped_ratio:
215 310
216This enables or disables panic on out-of-memory feature. 311This is available only on NUMA kernels.
217 312
218If this is set to 0, the kernel will kill some rogue process, 313A percentage of the total pages in each zone. Zone reclaim will only
219called oom_killer. Usually, oom_killer can kill rogue processes and 314occur if more than this percentage of pages are file backed and unmapped.
220system will survive. 315This is to insure that a minimal amount of local pages is still available for
316file I/O even if the node is overallocated.
221 317
222If this is set to 1, the kernel panics when out-of-memory happens. 318The default is 1 percent.
223However, if a process limits using nodes by mempolicy/cpusets,
224and those nodes become memory exhaustion status, one process
225may be killed by oom-killer. No panic occurs in this case.
226Because other nodes' memory may be free. This means system total status
227may be not fatal yet.
228 319
229If this is set to 2, the kernel panics compulsorily even on the 320==============================================================
230above-mentioned.
231 321
232The default value is 0. 322mmap_min_addr
2331 and 2 are for failover of clustering. Please select either
234according to your policy of failover.
235 323
236============================================================= 324This file indicates the amount of address space which a user process will
325be restricted from mmaping. Since kernel null dereference bugs could
326accidentally operate based on the information in the first couple of pages
327of memory userspace processes should not be allowed to write to them. By
328default this value is set to 0 and no protections will be enforced by the
329security module. Setting this value to something like 64k will allow the
330vast majority of applications to work correctly and provide defense in depth
331against future potential kernel bugs.
237 332
238oom_dump_tasks 333==============================================================
239 334
240Enables a system-wide task dump (excluding kernel threads) to be 335nr_hugepages
241produced when the kernel performs an OOM-killing and includes such
242information as pid, uid, tgid, vm size, rss, cpu, oom_adj score, and
243name. This is helpful to determine why the OOM killer was invoked
244and to identify the rogue task that caused it.
245 336
246If this is set to zero, this information is suppressed. On very 337Change the minimum size of the hugepage pool.
247large systems with thousands of tasks it may not be feasible to dump
248the memory state information for each one. Such systems should not
249be forced to incur a performance penalty in OOM conditions when the
250information may not be desired.
251 338
252If this is set to non-zero, this information is shown whenever the 339See Documentation/vm/hugetlbpage.txt
253OOM killer actually kills a memory-hogging task.
254 340
255The default value is 0. 341==============================================================
256 342
257============================================================= 343nr_overcommit_hugepages
258 344
259oom_kill_allocating_task 345Change the maximum size of the hugepage pool. The maximum is
346nr_hugepages + nr_overcommit_hugepages.
260 347
261This enables or disables killing the OOM-triggering task in 348See Documentation/vm/hugetlbpage.txt
262out-of-memory situations.
263 349
264If this is set to zero, the OOM killer will scan through the entire 350==============================================================
265tasklist and select a task based on heuristics to kill. This normally
266selects a rogue memory-hogging task that frees up a large amount of
267memory when killed.
268 351
269If this is set to non-zero, the OOM killer simply kills the task that 352nr_pdflush_threads
270triggered the out-of-memory condition. This avoids the expensive
271tasklist scan.
272 353
273If panic_on_oom is selected, it takes precedence over whatever value 354The current number of pdflush threads. This value is read-only.
274is used in oom_kill_allocating_task. 355The value changes according to the number of dirty pages in the system.
275 356
276The default value is 0. 357When neccessary, additional pdflush threads are created, one per second, up to
358nr_pdflush_threads_max.
277 359
278============================================================== 360==============================================================
279 361
280mmap_min_addr 362nr_trim_pages
281 363
282This file indicates the amount of address space which a user process will 364This is available only on NOMMU kernels.
283be restricted from mmaping. Since kernel null dereference bugs could 365
284accidentally operate based on the information in the first couple of pages 366This value adjusts the excess page trimming behaviour of power-of-2 aligned
285of memory userspace processes should not be allowed to write to them. By 367NOMMU mmap allocations.
286default this value is set to 0 and no protections will be enforced by the 368
287security module. Setting this value to something like 64k will allow the 369A value of 0 disables trimming of allocations entirely, while a value of 1
288vast majority of applications to work correctly and provide defense in depth 370trims excess pages aggressively. Any value >= 1 acts as the watermark where
289against future potential kernel bugs. 371trimming of allocations is initiated.
372
373The default value is 1.
374
375See Documentation/nommu-mmap.txt for more information.
290 376
291============================================================== 377==============================================================
292 378
@@ -335,34 +421,199 @@ this is causing problems for your system/application.
335 421
336============================================================== 422==============================================================
337 423
338nr_hugepages 424oom_dump_tasks
339 425
340Change the minimum size of the hugepage pool. 426Enables a system-wide task dump (excluding kernel threads) to be
427produced when the kernel performs an OOM-killing and includes such
428information as pid, uid, tgid, vm size, rss, cpu, oom_adj score, and
429name. This is helpful to determine why the OOM killer was invoked
430and to identify the rogue task that caused it.
341 431
342See Documentation/vm/hugetlbpage.txt 432If this is set to zero, this information is suppressed. On very
433large systems with thousands of tasks it may not be feasible to dump
434the memory state information for each one. Such systems should not
435be forced to incur a performance penalty in OOM conditions when the
436information may not be desired.
437
438If this is set to non-zero, this information is shown whenever the
439OOM killer actually kills a memory-hogging task.
440
441The default value is 0.
343 442
344============================================================== 443==============================================================
345 444
346nr_overcommit_hugepages 445oom_kill_allocating_task
347 446
348Change the maximum size of the hugepage pool. The maximum is 447This enables or disables killing the OOM-triggering task in
349nr_hugepages + nr_overcommit_hugepages. 448out-of-memory situations.
350 449
351See Documentation/vm/hugetlbpage.txt 450If this is set to zero, the OOM killer will scan through the entire
451tasklist and select a task based on heuristics to kill. This normally
452selects a rogue memory-hogging task that frees up a large amount of
453memory when killed.
454
455If this is set to non-zero, the OOM killer simply kills the task that
456triggered the out-of-memory condition. This avoids the expensive
457tasklist scan.
458
459If panic_on_oom is selected, it takes precedence over whatever value
460is used in oom_kill_allocating_task.
461
462The default value is 0.
352 463
353============================================================== 464==============================================================
354 465
355nr_trim_pages 466overcommit_memory:
356 467
357This is available only on NOMMU kernels. 468This value contains a flag that enables memory overcommitment.
358 469
359This value adjusts the excess page trimming behaviour of power-of-2 aligned 470When this flag is 0, the kernel attempts to estimate the amount
360NOMMU mmap allocations. 471of free memory left when userspace requests more memory.
361 472
362A value of 0 disables trimming of allocations entirely, while a value of 1 473When this flag is 1, the kernel pretends there is always enough
363trims excess pages aggressively. Any value >= 1 acts as the watermark where 474memory until it actually runs out.
364trimming of allocations is initiated.
365 475
366The default value is 1. 476When this flag is 2, the kernel uses a "never overcommit"
477policy that attempts to prevent any overcommit of memory.
367 478
368See Documentation/nommu-mmap.txt for more information. 479This feature can be very useful because there are a lot of
480programs that malloc() huge amounts of memory "just-in-case"
481and don't use much of it.
482
483The default value is 0.
484
485See Documentation/vm/overcommit-accounting and
486security/commoncap.c::cap_vm_enough_memory() for more information.
487
488==============================================================
489
490overcommit_ratio:
491
492When overcommit_memory is set to 2, the committed address
493space is not permitted to exceed swap plus this percentage
494of physical RAM. See above.
495
496==============================================================
497
498page-cluster
499
500page-cluster controls the number of pages which are written to swap in
501a single attempt. The swap I/O size.
502
503It is a logarithmic value - setting it to zero means "1 page", setting
504it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
505
506The default value is three (eight pages at a time). There may be some
507small benefits in tuning this to a different value if your workload is
508swap-intensive.
509
510=============================================================
511
512panic_on_oom
513
514This enables or disables panic on out-of-memory feature.
515
516If this is set to 0, the kernel will kill some rogue process,
517called oom_killer. Usually, oom_killer can kill rogue processes and
518system will survive.
519
520If this is set to 1, the kernel panics when out-of-memory happens.
521However, if a process limits using nodes by mempolicy/cpusets,
522and those nodes become memory exhaustion status, one process
523may be killed by oom-killer. No panic occurs in this case.
524Because other nodes' memory may be free. This means system total status
525may be not fatal yet.
526
527If this is set to 2, the kernel panics compulsorily even on the
528above-mentioned.
529
530The default value is 0.
5311 and 2 are for failover of clustering. Please select either
532according to your policy of failover.
533
534=============================================================
535
536percpu_pagelist_fraction
537
538This is the fraction of pages at most (high mark pcp->high) in each zone that
539are allocated for each per cpu page list. The min value for this is 8. It
540means that we don't allow more than 1/8th of pages in each zone to be
541allocated in any single per_cpu_pagelist. This entry only changes the value
542of hot per cpu pagelists. User can specify a number like 100 to allocate
5431/100th of each zone to each per cpu page list.
544
545The batch value of each per cpu pagelist is also updated as a result. It is
546set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
547
548The initial value is zero. Kernel does not use this value at boot time to set
549the high water marks for each per cpu page list.
550
551==============================================================
552
553stat_interval
554
555The time interval between which vm statistics are updated. The default
556is 1 second.
557
558==============================================================
559
560swappiness
561
562This control is used to define how aggressive the kernel will swap
563memory pages. Higher values will increase agressiveness, lower values
564descrease the amount of swap.
565
566The default value is 60.
567
568==============================================================
569
570vfs_cache_pressure
571------------------
572
573Controls the tendency of the kernel to reclaim the memory which is used for
574caching of directory and inode objects.
575
576At the default value of vfs_cache_pressure=100 the kernel will attempt to
577reclaim dentries and inodes at a "fair" rate with respect to pagecache and
578swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer
579to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100
580causes the kernel to prefer to reclaim dentries and inodes.
581
582==============================================================
583
584zone_reclaim_mode:
585
586Zone_reclaim_mode allows someone to set more or less aggressive approaches to
587reclaim memory when a zone runs out of memory. If it is set to zero then no
588zone reclaim occurs. Allocations will be satisfied from other zones / nodes
589in the system.
590
591This is value ORed together of
592
5931 = Zone reclaim on
5942 = Zone reclaim writes dirty pages out
5954 = Zone reclaim swaps pages
596
597zone_reclaim_mode is set during bootup to 1 if it is determined that pages
598from remote zones will cause a measurable performance reduction. The
599page allocator will then reclaim easily reusable pages (those page
600cache pages that are currently not used) before allocating off node pages.
601
602It may be beneficial to switch off zone reclaim if the system is
603used for a file server and all of memory should be used for caching files
604from disk. In that case the caching effect is more important than
605data locality.
606
607Allowing zone reclaim to write out pages stops processes that are
608writing large amounts of data from dirtying pages on other nodes. Zone
609reclaim will write out dirty pages if a zone fills up and so effectively
610throttle the process. This may decrease the performance of a single process
611since it cannot use all of system memory to buffer the outgoing writes
612anymore but it preserve the memory on other nodes so that the performance
613of other processes running on other nodes will not be affected.
614
615Allowing regular swap effectively restricts allocations to the local
616node unless explicitly overridden by memory policies or cpuset
617configurations.
618
619============ End of Document =================================
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 10a0263ebb3f..9e592c718afb 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -1,6 +1,5 @@
1Linux Magic System Request Key Hacks 1Linux Magic System Request Key Hacks
2Documentation for sysrq.c 2Documentation for sysrq.c
3Last update: 2007-AUG-04
4 3
5* What is the magic SysRq key? 4* What is the magic SysRq key?
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -211,6 +210,24 @@ within a function called by handle_sysrq, you must be aware that you are in
211a lock (you are also in an interrupt handler, which means don't sleep!), so 210a lock (you are also in an interrupt handler, which means don't sleep!), so
212you must call __handle_sysrq_nolock instead. 211you must call __handle_sysrq_nolock instead.
213 212
213* When I hit a SysRq key combination only the header appears on the console?
214~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215Sysrq output is subject to the same console loglevel control as all
216other console output. This means that if the kernel was booted 'quiet'
217as is common on distro kernels the output may not appear on the actual
218console, even though it will appear in the dmesg buffer, and be accessible
219via the dmesg command and to the consumers of /proc/kmsg. As a specific
220exception the header line from the sysrq command is passed to all console
221consumers as if the current loglevel was maximum. If only the header
222is emitted it is almost certain that the kernel loglevel is too low.
223Should you require the output on the console channel then you will need
224to temporarily up the console loglevel using alt-sysrq-8 or:
225
226 echo 8 > /proc/sysrq-trigger
227
228Remember to return the loglevel to normal after triggering the sysrq
229command you are interested in.
230
214* I have more questions, who can I ask? 231* I have more questions, who can I ask?
215~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 232~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216And I'll answer any questions about the registration system you got, also 233And I'll answer any questions about the registration system you got, also
diff --git a/MAINTAINERS b/MAINTAINERS
index 6f65a269cb17..3fe4dc2c2564 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1581,6 +1581,13 @@ L: bluesmoke-devel@lists.sourceforge.net
1581W: bluesmoke.sourceforge.net 1581W: bluesmoke.sourceforge.net
1582S: Maintained 1582S: Maintained
1583 1583
1584EDAC-I5400
1585P: Mauro Carvalho Chehab
1586M: mchehab@redhat.com
1587L: bluesmoke-devel@lists.sourceforge.net
1588W: bluesmoke.sourceforge.net
1589S: Maintained
1590
1584EDAC-I82975X 1591EDAC-I82975X
1585P: Ranganathan Desikan 1592P: Ranganathan Desikan
1586P: Arvind R. 1593P: Arvind R.
@@ -1814,6 +1821,14 @@ M: hch@infradead.org
1814W: ftp://ftp.openlinux.org/pub/people/hch/vxfs 1821W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
1815S: Maintained 1822S: Maintained
1816 1823
1824FREEZER
1825P: Pavel Machek
1826M: pavel@suse.cz
1827P: Rafael J. Wysocki
1828M: rjw@sisk.pl
1829L: linux-pm@lists.linux-foundation.org
1830S: Supported
1831
1817FTRACE 1832FTRACE
1818P: Steven Rostedt 1833P: Steven Rostedt
1819M: rostedt@goodmis.org 1834M: rostedt@goodmis.org
@@ -4842,11 +4857,11 @@ S: Supported
4842 4857
4843XFS FILESYSTEM 4858XFS FILESYSTEM
4844P: Silicon Graphics Inc 4859P: Silicon Graphics Inc
4845P: Tim Shimmin 4860P: Bill O'Donnell
4846M: xfs-masters@oss.sgi.com 4861M: xfs-masters@oss.sgi.com
4847L: xfs@oss.sgi.com 4862L: xfs@oss.sgi.com
4848W: http://oss.sgi.com/projects/xfs 4863W: http://oss.sgi.com/projects/xfs
4849T: git git://oss.sgi.com:8090/xfs/xfs-2.6.git 4864T: git://oss.sgi.com/xfs/xfs.git
4850S: Supported 4865S: Supported
4851 4866
4852XILINX SYSTEMACE DRIVER 4867XILINX SYSTEMACE DRIVER
diff --git a/arch/Kconfig b/arch/Kconfig
index 2e13aa261929..550dab22daa1 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -62,6 +62,9 @@ config HAVE_EFFICIENT_UNALIGNED_ACCESS
62 See Documentation/unaligned-memory-access.txt for more 62 See Documentation/unaligned-memory-access.txt for more
63 information on the topic of unaligned memory accesses. 63 information on the topic of unaligned memory accesses.
64 64
65config HAVE_SYSCALL_WRAPPERS
66 bool
67
65config KRETPROBES 68config KRETPROBES
66 def_bool y 69 def_bool y
67 depends on KPROBES && HAVE_KRETPROBES 70 depends on KPROBES && HAVE_KRETPROBES
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index 4dad27360576..b7c8f188b313 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -9,4 +9,3 @@ unifdef-y += console.h
9unifdef-y += fpu.h 9unifdef-y += fpu.h
10unifdef-y += sysinfo.h 10unifdef-y += sysinfo.h
11unifdef-y += compiler.h 11unifdef-y += compiler.h
12unifdef-y += swab.h
diff --git a/arch/alpha/include/asm/byteorder.h b/arch/alpha/include/asm/byteorder.h
index 6772f3168701..73683093202d 100644
--- a/arch/alpha/include/asm/byteorder.h
+++ b/arch/alpha/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ALPHA_BYTEORDER_H 1#ifndef _ALPHA_BYTEORDER_H
2#define _ALPHA_BYTEORDER_H 2#define _ALPHA_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ALPHA_BYTEORDER_H */ 6#endif /* _ALPHA_BYTEORDER_H */
diff --git a/arch/alpha/include/asm/machvec.h b/arch/alpha/include/asm/machvec.h
index a86c083cdf7f..fea4ea75b79d 100644
--- a/arch/alpha/include/asm/machvec.h
+++ b/arch/alpha/include/asm/machvec.h
@@ -21,6 +21,7 @@ struct pci_dev;
21struct pci_ops; 21struct pci_ops;
22struct pci_controller; 22struct pci_controller;
23struct _alpha_agp_info; 23struct _alpha_agp_info;
24struct rtc_time;
24 25
25struct alpha_machine_vector 26struct alpha_machine_vector
26{ 27{
@@ -94,6 +95,9 @@ struct alpha_machine_vector
94 95
95 struct _alpha_agp_info *(*agp_info)(void); 96 struct _alpha_agp_info *(*agp_info)(void);
96 97
98 unsigned int (*rtc_get_time)(struct rtc_time *);
99 int (*rtc_set_time)(struct rtc_time *);
100
97 const char *vector_name; 101 const char *vector_name;
98 102
99 /* NUMA information */ 103 /* NUMA information */
diff --git a/arch/alpha/include/asm/pgalloc.h b/arch/alpha/include/asm/pgalloc.h
index fd090155dccd..bc2a0daf2d92 100644
--- a/arch/alpha/include/asm/pgalloc.h
+++ b/arch/alpha/include/asm/pgalloc.h
@@ -50,7 +50,12 @@ pmd_free(struct mm_struct *mm, pmd_t *pmd)
50 free_page((unsigned long)pmd); 50 free_page((unsigned long)pmd);
51} 51}
52 52
53extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 53static inline pte_t *
54pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
55{
56 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
57 return pte;
58}
54 59
55static inline void 60static inline void
56pte_free_kernel(struct mm_struct *mm, pte_t *pte) 61pte_free_kernel(struct mm_struct *mm, pte_t *pte)
diff --git a/arch/alpha/include/asm/rtc.h b/arch/alpha/include/asm/rtc.h
index 4e854b1333eb..1f7fba671ae6 100644
--- a/arch/alpha/include/asm/rtc.h
+++ b/arch/alpha/include/asm/rtc.h
@@ -1,9 +1,15 @@
1#ifndef _ALPHA_RTC_H 1#ifndef _ALPHA_RTC_H
2#define _ALPHA_RTC_H 2#define _ALPHA_RTC_H
3 3
4/* 4#if defined(CONFIG_ALPHA_GENERIC)
5 * Alpha uses the default access methods for the RTC. 5# define get_rtc_time alpha_mv.rtc_get_time
6 */ 6# define set_rtc_time alpha_mv.rtc_set_time
7#else
8# if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP)
9# define get_rtc_time marvel_get_rtc_time
10# define set_rtc_time marvel_set_rtc_time
11# endif
12#endif
7 13
8#include <asm-generic/rtc.h> 14#include <asm-generic/rtc.h>
9 15
diff --git a/arch/alpha/kernel/.gitignore b/arch/alpha/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/alpha/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
index 9cd8dca742a7..e302daecbe56 100644
--- a/arch/alpha/kernel/core_marvel.c
+++ b/arch/alpha/kernel/core_marvel.c
@@ -658,16 +658,8 @@ __marvel_rtc_io(u8 b, unsigned long addr, int write)
658 rtc_access.data = bcd2bin(b); 658 rtc_access.data = bcd2bin(b);
659 rtc_access.function = 0x48 + !write; /* GET/PUT_TOY */ 659 rtc_access.function = 0x48 + !write; /* GET/PUT_TOY */
660 660
661#ifdef CONFIG_SMP
662 if (smp_processor_id() != boot_cpuid)
663 smp_call_function_single(boot_cpuid,
664 __marvel_access_rtc,
665 &rtc_access, 1);
666 else
667 __marvel_access_rtc(&rtc_access);
668#else
669 __marvel_access_rtc(&rtc_access); 661 __marvel_access_rtc(&rtc_access);
670#endif 662
671 ret = bin2bcd(rtc_access.data); 663 ret = bin2bcd(rtc_access.data);
672 break; 664 break;
673 665
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index f77345bc66a9..aa2e50cf9857 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -896,9 +896,9 @@ sys_getxpid:
896.end sys_getxpid 896.end sys_getxpid
897 897
898 .align 4 898 .align 4
899 .globl sys_pipe 899 .globl sys_alpha_pipe
900 .ent sys_pipe 900 .ent sys_alpha_pipe
901sys_pipe: 901sys_alpha_pipe:
902 lda $sp, -16($sp) 902 lda $sp, -16($sp)
903 stq $26, 0($sp) 903 stq $26, 0($sp)
904 .prologue 0 904 .prologue 0
@@ -916,7 +916,7 @@ sys_pipe:
916 stq $1, 80+16($sp) 916 stq $1, 80+16($sp)
9171: lda $sp, 16($sp) 9171: lda $sp, 16($sp)
918 ret 918 ret
919.end sys_pipe 919.end sys_alpha_pipe
920 920
921 .align 4 921 .align 4
922 .globl sys_execve 922 .globl sys_execve
diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c
index 32212014fbe9..a03fbca4940e 100644
--- a/arch/alpha/kernel/irq_srm.c
+++ b/arch/alpha/kernel/irq_srm.c
@@ -63,6 +63,8 @@ init_srm_irqs(long max, unsigned long ignore_mask)
63{ 63{
64 long i; 64 long i;
65 65
66 if (NR_IRQS <= 16)
67 return;
66 for (i = 16; i < max; ++i) { 68 for (i = 16; i < max; ++i) {
67 if (i < 64 && ((ignore_mask >> i) & 1)) 69 if (i < 64 && ((ignore_mask >> i) & 1))
68 continue; 70 continue;
diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
index 466c9dff8181..512685f78097 100644
--- a/arch/alpha/kernel/machvec_impl.h
+++ b/arch/alpha/kernel/machvec_impl.h
@@ -40,7 +40,10 @@
40#define CAT1(x,y) x##y 40#define CAT1(x,y) x##y
41#define CAT(x,y) CAT1(x,y) 41#define CAT(x,y) CAT1(x,y)
42 42
43#define DO_DEFAULT_RTC .rtc_port = 0x70 43#define DO_DEFAULT_RTC \
44 .rtc_port = 0x70, \
45 .rtc_get_time = common_get_rtc_time, \
46 .rtc_set_time = common_set_rtc_time
44 47
45#define DO_EV4_MMU \ 48#define DO_EV4_MMU \
46 .max_asn = EV4_MAX_ASN, \ 49 .max_asn = EV4_MAX_ASN, \
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
index 708d5ca87782..fe14c6747cd6 100644
--- a/arch/alpha/kernel/proto.h
+++ b/arch/alpha/kernel/proto.h
@@ -145,6 +145,8 @@ extern void smp_percpu_timer_interrupt(struct pt_regs *);
145extern irqreturn_t timer_interrupt(int irq, void *dev); 145extern irqreturn_t timer_interrupt(int irq, void *dev);
146extern void common_init_rtc(void); 146extern void common_init_rtc(void);
147extern unsigned long est_cycle_freq; 147extern unsigned long est_cycle_freq;
148extern unsigned int common_get_rtc_time(struct rtc_time *time);
149extern int common_set_rtc_time(struct rtc_time *time);
148 150
149/* smc37c93x.c */ 151/* smc37c93x.c */
150extern void SMC93x_Init(void); 152extern void SMC93x_Init(void);
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c
index 2c3de97de46c..e2516f9a8967 100644
--- a/arch/alpha/kernel/sys_jensen.c
+++ b/arch/alpha/kernel/sys_jensen.c
@@ -261,6 +261,8 @@ struct alpha_machine_vector jensen_mv __initmv = {
261 .machine_check = jensen_machine_check, 261 .machine_check = jensen_machine_check,
262 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, 262 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
263 .rtc_port = 0x170, 263 .rtc_port = 0x170,
264 .rtc_get_time = common_get_rtc_time,
265 .rtc_set_time = common_set_rtc_time,
264 266
265 .nr_irqs = 16, 267 .nr_irqs = 16,
266 .device_interrupt = jensen_device_interrupt, 268 .device_interrupt = jensen_device_interrupt,
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 828449cd2636..c5a1a2438c67 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -23,6 +23,7 @@
23#include <asm/hwrpb.h> 23#include <asm/hwrpb.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/vga.h> 25#include <asm/vga.h>
26#include <asm/rtc.h>
26 27
27#include "proto.h" 28#include "proto.h"
28#include "err_impl.h" 29#include "err_impl.h"
@@ -426,6 +427,57 @@ marvel_init_rtc(void)
426 init_rtc_irq(); 427 init_rtc_irq();
427} 428}
428 429
430struct marvel_rtc_time {
431 struct rtc_time *time;
432 int retval;
433};
434
435#ifdef CONFIG_SMP
436static void
437smp_get_rtc_time(void *data)
438{
439 struct marvel_rtc_time *mrt = data;
440 mrt->retval = __get_rtc_time(mrt->time);
441}
442
443static void
444smp_set_rtc_time(void *data)
445{
446 struct marvel_rtc_time *mrt = data;
447 mrt->retval = __set_rtc_time(mrt->time);
448}
449#endif
450
451static unsigned int
452marvel_get_rtc_time(struct rtc_time *time)
453{
454#ifdef CONFIG_SMP
455 struct marvel_rtc_time mrt;
456
457 if (smp_processor_id() != boot_cpuid) {
458 mrt.time = time;
459 smp_call_function_single(boot_cpuid, smp_get_rtc_time, &mrt, 1);
460 return mrt.retval;
461 }
462#endif
463 return __get_rtc_time(time);
464}
465
466static int
467marvel_set_rtc_time(struct rtc_time *time)
468{
469#ifdef CONFIG_SMP
470 struct marvel_rtc_time mrt;
471
472 if (smp_processor_id() != boot_cpuid) {
473 mrt.time = time;
474 smp_call_function_single(boot_cpuid, smp_set_rtc_time, &mrt, 1);
475 return mrt.retval;
476 }
477#endif
478 return __set_rtc_time(time);
479}
480
429static void 481static void
430marvel_smp_callin(void) 482marvel_smp_callin(void)
431{ 483{
@@ -466,7 +518,9 @@ marvel_smp_callin(void)
466struct alpha_machine_vector marvel_ev7_mv __initmv = { 518struct alpha_machine_vector marvel_ev7_mv __initmv = {
467 .vector_name = "MARVEL/EV7", 519 .vector_name = "MARVEL/EV7",
468 DO_EV7_MMU, 520 DO_EV7_MMU,
469 DO_DEFAULT_RTC, 521 .rtc_port = 0x70,
522 .rtc_get_time = marvel_get_rtc_time,
523 .rtc_set_time = marvel_set_rtc_time,
470 DO_MARVEL_IO, 524 DO_MARVEL_IO,
471 .machine_check = marvel_machine_check, 525 .machine_check = marvel_machine_check,
472 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS, 526 .max_isa_dma_address = ALPHA_MAX_ISA_DMA_ADDRESS,
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index a7f23b5ab814..99c0f46f6b9c 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -245,6 +245,10 @@ nautilus_init_pci(void)
245 IRONGATE0->pci_mem = pci_mem; 245 IRONGATE0->pci_mem = pci_mem;
246 246
247 pci_bus_assign_resources(bus); 247 pci_bus_assign_resources(bus);
248
249 /* pci_common_swizzle() relies on bus->self being NULL
250 for the root bus, so just clear it. */
251 bus->self = NULL;
248 pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); 252 pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
249} 253}
250 254
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index ba914af18c4f..9d9e3a98bb95 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -52,7 +52,7 @@ sys_call_table:
52 .quad sys_setpgid 52 .quad sys_setpgid
53 .quad alpha_ni_syscall /* 40 */ 53 .quad alpha_ni_syscall /* 40 */
54 .quad sys_dup 54 .quad sys_dup
55 .quad sys_pipe 55 .quad sys_alpha_pipe
56 .quad osf_set_program_attributes 56 .quad osf_set_program_attributes
57 .quad alpha_ni_syscall 57 .quad alpha_ni_syscall
58 .quad sys_open /* 45 */ 58 .quad sys_open /* 45 */
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index e6a231435cba..b04e2cbf23a4 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -46,6 +46,7 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/hwrpb.h> 47#include <asm/hwrpb.h>
48#include <asm/8253pit.h> 48#include <asm/8253pit.h>
49#include <asm/rtc.h>
49 50
50#include <linux/mc146818rtc.h> 51#include <linux/mc146818rtc.h>
51#include <linux/time.h> 52#include <linux/time.h>
@@ -180,6 +181,15 @@ common_init_rtc(void)
180 init_rtc_irq(); 181 init_rtc_irq();
181} 182}
182 183
184unsigned int common_get_rtc_time(struct rtc_time *time)
185{
186 return __get_rtc_time(time);
187}
188
189int common_set_rtc_time(struct rtc_time *time)
190{
191 return __set_rtc_time(time);
192}
183 193
184/* Validate a computed cycle counter result against the known bounds for 194/* Validate a computed cycle counter result against the known bounds for
185 the given processor core. There's too much brokenness in the way of 195 the given processor core. There's too much brokenness in the way of
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 234e42b8ee74..5d7a16eab312 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -59,13 +59,6 @@ pgd_alloc(struct mm_struct *mm)
59 return ret; 59 return ret;
60} 60}
61 61
62pte_t *
63pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
64{
65 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
66 return pte;
67}
68
69 62
70/* 63/*
71 * BAD_PAGE is the page that is used for page faults when linux 64 * BAD_PAGE is the page that is used for page faults when linux
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 43b0b2ba392f..73237bd130a2 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += hwcap.h 3unifdef-y += hwcap.h
4unifdef-y += swab.h
diff --git a/arch/arm/include/asm/byteorder.h b/arch/arm/include/asm/byteorder.h
index c02b6fc28e1a..77379748b171 100644
--- a/arch/arm/include/asm/byteorder.h
+++ b/arch/arm/include/asm/byteorder.h
@@ -15,8 +15,6 @@
15#ifndef __ASM_ARM_BYTEORDER_H 15#ifndef __ASM_ARM_BYTEORDER_H
16#define __ASM_ARM_BYTEORDER_H 16#define __ASM_ARM_BYTEORDER_H
17 17
18#include <asm/swab.h>
19
20#ifdef __ARMEB__ 18#ifdef __ARMEB__
21#include <linux/byteorder/big_endian.h> 19#include <linux/byteorder/big_endian.h>
22#else 20#else
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 09a061cb7838..9ca8d13f05f7 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -98,7 +98,7 @@
98 CALL(sys_uselib) 98 CALL(sys_uselib)
99 CALL(sys_swapon) 99 CALL(sys_swapon)
100 CALL(sys_reboot) 100 CALL(sys_reboot)
101 CALL(OBSOLETE(old_readdir)) /* used by libc4 */ 101 CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */
102/* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */ 102/* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */
103 CALL(sys_munmap) 103 CALL(sys_munmap)
104 CALL(sys_truncate) 104 CALL(sys_truncate)
diff --git a/arch/arm/mach-imx/clock.c b/arch/arm/mach-imx/clock.c
index 7ec60fc91565..cf332aeb942e 100644
--- a/arch/arm/mach-imx/clock.c
+++ b/arch/arm/mach-imx/clock.c
@@ -23,7 +23,7 @@
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <mach/imx-regs.h> 26#include <mach/hardware.h>
27 27
28/* 28/*
29 * Very simple approach: We can't disable clocks, so we do 29 * Very simple approach: We can't disable clocks, so we do
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index fa72174dd95c..887cb21f75b0 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -245,11 +245,11 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data *info)
245 imx_mmc_device.dev.platform_data = info; 245 imx_mmc_device.dev.platform_data = info;
246} 246}
247 247
248static struct imxfb_mach_info imx_fb_info; 248static struct imx_fb_platform_data imx_fb_info;
249 249
250void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info) 250void __init set_imx_fb_info(struct imx_fb_platform_data *hard_imx_fb_info)
251{ 251{
252 memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info)); 252 memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imx_fb_platform_data));
253} 253}
254 254
255static struct resource imxfb_resources[] = { 255static struct resource imxfb_resources[] = {
diff --git a/arch/arm/mach-imx/include/mach/imx-regs.h b/arch/arm/mach-imx/include/mach/imx-regs.h
index fb9de2733879..490297fc0e38 100644
--- a/arch/arm/mach-imx/include/mach/imx-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx-regs.h
@@ -373,110 +373,4 @@
373#define TSTAT_CAPT (1<<1) 373#define TSTAT_CAPT (1<<1)
374#define TSTAT_COMP (1<<0) 374#define TSTAT_COMP (1<<0)
375 375
376/*
377 * LCD Controller
378 */
379
380#define LCDC_SSA __REG(IMX_LCDC_BASE+0x00)
381
382#define LCDC_SIZE __REG(IMX_LCDC_BASE+0x04)
383#define SIZE_XMAX(x) ((((x) >> 4) & 0x3f) << 20)
384#define SIZE_YMAX(y) ( (y) & 0x1ff )
385
386#define LCDC_VPW __REG(IMX_LCDC_BASE+0x08)
387#define VPW_VPW(x) ( (x) & 0x3ff )
388
389#define LCDC_CPOS __REG(IMX_LCDC_BASE+0x0C)
390#define CPOS_CC1 (1<<31)
391#define CPOS_CC0 (1<<30)
392#define CPOS_OP (1<<28)
393#define CPOS_CXP(x) (((x) & 3ff) << 16)
394#define CPOS_CYP(y) ((y) & 0x1ff)
395
396#define LCDC_LCWHB __REG(IMX_LCDC_BASE+0x10)
397#define LCWHB_BK_EN (1<<31)
398#define LCWHB_CW(w) (((w) & 0x1f) << 24)
399#define LCWHB_CH(h) (((h) & 0x1f) << 16)
400#define LCWHB_BD(x) ((x) & 0xff)
401
402#define LCDC_LCHCC __REG(IMX_LCDC_BASE+0x14)
403#define LCHCC_CUR_COL_R(r) (((r) & 0x1f) << 11)
404#define LCHCC_CUR_COL_G(g) (((g) & 0x3f) << 5)
405#define LCHCC_CUR_COL_B(b) ((b) & 0x1f)
406
407#define LCDC_PCR __REG(IMX_LCDC_BASE+0x18)
408#define PCR_TFT (1<<31)
409#define PCR_COLOR (1<<30)
410#define PCR_PBSIZ_1 (0<<28)
411#define PCR_PBSIZ_2 (1<<28)
412#define PCR_PBSIZ_4 (2<<28)
413#define PCR_PBSIZ_8 (3<<28)
414#define PCR_BPIX_1 (0<<25)
415#define PCR_BPIX_2 (1<<25)
416#define PCR_BPIX_4 (2<<25)
417#define PCR_BPIX_8 (3<<25)
418#define PCR_BPIX_12 (4<<25)
419#define PCR_BPIX_16 (4<<25)
420#define PCR_PIXPOL (1<<24)
421#define PCR_FLMPOL (1<<23)
422#define PCR_LPPOL (1<<22)
423#define PCR_CLKPOL (1<<21)
424#define PCR_OEPOL (1<<20)
425#define PCR_SCLKIDLE (1<<19)
426#define PCR_END_SEL (1<<18)
427#define PCR_END_BYTE_SWAP (1<<17)
428#define PCR_REV_VS (1<<16)
429#define PCR_ACD_SEL (1<<15)
430#define PCR_ACD(x) (((x) & 0x7f) << 8)
431#define PCR_SCLK_SEL (1<<7)
432#define PCR_SHARP (1<<6)
433#define PCR_PCD(x) ((x) & 0x3f)
434
435#define LCDC_HCR __REG(IMX_LCDC_BASE+0x1C)
436#define HCR_H_WIDTH(x) (((x) & 0x3f) << 26)
437#define HCR_H_WAIT_1(x) (((x) & 0xff) << 8)
438#define HCR_H_WAIT_2(x) ((x) & 0xff)
439
440#define LCDC_VCR __REG(IMX_LCDC_BASE+0x20)
441#define VCR_V_WIDTH(x) (((x) & 0x3f) << 26)
442#define VCR_V_WAIT_1(x) (((x) & 0xff) << 8)
443#define VCR_V_WAIT_2(x) ((x) & 0xff)
444
445#define LCDC_POS __REG(IMX_LCDC_BASE+0x24)
446#define POS_POS(x) ((x) & 1f)
447
448#define LCDC_LSCR1 __REG(IMX_LCDC_BASE+0x28)
449#define LSCR1_PS_RISE_DELAY(x) (((x) & 0x7f) << 26)
450#define LSCR1_CLS_RISE_DELAY(x) (((x) & 0x3f) << 16)
451#define LSCR1_REV_TOGGLE_DELAY(x) (((x) & 0xf) << 8)
452#define LSCR1_GRAY2(x) (((x) & 0xf) << 4)
453#define LSCR1_GRAY1(x) (((x) & 0xf))
454
455#define LCDC_PWMR __REG(IMX_LCDC_BASE+0x2C)
456#define PWMR_CLS(x) (((x) & 0x1ff) << 16)
457#define PWMR_LDMSK (1<<15)
458#define PWMR_SCR1 (1<<10)
459#define PWMR_SCR0 (1<<9)
460#define PWMR_CC_EN (1<<8)
461#define PWMR_PW(x) ((x) & 0xff)
462
463#define LCDC_DMACR __REG(IMX_LCDC_BASE+0x30)
464#define DMACR_BURST (1<<31)
465#define DMACR_HM(x) (((x) & 0xf) << 16)
466#define DMACR_TM(x) ((x) &0xf)
467
468#define LCDC_RMCR __REG(IMX_LCDC_BASE+0x34)
469#define RMCR_LCDC_EN (1<<1)
470#define RMCR_SELF_REF (1<<0)
471
472#define LCDC_LCDICR __REG(IMX_LCDC_BASE+0x38)
473#define LCDICR_INT_SYN (1<<2)
474#define LCDICR_INT_CON (1)
475
476#define LCDC_LCDISR __REG(IMX_LCDC_BASE+0x40)
477#define LCDISR_UDR_ERR (1<<3)
478#define LCDISR_ERR_RES (1<<2)
479#define LCDISR_EOF (1<<1)
480#define LCDISR_BOF (1<<0)
481
482#endif // _IMX_REGS_H 376#endif // _IMX_REGS_H
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c
index 9307a2475438..9ebc93f48530 100644
--- a/arch/arm/mach-w90x900/mach-w90p910evb.c
+++ b/arch/arm/mach-w90x900/mach-w90p910evb.c
@@ -29,6 +29,7 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30 30
31#include <mach/regs-serial.h> 31#include <mach/regs-serial.h>
32#include <mach/map.h>
32 33
33#include "cpu.h" 34#include "cpu.h"
34 35
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index 3a69e381f316..bcc838f6b393 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -28,7 +28,6 @@
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30 30
31#include <mach/system.h>
32#include <mach/map.h> 31#include <mach/map.h>
33#include <mach/regs-timer.h> 32#include <mach/regs-timer.h>
34 33
diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c
index 4ad3bf291ad3..195e48edd8c2 100644
--- a/arch/arm/mm/proc-syms.c
+++ b/arch/arm/mm/proc-syms.c
@@ -27,6 +27,7 @@ EXPORT_SYMBOL(__cpuc_flush_kern_all);
27EXPORT_SYMBOL(__cpuc_flush_user_all); 27EXPORT_SYMBOL(__cpuc_flush_user_all);
28EXPORT_SYMBOL(__cpuc_flush_user_range); 28EXPORT_SYMBOL(__cpuc_flush_user_range);
29EXPORT_SYMBOL(__cpuc_coherent_kern_range); 29EXPORT_SYMBOL(__cpuc_coherent_kern_range);
30EXPORT_SYMBOL(dmac_inv_range); /* because of flush_ioremap_region() */
30#else 31#else
31EXPORT_SYMBOL(cpu_cache); 32EXPORT_SYMBOL(cpu_cache);
32#endif 33#endif
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 219822c8ad18..3136628ba8d2 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += swab.h
4header-y += cachectl.h 3header-y += cachectl.h
diff --git a/arch/avr32/include/asm/byteorder.h b/arch/avr32/include/asm/byteorder.h
index 2aba64b4e122..50abc21619a8 100644
--- a/arch/avr32/include/asm/byteorder.h
+++ b/arch/avr32/include/asm/byteorder.h
@@ -4,7 +4,6 @@
4#ifndef __ASM_AVR32_BYTEORDER_H 4#ifndef __ASM_AVR32_BYTEORDER_H
5#define __ASM_AVR32_BYTEORDER_H 5#define __ASM_AVR32_BYTEORDER_H
6 6
7#include <asm/swab.h>
8#include <linux/byteorder/big_endian.h> 7#include <linux/byteorder/big_endian.h>
9 8
10#endif /* __ASM_AVR32_BYTEORDER_H */ 9#endif /* __ASM_AVR32_BYTEORDER_H */
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index d0d1ac435544..606ecfdcc962 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += fixed_code.h 3unifdef-y += fixed_code.h
4unifdef-y += swab.h
diff --git a/arch/blackfin/include/asm/byteorder.h b/arch/blackfin/include/asm/byteorder.h
index b9e797a497b4..3e69106a4d37 100644
--- a/arch/blackfin/include/asm/byteorder.h
+++ b/arch/blackfin/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _BLACKFIN_BYTEORDER_H 1#ifndef _BLACKFIN_BYTEORDER_H
2#define _BLACKFIN_BYTEORDER_H 2#define _BLACKFIN_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _BLACKFIN_BYTEORDER_H */ 6#endif /* _BLACKFIN_BYTEORDER_H */
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index ed171d389e65..72f5cd319b97 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -691,7 +691,7 @@ sys_call_table:
691 .long sys_uselib 691 .long sys_uselib
692 .long sys_swapon 692 .long sys_swapon
693 .long sys_reboot 693 .long sys_reboot
694 .long old_readdir 694 .long sys_old_readdir
695 .long old_mmap /* 90 */ 695 .long old_mmap /* 90 */
696 .long sys_munmap 696 .long sys_munmap
697 .long sys_truncate 697 .long sys_truncate
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index 7f6f93e6b70e..5e674c8f7c51 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -614,7 +614,7 @@ sys_call_table:
614 .long sys_uselib 614 .long sys_uselib
615 .long sys_swapon 615 .long sys_swapon
616 .long sys_reboot 616 .long sys_reboot
617 .long old_readdir 617 .long sys_old_readdir
618 .long old_mmap /* 90 */ 618 .long old_mmap /* 90 */
619 .long sys_munmap 619 .long sys_munmap
620 .long sys_truncate 620 .long sys_truncate
diff --git a/arch/cris/include/arch-v10/arch/byteorder.h b/arch/cris/include/arch-v10/arch/swab.h
index 255b646b7fa8..e4e847d8a05e 100644
--- a/arch/cris/include/arch-v10/arch/byteorder.h
+++ b/arch/cris/include/arch-v10/arch/swab.h
@@ -1,26 +1,30 @@
1#ifndef _CRIS_ARCH_BYTEORDER_H 1#ifndef _CRIS_ARCH_SWAB_H
2#define _CRIS_ARCH_BYTEORDER_H 2#define _CRIS_ARCH_SWAB_H
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#define __SWAB_64_THRU_32__
8
7/* we just define these two (as we can do the swap in a single 9/* we just define these two (as we can do the swap in a single
8 * asm instruction in CRIS) and the arch-independent files will put 10 * asm instruction in CRIS) and the arch-independent files will put
9 * them together into ntohl etc. 11 * them together into ntohl etc.
10 */ 12 */
11 13
12static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) 14static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
13{ 15{
14 __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); 16 __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
15 17
16 return(x); 18 return(x);
17} 19}
20#define __arch_swab32 __arch_swab32
18 21
19static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) 22static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
20{ 23{
21 __asm__ ("swapb %0" : "=r" (x) : "0" (x)); 24 __asm__ ("swapb %0" : "=r" (x) : "0" (x));
22 25
23 return(x); 26 return(x);
24} 27}
28#define __arch_swab16 __arch_swab16
25 29
26#endif 30#endif
diff --git a/arch/cris/include/arch-v32/arch/byteorder.h b/arch/cris/include/arch-v32/arch/byteorder.h
deleted file mode 100644
index 6ef8fb4a35f2..000000000000
--- a/arch/cris/include/arch-v32/arch/byteorder.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_CRIS_ARCH_BYTEORDER_H
2#define _ASM_CRIS_ARCH_BYTEORDER_H
3
4#include <asm/types.h>
5
6static inline __const__ __u32
7___arch__swab32(__u32 x)
8{
9 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
10 return (x);
11}
12
13static inline __const__ __u16
14___arch__swab16(__u16 x)
15{
16 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
17 return (x);
18}
19
20#endif /* _ASM_CRIS_ARCH_BYTEORDER_H */
diff --git a/arch/cris/include/arch-v32/arch/swab.h b/arch/cris/include/arch-v32/arch/swab.h
new file mode 100644
index 000000000000..9a4ea5e209c2
--- /dev/null
+++ b/arch/cris/include/arch-v32/arch/swab.h
@@ -0,0 +1,24 @@
1#ifndef _ASM_CRIS_ARCH_SWAB_H
2#define _ASM_CRIS_ARCH_SWAB_H
3
4#include <asm/types.h>
5
6#define __SWAB_64_THRU_32__
7
8static inline __const__ __u32
9__arch_swab32(__u32 x)
10{
11 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
12 return (x);
13}
14#define __arch_swab32 __arch_swab32
15
16static inline __const__ __u16
17__arch_swab16(__u16 x)
18{
19 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
20 return (x);
21}
22#define __arch_swab16 __arch_swab16
23
24#endif /* _ASM_CRIS_ARCH_SWAB_H */
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/asm/byteorder.h
index cc8e418cfd14..bcd189798e26 100644
--- a/arch/cris/include/asm/byteorder.h
+++ b/arch/cris/include/asm/byteorder.h
@@ -1,25 +1,6 @@
1#ifndef _CRIS_BYTEORDER_H 1#ifndef _CRIS_BYTEORDER_H
2#define _CRIS_BYTEORDER_H 2#define _CRIS_BYTEORDER_H
3 3
4#ifdef __GNUC__
5
6#ifdef __KERNEL__
7#include <arch/byteorder.h>
8
9/* defines are necessary because the other files detect the presence
10 * of a defined __arch_swab32, not an inline
11 */
12#define __arch__swab32(x) ___arch__swab32(x)
13#define __arch__swab16(x) ___arch__swab16(x)
14#endif /* __KERNEL__ */
15
16#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
17# define __BYTEORDER_HAS_U64__
18# define __SWAB_64_THRU_32__
19#endif
20
21#endif /* __GNUC__ */
22
23#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
24 5
25#endif 6#endif
diff --git a/arch/cris/include/asm/swab.h b/arch/cris/include/asm/swab.h
new file mode 100644
index 000000000000..80668e88419c
--- /dev/null
+++ b/arch/cris/include/asm/swab.h
@@ -0,0 +1,8 @@
1#ifndef _CRIS_SWAB_H
2#define _CRIS_SWAB_H
3
4#ifdef __KERNEL__
5#include <arch/swab.h>
6#endif /* __KERNEL__ */
7
8#endif /* _CRIS_SWAB_H */
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 27b108a86b39..c68e1680da01 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -1,2 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/asm/byteorder.h
index c36b80a3dd84..13539da99efd 100644
--- a/arch/h8300/include/asm/byteorder.h
+++ b/arch/h8300/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _H8300_BYTEORDER_H 1#ifndef _H8300_BYTEORDER_H
2#define _H8300_BYTEORDER_H 2#define _H8300_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _H8300_BYTEORDER_H */ 6#endif /* _H8300_BYTEORDER_H */
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index 54e21c3f2057..4eb67faac633 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -103,7 +103,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
103 .long SYMBOL_NAME(sys_uselib) 103 .long SYMBOL_NAME(sys_uselib)
104 .long SYMBOL_NAME(sys_swapon) 104 .long SYMBOL_NAME(sys_swapon)
105 .long SYMBOL_NAME(sys_reboot) 105 .long SYMBOL_NAME(sys_reboot)
106 .long SYMBOL_NAME(old_readdir) 106 .long SYMBOL_NAME(sys_old_readdir)
107 .long SYMBOL_NAME(old_mmap) /* 90 */ 107 .long SYMBOL_NAME(old_mmap) /* 90 */
108 .long SYMBOL_NAME(sys_munmap) 108 .long SYMBOL_NAME(sys_munmap)
109 .long SYMBOL_NAME(sys_truncate) 109 .long SYMBOL_NAME(sys_truncate)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3d31636cbafb..6183aeccecf1 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -17,6 +17,7 @@ config IA64
17 select ACPI if (!IA64_HP_SIM) 17 select ACPI if (!IA64_HP_SIM)
18 select PM if (!IA64_HP_SIM) 18 select PM if (!IA64_HP_SIM)
19 select ARCH_SUPPORTS_MSI 19 select ARCH_SUPPORTS_MSI
20 select HAVE_UNSTABLE_SCHED_CLOCK
20 select HAVE_IDE 21 select HAVE_IDE
21 select HAVE_OPROFILE 22 select HAVE_OPROFILE
22 select HAVE_KPROBES 23 select HAVE_KPROBES
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 27eb67604c53..a109db30ce55 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -578,7 +578,7 @@ CONFIG_ATA_PIIX=y
578# CONFIG_SATA_SIS is not set 578# CONFIG_SATA_SIS is not set
579# CONFIG_SATA_ULI is not set 579# CONFIG_SATA_ULI is not set
580# CONFIG_SATA_VIA is not set 580# CONFIG_SATA_VIA is not set
581# CONFIG_SATA_VITESSE is not set 581CONFIG_SATA_VITESSE=y
582# CONFIG_SATA_INIC162X is not set 582# CONFIG_SATA_INIC162X is not set
583# CONFIG_PATA_ACPI is not set 583# CONFIG_PATA_ACPI is not set
584# CONFIG_PATA_ALI is not set 584# CONFIG_PATA_ALI is not set
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index a8cf19958850..a46f8395e9a5 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -220,7 +220,7 @@ ia32_syscall_table:
220 data8 sys_mkdir 220 data8 sys_mkdir
221 data8 sys_rmdir /* 40 */ 221 data8 sys_rmdir /* 40 */
222 data8 sys_dup 222 data8 sys_dup
223 data8 sys_pipe 223 data8 sys_ia64_pipe
224 data8 compat_sys_times 224 data8 compat_sys_times
225 data8 sys_ni_syscall /* old prof syscall holder */ 225 data8 sys_ni_syscall /* old prof syscall holder */
226 data8 sys32_brk /* 45 */ 226 data8 sys32_brk /* 45 */
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 3b25bd9dca91..ccbe8ae47a61 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -14,4 +14,3 @@ unifdef-y += gcc_intrin.h
14unifdef-y += intrinsics.h 14unifdef-y += intrinsics.h
15unifdef-y += perfmon.h 15unifdef-y += perfmon.h
16unifdef-y += ustack.h 16unifdef-y += ustack.h
17unifdef-y += swab.h
diff --git a/arch/ia64/include/asm/byteorder.h b/arch/ia64/include/asm/byteorder.h
index 0f84c5cb703d..a8dd73558150 100644
--- a/arch/ia64/include/asm/byteorder.h
+++ b/arch/ia64/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_IA64_BYTEORDER_H 1#ifndef _ASM_IA64_BYTEORDER_H
2#define _ASM_IA64_BYTEORDER_H 2#define _ASM_IA64_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ASM_IA64_BYTEORDER_H */ 6#endif /* _ASM_IA64_BYTEORDER_H */
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index bbab7e2b0fc9..1f912d927585 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -9,6 +9,8 @@
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <asm/swiotlb.h> 10#include <asm/swiotlb.h>
11 11
12#define ARCH_HAS_DMA_GET_REQUIRED_MASK
13
12struct dma_mapping_ops { 14struct dma_mapping_ops {
13 int (*mapping_error)(struct device *dev, 15 int (*mapping_error)(struct device *dev,
14 dma_addr_t dma_addr); 16 dma_addr_t dma_addr);
diff --git a/arch/ia64/include/asm/machvec.h b/arch/ia64/include/asm/machvec.h
index 59c17e446683..fe87b2121707 100644
--- a/arch/ia64/include/asm/machvec.h
+++ b/arch/ia64/include/asm/machvec.h
@@ -62,6 +62,7 @@ typedef dma_addr_t ia64_mv_dma_map_single_attrs (struct device *, void *, size_t
62typedef void ia64_mv_dma_unmap_single_attrs (struct device *, dma_addr_t, size_t, int, struct dma_attrs *); 62typedef void ia64_mv_dma_unmap_single_attrs (struct device *, dma_addr_t, size_t, int, struct dma_attrs *);
63typedef int ia64_mv_dma_map_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *); 63typedef int ia64_mv_dma_map_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
64typedef void ia64_mv_dma_unmap_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *); 64typedef void ia64_mv_dma_unmap_sg_attrs (struct device *, struct scatterlist *, int, int, struct dma_attrs *);
65typedef u64 ia64_mv_dma_get_required_mask (struct device *);
65 66
66/* 67/*
67 * WARNING: The legacy I/O space is _architected_. Platforms are 68 * WARNING: The legacy I/O space is _architected_. Platforms are
@@ -159,6 +160,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
159# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device 160# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device
160# define platform_dma_mapping_error ia64_mv.dma_mapping_error 161# define platform_dma_mapping_error ia64_mv.dma_mapping_error
161# define platform_dma_supported ia64_mv.dma_supported 162# define platform_dma_supported ia64_mv.dma_supported
163# define platform_dma_get_required_mask ia64_mv.dma_get_required_mask
162# define platform_irq_to_vector ia64_mv.irq_to_vector 164# define platform_irq_to_vector ia64_mv.irq_to_vector
163# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq 165# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq
164# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem 166# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem
@@ -213,6 +215,7 @@ struct ia64_machine_vector {
213 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device; 215 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device;
214 ia64_mv_dma_mapping_error *dma_mapping_error; 216 ia64_mv_dma_mapping_error *dma_mapping_error;
215 ia64_mv_dma_supported *dma_supported; 217 ia64_mv_dma_supported *dma_supported;
218 ia64_mv_dma_get_required_mask *dma_get_required_mask;
216 ia64_mv_irq_to_vector *irq_to_vector; 219 ia64_mv_irq_to_vector *irq_to_vector;
217 ia64_mv_local_vector_to_irq *local_vector_to_irq; 220 ia64_mv_local_vector_to_irq *local_vector_to_irq;
218 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem; 221 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem;
@@ -263,6 +266,7 @@ struct ia64_machine_vector {
263 platform_dma_sync_sg_for_device, \ 266 platform_dma_sync_sg_for_device, \
264 platform_dma_mapping_error, \ 267 platform_dma_mapping_error, \
265 platform_dma_supported, \ 268 platform_dma_supported, \
269 platform_dma_get_required_mask, \
266 platform_irq_to_vector, \ 270 platform_irq_to_vector, \
267 platform_local_vector_to_irq, \ 271 platform_local_vector_to_irq, \
268 platform_pci_get_legacy_mem, \ 272 platform_pci_get_legacy_mem, \
@@ -366,6 +370,9 @@ extern void machvec_init_from_cmdline(const char *cmdline);
366#ifndef platform_dma_supported 370#ifndef platform_dma_supported
367# define platform_dma_supported swiotlb_dma_supported 371# define platform_dma_supported swiotlb_dma_supported
368#endif 372#endif
373#ifndef platform_dma_get_required_mask
374# define platform_dma_get_required_mask ia64_dma_get_required_mask
375#endif
369#ifndef platform_irq_to_vector 376#ifndef platform_irq_to_vector
370# define platform_irq_to_vector __ia64_irq_to_vector 377# define platform_irq_to_vector __ia64_irq_to_vector
371#endif 378#endif
diff --git a/arch/ia64/include/asm/machvec_init.h b/arch/ia64/include/asm/machvec_init.h
index ef964b286842..37a469849ab9 100644
--- a/arch/ia64/include/asm/machvec_init.h
+++ b/arch/ia64/include/asm/machvec_init.h
@@ -3,6 +3,7 @@
3 3
4extern ia64_mv_send_ipi_t ia64_send_ipi; 4extern ia64_mv_send_ipi_t ia64_send_ipi;
5extern ia64_mv_global_tlb_purge_t ia64_global_tlb_purge; 5extern ia64_mv_global_tlb_purge_t ia64_global_tlb_purge;
6extern ia64_mv_dma_get_required_mask ia64_dma_get_required_mask;
6extern ia64_mv_irq_to_vector __ia64_irq_to_vector; 7extern ia64_mv_irq_to_vector __ia64_irq_to_vector;
7extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq; 8extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq;
8extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem; 9extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem;
diff --git a/arch/ia64/include/asm/machvec_sn2.h b/arch/ia64/include/asm/machvec_sn2.h
index 781308ea7b88..f1a6e0d6dfa5 100644
--- a/arch/ia64/include/asm/machvec_sn2.h
+++ b/arch/ia64/include/asm/machvec_sn2.h
@@ -67,6 +67,7 @@ extern ia64_mv_dma_sync_single_for_device sn_dma_sync_single_for_device;
67extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device; 67extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device;
68extern ia64_mv_dma_mapping_error sn_dma_mapping_error; 68extern ia64_mv_dma_mapping_error sn_dma_mapping_error;
69extern ia64_mv_dma_supported sn_dma_supported; 69extern ia64_mv_dma_supported sn_dma_supported;
70extern ia64_mv_dma_get_required_mask sn_dma_get_required_mask;
70extern ia64_mv_migrate_t sn_migrate; 71extern ia64_mv_migrate_t sn_migrate;
71extern ia64_mv_kernel_launch_event_t sn_kernel_launch_event; 72extern ia64_mv_kernel_launch_event_t sn_kernel_launch_event;
72extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq; 73extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq;
@@ -123,6 +124,7 @@ extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
123#define platform_dma_sync_sg_for_device sn_dma_sync_sg_for_device 124#define platform_dma_sync_sg_for_device sn_dma_sync_sg_for_device
124#define platform_dma_mapping_error sn_dma_mapping_error 125#define platform_dma_mapping_error sn_dma_mapping_error
125#define platform_dma_supported sn_dma_supported 126#define platform_dma_supported sn_dma_supported
127#define platform_dma_get_required_mask sn_dma_get_required_mask
126#define platform_migrate sn_migrate 128#define platform_migrate sn_migrate
127#define platform_kernel_launch_event sn_kernel_launch_event 129#define platform_kernel_launch_event sn_kernel_launch_event
128#ifdef CONFIG_PCI_MSI 130#ifdef CONFIG_PCI_MSI
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index f791576355ad..9015979ebe0f 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -364,7 +364,7 @@ struct pt_regs;
364struct sigaction; 364struct sigaction;
365long sys_execve(char __user *filename, char __user * __user *argv, 365long sys_execve(char __user *filename, char __user * __user *argv,
366 char __user * __user *envp, struct pt_regs *regs); 366 char __user * __user *envp, struct pt_regs *regs);
367asmlinkage long sys_pipe(void); 367asmlinkage long sys_ia64_pipe(void);
368asmlinkage long sys_rt_sigaction(int sig, 368asmlinkage long sys_rt_sigaction(int sig,
369 const struct sigaction __user *act, 369 const struct sigaction __user *act,
370 struct sigaction __user *oact, 370 struct sigaction __user *oact,
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d435f4a7a96c..e5341e2c1175 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1442,7 +1442,7 @@ sys_call_table:
1442 data8 sys_mkdir // 1055 1442 data8 sys_mkdir // 1055
1443 data8 sys_rmdir 1443 data8 sys_rmdir
1444 data8 sys_dup 1444 data8 sys_dup
1445 data8 sys_pipe 1445 data8 sys_ia64_pipe
1446 data8 sys_times 1446 data8 sys_times
1447 data8 ia64_brk // 1060 1447 data8 ia64_brk // 1060
1448 data8 sys_setgid 1448 data8 sys_setgid
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index bcbb6d8792d3..92ed83f34036 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -154,7 +154,7 @@ out:
154 * and r9) as this is faster than doing a copy_to_user(). 154 * and r9) as this is faster than doing a copy_to_user().
155 */ 155 */
156asmlinkage long 156asmlinkage long
157sys_pipe (void) 157sys_ia64_pipe (void)
158{ 158{
159 struct pt_regs *regs = task_pt_regs(current); 159 struct pt_regs *regs = task_pt_regs(current);
160 int fd[2]; 160 int fd[2];
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index ff0e7c10faa7..6db08599ebbc 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -59,6 +59,7 @@ dump (const char *str, void *vp, size_t len)
59 * (i.e. don't allow attacker to fill up logs with unaligned accesses). 59 * (i.e. don't allow attacker to fill up logs with unaligned accesses).
60 */ 60 */
61int no_unaligned_warning; 61int no_unaligned_warning;
62int unaligned_dump_stack;
62static int noprint_warning; 63static int noprint_warning;
63 64
64/* 65/*
@@ -1371,9 +1372,12 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1371 } 1372 }
1372 } 1373 }
1373 } else { 1374 } else {
1374 if (within_logging_rate_limit()) 1375 if (within_logging_rate_limit()) {
1375 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n", 1376 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n",
1376 ifa, regs->cr_iip + ipsr->ri); 1377 ifa, regs->cr_iip + ipsr->ri);
1378 if (unaligned_dump_stack)
1379 dump_stack();
1380 }
1377 set_fs(KERNEL_DS); 1381 set_fs(KERNEL_DS);
1378 } 1382 }
1379 1383
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 211fcfd115f9..61f1af5c23c1 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -19,6 +19,7 @@
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/bootmem.h>
22 23
23#include <asm/machvec.h> 24#include <asm/machvec.h>
24#include <asm/page.h> 25#include <asm/page.h>
@@ -748,6 +749,32 @@ static void __init set_pci_cacheline_size(void)
748 pci_cache_line_size = (1 << cci.pcci_line_size) / 4; 749 pci_cache_line_size = (1 << cci.pcci_line_size) / 4;
749} 750}
750 751
752u64 ia64_dma_get_required_mask(struct device *dev)
753{
754 u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
755 u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT));
756 u64 mask;
757
758 if (!high_totalram) {
759 /* convert to mask just covering totalram */
760 low_totalram = (1 << (fls(low_totalram) - 1));
761 low_totalram += low_totalram - 1;
762 mask = low_totalram;
763 } else {
764 high_totalram = (1 << (fls(high_totalram) - 1));
765 high_totalram += high_totalram - 1;
766 mask = (((u64)high_totalram) << 32) + 0xffffffff;
767 }
768 return mask;
769}
770EXPORT_SYMBOL_GPL(ia64_dma_get_required_mask);
771
772u64 dma_get_required_mask(struct device *dev)
773{
774 return platform_dma_get_required_mask(dev);
775}
776EXPORT_SYMBOL_GPL(dma_get_required_mask);
777
751static int __init pcibios_init(void) 778static int __init pcibios_init(void)
752{ 779{
753 set_pci_cacheline_size(); 780 set_pci_cacheline_size();
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 53ebb6484495..863f5017baae 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -356,6 +356,12 @@ int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
356} 356}
357EXPORT_SYMBOL(sn_dma_mapping_error); 357EXPORT_SYMBOL(sn_dma_mapping_error);
358 358
359u64 sn_dma_get_required_mask(struct device *dev)
360{
361 return DMA_64BIT_MASK;
362}
363EXPORT_SYMBOL_GPL(sn_dma_get_required_mask);
364
359char *sn_pci_get_legacy_mem(struct pci_bus *bus) 365char *sn_pci_get_legacy_mem(struct pci_bus *bus)
360{ 366{
361 if (!SN_PCIBUS_BUSSOFT(bus)) 367 if (!SN_PCIBUS_BUSSOFT(bus))
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index d15a94c330fb..68d6204c3f16 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -129,8 +129,8 @@ consider_steal_time(unsigned long new_itm)
129 blocked = stolentick; 129 blocked = stolentick;
130 130
131 if (stolen > 0 || blocked > 0) { 131 if (stolen > 0 || blocked > 0) {
132 account_steal_time(NULL, jiffies_to_cputime(stolen)); 132 account_steal_ticks(stolen);
133 account_steal_time(idle_task(cpu), jiffies_to_cputime(blocked)); 133 account_idle_ticks(blocked);
134 run_local_timers(); 134 run_local_timers();
135 135
136 if (rcu_pending(cpu)) 136 if (rcu_pending(cpu))
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 5b780826647c..5c332f2b9b83 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -513,7 +513,7 @@ sys_call_table:
513 .long sys_uselib 513 .long sys_uselib
514 .long sys_swapon 514 .long sys_swapon
515 .long sys_reboot 515 .long sys_reboot
516 .long old_readdir 516 .long sys_old_readdir
517 .long old_mmap /* 90 */ 517 .long old_mmap /* 90 */
518 .long sys_munmap 518 .long sys_munmap
519 .long sys_truncate 519 .long sys_truncate
diff --git a/arch/m68knommu/include/asm/Kbuild b/arch/m68knommu/include/asm/Kbuild
index 58c02a454130..c68e1680da01 100644
--- a/arch/m68knommu/include/asm/Kbuild
+++ b/arch/m68knommu/include/asm/Kbuild
@@ -1,3 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2
3unifdef-y += swab.h
diff --git a/arch/m68knommu/include/asm/byteorder.h b/arch/m68knommu/include/asm/byteorder.h
index a6f0b8f7f622..9c6c76a15041 100644
--- a/arch/m68knommu/include/asm/byteorder.h
+++ b/arch/m68knommu/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _M68KNOMMU_BYTEORDER_H 1#ifndef _M68KNOMMU_BYTEORDER_H
2#define _M68KNOMMU_BYTEORDER_H 2#define _M68KNOMMU_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _M68KNOMMU_BYTEORDER_H */ 6#endif /* _M68KNOMMU_BYTEORDER_H */
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
index 812f8d8b7a85..5c3e3f62194a 100644
--- a/arch/m68knommu/kernel/syscalltable.S
+++ b/arch/m68knommu/kernel/syscalltable.S
@@ -107,7 +107,7 @@ ENTRY(sys_call_table)
107 .long sys_uselib 107 .long sys_uselib
108 .long sys_ni_syscall /* sys_swapon */ 108 .long sys_ni_syscall /* sys_swapon */
109 .long sys_reboot 109 .long sys_reboot
110 .long old_readdir 110 .long sys_old_readdir
111 .long old_mmap /* 90 */ 111 .long old_mmap /* 90 */
112 .long sys_munmap 112 .long sys_munmap
113 .long sys_truncate 113 .long sys_truncate
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 023866c0c102..7897f05e3165 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += cachectl.h sgidefs.h sysmips.h 3header-y += cachectl.h sgidefs.h sysmips.h
4header-y += swab.h
diff --git a/arch/mips/include/asm/byteorder.h b/arch/mips/include/asm/byteorder.h
index 607b71830707..9579051ff1c7 100644
--- a/arch/mips/include/asm/byteorder.h
+++ b/arch/mips/include/asm/byteorder.h
@@ -8,8 +8,6 @@
8#ifndef _ASM_BYTEORDER_H 8#ifndef _ASM_BYTEORDER_H
9#define _ASM_BYTEORDER_H 9#define _ASM_BYTEORDER_H
10 10
11#include <asm/swab.h>
12
13#if defined(__MIPSEB__) 11#if defined(__MIPSEB__)
14#include <linux/byteorder/big_endian.h> 12#include <linux/byteorder/big_endian.h>
15#elif defined(__MIPSEL__) 13#elif defined(__MIPSEL__)
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d0916a55cd77..51d1ba415b90 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -398,7 +398,7 @@ einval: li v0, -ENOSYS
398 sys sys_uselib 1 398 sys sys_uselib 1
399 sys sys_swapon 2 399 sys sys_swapon 2
400 sys sys_reboot 3 400 sys sys_reboot 3
401 sys old_readdir 3 401 sys sys_old_readdir 3
402 sys old_mmap 6 /* 4090 */ 402 sys old_mmap 6 /* 4090 */
403 sys sys_munmap 2 403 sys sys_munmap 2
404 sys sys_truncate 2 404 sys sys_truncate 2
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 62fba8aa9b6e..ceeaaaa359e2 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -478,7 +478,7 @@ ENTRY(sys_call_table)
478 .long sys_uselib 478 .long sys_uselib
479 .long sys_swapon 479 .long sys_swapon
480 .long sys_reboot 480 .long sys_reboot
481 .long old_readdir 481 .long sys_old_readdir
482 .long old_mmap /* 90 */ 482 .long old_mmap /* 90 */
483 .long sys_munmap 483 .long sys_munmap
484 .long sys_truncate 484 .long sys_truncate
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 2121d99f8364..f88b252e419c 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -1,4 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3unifdef-y += pdc.h 3unifdef-y += pdc.h
4unifdef-y += swab.h
diff --git a/arch/parisc/include/asm/byteorder.h b/arch/parisc/include/asm/byteorder.h
index da66029c4cb2..58af2c5f5d61 100644
--- a/arch/parisc/include/asm/byteorder.h
+++ b/arch/parisc/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _PARISC_BYTEORDER_H 1#ifndef _PARISC_BYTEORDER_H
2#define _PARISC_BYTEORDER_H 2#define _PARISC_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _PARISC_BYTEORDER_H */ 6#endif /* _PARISC_BYTEORDER_H */
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 84b861316ce7..e39b73bc0ff8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -123,6 +123,7 @@ config PPC
123 select HAVE_DMA_ATTRS if PPC64 123 select HAVE_DMA_ATTRS if PPC64
124 select USE_GENERIC_SMP_HELPERS if SMP 124 select USE_GENERIC_SMP_HELPERS if SMP
125 select HAVE_OPROFILE 125 select HAVE_OPROFILE
126 select HAVE_SYSCALL_WRAPPERS if PPC64
126 127
127config EARLY_PRINTK 128config EARLY_PRINTK
128 bool 129 bool
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 072c9b0f8c8e..71784165b77e 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -255,7 +255,7 @@
255 device_type = "serial"; 255 device_type = "serial";
256 compatible = "ns16550"; 256 compatible = "ns16550";
257 reg = <0x4500 0x100>; 257 reg = <0x4500 0x100>;
258 clock-frequency = <0>; 258 clock-frequency = <133333333>;
259 interrupts = <9 0x8>; 259 interrupts = <9 0x8>;
260 interrupt-parent = <&ipic>; 260 interrupt-parent = <&ipic>;
261 }; 261 };
@@ -265,7 +265,7 @@
265 device_type = "serial"; 265 device_type = "serial";
266 compatible = "ns16550"; 266 compatible = "ns16550";
267 reg = <0x4600 0x100>; 267 reg = <0x4600 0x100>;
268 clock-frequency = <0>; 268 clock-frequency = <133333333>;
269 interrupts = <10 0x8>; 269 interrupts = <10 0x8>;
270 interrupt-parent = <&ipic>; 270 interrupt-parent = <&ipic>;
271 }; 271 };
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index b9da42105066..0668d1048779 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -313,7 +313,7 @@
313 0x1000000 0x0 0x0 0xe1010000 0x0 0x10000>; 313 0x1000000 0x0 0x0 0xe1010000 0x0 0x10000>;
314 clock-frequency = <33333333>; 314 clock-frequency = <33333333>;
315 interrupt-parent = <&mpic>; 315 interrupt-parent = <&mpic>;
316 interrupts = <26 2>; 316 interrupts = <25 2>;
317 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 317 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
318 interrupt-map = < 318 interrupt-map = <
319 /* IDSEL 0x0 */ 319 /* IDSEL 0x0 */
@@ -350,7 +350,7 @@
350 0x1000000 0x0 0x0 0xe1020000 0x0 0x10000>; 350 0x1000000 0x0 0x0 0xe1020000 0x0 0x10000>;
351 clock-frequency = <33333333>; 351 clock-frequency = <33333333>;
352 interrupt-parent = <&mpic>; 352 interrupt-parent = <&mpic>;
353 interrupts = <25 2>; 353 interrupts = <26 2>;
354 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 354 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
355 interrupt-map = < 355 interrupt-map = <
356 /* IDSEL 0x0 */ 356 /* IDSEL 0x0 */
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index 21459e161d02..3dcc001b8ed3 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -724,7 +724,7 @@
724 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x00010000>; 724 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x00010000>;
725 clock-frequency = <33333333>; 725 clock-frequency = <33333333>;
726 interrupt-parent = <&mpic>; 726 interrupt-parent = <&mpic>;
727 interrupts = <26 2>; 727 interrupts = <25 2>;
728 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 728 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
729 interrupt-map = < 729 interrupt-map = <
730 /* IDSEL 0x0 */ 730 /* IDSEL 0x0 */
@@ -761,7 +761,7 @@
761 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x00010000>; 761 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x00010000>;
762 clock-frequency = <33333333>; 762 clock-frequency = <33333333>;
763 interrupt-parent = <&mpic>; 763 interrupt-parent = <&mpic>;
764 interrupts = <27 2>; 764 interrupts = <26 2>;
765 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 765 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
766 interrupt-map = < 766 interrupt-map = <
767 /* IDSEL 0x0 */ 767 /* IDSEL 0x0 */
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
index c114c4ee9931..fd462efa9e61 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
@@ -457,7 +457,7 @@
457 0x1000000 0x0 0x0 0xffc10000 0x0 0x10000>; 457 0x1000000 0x0 0x0 0xffc10000 0x0 0x10000>;
458 clock-frequency = <33333333>; 458 clock-frequency = <33333333>;
459 interrupt-parent = <&mpic>; 459 interrupt-parent = <&mpic>;
460 interrupts = <26 2>; 460 interrupts = <25 2>;
461 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 461 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
462 interrupt-map = < 462 interrupt-map = <
463 /* IDSEL 0x0 */ 463 /* IDSEL 0x0 */
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
index 04ecda18d206..e35230f2ac93 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
@@ -208,7 +208,7 @@
208 0x1000000 0x0 0x0 0xffc20000 0x0 0x10000>; 208 0x1000000 0x0 0x0 0xffc20000 0x0 0x10000>;
209 clock-frequency = <33333333>; 209 clock-frequency = <33333333>;
210 interrupt-parent = <&mpic>; 210 interrupt-parent = <&mpic>;
211 interrupts = <27 2>; 211 interrupts = <26 2>;
212 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 212 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
213 interrupt-map = < 213 interrupt-map = <
214 /* IDSEL 0x0 */ 214 /* IDSEL 0x0 */
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 069ae1bbac29..d4685d1c0be8 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -211,11 +211,28 @@ CONFIG_PPC_PASEMI=y
211CONFIG_PPC_PASEMI_IOMMU=y 211CONFIG_PPC_PASEMI_IOMMU=y
212# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set 212# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
213CONFIG_PPC_PASEMI_MDIO=y 213CONFIG_PPC_PASEMI_MDIO=y
214# CONFIG_PPC_PS3 is not set 214CONFIG_PPC_PS3=y
215
216#
217# PS3 Platform Options
218#
219# CONFIG_PS3_ADVANCED is not set
220CONFIG_PS3_HTAB_SIZE=20
221# CONFIG_PS3_DYNAMIC_DMA is not set
222CONFIG_PS3_VUART=y
223CONFIG_PS3_PS3AV=y
224CONFIG_PS3_SYS_MANAGER=y
225CONFIG_PS3_STORAGE=m
226CONFIG_PS3_DISK=m
227CONFIG_PS3_ROM=m
228CONFIG_PS3_FLASH=m
229CONFIG_PS3_LPM=m
215CONFIG_PPC_CELL=y 230CONFIG_PPC_CELL=y
231CONFIG_PPC_CELL_COMMON=y
216CONFIG_PPC_CELL_NATIVE=y 232CONFIG_PPC_CELL_NATIVE=y
217CONFIG_PPC_IBM_CELL_BLADE=y 233CONFIG_PPC_IBM_CELL_BLADE=y
218CONFIG_PPC_CELLEB=y 234CONFIG_PPC_CELLEB=y
235CONFIG_PPC_CELL_QPACE=y
219 236
220# 237#
221# Cell Broadband Engine options 238# Cell Broadband Engine options
@@ -981,6 +998,9 @@ CONFIG_E1000=y
981CONFIG_TIGON3=y 998CONFIG_TIGON3=y
982# CONFIG_BNX2 is not set 999# CONFIG_BNX2 is not set
983CONFIG_SPIDER_NET=m 1000CONFIG_SPIDER_NET=m
1001CONFIG_GELIC_NET=m
1002CONFIG_GELIC_WIRELESS=y
1003# CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE is not set
984# CONFIG_QLA3XXX is not set 1004# CONFIG_QLA3XXX is not set
985# CONFIG_ATL1 is not set 1005# CONFIG_ATL1 is not set
986# CONFIG_ATL1E is not set 1006# CONFIG_ATL1E is not set
@@ -1370,6 +1390,8 @@ CONFIG_FB_RADEON_BACKLIGHT=y
1370# CONFIG_FB_PM3 is not set 1390# CONFIG_FB_PM3 is not set
1371# CONFIG_FB_CARMINE is not set 1391# CONFIG_FB_CARMINE is not set
1372CONFIG_FB_IBM_GXT4500=y 1392CONFIG_FB_IBM_GXT4500=y
1393CONFIG_FB_PS3=m
1394CONFIG_FB_PS3_DEFAULT_SIZE_M=9
1373# CONFIG_FB_VIRTUAL is not set 1395# CONFIG_FB_VIRTUAL is not set
1374# CONFIG_FB_METRONOME is not set 1396# CONFIG_FB_METRONOME is not set
1375CONFIG_BACKLIGHT_LCD_SUPPORT=y 1397CONFIG_BACKLIGHT_LCD_SUPPORT=y
@@ -1492,6 +1514,8 @@ CONFIG_SND_PCI=y
1492CONFIG_SND_PPC=y 1514CONFIG_SND_PPC=y
1493CONFIG_SND_POWERMAC=m 1515CONFIG_SND_POWERMAC=m
1494CONFIG_SND_POWERMAC_AUTO_DRC=y 1516CONFIG_SND_POWERMAC_AUTO_DRC=y
1517CONFIG_SND_PS3=m
1518CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
1495CONFIG_SND_AOA=m 1519CONFIG_SND_AOA=m
1496CONFIG_SND_AOA_FABRIC_LAYOUT=m 1520CONFIG_SND_AOA_FABRIC_LAYOUT=m
1497CONFIG_SND_AOA_ONYX=m 1521CONFIG_SND_AOA_ONYX=m
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 9268602de5d0..5ab7d7fe198c 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -35,4 +35,3 @@ unifdef-y += spu_info.h
35unifdef-y += termios.h 35unifdef-y += termios.h
36unifdef-y += types.h 36unifdef-y += types.h
37unifdef-y += unistd.h 37unifdef-y += unistd.h
38unifdef-y += swab.h
diff --git a/arch/powerpc/include/asm/byteorder.h b/arch/powerpc/include/asm/byteorder.h
index 5cca27a41532..aa6cc4fac965 100644
--- a/arch/powerpc/include/asm/byteorder.h
+++ b/arch/powerpc/include/asm/byteorder.h
@@ -7,8 +7,6 @@
7 * as published by the Free Software Foundation; either version 7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10
11#include <asm/swab.h>
12#include <linux/byteorder/big_endian.h> 10#include <linux/byteorder/big_endian.h>
13 11
14#endif /* _ASM_POWERPC_BYTEORDER_H */ 12#endif /* _ASM_POWERPC_BYTEORDER_H */
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index eead5c67197a..67f1812698d2 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -103,10 +103,10 @@ struct ps3_dma_region_ops {
103 int (*map)(struct ps3_dma_region *, 103 int (*map)(struct ps3_dma_region *,
104 unsigned long virt_addr, 104 unsigned long virt_addr,
105 unsigned long len, 105 unsigned long len,
106 unsigned long *bus_addr, 106 dma_addr_t *bus_addr,
107 u64 iopte_pp); 107 u64 iopte_pp);
108 int (*unmap)(struct ps3_dma_region *, 108 int (*unmap)(struct ps3_dma_region *,
109 unsigned long bus_addr, 109 dma_addr_t bus_addr,
110 unsigned long len); 110 unsigned long len);
111}; 111};
112/** 112/**
@@ -124,9 +124,9 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev,
124int ps3_dma_region_create(struct ps3_dma_region *r); 124int ps3_dma_region_create(struct ps3_dma_region *r);
125int ps3_dma_region_free(struct ps3_dma_region *r); 125int ps3_dma_region_free(struct ps3_dma_region *r);
126int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, 126int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
127 unsigned long len, unsigned long *bus_addr, 127 unsigned long len, dma_addr_t *bus_addr,
128 u64 iopte_pp); 128 u64 iopte_pp);
129int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, 129int ps3_dma_unmap(struct ps3_dma_region *r, dma_addr_t bus_addr,
130 unsigned long len); 130 unsigned long len);
131 131
132/* mmio routines */ 132/* mmio routines */
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index a0a15311d0d8..2701753d9937 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -624,7 +624,7 @@ struct ucc_slow_pram {
624#define UCC_GETH_UCCE_RXF1 0x00000002 624#define UCC_GETH_UCCE_RXF1 0x00000002
625#define UCC_GETH_UCCE_RXF0 0x00000001 625#define UCC_GETH_UCCE_RXF0 0x00000001
626 626
627/* UPSMR, when used as a UART */ 627/* UCC Protocol Specific Mode Register (UPSMR), when used for UART */
628#define UCC_UART_UPSMR_FLC 0x8000 628#define UCC_UART_UPSMR_FLC 0x8000
629#define UCC_UART_UPSMR_SL 0x4000 629#define UCC_UART_UPSMR_SL 0x4000
630#define UCC_UART_UPSMR_CL_MASK 0x3000 630#define UCC_UART_UPSMR_CL_MASK 0x3000
@@ -652,6 +652,23 @@ struct ucc_slow_pram {
652#define UCC_UART_UPSMR_TPM_EVEN 0x0002 652#define UCC_UART_UPSMR_TPM_EVEN 0x0002
653#define UCC_UART_UPSMR_TPM_HIGH 0x0003 653#define UCC_UART_UPSMR_TPM_HIGH 0x0003
654 654
655/* UCC Protocol Specific Mode Register (UPSMR), when used for Ethernet */
656#define UCC_GETH_UPSMR_FTFE 0x80000000
657#define UCC_GETH_UPSMR_PTPE 0x40000000
658#define UCC_GETH_UPSMR_ECM 0x04000000
659#define UCC_GETH_UPSMR_HSE 0x02000000
660#define UCC_GETH_UPSMR_PRO 0x00400000
661#define UCC_GETH_UPSMR_CAP 0x00200000
662#define UCC_GETH_UPSMR_RSH 0x00100000
663#define UCC_GETH_UPSMR_RPM 0x00080000
664#define UCC_GETH_UPSMR_R10M 0x00040000
665#define UCC_GETH_UPSMR_RLPB 0x00020000
666#define UCC_GETH_UPSMR_TBIM 0x00010000
667#define UCC_GETH_UPSMR_RES1 0x00002000
668#define UCC_GETH_UPSMR_RMM 0x00001000
669#define UCC_GETH_UPSMR_CAM 0x00000400
670#define UCC_GETH_UPSMR_BRO 0x00000200
671
655/* UCC Transmit On Demand Register (UTODR) */ 672/* UCC Transmit On Demand Register (UTODR) */
656#define UCC_SLOW_TOD 0x8000 673#define UCC_SLOW_TOD 0x8000
657#define UCC_FAST_TOD 0x8000 674#define UCC_FAST_TOD 0x8000
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index e0175beb4462..0aa0315fb7e8 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20#define RTAS_UNKNOWN_SERVICE (-1) 20#define RTAS_UNKNOWN_SERVICE (-1)
21#define RTAS_INSTANTIATE_MAX (1UL<<30) /* Don't instantiate rtas at/above this value */ 21#define RTAS_INSTANTIATE_MAX (1ULL<<30) /* Don't instantiate rtas at/above this value */
22 22
23/* Buffer size for ppc_rtas system call. */ 23/* Buffer size for ppc_rtas system call. */
24#define RTAS_RMOBUF_MAX (64 * 1024) 24#define RTAS_RMOBUF_MAX (64 * 1024)
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 803def236654..72353f6070a4 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -92,7 +92,7 @@ COMPAT_SYS_SPU(readlink)
92SYSCALL(uselib) 92SYSCALL(uselib)
93SYSCALL(swapon) 93SYSCALL(swapon)
94SYSCALL(reboot) 94SYSCALL(reboot)
95SYSX(sys_ni_syscall,compat_sys_old_readdir,old_readdir) 95SYSX(sys_ni_syscall,compat_sys_old_readdir,sys_old_readdir)
96SYSCALL_SPU(mmap) 96SYSCALL_SPU(mmap)
97SYSCALL_SPU(munmap) 97SYSCALL_SPU(munmap)
98SYSCALL_SPU(truncate) 98SYSCALL_SPU(truncate)
diff --git a/arch/powerpc/include/asm/types.h b/arch/powerpc/include/asm/types.h
index c004c13f291e..7ce27a52bb34 100644
--- a/arch/powerpc/include/asm/types.h
+++ b/arch/powerpc/include/asm/types.h
@@ -1,7 +1,12 @@
1#ifndef _ASM_POWERPC_TYPES_H 1#ifndef _ASM_POWERPC_TYPES_H
2#define _ASM_POWERPC_TYPES_H 2#define _ASM_POWERPC_TYPES_H
3 3
4#ifdef __powerpc64__ 4/*
5 * This is here because we used to use l64 for 64bit powerpc
6 * and we don't want to impact user mode with our change to ll64
7 * in the kernel.
8 */
9#if defined(__powerpc64__) && !defined(__KERNEL__)
5# include <asm-generic/int-l64.h> 10# include <asm-generic/int-l64.h>
6#else 11#else
7# include <asm-generic/int-ll64.h> 12# include <asm-generic/int-ll64.h>
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 9937fe44555f..19ee491e9e23 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -56,6 +56,10 @@
56#include "head_booke.h" 56#include "head_booke.h"
57#endif 57#endif
58 58
59#if defined(CONFIG_FSL_BOOKE)
60#include "../mm/mmu_decl.h"
61#endif
62
59int main(void) 63int main(void)
60{ 64{
61 DEFINE(THREAD, offsetof(struct task_struct, thread)); 65 DEFINE(THREAD, offsetof(struct task_struct, thread));
@@ -382,6 +386,9 @@ int main(void)
382 DEFINE(PGD_T_LOG2, PGD_T_LOG2); 386 DEFINE(PGD_T_LOG2, PGD_T_LOG2);
383 DEFINE(PTE_T_LOG2, PTE_T_LOG2); 387 DEFINE(PTE_T_LOG2, PTE_T_LOG2);
384#endif 388#endif
389#ifdef CONFIG_FSL_BOOKE
390 DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam));
391#endif
385 392
386#ifdef CONFIG_KVM_EXIT_TIMING 393#ifdef CONFIG_KVM_EXIT_TIMING
387 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu, 394 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu,
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index b33f0417a4bf..bb37b1d19a58 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -113,7 +113,7 @@ struct cache {
113 struct cache *next_local; /* next cache of >= level */ 113 struct cache *next_local; /* next cache of >= level */
114}; 114};
115 115
116static DEFINE_PER_CPU(struct cache_dir *, cache_dir); 116static DEFINE_PER_CPU(struct cache_dir *, cache_dir_pcpu);
117 117
118/* traversal/modification of this list occurs only at cpu hotplug time; 118/* traversal/modification of this list occurs only at cpu hotplug time;
119 * access is serialized by cpu hotplug locking 119 * access is serialized by cpu hotplug locking
@@ -468,9 +468,9 @@ static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_i
468 468
469 cache_dir->kobj = kobj; 469 cache_dir->kobj = kobj;
470 470
471 WARN_ON_ONCE(per_cpu(cache_dir, cpu_id) != NULL); 471 WARN_ON_ONCE(per_cpu(cache_dir_pcpu, cpu_id) != NULL);
472 472
473 per_cpu(cache_dir, cpu_id) = cache_dir; 473 per_cpu(cache_dir_pcpu, cpu_id) = cache_dir;
474 474
475 return cache_dir; 475 return cache_dir;
476err: 476err:
@@ -820,13 +820,13 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)
820 820
821 /* Prevent userspace from seeing inconsistent state - remove 821 /* Prevent userspace from seeing inconsistent state - remove
822 * the sysfs hierarchy first */ 822 * the sysfs hierarchy first */
823 cache_dir = per_cpu(cache_dir, cpu_id); 823 cache_dir = per_cpu(cache_dir_pcpu, cpu_id);
824 824
825 /* careful, sysfs population may have failed */ 825 /* careful, sysfs population may have failed */
826 if (cache_dir) 826 if (cache_dir)
827 remove_cache_dir(cache_dir); 827 remove_cache_dir(cache_dir);
828 828
829 per_cpu(cache_dir, cpu_id) = NULL; 829 per_cpu(cache_dir_pcpu, cpu_id) = NULL;
830 830
831 /* clear the CPU's bit in its cache chain, possibly freeing 831 /* clear the CPU's bit in its cache chain, possibly freeing
832 * cache objects */ 832 * cache objects */
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 14183af1b3fb..2983adac8cc3 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -79,10 +79,10 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
79 "Warning: IOMMU offset too big for device mask\n"); 79 "Warning: IOMMU offset too big for device mask\n");
80 if (tbl) 80 if (tbl)
81 printk(KERN_INFO 81 printk(KERN_INFO
82 "mask: 0x%08lx, table offset: 0x%08lx\n", 82 "mask: 0x%08llx, table offset: 0x%08lx\n",
83 mask, tbl->it_offset); 83 mask, tbl->it_offset);
84 else 84 else
85 printk(KERN_INFO "mask: 0x%08lx, table unavailable\n", 85 printk(KERN_INFO "mask: 0x%08llx, table unavailable\n",
86 mask); 86 mask);
87 return 0; 87 return 0;
88 } else 88 } else
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index b4bcf5a930fa..ebaedafc8e67 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1518,6 +1518,15 @@ _GLOBAL(pmac_secondary_start)
1518 /* turn on 64-bit mode */ 1518 /* turn on 64-bit mode */
1519 bl .enable_64b_mode 1519 bl .enable_64b_mode
1520 1520
1521 li r0,0
1522 mfspr r3,SPRN_HID4
1523 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
1524 sync
1525 mtspr SPRN_HID4,r3
1526 isync
1527 sync
1528 slbia
1529
1521 /* get TOC pointer (real address) */ 1530 /* get TOC pointer (real address) */
1522 bl .relative_toc 1531 bl .relative_toc
1523 1532
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 11b549acc034..36ffb3504a4f 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -389,10 +389,6 @@ skpinv: addi r6,r6,1 /* Increment */
389#endif 389#endif
390#endif 390#endif
391 391
392 mfspr r3,SPRN_TLB1CFG
393 andi. r3,r3,0xfff
394 lis r4,num_tlbcam_entries@ha
395 stw r3,num_tlbcam_entries@l(r4)
396/* 392/*
397 * Decide what sort of machine this is and initialize the MMU. 393 * Decide what sort of machine this is and initialize the MMU.
398 */ 394 */
@@ -711,7 +707,7 @@ interrupt_base:
711 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD) 707 EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD)
712 708
713#ifdef CONFIG_PPC_E500MC 709#ifdef CONFIG_PPC_E500MC
714 EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_EE) 710 EXCEPTION(0x2070, Doorbell, unknown_exception, EXC_XFER_STD)
715#endif 711#endif
716 712
717 /* Debug Interrupt */ 713 /* Debug Interrupt */
@@ -909,7 +905,7 @@ KernelSPE:
909_GLOBAL(loadcam_entry) 905_GLOBAL(loadcam_entry)
910 lis r4,TLBCAM@ha 906 lis r4,TLBCAM@ha
911 addi r4,r4,TLBCAM@l 907 addi r4,r4,TLBCAM@l
912 mulli r5,r3,20 908 mulli r5,r3,TLBCAM_SIZE
913 add r3,r5,r4 909 add r3,r5,r4
914 lwz r4,0(r3) 910 lwz r4,0(r3)
915 mtspr SPRN_MAS0,r4 911 mtspr SPRN_MAS0,r4
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 1bfa706b96e7..fd51578e29dd 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -239,12 +239,12 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
239 if (printk_ratelimit()) { 239 if (printk_ratelimit()) {
240 printk(KERN_INFO "iommu_free: invalid entry\n"); 240 printk(KERN_INFO "iommu_free: invalid entry\n");
241 printk(KERN_INFO "\tentry = 0x%lx\n", entry); 241 printk(KERN_INFO "\tentry = 0x%lx\n", entry);
242 printk(KERN_INFO "\tdma_addr = 0x%lx\n", (u64)dma_addr); 242 printk(KERN_INFO "\tdma_addr = 0x%llx\n", (u64)dma_addr);
243 printk(KERN_INFO "\tTable = 0x%lx\n", (u64)tbl); 243 printk(KERN_INFO "\tTable = 0x%llx\n", (u64)tbl);
244 printk(KERN_INFO "\tbus# = 0x%lx\n", (u64)tbl->it_busno); 244 printk(KERN_INFO "\tbus# = 0x%llx\n", (u64)tbl->it_busno);
245 printk(KERN_INFO "\tsize = 0x%lx\n", (u64)tbl->it_size); 245 printk(KERN_INFO "\tsize = 0x%llx\n", (u64)tbl->it_size);
246 printk(KERN_INFO "\tstartOff = 0x%lx\n", (u64)tbl->it_offset); 246 printk(KERN_INFO "\tstartOff = 0x%llx\n", (u64)tbl->it_offset);
247 printk(KERN_INFO "\tindex = 0x%lx\n", (u64)tbl->it_index); 247 printk(KERN_INFO "\tindex = 0x%llx\n", (u64)tbl->it_index);
248 WARN_ON(1); 248 WARN_ON(1);
249 } 249 }
250 return; 250 return;
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index d051e8cbcd03..182e0f642f36 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -240,7 +240,7 @@ static void parse_ppp_data(struct seq_file *m)
240 if (rc) 240 if (rc)
241 return; 241 return;
242 242
243 seq_printf(m, "partition_entitled_capacity=%ld\n", 243 seq_printf(m, "partition_entitled_capacity=%lld\n",
244 ppp_data.entitlement); 244 ppp_data.entitlement);
245 seq_printf(m, "group=%d\n", ppp_data.group_num); 245 seq_printf(m, "group=%d\n", ppp_data.group_num);
246 seq_printf(m, "system_active_processors=%d\n", 246 seq_printf(m, "system_active_processors=%d\n",
@@ -265,7 +265,7 @@ static void parse_ppp_data(struct seq_file *m)
265 ppp_data.unallocated_weight); 265 ppp_data.unallocated_weight);
266 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight); 266 seq_printf(m, "capacity_weight=%d\n", ppp_data.weight);
267 seq_printf(m, "capped=%d\n", ppp_data.capped); 267 seq_printf(m, "capped=%d\n", ppp_data.capped);
268 seq_printf(m, "unallocated_capacity=%ld\n", 268 seq_printf(m, "unallocated_capacity=%lld\n",
269 ppp_data.unallocated_entitlement); 269 ppp_data.unallocated_entitlement);
270} 270}
271 271
@@ -509,10 +509,10 @@ static ssize_t update_ppp(u64 *entitlement, u8 *weight)
509 } else 509 } else
510 return -EINVAL; 510 return -EINVAL;
511 511
512 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 512 pr_debug("%s: current_entitled = %llu, current_weight = %u\n",
513 __func__, ppp_data.entitlement, ppp_data.weight); 513 __func__, ppp_data.entitlement, ppp_data.weight);
514 514
515 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 515 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
516 __func__, new_entitled, new_weight); 516 __func__, new_entitled, new_weight);
517 517
518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight); 518 retval = plpar_hcall_norets(H_SET_PPP, new_entitled, new_weight);
@@ -558,7 +558,7 @@ static ssize_t update_mpp(u64 *entitlement, u8 *weight)
558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n", 558 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight); 559 __func__, mpp_data.entitled_mem, mpp_data.mem_weight);
560 560
561 pr_debug("%s: new_entitled = %lu, new_weight = %u\n", 561 pr_debug("%s: new_entitled = %llu, new_weight = %u\n",
562 __func__, new_entitled, new_weight); 562 __func__, new_entitled, new_weight);
563 563
564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight); 564 rc = plpar_hcall_norets(H_SET_MPP, new_entitled, new_weight);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index b3abebb7ee64..d59e2b1bdcba 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -93,10 +93,35 @@ void __init reserve_crashkernel(void)
93 KDUMP_KERNELBASE); 93 KDUMP_KERNELBASE);
94 94
95 crashk_res.start = KDUMP_KERNELBASE; 95 crashk_res.start = KDUMP_KERNELBASE;
96#else
97 if (!crashk_res.start) {
98 /*
99 * unspecified address, choose a region of specified size
100 * can overlap with initrd (ignoring corruption when retained)
101 * ppc64 requires kernel and some stacks to be in first segemnt
102 */
103 crashk_res.start = KDUMP_KERNELBASE;
104 }
105
106 crash_base = PAGE_ALIGN(crashk_res.start);
107 if (crash_base != crashk_res.start) {
108 printk("Crash kernel base must be aligned to 0x%lx\n",
109 PAGE_SIZE);
110 crashk_res.start = crash_base;
111 }
112
96#endif 113#endif
97 crash_size = PAGE_ALIGN(crash_size); 114 crash_size = PAGE_ALIGN(crash_size);
98 crashk_res.end = crashk_res.start + crash_size - 1; 115 crashk_res.end = crashk_res.start + crash_size - 1;
99 116
117 /* The crash region must not overlap the current kernel */
118 if (overlaps_crashkernel(__pa(_stext), _end - _stext)) {
119 printk(KERN_WARNING
120 "Crash kernel can not overlap current kernel\n");
121 crashk_res.start = crashk_res.end = 0;
122 return;
123 }
124
100 /* Crash kernel trumps memory limit */ 125 /* Crash kernel trumps memory limit */
101 if (memory_limit && memory_limit <= crashk_res.end) { 126 if (memory_limit && memory_limit <= crashk_res.end) {
102 memory_limit = crashk_res.end + 1; 127 memory_limit = crashk_res.end + 1;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 586962f65c2a..ea8eda8c87cf 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -470,7 +470,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
470 if (bus->self) { 470 if (bus->self) {
471 pr_debug("IO mapping for PCI-PCI bridge %s\n", 471 pr_debug("IO mapping for PCI-PCI bridge %s\n",
472 pci_name(bus->self)); 472 pci_name(bus->self));
473 pr_debug(" virt=0x%016lx...0x%016lx\n", 473 pr_debug(" virt=0x%016llx...0x%016llx\n",
474 bus->resource[0]->start + _IO_BASE, 474 bus->resource[0]->start + _IO_BASE,
475 bus->resource[0]->end + _IO_BASE); 475 bus->resource[0]->end + _IO_BASE);
476 return 0; 476 return 0;
@@ -502,7 +502,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
502 hose->io_base_phys - phys_page); 502 hose->io_base_phys - phys_page);
503 503
504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name); 504 pr_debug("IO mapping for PHB %s\n", hose->dn->full_name);
505 pr_debug(" phys=0x%016lx, virt=0x%p (alloc=0x%p)\n", 505 pr_debug(" phys=0x%016llx, virt=0x%p (alloc=0x%p)\n",
506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc); 506 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n", 507 pr_debug(" size=0x%016lx (alloc=0x%016lx)\n",
508 hose->pci_io_size, size_page); 508 hose->pci_io_size, size_page);
@@ -517,7 +517,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
517 hose->io_resource.start += io_virt_offset; 517 hose->io_resource.start += io_virt_offset;
518 hose->io_resource.end += io_virt_offset; 518 hose->io_resource.end += io_virt_offset;
519 519
520 pr_debug(" hose->io_resource=0x%016lx...0x%016lx\n", 520 pr_debug(" hose->io_resource=0x%016llx...0x%016llx\n",
521 hose->io_resource.start, hose->io_resource.end); 521 hose->io_resource.start, hose->io_resource.end);
522 522
523 return 0; 523 return 0;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c09cffafb6ee..f00f83109ab3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -590,6 +590,11 @@ static void __init check_cpu_slb_size(unsigned long node)
590{ 590{
591 u32 *slb_size_ptr; 591 u32 *slb_size_ptr;
592 592
593 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
594 if (slb_size_ptr != NULL) {
595 mmu_slb_size = *slb_size_ptr;
596 return;
597 }
593 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL); 598 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
594 if (slb_size_ptr != NULL) { 599 if (slb_size_ptr != NULL) {
595 mmu_slb_size = *slb_size_ptr; 600 mmu_slb_size = *slb_size_ptr;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d8bd2161e738..2d34196bba8c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -434,8 +434,8 @@ void __init setup_system(void)
434 printk("Starting Linux PPC64 %s\n", init_utsname()->version); 434 printk("Starting Linux PPC64 %s\n", init_utsname()->version);
435 435
436 printk("-----------------------------------------------------\n"); 436 printk("-----------------------------------------------------\n");
437 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 437 printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size);
438 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); 438 printk("physicalMemorySize = 0x%llx\n", lmb_phys_mem_size());
439 if (ppc64_caches.dline_size != 0x80) 439 if (ppc64_caches.dline_size != 0x80)
440 printk("ppc64_caches.dcache_line_size = 0x%x\n", 440 printk("ppc64_caches.dcache_line_size = 0x%x\n",
441 ppc64_caches.dline_size); 441 ppc64_caches.dline_size);
@@ -493,7 +493,7 @@ static void __init emergency_stack_init(void)
493 * bringup, we need to get at them in real mode. This means they 493 * bringup, we need to get at them in real mode. This means they
494 * must also be within the RMO region. 494 * must also be within the RMO region.
495 */ 495 */
496 limit = min(0x10000000UL, lmb.rmo_size); 496 limit = min(0x10000000ULL, lmb.rmo_size);
497 497
498 for_each_possible_cpu(i) { 498 for_each_possible_cpu(i) {
499 unsigned long sp; 499 unsigned long sp;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 47bf15cd2c9e..161b9b9691f0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -87,7 +87,9 @@ SECTIONS
87 /* The dummy segment contents for the bug workaround mentioned above 87 /* The dummy segment contents for the bug workaround mentioned above
88 near PHDRS. */ 88 near PHDRS. */
89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { 89 .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) {
90 LONG(0xf177) 90 LONG(0)
91 LONG(0)
92 LONG(0)
91 } :kernel :dummy 93 } :kernel :dummy
92 94
93/* 95/*
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 23cee39534fd..1971e4ee3d6e 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -56,18 +56,11 @@
56 56
57extern void loadcam_entry(unsigned int index); 57extern void loadcam_entry(unsigned int index);
58unsigned int tlbcam_index; 58unsigned int tlbcam_index;
59unsigned int num_tlbcam_entries;
60static unsigned long __cam0, __cam1, __cam2; 59static unsigned long __cam0, __cam1, __cam2;
61 60
62#define NUM_TLBCAMS (16) 61#define NUM_TLBCAMS (16)
63 62
64struct tlbcam { 63struct tlbcam TLBCAM[NUM_TLBCAMS];
65 u32 MAS0;
66 u32 MAS1;
67 u32 MAS2;
68 u32 MAS3;
69 u32 MAS7;
70} TLBCAM[NUM_TLBCAMS];
71 64
72struct tlbcamrange { 65struct tlbcamrange {
73 unsigned long start; 66 unsigned long start;
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index ad123bced404..d1f9c62dc177 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -75,6 +75,15 @@ extern void _tlbia(void);
75#endif /* CONFIG_PPC_MMU_NOHASH */ 75#endif /* CONFIG_PPC_MMU_NOHASH */
76 76
77#ifdef CONFIG_PPC32 77#ifdef CONFIG_PPC32
78
79struct tlbcam {
80 u32 MAS0;
81 u32 MAS1;
82 u32 MAS2;
83 u32 MAS3;
84 u32 MAS7;
85};
86
78extern void mapin_ram(void); 87extern void mapin_ram(void);
79extern int map_page(unsigned long va, phys_addr_t pa, int flags); 88extern int map_page(unsigned long va, phys_addr_t pa, int flags);
80extern void setbat(int index, unsigned long virt, phys_addr_t phys, 89extern void setbat(int index, unsigned long virt, phys_addr_t phys,
@@ -90,8 +99,6 @@ extern unsigned int rtas_data, rtas_size;
90struct hash_pte; 99struct hash_pte;
91extern struct hash_pte *Hash, *Hash_end; 100extern struct hash_pte *Hash, *Hash_end;
92extern unsigned long Hash_size, Hash_mask; 101extern unsigned long Hash_size, Hash_mask;
93
94extern unsigned int num_tlbcam_entries;
95#endif 102#endif
96 103
97extern unsigned long ioremap_bot; 104extern unsigned long ioremap_bot;
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index db44e02e045b..ba5194817f8a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -710,9 +710,18 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
710 unsigned long len) 710 unsigned long len)
711{ 711{
712 struct slice_mask mask, available; 712 struct slice_mask mask, available;
713 unsigned int psize = mm->context.user_psize;
713 714
714 mask = slice_range_to_mask(addr, len); 715 mask = slice_range_to_mask(addr, len);
715 available = slice_mask_for_size(mm, mm->context.user_psize); 716 available = slice_mask_for_size(mm, psize);
717#ifdef CONFIG_PPC_64K_PAGES
718 /* We need to account for 4k slices too */
719 if (psize == MMU_PAGE_64K) {
720 struct slice_mask compat_mask;
721 compat_mask = slice_mask_for_size(mm, MMU_PAGE_4K);
722 or_mask(available, compat_mask);
723 }
724#endif
716 725
717#if 0 /* too verbose */ 726#if 0 /* too verbose */
718 slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n", 727 slice_dbg("is_hugepage_only_range(mm=%p, addr=%lx, len=%lx)\n",
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 60e6032a8088..98cd1dc2ae75 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -251,8 +251,8 @@ void __init stabs_alloc(void)
251 251
252 paca[cpu].stab_addr = newstab; 252 paca[cpu].stab_addr = newstab;
253 paca[cpu].stab_real = virt_to_abs(newstab); 253 paca[cpu].stab_real = virt_to_abs(newstab);
254 printk(KERN_INFO "Segment table for CPU %d at 0x%lx " 254 printk(KERN_INFO "Segment table for CPU %d at 0x%llx "
255 "virtual, 0x%lx absolute\n", 255 "virtual, 0x%llx absolute\n",
256 cpu, paca[cpu].stab_addr, paca[cpu].stab_real); 256 cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
257 } 257 }
258} 258}
diff --git a/arch/powerpc/oprofile/op_model_pa6t.c b/arch/powerpc/oprofile/op_model_pa6t.c
index c40de461fd4e..42f778dff919 100644
--- a/arch/powerpc/oprofile/op_model_pa6t.c
+++ b/arch/powerpc/oprofile/op_model_pa6t.c
@@ -132,7 +132,7 @@ static int pa6t_reg_setup(struct op_counter_config *ctr,
132 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) { 132 for (pmc = 0; pmc < cur_cpu_spec->num_pmcs; pmc++) {
133 /* counters are 40 bit. Move to cputable at some point? */ 133 /* counters are 40 bit. Move to cputable at some point? */
134 reset_value[pmc] = (0x1UL << 39) - ctr[pmc].count; 134 reset_value[pmc] = (0x1UL << 39) - ctr[pmc].count;
135 pr_debug("reset_value for pmc%u inited to 0x%lx\n", 135 pr_debug("reset_value for pmc%u inited to 0x%llx\n",
136 pmc, reset_value[pmc]); 136 pmc, reset_value[pmc]);
137 } 137 }
138 138
@@ -177,7 +177,7 @@ static int pa6t_start(struct op_counter_config *ctr)
177 177
178 oprofile_running = 1; 178 oprofile_running = 1;
179 179
180 pr_debug("start on cpu %d, mmcr0 %lx\n", smp_processor_id(), mmcr0); 180 pr_debug("start on cpu %d, mmcr0 %llx\n", smp_processor_id(), mmcr0);
181 181
182 return 0; 182 return 0;
183} 183}
@@ -193,7 +193,7 @@ static void pa6t_stop(void)
193 193
194 oprofile_running = 0; 194 oprofile_running = 0;
195 195
196 pr_debug("stop on cpu %d, mmcr0 %lx\n", smp_processor_id(), mmcr0); 196 pr_debug("stop on cpu %d, mmcr0 %llx\n", smp_processor_id(), mmcr0);
197} 197}
198 198
199/* handle the perfmon overflow vector */ 199/* handle the perfmon overflow vector */
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index f416014ee727..1bcff94eb924 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -56,12 +56,12 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
56 int dev_match = 0; 56 int dev_match = 0;
57 int id_match = 0; 57 int id_match = 0;
58 58
59 if (dev == NULL && id == NULL) 59 if (dev == NULL || id == NULL)
60 return NULL; 60 return NULL;
61 61
62 mutex_lock(&clocks_mutex); 62 mutex_lock(&clocks_mutex);
63 list_for_each_entry(p, &clocks, node) { 63 list_for_each_entry(p, &clocks, node) {
64 if (dev && dev == p->dev) 64 if (dev == p->dev)
65 dev_match++; 65 dev_match++;
66 if (strcmp(id, p->name) == 0) 66 if (strcmp(id, p->name) == 0)
67 id_match++; 67 id_match++;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 8a455ebce98d..07f89ae46d04 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -363,11 +363,8 @@ static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio)
363{ 363{
364 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 364 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
365 struct mpc52xx_gpt __iomem *regs = mm_gc->regs; 365 struct mpc52xx_gpt __iomem *regs = mm_gc->regs;
366 unsigned int ret;
367 366
368 return (in_be32(&regs->status) & (1 << (31 - 23))) ? 1 : 0; 367 return (in_be32(&regs->status) & (1 << (31 - 23))) ? 1 : 0;
369
370 return ret;
371} 368}
372 369
373static void 370static void
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 72865e8e4b51..0a093f03c758 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -196,6 +196,7 @@ static void mpc52xx_extirq_ack(unsigned int virq)
196 196
197static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type) 197static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
198{ 198{
199 struct irq_desc *desc = get_irq_desc(virq);
199 u32 ctrl_reg, type; 200 u32 ctrl_reg, type;
200 int irq; 201 int irq;
201 int l2irq; 202 int l2irq;
@@ -222,6 +223,11 @@ static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
222 type = 0; 223 type = 0;
223 } 224 }
224 225
226 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
227 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
228 if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
229 desc->status |= IRQ_LEVEL;
230
225 ctrl_reg = in_be32(&intr->ctrl); 231 ctrl_reg = in_be32(&intr->ctrl);
226 ctrl_reg &= ~(0x3 << (22 - (l2irq * 2))); 232 ctrl_reg &= ~(0x3 << (22 - (l2irq * 2)));
227 ctrl_reg |= (type << (22 - (l2irq * 2))); 233 ctrl_reg |= (type << (22 - (l2irq * 2)));
@@ -231,7 +237,7 @@ static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
231} 237}
232 238
233static struct irq_chip mpc52xx_extirq_irqchip = { 239static struct irq_chip mpc52xx_extirq_irqchip = {
234 .typename = " MPC52xx IRQ[0-3] ", 240 .typename = "MPC52xx External",
235 .mask = mpc52xx_extirq_mask, 241 .mask = mpc52xx_extirq_mask,
236 .unmask = mpc52xx_extirq_unmask, 242 .unmask = mpc52xx_extirq_unmask,
237 .ack = mpc52xx_extirq_ack, 243 .ack = mpc52xx_extirq_ack,
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index ba5028e29890..051777c542c7 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -3,6 +3,7 @@
3# 3#
4obj-y := misc.o usb.o 4obj-y := misc.o usb.o
5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o 5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o
6obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
6obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o 7obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o
7obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o 8obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
8obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o 9obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
diff --git a/drivers/i2c/chips/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 82a9bcb858b6..82a9bcb858b6 100644
--- a/drivers/i2c/chips/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 47fe2bea9865..200b9cb900ea 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -323,4 +323,15 @@ config SIMPLE_GPIO
323 chip-selects, Ethernet/USB PHY's power and various other small 323 chip-selects, Ethernet/USB PHY's power and various other small
324 on-board peripherals. 324 on-board peripherals.
325 325
326config MCU_MPC8349EMITX
327 tristate "MPC8349E-mITX MCU driver"
328 depends on I2C && PPC_83xx
329 select GENERIC_GPIO
330 select ARCH_REQUIRE_GPIOLIB
331 help
332 Say Y here to enable soft power-off functionality on the Freescale
333 boards with the MPC8349E-mITX-compatible MCU chips. This driver will
334 also register MCU GPIOs with the generic GPIO API, so you'll able
335 to use MCU pins as GPIOs.
336
326endmenu 337endmenu
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c
index 192a93509372..72254848a228 100644
--- a/arch/powerpc/platforms/cell/beat_interrupt.c
+++ b/arch/powerpc/platforms/cell/beat_interrupt.c
@@ -99,7 +99,7 @@ static void beatic_end_irq(unsigned int irq_plug)
99 err = beat_downcount_of_interrupt(irq_plug); 99 err = beat_downcount_of_interrupt(irq_plug);
100 if (err != 0) { 100 if (err != 0) {
101 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */ 101 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */
102 panic("Failed to downcount IRQ! Error = %16lx", err); 102 panic("Failed to downcount IRQ! Error = %16llx", err);
103 103
104 printk(KERN_ERR "IRQ over-downcounted, plug %d\n", irq_plug); 104 printk(KERN_ERR "IRQ over-downcounted, plug %d\n", irq_plug);
105 } 105 }
diff --git a/arch/powerpc/platforms/cell/celleb_scc_epci.c b/arch/powerpc/platforms/cell/celleb_scc_epci.c
index 08c285b10e30..48ec88a38a12 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_epci.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_epci.c
@@ -405,7 +405,7 @@ static int __init celleb_setup_epci(struct device_node *node,
405 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); 405 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1));
406 if (!hose->cfg_addr) 406 if (!hose->cfg_addr)
407 goto error; 407 goto error;
408 pr_debug("EPCI: cfg_addr map 0x%016lx->0x%016lx + 0x%016lx\n", 408 pr_debug("EPCI: cfg_addr map 0x%016llx->0x%016lx + 0x%016llx\n",
409 r.start, (unsigned long)hose->cfg_addr, (r.end - r.start + 1)); 409 r.start, (unsigned long)hose->cfg_addr, (r.end - r.start + 1));
410 410
411 if (of_address_to_resource(node, 2, &r)) 411 if (of_address_to_resource(node, 2, &r))
@@ -413,7 +413,7 @@ static int __init celleb_setup_epci(struct device_node *node,
413 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1)); 413 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1));
414 if (!hose->cfg_data) 414 if (!hose->cfg_data)
415 goto error; 415 goto error;
416 pr_debug("EPCI: cfg_data map 0x%016lx->0x%016lx + 0x%016lx\n", 416 pr_debug("EPCI: cfg_data map 0x%016llx->0x%016lx + 0x%016llx\n",
417 r.start, (unsigned long)hose->cfg_data, (r.end - r.start + 1)); 417 r.start, (unsigned long)hose->cfg_data, (r.end - r.start + 1));
418 418
419 hose->ops = &celleb_epci_ops; 419 hose->ops = &celleb_epci_ops;
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 88d94b59a7cb..ee5033eddf01 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -855,7 +855,7 @@ static int __init cell_iommu_init_disabled(void)
855 */ 855 */
856 if (np && size < lmb_end_of_DRAM()) { 856 if (np && size < lmb_end_of_DRAM()) {
857 printk(KERN_WARNING "iommu: force-enabled, dma window" 857 printk(KERN_WARNING "iommu: force-enabled, dma window"
858 " (%ldMB) smaller than total memory (%ldMB)\n", 858 " (%ldMB) smaller than total memory (%lldMB)\n",
859 size >> 20, lmb_end_of_DRAM() >> 20); 859 size >> 20, lmb_end_of_DRAM() >> 20);
860 return -ENODEV; 860 return -ENODEV;
861 } 861 }
@@ -985,7 +985,7 @@ static void cell_dma_dev_setup_fixed(struct device *dev)
985 addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base; 985 addr = cell_iommu_get_fixed_address(dev) + dma_iommu_fixed_base;
986 archdata->dma_data = (void *)addr; 986 archdata->dma_data = (void *)addr;
987 987
988 dev_dbg(dev, "iommu: fixed addr = %lx\n", addr); 988 dev_dbg(dev, "iommu: fixed addr = %llx\n", addr);
989} 989}
990 990
991static void insert_16M_pte(unsigned long addr, unsigned long *ptab, 991static void insert_16M_pte(unsigned long addr, unsigned long *ptab,
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 7b4cefa2199b..5f961c464cc4 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -38,16 +38,16 @@ static void dump_fir(int cpu)
38 /* Todo: do some nicer parsing of bits and based on them go down 38 /* Todo: do some nicer parsing of bits and based on them go down
39 * to other sub-units FIRs and not only IIC 39 * to other sub-units FIRs and not only IIC
40 */ 40 */
41 printk(KERN_ERR "Global Checkstop FIR : 0x%016lx\n", 41 printk(KERN_ERR "Global Checkstop FIR : 0x%016llx\n",
42 in_be64(&pregs->checkstop_fir)); 42 in_be64(&pregs->checkstop_fir));
43 printk(KERN_ERR "Global Recoverable FIR : 0x%016lx\n", 43 printk(KERN_ERR "Global Recoverable FIR : 0x%016llx\n",
44 in_be64(&pregs->checkstop_fir)); 44 in_be64(&pregs->checkstop_fir));
45 printk(KERN_ERR "Global MachineCheck FIR : 0x%016lx\n", 45 printk(KERN_ERR "Global MachineCheck FIR : 0x%016llx\n",
46 in_be64(&pregs->spec_att_mchk_fir)); 46 in_be64(&pregs->spec_att_mchk_fir));
47 47
48 if (iregs == NULL) 48 if (iregs == NULL)
49 return; 49 return;
50 printk(KERN_ERR "IOC FIR : 0x%016lx\n", 50 printk(KERN_ERR "IOC FIR : 0x%016llx\n",
51 in_be64(&iregs->ioc_fir)); 51 in_be64(&iregs->ioc_fir));
52 52
53} 53}
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index a5bdb89a17c3..e487ad68ac11 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -151,7 +151,7 @@ static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb)
151{ 151{
152 struct spu_priv2 __iomem *priv2 = spu->priv2; 152 struct spu_priv2 __iomem *priv2 = spu->priv2;
153 153
154 pr_debug("%s: adding SLB[%d] 0x%016lx 0x%016lx\n", 154 pr_debug("%s: adding SLB[%d] 0x%016llx 0x%016llx\n",
155 __func__, slbe, slb->vsid, slb->esid); 155 __func__, slbe, slb->vsid, slb->esid);
156 156
157 out_be64(&priv2->slb_index_W, slbe); 157 out_be64(&priv2->slb_index_W, slbe);
@@ -221,7 +221,7 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
221{ 221{
222 int ret; 222 int ret;
223 223
224 pr_debug("%s, %lx, %lx\n", __func__, dsisr, ea); 224 pr_debug("%s, %llx, %lx\n", __func__, dsisr, ea);
225 225
226 /* 226 /*
227 * Handle kernel space hash faults immediately. User hash 227 * Handle kernel space hash faults immediately. User hash
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
index 19f6bfdbb933..fec1495e6b12 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -54,7 +54,7 @@ long spu_sys_callback(struct spu_syscall_block *s)
54 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); 54 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
55 55
56 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { 56 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
57 pr_debug("%s: invalid syscall #%ld", __func__, s->nr_ret); 57 pr_debug("%s: invalid syscall #%lld", __func__, s->nr_ret);
58 return -ENOSYS; 58 return -ENOSYS;
59 } 59 }
60 60
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index af116aadba10..c4d4a19235e0 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -42,7 +42,7 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
42 return spufs_coredump_read[num].read(ctx, buffer, size, off); 42 return spufs_coredump_read[num].read(ctx, buffer, size, off);
43 43
44 data = spufs_coredump_read[num].get(ctx); 44 data = spufs_coredump_read[num].get(ctx);
45 ret = snprintf(buffer, size, "0x%.16lx", data); 45 ret = snprintf(buffer, size, "0x%.16llx", data);
46 if (ret >= size) 46 if (ret >= size)
47 return size; 47 return size;
48 return ++ret; /* count trailing NULL */ 48 return ++ret; /* count trailing NULL */
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index f093a581ac74..a4dd3ae7223a 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -132,7 +132,7 @@ int spufs_handle_class1(struct spu_context *ctx)
132 132
133 spuctx_switch_state(ctx, SPU_UTIL_IOWAIT); 133 spuctx_switch_state(ctx, SPU_UTIL_IOWAIT);
134 134
135 pr_debug("ctx %p: ea %016lx, dsisr %016lx state %d\n", ctx, ea, 135 pr_debug("ctx %p: ea %016llx, dsisr %016llx state %d\n", ctx, ea,
136 dsisr, ctx->state); 136 dsisr, ctx->state);
137 137
138 ctx->stats.hash_flt++; 138 ctx->stats.hash_flt++;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 7106b63d401b..0da7f2bf5ee1 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1654,7 +1654,7 @@ out:
1654 1654
1655static int spufs_check_valid_dma(struct mfc_dma_command *cmd) 1655static int spufs_check_valid_dma(struct mfc_dma_command *cmd)
1656{ 1656{
1657 pr_debug("queueing DMA %x %lx %x %x %x\n", cmd->lsa, 1657 pr_debug("queueing DMA %x %llx %x %x %x\n", cmd->lsa,
1658 cmd->ea, cmd->size, cmd->tag, cmd->cmd); 1658 cmd->ea, cmd->size, cmd->tag, cmd->cmd);
1659 1659
1660 switch (cmd->cmd) { 1660 switch (cmd->cmd) {
@@ -1671,7 +1671,7 @@ static int spufs_check_valid_dma(struct mfc_dma_command *cmd)
1671 } 1671 }
1672 1672
1673 if ((cmd->lsa & 0xf) != (cmd->ea &0xf)) { 1673 if ((cmd->lsa & 0xf) != (cmd->ea &0xf)) {
1674 pr_debug("invalid DMA alignment, ea %lx lsa %x\n", 1674 pr_debug("invalid DMA alignment, ea %llx lsa %x\n",
1675 cmd->ea, cmd->lsa); 1675 cmd->ea, cmd->lsa);
1676 return -EIO; 1676 return -EIO;
1677 } 1677 }
@@ -2633,7 +2633,7 @@ static int spufs_show_ctx(struct seq_file *s, void *private)
2633 } 2633 }
2634 2634
2635 seq_printf(s, "%c flgs(%lx) sflgs(%lx) pri(%d) ts(%d) spu(%02d)" 2635 seq_printf(s, "%c flgs(%lx) sflgs(%lx) pri(%d) ts(%d) spu(%02d)"
2636 " %c %lx %lx %lx %lx %x %x\n", 2636 " %c %llx %llx %llx %llx %x %x\n",
2637 ctx->state == SPU_STATE_SAVED ? 'S' : 'R', 2637 ctx->state == SPU_STATE_SAVED ? 'S' : 'R',
2638 ctx->flags, 2638 ctx->flags,
2639 ctx->sched_flags, 2639 ctx->sched_flags,
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 8c619963becc..1db6b9e037fc 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -249,6 +249,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
249DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229); 249DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
250DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249); 250DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
251DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575); 251DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
252DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
252 253
253static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev) 254static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev)
254{ 255{
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index bbe828f1b885..6ed75bffc8ab 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -66,7 +66,7 @@ static int tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
66 66
67 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce); 67 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce);
68 if (rc) 68 if (rc)
69 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n", 69 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%llx\n",
70 rc); 70 rc);
71 index++; 71 index++;
72 uaddr += TCE_PAGE_SIZE; 72 uaddr += TCE_PAGE_SIZE;
@@ -81,7 +81,7 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages)
81 while (npages--) { 81 while (npages--) {
82 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 0); 82 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 0);
83 if (rc) 83 if (rc)
84 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n", 84 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%llx\n",
85 rc); 85 rc);
86 index++; 86 index++;
87 } 87 }
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 6b0711c15eca..bd8817b00fa4 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -53,7 +53,7 @@
53#include <asm/pmac_low_i2c.h> 53#include <asm/pmac_low_i2c.h>
54#include <asm/pmac_pfunc.h> 54#include <asm/pmac_pfunc.h>
55 55
56#define DEBUG 56#undef DEBUG
57 57
58#ifdef DEBUG 58#ifdef DEBUG
59#define DBG(fmt...) udbg_printf(fmt) 59#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index ca71a12b764c..bb028f165fb3 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -82,7 +82,7 @@ static int __init ps3_register_lpm_devices(void)
82 goto fail_rights; 82 goto fail_rights;
83 } 83 }
84 84
85 pr_debug("%s:%d: pu_id %lu, rights %lu(%lxh)\n", 85 pr_debug("%s:%d: pu_id %llu, rights %llu(%llxh)\n",
86 __func__, __LINE__, dev->lpm.pu_id, dev->lpm.rights, 86 __func__, __LINE__, dev->lpm.pu_id, dev->lpm.rights,
87 dev->lpm.rights); 87 dev->lpm.rights);
88 88
@@ -348,7 +348,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
348 return -ENODEV; 348 return -ENODEV;
349 } 349 }
350 350
351 pr_debug("%s:%u: (%u:%u:%u): port %lu blk_size %lu num_blocks %lu " 351 pr_debug("%s:%u: (%u:%u:%u): port %llu blk_size %llu num_blocks %llu "
352 "num_regions %u\n", __func__, __LINE__, repo->bus_index, 352 "num_regions %u\n", __func__, __LINE__, repo->bus_index,
353 repo->dev_index, repo->dev_type, port, blk_size, num_blocks, 353 repo->dev_index, repo->dev_type, port, blk_size, num_blocks,
354 num_regions); 354 num_regions);
@@ -394,7 +394,7 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
394 result = -ENODEV; 394 result = -ENODEV;
395 goto fail_read_region; 395 goto fail_read_region;
396 } 396 }
397 pr_debug("%s:%u: region %u: id %u start %lu size %lu\n", 397 pr_debug("%s:%u: region %u: id %u start %llu size %llu\n",
398 __func__, __LINE__, i, id, start, size); 398 __func__, __LINE__, i, id, start, size);
399 399
400 p->regions[i].id = id; 400 p->regions[i].id = id;
@@ -662,13 +662,13 @@ static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
662 if (rem) 662 if (rem)
663 break; 663 break;
664 } 664 }
665 pr_warning("%s:%u: device %lu:%lu not found\n", __func__, __LINE__, 665 pr_warning("%s:%u: device %llu:%llu not found\n", __func__, __LINE__,
666 bus_id, dev_id); 666 bus_id, dev_id);
667 return; 667 return;
668 668
669found: 669found:
670 if (retries) 670 if (retries)
671 pr_debug("%s:%u: device %lu:%lu found after %u retries\n", 671 pr_debug("%s:%u: device %llu:%llu found after %u retries\n",
672 __func__, __LINE__, bus_id, dev_id, retries); 672 __func__, __LINE__, bus_id, dev_id, retries);
673 673
674 ps3_setup_dynamic_device(&repo); 674 ps3_setup_dynamic_device(&repo);
@@ -715,14 +715,14 @@ static irqreturn_t ps3_notification_interrupt(int irq, void *data)
715 res = lv1_storage_get_async_status(PS3_NOTIFICATION_DEV_ID, &tag, 715 res = lv1_storage_get_async_status(PS3_NOTIFICATION_DEV_ID, &tag,
716 &status); 716 &status);
717 if (tag != dev->tag) 717 if (tag != dev->tag)
718 pr_err("%s:%u: tag mismatch, got %lx, expected %lx\n", 718 pr_err("%s:%u: tag mismatch, got %llx, expected %llx\n",
719 __func__, __LINE__, tag, dev->tag); 719 __func__, __LINE__, tag, dev->tag);
720 720
721 if (res) { 721 if (res) {
722 pr_err("%s:%u: res %d status 0x%lx\n", __func__, __LINE__, res, 722 pr_err("%s:%u: res %d status 0x%llx\n", __func__, __LINE__, res,
723 status); 723 status);
724 } else { 724 } else {
725 pr_debug("%s:%u: completed, status 0x%lx\n", __func__, 725 pr_debug("%s:%u: completed, status 0x%llx\n", __func__,
726 __LINE__, status); 726 __LINE__, status);
727 dev->lv1_status = status; 727 dev->lv1_status = status;
728 complete(&dev->done); 728 complete(&dev->done);
@@ -761,7 +761,7 @@ static int ps3_notification_read_write(struct ps3_notification_device *dev,
761 } 761 }
762 762
763 if (dev->lv1_status) { 763 if (dev->lv1_status) {
764 pr_err("%s:%u: %s not completed, status 0x%lx\n", __func__, 764 pr_err("%s:%u: %s not completed, status 0x%llx\n", __func__,
765 __LINE__, op, dev->lv1_status); 765 __LINE__, op, dev->lv1_status);
766 return -EIO; 766 return -EIO;
767 } 767 }
@@ -850,16 +850,16 @@ static int ps3_probe_thread(void *data)
850 if (res) 850 if (res)
851 break; 851 break;
852 852
853 pr_debug("%s:%u: notify event type 0x%lx bus id %lu dev id %lu" 853 pr_debug("%s:%u: notify event type 0x%llx bus id %llu dev id %llu"
854 " type %lu port %lu\n", __func__, __LINE__, 854 " type %llu port %llu\n", __func__, __LINE__,
855 notify_event->event_type, notify_event->bus_id, 855 notify_event->event_type, notify_event->bus_id,
856 notify_event->dev_id, notify_event->dev_type, 856 notify_event->dev_id, notify_event->dev_type,
857 notify_event->dev_port); 857 notify_event->dev_port);
858 858
859 if (notify_event->event_type != notify_region_probe || 859 if (notify_event->event_type != notify_region_probe ||
860 notify_event->bus_id != dev.sbd.bus_id) { 860 notify_event->bus_id != dev.sbd.bus_id) {
861 pr_warning("%s:%u: bad notify_event: event %lu, " 861 pr_warning("%s:%u: bad notify_event: event %llu, "
862 "dev_id %lu, dev_type %lu\n", 862 "dev_id %llu, dev_type %llu\n",
863 __func__, __LINE__, notify_event->event_type, 863 __func__, __LINE__, notify_event->event_type,
864 notify_event->dev_id, 864 notify_event->dev_id,
865 notify_event->dev_type); 865 notify_event->dev_type);
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 6eb1d4d182c9..1e8a1e39dfe8 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -75,7 +75,7 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va,
75 75
76 if (result) { 76 if (result) {
77 /* all entries bolted !*/ 77 /* all entries bolted !*/
78 pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%lx r=%lx\n", 78 pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%llx r=%llx\n",
79 __func__, result, va, pa, hpte_group, hpte_v, hpte_r); 79 __func__, result, va, pa, hpte_group, hpte_v, hpte_r);
80 BUG(); 80 BUG();
81 } 81 }
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index e59634f7af96..8ec5ccf76b19 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -60,6 +60,8 @@
60 * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note 60 * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note
61 * that there is no constraint on how many in this set an individual thread 61 * that there is no constraint on how many in this set an individual thread
62 * can acquire. 62 * can acquire.
63 *
64 * The mask is declared as unsigned long so we can use set/clear_bit on it.
63 */ 65 */
64 66
65#define PS3_BMP_MINALIGN 64 67#define PS3_BMP_MINALIGN 64
@@ -68,7 +70,7 @@ struct ps3_bmp {
68 struct { 70 struct {
69 u64 status; 71 u64 status;
70 u64 unused_1[3]; 72 u64 unused_1[3];
71 u64 mask; 73 unsigned long mask;
72 u64 unused_2[3]; 74 u64 unused_2[3];
73 }; 75 };
74 u64 ipi_debug_brk_mask; 76 u64 ipi_debug_brk_mask;
@@ -102,7 +104,7 @@ static void ps3_chip_mask(unsigned int virq)
102 struct ps3_private *pd = get_irq_chip_data(virq); 104 struct ps3_private *pd = get_irq_chip_data(virq);
103 unsigned long flags; 105 unsigned long flags;
104 106
105 pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__, 107 pr_debug("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__,
106 pd->thread_id, virq); 108 pd->thread_id, virq);
107 109
108 local_irq_save(flags); 110 local_irq_save(flags);
@@ -123,7 +125,7 @@ static void ps3_chip_unmask(unsigned int virq)
123 struct ps3_private *pd = get_irq_chip_data(virq); 125 struct ps3_private *pd = get_irq_chip_data(virq);
124 unsigned long flags; 126 unsigned long flags;
125 127
126 pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__, 128 pr_debug("%s:%d: thread_id %llu, virq %d\n", __func__, __LINE__,
127 pd->thread_id, virq); 129 pd->thread_id, virq);
128 130
129 local_irq_save(flags); 131 local_irq_save(flags);
@@ -221,7 +223,7 @@ static int ps3_virq_destroy(unsigned int virq)
221{ 223{
222 const struct ps3_private *pd = get_irq_chip_data(virq); 224 const struct ps3_private *pd = get_irq_chip_data(virq);
223 225
224 pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__, 226 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__,
225 __LINE__, pd->ppe_id, pd->thread_id, virq); 227 __LINE__, pd->ppe_id, pd->thread_id, virq);
226 228
227 set_irq_chip_data(virq, NULL); 229 set_irq_chip_data(virq, NULL);
@@ -291,7 +293,7 @@ int ps3_irq_plug_destroy(unsigned int virq)
291 int result; 293 int result;
292 const struct ps3_private *pd = get_irq_chip_data(virq); 294 const struct ps3_private *pd = get_irq_chip_data(virq);
293 295
294 pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__, 296 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, virq %u\n", __func__,
295 __LINE__, pd->ppe_id, pd->thread_id, virq); 297 __LINE__, pd->ppe_id, pd->thread_id, virq);
296 298
297 ps3_chip_mask(virq); 299 ps3_chip_mask(virq);
@@ -322,7 +324,7 @@ EXPORT_SYMBOL_GPL(ps3_irq_plug_destroy);
322int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq) 324int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq)
323{ 325{
324 int result; 326 int result;
325 unsigned long outlet; 327 u64 outlet;
326 328
327 result = lv1_construct_event_receive_port(&outlet); 329 result = lv1_construct_event_receive_port(&outlet);
328 330
@@ -468,7 +470,7 @@ int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
468 unsigned int *virq) 470 unsigned int *virq)
469{ 471{
470 int result; 472 int result;
471 unsigned long outlet; 473 u64 outlet;
472 474
473 result = lv1_construct_io_irq_outlet(interrupt_id, &outlet); 475 result = lv1_construct_io_irq_outlet(interrupt_id, &outlet);
474 476
@@ -525,7 +527,7 @@ int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
525 unsigned int *virq) 527 unsigned int *virq)
526{ 528{
527 int result; 529 int result;
528 unsigned long outlet; 530 u64 outlet;
529 u64 lpar_addr; 531 u64 lpar_addr;
530 532
531 BUG_ON(!is_kernel_addr((u64)virt_addr_bmp)); 533 BUG_ON(!is_kernel_addr((u64)virt_addr_bmp));
@@ -581,7 +583,7 @@ int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id,
581 unsigned int class, unsigned int *virq) 583 unsigned int class, unsigned int *virq)
582{ 584{
583 int result; 585 int result;
584 unsigned long outlet; 586 u64 outlet;
585 587
586 BUG_ON(class > 2); 588 BUG_ON(class > 2);
587 589
@@ -691,7 +693,7 @@ void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
691 693
692 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq; 694 pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq;
693 695
694 pr_debug("%s:%d: cpu %u, virq %u, mask %lxh\n", __func__, __LINE__, 696 pr_debug("%s:%d: cpu %u, virq %u, mask %llxh\n", __func__, __LINE__,
695 cpu, virq, pd->bmp.ipi_debug_brk_mask); 697 cpu, virq, pd->bmp.ipi_debug_brk_mask);
696} 698}
697 699
@@ -710,7 +712,7 @@ static unsigned int ps3_get_irq(void)
710 plug &= 0x3f; 712 plug &= 0x3f;
711 713
712 if (unlikely(plug == NO_IRQ)) { 714 if (unlikely(plug == NO_IRQ)) {
713 pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__, 715 pr_debug("%s:%d: no plug found: thread_id %llu\n", __func__,
714 __LINE__, pd->thread_id); 716 __LINE__, pd->thread_id);
715 dump_bmp(&per_cpu(ps3_private, 0)); 717 dump_bmp(&per_cpu(ps3_private, 0));
716 dump_bmp(&per_cpu(ps3_private, 1)); 718 dump_bmp(&per_cpu(ps3_private, 1));
@@ -745,7 +747,7 @@ void __init ps3_init_IRQ(void)
745 pd->thread_id = get_hard_smp_processor_id(cpu); 747 pd->thread_id = get_hard_smp_processor_id(cpu);
746 spin_lock_init(&pd->bmp.lock); 748 spin_lock_init(&pd->bmp.lock);
747 749
748 pr_debug("%s:%d: ppe_id %lu, thread_id %lu, bmp %lxh\n", 750 pr_debug("%s:%d: ppe_id %llu, thread_id %llu, bmp %lxh\n",
749 __func__, __LINE__, pd->ppe_id, pd->thread_id, 751 __func__, __LINE__, pd->ppe_id, pd->thread_id,
750 ps3_mm_phys_to_lpar(__pa(&pd->bmp))); 752 ps3_mm_phys_to_lpar(__pa(&pd->bmp)));
751 753
@@ -770,6 +772,6 @@ void ps3_shutdown_IRQ(int cpu)
770 lv1_get_logical_ppe_id(&ppe_id); 772 lv1_get_logical_ppe_id(&ppe_id);
771 result = lv1_configure_irq_state_bitmap(ppe_id, thread_id, 0); 773 result = lv1_configure_irq_state_bitmap(ppe_id, thread_id, 0);
772 774
773 DBG("%s:%d: lv1_configure_irq_state_bitmap (%lu:%lu/%d) %s\n", __func__, 775 DBG("%s:%d: lv1_configure_irq_state_bitmap (%llu:%llu/%d) %s\n", __func__,
774 __LINE__, ppe_id, thread_id, cpu, ps3_result(result)); 776 __LINE__, ppe_id, thread_id, cpu, ps3_result(result));
775} 777}
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index a4d49dd9e8a9..67de6bf3db3d 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -79,8 +79,8 @@ enum {
79 */ 79 */
80 80
81struct mem_region { 81struct mem_region {
82 unsigned long base; 82 u64 base;
83 unsigned long size; 83 u64 size;
84 unsigned long offset; 84 unsigned long offset;
85}; 85};
86 86
@@ -103,9 +103,9 @@ struct mem_region {
103 */ 103 */
104 104
105struct map { 105struct map {
106 unsigned long total; 106 u64 total;
107 unsigned long vas_id; 107 u64 vas_id;
108 unsigned long htab_size; 108 u64 htab_size;
109 struct mem_region rm; 109 struct mem_region rm;
110 struct mem_region r1; 110 struct mem_region r1;
111}; 111};
@@ -114,13 +114,13 @@ struct map {
114static void __maybe_unused _debug_dump_map(const struct map *m, 114static void __maybe_unused _debug_dump_map(const struct map *m,
115 const char *func, int line) 115 const char *func, int line)
116{ 116{
117 DBG("%s:%d: map.total = %lxh\n", func, line, m->total); 117 DBG("%s:%d: map.total = %llxh\n", func, line, m->total);
118 DBG("%s:%d: map.rm.size = %lxh\n", func, line, m->rm.size); 118 DBG("%s:%d: map.rm.size = %llxh\n", func, line, m->rm.size);
119 DBG("%s:%d: map.vas_id = %lu\n", func, line, m->vas_id); 119 DBG("%s:%d: map.vas_id = %llu\n", func, line, m->vas_id);
120 DBG("%s:%d: map.htab_size = %lxh\n", func, line, m->htab_size); 120 DBG("%s:%d: map.htab_size = %llxh\n", func, line, m->htab_size);
121 DBG("%s:%d: map.r1.base = %lxh\n", func, line, m->r1.base); 121 DBG("%s:%d: map.r1.base = %llxh\n", func, line, m->r1.base);
122 DBG("%s:%d: map.r1.offset = %lxh\n", func, line, m->r1.offset); 122 DBG("%s:%d: map.r1.offset = %lxh\n", func, line, m->r1.offset);
123 DBG("%s:%d: map.r1.size = %lxh\n", func, line, m->r1.size); 123 DBG("%s:%d: map.r1.size = %llxh\n", func, line, m->r1.size);
124} 124}
125 125
126static struct map map; 126static struct map map;
@@ -146,11 +146,11 @@ EXPORT_SYMBOL(ps3_mm_phys_to_lpar);
146void __init ps3_mm_vas_create(unsigned long* htab_size) 146void __init ps3_mm_vas_create(unsigned long* htab_size)
147{ 147{
148 int result; 148 int result;
149 unsigned long start_address; 149 u64 start_address;
150 unsigned long size; 150 u64 size;
151 unsigned long access_right; 151 u64 access_right;
152 unsigned long max_page_size; 152 u64 max_page_size;
153 unsigned long flags; 153 u64 flags;
154 154
155 result = lv1_query_logical_partition_address_region_info(0, 155 result = lv1_query_logical_partition_address_region_info(0,
156 &start_address, &size, &access_right, &max_page_size, 156 &start_address, &size, &access_right, &max_page_size,
@@ -164,7 +164,7 @@ void __init ps3_mm_vas_create(unsigned long* htab_size)
164 } 164 }
165 165
166 if (max_page_size < PAGE_SHIFT_16M) { 166 if (max_page_size < PAGE_SHIFT_16M) {
167 DBG("%s:%d: bad max_page_size %lxh\n", __func__, __LINE__, 167 DBG("%s:%d: bad max_page_size %llxh\n", __func__, __LINE__,
168 max_page_size); 168 max_page_size);
169 goto fail; 169 goto fail;
170 } 170 }
@@ -208,7 +208,7 @@ void ps3_mm_vas_destroy(void)
208{ 208{
209 int result; 209 int result;
210 210
211 DBG("%s:%d: map.vas_id = %lu\n", __func__, __LINE__, map.vas_id); 211 DBG("%s:%d: map.vas_id = %llu\n", __func__, __LINE__, map.vas_id);
212 212
213 if (map.vas_id) { 213 if (map.vas_id) {
214 result = lv1_select_virtual_address_space(0); 214 result = lv1_select_virtual_address_space(0);
@@ -235,15 +235,14 @@ void ps3_mm_vas_destroy(void)
235static int ps3_mm_region_create(struct mem_region *r, unsigned long size) 235static int ps3_mm_region_create(struct mem_region *r, unsigned long size)
236{ 236{
237 int result; 237 int result;
238 unsigned long muid; 238 u64 muid;
239 239
240 r->size = _ALIGN_DOWN(size, 1 << PAGE_SHIFT_16M); 240 r->size = _ALIGN_DOWN(size, 1 << PAGE_SHIFT_16M);
241 241
242 DBG("%s:%d requested %lxh\n", __func__, __LINE__, size); 242 DBG("%s:%d requested %lxh\n", __func__, __LINE__, size);
243 DBG("%s:%d actual %lxh\n", __func__, __LINE__, r->size); 243 DBG("%s:%d actual %llxh\n", __func__, __LINE__, r->size);
244 DBG("%s:%d difference %lxh (%luMB)\n", __func__, __LINE__, 244 DBG("%s:%d difference %llxh (%lluMB)\n", __func__, __LINE__,
245 (unsigned long)(size - r->size), 245 size - r->size, (size - r->size) / 1024 / 1024);
246 (size - r->size) / 1024 / 1024);
247 246
248 if (r->size == 0) { 247 if (r->size == 0) {
249 DBG("%s:%d: size == 0\n", __func__, __LINE__); 248 DBG("%s:%d: size == 0\n", __func__, __LINE__);
@@ -277,7 +276,7 @@ static void ps3_mm_region_destroy(struct mem_region *r)
277{ 276{
278 int result; 277 int result;
279 278
280 DBG("%s:%d: r->base = %lxh\n", __func__, __LINE__, r->base); 279 DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base);
281 if (r->base) { 280 if (r->base) {
282 result = lv1_release_memory(r->base); 281 result = lv1_release_memory(r->base);
283 BUG_ON(result); 282 BUG_ON(result);
@@ -355,7 +354,7 @@ static unsigned long dma_sb_lpar_to_bus(struct ps3_dma_region *r,
355static void __maybe_unused _dma_dump_region(const struct ps3_dma_region *r, 354static void __maybe_unused _dma_dump_region(const struct ps3_dma_region *r,
356 const char *func, int line) 355 const char *func, int line)
357{ 356{
358 DBG("%s:%d: dev %lu:%lu\n", func, line, r->dev->bus_id, 357 DBG("%s:%d: dev %llu:%llu\n", func, line, r->dev->bus_id,
359 r->dev->dev_id); 358 r->dev->dev_id);
360 DBG("%s:%d: page_size %u\n", func, line, r->page_size); 359 DBG("%s:%d: page_size %u\n", func, line, r->page_size);
361 DBG("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr); 360 DBG("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr);
@@ -390,7 +389,7 @@ struct dma_chunk {
390static void _dma_dump_chunk (const struct dma_chunk* c, const char* func, 389static void _dma_dump_chunk (const struct dma_chunk* c, const char* func,
391 int line) 390 int line)
392{ 391{
393 DBG("%s:%d: r.dev %lu:%lu\n", func, line, 392 DBG("%s:%d: r.dev %llu:%llu\n", func, line,
394 c->region->dev->bus_id, c->region->dev->dev_id); 393 c->region->dev->bus_id, c->region->dev->dev_id);
395 DBG("%s:%d: r.bus_addr %lxh\n", func, line, c->region->bus_addr); 394 DBG("%s:%d: r.bus_addr %lxh\n", func, line, c->region->bus_addr);
396 DBG("%s:%d: r.page_size %u\n", func, line, c->region->page_size); 395 DBG("%s:%d: r.page_size %u\n", func, line, c->region->page_size);
@@ -596,7 +595,7 @@ static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr,
596 595
597 /* build ioptes for the area */ 596 /* build ioptes for the area */
598 pages = len >> r->page_size; 597 pages = len >> r->page_size;
599 DBG("%s: pgsize=%#x len=%#lx pages=%#x iopteflag=%#lx\n", __func__, 598 DBG("%s: pgsize=%#x len=%#lx pages=%#x iopteflag=%#llx\n", __func__,
600 r->page_size, r->len, pages, iopte_flag); 599 r->page_size, r->len, pages, iopte_flag);
601 for (iopage = 0; iopage < pages; iopage++) { 600 for (iopage = 0; iopage < pages; iopage++) {
602 offset = (1 << r->page_size) * iopage; 601 offset = (1 << r->page_size) * iopage;
@@ -648,13 +647,14 @@ fail_alloc:
648static int dma_sb_region_create(struct ps3_dma_region *r) 647static int dma_sb_region_create(struct ps3_dma_region *r)
649{ 648{
650 int result; 649 int result;
650 u64 bus_addr;
651 651
652 DBG(" -> %s:%d:\n", __func__, __LINE__); 652 DBG(" -> %s:%d:\n", __func__, __LINE__);
653 653
654 BUG_ON(!r); 654 BUG_ON(!r);
655 655
656 if (!r->dev->bus_id) { 656 if (!r->dev->bus_id) {
657 pr_info("%s:%d: %lu:%lu no dma\n", __func__, __LINE__, 657 pr_info("%s:%d: %llu:%llu no dma\n", __func__, __LINE__,
658 r->dev->bus_id, r->dev->dev_id); 658 r->dev->bus_id, r->dev->dev_id);
659 return 0; 659 return 0;
660 } 660 }
@@ -671,7 +671,8 @@ static int dma_sb_region_create(struct ps3_dma_region *r)
671 671
672 result = lv1_allocate_device_dma_region(r->dev->bus_id, r->dev->dev_id, 672 result = lv1_allocate_device_dma_region(r->dev->bus_id, r->dev->dev_id,
673 roundup_pow_of_two(r->len), r->page_size, r->region_type, 673 roundup_pow_of_two(r->len), r->page_size, r->region_type,
674 &r->bus_addr); 674 &bus_addr);
675 r->bus_addr = bus_addr;
675 676
676 if (result) { 677 if (result) {
677 DBG("%s:%d: lv1_allocate_device_dma_region failed: %s\n", 678 DBG("%s:%d: lv1_allocate_device_dma_region failed: %s\n",
@@ -685,6 +686,7 @@ static int dma_sb_region_create(struct ps3_dma_region *r)
685static int dma_ioc0_region_create(struct ps3_dma_region *r) 686static int dma_ioc0_region_create(struct ps3_dma_region *r)
686{ 687{
687 int result; 688 int result;
689 u64 bus_addr;
688 690
689 INIT_LIST_HEAD(&r->chunk_list.head); 691 INIT_LIST_HEAD(&r->chunk_list.head);
690 spin_lock_init(&r->chunk_list.lock); 692 spin_lock_init(&r->chunk_list.lock);
@@ -692,7 +694,8 @@ static int dma_ioc0_region_create(struct ps3_dma_region *r)
692 result = lv1_allocate_io_segment(0, 694 result = lv1_allocate_io_segment(0,
693 r->len, 695 r->len,
694 r->page_size, 696 r->page_size,
695 &r->bus_addr); 697 &bus_addr);
698 r->bus_addr = bus_addr;
696 if (result) { 699 if (result) {
697 DBG("%s:%d: lv1_allocate_io_segment failed: %s\n", 700 DBG("%s:%d: lv1_allocate_io_segment failed: %s\n",
698 __func__, __LINE__, ps3_result(result)); 701 __func__, __LINE__, ps3_result(result));
@@ -720,7 +723,7 @@ static int dma_sb_region_free(struct ps3_dma_region *r)
720 BUG_ON(!r); 723 BUG_ON(!r);
721 724
722 if (!r->dev->bus_id) { 725 if (!r->dev->bus_id) {
723 pr_info("%s:%d: %lu:%lu no dma\n", __func__, __LINE__, 726 pr_info("%s:%d: %llu:%llu no dma\n", __func__, __LINE__,
724 r->dev->bus_id, r->dev->dev_id); 727 r->dev->bus_id, r->dev->dev_id);
725 return 0; 728 return 0;
726 } 729 }
@@ -777,7 +780,7 @@ static int dma_ioc0_region_free(struct ps3_dma_region *r)
777 */ 780 */
778 781
779static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr, 782static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
780 unsigned long len, unsigned long *bus_addr, 783 unsigned long len, dma_addr_t *bus_addr,
781 u64 iopte_flag) 784 u64 iopte_flag)
782{ 785{
783 int result; 786 int result;
@@ -800,7 +803,7 @@ static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
800 DBG("%s:%d lpar_addr %lxh\n", __func__, __LINE__, 803 DBG("%s:%d lpar_addr %lxh\n", __func__, __LINE__,
801 lpar_addr); 804 lpar_addr);
802 DBG("%s:%d len %lxh\n", __func__, __LINE__, len); 805 DBG("%s:%d len %lxh\n", __func__, __LINE__, len);
803 DBG("%s:%d bus_addr %lxh (%lxh)\n", __func__, __LINE__, 806 DBG("%s:%d bus_addr %llxh (%lxh)\n", __func__, __LINE__,
804 *bus_addr, len); 807 *bus_addr, len);
805 } 808 }
806 809
@@ -832,7 +835,7 @@ static int dma_sb_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
832} 835}
833 836
834static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr, 837static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
835 unsigned long len, unsigned long *bus_addr, 838 unsigned long len, dma_addr_t *bus_addr,
836 u64 iopte_flag) 839 u64 iopte_flag)
837{ 840{
838 int result; 841 int result;
@@ -872,7 +875,7 @@ static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
872 return result; 875 return result;
873 } 876 }
874 *bus_addr = c->bus_addr + phys_addr - aligned_phys; 877 *bus_addr = c->bus_addr + phys_addr - aligned_phys;
875 DBG("%s: va=%#lx pa=%#lx a_pa=%#lx bus=%#lx\n", __func__, 878 DBG("%s: va=%#lx pa=%#lx a_pa=%#lx bus=%#llx\n", __func__,
876 virt_addr, phys_addr, aligned_phys, *bus_addr); 879 virt_addr, phys_addr, aligned_phys, *bus_addr);
877 c->usage_count = 1; 880 c->usage_count = 1;
878 881
@@ -889,7 +892,7 @@ static int dma_ioc0_map_area(struct ps3_dma_region *r, unsigned long virt_addr,
889 * This is the common dma unmap routine. 892 * This is the common dma unmap routine.
890 */ 893 */
891 894
892static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr, 895static int dma_sb_unmap_area(struct ps3_dma_region *r, dma_addr_t bus_addr,
893 unsigned long len) 896 unsigned long len)
894{ 897{
895 unsigned long flags; 898 unsigned long flags;
@@ -903,7 +906,7 @@ static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr,
903 1 << r->page_size); 906 1 << r->page_size);
904 unsigned long aligned_len = _ALIGN_UP(len + bus_addr 907 unsigned long aligned_len = _ALIGN_UP(len + bus_addr
905 - aligned_bus, 1 << r->page_size); 908 - aligned_bus, 1 << r->page_size);
906 DBG("%s:%d: not found: bus_addr %lxh\n", 909 DBG("%s:%d: not found: bus_addr %llxh\n",
907 __func__, __LINE__, bus_addr); 910 __func__, __LINE__, bus_addr);
908 DBG("%s:%d: not found: len %lxh\n", 911 DBG("%s:%d: not found: len %lxh\n",
909 __func__, __LINE__, len); 912 __func__, __LINE__, len);
@@ -926,12 +929,12 @@ static int dma_sb_unmap_area(struct ps3_dma_region *r, unsigned long bus_addr,
926} 929}
927 930
928static int dma_ioc0_unmap_area(struct ps3_dma_region *r, 931static int dma_ioc0_unmap_area(struct ps3_dma_region *r,
929 unsigned long bus_addr, unsigned long len) 932 dma_addr_t bus_addr, unsigned long len)
930{ 933{
931 unsigned long flags; 934 unsigned long flags;
932 struct dma_chunk *c; 935 struct dma_chunk *c;
933 936
934 DBG("%s: start a=%#lx l=%#lx\n", __func__, bus_addr, len); 937 DBG("%s: start a=%#llx l=%#lx\n", __func__, bus_addr, len);
935 spin_lock_irqsave(&r->chunk_list.lock, flags); 938 spin_lock_irqsave(&r->chunk_list.lock, flags);
936 c = dma_find_chunk(r, bus_addr, len); 939 c = dma_find_chunk(r, bus_addr, len);
937 940
@@ -941,7 +944,7 @@ static int dma_ioc0_unmap_area(struct ps3_dma_region *r,
941 unsigned long aligned_len = _ALIGN_UP(len + bus_addr 944 unsigned long aligned_len = _ALIGN_UP(len + bus_addr
942 - aligned_bus, 945 - aligned_bus,
943 1 << r->page_size); 946 1 << r->page_size);
944 DBG("%s:%d: not found: bus_addr %lxh\n", 947 DBG("%s:%d: not found: bus_addr %llxh\n",
945 __func__, __LINE__, bus_addr); 948 __func__, __LINE__, bus_addr);
946 DBG("%s:%d: not found: len %lxh\n", 949 DBG("%s:%d: not found: len %lxh\n",
947 __func__, __LINE__, len); 950 __func__, __LINE__, len);
@@ -975,7 +978,8 @@ static int dma_ioc0_unmap_area(struct ps3_dma_region *r,
975static int dma_sb_region_create_linear(struct ps3_dma_region *r) 978static int dma_sb_region_create_linear(struct ps3_dma_region *r)
976{ 979{
977 int result; 980 int result;
978 unsigned long virt_addr, len, tmp; 981 unsigned long virt_addr, len;
982 dma_addr_t tmp;
979 983
980 if (r->len > 16*1024*1024) { /* FIXME: need proper fix */ 984 if (r->len > 16*1024*1024) { /* FIXME: need proper fix */
981 /* force 16M dma pages for linear mapping */ 985 /* force 16M dma pages for linear mapping */
@@ -1027,7 +1031,8 @@ static int dma_sb_region_create_linear(struct ps3_dma_region *r)
1027static int dma_sb_region_free_linear(struct ps3_dma_region *r) 1031static int dma_sb_region_free_linear(struct ps3_dma_region *r)
1028{ 1032{
1029 int result; 1033 int result;
1030 unsigned long bus_addr, len, lpar_addr; 1034 dma_addr_t bus_addr;
1035 unsigned long len, lpar_addr;
1031 1036
1032 if (r->offset < map.rm.size) { 1037 if (r->offset < map.rm.size) {
1033 /* Unmap (part of) 1st RAM chunk */ 1038 /* Unmap (part of) 1st RAM chunk */
@@ -1072,7 +1077,7 @@ static int dma_sb_region_free_linear(struct ps3_dma_region *r)
1072 */ 1077 */
1073 1078
1074static int dma_sb_map_area_linear(struct ps3_dma_region *r, 1079static int dma_sb_map_area_linear(struct ps3_dma_region *r,
1075 unsigned long virt_addr, unsigned long len, unsigned long *bus_addr, 1080 unsigned long virt_addr, unsigned long len, dma_addr_t *bus_addr,
1076 u64 iopte_flag) 1081 u64 iopte_flag)
1077{ 1082{
1078 unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr) 1083 unsigned long phys_addr = is_kernel_addr(virt_addr) ? __pa(virt_addr)
@@ -1091,7 +1096,7 @@ static int dma_sb_map_area_linear(struct ps3_dma_region *r,
1091 */ 1096 */
1092 1097
1093static int dma_sb_unmap_area_linear(struct ps3_dma_region *r, 1098static int dma_sb_unmap_area_linear(struct ps3_dma_region *r,
1094 unsigned long bus_addr, unsigned long len) 1099 dma_addr_t bus_addr, unsigned long len)
1095{ 1100{
1096 return 0; 1101 return 0;
1097}; 1102};
@@ -1169,13 +1174,13 @@ int ps3_dma_region_free(struct ps3_dma_region *r)
1169EXPORT_SYMBOL(ps3_dma_region_free); 1174EXPORT_SYMBOL(ps3_dma_region_free);
1170 1175
1171int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, 1176int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
1172 unsigned long len, unsigned long *bus_addr, 1177 unsigned long len, dma_addr_t *bus_addr,
1173 u64 iopte_flag) 1178 u64 iopte_flag)
1174{ 1179{
1175 return r->region_ops->map(r, virt_addr, len, bus_addr, iopte_flag); 1180 return r->region_ops->map(r, virt_addr, len, bus_addr, iopte_flag);
1176} 1181}
1177 1182
1178int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, 1183int ps3_dma_unmap(struct ps3_dma_region *r, dma_addr_t bus_addr,
1179 unsigned long len) 1184 unsigned long len)
1180{ 1185{
1181 return r->region_ops->unmap(r, bus_addr, len); 1186 return r->region_ops->unmap(r, bus_addr, len);
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 1d201782d4e5..e1c83c23b435 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -306,7 +306,7 @@ static void _dump_params(const struct os_area_params *p, const char *func,
306{ 306{
307 pr_debug("%s:%d: p.boot_flag: %u\n", func, line, p->boot_flag); 307 pr_debug("%s:%d: p.boot_flag: %u\n", func, line, p->boot_flag);
308 pr_debug("%s:%d: p.num_params: %u\n", func, line, p->num_params); 308 pr_debug("%s:%d: p.num_params: %u\n", func, line, p->num_params);
309 pr_debug("%s:%d: p.rtc_diff %ld\n", func, line, p->rtc_diff); 309 pr_debug("%s:%d: p.rtc_diff %lld\n", func, line, p->rtc_diff);
310 pr_debug("%s:%d: p.av_multi_out %u\n", func, line, p->av_multi_out); 310 pr_debug("%s:%d: p.av_multi_out %u\n", func, line, p->av_multi_out);
311 pr_debug("%s:%d: p.ctrl_button: %u\n", func, line, p->ctrl_button); 311 pr_debug("%s:%d: p.ctrl_button: %u\n", func, line, p->ctrl_button);
312 pr_debug("%s:%d: p.static_ip_addr: %u.%u.%u.%u\n", func, line, 312 pr_debug("%s:%d: p.static_ip_addr: %u.%u.%u.%u\n", func, line,
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index 22063adeb38b..5e304c292f68 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -44,7 +44,7 @@ static void _dump_field(const char *hdr, u64 n, const char *func, int line)
44 s[i] = (in[i] <= 126 && in[i] >= 32) ? in[i] : '.'; 44 s[i] = (in[i] <= 126 && in[i] >= 32) ? in[i] : '.';
45 s[i] = 0; 45 s[i] = 0;
46 46
47 pr_debug("%s:%d: %s%016lx : %s\n", func, line, hdr, n, s); 47 pr_debug("%s:%d: %s%016llx : %s\n", func, line, hdr, n, s);
48#endif 48#endif
49} 49}
50 50
@@ -70,8 +70,8 @@ static void _dump_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
70 _dump_field("n2: ", n2, func, line); 70 _dump_field("n2: ", n2, func, line);
71 _dump_field("n3: ", n3, func, line); 71 _dump_field("n3: ", n3, func, line);
72 _dump_field("n4: ", n4, func, line); 72 _dump_field("n4: ", n4, func, line);
73 pr_debug("%s:%d: v1: %016lx\n", func, line, v1); 73 pr_debug("%s:%d: v1: %016llx\n", func, line, v1);
74 pr_debug("%s:%d: v2: %016lx\n", func, line, v2); 74 pr_debug("%s:%d: v2: %016llx\n", func, line, v2);
75} 75}
76 76
77/** 77/**
@@ -149,10 +149,10 @@ static int read_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
149 *_v2 = v2; 149 *_v2 = v2;
150 150
151 if (v1 && !_v1) 151 if (v1 && !_v1)
152 pr_debug("%s:%d: warning: discarding non-zero v1: %016lx\n", 152 pr_debug("%s:%d: warning: discarding non-zero v1: %016llx\n",
153 __func__, __LINE__, v1); 153 __func__, __LINE__, v1);
154 if (v2 && !_v2) 154 if (v2 && !_v2)
155 pr_debug("%s:%d: warning: discarding non-zero v2: %016lx\n", 155 pr_debug("%s:%d: warning: discarding non-zero v2: %016llx\n",
156 __func__, __LINE__, v2); 156 __func__, __LINE__, v2);
157 157
158 return 0; 158 return 0;
@@ -327,7 +327,7 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
327 return result; 327 return result;
328 } 328 }
329 329
330 pr_debug("%s:%d: bus_type %u, bus_index %u, bus_id %lu, num_dev %u\n", 330 pr_debug("%s:%d: bus_type %u, bus_index %u, bus_id %llu, num_dev %u\n",
331 __func__, __LINE__, tmp.bus_type, tmp.bus_index, tmp.bus_id, 331 __func__, __LINE__, tmp.bus_type, tmp.bus_index, tmp.bus_id,
332 num_dev); 332 num_dev);
333 333
@@ -353,7 +353,7 @@ int ps3_repository_find_device(struct ps3_repository_device *repo)
353 return result; 353 return result;
354 } 354 }
355 355
356 pr_debug("%s:%d: found: dev_type %u, dev_index %u, dev_id %lu\n", 356 pr_debug("%s:%d: found: dev_type %u, dev_index %u, dev_id %llu\n",
357 __func__, __LINE__, tmp.dev_type, tmp.dev_index, tmp.dev_id); 357 __func__, __LINE__, tmp.dev_type, tmp.dev_index, tmp.dev_id);
358 358
359 *repo = tmp; 359 *repo = tmp;
@@ -367,7 +367,7 @@ int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
367 struct ps3_repository_device tmp; 367 struct ps3_repository_device tmp;
368 unsigned int num_dev; 368 unsigned int num_dev;
369 369
370 pr_debug(" -> %s:%u: find device by id %lu:%lu\n", __func__, __LINE__, 370 pr_debug(" -> %s:%u: find device by id %llu:%llu\n", __func__, __LINE__,
371 bus_id, dev_id); 371 bus_id, dev_id);
372 372
373 for (tmp.bus_index = 0; tmp.bus_index < 10; tmp.bus_index++) { 373 for (tmp.bus_index = 0; tmp.bus_index < 10; tmp.bus_index++) {
@@ -382,7 +382,7 @@ int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
382 if (tmp.bus_id == bus_id) 382 if (tmp.bus_id == bus_id)
383 goto found_bus; 383 goto found_bus;
384 384
385 pr_debug("%s:%u: skip, bus_id %lu\n", __func__, __LINE__, 385 pr_debug("%s:%u: skip, bus_id %llu\n", __func__, __LINE__,
386 tmp.bus_id); 386 tmp.bus_id);
387 } 387 }
388 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__); 388 pr_debug(" <- %s:%u: bus not found\n", __func__, __LINE__);
@@ -416,7 +416,7 @@ found_bus:
416 if (tmp.dev_id == dev_id) 416 if (tmp.dev_id == dev_id)
417 goto found_dev; 417 goto found_dev;
418 418
419 pr_debug("%s:%u: skip, dev_id %lu\n", __func__, __LINE__, 419 pr_debug("%s:%u: skip, dev_id %llu\n", __func__, __LINE__,
420 tmp.dev_id); 420 tmp.dev_id);
421 } 421 }
422 pr_debug(" <- %s:%u: dev not found\n", __func__, __LINE__); 422 pr_debug(" <- %s:%u: dev not found\n", __func__, __LINE__);
@@ -430,7 +430,7 @@ found_dev:
430 return result; 430 return result;
431 } 431 }
432 432
433 pr_debug(" <- %s:%u: found: type (%u:%u) index (%u:%u) id (%lu:%lu)\n", 433 pr_debug(" <- %s:%u: found: type (%u:%u) index (%u:%u) id (%llu:%llu)\n",
434 __func__, __LINE__, tmp.bus_type, tmp.dev_type, tmp.bus_index, 434 __func__, __LINE__, tmp.bus_type, tmp.dev_type, tmp.bus_index,
435 tmp.dev_index, tmp.bus_id, tmp.dev_id); 435 tmp.dev_index, tmp.bus_id, tmp.dev_id);
436 *repo = tmp; 436 *repo = tmp;
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 35f3e85cf60e..3331ccbb8d38 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -186,7 +186,7 @@ early_param("ps3flash", early_parse_ps3flash);
186#define prealloc_ps3flash_bounce_buffer() do { } while (0) 186#define prealloc_ps3flash_bounce_buffer() do { } while (0)
187#endif 187#endif
188 188
189static int ps3_set_dabr(u64 dabr) 189static int ps3_set_dabr(unsigned long dabr)
190{ 190{
191 enum {DABR_USER = 1, DABR_KERNEL = 2,}; 191 enum {DABR_USER = 1, DABR_KERNEL = 2,};
192 192
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index ccae3d446b98..b3c6a993f9f3 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(ps3_get_spe_id);
149 149
150static unsigned long get_vas_id(void) 150static unsigned long get_vas_id(void)
151{ 151{
152 unsigned long id; 152 u64 id;
153 153
154 lv1_get_logical_ppe_id(&id); 154 lv1_get_logical_ppe_id(&id);
155 lv1_get_virtual_address_space_id_of_ppe(id, &id); 155 lv1_get_virtual_address_space_id_of_ppe(id, &id);
@@ -160,14 +160,18 @@ static unsigned long get_vas_id(void)
160static int __init construct_spu(struct spu *spu) 160static int __init construct_spu(struct spu *spu)
161{ 161{
162 int result; 162 int result;
163 unsigned long unused; 163 u64 unused;
164 u64 problem_phys;
165 u64 local_store_phys;
164 166
165 result = lv1_construct_logical_spe(PAGE_SHIFT, PAGE_SHIFT, PAGE_SHIFT, 167 result = lv1_construct_logical_spe(PAGE_SHIFT, PAGE_SHIFT, PAGE_SHIFT,
166 PAGE_SHIFT, PAGE_SHIFT, get_vas_id(), SPE_TYPE_LOGICAL, 168 PAGE_SHIFT, PAGE_SHIFT, get_vas_id(), SPE_TYPE_LOGICAL,
167 &spu_pdata(spu)->priv2_addr, &spu->problem_phys, 169 &spu_pdata(spu)->priv2_addr, &problem_phys,
168 &spu->local_store_phys, &unused, 170 &local_store_phys, &unused,
169 &spu_pdata(spu)->shadow_addr, 171 &spu_pdata(spu)->shadow_addr,
170 &spu_pdata(spu)->spe_id); 172 &spu_pdata(spu)->spe_id);
173 spu->problem_phys = problem_phys;
174 spu->local_store_phys = local_store_phys;
171 175
172 if (result) { 176 if (result) {
173 pr_debug("%s:%d: lv1_construct_logical_spe failed: %s\n", 177 pr_debug("%s:%d: lv1_construct_logical_spe failed: %s\n",
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index ee0d22911621..58311a867851 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -182,7 +182,7 @@ int ps3_open_hv_device(struct ps3_system_bus_device *dev)
182 case PS3_MATCH_ID_SYSTEM_MANAGER: 182 case PS3_MATCH_ID_SYSTEM_MANAGER:
183 pr_debug("%s:%d: unsupported match_id: %u\n", __func__, 183 pr_debug("%s:%d: unsupported match_id: %u\n", __func__,
184 __LINE__, dev->match_id); 184 __LINE__, dev->match_id);
185 pr_debug("%s:%d: bus_id: %lu\n", __func__, __LINE__, 185 pr_debug("%s:%d: bus_id: %llu\n", __func__, __LINE__,
186 dev->bus_id); 186 dev->bus_id);
187 BUG(); 187 BUG();
188 return -EINVAL; 188 return -EINVAL;
@@ -220,7 +220,7 @@ int ps3_close_hv_device(struct ps3_system_bus_device *dev)
220 case PS3_MATCH_ID_SYSTEM_MANAGER: 220 case PS3_MATCH_ID_SYSTEM_MANAGER:
221 pr_debug("%s:%d: unsupported match_id: %u\n", __func__, 221 pr_debug("%s:%d: unsupported match_id: %u\n", __func__,
222 __LINE__, dev->match_id); 222 __LINE__, dev->match_id);
223 pr_debug("%s:%d: bus_id: %lu\n", __func__, __LINE__, 223 pr_debug("%s:%d: bus_id: %llu\n", __func__, __LINE__,
224 dev->bus_id); 224 dev->bus_id);
225 BUG(); 225 BUG();
226 return -EINVAL; 226 return -EINVAL;
@@ -240,7 +240,7 @@ EXPORT_SYMBOL_GPL(ps3_close_hv_device);
240static void _dump_mmio_region(const struct ps3_mmio_region* r, 240static void _dump_mmio_region(const struct ps3_mmio_region* r,
241 const char* func, int line) 241 const char* func, int line)
242{ 242{
243 pr_debug("%s:%d: dev %lu:%lu\n", func, line, r->dev->bus_id, 243 pr_debug("%s:%d: dev %llu:%llu\n", func, line, r->dev->bus_id,
244 r->dev->dev_id); 244 r->dev->dev_id);
245 pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr); 245 pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr);
246 pr_debug("%s:%d: len %lxh\n", func, line, r->len); 246 pr_debug("%s:%d: len %lxh\n", func, line, r->len);
@@ -250,9 +250,11 @@ static void _dump_mmio_region(const struct ps3_mmio_region* r,
250static int ps3_sb_mmio_region_create(struct ps3_mmio_region *r) 250static int ps3_sb_mmio_region_create(struct ps3_mmio_region *r)
251{ 251{
252 int result; 252 int result;
253 u64 lpar_addr;
253 254
254 result = lv1_map_device_mmio_region(r->dev->bus_id, r->dev->dev_id, 255 result = lv1_map_device_mmio_region(r->dev->bus_id, r->dev->dev_id,
255 r->bus_addr, r->len, r->page_size, &r->lpar_addr); 256 r->bus_addr, r->len, r->page_size, &lpar_addr);
257 r->lpar_addr = lpar_addr;
256 258
257 if (result) { 259 if (result) {
258 pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n", 260 pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n",
@@ -568,7 +570,7 @@ static dma_addr_t ps3_sb_map_page(struct device *_dev, struct page *page,
568{ 570{
569 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 571 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
570 int result; 572 int result;
571 unsigned long bus_addr; 573 dma_addr_t bus_addr;
572 void *ptr = page_address(page) + offset; 574 void *ptr = page_address(page) + offset;
573 575
574 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, 576 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size,
@@ -590,7 +592,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page,
590{ 592{
591 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 593 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
592 int result; 594 int result;
593 unsigned long bus_addr; 595 dma_addr_t bus_addr;
594 u64 iopte_flag; 596 u64 iopte_flag;
595 void *ptr = page_address(page) + offset; 597 void *ptr = page_address(page) + offset;
596 598
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index c90817acb472..3ee01b4f4257 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -127,10 +127,10 @@ static int tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
127 } 127 }
128 128
129 if (rc && printk_ratelimit()) { 129 if (rc && printk_ratelimit()) {
130 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 130 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%lld\n", rc);
131 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 131 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
132 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 132 printk("\ttcenum = 0x%llx\n", (u64)tcenum);
133 printk("\ttce val = 0x%lx\n", tce ); 133 printk("\ttce val = 0x%llx\n", tce );
134 show_stack(current, (unsigned long *)__get_SP()); 134 show_stack(current, (unsigned long *)__get_SP());
135 } 135 }
136 136
@@ -210,10 +210,10 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
210 } 210 }
211 211
212 if (rc && printk_ratelimit()) { 212 if (rc && printk_ratelimit()) {
213 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 213 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%lld\n", rc);
214 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 214 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
215 printk("\tnpages = 0x%lx\n", (u64)npages); 215 printk("\tnpages = 0x%llx\n", (u64)npages);
216 printk("\ttce[0] val = 0x%lx\n", tcep[0]); 216 printk("\ttce[0] val = 0x%llx\n", tcep[0]);
217 show_stack(current, (unsigned long *)__get_SP()); 217 show_stack(current, (unsigned long *)__get_SP());
218 } 218 }
219 return ret; 219 return ret;
@@ -227,9 +227,9 @@ static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages
227 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0); 227 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0);
228 228
229 if (rc && printk_ratelimit()) { 229 if (rc && printk_ratelimit()) {
230 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 230 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%lld\n", rc);
231 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 231 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
232 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 232 printk("\ttcenum = 0x%llx\n", (u64)tcenum);
233 show_stack(current, (unsigned long *)__get_SP()); 233 show_stack(current, (unsigned long *)__get_SP());
234 } 234 }
235 235
@@ -246,9 +246,9 @@ static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long n
246 246
247 if (rc && printk_ratelimit()) { 247 if (rc && printk_ratelimit()) {
248 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n"); 248 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");
249 printk("\trc = %ld\n", rc); 249 printk("\trc = %lld\n", rc);
250 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 250 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
251 printk("\tnpages = 0x%lx\n", (u64)npages); 251 printk("\tnpages = 0x%llx\n", (u64)npages);
252 show_stack(current, (unsigned long *)__get_SP()); 252 show_stack(current, (unsigned long *)__get_SP());
253 } 253 }
254} 254}
@@ -261,10 +261,9 @@ static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum)
261 rc = plpar_tce_get((u64)tbl->it_index, (u64)tcenum << 12, &tce_ret); 261 rc = plpar_tce_get((u64)tbl->it_index, (u64)tcenum << 12, &tce_ret);
262 262
263 if (rc && printk_ratelimit()) { 263 if (rc && printk_ratelimit()) {
264 printk("tce_get_pSeriesLP: plpar_tce_get failed. rc=%ld\n", 264 printk("tce_get_pSeriesLP: plpar_tce_get failed. rc=%lld\n", rc);
265 rc); 265 printk("\tindex = 0x%llx\n", (u64)tbl->it_index);
266 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 266 printk("\ttcenum = 0x%llx\n", (u64)tcenum);
267 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
268 show_stack(current, (unsigned long *)__get_SP()); 267 show_stack(current, (unsigned long *)__get_SP());
269 } 268 }
270 269
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index f611d0369cc8..9817f63723dd 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -28,63 +28,104 @@
28#include <sysdev/fsl_pci.h> 28#include <sysdev/fsl_pci.h>
29 29
30#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) 30#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx)
31static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
32 unsigned int index, const struct resource *res,
33 resource_size_t offset)
34{
35 resource_size_t pci_addr = res->start - offset;
36 resource_size_t phys_addr = res->start;
37 resource_size_t size = res->end - res->start + 1;
38 u32 flags = 0x80044000; /* enable & mem R/W */
39 unsigned int i;
40
41 pr_debug("PCI MEM resource start 0x%016llx, size 0x%016llx.\n",
42 (u64)res->start, (u64)size);
43
44 if (res->flags & IORESOURCE_PREFETCH)
45 flags |= 0x10000000; /* enable relaxed ordering */
46
47 for (i = 0; size > 0; i++) {
48 unsigned int bits = min(__ilog2(size),
49 __ffs(pci_addr | phys_addr));
50
51 if (index + i >= 5)
52 return -1;
53
54 out_be32(&pci->pow[index + i].potar, pci_addr >> 12);
55 out_be32(&pci->pow[index + i].potear, (u64)pci_addr >> 44);
56 out_be32(&pci->pow[index + i].powbar, phys_addr >> 12);
57 out_be32(&pci->pow[index + i].powar, flags | (bits - 1));
58
59 pci_addr += (resource_size_t)1U << bits;
60 phys_addr += (resource_size_t)1U << bits;
61 size -= (resource_size_t)1U << bits;
62 }
63
64 return i;
65}
66
31/* atmu setup for fsl pci/pcie controller */ 67/* atmu setup for fsl pci/pcie controller */
32static void __init setup_pci_atmu(struct pci_controller *hose, 68static void __init setup_pci_atmu(struct pci_controller *hose,
33 struct resource *rsrc) 69 struct resource *rsrc)
34{ 70{
35 struct ccsr_pci __iomem *pci; 71 struct ccsr_pci __iomem *pci;
36 int i; 72 int i, j, n;
37 73
38 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n", 74 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
39 (u64)rsrc->start, (u64)rsrc->end - (u64)rsrc->start + 1); 75 (u64)rsrc->start, (u64)rsrc->end - (u64)rsrc->start + 1);
40 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1); 76 pci = ioremap(rsrc->start, rsrc->end - rsrc->start + 1);
77 if (!pci) {
78 dev_err(hose->parent, "Unable to map ATMU registers\n");
79 return;
80 }
41 81
42 /* Disable all windows (except powar0 since its ignored) */ 82 /* Disable all windows (except powar0 since it's ignored) */
43 for(i = 1; i < 5; i++) 83 for(i = 1; i < 5; i++)
44 out_be32(&pci->pow[i].powar, 0); 84 out_be32(&pci->pow[i].powar, 0);
45 for(i = 0; i < 3; i++) 85 for(i = 0; i < 3; i++)
46 out_be32(&pci->piw[i].piwar, 0); 86 out_be32(&pci->piw[i].piwar, 0);
47 87
48 /* Setup outbound MEM window */ 88 /* Setup outbound MEM window */
49 for(i = 0; i < 3; i++) 89 for(i = 0, j = 1; i < 3; i++) {
50 if (hose->mem_resources[i].flags & IORESOURCE_MEM){ 90 if (!(hose->mem_resources[i].flags & IORESOURCE_MEM))
51 resource_size_t pci_addr_start = 91 continue;
52 hose->mem_resources[i].start - 92
53 hose->pci_mem_offset; 93 n = setup_one_atmu(pci, j, &hose->mem_resources[i],
54 pr_debug("PCI MEM resource start 0x%016llx, size 0x%016llx.\n", 94 hose->pci_mem_offset);
55 (u64)hose->mem_resources[i].start, 95
56 (u64)hose->mem_resources[i].end 96 if (n < 0 || j >= 5) {
57 - (u64)hose->mem_resources[i].start + 1); 97 pr_err("Ran out of outbound PCI ATMUs for resource %d!\n", i);
58 out_be32(&pci->pow[i+1].potar, (pci_addr_start >> 12)); 98 hose->mem_resources[i].flags |= IORESOURCE_DISABLED;
59 out_be32(&pci->pow[i+1].potear, 0); 99 } else
60 out_be32(&pci->pow[i+1].powbar, 100 j += n;
61 (hose->mem_resources[i].start >> 12)); 101 }
62 /* Enable, Mem R/W */
63 out_be32(&pci->pow[i+1].powar, 0x80044000
64 | (__ilog2(hose->mem_resources[i].end
65 - hose->mem_resources[i].start + 1) - 1));
66 }
67 102
68 /* Setup outbound IO window */ 103 /* Setup outbound IO window */
69 if (hose->io_resource.flags & IORESOURCE_IO){ 104 if (hose->io_resource.flags & IORESOURCE_IO) {
70 pr_debug("PCI IO resource start 0x%016llx, size 0x%016llx, " 105 if (j >= 5) {
71 "phy base 0x%016llx.\n", 106 pr_err("Ran out of outbound PCI ATMUs for IO resource\n");
72 (u64)hose->io_resource.start, 107 } else {
73 (u64)hose->io_resource.end - (u64)hose->io_resource.start + 1, 108 pr_debug("PCI IO resource start 0x%016llx, size 0x%016llx, "
74 (u64)hose->io_base_phys); 109 "phy base 0x%016llx.\n",
75 out_be32(&pci->pow[i+1].potar, (hose->io_resource.start >> 12)); 110 (u64)hose->io_resource.start,
76 out_be32(&pci->pow[i+1].potear, 0); 111 (u64)hose->io_resource.end - (u64)hose->io_resource.start + 1,
77 out_be32(&pci->pow[i+1].powbar, (hose->io_base_phys >> 12)); 112 (u64)hose->io_base_phys);
78 /* Enable, IO R/W */ 113 out_be32(&pci->pow[j].potar, (hose->io_resource.start >> 12));
79 out_be32(&pci->pow[i+1].powar, 0x80088000 114 out_be32(&pci->pow[j].potear, 0);
80 | (__ilog2(hose->io_resource.end 115 out_be32(&pci->pow[j].powbar, (hose->io_base_phys >> 12));
81 - hose->io_resource.start + 1) - 1)); 116 /* Enable, IO R/W */
117 out_be32(&pci->pow[j].powar, 0x80088000
118 | (__ilog2(hose->io_resource.end
119 - hose->io_resource.start + 1) - 1));
120 }
82 } 121 }
83 122
84 /* Setup 2G inbound Memory Window @ 1 */ 123 /* Setup 2G inbound Memory Window @ 1 */
85 out_be32(&pci->piw[2].pitar, 0x00000000); 124 out_be32(&pci->piw[2].pitar, 0x00000000);
86 out_be32(&pci->piw[2].piwbar,0x00000000); 125 out_be32(&pci->piw[2].piwbar,0x00000000);
87 out_be32(&pci->piw[2].piwar, PIWAR_2G); 126 out_be32(&pci->piw[2].piwar, PIWAR_2G);
127
128 iounmap(pci);
88} 129}
89 130
90static void __init setup_pci_cmd(struct pci_controller *hose) 131static void __init setup_pci_cmd(struct pci_controller *hose)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 3e0d89dcdba2..a35297dbac28 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -435,7 +435,7 @@ static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem *devbase,
435 addr = addr | ((u64)readl(base + HT_MSI_ADDR_HI) << 32); 435 addr = addr | ((u64)readl(base + HT_MSI_ADDR_HI) << 32);
436 } 436 }
437 437
438 printk(KERN_DEBUG "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%lx\n", 438 printk(KERN_DEBUG "mpic: - HT:%02x.%x %s MSI mapping found @ 0x%llx\n",
439 PCI_SLOT(devfn), PCI_FUNC(devfn), 439 PCI_SLOT(devfn), PCI_FUNC(devfn),
440 flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr); 440 flags & HT_MSI_FLAGS_ENABLE ? "enabled" : "disabled", addr);
441 441
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index a94a3c3ae932..6b0a3538dc63 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -77,6 +77,7 @@ mainmenu "Linux Kernel Configuration"
77config S390 77config S390
78 def_bool y 78 def_bool y
79 select USE_GENERIC_SMP_HELPERS if SMP 79 select USE_GENERIC_SMP_HELPERS if SMP
80 select HAVE_SYSCALL_WRAPPERS
80 select HAVE_FUNCTION_TRACER 81 select HAVE_FUNCTION_TRACER
81 select HAVE_OPROFILE 82 select HAVE_OPROFILE
82 select HAVE_KPROBES 83 select HAVE_KPROBES
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index f2af4167bd5f..63a23415fba6 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -13,4 +13,3 @@ unifdef-y += cmb.h
13unifdef-y += debug.h 13unifdef-y += debug.h
14unifdef-y += chpid.h 14unifdef-y += chpid.h
15unifdef-y += schid.h 15unifdef-y += schid.h
16unifdef-y += swab.h
diff --git a/arch/s390/include/asm/byteorder.h b/arch/s390/include/asm/byteorder.h
index b95a2b2933fb..a332e59e26fc 100644
--- a/arch/s390/include/asm/byteorder.h
+++ b/arch/s390/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _S390_BYTEORDER_H 1#ifndef _S390_BYTEORDER_H
2#define _S390_BYTEORDER_H 2#define _S390_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _S390_BYTEORDER_H */ 6#endif /* _S390_BYTEORDER_H */
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index fc2c97197a53..6035cd20c7a7 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -547,7 +547,7 @@ sys32_setdomainname_wrapper:
547 .globl sys32_newuname_wrapper 547 .globl sys32_newuname_wrapper
548sys32_newuname_wrapper: 548sys32_newuname_wrapper:
549 llgtr %r2,%r2 # struct new_utsname * 549 llgtr %r2,%r2 # struct new_utsname *
550 jg s390x_newuname # branch to system call 550 jg sys_s390_newuname # branch to system call
551 551
552 .globl compat_sys_adjtimex_wrapper 552 .globl compat_sys_adjtimex_wrapper
553compat_sys_adjtimex_wrapper: 553compat_sys_adjtimex_wrapper:
@@ -615,7 +615,7 @@ sys32_sysfs_wrapper:
615 .globl sys32_personality_wrapper 615 .globl sys32_personality_wrapper
616sys32_personality_wrapper: 616sys32_personality_wrapper:
617 llgfr %r2,%r2 # unsigned long 617 llgfr %r2,%r2 # unsigned long
618 jg s390x_personality # branch to system call 618 jg sys_s390_personality # branch to system call
619 619
620 .globl sys32_setfsuid16_wrapper 620 .globl sys32_setfsuid16_wrapper
621sys32_setfsuid16_wrapper: 621sys32_setfsuid16_wrapper:
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index a65afc91e8aa..950c59c6688b 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -30,23 +30,23 @@ struct fadvise64_64_args;
30struct old_sigaction; 30struct old_sigaction;
31struct sel_arg_struct; 31struct sel_arg_struct;
32 32
33long sys_pipe(unsigned long __user *fildes);
34long sys_mmap2(struct mmap_arg_struct __user *arg); 33long sys_mmap2(struct mmap_arg_struct __user *arg);
35long old_mmap(struct mmap_arg_struct __user *arg); 34long sys_s390_old_mmap(struct mmap_arg_struct __user *arg);
36long sys_ipc(uint call, int first, unsigned long second, 35long sys_ipc(uint call, int first, unsigned long second,
37 unsigned long third, void __user *ptr); 36 unsigned long third, void __user *ptr);
38long s390x_newuname(struct new_utsname __user *name); 37long sys_s390_newuname(struct new_utsname __user *name);
39long s390x_personality(unsigned long personality); 38long sys_s390_personality(unsigned long personality);
40long s390_fadvise64(int fd, u32 offset_high, u32 offset_low, 39long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
41 size_t len, int advice); 40 size_t len, int advice);
42long s390_fadvise64_64(struct fadvise64_64_args __user *args); 41long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
43long s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, u32 len_low); 42long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
43 u32 len_low);
44long sys_fork(void); 44long sys_fork(void);
45long sys_clone(void); 45long sys_clone(void);
46long sys_vfork(void); 46long sys_vfork(void);
47void execve_tail(void); 47void execve_tail(void);
48long sys_execve(void); 48long sys_execve(void);
49int sys_sigsuspend(int history0, int history1, old_sigset_t mask); 49long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
50long sys_sigaction(int sig, const struct old_sigaction __user *act, 50long sys_sigaction(int sig, const struct old_sigaction __user *act,
51 struct old_sigaction __user *oact); 51 struct old_sigaction __user *oact);
52long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss); 52long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss);
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index b6110bdf8dc2..5cd38a90e64d 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -39,6 +39,7 @@
39#include <linux/tick.h> 39#include <linux/tick.h>
40#include <linux/elfcore.h> 40#include <linux/elfcore.h>
41#include <linux/kernel_stat.h> 41#include <linux/kernel_stat.h>
42#include <linux/syscalls.h>
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
43#include <asm/pgtable.h> 44#include <asm/pgtable.h>
44#include <asm/system.h> 45#include <asm/system.h>
@@ -225,13 +226,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
225 return 0; 226 return 0;
226} 227}
227 228
228asmlinkage long sys_fork(void) 229SYSCALL_DEFINE0(fork)
229{ 230{
230 struct pt_regs *regs = task_pt_regs(current); 231 struct pt_regs *regs = task_pt_regs(current);
231 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL); 232 return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL);
232} 233}
233 234
234asmlinkage long sys_clone(void) 235SYSCALL_DEFINE0(clone)
235{ 236{
236 struct pt_regs *regs = task_pt_regs(current); 237 struct pt_regs *regs = task_pt_regs(current);
237 unsigned long clone_flags; 238 unsigned long clone_flags;
@@ -258,7 +259,7 @@ asmlinkage long sys_clone(void)
258 * do not have enough call-clobbered registers to hold all 259 * do not have enough call-clobbered registers to hold all
259 * the information you need. 260 * the information you need.
260 */ 261 */
261asmlinkage long sys_vfork(void) 262SYSCALL_DEFINE0(vfork)
262{ 263{
263 struct pt_regs *regs = task_pt_regs(current); 264 struct pt_regs *regs = task_pt_regs(current);
264 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 265 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
@@ -278,7 +279,7 @@ asmlinkage void execve_tail(void)
278/* 279/*
279 * sys_execve() executes a new program. 280 * sys_execve() executes a new program.
280 */ 281 */
281asmlinkage long sys_execve(void) 282SYSCALL_DEFINE0(execve)
282{ 283{
283 struct pt_regs *regs = task_pt_regs(current); 284 struct pt_regs *regs = task_pt_regs(current);
284 char *filename; 285 char *filename;
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 8e6812a22670..3cf74c3ccb69 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -25,6 +25,7 @@
25#include <linux/personality.h> 25#include <linux/personality.h>
26#include <linux/binfmts.h> 26#include <linux/binfmts.h>
27#include <linux/tracehook.h> 27#include <linux/tracehook.h>
28#include <linux/syscalls.h>
28#include <asm/ucontext.h> 29#include <asm/ucontext.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/lowcore.h> 31#include <asm/lowcore.h>
@@ -53,8 +54,7 @@ typedef struct
53/* 54/*
54 * Atomically swap in the new signal mask, and wait for a signal. 55 * Atomically swap in the new signal mask, and wait for a signal.
55 */ 56 */
56asmlinkage int 57SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
57sys_sigsuspend(int history0, int history1, old_sigset_t mask)
58{ 58{
59 mask &= _BLOCKABLE; 59 mask &= _BLOCKABLE;
60 spin_lock_irq(&current->sighand->siglock); 60 spin_lock_irq(&current->sighand->siglock);
@@ -70,9 +70,8 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask)
70 return -ERESTARTNOHAND; 70 return -ERESTARTNOHAND;
71} 71}
72 72
73asmlinkage long 73SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act,
74sys_sigaction(int sig, const struct old_sigaction __user *act, 74 struct old_sigaction __user *, oact)
75 struct old_sigaction __user *oact)
76{ 75{
77 struct k_sigaction new_ka, old_ka; 76 struct k_sigaction new_ka, old_ka;
78 int ret; 77 int ret;
@@ -102,15 +101,13 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
102 return ret; 101 return ret;
103} 102}
104 103
105asmlinkage long 104SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
106sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) 105 stack_t __user *, uoss)
107{ 106{
108 struct pt_regs *regs = task_pt_regs(current); 107 struct pt_regs *regs = task_pt_regs(current);
109 return do_sigaltstack(uss, uoss, regs->gprs[15]); 108 return do_sigaltstack(uss, uoss, regs->gprs[15]);
110} 109}
111 110
112
113
114/* Returns non-zero on fault. */ 111/* Returns non-zero on fault. */
115static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs) 112static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
116{ 113{
@@ -164,7 +161,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
164 return 0; 161 return 0;
165} 162}
166 163
167asmlinkage long sys_sigreturn(void) 164SYSCALL_DEFINE0(sigreturn)
168{ 165{
169 struct pt_regs *regs = task_pt_regs(current); 166 struct pt_regs *regs = task_pt_regs(current);
170 sigframe __user *frame = (sigframe __user *)regs->gprs[15]; 167 sigframe __user *frame = (sigframe __user *)regs->gprs[15];
@@ -191,7 +188,7 @@ badframe:
191 return 0; 188 return 0;
192} 189}
193 190
194asmlinkage long sys_rt_sigreturn(void) 191SYSCALL_DEFINE0(rt_sigreturn)
195{ 192{
196 struct pt_regs *regs = task_pt_regs(current); 193 struct pt_regs *regs = task_pt_regs(current);
197 rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; 194 rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index c34be4568b80..c7ae4b17e0e3 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -29,6 +29,7 @@
29#include <linux/personality.h> 29#include <linux/personality.h>
30#include <linux/unistd.h> 30#include <linux/unistd.h>
31#include <linux/ipc.h> 31#include <linux/ipc.h>
32#include <linux/syscalls.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include "entry.h" 34#include "entry.h"
34 35
@@ -74,7 +75,7 @@ struct mmap_arg_struct {
74 unsigned long offset; 75 unsigned long offset;
75}; 76};
76 77
77asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg) 78SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg)
78{ 79{
79 struct mmap_arg_struct a; 80 struct mmap_arg_struct a;
80 int error = -EFAULT; 81 int error = -EFAULT;
@@ -86,7 +87,7 @@ out:
86 return error; 87 return error;
87} 88}
88 89
89asmlinkage long old_mmap(struct mmap_arg_struct __user *arg) 90SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
90{ 91{
91 struct mmap_arg_struct a; 92 struct mmap_arg_struct a;
92 long error = -EFAULT; 93 long error = -EFAULT;
@@ -108,8 +109,8 @@ out:
108 * 109 *
109 * This is really horribly ugly. 110 * This is really horribly ugly.
110 */ 111 */
111asmlinkage long sys_ipc(uint call, int first, unsigned long second, 112SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
112 unsigned long third, void __user *ptr) 113 unsigned long, third, void __user *, ptr)
113{ 114{
114 struct ipc_kludge tmp; 115 struct ipc_kludge tmp;
115 int ret; 116 int ret;
@@ -175,7 +176,7 @@ asmlinkage long sys_ipc(uint call, int first, unsigned long second,
175} 176}
176 177
177#ifdef CONFIG_64BIT 178#ifdef CONFIG_64BIT
178asmlinkage long s390x_newuname(struct new_utsname __user *name) 179SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name)
179{ 180{
180 int ret = sys_newuname(name); 181 int ret = sys_newuname(name);
181 182
@@ -186,7 +187,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user *name)
186 return ret; 187 return ret;
187} 188}
188 189
189asmlinkage long s390x_personality(unsigned long personality) 190SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
190{ 191{
191 int ret; 192 int ret;
192 193
@@ -205,15 +206,13 @@ asmlinkage long s390x_personality(unsigned long personality)
205 */ 206 */
206#ifndef CONFIG_64BIT 207#ifndef CONFIG_64BIT
207 208
208asmlinkage long 209SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
209s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice) 210 size_t, len, int, advice)
210{ 211{
211 return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low, 212 return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
212 len, advice); 213 len, advice);
213} 214}
214 215
215#endif
216
217struct fadvise64_64_args { 216struct fadvise64_64_args {
218 int fd; 217 int fd;
219 long long offset; 218 long long offset;
@@ -221,8 +220,7 @@ struct fadvise64_64_args {
221 int advice; 220 int advice;
222}; 221};
223 222
224asmlinkage long 223SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
225s390_fadvise64_64(struct fadvise64_64_args __user *args)
226{ 224{
227 struct fadvise64_64_args a; 225 struct fadvise64_64_args a;
228 226
@@ -231,7 +229,6 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
231 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); 229 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
232} 230}
233 231
234#ifndef CONFIG_64BIT
235/* 232/*
236 * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last 233 * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
237 * 64 bit argument "len" is split into the upper and lower 32 bits. The 234 * 64 bit argument "len" is split into the upper and lower 32 bits. The
@@ -244,9 +241,19 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
244 * to 241 * to
245 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len 242 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
246 */ 243 */
247asmlinkage long s390_fallocate(int fd, int mode, loff_t offset, 244SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
248 u32 len_high, u32 len_low) 245 u32 len_high, u32 len_low)
249{ 246{
250 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); 247 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
251} 248}
249#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
250asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
251 long len_high, long len_low)
252{
253 return SYSC_s390_fallocate((int) fd, (int) mode, offset,
254 (u32) len_high, (u32) len_low);
255}
256SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
257#endif
258
252#endif 259#endif
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 2d61787949d5..76d16e0140bb 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -98,7 +98,7 @@ SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper)
98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) 98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper)
99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) 99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper)
100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ 100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */
101SYSCALL(old_mmap,old_mmap,old32_mmap_wrapper) /* 90 */ 101SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */
102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) 102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper)
103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) 103SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper)
104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) 104SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper)
@@ -130,7 +130,7 @@ SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys32_clone) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
133SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,sys_s390_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
@@ -144,7 +144,7 @@ SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper)
144SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper) 144SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper)
145SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper) 145SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper)
146SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */ 146SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */
147SYSCALL(sys_personality,s390x_personality,sys32_personality_wrapper) 147SYSCALL(sys_personality,sys_s390_personality,sys32_personality_wrapper)
148NI_SYSCALL /* for afs_syscall */ 148NI_SYSCALL /* for afs_syscall */
149SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */ 149SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */
150SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */ 150SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */
@@ -261,7 +261,7 @@ SYSCALL(sys_epoll_create,sys_epoll_create,sys_epoll_create_wrapper)
261SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */ 261SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */
262SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper) 262SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper)
263SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper) 263SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper)
264SYSCALL(s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper) 264SYSCALL(sys_s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper)
265SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper) 265SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper)
266SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */ 266SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */
267SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper) 267SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper)
@@ -272,7 +272,7 @@ SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260
272SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper) 272SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
273SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper) 273SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
274NI_SYSCALL /* reserved for vserver */ 274NI_SYSCALL /* reserved for vserver */
275SYSCALL(s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) 275SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
276SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper) 276SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
277SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper) 277SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
278SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper) 278SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper)
@@ -322,7 +322,7 @@ NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper) 323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper)
324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) 324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
325SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper) 325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ 326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */
327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) 327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper)
328NI_SYSCALL /* 317 old sys_timer_fd */ 328NI_SYSCALL /* 317 old sys_timer_fd */
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index f1a2a0d1c79c..43910cdf78a5 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -6,4 +6,3 @@ unifdef-y += unistd_32.h
6unifdef-y += unistd_64.h 6unifdef-y += unistd_64.h
7unifdef-y += posix_types_32.h 7unifdef-y += posix_types_32.h
8unifdef-y += posix_types_64.h 8unifdef-y += posix_types_64.h
9unifdef-y += swab.h
diff --git a/arch/sh/include/asm/byteorder.h b/arch/sh/include/asm/byteorder.h
index e95c41a5c8cc..db2f5d7cb17d 100644
--- a/arch/sh/include/asm/byteorder.h
+++ b/arch/sh/include/asm/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_SH_BYTEORDER_H 1#ifndef __ASM_SH_BYTEORDER_H
2#define __ASM_SH_BYTEORDER_H 2#define __ASM_SH_BYTEORDER_H
3 3
4#include <asm/swab.h>
5
6#ifdef __LITTLE_ENDIAN__ 4#ifdef __LITTLE_ENDIAN__
7#include <linux/byteorder/little_endian.h> 5#include <linux/byteorder/little_endian.h>
8#else 6#else
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index 104c5e686106..8b30200305c3 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -36,9 +36,9 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
36asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, 36asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
37 unsigned long r6, unsigned long r7, 37 unsigned long r6, unsigned long r7,
38 struct pt_regs __regs); 38 struct pt_regs __regs);
39asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, 39asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5,
40 unsigned long r6, unsigned long r7, 40 unsigned long r6, unsigned long r7,
41 struct pt_regs __regs); 41 struct pt_regs __regs);
42asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf, 42asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
43 size_t count, long dummy, loff_t pos); 43 size_t count, long dummy, loff_t pos);
44asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf, 44asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
diff --git a/arch/sh/kernel/sys_sh32.c b/arch/sh/kernel/sys_sh32.c
index dbba1e1833d4..63ba12836eae 100644
--- a/arch/sh/kernel/sys_sh32.c
+++ b/arch/sh/kernel/sys_sh32.c
@@ -22,7 +22,7 @@
22 * sys_pipe() is the normal C calling standard for creating 22 * sys_pipe() is the normal C calling standard for creating
23 * a pipe. It's not the way Unix traditionally does this, though. 23 * a pipe. It's not the way Unix traditionally does this, though.
24 */ 24 */
25asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, 25asmlinkage int sys_sh_pipe(unsigned long r4, unsigned long r5,
26 unsigned long r6, unsigned long r7, 26 unsigned long r6, unsigned long r7,
27 struct pt_regs __regs) 27 struct pt_regs __regs)
28{ 28{
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 0af693e65764..e67c1733e1b9 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -58,7 +58,7 @@ ENTRY(sys_call_table)
58 .long sys_mkdir 58 .long sys_mkdir
59 .long sys_rmdir /* 40 */ 59 .long sys_rmdir /* 40 */
60 .long sys_dup 60 .long sys_dup
61 .long sys_pipe 61 .long sys_sh_pipe
62 .long sys_times 62 .long sys_times
63 .long sys_ni_syscall /* old prof syscall holder */ 63 .long sys_ni_syscall /* old prof syscall holder */
64 .long sys_brk /* 45 */ 64 .long sys_brk /* 45 */
@@ -105,7 +105,7 @@ ENTRY(sys_call_table)
105 .long sys_uselib 105 .long sys_uselib
106 .long sys_swapon 106 .long sys_swapon
107 .long sys_reboot 107 .long sys_reboot
108 .long old_readdir 108 .long sys_old_readdir
109 .long old_mmap /* 90 */ 109 .long old_mmap /* 90 */
110 .long sys_munmap 110 .long sys_munmap
111 .long sys_truncate 111 .long sys_truncate
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 0b436aa3cad7..557cb91f5caf 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -109,7 +109,7 @@ sys_call_table:
109 .long sys_uselib 109 .long sys_uselib
110 .long sys_swapon 110 .long sys_swapon
111 .long sys_reboot 111 .long sys_reboot
112 .long old_readdir 112 .long sys_old_readdir
113 .long old_mmap /* 90 */ 113 .long old_mmap /* 90 */
114 .long sys_munmap 114 .long sys_munmap
115 .long sys_truncate 115 .long sys_truncate
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 95e38a43dff0..deeb0fba8029 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -17,4 +17,3 @@ header-y += traps.h
17header-y += uctx.h 17header-y += uctx.h
18header-y += utrap.h 18header-y += utrap.h
19header-y += watchdog.h 19header-y += watchdog.h
20header-y += swab.h
diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h
index 48a047cd6fa9..ccc1b6b7de6c 100644
--- a/arch/sparc/include/asm/byteorder.h
+++ b/arch/sparc/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _SPARC_BYTEORDER_H 1#ifndef _SPARC_BYTEORDER_H
2#define _SPARC_BYTEORDER_H 2#define _SPARC_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _SPARC_BYTEORDER_H */ 6#endif /* _SPARC_BYTEORDER_H */
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index faf9ccd9ef5d..f41ecc5ac0b4 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1088,8 +1088,8 @@ sunos_execv:
1088 ld [%sp + STACKFRAME_SZ + PT_I0], %o0 1088 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
1089 1089
1090 .align 4 1090 .align 4
1091 .globl sys_pipe 1091 .globl sys_sparc_pipe
1092sys_pipe: 1092sys_sparc_pipe:
1093 mov %o7, %l5 1093 mov %o7, %l5
1094 add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg 1094 add %sp, STACKFRAME_SZ, %o0 ! pt_regs *regs arg
1095 call sparc_pipe 1095 call sparc_pipe
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c
index da8f804feb49..0f26066a08d9 100644
--- a/arch/sparc/kernel/sparc_ksyms_64.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -9,7 +9,6 @@
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h> 10#include <linux/init.h>
11 11
12#include <asm/spinlock.h>
13#include <asm/system.h> 12#include <asm/system.h>
14#include <asm/cpudata.h> 13#include <asm/cpudata.h>
15#include <asm/uaccess.h> 14#include <asm/uaccess.h>
@@ -23,16 +22,6 @@ struct poll {
23 short revents; 22 short revents;
24}; 23};
25 24
26/* used by various drivers */
27#ifdef CONFIG_SMP
28/* Out of line rw-locking implementation. */
29EXPORT_SYMBOL(__read_lock);
30EXPORT_SYMBOL(__read_unlock);
31EXPORT_SYMBOL(__write_lock);
32EXPORT_SYMBOL(__write_unlock);
33EXPORT_SYMBOL(__write_trylock);
34#endif /* CONFIG_SMP */
35
36/* from helpers.S */ 25/* from helpers.S */
37EXPORT_SYMBOL(__flushw_user); 26EXPORT_SYMBOL(__flushw_user);
38EXPORT_SYMBOL_GPL(real_hard_smp_processor_id); 27EXPORT_SYMBOL_GPL(real_hard_smp_processor_id);
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 7a6786a71363..87f5a3b8a253 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -20,7 +20,7 @@ execve_merge:
20 add %sp, PTREGS_OFF, %o0 20 add %sp, PTREGS_OFF, %o0
21 21
22 .align 32 22 .align 32
23sys_pipe: 23sys_sparc_pipe:
24 ba,pt %xcc, sparc_pipe 24 ba,pt %xcc, sparc_pipe
25 add %sp, PTREGS_OFF, %o0 25 add %sp, PTREGS_OFF, %o0
26sys_nis_syscall: 26sys_nis_syscall:
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 7d0807586442..dccc95df0c7f 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -24,7 +24,7 @@ sys_call_table:
24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause 24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
26/*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile 26/*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile
27/*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_getuid 27/*40*/ .long sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_getuid
28/*45*/ .long sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16 28/*45*/ .long sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16
29/*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl 29/*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl
30/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve 30/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve
@@ -56,7 +56,7 @@ sys_call_table:
56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname 56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl 57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl
58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask 58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask
59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, old_readdir 59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir
60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
62/*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex 62/*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 9fc78cf354bd..e6007bb37046 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -26,7 +26,7 @@ sys_call_table32:
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause 26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
28 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile 28 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
29/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid 29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid
30 .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16 30 .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16
31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl 31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
32 .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve 32 .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve
@@ -100,7 +100,7 @@ sys_call_table:
100/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall 100/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
101/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice 101/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
102 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64 102 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64
103/*40*/ .word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall 103/*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall
104 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid 104 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
105/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl 105/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
106 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve 106 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index a9f8a814a1f7..4a8e80cdcfa5 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -22,4 +22,3 @@ unifdef-y += unistd_32.h
22unifdef-y += unistd_64.h 22unifdef-y += unistd_64.h
23unifdef-y += vm86.h 23unifdef-y += vm86.h
24unifdef-y += vsyscall.h 24unifdef-y += vsyscall.h
25unifdef-y += swab.h
diff --git a/arch/x86/include/asm/byteorder.h b/arch/x86/include/asm/byteorder.h
index 7c49917e3d9d..b13a7a88f3eb 100644
--- a/arch/x86/include/asm/byteorder.h
+++ b/arch/x86/include/asm/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_X86_BYTEORDER_H 1#ifndef _ASM_X86_BYTEORDER_H
2#define _ASM_X86_BYTEORDER_H 2#define _ASM_X86_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ASM_X86_BYTEORDER_H */ 6#endif /* _ASM_X86_BYTEORDER_H */
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 83e69f4a37f0..06bbcbd66e9c 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -341,6 +341,25 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
341 341
342#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) 342#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
343 343
344static inline int is_new_memtype_allowed(unsigned long flags,
345 unsigned long new_flags)
346{
347 /*
348 * Certain new memtypes are not allowed with certain
349 * requested memtype:
350 * - request is uncached, return cannot be write-back
351 * - request is write-combine, return cannot be write-back
352 */
353 if ((flags == _PAGE_CACHE_UC_MINUS &&
354 new_flags == _PAGE_CACHE_WB) ||
355 (flags == _PAGE_CACHE_WC &&
356 new_flags == _PAGE_CACHE_WB)) {
357 return 0;
358 }
359
360 return 1;
361}
362
344#ifndef __ASSEMBLY__ 363#ifndef __ASSEMBLY__
345/* Indicate that x86 has its own track and untrack pfn vma functions */ 364/* Indicate that x86 has its own track and untrack pfn vma functions */
346#define __HAVE_PFNMAP_TRACKING 365#define __HAVE_PFNMAP_TRACKING
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index d6f0490a7391..46469029e9d3 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -1203,7 +1203,6 @@ nmi_stack_correct:
1203 pushl %eax 1203 pushl %eax
1204 CFI_ADJUST_CFA_OFFSET 4 1204 CFI_ADJUST_CFA_OFFSET 4
1205 SAVE_ALL 1205 SAVE_ALL
1206 TRACE_IRQS_OFF
1207 xorl %edx,%edx # zero error code 1206 xorl %edx,%edx # zero error code
1208 movl %esp,%eax # pt_regs pointer 1207 movl %esp,%eax # pt_regs pointer
1209 call do_nmi 1208 call do_nmi
@@ -1244,7 +1243,6 @@ nmi_espfix_stack:
1244 pushl %eax 1243 pushl %eax
1245 CFI_ADJUST_CFA_OFFSET 4 1244 CFI_ADJUST_CFA_OFFSET 4
1246 SAVE_ALL 1245 SAVE_ALL
1247 TRACE_IRQS_OFF
1248 FIXUP_ESPFIX_STACK # %eax == %esp 1246 FIXUP_ESPFIX_STACK # %eax == %esp
1249 xorl %edx,%edx # zero error code 1247 xorl %edx,%edx # zero error code
1250 call do_nmi 1248 call do_nmi
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index d44395ff34c3..e2e86a08f31d 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -88,7 +88,7 @@ ENTRY(sys_call_table)
88 .long sys_uselib 88 .long sys_uselib
89 .long sys_swapon 89 .long sys_swapon
90 .long sys_reboot 90 .long sys_reboot
91 .long old_readdir 91 .long sys_old_readdir
92 .long old_mmap /* 90 */ 92 .long old_mmap /* 90 */
93 .long sys_munmap 93 .long sys_munmap
94 .long sys_truncate 94 .long sys_truncate
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 85cbd3cd3723..8b08fb955274 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -601,12 +601,13 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
601 * Reserved non RAM regions only and after successful reserve_memtype, 601 * Reserved non RAM regions only and after successful reserve_memtype,
602 * this func also keeps identity mapping (if any) in sync with this new prot. 602 * this func also keeps identity mapping (if any) in sync with this new prot.
603 */ 603 */
604static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t vma_prot) 604static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
605 int strict_prot)
605{ 606{
606 int is_ram = 0; 607 int is_ram = 0;
607 int id_sz, ret; 608 int id_sz, ret;
608 unsigned long flags; 609 unsigned long flags;
609 unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK); 610 unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK);
610 611
611 is_ram = pagerange_is_ram(paddr, paddr + size); 612 is_ram = pagerange_is_ram(paddr, paddr + size);
612 613
@@ -625,15 +626,24 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t vma_prot)
625 return ret; 626 return ret;
626 627
627 if (flags != want_flags) { 628 if (flags != want_flags) {
628 free_memtype(paddr, paddr + size); 629 if (strict_prot || !is_new_memtype_allowed(want_flags, flags)) {
629 printk(KERN_ERR 630 free_memtype(paddr, paddr + size);
630 "%s:%d map pfn expected mapping type %s for %Lx-%Lx, got %s\n", 631 printk(KERN_ERR "%s:%d map pfn expected mapping type %s"
631 current->comm, current->pid, 632 " for %Lx-%Lx, got %s\n",
632 cattr_name(want_flags), 633 current->comm, current->pid,
633 (unsigned long long)paddr, 634 cattr_name(want_flags),
634 (unsigned long long)(paddr + size), 635 (unsigned long long)paddr,
635 cattr_name(flags)); 636 (unsigned long long)(paddr + size),
636 return -EINVAL; 637 cattr_name(flags));
638 return -EINVAL;
639 }
640 /*
641 * We allow returning different type than the one requested in
642 * non strict case.
643 */
644 *vma_prot = __pgprot((pgprot_val(*vma_prot) &
645 (~_PAGE_CACHE_MASK)) |
646 flags);
637 } 647 }
638 648
639 /* Need to keep identity mapping in sync */ 649 /* Need to keep identity mapping in sync */
@@ -689,6 +699,7 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
689 unsigned long vma_start = vma->vm_start; 699 unsigned long vma_start = vma->vm_start;
690 unsigned long vma_end = vma->vm_end; 700 unsigned long vma_end = vma->vm_end;
691 unsigned long vma_size = vma_end - vma_start; 701 unsigned long vma_size = vma_end - vma_start;
702 pgprot_t pgprot;
692 703
693 if (!pat_enabled) 704 if (!pat_enabled)
694 return 0; 705 return 0;
@@ -702,7 +713,8 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
702 WARN_ON_ONCE(1); 713 WARN_ON_ONCE(1);
703 return -EINVAL; 714 return -EINVAL;
704 } 715 }
705 return reserve_pfn_range(paddr, vma_size, __pgprot(prot)); 716 pgprot = __pgprot(prot);
717 return reserve_pfn_range(paddr, vma_size, &pgprot, 1);
706 } 718 }
707 719
708 /* reserve entire vma page by page, using pfn and prot from pte */ 720 /* reserve entire vma page by page, using pfn and prot from pte */
@@ -710,7 +722,8 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
710 if (follow_phys(vma, vma_start + i, 0, &prot, &paddr)) 722 if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
711 continue; 723 continue;
712 724
713 retval = reserve_pfn_range(paddr, PAGE_SIZE, __pgprot(prot)); 725 pgprot = __pgprot(prot);
726 retval = reserve_pfn_range(paddr, PAGE_SIZE, &pgprot, 1);
714 if (retval) 727 if (retval)
715 goto cleanup_ret; 728 goto cleanup_ret;
716 } 729 }
@@ -741,7 +754,7 @@ cleanup_ret:
741 * Note that this function can be called with caller trying to map only a 754 * Note that this function can be called with caller trying to map only a
742 * subrange/page inside the vma. 755 * subrange/page inside the vma.
743 */ 756 */
744int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot, 757int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
745 unsigned long pfn, unsigned long size) 758 unsigned long pfn, unsigned long size)
746{ 759{
747 int retval = 0; 760 int retval = 0;
@@ -758,14 +771,14 @@ int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
758 if (is_linear_pfn_mapping(vma)) { 771 if (is_linear_pfn_mapping(vma)) {
759 /* reserve the whole chunk starting from vm_pgoff */ 772 /* reserve the whole chunk starting from vm_pgoff */
760 paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT; 773 paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
761 return reserve_pfn_range(paddr, vma_size, prot); 774 return reserve_pfn_range(paddr, vma_size, prot, 0);
762 } 775 }
763 776
764 /* reserve page by page using pfn and size */ 777 /* reserve page by page using pfn and size */
765 base_paddr = (resource_size_t)pfn << PAGE_SHIFT; 778 base_paddr = (resource_size_t)pfn << PAGE_SHIFT;
766 for (i = 0; i < size; i += PAGE_SIZE) { 779 for (i = 0; i < size; i += PAGE_SIZE) {
767 paddr = base_paddr + i; 780 paddr = base_paddr + i;
768 retval = reserve_pfn_range(paddr, PAGE_SIZE, prot); 781 retval = reserve_pfn_range(paddr, PAGE_SIZE, prot, 0);
769 if (retval) 782 if (retval)
770 goto cleanup_ret; 783 goto cleanup_ret;
771 } 784 }
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index f884740da318..5ead808dd70c 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -314,17 +314,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
314 return retval; 314 return retval;
315 315
316 if (flags != new_flags) { 316 if (flags != new_flags) {
317 /* 317 if (!is_new_memtype_allowed(flags, new_flags)) {
318 * Do not fallback to certain memory types with certain
319 * requested type:
320 * - request is uncached, return cannot be write-back
321 * - request is uncached, return cannot be write-combine
322 * - request is write-combine, return cannot be write-back
323 */
324 if ((flags == _PAGE_CACHE_UC_MINUS &&
325 (new_flags == _PAGE_CACHE_WB)) ||
326 (flags == _PAGE_CACHE_WC &&
327 new_flags == _PAGE_CACHE_WB)) {
328 free_memtype(addr, addr+len); 318 free_memtype(addr, addr+len);
329 return -EINVAL; 319 return -EINVAL;
330 } 320 }
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 58c02a454130..c68e1680da01 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1,3 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2
3unifdef-y += swab.h
diff --git a/arch/xtensa/include/asm/byteorder.h b/arch/xtensa/include/asm/byteorder.h
index 329b94591ca4..54eb6315349c 100644
--- a/arch/xtensa/include/asm/byteorder.h
+++ b/arch/xtensa/include/asm/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef _XTENSA_BYTEORDER_H 1#ifndef _XTENSA_BYTEORDER_H
2#define _XTENSA_BYTEORDER_H 2#define _XTENSA_BYTEORDER_H
3 3
4#include <asm/swab.h>
5
6#ifdef __XTENSA_EL__ 4#ifdef __XTENSA_EL__
7#include <linux/byteorder/little_endian.h> 5#include <linux/byteorder/little_endian.h>
8#elif defined(__XTENSA_EB__) 6#elif defined(__XTENSA_EB__)
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 1a7be96d627b..503a908afc80 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -698,6 +698,15 @@ config PATA_IXP4XX_CF
698 698
699 If unsure, say N. 699 If unsure, say N.
700 700
701config PATA_OCTEON_CF
702 tristate "OCTEON Boot Bus Compact Flash support"
703 depends on CPU_CAVIUM_OCTEON
704 help
705 This option enables a polled compact flash driver for use with
706 compact flash cards attached to the OCTEON boot bus.
707
708 If unsure, say N.
709
701config PATA_SCC 710config PATA_SCC
702 tristate "Toshiba's Cell Reference Set IDE support" 711 tristate "Toshiba's Cell Reference Set IDE support"
703 depends on PCI && PPC_CELLEB 712 depends on PCI && PPC_CELLEB
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 674965fa326d..7f1ecf99528c 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o
69obj-$(CONFIG_PATA_SCC) += pata_scc.o 69obj-$(CONFIG_PATA_SCC) += pata_scc.o
70obj-$(CONFIG_PATA_SCH) += pata_sch.o 70obj-$(CONFIG_PATA_SCH) += pata_sch.o
71obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o 71obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o
72obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o
72obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o 73obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o
73obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o 74obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o
74obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o 75obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 71218d76d75e..88c242856dae 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3029,33 +3029,33 @@ int sata_set_spd(struct ata_link *link)
3029 */ 3029 */
3030 3030
3031static const struct ata_timing ata_timing[] = { 3031static const struct ata_timing ata_timing[] = {
3032/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960, 0 }, */ 3032/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 0, 960, 0 }, */
3033 { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0 }, 3033 { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 0, 600, 0 },
3034 { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 383, 0 }, 3034 { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 0, 383, 0 },
3035 { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 240, 0 }, 3035 { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 0, 240, 0 },
3036 { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 }, 3036 { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 0, 180, 0 },
3037 { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 }, 3037 { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 0, 120, 0 },
3038 { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 100, 0 }, 3038 { XFER_PIO_5, 15, 65, 25, 100, 65, 25, 0, 100, 0 },
3039 { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 80, 0 }, 3039 { XFER_PIO_6, 10, 55, 20, 80, 55, 20, 0, 80, 0 },
3040 3040
3041 { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, 3041 { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 50, 960, 0 },
3042 { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, 3042 { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 30, 480, 0 },
3043 { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 240, 0 }, 3043 { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 20, 240, 0 },
3044 3044
3045 { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 480, 0 }, 3045 { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 20, 480, 0 },
3046 { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 150, 0 }, 3046 { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 5, 150, 0 },
3047 { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 120, 0 }, 3047 { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 5, 120, 0 },
3048 { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 100, 0 }, 3048 { XFER_MW_DMA_3, 25, 0, 0, 0, 65, 25, 5, 100, 0 },
3049 { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 80, 0 }, 3049 { XFER_MW_DMA_4, 25, 0, 0, 0, 55, 20, 5, 80, 0 },
3050 3050
3051/* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 150 }, */ 3051/* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 0, 150 }, */
3052 { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, 3052 { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 0, 120 },
3053 { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 }, 3053 { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 0, 80 },
3054 { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 }, 3054 { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 0, 60 },
3055 { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, 3055 { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 0, 45 },
3056 { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, 3056 { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 0, 30 },
3057 { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 20 }, 3057 { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 0, 20 },
3058 { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 15 }, 3058 { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 0, 15 },
3059 3059
3060 { 0xFF } 3060 { 0xFF }
3061}; 3061};
@@ -3065,14 +3065,15 @@ static const struct ata_timing ata_timing[] = {
3065 3065
3066static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) 3066static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
3067{ 3067{
3068 q->setup = EZ(t->setup * 1000, T); 3068 q->setup = EZ(t->setup * 1000, T);
3069 q->act8b = EZ(t->act8b * 1000, T); 3069 q->act8b = EZ(t->act8b * 1000, T);
3070 q->rec8b = EZ(t->rec8b * 1000, T); 3070 q->rec8b = EZ(t->rec8b * 1000, T);
3071 q->cyc8b = EZ(t->cyc8b * 1000, T); 3071 q->cyc8b = EZ(t->cyc8b * 1000, T);
3072 q->active = EZ(t->active * 1000, T); 3072 q->active = EZ(t->active * 1000, T);
3073 q->recover = EZ(t->recover * 1000, T); 3073 q->recover = EZ(t->recover * 1000, T);
3074 q->cycle = EZ(t->cycle * 1000, T); 3074 q->dmack_hold = EZ(t->dmack_hold * 1000, T);
3075 q->udma = EZ(t->udma * 1000, UT); 3075 q->cycle = EZ(t->cycle * 1000, T);
3076 q->udma = EZ(t->udma * 1000, UT);
3076} 3077}
3077 3078
3078void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b, 3079void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
@@ -3084,6 +3085,7 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
3084 if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b); 3085 if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b);
3085 if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active); 3086 if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active);
3086 if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover); 3087 if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
3088 if (what & ATA_TIMING_DMACK_HOLD) m->dmack_hold = max(a->dmack_hold, b->dmack_hold);
3087 if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle); 3089 if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle);
3088 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); 3090 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
3089} 3091}
@@ -6638,7 +6640,6 @@ EXPORT_SYMBOL_GPL(ata_dev_pair);
6638EXPORT_SYMBOL_GPL(ata_port_disable); 6640EXPORT_SYMBOL_GPL(ata_port_disable);
6639EXPORT_SYMBOL_GPL(ata_ratelimit); 6641EXPORT_SYMBOL_GPL(ata_ratelimit);
6640EXPORT_SYMBOL_GPL(ata_wait_register); 6642EXPORT_SYMBOL_GPL(ata_wait_register);
6641EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
6642EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); 6643EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
6643EXPORT_SYMBOL_GPL(ata_scsi_slave_config); 6644EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
6644EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy); 6645EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9e92107691f2..a1a6e6298c33 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -423,9 +423,9 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
423 * RETURNS: 423 * RETURNS:
424 * Zero on success, negative errno on error. 424 * Zero on success, negative errno on error.
425 */ 425 */
426static int ata_get_identity(struct scsi_device *sdev, void __user *arg) 426static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
427 void __user *arg)
427{ 428{
428 struct ata_port *ap = ata_shost_to_port(sdev->host);
429 struct ata_device *dev = ata_scsi_find_dev(ap, sdev); 429 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
430 u16 __user *dst = arg; 430 u16 __user *dst = arg;
431 char buf[40]; 431 char buf[40];
@@ -645,7 +645,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
645 return rc; 645 return rc;
646} 646}
647 647
648int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) 648int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev,
649 int cmd, void __user *arg)
649{ 650{
650 int val = -EINVAL, rc = -EINVAL; 651 int val = -EINVAL, rc = -EINVAL;
651 652
@@ -663,7 +664,7 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
663 return 0; 664 return 0;
664 665
665 case HDIO_GET_IDENTITY: 666 case HDIO_GET_IDENTITY:
666 return ata_get_identity(scsidev, arg); 667 return ata_get_identity(ap, scsidev, arg);
667 668
668 case HDIO_DRIVE_CMD: 669 case HDIO_DRIVE_CMD:
669 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 670 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
@@ -682,6 +683,14 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
682 683
683 return rc; 684 return rc;
684} 685}
686EXPORT_SYMBOL_GPL(ata_sas_scsi_ioctl);
687
688int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
689{
690 return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host),
691 scsidev, cmd, arg);
692}
693EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
685 694
686/** 695/**
687 * ata_scsi_qc_new - acquire new ata_queued_cmd reference 696 * ata_scsi_qc_new - acquire new ata_queued_cmd reference
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 0eae9b453556..5a4aad123c42 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1013,9 +1013,12 @@ next_sg:
1013 qc->cursg_ofs = 0; 1013 qc->cursg_ofs = 0;
1014 } 1014 }
1015 1015
1016 /* consumed can be larger than count only for the last transfer */ 1016 /*
1017 WARN_ON_ONCE(qc->cursg && count != consumed); 1017 * There used to be a WARN_ON_ONCE(qc->cursg && count != consumed);
1018 1018 * Unfortunately __atapi_pio_bytes doesn't know enough to do the WARN
1019 * check correctly as it doesn't know if it is the last request being
1020 * made. Somebody should implement a proper sanity check.
1021 */
1019 if (bytes) 1022 if (bytes)
1020 goto next_sg; 1023 goto next_sg;
1021 return 0; 1024 return 0;
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index a7999c19f0c9..eb99dbe78081 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -41,7 +41,7 @@ static int ali_atapi_dma = 0;
41module_param_named(atapi_dma, ali_atapi_dma, int, 0644); 41module_param_named(atapi_dma, ali_atapi_dma, int, 0644);
42MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); 42MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)");
43 43
44static struct pci_dev *isa_bridge; 44static struct pci_dev *ali_isa_bridge;
45 45
46/* 46/*
47 * Cable special cases 47 * Cable special cases
@@ -346,13 +346,13 @@ static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes)
346 int port_bit = 4 << link->ap->port_no; 346 int port_bit = 4 << link->ap->port_no;
347 347
348 /* If our bridge is an ALI 1533 then do the extra work */ 348 /* If our bridge is an ALI 1533 then do the extra work */
349 if (isa_bridge) { 349 if (ali_isa_bridge) {
350 /* Tristate and re-enable the bus signals */ 350 /* Tristate and re-enable the bus signals */
351 pci_read_config_byte(isa_bridge, 0x58, &r); 351 pci_read_config_byte(ali_isa_bridge, 0x58, &r);
352 r &= ~port_bit; 352 r &= ~port_bit;
353 pci_write_config_byte(isa_bridge, 0x58, r); 353 pci_write_config_byte(ali_isa_bridge, 0x58, r);
354 r |= port_bit; 354 r |= port_bit;
355 pci_write_config_byte(isa_bridge, 0x58, r); 355 pci_write_config_byte(ali_isa_bridge, 0x58, r);
356 } 356 }
357 ata_sff_postreset(link, classes); 357 ata_sff_postreset(link, classes);
358} 358}
@@ -467,14 +467,14 @@ static void ali_init_chipset(struct pci_dev *pdev)
467 pci_write_config_byte(pdev, 0x53, tmp); 467 pci_write_config_byte(pdev, 0x53, tmp);
468 } 468 }
469 north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); 469 north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
470 if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) { 470 if (north && north->vendor == PCI_VENDOR_ID_AL && ali_isa_bridge) {
471 /* Configure the ALi bridge logic. For non ALi rely on BIOS. 471 /* Configure the ALi bridge logic. For non ALi rely on BIOS.
472 Set the south bridge enable bit */ 472 Set the south bridge enable bit */
473 pci_read_config_byte(isa_bridge, 0x79, &tmp); 473 pci_read_config_byte(ali_isa_bridge, 0x79, &tmp);
474 if (pdev->revision == 0xC2) 474 if (pdev->revision == 0xC2)
475 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); 475 pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x04);
476 else if (pdev->revision > 0xC2 && pdev->revision < 0xC5) 476 else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
477 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); 477 pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x02);
478 } 478 }
479 pci_dev_put(north); 479 pci_dev_put(north);
480 ata_pci_bmdma_clear_simplex(pdev); 480 ata_pci_bmdma_clear_simplex(pdev);
@@ -571,9 +571,9 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
571 571
572 ali_init_chipset(pdev); 572 ali_init_chipset(pdev);
573 573
574 if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { 574 if (ali_isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
575 /* Are we paired with a UDMA capable chip */ 575 /* Are we paired with a UDMA capable chip */
576 pci_read_config_byte(isa_bridge, 0x5E, &tmp); 576 pci_read_config_byte(ali_isa_bridge, 0x5E, &tmp);
577 if ((tmp & 0x1E) == 0x12) 577 if ((tmp & 0x1E) == 0x12)
578 ppi[0] = &info_20_udma; 578 ppi[0] = &info_20_udma;
579 } 579 }
@@ -617,11 +617,11 @@ static struct pci_driver ali_pci_driver = {
617static int __init ali_init(void) 617static int __init ali_init(void)
618{ 618{
619 int ret; 619 int ret;
620 isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); 620 ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
621 621
622 ret = pci_register_driver(&ali_pci_driver); 622 ret = pci_register_driver(&ali_pci_driver);
623 if (ret < 0) 623 if (ret < 0)
624 pci_dev_put(isa_bridge); 624 pci_dev_put(ali_isa_bridge);
625 return ret; 625 return ret;
626} 626}
627 627
@@ -629,7 +629,7 @@ static int __init ali_init(void)
629static void __exit ali_exit(void) 629static void __exit ali_exit(void)
630{ 630{
631 pci_unregister_driver(&ali_pci_driver); 631 pci_unregister_driver(&ali_pci_driver);
632 pci_dev_put(isa_bridge); 632 pci_dev_put(ali_isa_bridge);
633} 633}
634 634
635 635
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 0e2cde8f9973..506adde8ebb3 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -32,21 +32,6 @@ enum {
32 ATIIXP_IDE_UDMA_MODE = 0x56 32 ATIIXP_IDE_UDMA_MODE = 0x56
33}; 33};
34 34
35static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline)
36{
37 struct ata_port *ap = link->ap;
38 static const struct pci_bits atiixp_enable_bits[] = {
39 { 0x48, 1, 0x01, 0x00 },
40 { 0x48, 1, 0x08, 0x00 }
41 };
42 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
43
44 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no]))
45 return -ENOENT;
46
47 return ata_sff_prereset(link, deadline);
48}
49
50static int atiixp_cable_detect(struct ata_port *ap) 35static int atiixp_cable_detect(struct ata_port *ap)
51{ 36{
52 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 37 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -229,10 +214,9 @@ static struct ata_port_operations atiixp_port_ops = {
229 .cable_detect = atiixp_cable_detect, 214 .cable_detect = atiixp_cable_detect,
230 .set_piomode = atiixp_set_piomode, 215 .set_piomode = atiixp_set_piomode,
231 .set_dmamode = atiixp_set_dmamode, 216 .set_dmamode = atiixp_set_dmamode,
232 .prereset = atiixp_pre_reset,
233}; 217};
234 218
235static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 219static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
236{ 220{
237 static const struct ata_port_info info = { 221 static const struct ata_port_info info = {
238 .flags = ATA_FLAG_SLAVE_POSS, 222 .flags = ATA_FLAG_SLAVE_POSS,
@@ -241,8 +225,18 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
241 .udma_mask = 0x3F, 225 .udma_mask = 0x3F,
242 .port_ops = &atiixp_port_ops 226 .port_ops = &atiixp_port_ops
243 }; 227 };
244 const struct ata_port_info *ppi[] = { &info, NULL }; 228 static const struct pci_bits atiixp_enable_bits[] = {
245 return ata_pci_sff_init_one(dev, ppi, &atiixp_sht, NULL); 229 { 0x48, 1, 0x01, 0x00 },
230 { 0x48, 1, 0x08, 0x00 }
231 };
232 const struct ata_port_info *ppi[] = { &info, &info };
233 int i;
234
235 for (i = 0; i < 2; i++)
236 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i]))
237 ppi[i] = &ata_dummy_port_info;
238
239 return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL);
246} 240}
247 241
248static const struct pci_device_id atiixp[] = { 242static const struct pci_device_id atiixp[] = {
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index f828a29d7756..f1bb2f9fecbf 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -80,7 +80,7 @@
80 80
81 81
82#define DRV_NAME "pata_it821x" 82#define DRV_NAME "pata_it821x"
83#define DRV_VERSION "0.4.0" 83#define DRV_VERSION "0.4.2"
84 84
85struct it821x_dev 85struct it821x_dev
86{ 86{
@@ -494,8 +494,6 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus
494 * special. In our case we need to lock the sector count to avoid 494 * special. In our case we need to lock the sector count to avoid
495 * blowing the brains out of the firmware with large LBA48 requests 495 * blowing the brains out of the firmware with large LBA48 requests
496 * 496 *
497 * FIXME: When FUA appears we need to block FUA too. And SMART and
498 * basically we need to filter commands for this chip.
499 */ 497 */
500 498
501static void it821x_dev_config(struct ata_device *adev) 499static void it821x_dev_config(struct ata_device *adev)
@@ -890,6 +888,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
890 .flags = ATA_FLAG_SLAVE_POSS, 888 .flags = ATA_FLAG_SLAVE_POSS,
891 .pio_mask = 0x1f, 889 .pio_mask = 0x1f,
892 .mwdma_mask = 0x07, 890 .mwdma_mask = 0x07,
891 .udma_mask = ATA_UDMA6,
892 .port_ops = &it821x_rdc_port_ops
893 };
894 static const struct ata_port_info info_rdc_11 = {
895 .flags = ATA_FLAG_SLAVE_POSS,
896 .pio_mask = 0x1f,
897 .mwdma_mask = 0x07,
893 /* No UDMA */ 898 /* No UDMA */
894 .port_ops = &it821x_rdc_port_ops 899 .port_ops = &it821x_rdc_port_ops
895 }; 900 };
@@ -903,7 +908,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
903 return rc; 908 return rc;
904 909
905 if (pdev->vendor == PCI_VENDOR_ID_RDC) { 910 if (pdev->vendor == PCI_VENDOR_ID_RDC) {
906 ppi[0] = &info_rdc; 911 /* Deal with Vortex86SX */
912 if (pdev->revision == 0x11)
913 ppi[0] = &info_rdc_11;
914 else
915 ppi[0] = &info_rdc;
907 } else { 916 } else {
908 /* Force the card into bypass mode if so requested */ 917 /* Force the card into bypass mode if so requested */
909 if (it8212_noraid) { 918 if (it8212_noraid) {
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
new file mode 100644
index 000000000000..0fe4ef309c62
--- /dev/null
+++ b/drivers/ata/pata_octeon_cf.c
@@ -0,0 +1,965 @@
1/*
2 * Driver for the Octeon bootbus compact flash.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2005 - 2009 Cavium Networks
9 * Copyright (C) 2008 Wind River Systems
10 */
11
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/libata.h>
15#include <linux/irq.h>
16#include <linux/platform_device.h>
17#include <linux/workqueue.h>
18#include <scsi/scsi_host.h>
19
20#include <asm/octeon/octeon.h>
21
22/*
23 * The Octeon bootbus compact flash interface is connected in at least
24 * 3 different configurations on various evaluation boards:
25 *
26 * -- 8 bits no irq, no DMA
27 * -- 16 bits no irq, no DMA
28 * -- 16 bits True IDE mode with DMA, but no irq.
29 *
30 * In the last case the DMA engine can generate an interrupt when the
31 * transfer is complete. For the first two cases only PIO is supported.
32 *
33 */
34
35#define DRV_NAME "pata_octeon_cf"
36#define DRV_VERSION "2.1"
37
38
39struct octeon_cf_port {
40 struct workqueue_struct *wq;
41 struct delayed_work delayed_finish;
42 struct ata_port *ap;
43 int dma_finished;
44};
45
46static struct scsi_host_template octeon_cf_sht = {
47 ATA_PIO_SHT(DRV_NAME),
48};
49
50/**
51 * Convert nanosecond based time to setting used in the
52 * boot bus timing register, based on timing multiple
53 */
54static unsigned int ns_to_tim_reg(unsigned int tim_mult, unsigned int nsecs)
55{
56 unsigned int val;
57
58 /*
59 * Compute # of eclock periods to get desired duration in
60 * nanoseconds.
61 */
62 val = DIV_ROUND_UP(nsecs * (octeon_get_clock_rate() / 1000000),
63 1000 * tim_mult);
64
65 return val;
66}
67
68static void octeon_cf_set_boot_reg_cfg(int cs)
69{
70 union cvmx_mio_boot_reg_cfgx reg_cfg;
71 reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs));
72 reg_cfg.s.dmack = 0; /* Don't assert DMACK on access */
73 reg_cfg.s.tim_mult = 2; /* Timing mutiplier 2x */
74 reg_cfg.s.rd_dly = 0; /* Sample on falling edge of BOOT_OE */
75 reg_cfg.s.sam = 0; /* Don't combine write and output enable */
76 reg_cfg.s.we_ext = 0; /* No write enable extension */
77 reg_cfg.s.oe_ext = 0; /* No read enable extension */
78 reg_cfg.s.en = 1; /* Enable this region */
79 reg_cfg.s.orbit = 0; /* Don't combine with previous region */
80 reg_cfg.s.ale = 0; /* Don't do address multiplexing */
81 cvmx_write_csr(CVMX_MIO_BOOT_REG_CFGX(cs), reg_cfg.u64);
82}
83
84/**
85 * Called after libata determines the needed PIO mode. This
86 * function programs the Octeon bootbus regions to support the
87 * timing requirements of the PIO mode.
88 *
89 * @ap: ATA port information
90 * @dev: ATA device
91 */
92static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev)
93{
94 struct octeon_cf_data *ocd = ap->dev->platform_data;
95 union cvmx_mio_boot_reg_timx reg_tim;
96 int cs = ocd->base_region;
97 int T;
98 struct ata_timing timing;
99
100 int use_iordy;
101 int trh;
102 int pause;
103 /* These names are timing parameters from the ATA spec */
104 int t1;
105 int t2;
106 int t2i;
107
108 T = (int)(2000000000000LL / octeon_get_clock_rate());
109
110 if (ata_timing_compute(dev, dev->pio_mode, &timing, T, T))
111 BUG();
112
113 t1 = timing.setup;
114 if (t1)
115 t1--;
116 t2 = timing.active;
117 if (t2)
118 t2--;
119 t2i = timing.act8b;
120 if (t2i)
121 t2i--;
122
123 trh = ns_to_tim_reg(2, 20);
124 if (trh)
125 trh--;
126
127 pause = timing.cycle - timing.active - timing.setup - trh;
128 if (pause)
129 pause--;
130
131 octeon_cf_set_boot_reg_cfg(cs);
132 if (ocd->dma_engine >= 0)
133 /* True IDE mode, program both chip selects. */
134 octeon_cf_set_boot_reg_cfg(cs + 1);
135
136
137 use_iordy = ata_pio_need_iordy(dev);
138
139 reg_tim.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_TIMX(cs));
140 /* Disable page mode */
141 reg_tim.s.pagem = 0;
142 /* Enable dynamic timing */
143 reg_tim.s.waitm = use_iordy;
144 /* Pages are disabled */
145 reg_tim.s.pages = 0;
146 /* We don't use multiplexed address mode */
147 reg_tim.s.ale = 0;
148 /* Not used */
149 reg_tim.s.page = 0;
150 /* Time after IORDY to coninue to assert the data */
151 reg_tim.s.wait = 0;
152 /* Time to wait to complete the cycle. */
153 reg_tim.s.pause = pause;
154 /* How long to hold after a write to de-assert CE. */
155 reg_tim.s.wr_hld = trh;
156 /* How long to wait after a read to de-assert CE. */
157 reg_tim.s.rd_hld = trh;
158 /* How long write enable is asserted */
159 reg_tim.s.we = t2;
160 /* How long read enable is asserted */
161 reg_tim.s.oe = t2;
162 /* Time after CE that read/write starts */
163 reg_tim.s.ce = ns_to_tim_reg(2, 5);
164 /* Time before CE that address is valid */
165 reg_tim.s.adr = 0;
166
167 /* Program the bootbus region timing for the data port chip select. */
168 cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs), reg_tim.u64);
169 if (ocd->dma_engine >= 0)
170 /* True IDE mode, program both chip selects. */
171 cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs + 1), reg_tim.u64);
172}
173
174static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev)
175{
176 struct octeon_cf_data *ocd = dev->link->ap->dev->platform_data;
177 union cvmx_mio_boot_dma_timx dma_tim;
178 unsigned int oe_a;
179 unsigned int oe_n;
180 unsigned int dma_ackh;
181 unsigned int dma_arq;
182 unsigned int pause;
183 unsigned int T0, Tkr, Td;
184 unsigned int tim_mult;
185
186 const struct ata_timing *timing;
187
188 timing = ata_timing_find_mode(dev->dma_mode);
189 T0 = timing->cycle;
190 Td = timing->active;
191 Tkr = timing->recover;
192 dma_ackh = timing->dmack_hold;
193
194 dma_tim.u64 = 0;
195 /* dma_tim.s.tim_mult = 0 --> 4x */
196 tim_mult = 4;
197
198 /* not spec'ed, value in eclocks, not affected by tim_mult */
199 dma_arq = 8;
200 pause = 25 - dma_arq * 1000 /
201 (octeon_get_clock_rate() / 1000000); /* Tz */
202
203 oe_a = Td;
204 /* Tkr from cf spec, lengthened to meet T0 */
205 oe_n = max(T0 - oe_a, Tkr);
206
207 dma_tim.s.dmack_pi = 1;
208
209 dma_tim.s.oe_n = ns_to_tim_reg(tim_mult, oe_n);
210 dma_tim.s.oe_a = ns_to_tim_reg(tim_mult, oe_a);
211
212 /*
213 * This is tI, C.F. spec. says 0, but Sony CF card requires
214 * more, we use 20 nS.
215 */
216 dma_tim.s.dmack_s = ns_to_tim_reg(tim_mult, 20);;
217 dma_tim.s.dmack_h = ns_to_tim_reg(tim_mult, dma_ackh);
218
219 dma_tim.s.dmarq = dma_arq;
220 dma_tim.s.pause = ns_to_tim_reg(tim_mult, pause);
221
222 dma_tim.s.rd_dly = 0; /* Sample right on edge */
223
224 /* writes only */
225 dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n);
226 dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a);
227
228 pr_debug("ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
229 ns_to_tim_reg(tim_mult, 60));
230 pr_debug("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: "
231 "%d, dmarq: %d, pause: %d\n",
232 dma_tim.s.oe_n, dma_tim.s.oe_a, dma_tim.s.dmack_s,
233 dma_tim.s.dmack_h, dma_tim.s.dmarq, dma_tim.s.pause);
234
235 cvmx_write_csr(CVMX_MIO_BOOT_DMA_TIMX(ocd->dma_engine),
236 dma_tim.u64);
237
238}
239
240/**
241 * Handle an 8 bit I/O request.
242 *
243 * @dev: Device to access
244 * @buffer: Data buffer
245 * @buflen: Length of the buffer.
246 * @rw: True to write.
247 */
248static unsigned int octeon_cf_data_xfer8(struct ata_device *dev,
249 unsigned char *buffer,
250 unsigned int buflen,
251 int rw)
252{
253 struct ata_port *ap = dev->link->ap;
254 void __iomem *data_addr = ap->ioaddr.data_addr;
255 unsigned long words;
256 int count;
257
258 words = buflen;
259 if (rw) {
260 count = 16;
261 while (words--) {
262 iowrite8(*buffer, data_addr);
263 buffer++;
264 /*
265 * Every 16 writes do a read so the bootbus
266 * FIFO doesn't fill up.
267 */
268 if (--count == 0) {
269 ioread8(ap->ioaddr.altstatus_addr);
270 count = 16;
271 }
272 }
273 } else {
274 ioread8_rep(data_addr, buffer, words);
275 }
276 return buflen;
277}
278
279/**
280 * Handle a 16 bit I/O request.
281 *
282 * @dev: Device to access
283 * @buffer: Data buffer
284 * @buflen: Length of the buffer.
285 * @rw: True to write.
286 */
287static unsigned int octeon_cf_data_xfer16(struct ata_device *dev,
288 unsigned char *buffer,
289 unsigned int buflen,
290 int rw)
291{
292 struct ata_port *ap = dev->link->ap;
293 void __iomem *data_addr = ap->ioaddr.data_addr;
294 unsigned long words;
295 int count;
296
297 words = buflen / 2;
298 if (rw) {
299 count = 16;
300 while (words--) {
301 iowrite16(*(uint16_t *)buffer, data_addr);
302 buffer += sizeof(uint16_t);
303 /*
304 * Every 16 writes do a read so the bootbus
305 * FIFO doesn't fill up.
306 */
307 if (--count == 0) {
308 ioread8(ap->ioaddr.altstatus_addr);
309 count = 16;
310 }
311 }
312 } else {
313 while (words--) {
314 *(uint16_t *)buffer = ioread16(data_addr);
315 buffer += sizeof(uint16_t);
316 }
317 }
318 /* Transfer trailing 1 byte, if any. */
319 if (unlikely(buflen & 0x01)) {
320 __le16 align_buf[1] = { 0 };
321
322 if (rw == READ) {
323 align_buf[0] = cpu_to_le16(ioread16(data_addr));
324 memcpy(buffer, align_buf, 1);
325 } else {
326 memcpy(align_buf, buffer, 1);
327 iowrite16(le16_to_cpu(align_buf[0]), data_addr);
328 }
329 words++;
330 }
331 return buflen;
332}
333
334/**
335 * Read the taskfile for 16bit non-True IDE only.
336 */
337static void octeon_cf_tf_read16(struct ata_port *ap, struct ata_taskfile *tf)
338{
339 u16 blob;
340 /* The base of the registers is at ioaddr.data_addr. */
341 void __iomem *base = ap->ioaddr.data_addr;
342
343 blob = __raw_readw(base + 0xc);
344 tf->feature = blob >> 8;
345
346 blob = __raw_readw(base + 2);
347 tf->nsect = blob & 0xff;
348 tf->lbal = blob >> 8;
349
350 blob = __raw_readw(base + 4);
351 tf->lbam = blob & 0xff;
352 tf->lbah = blob >> 8;
353
354 blob = __raw_readw(base + 6);
355 tf->device = blob & 0xff;
356 tf->command = blob >> 8;
357
358 if (tf->flags & ATA_TFLAG_LBA48) {
359 if (likely(ap->ioaddr.ctl_addr)) {
360 iowrite8(tf->ctl | ATA_HOB, ap->ioaddr.ctl_addr);
361
362 blob = __raw_readw(base + 0xc);
363 tf->hob_feature = blob >> 8;
364
365 blob = __raw_readw(base + 2);
366 tf->hob_nsect = blob & 0xff;
367 tf->hob_lbal = blob >> 8;
368
369 blob = __raw_readw(base + 4);
370 tf->hob_lbam = blob & 0xff;
371 tf->hob_lbah = blob >> 8;
372
373 iowrite8(tf->ctl, ap->ioaddr.ctl_addr);
374 ap->last_ctl = tf->ctl;
375 } else {
376 WARN_ON(1);
377 }
378 }
379}
380
381static u8 octeon_cf_check_status16(struct ata_port *ap)
382{
383 u16 blob;
384 void __iomem *base = ap->ioaddr.data_addr;
385
386 blob = __raw_readw(base + 6);
387 return blob >> 8;
388}
389
390static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
391 unsigned long deadline)
392{
393 struct ata_port *ap = link->ap;
394 void __iomem *base = ap->ioaddr.data_addr;
395 int rc;
396 u8 err;
397
398 DPRINTK("about to softreset\n");
399 __raw_writew(ap->ctl, base + 0xe);
400 udelay(20);
401 __raw_writew(ap->ctl | ATA_SRST, base + 0xe);
402 udelay(20);
403 __raw_writew(ap->ctl, base + 0xe);
404
405 rc = ata_sff_wait_after_reset(link, 1, deadline);
406 if (rc) {
407 ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
408 return rc;
409 }
410
411 /* determine by signature whether we have ATA or ATAPI devices */
412 classes[0] = ata_sff_dev_classify(&link->device[0], 1, &err);
413 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
414 return 0;
415}
416
417/**
418 * Load the taskfile for 16bit non-True IDE only. The device_addr is
419 * not loaded, we do this as part of octeon_cf_exec_command16.
420 */
421static void octeon_cf_tf_load16(struct ata_port *ap,
422 const struct ata_taskfile *tf)
423{
424 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
425 /* The base of the registers is at ioaddr.data_addr. */
426 void __iomem *base = ap->ioaddr.data_addr;
427
428 if (tf->ctl != ap->last_ctl) {
429 iowrite8(tf->ctl, ap->ioaddr.ctl_addr);
430 ap->last_ctl = tf->ctl;
431 ata_wait_idle(ap);
432 }
433 if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
434 __raw_writew(tf->hob_feature << 8, base + 0xc);
435 __raw_writew(tf->hob_nsect | tf->hob_lbal << 8, base + 2);
436 __raw_writew(tf->hob_lbam | tf->hob_lbah << 8, base + 4);
437 VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
438 tf->hob_feature,
439 tf->hob_nsect,
440 tf->hob_lbal,
441 tf->hob_lbam,
442 tf->hob_lbah);
443 }
444 if (is_addr) {
445 __raw_writew(tf->feature << 8, base + 0xc);
446 __raw_writew(tf->nsect | tf->lbal << 8, base + 2);
447 __raw_writew(tf->lbam | tf->lbah << 8, base + 4);
448 VPRINTK("feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
449 tf->feature,
450 tf->nsect,
451 tf->lbal,
452 tf->lbam,
453 tf->lbah);
454 }
455 ata_wait_idle(ap);
456}
457
458
459static void octeon_cf_dev_select(struct ata_port *ap, unsigned int device)
460{
461/* There is only one device, do nothing. */
462 return;
463}
464
465/*
466 * Issue ATA command to host controller. The device_addr is also sent
467 * as it must be written in a combined write with the command.
468 */
469static void octeon_cf_exec_command16(struct ata_port *ap,
470 const struct ata_taskfile *tf)
471{
472 /* The base of the registers is at ioaddr.data_addr. */
473 void __iomem *base = ap->ioaddr.data_addr;
474 u16 blob;
475
476 if (tf->flags & ATA_TFLAG_DEVICE) {
477 VPRINTK("device 0x%X\n", tf->device);
478 blob = tf->device;
479 } else {
480 blob = 0;
481 }
482
483 DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
484 blob |= (tf->command << 8);
485 __raw_writew(blob, base + 6);
486
487
488 ata_wait_idle(ap);
489}
490
491static u8 octeon_cf_irq_on(struct ata_port *ap)
492{
493 return 0;
494}
495
496static void octeon_cf_irq_clear(struct ata_port *ap)
497{
498 return;
499}
500
501static void octeon_cf_dma_setup(struct ata_queued_cmd *qc)
502{
503 struct ata_port *ap = qc->ap;
504 struct octeon_cf_port *cf_port;
505
506 cf_port = (struct octeon_cf_port *)ap->private_data;
507 DPRINTK("ENTER\n");
508 /* issue r/w command */
509 qc->cursg = qc->sg;
510 cf_port->dma_finished = 0;
511 ap->ops->sff_exec_command(ap, &qc->tf);
512 DPRINTK("EXIT\n");
513}
514
515/**
516 * Start a DMA transfer that was already setup
517 *
518 * @qc: Information about the DMA
519 */
520static void octeon_cf_dma_start(struct ata_queued_cmd *qc)
521{
522 struct octeon_cf_data *ocd = qc->ap->dev->platform_data;
523 union cvmx_mio_boot_dma_cfgx mio_boot_dma_cfg;
524 union cvmx_mio_boot_dma_intx mio_boot_dma_int;
525 struct scatterlist *sg;
526
527 VPRINTK("%d scatterlists\n", qc->n_elem);
528
529 /* Get the scatter list entry we need to DMA into */
530 sg = qc->cursg;
531 BUG_ON(!sg);
532
533 /*
534 * Clear the DMA complete status.
535 */
536 mio_boot_dma_int.u64 = 0;
537 mio_boot_dma_int.s.done = 1;
538 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine),
539 mio_boot_dma_int.u64);
540
541 /* Enable the interrupt. */
542 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine),
543 mio_boot_dma_int.u64);
544
545 /* Set the direction of the DMA */
546 mio_boot_dma_cfg.u64 = 0;
547 mio_boot_dma_cfg.s.en = 1;
548 mio_boot_dma_cfg.s.rw = ((qc->tf.flags & ATA_TFLAG_WRITE) != 0);
549
550 /*
551 * Don't stop the DMA if the device deasserts DMARQ. Many
552 * compact flashes deassert DMARQ for a short time between
553 * sectors. Instead of stopping and restarting the DMA, we'll
554 * let the hardware do it. If the DMA is really stopped early
555 * due to an error condition, a later timeout will force us to
556 * stop.
557 */
558 mio_boot_dma_cfg.s.clr = 0;
559
560 /* Size is specified in 16bit words and minus one notation */
561 mio_boot_dma_cfg.s.size = sg_dma_len(sg) / 2 - 1;
562
563 /* We need to swap the high and low bytes of every 16 bits */
564 mio_boot_dma_cfg.s.swap8 = 1;
565
566 mio_boot_dma_cfg.s.adr = sg_dma_address(sg);
567
568 VPRINTK("%s %d bytes address=%p\n",
569 (mio_boot_dma_cfg.s.rw) ? "write" : "read", sg->length,
570 (void *)(unsigned long)mio_boot_dma_cfg.s.adr);
571
572 cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine),
573 mio_boot_dma_cfg.u64);
574}
575
576/**
577 *
578 * LOCKING:
579 * spin_lock_irqsave(host lock)
580 *
581 */
582static unsigned int octeon_cf_dma_finished(struct ata_port *ap,
583 struct ata_queued_cmd *qc)
584{
585 struct ata_eh_info *ehi = &ap->link.eh_info;
586 struct octeon_cf_data *ocd = ap->dev->platform_data;
587 union cvmx_mio_boot_dma_cfgx dma_cfg;
588 union cvmx_mio_boot_dma_intx dma_int;
589 struct octeon_cf_port *cf_port;
590 u8 status;
591
592 VPRINTK("ata%u: protocol %d task_state %d\n",
593 ap->print_id, qc->tf.protocol, ap->hsm_task_state);
594
595
596 if (ap->hsm_task_state != HSM_ST_LAST)
597 return 0;
598
599 cf_port = (struct octeon_cf_port *)ap->private_data;
600
601 dma_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine));
602 if (dma_cfg.s.size != 0xfffff) {
603 /* Error, the transfer was not complete. */
604 qc->err_mask |= AC_ERR_HOST_BUS;
605 ap->hsm_task_state = HSM_ST_ERR;
606 }
607
608 /* Stop and clear the dma engine. */
609 dma_cfg.u64 = 0;
610 dma_cfg.s.size = -1;
611 cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine), dma_cfg.u64);
612
613 /* Disable the interrupt. */
614 dma_int.u64 = 0;
615 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine), dma_int.u64);
616
617 /* Clear the DMA complete status */
618 dma_int.s.done = 1;
619 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine), dma_int.u64);
620
621 status = ap->ops->sff_check_status(ap);
622
623 ata_sff_hsm_move(ap, qc, status, 0);
624
625 if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA))
626 ata_ehi_push_desc(ehi, "DMA stat 0x%x", status);
627
628 return 1;
629}
630
631/*
632 * Check if any queued commands have more DMAs, if so start the next
633 * transfer, else do end of transfer handling.
634 */
635static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
636{
637 struct ata_host *host = dev_instance;
638 struct octeon_cf_port *cf_port;
639 int i;
640 unsigned int handled = 0;
641 unsigned long flags;
642
643 spin_lock_irqsave(&host->lock, flags);
644
645 DPRINTK("ENTER\n");
646 for (i = 0; i < host->n_ports; i++) {
647 u8 status;
648 struct ata_port *ap;
649 struct ata_queued_cmd *qc;
650 union cvmx_mio_boot_dma_intx dma_int;
651 union cvmx_mio_boot_dma_cfgx dma_cfg;
652 struct octeon_cf_data *ocd;
653
654 ap = host->ports[i];
655 ocd = ap->dev->platform_data;
656 if (!ap || (ap->flags & ATA_FLAG_DISABLED))
657 continue;
658
659 ocd = ap->dev->platform_data;
660 cf_port = (struct octeon_cf_port *)ap->private_data;
661 dma_int.u64 =
662 cvmx_read_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine));
663 dma_cfg.u64 =
664 cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine));
665
666 qc = ata_qc_from_tag(ap, ap->link.active_tag);
667
668 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
669 (qc->flags & ATA_QCFLAG_ACTIVE)) {
670 if (dma_int.s.done && !dma_cfg.s.en) {
671 if (!sg_is_last(qc->cursg)) {
672 qc->cursg = sg_next(qc->cursg);
673 handled = 1;
674 octeon_cf_dma_start(qc);
675 continue;
676 } else {
677 cf_port->dma_finished = 1;
678 }
679 }
680 if (!cf_port->dma_finished)
681 continue;
682 status = ioread8(ap->ioaddr.altstatus_addr);
683 if (status & (ATA_BUSY | ATA_DRQ)) {
684 /*
685 * We are busy, try to handle it
686 * later. This is the DMA finished
687 * interrupt, and it could take a
688 * little while for the card to be
689 * ready for more commands.
690 */
691 /* Clear DMA irq. */
692 dma_int.u64 = 0;
693 dma_int.s.done = 1;
694 cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine),
695 dma_int.u64);
696
697 queue_delayed_work(cf_port->wq,
698 &cf_port->delayed_finish, 1);
699 handled = 1;
700 } else {
701 handled |= octeon_cf_dma_finished(ap, qc);
702 }
703 }
704 }
705 spin_unlock_irqrestore(&host->lock, flags);
706 DPRINTK("EXIT\n");
707 return IRQ_RETVAL(handled);
708}
709
710static void octeon_cf_delayed_finish(struct work_struct *work)
711{
712 struct octeon_cf_port *cf_port = container_of(work,
713 struct octeon_cf_port,
714 delayed_finish.work);
715 struct ata_port *ap = cf_port->ap;
716 struct ata_host *host = ap->host;
717 struct ata_queued_cmd *qc;
718 unsigned long flags;
719 u8 status;
720
721 spin_lock_irqsave(&host->lock, flags);
722
723 /*
724 * If the port is not waiting for completion, it must have
725 * handled it previously. The hsm_task_state is
726 * protected by host->lock.
727 */
728 if (ap->hsm_task_state != HSM_ST_LAST || !cf_port->dma_finished)
729 goto out;
730
731 status = ioread8(ap->ioaddr.altstatus_addr);
732 if (status & (ATA_BUSY | ATA_DRQ)) {
733 /* Still busy, try again. */
734 queue_delayed_work(cf_port->wq,
735 &cf_port->delayed_finish, 1);
736 goto out;
737 }
738 qc = ata_qc_from_tag(ap, ap->link.active_tag);
739 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
740 (qc->flags & ATA_QCFLAG_ACTIVE))
741 octeon_cf_dma_finished(ap, qc);
742out:
743 spin_unlock_irqrestore(&host->lock, flags);
744}
745
746static void octeon_cf_dev_config(struct ata_device *dev)
747{
748 /*
749 * A maximum of 2^20 - 1 16 bit transfers are possible with
750 * the bootbus DMA. So we need to throttle max_sectors to
751 * (2^12 - 1 == 4095) to assure that this can never happen.
752 */
753 dev->max_sectors = min(dev->max_sectors, 4095U);
754}
755
756/*
757 * Trap if driver tries to do standard bmdma commands. They are not
758 * supported.
759 */
760static void unreachable_qc(struct ata_queued_cmd *qc)
761{
762 BUG();
763}
764
765static u8 unreachable_port(struct ata_port *ap)
766{
767 BUG();
768}
769
770/*
771 * We don't do ATAPI DMA so return 0.
772 */
773static int octeon_cf_check_atapi_dma(struct ata_queued_cmd *qc)
774{
775 return 0;
776}
777
778static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc)
779{
780 struct ata_port *ap = qc->ap;
781
782 switch (qc->tf.protocol) {
783 case ATA_PROT_DMA:
784 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
785
786 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */
787 octeon_cf_dma_setup(qc); /* set up dma */
788 octeon_cf_dma_start(qc); /* initiate dma */
789 ap->hsm_task_state = HSM_ST_LAST;
790 break;
791
792 case ATAPI_PROT_DMA:
793 dev_err(ap->dev, "Error, ATAPI not supported\n");
794 BUG();
795
796 default:
797 return ata_sff_qc_issue(qc);
798 }
799
800 return 0;
801}
802
803static struct ata_port_operations octeon_cf_ops = {
804 .inherits = &ata_sff_port_ops,
805 .check_atapi_dma = octeon_cf_check_atapi_dma,
806 .qc_prep = ata_noop_qc_prep,
807 .qc_issue = octeon_cf_qc_issue,
808 .sff_dev_select = octeon_cf_dev_select,
809 .sff_irq_on = octeon_cf_irq_on,
810 .sff_irq_clear = octeon_cf_irq_clear,
811 .bmdma_setup = unreachable_qc,
812 .bmdma_start = unreachable_qc,
813 .bmdma_stop = unreachable_qc,
814 .bmdma_status = unreachable_port,
815 .cable_detect = ata_cable_40wire,
816 .set_piomode = octeon_cf_set_piomode,
817 .set_dmamode = octeon_cf_set_dmamode,
818 .dev_config = octeon_cf_dev_config,
819};
820
821static int __devinit octeon_cf_probe(struct platform_device *pdev)
822{
823 struct resource *res_cs0, *res_cs1;
824
825 void __iomem *cs0;
826 void __iomem *cs1 = NULL;
827 struct ata_host *host;
828 struct ata_port *ap;
829 struct octeon_cf_data *ocd;
830 int irq = 0;
831 irq_handler_t irq_handler = NULL;
832 void __iomem *base;
833 struct octeon_cf_port *cf_port;
834
835 res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
836
837 if (!res_cs0)
838 return -EINVAL;
839
840 ocd = pdev->dev.platform_data;
841
842 cs0 = devm_ioremap_nocache(&pdev->dev, res_cs0->start,
843 res_cs0->end - res_cs0->start + 1);
844
845 if (!cs0)
846 return -ENOMEM;
847
848 /* Determine from availability of DMA if True IDE mode or not */
849 if (ocd->dma_engine >= 0) {
850 res_cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
851 if (!res_cs1)
852 return -EINVAL;
853
854 cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start,
855 res_cs0->end - res_cs1->start + 1);
856
857 if (!cs1)
858 return -ENOMEM;
859 }
860
861 cf_port = kzalloc(sizeof(*cf_port), GFP_KERNEL);
862 if (!cf_port)
863 return -ENOMEM;
864
865 /* allocate host */
866 host = ata_host_alloc(&pdev->dev, 1);
867 if (!host)
868 goto free_cf_port;
869
870 ap = host->ports[0];
871 ap->private_data = cf_port;
872 cf_port->ap = ap;
873 ap->ops = &octeon_cf_ops;
874 ap->pio_mask = 0x7f; /* Support PIO 0-6 */
875 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY
876 | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING;
877
878 base = cs0 + ocd->base_region_bias;
879 if (!ocd->is16bit) {
880 ap->ioaddr.cmd_addr = base;
881 ata_sff_std_ports(&ap->ioaddr);
882
883 ap->ioaddr.altstatus_addr = base + 0xe;
884 ap->ioaddr.ctl_addr = base + 0xe;
885 octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer8;
886 } else if (cs1) {
887 /* Presence of cs1 indicates True IDE mode. */
888 ap->ioaddr.cmd_addr = base + (ATA_REG_CMD << 1) + 1;
889 ap->ioaddr.data_addr = base + (ATA_REG_DATA << 1);
890 ap->ioaddr.error_addr = base + (ATA_REG_ERR << 1) + 1;
891 ap->ioaddr.feature_addr = base + (ATA_REG_FEATURE << 1) + 1;
892 ap->ioaddr.nsect_addr = base + (ATA_REG_NSECT << 1) + 1;
893 ap->ioaddr.lbal_addr = base + (ATA_REG_LBAL << 1) + 1;
894 ap->ioaddr.lbam_addr = base + (ATA_REG_LBAM << 1) + 1;
895 ap->ioaddr.lbah_addr = base + (ATA_REG_LBAH << 1) + 1;
896 ap->ioaddr.device_addr = base + (ATA_REG_DEVICE << 1) + 1;
897 ap->ioaddr.status_addr = base + (ATA_REG_STATUS << 1) + 1;
898 ap->ioaddr.command_addr = base + (ATA_REG_CMD << 1) + 1;
899 ap->ioaddr.altstatus_addr = cs1 + (6 << 1) + 1;
900 ap->ioaddr.ctl_addr = cs1 + (6 << 1) + 1;
901 octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16;
902
903 ap->mwdma_mask = 0x1f; /* Support MWDMA 0-4 */
904 irq = platform_get_irq(pdev, 0);
905 irq_handler = octeon_cf_interrupt;
906
907 /* True IDE mode needs delayed work to poll for not-busy. */
908 cf_port->wq = create_singlethread_workqueue(DRV_NAME);
909 if (!cf_port->wq)
910 goto free_cf_port;
911 INIT_DELAYED_WORK(&cf_port->delayed_finish,
912 octeon_cf_delayed_finish);
913
914 } else {
915 /* 16 bit but not True IDE */
916 octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16;
917 octeon_cf_ops.softreset = octeon_cf_softreset16;
918 octeon_cf_ops.sff_check_status = octeon_cf_check_status16;
919 octeon_cf_ops.sff_tf_read = octeon_cf_tf_read16;
920 octeon_cf_ops.sff_tf_load = octeon_cf_tf_load16;
921 octeon_cf_ops.sff_exec_command = octeon_cf_exec_command16;
922
923 ap->ioaddr.data_addr = base + ATA_REG_DATA;
924 ap->ioaddr.nsect_addr = base + ATA_REG_NSECT;
925 ap->ioaddr.lbal_addr = base + ATA_REG_LBAL;
926 ap->ioaddr.ctl_addr = base + 0xe;
927 ap->ioaddr.altstatus_addr = base + 0xe;
928 }
929
930 ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
931
932
933 dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
934 (ocd->is16bit) ? 16 : 8,
935 (cs1) ? ", True IDE" : "");
936
937
938 return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht);
939
940free_cf_port:
941 kfree(cf_port);
942 return -ENOMEM;
943}
944
945static struct platform_driver octeon_cf_driver = {
946 .probe = octeon_cf_probe,
947 .driver = {
948 .name = DRV_NAME,
949 .owner = THIS_MODULE,
950 },
951};
952
953static int __init octeon_cf_init(void)
954{
955 return platform_driver_register(&octeon_cf_driver);
956}
957
958
959MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
960MODULE_DESCRIPTION("low-level driver for Cavium OCTEON Compact Flash PATA");
961MODULE_LICENSE("GPL");
962MODULE_VERSION(DRV_VERSION);
963MODULE_ALIAS("platform:" DRV_NAME);
964
965module_init(octeon_cf_init);
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 1a56db92ff7a..55bc88c1707b 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1288,7 +1288,7 @@ static const struct ata_port_info sata_fsl_port_info[] = {
1288static int sata_fsl_probe(struct of_device *ofdev, 1288static int sata_fsl_probe(struct of_device *ofdev,
1289 const struct of_device_id *match) 1289 const struct of_device_id *match)
1290{ 1290{
1291 int retval = 0; 1291 int retval = -ENXIO;
1292 void __iomem *hcr_base = NULL; 1292 void __iomem *hcr_base = NULL;
1293 void __iomem *ssr_base = NULL; 1293 void __iomem *ssr_base = NULL;
1294 void __iomem *csr_base = NULL; 1294 void __iomem *csr_base = NULL;
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index c18935f0bda2..5c62da9cd491 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -92,6 +92,8 @@ static const struct pci_device_id svia_pci_tbl[] = {
92 { PCI_VDEVICE(VIA, 0x5372), vt6420 }, 92 { PCI_VDEVICE(VIA, 0x5372), vt6420 },
93 { PCI_VDEVICE(VIA, 0x7372), vt6420 }, 93 { PCI_VDEVICE(VIA, 0x7372), vt6420 },
94 { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */ 94 { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */
95 { PCI_VDEVICE(VIA, 0x9000), vt8251 },
96 { PCI_VDEVICE(VIA, 0x9040), vt8251 },
95 97
96 { } /* terminate list */ 98 { } /* terminate list */
97}; 99};
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7bcc1d8bc967..34f80fa6fed1 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -406,6 +406,7 @@ static int nbd_do_it(struct nbd_device *lo)
406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); 406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
407 if (ret) { 407 if (ret) {
408 printk(KERN_ERR "nbd: sysfs_create_file failed!"); 408 printk(KERN_ERR "nbd: sysfs_create_file failed!");
409 lo->pid = 0;
409 return ret; 410 return ret;
410 } 411 }
411 412
@@ -413,6 +414,7 @@ static int nbd_do_it(struct nbd_device *lo)
413 nbd_end_request(req); 414 nbd_end_request(req);
414 415
415 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); 416 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
417 lo->pid = 0;
416 return 0; 418 return 0;
417} 419}
418 420
@@ -648,6 +650,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
648 set_capacity(lo->disk, lo->bytesize >> 9); 650 set_capacity(lo->disk, lo->bytesize >> 9);
649 return 0; 651 return 0;
650 case NBD_DO_IT: 652 case NBD_DO_IT:
653 if (lo->pid)
654 return -EBUSY;
651 if (!lo->file) 655 if (!lo->file)
652 return -EINVAL; 656 return -EINVAL;
653 thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); 657 thread = kthread_create(nbd_thread, lo, lo->disk->disk_name);
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index 936466f62afd..bccc42bb9212 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -141,7 +141,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
141 141
142 start_sector = req->sector * priv->blocking_factor; 142 start_sector = req->sector * priv->blocking_factor;
143 sectors = req->nr_sectors * priv->blocking_factor; 143 sectors = req->nr_sectors * priv->blocking_factor;
144 dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n", 144 dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n",
145 __func__, __LINE__, op, sectors, start_sector); 145 __func__, __LINE__, op, sectors, start_sector);
146 146
147 if (write) { 147 if (write) {
@@ -178,7 +178,7 @@ static int ps3disk_submit_flush_request(struct ps3_storage_device *dev,
178 LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 178 LV1_STORAGE_ATA_HDDOUT, 0, 0, 0,
179 0, &dev->tag); 179 0, &dev->tag);
180 if (res) { 180 if (res) {
181 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n", 181 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n",
182 __func__, __LINE__, res); 182 __func__, __LINE__, res);
183 end_request(req, 0); 183 end_request(req, 0);
184 return 0; 184 return 0;
@@ -238,11 +238,11 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
238 238
239 if (tag != dev->tag) 239 if (tag != dev->tag)
240 dev_err(&dev->sbd.core, 240 dev_err(&dev->sbd.core,
241 "%s:%u: tag mismatch, got %lx, expected %lx\n", 241 "%s:%u: tag mismatch, got %llx, expected %llx\n",
242 __func__, __LINE__, tag, dev->tag); 242 __func__, __LINE__, tag, dev->tag);
243 243
244 if (res) { 244 if (res) {
245 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", 245 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
246 __func__, __LINE__, res, status); 246 __func__, __LINE__, res, status);
247 return IRQ_HANDLED; 247 return IRQ_HANDLED;
248 } 248 }
@@ -269,7 +269,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
269 op = read ? "read" : "write"; 269 op = read ? "read" : "write";
270 } 270 }
271 if (status) { 271 if (status) {
272 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 272 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
273 __LINE__, op, status); 273 __LINE__, op, status);
274 error = -EIO; 274 error = -EIO;
275 } else { 275 } else {
@@ -297,7 +297,7 @@ static int ps3disk_sync_cache(struct ps3_storage_device *dev)
297 297
298 res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0); 298 res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0);
299 if (res) { 299 if (res) {
300 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n", 300 dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n",
301 __func__, __LINE__, res); 301 __func__, __LINE__, res);
302 return -EIO; 302 return -EIO;
303 } 303 }
@@ -388,7 +388,7 @@ static int ps3disk_identify(struct ps3_storage_device *dev)
388 sizeof(ata_cmnd), ata_cmnd.buffer, 388 sizeof(ata_cmnd), ata_cmnd.buffer,
389 ata_cmnd.arglen); 389 ata_cmnd.arglen);
390 if (res) { 390 if (res) {
391 dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%lx\n", 391 dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%llx\n",
392 __func__, __LINE__, res); 392 __func__, __LINE__, res);
393 return -EIO; 393 return -EIO;
394 } 394 }
@@ -426,7 +426,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
426 426
427 if (dev->blk_size < 512) { 427 if (dev->blk_size < 512) {
428 dev_err(&dev->sbd.core, 428 dev_err(&dev->sbd.core,
429 "%s:%u: cannot handle block size %lu\n", __func__, 429 "%s:%u: cannot handle block size %llu\n", __func__,
430 __LINE__, dev->blk_size); 430 __LINE__, dev->blk_size);
431 return -EINVAL; 431 return -EINVAL;
432 } 432 }
@@ -512,7 +512,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
512 dev->regions[dev->region_idx].size*priv->blocking_factor); 512 dev->regions[dev->region_idx].size*priv->blocking_factor);
513 513
514 dev_info(&dev->sbd.core, 514 dev_info(&dev->sbd.core,
515 "%s is a %s (%lu MiB total, %lu MiB for OtherOS)\n", 515 "%s is a %s (%llu MiB total, %lu MiB for OtherOS)\n",
516 gendisk->disk_name, priv->model, priv->raw_capacity >> 11, 516 gendisk->disk_name, priv->model, priv->raw_capacity >> 11,
517 get_capacity(gendisk) >> 11); 517 get_capacity(gendisk) >> 11);
518 518
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 29e1dfafb7c6..381d686fc1a3 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1206,6 +1206,7 @@ static struct of_device_id ace_of_match[] __devinitdata = {
1206 { .compatible = "xlnx,opb-sysace-1.00.b", }, 1206 { .compatible = "xlnx,opb-sysace-1.00.b", },
1207 { .compatible = "xlnx,opb-sysace-1.00.c", }, 1207 { .compatible = "xlnx,opb-sysace-1.00.c", },
1208 { .compatible = "xlnx,xps-sysace-1.00.a", }, 1208 { .compatible = "xlnx,xps-sysace-1.00.a", },
1209 { .compatible = "xlnx,sysace", },
1209 {}, 1210 {},
1210}; 1211};
1211MODULE_DEVICE_TABLE(of, ace_of_match); 1212MODULE_DEVICE_TABLE(of, ace_of_match);
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 977dfb1096a0..f6094ae0ef33 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -103,7 +103,7 @@ static ssize_t
103bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) 103bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf)
104{ 104{
105 struct bsr_dev *bsr_dev = dev_get_drvdata(dev); 105 struct bsr_dev *bsr_dev = dev_get_drvdata(dev);
106 return sprintf(buf, "%lu\n", bsr_dev->bsr_len); 106 return sprintf(buf, "%llu\n", bsr_dev->bsr_len);
107} 107}
108 108
109static struct device_attribute bsr_dev_attrs[] = { 109static struct device_attribute bsr_dev_attrs[] = {
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 5a8a4c28c867..94e7e3c8c05a 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -318,7 +318,6 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
318 } /* else count == 0 */ 318 } /* else count == 0 */
319 319
320 tty->driver_data = hp; 320 tty->driver_data = hp;
321 tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */
322 321
323 hp->tty = tty; 322 hp->tty = tty;
324 323
@@ -764,13 +763,11 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data,
764 return ERR_PTR(err); 763 return ERR_PTR(err);
765 } 764 }
766 765
767 hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, 766 hp = kzalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
768 GFP_KERNEL); 767 GFP_KERNEL);
769 if (!hp) 768 if (!hp)
770 return ERR_PTR(-ENOMEM); 769 return ERR_PTR(-ENOMEM);
771 770
772 memset(hp, 0x00, sizeof(*hp));
773
774 hp->vtermno = vtermno; 771 hp->vtermno = vtermno;
775 hp->data = data; 772 hp->data = data;
776 hp->ops = ops; 773 hp->ops = ops;
@@ -876,8 +873,11 @@ static int hvc_init(void)
876 goto stop_thread; 873 goto stop_thread;
877 } 874 }
878 875
879 /* FIXME: This mb() seems completely random. Remove it. */ 876 /*
880 mb(); 877 * Make sure tty is fully registered before allowing it to be
878 * found by hvc_console_device.
879 */
880 smp_mb();
881 hvc_driver = drv; 881 hvc_driver = drv;
882 return 0; 882 return 0;
883 883
diff --git a/drivers/char/hvc_irq.c b/drivers/char/hvc_irq.c
index d09e5688d449..2623e177e8d6 100644
--- a/drivers/char/hvc_irq.c
+++ b/drivers/char/hvc_irq.c
@@ -37,7 +37,7 @@ int notifier_add_irq(struct hvc_struct *hp, int irq)
37 37
38void notifier_del_irq(struct hvc_struct *hp, int irq) 38void notifier_del_irq(struct hvc_struct *hp, int irq)
39{ 39{
40 if (!irq) 40 if (!hp->irq_requested)
41 return; 41 return;
42 free_irq(irq, hp); 42 free_irq(irq, hp);
43 hp->irq_requested = 0; 43 hp->irq_requested = 0;
diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c
index 79b6f461be75..afbe45676d71 100644
--- a/drivers/char/ps3flash.c
+++ b/drivers/char/ps3flash.c
@@ -44,7 +44,7 @@ static ssize_t ps3flash_read_write_sectors(struct ps3_storage_device *dev,
44 u64 res = ps3stor_read_write_sectors(dev, lpar, start_sector, sectors, 44 u64 res = ps3stor_read_write_sectors(dev, lpar, start_sector, sectors,
45 write); 45 write);
46 if (res) { 46 if (res) {
47 dev_err(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 47 dev_err(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
48 __LINE__, write ? "write" : "read", res); 48 __LINE__, write ? "write" : "read", res);
49 return -EIO; 49 return -EIO;
50 } 50 }
@@ -59,7 +59,7 @@ static ssize_t ps3flash_read_sectors(struct ps3_storage_device *dev,
59 59
60 max_sectors = dev->bounce_size / dev->blk_size; 60 max_sectors = dev->bounce_size / dev->blk_size;
61 if (sectors > max_sectors) { 61 if (sectors > max_sectors) {
62 dev_dbg(&dev->sbd.core, "%s:%u Limiting sectors to %lu\n", 62 dev_dbg(&dev->sbd.core, "%s:%u Limiting sectors to %llu\n",
63 __func__, __LINE__, max_sectors); 63 __func__, __LINE__, max_sectors);
64 sectors = max_sectors; 64 sectors = max_sectors;
65 } 65 }
@@ -144,7 +144,7 @@ static ssize_t ps3flash_read(struct file *file, char __user *buf, size_t count,
144 goto fail; 144 goto fail;
145 } 145 }
146 146
147 n = min(remaining, sectors_read*dev->blk_size-offset); 147 n = min_t(u64, remaining, sectors_read*dev->blk_size-offset);
148 dev_dbg(&dev->sbd.core, 148 dev_dbg(&dev->sbd.core,
149 "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n", 149 "%s:%u: copy %lu bytes from 0x%p to user 0x%p\n",
150 __func__, __LINE__, n, dev->bounce_buf+offset, buf); 150 __func__, __LINE__, n, dev->bounce_buf+offset, buf);
@@ -225,7 +225,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
225 if (end_read_sector >= start_read_sector) { 225 if (end_read_sector >= start_read_sector) {
226 /* Merge head and tail */ 226 /* Merge head and tail */
227 dev_dbg(&dev->sbd.core, 227 dev_dbg(&dev->sbd.core,
228 "Merged head and tail: %lu sectors at %lu\n", 228 "Merged head and tail: %llu sectors at %llu\n",
229 chunk_sectors, start_write_sector); 229 chunk_sectors, start_write_sector);
230 res = ps3flash_read_sectors(dev, start_write_sector, 230 res = ps3flash_read_sectors(dev, start_write_sector,
231 chunk_sectors, 0); 231 chunk_sectors, 0);
@@ -235,7 +235,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
235 if (head) { 235 if (head) {
236 /* Read head */ 236 /* Read head */
237 dev_dbg(&dev->sbd.core, 237 dev_dbg(&dev->sbd.core,
238 "head: %lu sectors at %lu\n", head, 238 "head: %llu sectors at %llu\n", head,
239 start_write_sector); 239 start_write_sector);
240 res = ps3flash_read_sectors(dev, 240 res = ps3flash_read_sectors(dev,
241 start_write_sector, 241 start_write_sector,
@@ -247,7 +247,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
247 start_write_sector+chunk_sectors) { 247 start_write_sector+chunk_sectors) {
248 /* Read tail */ 248 /* Read tail */
249 dev_dbg(&dev->sbd.core, 249 dev_dbg(&dev->sbd.core,
250 "tail: %lu sectors at %lu\n", tail, 250 "tail: %llu sectors at %llu\n", tail,
251 start_read_sector); 251 start_read_sector);
252 sec_off = start_read_sector-start_write_sector; 252 sec_off = start_read_sector-start_write_sector;
253 res = ps3flash_read_sectors(dev, 253 res = ps3flash_read_sectors(dev,
@@ -258,7 +258,7 @@ static ssize_t ps3flash_write(struct file *file, const char __user *buf,
258 } 258 }
259 } 259 }
260 260
261 n = min(remaining, dev->bounce_size-offset); 261 n = min_t(u64, remaining, dev->bounce_size-offset);
262 dev_dbg(&dev->sbd.core, 262 dev_dbg(&dev->sbd.core,
263 "%s:%u: copy %lu bytes from user 0x%p to 0x%p\n", 263 "%s:%u: copy %lu bytes from user 0x%p to 0x%p\n",
264 __func__, __LINE__, n, buf, dev->bounce_buf+offset); 264 __func__, __LINE__, n, buf, dev->bounce_buf+offset);
@@ -299,11 +299,11 @@ static irqreturn_t ps3flash_interrupt(int irq, void *data)
299 299
300 if (tag != dev->tag) 300 if (tag != dev->tag)
301 dev_err(&dev->sbd.core, 301 dev_err(&dev->sbd.core,
302 "%s:%u: tag mismatch, got %lx, expected %lx\n", 302 "%s:%u: tag mismatch, got %llx, expected %llx\n",
303 __func__, __LINE__, tag, dev->tag); 303 __func__, __LINE__, tag, dev->tag);
304 304
305 if (res) { 305 if (res) {
306 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", 306 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
307 __func__, __LINE__, res, status); 307 __func__, __LINE__, res, status);
308 } else { 308 } else {
309 dev->lv1_status = status; 309 dev->lv1_status = status;
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 53544e21f191..f329f459817c 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: synclink_gt.c,v 4.50 2007/07/25 19:29:25 paulkf Exp $
3 *
4 * Device driver for Microgate SyncLink GT serial adapters. 2 * Device driver for Microgate SyncLink GT serial adapters.
5 * 3 *
6 * written by Paul Fulghum for Microgate Corporation 4 * written by Paul Fulghum for Microgate Corporation
@@ -91,7 +89,6 @@
91 * module identification 89 * module identification
92 */ 90 */
93static char *driver_name = "SyncLink GT"; 91static char *driver_name = "SyncLink GT";
94static char *driver_version = "$Revision: 4.50 $";
95static char *tty_driver_name = "synclink_gt"; 92static char *tty_driver_name = "synclink_gt";
96static char *tty_dev_prefix = "ttySLG"; 93static char *tty_dev_prefix = "ttySLG";
97MODULE_LICENSE("GPL"); 94MODULE_LICENSE("GPL");
@@ -1309,7 +1306,7 @@ static int read_proc(char *page, char **start, off_t off, int count,
1309 off_t begin = 0; 1306 off_t begin = 0;
1310 struct slgt_info *info; 1307 struct slgt_info *info;
1311 1308
1312 len += sprintf(page, "synclink_gt driver:%s\n", driver_version); 1309 len += sprintf(page, "synclink_gt driver\n");
1313 1310
1314 info = slgt_device_list; 1311 info = slgt_device_list;
1315 while( info ) { 1312 while( info ) {
@@ -2441,7 +2438,7 @@ static void program_hw(struct slgt_info *info)
2441 info->ri_chkcount = 0; 2438 info->ri_chkcount = 0;
2442 info->dsr_chkcount = 0; 2439 info->dsr_chkcount = 0;
2443 2440
2444 slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR); 2441 slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI);
2445 get_signals(info); 2442 get_signals(info);
2446 2443
2447 if (info->netcount || 2444 if (info->netcount ||
@@ -3576,7 +3573,7 @@ static void slgt_cleanup(void)
3576 struct slgt_info *info; 3573 struct slgt_info *info;
3577 struct slgt_info *tmp; 3574 struct slgt_info *tmp;
3578 3575
3579 printk("unload %s %s\n", driver_name, driver_version); 3576 printk(KERN_INFO "unload %s\n", driver_name);
3580 3577
3581 if (serial_driver) { 3578 if (serial_driver) {
3582 for (info=slgt_device_list ; info != NULL ; info=info->next_device) 3579 for (info=slgt_device_list ; info != NULL ; info=info->next_device)
@@ -3619,7 +3616,7 @@ static int __init slgt_init(void)
3619{ 3616{
3620 int rc; 3617 int rc;
3621 3618
3622 printk("%s %s\n", driver_name, driver_version); 3619 printk(KERN_INFO "%s\n", driver_name);
3623 3620
3624 serial_driver = alloc_tty_driver(MAX_DEVICES); 3621 serial_driver = alloc_tty_driver(MAX_DEVICES);
3625 if (!serial_driver) { 3622 if (!serial_driver) {
@@ -3650,9 +3647,8 @@ static int __init slgt_init(void)
3650 goto error; 3647 goto error;
3651 } 3648 }
3652 3649
3653 printk("%s %s, tty major#%d\n", 3650 printk(KERN_INFO "%s, tty major#%d\n",
3654 driver_name, driver_version, 3651 driver_name, serial_driver->major);
3655 serial_driver->major);
3656 3652
3657 slgt_device_count = 0; 3653 slgt_device_count = 0;
3658 if ((rc = pci_register_driver(&pci_driver)) < 0) { 3654 if ((rc = pci_register_driver(&pci_driver)) < 0) {
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index d41b9f6f7903..33a9351c896d 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -473,6 +473,12 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
473 unsigned long flags; 473 unsigned long flags;
474 474
475 spin_lock_irqsave(&sysrq_key_table_lock, flags); 475 spin_lock_irqsave(&sysrq_key_table_lock, flags);
476 /*
477 * Raise the apparent loglevel to maximum so that the sysrq header
478 * is shown to provide the user with positive feedback. We do not
479 * simply emit this at KERN_EMERG as that would change message
480 * routing in the consumers of /proc/kmsg.
481 */
476 orig_log_level = console_loglevel; 482 orig_log_level = console_loglevel;
477 console_loglevel = 7; 483 console_loglevel = 7;
478 printk(KERN_INFO "SysRq : "); 484 printk(KERN_INFO "SysRq : ");
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index a408c8e487ec..6f4c7d0a53bf 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -1057,7 +1057,7 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg)
1057 if (retval) 1057 if (retval)
1058 return retval; 1058 return retval;
1059 1059
1060 ld = tty_ldisc_ref(tty); 1060 ld = tty_ldisc_ref_wait(tty);
1061 switch (arg) { 1061 switch (arg) {
1062 case TCIFLUSH: 1062 case TCIFLUSH:
1063 if (ld && ld->ops->flush_buffer) 1063 if (ld && ld->ops->flush_buffer)
diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 8b24d784db93..3e7f4e06386e 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -217,8 +217,10 @@ static int __devinit max7301_probe(struct spi_device *spi)
217 int i, ret; 217 int i, ret;
218 218
219 pdata = spi->dev.platform_data; 219 pdata = spi->dev.platform_data;
220 if (!pdata || !pdata->base) 220 if (!pdata || !pdata->base) {
221 return -ENODEV; 221 dev_dbg(&spi->dev, "incorrect or missing platform data\n");
222 return -EINVAL;
223 }
222 224
223 /* 225 /*
224 * bits_per_word cannot be configured in platform data 226 * bits_per_word cannot be configured in platform data
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c
index 55ae9a41897a..f7868243af89 100644
--- a/drivers/gpio/max732x.c
+++ b/drivers/gpio/max732x.c
@@ -267,8 +267,10 @@ static int __devinit max732x_probe(struct i2c_client *client,
267 int ret, nr_port; 267 int ret, nr_port;
268 268
269 pdata = client->dev.platform_data; 269 pdata = client->dev.platform_data;
270 if (pdata == NULL) 270 if (pdata == NULL) {
271 return -ENODEV; 271 dev_dbg(&client->dev, "no platform data\n");
272 return -EINVAL;
273 }
272 274
273 chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL); 275 chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL);
274 if (chip == NULL) 276 if (chip == NULL)
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index 89c1d222e9d1..f6fae0e50e65 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -310,8 +310,10 @@ static int mcp23s08_probe(struct spi_device *spi)
310 unsigned base; 310 unsigned base;
311 311
312 pdata = spi->dev.platform_data; 312 pdata = spi->dev.platform_data;
313 if (!pdata || !gpio_is_valid(pdata->base)) 313 if (!pdata || !gpio_is_valid(pdata->base)) {
314 return -ENODEV; 314 dev_dbg(&spi->dev, "invalid or missing platform data\n");
315 return -EINVAL;
316 }
315 317
316 for (addr = 0; addr < 4; addr++) { 318 for (addr = 0; addr < 4; addr++) {
317 if (!pdata->chip[addr].is_present) 319 if (!pdata->chip[addr].is_present)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 37f35388a2ae..8dc0164bd51e 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -202,8 +202,10 @@ static int __devinit pca953x_probe(struct i2c_client *client,
202 int ret; 202 int ret;
203 203
204 pdata = client->dev.platform_data; 204 pdata = client->dev.platform_data;
205 if (pdata == NULL) 205 if (pdata == NULL) {
206 return -ENODEV; 206 dev_dbg(&client->dev, "no platform data\n");
207 return -EINVAL;
208 }
207 209
208 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); 210 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
209 if (chip == NULL) 211 if (chip == NULL)
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c
index 4bc2070dd4a1..9525724be731 100644
--- a/drivers/gpio/pcf857x.c
+++ b/drivers/gpio/pcf857x.c
@@ -188,8 +188,10 @@ static int pcf857x_probe(struct i2c_client *client,
188 int status; 188 int status;
189 189
190 pdata = client->dev.platform_data; 190 pdata = client->dev.platform_data;
191 if (!pdata) 191 if (!pdata) {
192 return -ENODEV; 192 dev_dbg(&client->dev, "no platform data\n");
193 return -EINVAL;
194 }
193 195
194 /* Allocate, initialize, and register this gpio_chip. */ 196 /* Allocate, initialize, and register this gpio_chip. */
195 gpio = kzalloc(sizeof *gpio, GFP_KERNEL); 197 gpio = kzalloc(sizeof *gpio, GFP_KERNEL);
@@ -248,8 +250,10 @@ static int pcf857x_probe(struct i2c_client *client,
248 else 250 else
249 status = i2c_read_le16(client); 251 status = i2c_read_le16(client);
250 252
251 } else 253 } else {
252 status = -ENODEV; 254 dev_dbg(&client->dev, "unsupported number of gpios\n");
255 status = -EINVAL;
256 }
253 257
254 if (status < 0) 258 if (status < 0)
255 goto fail; 259 goto fail;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index d8a982b71296..964c5eb1fada 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -36,7 +36,7 @@
36/* 36/*
37 * Detailed mode info for 800x600@60Hz 37 * Detailed mode info for 800x600@60Hz
38 */ 38 */
39static struct drm_display_mode std_mode[] = { 39static struct drm_display_mode std_modes[] = {
40 { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840, 40 { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840,
41 968, 1056, 0, 600, 601, 605, 628, 0, 41 968, 1056, 0, 600, 601, 605, 628, 0,
42 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 42 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
@@ -60,15 +60,18 @@ static struct drm_display_mode std_mode[] = {
60 * changes have occurred. 60 * changes have occurred.
61 * 61 *
62 * FIXME: take into account monitor limits 62 * FIXME: take into account monitor limits
63 *
64 * RETURNS:
65 * Number of modes found on @connector.
63 */ 66 */
64void drm_helper_probe_single_connector_modes(struct drm_connector *connector, 67int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
65 uint32_t maxX, uint32_t maxY) 68 uint32_t maxX, uint32_t maxY)
66{ 69{
67 struct drm_device *dev = connector->dev; 70 struct drm_device *dev = connector->dev;
68 struct drm_display_mode *mode, *t; 71 struct drm_display_mode *mode, *t;
69 struct drm_connector_helper_funcs *connector_funcs = 72 struct drm_connector_helper_funcs *connector_funcs =
70 connector->helper_private; 73 connector->helper_private;
71 int ret; 74 int count = 0;
72 75
73 DRM_DEBUG("%s\n", drm_get_connector_name(connector)); 76 DRM_DEBUG("%s\n", drm_get_connector_name(connector));
74 /* set all modes to the unverified state */ 77 /* set all modes to the unverified state */
@@ -81,14 +84,14 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
81 DRM_DEBUG("%s is disconnected\n", 84 DRM_DEBUG("%s is disconnected\n",
82 drm_get_connector_name(connector)); 85 drm_get_connector_name(connector));
83 /* TODO set EDID to NULL */ 86 /* TODO set EDID to NULL */
84 return; 87 return 0;
85 } 88 }
86 89
87 ret = (*connector_funcs->get_modes)(connector); 90 count = (*connector_funcs->get_modes)(connector);
91 if (!count)
92 return 0;
88 93
89 if (ret) { 94 drm_mode_connector_list_update(connector);
90 drm_mode_connector_list_update(connector);
91 }
92 95
93 if (maxX && maxY) 96 if (maxX && maxY)
94 drm_mode_validate_size(dev, &connector->modes, maxX, 97 drm_mode_validate_size(dev, &connector->modes, maxX,
@@ -102,25 +105,8 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
102 105
103 drm_mode_prune_invalid(dev, &connector->modes, true); 106 drm_mode_prune_invalid(dev, &connector->modes, true);
104 107
105 if (list_empty(&connector->modes)) { 108 if (list_empty(&connector->modes))
106 struct drm_display_mode *stdmode; 109 return 0;
107
108 DRM_DEBUG("No valid modes on %s\n",
109 drm_get_connector_name(connector));
110
111 /* Should we do this here ???
112 * When no valid EDID modes are available we end up
113 * here and bailed in the past, now we add a standard
114 * 640x480@60Hz mode and carry on.
115 */
116 stdmode = drm_mode_duplicate(dev, &std_mode[0]);
117 drm_mode_probed_add(connector, stdmode);
118 drm_mode_list_concat(&connector->probed_modes,
119 &connector->modes);
120
121 DRM_DEBUG("Adding standard 640x480 @ 60Hz to %s\n",
122 drm_get_connector_name(connector));
123 }
124 110
125 drm_mode_sort(&connector->modes); 111 drm_mode_sort(&connector->modes);
126 112
@@ -131,20 +117,58 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
131 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 117 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
132 drm_mode_debug_printmodeline(mode); 118 drm_mode_debug_printmodeline(mode);
133 } 119 }
120
121 return count;
134} 122}
135EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); 123EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
136 124
137void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX, 125int drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,
138 uint32_t maxY) 126 uint32_t maxY)
139{ 127{
140 struct drm_connector *connector; 128 struct drm_connector *connector;
129 int count = 0;
141 130
142 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 131 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
143 drm_helper_probe_single_connector_modes(connector, maxX, maxY); 132 count += drm_helper_probe_single_connector_modes(connector,
133 maxX, maxY);
144 } 134 }
135
136 return count;
145} 137}
146EXPORT_SYMBOL(drm_helper_probe_connector_modes); 138EXPORT_SYMBOL(drm_helper_probe_connector_modes);
147 139
140static void drm_helper_add_std_modes(struct drm_device *dev,
141 struct drm_connector *connector)
142{
143 struct drm_display_mode *mode, *t;
144 int i;
145
146 for (i = 0; i < ARRAY_SIZE(std_modes); i++) {
147 struct drm_display_mode *stdmode;
148
149 /*
150 * When no valid EDID modes are available we end up
151 * here and bailed in the past, now we add some standard
152 * modes and move on.
153 */
154 stdmode = drm_mode_duplicate(dev, &std_modes[i]);
155 drm_mode_probed_add(connector, stdmode);
156 drm_mode_list_concat(&connector->probed_modes,
157 &connector->modes);
158
159 DRM_DEBUG("Adding mode %s to %s\n", stdmode->name,
160 drm_get_connector_name(connector));
161 }
162 drm_mode_sort(&connector->modes);
163
164 DRM_DEBUG("Added std modes on %s\n", drm_get_connector_name(connector));
165 list_for_each_entry_safe(mode, t, &connector->modes, head) {
166 mode->vrefresh = drm_mode_vrefresh(mode);
167
168 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
169 drm_mode_debug_printmodeline(mode);
170 }
171}
148 172
149/** 173/**
150 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config 174 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
@@ -237,6 +261,8 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled)
237 261
238 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 262 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
239 enabled[i] = drm_connector_enabled(connector, true); 263 enabled[i] = drm_connector_enabled(connector, true);
264 DRM_DEBUG("connector %d enabled? %s\n", connector->base.id,
265 enabled[i] ? "yes" : "no");
240 any_enabled |= enabled[i]; 266 any_enabled |= enabled[i];
241 i++; 267 i++;
242 } 268 }
@@ -265,11 +291,17 @@ static bool drm_target_preferred(struct drm_device *dev,
265 continue; 291 continue;
266 } 292 }
267 293
294 DRM_DEBUG("looking for preferred mode on connector %d\n",
295 connector->base.id);
296
268 modes[i] = drm_has_preferred_mode(connector, width, height); 297 modes[i] = drm_has_preferred_mode(connector, width, height);
269 if (!modes[i]) { 298 /* No preferred modes, pick one off the list */
299 if (!modes[i] && !list_empty(&connector->modes)) {
270 list_for_each_entry(modes[i], &connector->modes, head) 300 list_for_each_entry(modes[i], &connector->modes, head)
271 break; 301 break;
272 } 302 }
303 DRM_DEBUG("found mode %s\n", modes[i] ? modes[i]->name :
304 "none");
273 i++; 305 i++;
274 } 306 }
275 return true; 307 return true;
@@ -369,6 +401,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
369 int width, height; 401 int width, height;
370 int i, ret; 402 int i, ret;
371 403
404 DRM_DEBUG("\n");
405
372 width = dev->mode_config.max_width; 406 width = dev->mode_config.max_width;
373 height = dev->mode_config.max_height; 407 height = dev->mode_config.max_height;
374 408
@@ -390,6 +424,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
390 if (!ret) 424 if (!ret)
391 DRM_ERROR("Unable to find initial modes\n"); 425 DRM_ERROR("Unable to find initial modes\n");
392 426
427 DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height);
428
393 drm_pick_crtcs(dev, crtcs, modes, 0, width, height); 429 drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
394 430
395 i = 0; 431 i = 0;
@@ -403,6 +439,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
403 } 439 }
404 440
405 if (mode && crtc) { 441 if (mode && crtc) {
442 DRM_DEBUG("desired mode %s set on crtc %d\n",
443 mode->name, crtc->base.id);
406 crtc->desired_mode = mode; 444 crtc->desired_mode = mode;
407 connector->encoder->crtc = crtc; 445 connector->encoder->crtc = crtc;
408 } else 446 } else
@@ -442,6 +480,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
442 int saved_x, saved_y; 480 int saved_x, saved_y;
443 struct drm_encoder *encoder; 481 struct drm_encoder *encoder;
444 bool ret = true; 482 bool ret = true;
483 bool depth_changed, bpp_changed;
445 484
446 adjusted_mode = drm_mode_duplicate(dev, mode); 485 adjusted_mode = drm_mode_duplicate(dev, mode);
447 486
@@ -450,6 +489,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
450 if (!crtc->enabled) 489 if (!crtc->enabled)
451 return true; 490 return true;
452 491
492 if (old_fb && crtc->fb) {
493 depth_changed = (old_fb->depth != crtc->fb->depth);
494 bpp_changed = (old_fb->bits_per_pixel !=
495 crtc->fb->bits_per_pixel);
496 } else {
497 depth_changed = true;
498 bpp_changed = true;
499 }
500
453 saved_mode = crtc->mode; 501 saved_mode = crtc->mode;
454 saved_x = crtc->x; 502 saved_x = crtc->x;
455 saved_y = crtc->y; 503 saved_y = crtc->y;
@@ -462,7 +510,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
462 crtc->y = y; 510 crtc->y = y;
463 511
464 if (drm_mode_equal(&saved_mode, &crtc->mode)) { 512 if (drm_mode_equal(&saved_mode, &crtc->mode)) {
465 if (saved_x != crtc->x || saved_y != crtc->y) { 513 if (saved_x != crtc->x || saved_y != crtc->y ||
514 depth_changed || bpp_changed) {
466 crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, 515 crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y,
467 old_fb); 516 old_fb);
468 goto done; 517 goto done;
@@ -568,8 +617,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
568 struct drm_encoder **save_encoders, *new_encoder; 617 struct drm_encoder **save_encoders, *new_encoder;
569 struct drm_framebuffer *old_fb; 618 struct drm_framebuffer *old_fb;
570 bool save_enabled; 619 bool save_enabled;
571 bool changed = false; 620 bool mode_changed = false;
572 bool flip_or_move = false; 621 bool fb_changed = false;
573 struct drm_connector *connector; 622 struct drm_connector *connector;
574 int count = 0, ro, fail = 0; 623 int count = 0, ro, fail = 0;
575 struct drm_crtc_helper_funcs *crtc_funcs; 624 struct drm_crtc_helper_funcs *crtc_funcs;
@@ -597,7 +646,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
597 /* save previous config */ 646 /* save previous config */
598 save_enabled = set->crtc->enabled; 647 save_enabled = set->crtc->enabled;
599 648
600 /* this is meant to be num_connector not num_crtc */ 649 /*
650 * We do mode_config.num_connectors here since we'll look at the
651 * CRTC and encoder associated with each connector later.
652 */
601 save_crtcs = kzalloc(dev->mode_config.num_connector * 653 save_crtcs = kzalloc(dev->mode_config.num_connector *
602 sizeof(struct drm_crtc *), GFP_KERNEL); 654 sizeof(struct drm_crtc *), GFP_KERNEL);
603 if (!save_crtcs) 655 if (!save_crtcs)
@@ -613,21 +665,25 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
613 /* We should be able to check here if the fb has the same properties 665 /* We should be able to check here if the fb has the same properties
614 * and then just flip_or_move it */ 666 * and then just flip_or_move it */
615 if (set->crtc->fb != set->fb) { 667 if (set->crtc->fb != set->fb) {
616 /* if we have no fb then its a change not a flip */ 668 /* If we have no fb then treat it as a full mode set */
617 if (set->crtc->fb == NULL) 669 if (set->crtc->fb == NULL)
618 changed = true; 670 mode_changed = true;
671 else if ((set->fb->bits_per_pixel !=
672 set->crtc->fb->bits_per_pixel) ||
673 set->fb->depth != set->crtc->fb->depth)
674 fb_changed = true;
619 else 675 else
620 flip_or_move = true; 676 fb_changed = true;
621 } 677 }
622 678
623 if (set->x != set->crtc->x || set->y != set->crtc->y) 679 if (set->x != set->crtc->x || set->y != set->crtc->y)
624 flip_or_move = true; 680 fb_changed = true;
625 681
626 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { 682 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
627 DRM_DEBUG("modes are different\n"); 683 DRM_DEBUG("modes are different\n");
628 drm_mode_debug_printmodeline(&set->crtc->mode); 684 drm_mode_debug_printmodeline(&set->crtc->mode);
629 drm_mode_debug_printmodeline(set->mode); 685 drm_mode_debug_printmodeline(set->mode);
630 changed = true; 686 mode_changed = true;
631 } 687 }
632 688
633 /* a) traverse passed in connector list and get encoders for them */ 689 /* a) traverse passed in connector list and get encoders for them */
@@ -650,7 +706,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
650 } 706 }
651 707
652 if (new_encoder != connector->encoder) { 708 if (new_encoder != connector->encoder) {
653 changed = true; 709 mode_changed = true;
654 connector->encoder = new_encoder; 710 connector->encoder = new_encoder;
655 } 711 }
656 } 712 }
@@ -677,16 +733,16 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
677 new_crtc = set->crtc; 733 new_crtc = set->crtc;
678 } 734 }
679 if (new_crtc != connector->encoder->crtc) { 735 if (new_crtc != connector->encoder->crtc) {
680 changed = true; 736 mode_changed = true;
681 connector->encoder->crtc = new_crtc; 737 connector->encoder->crtc = new_crtc;
682 } 738 }
683 } 739 }
684 740
685 /* mode_set_base is not a required function */ 741 /* mode_set_base is not a required function */
686 if (flip_or_move && !crtc_funcs->mode_set_base) 742 if (fb_changed && !crtc_funcs->mode_set_base)
687 changed = true; 743 mode_changed = true;
688 744
689 if (changed) { 745 if (mode_changed) {
690 old_fb = set->crtc->fb; 746 old_fb = set->crtc->fb;
691 set->crtc->fb = set->fb; 747 set->crtc->fb = set->fb;
692 set->crtc->enabled = (set->mode != NULL); 748 set->crtc->enabled = (set->mode != NULL);
@@ -705,7 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
705 set->crtc->desired_mode = set->mode; 761 set->crtc->desired_mode = set->mode;
706 } 762 }
707 drm_helper_disable_unused_functions(dev); 763 drm_helper_disable_unused_functions(dev);
708 } else if (flip_or_move) { 764 } else if (fb_changed) {
709 old_fb = set->crtc->fb; 765 old_fb = set->crtc->fb;
710 if (set->crtc->fb != set->fb) 766 if (set->crtc->fb != set->fb)
711 set->crtc->fb = set->fb; 767 set->crtc->fb = set->fb;
@@ -764,10 +820,31 @@ bool drm_helper_plugged_event(struct drm_device *dev)
764 */ 820 */
765bool drm_helper_initial_config(struct drm_device *dev, bool can_grow) 821bool drm_helper_initial_config(struct drm_device *dev, bool can_grow)
766{ 822{
767 int ret = false; 823 struct drm_connector *connector;
824 int count = 0;
768 825
769 drm_helper_plugged_event(dev); 826 count = drm_helper_probe_connector_modes(dev,
770 return ret; 827 dev->mode_config.max_width,
828 dev->mode_config.max_height);
829
830 /*
831 * None of the available connectors had any modes, so add some
832 * and try to light them up anyway
833 */
834 if (!count) {
835 DRM_ERROR("connectors have no modes, using standard modes\n");
836 list_for_each_entry(connector,
837 &dev->mode_config.connector_list,
838 head)
839 drm_helper_add_std_modes(dev, connector);
840 }
841
842 drm_setup_crtcs(dev);
843
844 /* alert the driver fb layer */
845 dev->mode_config.funcs->fb_changed(dev);
846
847 return 0;
771} 848}
772EXPORT_SYMBOL(drm_helper_initial_config); 849EXPORT_SYMBOL(drm_helper_initial_config);
773 850
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 724e505873cf..477caa1b1e4b 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -267,7 +267,8 @@ EXPORT_SYMBOL(drm_irq_install);
267 */ 267 */
268int drm_irq_uninstall(struct drm_device * dev) 268int drm_irq_uninstall(struct drm_device * dev)
269{ 269{
270 int irq_enabled; 270 unsigned long irqflags;
271 int irq_enabled, i;
271 272
272 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 273 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
273 return -EINVAL; 274 return -EINVAL;
@@ -277,6 +278,16 @@ int drm_irq_uninstall(struct drm_device * dev)
277 dev->irq_enabled = 0; 278 dev->irq_enabled = 0;
278 mutex_unlock(&dev->struct_mutex); 279 mutex_unlock(&dev->struct_mutex);
279 280
281 /*
282 * Wake up any waiters so they don't hang.
283 */
284 spin_lock_irqsave(&dev->vbl_lock, irqflags);
285 for (i = 0; i < dev->num_crtcs; i++) {
286 DRM_WAKEUP(&dev->vbl_queue[i]);
287 dev->vblank_enabled[i] = 0;
288 }
289 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
290
280 if (!irq_enabled) 291 if (!irq_enabled)
281 return -EINVAL; 292 return -EINVAL;
282 293
@@ -652,8 +663,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
652 vblwait->request.sequence, crtc); 663 vblwait->request.sequence, crtc);
653 dev->last_vblank_wait[crtc] = vblwait->request.sequence; 664 dev->last_vblank_wait[crtc] = vblwait->request.sequence;
654 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, 665 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
655 ((drm_vblank_count(dev, crtc) 666 (((drm_vblank_count(dev, crtc) -
656 - vblwait->request.sequence) <= (1 << 23))); 667 vblwait->request.sequence) <= (1 << 23)) ||
668 !dev->irq_enabled));
657 669
658 if (ret != -EINTR) { 670 if (ret != -EINTR) {
659 struct timeval now; 671 struct timeval now;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 62a4bf7b49df..bbadf1c04142 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -177,6 +177,14 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
177 drm_i915_private_t *dev_priv = dev->dev_private; 177 drm_i915_private_t *dev_priv = dev->dev_private;
178 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; 178 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
179 179
180 master_priv->sarea = drm_getsarea(dev);
181 if (master_priv->sarea) {
182 master_priv->sarea_priv = (drm_i915_sarea_t *)
183 ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset);
184 } else {
185 DRM_DEBUG("sarea not found assuming DRI2 userspace\n");
186 }
187
180 if (init->ring_size != 0) { 188 if (init->ring_size != 0) {
181 if (dev_priv->ring.ring_obj != NULL) { 189 if (dev_priv->ring.ring_obj != NULL) {
182 i915_dma_cleanup(dev); 190 i915_dma_cleanup(dev);
@@ -1152,6 +1160,8 @@ int i915_driver_unload(struct drm_device *dev)
1152 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 1160 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1153 intel_modeset_cleanup(dev); 1161 intel_modeset_cleanup(dev);
1154 1162
1163 i915_gem_free_all_phys_object(dev);
1164
1155 mutex_lock(&dev->struct_mutex); 1165 mutex_lock(&dev->struct_mutex);
1156 i915_gem_cleanup_ringbuffer(dev); 1166 i915_gem_cleanup_ringbuffer(dev);
1157 mutex_unlock(&dev->struct_mutex); 1167 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 563de18063fd..e13518252007 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -72,6 +72,18 @@ enum pipe {
72#define WATCH_INACTIVE 0 72#define WATCH_INACTIVE 0
73#define WATCH_PWRITE 0 73#define WATCH_PWRITE 0
74 74
75#define I915_GEM_PHYS_CURSOR_0 1
76#define I915_GEM_PHYS_CURSOR_1 2
77#define I915_GEM_PHYS_OVERLAY_REGS 3
78#define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
79
80struct drm_i915_gem_phys_object {
81 int id;
82 struct page **page_list;
83 drm_dma_handle_t *handle;
84 struct drm_gem_object *cur_obj;
85};
86
75typedef struct _drm_i915_ring_buffer { 87typedef struct _drm_i915_ring_buffer {
76 int tail_mask; 88 int tail_mask;
77 unsigned long Size; 89 unsigned long Size;
@@ -358,6 +370,9 @@ typedef struct drm_i915_private {
358 uint32_t bit_6_swizzle_x; 370 uint32_t bit_6_swizzle_x;
359 /** Bit 6 swizzling required for Y tiling */ 371 /** Bit 6 swizzling required for Y tiling */
360 uint32_t bit_6_swizzle_y; 372 uint32_t bit_6_swizzle_y;
373
374 /* storage for physical objects */
375 struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
361 } mm; 376 } mm;
362} drm_i915_private_t; 377} drm_i915_private_t;
363 378
@@ -436,6 +451,9 @@ struct drm_i915_gem_object {
436 /** User space pin count and filp owning the pin */ 451 /** User space pin count and filp owning the pin */
437 uint32_t user_pin_count; 452 uint32_t user_pin_count;
438 struct drm_file *pin_filp; 453 struct drm_file *pin_filp;
454
455 /** for phy allocated objects */
456 struct drm_i915_gem_phys_object *phys_obj;
439}; 457};
440 458
441/** 459/**
@@ -598,6 +616,11 @@ int i915_gem_do_init(struct drm_device *dev, unsigned long start,
598int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); 616int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
599int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, 617int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
600 int write); 618 int write);
619int i915_gem_attach_phys_object(struct drm_device *dev,
620 struct drm_gem_object *obj, int id);
621void i915_gem_detach_phys_object(struct drm_device *dev,
622 struct drm_gem_object *obj);
623void i915_gem_free_all_phys_object(struct drm_device *dev);
601 624
602/* i915_gem_tiling.c */ 625/* i915_gem_tiling.c */
603void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); 626void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1384d6686555..96316fd47233 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -55,6 +55,9 @@ static int i915_gem_object_bind_to_gtt(struct drm_gem_object *obj,
55static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj); 55static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj);
56static void i915_gem_clear_fence_reg(struct drm_gem_object *obj); 56static void i915_gem_clear_fence_reg(struct drm_gem_object *obj);
57static int i915_gem_evict_something(struct drm_device *dev); 57static int i915_gem_evict_something(struct drm_device *dev);
58static int i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
59 struct drm_i915_gem_pwrite *args,
60 struct drm_file *file_priv);
58 61
59int i915_gem_do_init(struct drm_device *dev, unsigned long start, 62int i915_gem_do_init(struct drm_device *dev, unsigned long start,
60 unsigned long end) 63 unsigned long end)
@@ -386,8 +389,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
386 * pread/pwrite currently are reading and writing from the CPU 389 * pread/pwrite currently are reading and writing from the CPU
387 * perspective, requiring manual detiling by the client. 390 * perspective, requiring manual detiling by the client.
388 */ 391 */
389 if (obj_priv->tiling_mode == I915_TILING_NONE && 392 if (obj_priv->phys_obj)
390 dev->gtt_total != 0) 393 ret = i915_gem_phys_pwrite(dev, obj, args, file_priv);
394 else if (obj_priv->tiling_mode == I915_TILING_NONE &&
395 dev->gtt_total != 0)
391 ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv); 396 ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv);
392 else 397 else
393 ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv); 398 ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv);
@@ -2858,6 +2863,9 @@ void i915_gem_free_object(struct drm_gem_object *obj)
2858 while (obj_priv->pin_count > 0) 2863 while (obj_priv->pin_count > 0)
2859 i915_gem_object_unpin(obj); 2864 i915_gem_object_unpin(obj);
2860 2865
2866 if (obj_priv->phys_obj)
2867 i915_gem_detach_phys_object(dev, obj);
2868
2861 i915_gem_object_unbind(obj); 2869 i915_gem_object_unbind(obj);
2862 2870
2863 list = &obj->map_list; 2871 list = &obj->map_list;
@@ -3293,3 +3301,180 @@ i915_gem_load(struct drm_device *dev)
3293 3301
3294 i915_gem_detect_bit_6_swizzle(dev); 3302 i915_gem_detect_bit_6_swizzle(dev);
3295} 3303}
3304
3305/*
3306 * Create a physically contiguous memory object for this object
3307 * e.g. for cursor + overlay regs
3308 */
3309int i915_gem_init_phys_object(struct drm_device *dev,
3310 int id, int size)
3311{
3312 drm_i915_private_t *dev_priv = dev->dev_private;
3313 struct drm_i915_gem_phys_object *phys_obj;
3314 int ret;
3315
3316 if (dev_priv->mm.phys_objs[id - 1] || !size)
3317 return 0;
3318
3319 phys_obj = drm_calloc(1, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER);
3320 if (!phys_obj)
3321 return -ENOMEM;
3322
3323 phys_obj->id = id;
3324
3325 phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
3326 if (!phys_obj->handle) {
3327 ret = -ENOMEM;
3328 goto kfree_obj;
3329 }
3330#ifdef CONFIG_X86
3331 set_memory_wc((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE);
3332#endif
3333
3334 dev_priv->mm.phys_objs[id - 1] = phys_obj;
3335
3336 return 0;
3337kfree_obj:
3338 drm_free(phys_obj, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER);
3339 return ret;
3340}
3341
3342void i915_gem_free_phys_object(struct drm_device *dev, int id)
3343{
3344 drm_i915_private_t *dev_priv = dev->dev_private;
3345 struct drm_i915_gem_phys_object *phys_obj;
3346
3347 if (!dev_priv->mm.phys_objs[id - 1])
3348 return;
3349
3350 phys_obj = dev_priv->mm.phys_objs[id - 1];
3351 if (phys_obj->cur_obj) {
3352 i915_gem_detach_phys_object(dev, phys_obj->cur_obj);
3353 }
3354
3355#ifdef CONFIG_X86
3356 set_memory_wb((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE);
3357#endif
3358 drm_pci_free(dev, phys_obj->handle);
3359 kfree(phys_obj);
3360 dev_priv->mm.phys_objs[id - 1] = NULL;
3361}
3362
3363void i915_gem_free_all_phys_object(struct drm_device *dev)
3364{
3365 int i;
3366
3367 for (i = 0; i < I915_MAX_PHYS_OBJECT; i++)
3368 i915_gem_free_phys_object(dev, i);
3369}
3370
3371void i915_gem_detach_phys_object(struct drm_device *dev,
3372 struct drm_gem_object *obj)
3373{
3374 struct drm_i915_gem_object *obj_priv;
3375 int i;
3376 int ret;
3377 int page_count;
3378
3379 obj_priv = obj->driver_private;
3380 if (!obj_priv->phys_obj)
3381 return;
3382
3383 ret = i915_gem_object_get_page_list(obj);
3384 if (ret)
3385 goto out;
3386
3387 page_count = obj->size / PAGE_SIZE;
3388
3389 for (i = 0; i < page_count; i++) {
3390 char *dst = kmap_atomic(obj_priv->page_list[i], KM_USER0);
3391 char *src = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
3392
3393 memcpy(dst, src, PAGE_SIZE);
3394 kunmap_atomic(dst, KM_USER0);
3395 }
3396 drm_clflush_pages(obj_priv->page_list, page_count);
3397 drm_agp_chipset_flush(dev);
3398out:
3399 obj_priv->phys_obj->cur_obj = NULL;
3400 obj_priv->phys_obj = NULL;
3401}
3402
3403int
3404i915_gem_attach_phys_object(struct drm_device *dev,
3405 struct drm_gem_object *obj, int id)
3406{
3407 drm_i915_private_t *dev_priv = dev->dev_private;
3408 struct drm_i915_gem_object *obj_priv;
3409 int ret = 0;
3410 int page_count;
3411 int i;
3412
3413 if (id > I915_MAX_PHYS_OBJECT)
3414 return -EINVAL;
3415
3416 obj_priv = obj->driver_private;
3417
3418 if (obj_priv->phys_obj) {
3419 if (obj_priv->phys_obj->id == id)
3420 return 0;
3421 i915_gem_detach_phys_object(dev, obj);
3422 }
3423
3424
3425 /* create a new object */
3426 if (!dev_priv->mm.phys_objs[id - 1]) {
3427 ret = i915_gem_init_phys_object(dev, id,
3428 obj->size);
3429 if (ret) {
3430 DRM_ERROR("failed to init phys object %d size: %d\n", id, obj->size);
3431 goto out;
3432 }
3433 }
3434
3435 /* bind to the object */
3436 obj_priv->phys_obj = dev_priv->mm.phys_objs[id - 1];
3437 obj_priv->phys_obj->cur_obj = obj;
3438
3439 ret = i915_gem_object_get_page_list(obj);
3440 if (ret) {
3441 DRM_ERROR("failed to get page list\n");
3442 goto out;
3443 }
3444
3445 page_count = obj->size / PAGE_SIZE;
3446
3447 for (i = 0; i < page_count; i++) {
3448 char *src = kmap_atomic(obj_priv->page_list[i], KM_USER0);
3449 char *dst = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
3450
3451 memcpy(dst, src, PAGE_SIZE);
3452 kunmap_atomic(src, KM_USER0);
3453 }
3454
3455 return 0;
3456out:
3457 return ret;
3458}
3459
3460static int
3461i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
3462 struct drm_i915_gem_pwrite *args,
3463 struct drm_file *file_priv)
3464{
3465 struct drm_i915_gem_object *obj_priv = obj->driver_private;
3466 void *obj_addr;
3467 int ret;
3468 char __user *user_data;
3469
3470 user_data = (char __user *) (uintptr_t) args->data_ptr;
3471 obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset;
3472
3473 DRM_ERROR("obj_addr %p, %lld\n", obj_addr, args->size);
3474 ret = copy_from_user(obj_addr, user_data, args->size);
3475 if (ret)
3476 return -EFAULT;
3477
3478 drm_agp_chipset_flush(dev);
3479 return 0;
3480}
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 0cadafbef411..6290219de6c8 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -411,6 +411,12 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
411{ 411{
412 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 412 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
413 unsigned long irqflags; 413 unsigned long irqflags;
414 int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
415 u32 pipeconf;
416
417 pipeconf = I915_READ(pipeconf_reg);
418 if (!(pipeconf & PIPEACONF_ENABLE))
419 return -EINVAL;
414 420
415 spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags); 421 spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
416 if (IS_I965G(dev)) 422 if (IS_I965G(dev))
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8ccb9c3ab868..31c3732b7a69 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -401,6 +401,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
401 I915_WRITE(dspstride, crtc->fb->pitch); 401 I915_WRITE(dspstride, crtc->fb->pitch);
402 402
403 dspcntr = I915_READ(dspcntr_reg); 403 dspcntr = I915_READ(dspcntr_reg);
404 /* Mask out pixel format bits in case we change it */
405 dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
404 switch (crtc->fb->bits_per_pixel) { 406 switch (crtc->fb->bits_per_pixel) {
405 case 8: 407 case 8:
406 dspcntr |= DISPPLANE_8BPP; 408 dspcntr |= DISPPLANE_8BPP;
@@ -1014,21 +1016,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1014 1016
1015 if (bo->size < width * height * 4) { 1017 if (bo->size < width * height * 4) {
1016 DRM_ERROR("buffer is to small\n"); 1018 DRM_ERROR("buffer is to small\n");
1017 drm_gem_object_unreference(bo); 1019 ret = -ENOMEM;
1018 return -ENOMEM; 1020 goto fail;
1019 } 1021 }
1020 1022
1021 if (dev_priv->cursor_needs_physical) { 1023 /* we only need to pin inside GTT if cursor is non-phy */
1022 addr = dev->agp->base + obj_priv->gtt_offset; 1024 if (!dev_priv->cursor_needs_physical) {
1023 } else { 1025 ret = i915_gem_object_pin(bo, PAGE_SIZE);
1026 if (ret) {
1027 DRM_ERROR("failed to pin cursor bo\n");
1028 goto fail;
1029 }
1024 addr = obj_priv->gtt_offset; 1030 addr = obj_priv->gtt_offset;
1025 } 1031 } else {
1026 1032 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
1027 ret = i915_gem_object_pin(bo, PAGE_SIZE); 1033 if (ret) {
1028 if (ret) { 1034 DRM_ERROR("failed to attach phys object\n");
1029 DRM_ERROR("failed to pin cursor bo\n"); 1035 goto fail;
1030 drm_gem_object_unreference(bo); 1036 }
1031 return ret; 1037 addr = obj_priv->phys_obj->handle->busaddr;
1032 } 1038 }
1033 1039
1034 temp = 0; 1040 temp = 0;
@@ -1041,14 +1047,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1041 I915_WRITE(base, addr); 1047 I915_WRITE(base, addr);
1042 1048
1043 if (intel_crtc->cursor_bo) { 1049 if (intel_crtc->cursor_bo) {
1044 i915_gem_object_unpin(intel_crtc->cursor_bo); 1050 if (dev_priv->cursor_needs_physical) {
1051 if (intel_crtc->cursor_bo != bo)
1052 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
1053 } else
1054 i915_gem_object_unpin(intel_crtc->cursor_bo);
1055 mutex_lock(&dev->struct_mutex);
1045 drm_gem_object_unreference(intel_crtc->cursor_bo); 1056 drm_gem_object_unreference(intel_crtc->cursor_bo);
1057 mutex_unlock(&dev->struct_mutex);
1046 } 1058 }
1047 1059
1048 intel_crtc->cursor_addr = addr; 1060 intel_crtc->cursor_addr = addr;
1049 intel_crtc->cursor_bo = bo; 1061 intel_crtc->cursor_bo = bo;
1050 1062
1051 return 0; 1063 return 0;
1064fail:
1065 mutex_lock(&dev->struct_mutex);
1066 drm_gem_object_unreference(bo);
1067 mutex_unlock(&dev->struct_mutex);
1068 return ret;
1052} 1069}
1053 1070
1054static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) 1071static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index ccecfaf6307b..2fafdcc108fe 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -456,6 +456,13 @@ void intel_lvds_init(struct drm_device *dev)
456 dev_priv->panel_fixed_mode = 456 dev_priv->panel_fixed_mode =
457 drm_mode_duplicate(dev, dev_priv->vbt_mode); 457 drm_mode_duplicate(dev, dev_priv->vbt_mode);
458 mutex_unlock(&dev->mode_config.mutex); 458 mutex_unlock(&dev->mode_config.mutex);
459 if (dev_priv->panel_fixed_mode) {
460 dev_priv->panel_fixed_mode->type |=
461 DRM_MODE_TYPE_PREFERRED;
462 drm_mode_probed_add(connector,
463 dev_priv->panel_fixed_mode);
464 goto out;
465 }
459 } 466 }
460 467
461 /* 468 /*
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 4b33bc82cc24..b84bf066879b 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -189,6 +189,16 @@ config SENSORS_ADT7473
189 This driver can also be built as a module. If so, the module 189 This driver can also be built as a module. If so, the module
190 will be called adt7473. 190 will be called adt7473.
191 191
192config SENSORS_ADT7475
193 tristate "Analog Devices ADT7475"
194 depends on I2C && EXPERIMENTAL
195 help
196 If you say yes here you get support for the Analog Devices
197 ADT7475 hardware monitoring chips.
198
199 This driver can also be build as a module. If so, the module
200 will be called adt7475.
201
192config SENSORS_K8TEMP 202config SENSORS_K8TEMP
193 tristate "AMD Athlon64/FX or Opteron temperature sensor" 203 tristate "AMD Athlon64/FX or Opteron temperature sensor"
194 depends on X86 && PCI && EXPERIMENTAL 204 depends on X86 && PCI && EXPERIMENTAL
@@ -861,6 +871,8 @@ config SENSORS_HDAPS
861config SENSORS_LIS3LV02D 871config SENSORS_LIS3LV02D
862 tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" 872 tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer"
863 depends on ACPI && INPUT 873 depends on ACPI && INPUT
874 select NEW_LEDS
875 select LEDS_CLASS
864 default n 876 default n
865 help 877 help
866 This driver provides support for the LIS3LV02Dx accelerometer. In 878 This driver provides support for the LIS3LV02Dx accelerometer. In
@@ -872,10 +884,16 @@ config SENSORS_LIS3LV02D
872 /sys/devices/platform/lis3lv02d. 884 /sys/devices/platform/lis3lv02d.
873 885
874 This driver also provides an absolute input class device, allowing 886 This driver also provides an absolute input class device, allowing
875 the laptop to act as a pinball machine-esque joystick. 887 the laptop to act as a pinball machine-esque joystick. On HP laptops,
888 if the led infrastructure is activated, support for a led indicating
889 disk protection will be provided as hp:red:hddprotection.
876 890
877 This driver can also be built as a module. If so, the module 891 This driver can also be built as modules. If so, the core module
878 will be called lis3lv02d. 892 will be called lis3lv02d and a specific module for HP laptops will be
893 called hp_accel.
894
895 Say Y here if you have an applicable laptop and want to experience
896 the awesome power of lis3lv02d.
879 897
880config SENSORS_APPLESMC 898config SENSORS_APPLESMC
881 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" 899 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)"
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 19cb1ace3eb4..2e80f37f39eb 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -28,6 +28,8 @@ obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o
28obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o 28obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o
29obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o 29obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
30obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o 30obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o
31obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o
32
31obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o 33obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
32obj-$(CONFIG_SENSORS_AMS) += ams/ 34obj-$(CONFIG_SENSORS_AMS) += ams/
33obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o 35obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index 70bb854086df..e52b38806d03 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
279 { "OTES1 Fan", 36, 2, 60, 1, 0 }, 279 { "OTES1 Fan", 36, 2, 60, 1, 0 },
280 { NULL, 0, 0, 0, 0, 0 } } 280 { NULL, 0, 0, 0, 0, 0 } }
281 }, 281 },
282 { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", { 282 { 0x0011, "AT8 32X", {
283 { "CPU Core", 0, 0, 10, 1, 0 }, 283 { "CPU Core", 0, 0, 10, 1, 0 },
284 { "DDR", 1, 0, 20, 1, 0 }, 284 { "DDR", 1, 0, 20, 1, 0 },
285 { "DDR VTT", 2, 0, 10, 1, 0 }, 285 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
402 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 402 { "AUX3 Fan", 36, 2, 60, 1, 0 },
403 { NULL, 0, 0, 0, 0, 0 } } 403 { NULL, 0, 0, 0, 0, 0 } }
404 }, 404 },
405 { 0x0016, "AW9D-MAX (Intel i975-ICH7)", { 405 { 0x0016, "AW9D-MAX", {
406 { "CPU Core", 0, 0, 10, 1, 0 }, 406 { "CPU Core", 0, 0, 10, 1, 0 },
407 { "DDR2", 1, 0, 20, 1, 0 }, 407 { "DDR2", 1, 0, 20, 1, 0 },
408 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 408 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -482,7 +482,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
482 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 482 { "AUX3 Fan", 36, 2, 60, 1, 0 },
483 { NULL, 0, 0, 0, 0, 0 } } 483 { NULL, 0, 0, 0, 0, 0 } }
484 }, 484 },
485 { 0x0019, NULL /* Unknown, need DMI string */, { 485 { 0x0019, "IN9 32X MAX", {
486 { "CPU Core", 7, 0, 10, 1, 0 }, 486 { "CPU Core", 7, 0, 10, 1, 0 },
487 { "DDR2", 13, 0, 20, 1, 0 }, 487 { "DDR2", 13, 0, 20, 1, 0 },
488 { "DDR2 VTT", 14, 0, 10, 1, 0 }, 488 { "DDR2 VTT", 14, 0, 10, 1, 0 },
@@ -509,7 +509,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
509 { "AUX3 FAN", 36, 2, 60, 1, 0 }, 509 { "AUX3 FAN", 36, 2, 60, 1, 0 },
510 { NULL, 0, 0, 0, 0, 0 } } 510 { NULL, 0, 0, 0, 0, 0 } }
511 }, 511 },
512 { 0x001A, "IP35 Pro(Intel P35-ICH9R)", { 512 { 0x001A, "IP35 Pro", {
513 { "CPU Core", 0, 0, 10, 1, 0 }, 513 { "CPU Core", 0, 0, 10, 1, 0 },
514 { "DDR2", 1, 0, 20, 1, 0 }, 514 { "DDR2", 1, 0, 20, 1, 0 },
515 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 515 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -1128,6 +1128,7 @@ static int __init abituguru3_dmi_detect(void)
1128{ 1128{
1129 const char *board_vendor, *board_name; 1129 const char *board_vendor, *board_name;
1130 int i, err = (force) ? 1 : -ENODEV; 1130 int i, err = (force) ? 1 : -ENODEV;
1131 size_t sublen;
1131 1132
1132 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); 1133 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
1133 if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) 1134 if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/"))
@@ -1137,9 +1138,20 @@ static int __init abituguru3_dmi_detect(void)
1137 if (!board_name) 1138 if (!board_name)
1138 return err; 1139 return err;
1139 1140
1141 /* At the moment, we don't care about the part of the vendor
1142 * DMI string contained in brackets. Truncate the string at
1143 * the first occurrence of a bracket. Trim any trailing space
1144 * from the substring.
1145 */
1146 sublen = strcspn(board_name, "(");
1147 while (sublen > 0 && board_name[sublen - 1] == ' ')
1148 sublen--;
1149
1140 for (i = 0; abituguru3_motherboards[i].id; i++) { 1150 for (i = 0; abituguru3_motherboards[i].id; i++) {
1141 const char *dmi_name = abituguru3_motherboards[i].dmi_name; 1151 const char *dmi_name = abituguru3_motherboards[i].dmi_name;
1142 if (dmi_name && !strcmp(dmi_name, board_name)) 1152 if (!dmi_name || strlen(dmi_name) != sublen)
1153 continue;
1154 if (!strncasecmp(board_name, dmi_name, sublen))
1143 break; 1155 break;
1144 } 1156 }
1145 1157
@@ -1153,7 +1165,7 @@ static int __init abituguru3_dmi_detect(void)
1153 1165
1154static inline int abituguru3_dmi_detect(void) 1166static inline int abituguru3_dmi_detect(void)
1155{ 1167{
1156 return -ENODEV; 1168 return 1;
1157} 1169}
1158 1170
1159#endif /* CONFIG_DMI */ 1171#endif /* CONFIG_DMI */
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
new file mode 100644
index 000000000000..d39877a7da63
--- /dev/null
+++ b/drivers/hwmon/adt7475.c
@@ -0,0 +1,1221 @@
1/*
2 * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives
3 * Copyright (C) 2007-2008, Advanced Micro Devices, Inc.
4 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
5 * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com>
6
7 * Derived from the lm83 driver by Jean Delvare
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/slab.h>
17#include <linux/i2c.h>
18#include <linux/hwmon.h>
19#include <linux/hwmon-sysfs.h>
20#include <linux/err.h>
21
22/* Indexes for the sysfs hooks */
23
24#define INPUT 0
25#define MIN 1
26#define MAX 2
27#define CONTROL 3
28#define OFFSET 3
29#define AUTOMIN 4
30#define THERM 5
31#define HYSTERSIS 6
32
33/* These are unique identifiers for the sysfs functions - unlike the
34 numbers above, these are not also indexes into an array
35*/
36
37#define ALARM 9
38#define FAULT 10
39
40/* 7475 Common Registers */
41
42#define REG_VOLTAGE_BASE 0x21
43#define REG_TEMP_BASE 0x25
44#define REG_TACH_BASE 0x28
45#define REG_PWM_BASE 0x30
46#define REG_PWM_MAX_BASE 0x38
47
48#define REG_DEVID 0x3D
49#define REG_VENDID 0x3E
50
51#define REG_STATUS1 0x41
52#define REG_STATUS2 0x42
53
54#define REG_VOLTAGE_MIN_BASE 0x46
55#define REG_VOLTAGE_MAX_BASE 0x47
56
57#define REG_TEMP_MIN_BASE 0x4E
58#define REG_TEMP_MAX_BASE 0x4F
59
60#define REG_TACH_MIN_BASE 0x54
61
62#define REG_PWM_CONFIG_BASE 0x5C
63
64#define REG_TEMP_TRANGE_BASE 0x5F
65
66#define REG_PWM_MIN_BASE 0x64
67
68#define REG_TEMP_TMIN_BASE 0x67
69#define REG_TEMP_THERM_BASE 0x6A
70
71#define REG_REMOTE1_HYSTERSIS 0x6D
72#define REG_REMOTE2_HYSTERSIS 0x6E
73
74#define REG_TEMP_OFFSET_BASE 0x70
75
76#define REG_EXTEND1 0x76
77#define REG_EXTEND2 0x77
78#define REG_CONFIG5 0x7C
79
80#define CONFIG5_TWOSCOMP 0x01
81#define CONFIG5_TEMPOFFSET 0x02
82
83/* ADT7475 Settings */
84
85#define ADT7475_VOLTAGE_COUNT 2
86#define ADT7475_TEMP_COUNT 3
87#define ADT7475_TACH_COUNT 4
88#define ADT7475_PWM_COUNT 3
89
90/* Macro to read the registers */
91
92#define adt7475_read(reg) i2c_smbus_read_byte_data(client, (reg))
93
94/* Macros to easily index the registers */
95
96#define TACH_REG(idx) (REG_TACH_BASE + ((idx) * 2))
97#define TACH_MIN_REG(idx) (REG_TACH_MIN_BASE + ((idx) * 2))
98
99#define PWM_REG(idx) (REG_PWM_BASE + (idx))
100#define PWM_MAX_REG(idx) (REG_PWM_MAX_BASE + (idx))
101#define PWM_MIN_REG(idx) (REG_PWM_MIN_BASE + (idx))
102#define PWM_CONFIG_REG(idx) (REG_PWM_CONFIG_BASE + (idx))
103
104#define VOLTAGE_REG(idx) (REG_VOLTAGE_BASE + (idx))
105#define VOLTAGE_MIN_REG(idx) (REG_VOLTAGE_MIN_BASE + ((idx) * 2))
106#define VOLTAGE_MAX_REG(idx) (REG_VOLTAGE_MAX_BASE + ((idx) * 2))
107
108#define TEMP_REG(idx) (REG_TEMP_BASE + (idx))
109#define TEMP_MIN_REG(idx) (REG_TEMP_MIN_BASE + ((idx) * 2))
110#define TEMP_MAX_REG(idx) (REG_TEMP_MAX_BASE + ((idx) * 2))
111#define TEMP_TMIN_REG(idx) (REG_TEMP_TMIN_BASE + (idx))
112#define TEMP_THERM_REG(idx) (REG_TEMP_THERM_BASE + (idx))
113#define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx))
114#define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx))
115
116static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END };
117
118I2C_CLIENT_INSMOD_1(adt7475);
119
120static const struct i2c_device_id adt7475_id[] = {
121 { "adt7475", adt7475 },
122 { }
123};
124MODULE_DEVICE_TABLE(i2c, adt7475_id);
125
126struct adt7475_data {
127 struct device *hwmon_dev;
128 struct mutex lock;
129
130 unsigned long measure_updated;
131 unsigned long limits_updated;
132 char valid;
133
134 u8 config5;
135 u16 alarms;
136 u16 voltage[3][3];
137 u16 temp[7][3];
138 u16 tach[2][4];
139 u8 pwm[4][3];
140 u8 range[3];
141 u8 pwmctl[3];
142 u8 pwmchan[3];
143};
144
145static struct i2c_driver adt7475_driver;
146static struct adt7475_data *adt7475_update_device(struct device *dev);
147static void adt7475_read_hystersis(struct i2c_client *client);
148static void adt7475_read_pwm(struct i2c_client *client, int index);
149
150/* Given a temp value, convert it to register value */
151
152static inline u16 temp2reg(struct adt7475_data *data, long val)
153{
154 u16 ret;
155
156 if (!(data->config5 & CONFIG5_TWOSCOMP)) {
157 val = SENSORS_LIMIT(val, -64000, 191000);
158 ret = (val + 64500) / 1000;
159 } else {
160 val = SENSORS_LIMIT(val, -128000, 127000);
161 if (val < -500)
162 ret = (256500 + val) / 1000;
163 else
164 ret = (val + 500) / 1000;
165 }
166
167 return ret << 2;
168}
169
170/* Given a register value, convert it to a real temp value */
171
172static inline int reg2temp(struct adt7475_data *data, u16 reg)
173{
174 if (data->config5 & CONFIG5_TWOSCOMP) {
175 if (reg >= 512)
176 return (reg - 1024) * 250;
177 else
178 return reg * 250;
179 } else
180 return (reg - 256) * 250;
181}
182
183static inline int tach2rpm(u16 tach)
184{
185 if (tach == 0 || tach == 0xFFFF)
186 return 0;
187
188 return (90000 * 60) / tach;
189}
190
191static inline u16 rpm2tach(unsigned long rpm)
192{
193 if (rpm == 0)
194 return 0;
195
196 return SENSORS_LIMIT((90000 * 60) / rpm, 1, 0xFFFF);
197}
198
199static inline int reg2vcc(u16 reg)
200{
201 return (4296 * reg) / 1000;
202}
203
204static inline int reg2vccp(u16 reg)
205{
206 return (2929 * reg) / 1000;
207}
208
209static inline u16 vcc2reg(long vcc)
210{
211 vcc = SENSORS_LIMIT(vcc, 0, 4396);
212 return (vcc * 1000) / 4296;
213}
214
215static inline u16 vccp2reg(long vcc)
216{
217 vcc = SENSORS_LIMIT(vcc, 0, 2998);
218 return (vcc * 1000) / 2929;
219}
220
221static u16 adt7475_read_word(struct i2c_client *client, int reg)
222{
223 u16 val;
224
225 val = i2c_smbus_read_byte_data(client, reg);
226 val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8);
227
228 return val;
229}
230
231static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
232{
233 i2c_smbus_write_byte_data(client, reg + 1, val >> 8);
234 i2c_smbus_write_byte_data(client, reg, val & 0xFF);
235}
236
237/* Find the nearest value in a table - used for pwm frequency and
238 auto temp range */
239static int find_nearest(long val, const int *array, int size)
240{
241 int i;
242
243 if (val < array[0])
244 return 0;
245
246 if (val > array[size - 1])
247 return size - 1;
248
249 for (i = 0; i < size - 1; i++) {
250 int a, b;
251
252 if (val > array[i + 1])
253 continue;
254
255 a = val - array[i];
256 b = array[i + 1] - val;
257
258 return (a <= b) ? i : i + 1;
259 }
260
261 return 0;
262}
263
264static ssize_t show_voltage(struct device *dev, struct device_attribute *attr,
265 char *buf)
266{
267 struct adt7475_data *data = adt7475_update_device(dev);
268 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
269 unsigned short val;
270
271 switch (sattr->nr) {
272 case ALARM:
273 return sprintf(buf, "%d\n",
274 (data->alarms >> (sattr->index + 1)) & 1);
275 default:
276 val = data->voltage[sattr->nr][sattr->index];
277 return sprintf(buf, "%d\n",
278 sattr->index ==
279 0 ? reg2vccp(val) : reg2vcc(val));
280 }
281}
282
283static ssize_t set_voltage(struct device *dev, struct device_attribute *attr,
284 const char *buf, size_t count)
285{
286
287 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
288 struct i2c_client *client = to_i2c_client(dev);
289 struct adt7475_data *data = i2c_get_clientdata(client);
290 unsigned char reg;
291 long val;
292
293 if (strict_strtol(buf, 10, &val))
294 return -EINVAL;
295
296 mutex_lock(&data->lock);
297
298 data->voltage[sattr->nr][sattr->index] =
299 sattr->index ? vcc2reg(val) : vccp2reg(val);
300
301 if (sattr->nr == MIN)
302 reg = VOLTAGE_MIN_REG(sattr->index);
303 else
304 reg = VOLTAGE_MAX_REG(sattr->index);
305
306 i2c_smbus_write_byte_data(client, reg,
307 data->voltage[sattr->nr][sattr->index] >> 2);
308 mutex_unlock(&data->lock);
309
310 return count;
311}
312
313static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
314 char *buf)
315{
316 struct adt7475_data *data = adt7475_update_device(dev);
317 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
318 int out;
319
320 switch (sattr->nr) {
321 case HYSTERSIS:
322 mutex_lock(&data->lock);
323 out = data->temp[sattr->nr][sattr->index];
324 if (sattr->index != 1)
325 out = (out >> 4) & 0xF;
326 else
327 out = (out & 0xF);
328 /* Show the value as an absolute number tied to
329 * THERM */
330 out = reg2temp(data, data->temp[THERM][sattr->index]) -
331 out * 1000;
332 mutex_unlock(&data->lock);
333 break;
334
335 case OFFSET:
336 /* Offset is always 2's complement, regardless of the
337 * setting in CONFIG5 */
338 mutex_lock(&data->lock);
339 out = (s8)data->temp[sattr->nr][sattr->index];
340 if (data->config5 & CONFIG5_TEMPOFFSET)
341 out *= 1000;
342 else
343 out *= 500;
344 mutex_unlock(&data->lock);
345 break;
346
347 case ALARM:
348 out = (data->alarms >> (sattr->index + 4)) & 1;
349 break;
350
351 case FAULT:
352 /* Note - only for remote1 and remote2 */
353 out = data->alarms & (sattr->index ? 0x8000 : 0x4000);
354 out = out ? 0 : 1;
355 break;
356
357 default:
358 /* All other temp values are in the configured format */
359 out = reg2temp(data, data->temp[sattr->nr][sattr->index]);
360 }
361
362 return sprintf(buf, "%d\n", out);
363}
364
365static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
366 const char *buf, size_t count)
367{
368 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
369 struct i2c_client *client = to_i2c_client(dev);
370 struct adt7475_data *data = i2c_get_clientdata(client);
371 unsigned char reg = 0;
372 u8 out;
373 int temp;
374 long val;
375
376 if (strict_strtol(buf, 10, &val))
377 return -EINVAL;
378
379 mutex_lock(&data->lock);
380
381 /* We need the config register in all cases for temp <-> reg conv. */
382 data->config5 = adt7475_read(REG_CONFIG5);
383
384 switch (sattr->nr) {
385 case OFFSET:
386 if (data->config5 & CONFIG5_TEMPOFFSET) {
387 val = SENSORS_LIMIT(val, -63000, 127000);
388 out = data->temp[OFFSET][sattr->index] = val / 1000;
389 } else {
390 val = SENSORS_LIMIT(val, -63000, 64000);
391 out = data->temp[OFFSET][sattr->index] = val / 500;
392 }
393 break;
394
395 case HYSTERSIS:
396 /* The value will be given as an absolute value, turn it
397 into an offset based on THERM */
398
399 /* Read fresh THERM and HYSTERSIS values from the chip */
400 data->temp[THERM][sattr->index] =
401 adt7475_read(TEMP_THERM_REG(sattr->index)) << 2;
402 adt7475_read_hystersis(client);
403
404 temp = reg2temp(data, data->temp[THERM][sattr->index]);
405 val = SENSORS_LIMIT(val, temp - 15000, temp);
406 val = (temp - val) / 1000;
407
408 if (sattr->index != 1) {
409 data->temp[HYSTERSIS][sattr->index] &= 0xF0;
410 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4;
411 } else {
412 data->temp[HYSTERSIS][sattr->index] &= 0x0F;
413 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF);
414 }
415
416 out = data->temp[HYSTERSIS][sattr->index];
417 break;
418
419 default:
420 data->temp[sattr->nr][sattr->index] = temp2reg(data, val);
421
422 /* We maintain an extra 2 digits of precision for simplicity
423 * - shift those back off before writing the value */
424 out = (u8) (data->temp[sattr->nr][sattr->index] >> 2);
425 }
426
427 switch (sattr->nr) {
428 case MIN:
429 reg = TEMP_MIN_REG(sattr->index);
430 break;
431 case MAX:
432 reg = TEMP_MAX_REG(sattr->index);
433 break;
434 case OFFSET:
435 reg = TEMP_OFFSET_REG(sattr->index);
436 break;
437 case AUTOMIN:
438 reg = TEMP_TMIN_REG(sattr->index);
439 break;
440 case THERM:
441 reg = TEMP_THERM_REG(sattr->index);
442 break;
443 case HYSTERSIS:
444 if (sattr->index != 2)
445 reg = REG_REMOTE1_HYSTERSIS;
446 else
447 reg = REG_REMOTE2_HYSTERSIS;
448
449 break;
450 }
451
452 i2c_smbus_write_byte_data(client, reg, out);
453
454 mutex_unlock(&data->lock);
455 return count;
456}
457
458/* Table of autorange values - the user will write the value in millidegrees,
459 and we'll convert it */
460static const int autorange_table[] = {
461 2000, 2500, 3330, 4000, 5000, 6670, 8000,
462 10000, 13330, 16000, 20000, 26670, 32000, 40000,
463 53330, 80000
464};
465
466static ssize_t show_point2(struct device *dev, struct device_attribute *attr,
467 char *buf)
468{
469 struct adt7475_data *data = adt7475_update_device(dev);
470 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
471 int out, val;
472
473 mutex_lock(&data->lock);
474 out = (data->range[sattr->index] >> 4) & 0x0F;
475 val = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
476 mutex_unlock(&data->lock);
477
478 return sprintf(buf, "%d\n", val + autorange_table[out]);
479}
480
481static ssize_t set_point2(struct device *dev, struct device_attribute *attr,
482 const char *buf, size_t count)
483{
484 struct i2c_client *client = to_i2c_client(dev);
485 struct adt7475_data *data = i2c_get_clientdata(client);
486 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
487 int temp;
488 long val;
489
490 if (strict_strtol(buf, 10, &val))
491 return -EINVAL;
492
493 mutex_lock(&data->lock);
494
495 /* Get a fresh copy of the needed registers */
496 data->config5 = adt7475_read(REG_CONFIG5);
497 data->temp[AUTOMIN][sattr->index] =
498 adt7475_read(TEMP_TMIN_REG(sattr->index)) << 2;
499 data->range[sattr->index] =
500 adt7475_read(TEMP_TRANGE_REG(sattr->index));
501
502 /* The user will write an absolute value, so subtract the start point
503 to figure the range */
504 temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
505 val = SENSORS_LIMIT(val, temp + autorange_table[0],
506 temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]);
507 val -= temp;
508
509 /* Find the nearest table entry to what the user wrote */
510 val = find_nearest(val, autorange_table, ARRAY_SIZE(autorange_table));
511
512 data->range[sattr->index] &= ~0xF0;
513 data->range[sattr->index] |= val << 4;
514
515 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index),
516 data->range[sattr->index]);
517
518 mutex_unlock(&data->lock);
519 return count;
520}
521
522static ssize_t show_tach(struct device *dev, struct device_attribute *attr,
523 char *buf)
524{
525 struct adt7475_data *data = adt7475_update_device(dev);
526 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
527 int out;
528
529 if (sattr->nr == ALARM)
530 out = (data->alarms >> (sattr->index + 10)) & 1;
531 else
532 out = tach2rpm(data->tach[sattr->nr][sattr->index]);
533
534 return sprintf(buf, "%d\n", out);
535}
536
537static ssize_t set_tach(struct device *dev, struct device_attribute *attr,
538 const char *buf, size_t count)
539{
540
541 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
542 struct i2c_client *client = to_i2c_client(dev);
543 struct adt7475_data *data = i2c_get_clientdata(client);
544 unsigned long val;
545
546 if (strict_strtoul(buf, 10, &val))
547 return -EINVAL;
548
549 mutex_lock(&data->lock);
550
551 data->tach[MIN][sattr->index] = rpm2tach(val);
552
553 adt7475_write_word(client, TACH_MIN_REG(sattr->index),
554 data->tach[MIN][sattr->index]);
555
556 mutex_unlock(&data->lock);
557 return count;
558}
559
560static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
561 char *buf)
562{
563 struct adt7475_data *data = adt7475_update_device(dev);
564 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
565
566 return sprintf(buf, "%d\n", data->pwm[sattr->nr][sattr->index]);
567}
568
569static ssize_t show_pwmchan(struct device *dev, struct device_attribute *attr,
570 char *buf)
571{
572 struct adt7475_data *data = adt7475_update_device(dev);
573 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
574
575 return sprintf(buf, "%d\n", data->pwmchan[sattr->index]);
576}
577
578static ssize_t show_pwmctrl(struct device *dev, struct device_attribute *attr,
579 char *buf)
580{
581 struct adt7475_data *data = adt7475_update_device(dev);
582 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
583
584 return sprintf(buf, "%d\n", data->pwmctl[sattr->index]);
585}
586
587static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
588 const char *buf, size_t count)
589{
590
591 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
592 struct i2c_client *client = to_i2c_client(dev);
593 struct adt7475_data *data = i2c_get_clientdata(client);
594 unsigned char reg = 0;
595 long val;
596
597 if (strict_strtol(buf, 10, &val))
598 return -EINVAL;
599
600 mutex_lock(&data->lock);
601
602 switch (sattr->nr) {
603 case INPUT:
604 /* Get a fresh value for CONTROL */
605 data->pwm[CONTROL][sattr->index] =
606 adt7475_read(PWM_CONFIG_REG(sattr->index));
607
608 /* If we are not in manual mode, then we shouldn't allow
609 * the user to set the pwm speed */
610 if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) {
611 mutex_unlock(&data->lock);
612 return count;
613 }
614
615 reg = PWM_REG(sattr->index);
616 break;
617
618 case MIN:
619 reg = PWM_MIN_REG(sattr->index);
620 break;
621
622 case MAX:
623 reg = PWM_MAX_REG(sattr->index);
624 break;
625 }
626
627 data->pwm[sattr->nr][sattr->index] = SENSORS_LIMIT(val, 0, 0xFF);
628 i2c_smbus_write_byte_data(client, reg,
629 data->pwm[sattr->nr][sattr->index]);
630
631 mutex_unlock(&data->lock);
632
633 return count;
634}
635
636/* Called by set_pwmctrl and set_pwmchan */
637
638static int hw_set_pwm(struct i2c_client *client, int index,
639 unsigned int pwmctl, unsigned int pwmchan)
640{
641 struct adt7475_data *data = i2c_get_clientdata(client);
642 long val = 0;
643
644 switch (pwmctl) {
645 case 0:
646 val = 0x03; /* Run at full speed */
647 break;
648 case 1:
649 val = 0x07; /* Manual mode */
650 break;
651 case 2:
652 switch (pwmchan) {
653 case 1:
654 /* Remote1 controls PWM */
655 val = 0x00;
656 break;
657 case 2:
658 /* local controls PWM */
659 val = 0x01;
660 break;
661 case 4:
662 /* remote2 controls PWM */
663 val = 0x02;
664 break;
665 case 6:
666 /* local/remote2 control PWM */
667 val = 0x05;
668 break;
669 case 7:
670 /* All three control PWM */
671 val = 0x06;
672 break;
673 default:
674 return -EINVAL;
675 }
676 break;
677 default:
678 return -EINVAL;
679 }
680
681 data->pwmctl[index] = pwmctl;
682 data->pwmchan[index] = pwmchan;
683
684 data->pwm[CONTROL][index] &= ~0xE0;
685 data->pwm[CONTROL][index] |= (val & 7) << 5;
686
687 i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index),
688 data->pwm[CONTROL][index]);
689
690 return 0;
691}
692
693static ssize_t set_pwmchan(struct device *dev, struct device_attribute *attr,
694 const char *buf, size_t count)
695{
696 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
697 struct i2c_client *client = to_i2c_client(dev);
698 struct adt7475_data *data = i2c_get_clientdata(client);
699 int r;
700 long val;
701
702 if (strict_strtol(buf, 10, &val))
703 return -EINVAL;
704
705 mutex_lock(&data->lock);
706 /* Read Modify Write PWM values */
707 adt7475_read_pwm(client, sattr->index);
708 r = hw_set_pwm(client, sattr->index, data->pwmctl[sattr->index], val);
709 if (r)
710 count = r;
711 mutex_unlock(&data->lock);
712
713 return count;
714}
715
716static ssize_t set_pwmctrl(struct device *dev, struct device_attribute *attr,
717 const char *buf, size_t count)
718{
719 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
720 struct i2c_client *client = to_i2c_client(dev);
721 struct adt7475_data *data = i2c_get_clientdata(client);
722 int r;
723 long val;
724
725 if (strict_strtol(buf, 10, &val))
726 return -EINVAL;
727
728 mutex_lock(&data->lock);
729 /* Read Modify Write PWM values */
730 adt7475_read_pwm(client, sattr->index);
731 r = hw_set_pwm(client, sattr->index, val, data->pwmchan[sattr->index]);
732 if (r)
733 count = r;
734 mutex_unlock(&data->lock);
735
736 return count;
737}
738
739/* List of frequencies for the PWM */
740static const int pwmfreq_table[] = {
741 11, 14, 22, 29, 35, 44, 58, 88
742};
743
744static ssize_t show_pwmfreq(struct device *dev, struct device_attribute *attr,
745 char *buf)
746{
747 struct adt7475_data *data = adt7475_update_device(dev);
748 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
749
750 return sprintf(buf, "%d\n",
751 pwmfreq_table[data->range[sattr->index] & 7]);
752}
753
754static ssize_t set_pwmfreq(struct device *dev, struct device_attribute *attr,
755 const char *buf, size_t count)
756{
757 struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
758 struct i2c_client *client = to_i2c_client(dev);
759 struct adt7475_data *data = i2c_get_clientdata(client);
760 int out;
761 long val;
762
763 if (strict_strtol(buf, 10, &val))
764 return -EINVAL;
765
766 out = find_nearest(val, pwmfreq_table, ARRAY_SIZE(pwmfreq_table));
767
768 mutex_lock(&data->lock);
769
770 data->range[sattr->index] =
771 adt7475_read(TEMP_TRANGE_REG(sattr->index));
772 data->range[sattr->index] &= ~7;
773 data->range[sattr->index] |= out;
774
775 i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index),
776 data->range[sattr->index]);
777
778 mutex_unlock(&data->lock);
779 return count;
780}
781
782static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_voltage, NULL, INPUT, 0);
783static SENSOR_DEVICE_ATTR_2(in1_max, S_IRUGO | S_IWUSR, show_voltage,
784 set_voltage, MAX, 0);
785static SENSOR_DEVICE_ATTR_2(in1_min, S_IRUGO | S_IWUSR, show_voltage,
786 set_voltage, MIN, 0);
787static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, show_voltage, NULL, ALARM, 0);
788static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_voltage, NULL, INPUT, 1);
789static SENSOR_DEVICE_ATTR_2(in2_max, S_IRUGO | S_IWUSR, show_voltage,
790 set_voltage, MAX, 1);
791static SENSOR_DEVICE_ATTR_2(in2_min, S_IRUGO | S_IWUSR, show_voltage,
792 set_voltage, MIN, 1);
793static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, show_voltage, NULL, ALARM, 1);
794static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, INPUT, 0);
795static SENSOR_DEVICE_ATTR_2(temp1_alarm, S_IRUGO, show_temp, NULL, ALARM, 0);
796static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_temp, NULL, FAULT, 0);
797static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
798 MAX, 0);
799static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
800 MIN, 0);
801static SENSOR_DEVICE_ATTR_2(temp1_offset, S_IRUGO | S_IWUSR, show_temp,
802 set_temp, OFFSET, 0);
803static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO | S_IWUSR,
804 show_temp, set_temp, AUTOMIN, 0);
805static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IRUGO | S_IWUSR,
806 show_point2, set_point2, 0, 0);
807static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, set_temp,
808 THERM, 0);
809static SENSOR_DEVICE_ATTR_2(temp1_crit_hyst, S_IRUGO | S_IWUSR, show_temp,
810 set_temp, HYSTERSIS, 0);
811static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, INPUT, 1);
812static SENSOR_DEVICE_ATTR_2(temp2_alarm, S_IRUGO, show_temp, NULL, ALARM, 1);
813static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
814 MAX, 1);
815static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
816 MIN, 1);
817static SENSOR_DEVICE_ATTR_2(temp2_offset, S_IRUGO | S_IWUSR, show_temp,
818 set_temp, OFFSET, 1);
819static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IRUGO | S_IWUSR,
820 show_temp, set_temp, AUTOMIN, 1);
821static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IRUGO | S_IWUSR,
822 show_point2, set_point2, 0, 1);
823static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, set_temp,
824 THERM, 1);
825static SENSOR_DEVICE_ATTR_2(temp2_crit_hyst, S_IRUGO | S_IWUSR, show_temp,
826 set_temp, HYSTERSIS, 1);
827static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, INPUT, 2);
828static SENSOR_DEVICE_ATTR_2(temp3_alarm, S_IRUGO, show_temp, NULL, ALARM, 2);
829static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_temp, NULL, FAULT, 2);
830static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
831 MAX, 2);
832static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
833 MIN, 2);
834static SENSOR_DEVICE_ATTR_2(temp3_offset, S_IRUGO | S_IWUSR, show_temp,
835 set_temp, OFFSET, 2);
836static SENSOR_DEVICE_ATTR_2(temp3_auto_point1_temp, S_IRUGO | S_IWUSR,
837 show_temp, set_temp, AUTOMIN, 2);
838static SENSOR_DEVICE_ATTR_2(temp3_auto_point2_temp, S_IRUGO | S_IWUSR,
839 show_point2, set_point2, 0, 2);
840static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, set_temp,
841 THERM, 2);
842static SENSOR_DEVICE_ATTR_2(temp3_crit_hyst, S_IRUGO | S_IWUSR, show_temp,
843 set_temp, HYSTERSIS, 2);
844static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_tach, NULL, INPUT, 0);
845static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
846 MIN, 0);
847static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_tach, NULL, ALARM, 0);
848static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_tach, NULL, INPUT, 1);
849static SENSOR_DEVICE_ATTR_2(fan2_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
850 MIN, 1);
851static SENSOR_DEVICE_ATTR_2(fan2_alarm, S_IRUGO, show_tach, NULL, ALARM, 1);
852static SENSOR_DEVICE_ATTR_2(fan3_input, S_IRUGO, show_tach, NULL, INPUT, 2);
853static SENSOR_DEVICE_ATTR_2(fan3_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
854 MIN, 2);
855static SENSOR_DEVICE_ATTR_2(fan3_alarm, S_IRUGO, show_tach, NULL, ALARM, 2);
856static SENSOR_DEVICE_ATTR_2(fan4_input, S_IRUGO, show_tach, NULL, INPUT, 3);
857static SENSOR_DEVICE_ATTR_2(fan4_min, S_IRUGO | S_IWUSR, show_tach, set_tach,
858 MIN, 3);
859static SENSOR_DEVICE_ATTR_2(fan4_alarm, S_IRUGO, show_tach, NULL, ALARM, 3);
860static SENSOR_DEVICE_ATTR_2(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT,
861 0);
862static SENSOR_DEVICE_ATTR_2(pwm1_freq, S_IRUGO | S_IWUSR, show_pwmfreq,
863 set_pwmfreq, INPUT, 0);
864static SENSOR_DEVICE_ATTR_2(pwm1_enable, S_IRUGO | S_IWUSR, show_pwmctrl,
865 set_pwmctrl, INPUT, 0);
866static SENSOR_DEVICE_ATTR_2(pwm1_auto_channel_temp, S_IRUGO | S_IWUSR,
867 show_pwmchan, set_pwmchan, INPUT, 0);
868static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm,
869 set_pwm, MIN, 0);
870static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm,
871 set_pwm, MAX, 0);
872static SENSOR_DEVICE_ATTR_2(pwm2, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT,
873 1);
874static SENSOR_DEVICE_ATTR_2(pwm2_freq, S_IRUGO | S_IWUSR, show_pwmfreq,
875 set_pwmfreq, INPUT, 1);
876static SENSOR_DEVICE_ATTR_2(pwm2_enable, S_IRUGO | S_IWUSR, show_pwmctrl,
877 set_pwmctrl, INPUT, 1);
878static SENSOR_DEVICE_ATTR_2(pwm2_auto_channel_temp, S_IRUGO | S_IWUSR,
879 show_pwmchan, set_pwmchan, INPUT, 1);
880static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm,
881 set_pwm, MIN, 1);
882static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm,
883 set_pwm, MAX, 1);
884static SENSOR_DEVICE_ATTR_2(pwm3, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT,
885 2);
886static SENSOR_DEVICE_ATTR_2(pwm3_freq, S_IRUGO | S_IWUSR, show_pwmfreq,
887 set_pwmfreq, INPUT, 2);
888static SENSOR_DEVICE_ATTR_2(pwm3_enable, S_IRUGO | S_IWUSR, show_pwmctrl,
889 set_pwmctrl, INPUT, 2);
890static SENSOR_DEVICE_ATTR_2(pwm3_auto_channel_temp, S_IRUGO | S_IWUSR,
891 show_pwmchan, set_pwmchan, INPUT, 2);
892static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm,
893 set_pwm, MIN, 2);
894static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm,
895 set_pwm, MAX, 2);
896
897static struct attribute *adt7475_attrs[] = {
898 &sensor_dev_attr_in1_input.dev_attr.attr,
899 &sensor_dev_attr_in1_max.dev_attr.attr,
900 &sensor_dev_attr_in1_min.dev_attr.attr,
901 &sensor_dev_attr_in1_alarm.dev_attr.attr,
902 &sensor_dev_attr_in2_input.dev_attr.attr,
903 &sensor_dev_attr_in2_max.dev_attr.attr,
904 &sensor_dev_attr_in2_min.dev_attr.attr,
905 &sensor_dev_attr_in2_alarm.dev_attr.attr,
906 &sensor_dev_attr_temp1_input.dev_attr.attr,
907 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
908 &sensor_dev_attr_temp1_fault.dev_attr.attr,
909 &sensor_dev_attr_temp1_max.dev_attr.attr,
910 &sensor_dev_attr_temp1_min.dev_attr.attr,
911 &sensor_dev_attr_temp1_offset.dev_attr.attr,
912 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
913 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
914 &sensor_dev_attr_temp1_crit.dev_attr.attr,
915 &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,
916 &sensor_dev_attr_temp2_input.dev_attr.attr,
917 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
918 &sensor_dev_attr_temp2_max.dev_attr.attr,
919 &sensor_dev_attr_temp2_min.dev_attr.attr,
920 &sensor_dev_attr_temp2_offset.dev_attr.attr,
921 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
922 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
923 &sensor_dev_attr_temp2_crit.dev_attr.attr,
924 &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr,
925 &sensor_dev_attr_temp3_input.dev_attr.attr,
926 &sensor_dev_attr_temp3_fault.dev_attr.attr,
927 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
928 &sensor_dev_attr_temp3_max.dev_attr.attr,
929 &sensor_dev_attr_temp3_min.dev_attr.attr,
930 &sensor_dev_attr_temp3_offset.dev_attr.attr,
931 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
932 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
933 &sensor_dev_attr_temp3_crit.dev_attr.attr,
934 &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr,
935 &sensor_dev_attr_fan1_input.dev_attr.attr,
936 &sensor_dev_attr_fan1_min.dev_attr.attr,
937 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
938 &sensor_dev_attr_fan2_input.dev_attr.attr,
939 &sensor_dev_attr_fan2_min.dev_attr.attr,
940 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
941 &sensor_dev_attr_fan3_input.dev_attr.attr,
942 &sensor_dev_attr_fan3_min.dev_attr.attr,
943 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
944 &sensor_dev_attr_fan4_input.dev_attr.attr,
945 &sensor_dev_attr_fan4_min.dev_attr.attr,
946 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
947 &sensor_dev_attr_pwm1.dev_attr.attr,
948 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
949 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
950 &sensor_dev_attr_pwm1_auto_channel_temp.dev_attr.attr,
951 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
952 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
953 &sensor_dev_attr_pwm2.dev_attr.attr,
954 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
955 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
956 &sensor_dev_attr_pwm2_auto_channel_temp.dev_attr.attr,
957 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
958 &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
959 &sensor_dev_attr_pwm3.dev_attr.attr,
960 &sensor_dev_attr_pwm3_freq.dev_attr.attr,
961 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
962 &sensor_dev_attr_pwm3_auto_channel_temp.dev_attr.attr,
963 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
964 &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
965 NULL,
966};
967
968struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs };
969
970static int adt7475_detect(struct i2c_client *client, int kind,
971 struct i2c_board_info *info)
972{
973 struct i2c_adapter *adapter = client->adapter;
974
975 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
976 return -ENODEV;
977
978 if (kind <= 0) {
979 if (adt7475_read(REG_VENDID) != 0x41 ||
980 adt7475_read(REG_DEVID) != 0x75) {
981 dev_err(&adapter->dev,
982 "Couldn't detect a adt7475 part at 0x%02x\n",
983 (unsigned int)client->addr);
984 return -ENODEV;
985 }
986 }
987
988 strlcpy(info->type, adt7475_id[0].name, I2C_NAME_SIZE);
989
990 return 0;
991}
992
993static int adt7475_probe(struct i2c_client *client,
994 const struct i2c_device_id *id)
995{
996 struct adt7475_data *data;
997 int i, ret = 0;
998
999 data = kzalloc(sizeof(*data), GFP_KERNEL);
1000 if (data == NULL)
1001 return -ENOMEM;
1002
1003 mutex_init(&data->lock);
1004 i2c_set_clientdata(client, data);
1005
1006 /* Call adt7475_read_pwm for all pwm's as this will reprogram any
1007 pwm's which are disabled to manual mode with 0% duty cycle */
1008 for (i = 0; i < ADT7475_PWM_COUNT; i++)
1009 adt7475_read_pwm(client, i);
1010
1011 ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group);
1012 if (ret)
1013 goto efree;
1014
1015 data->hwmon_dev = hwmon_device_register(&client->dev);
1016 if (IS_ERR(data->hwmon_dev)) {
1017 ret = PTR_ERR(data->hwmon_dev);
1018 goto eremove;
1019 }
1020
1021 return 0;
1022
1023eremove:
1024 sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group);
1025efree:
1026 kfree(data);
1027 return ret;
1028}
1029
1030static int adt7475_remove(struct i2c_client *client)
1031{
1032 struct adt7475_data *data = i2c_get_clientdata(client);
1033
1034 hwmon_device_unregister(data->hwmon_dev);
1035 sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group);
1036 kfree(data);
1037
1038 return 0;
1039}
1040
1041static struct i2c_driver adt7475_driver = {
1042 .class = I2C_CLASS_HWMON,
1043 .driver = {
1044 .name = "adt7475",
1045 },
1046 .probe = adt7475_probe,
1047 .remove = adt7475_remove,
1048 .id_table = adt7475_id,
1049 .detect = adt7475_detect,
1050 .address_data = &addr_data,
1051};
1052
1053static void adt7475_read_hystersis(struct i2c_client *client)
1054{
1055 struct adt7475_data *data = i2c_get_clientdata(client);
1056
1057 data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS);
1058 data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0];
1059 data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS);
1060}
1061
1062static void adt7475_read_pwm(struct i2c_client *client, int index)
1063{
1064 struct adt7475_data *data = i2c_get_clientdata(client);
1065 unsigned int v;
1066
1067 data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index));
1068
1069 /* Figure out the internal value for pwmctrl and pwmchan
1070 based on the current settings */
1071 v = (data->pwm[CONTROL][index] >> 5) & 7;
1072
1073 if (v == 3)
1074 data->pwmctl[index] = 0;
1075 else if (v == 7)
1076 data->pwmctl[index] = 1;
1077 else if (v == 4) {
1078 /* The fan is disabled - we don't want to
1079 support that, so change to manual mode and
1080 set the duty cycle to 0 instead
1081 */
1082 data->pwm[INPUT][index] = 0;
1083 data->pwm[CONTROL][index] &= ~0xE0;
1084 data->pwm[CONTROL][index] |= (7 << 5);
1085
1086 i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index),
1087 data->pwm[INPUT][index]);
1088
1089 i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index),
1090 data->pwm[CONTROL][index]);
1091
1092 data->pwmctl[index] = 1;
1093 } else {
1094 data->pwmctl[index] = 2;
1095
1096 switch (v) {
1097 case 0:
1098 data->pwmchan[index] = 1;
1099 break;
1100 case 1:
1101 data->pwmchan[index] = 2;
1102 break;
1103 case 2:
1104 data->pwmchan[index] = 4;
1105 break;
1106 case 5:
1107 data->pwmchan[index] = 6;
1108 break;
1109 case 6:
1110 data->pwmchan[index] = 7;
1111 break;
1112 }
1113 }
1114}
1115
1116static struct adt7475_data *adt7475_update_device(struct device *dev)
1117{
1118 struct i2c_client *client = to_i2c_client(dev);
1119 struct adt7475_data *data = i2c_get_clientdata(client);
1120 u8 ext;
1121 int i;
1122
1123 mutex_lock(&data->lock);
1124
1125 /* Measurement values update every 2 seconds */
1126 if (time_after(jiffies, data->measure_updated + HZ * 2) ||
1127 !data->valid) {
1128 data->alarms = adt7475_read(REG_STATUS2) << 8;
1129 data->alarms |= adt7475_read(REG_STATUS1);
1130
1131 ext = adt7475_read(REG_EXTEND1);
1132 for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++)
1133 data->voltage[INPUT][i] =
1134 (adt7475_read(VOLTAGE_REG(i)) << 2) |
1135 ((ext >> ((i + 1) * 2)) & 3);
1136
1137 ext = adt7475_read(REG_EXTEND2);
1138 for (i = 0; i < ADT7475_TEMP_COUNT; i++)
1139 data->temp[INPUT][i] =
1140 (adt7475_read(TEMP_REG(i)) << 2) |
1141 ((ext >> ((i + 1) * 2)) & 3);
1142
1143 for (i = 0; i < ADT7475_TACH_COUNT; i++)
1144 data->tach[INPUT][i] =
1145 adt7475_read_word(client, TACH_REG(i));
1146
1147 /* Updated by hw when in auto mode */
1148 for (i = 0; i < ADT7475_PWM_COUNT; i++)
1149 data->pwm[INPUT][i] = adt7475_read(PWM_REG(i));
1150
1151 data->measure_updated = jiffies;
1152 }
1153
1154 /* Limits and settings, should never change update every 60 seconds */
1155 if (time_after(jiffies, data->limits_updated + HZ * 2) ||
1156 !data->valid) {
1157 data->config5 = adt7475_read(REG_CONFIG5);
1158
1159 for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++) {
1160 /* Adjust values so they match the input precision */
1161 data->voltage[MIN][i] =
1162 adt7475_read(VOLTAGE_MIN_REG(i)) << 2;
1163 data->voltage[MAX][i] =
1164 adt7475_read(VOLTAGE_MAX_REG(i)) << 2;
1165 }
1166
1167 for (i = 0; i < ADT7475_TEMP_COUNT; i++) {
1168 /* Adjust values so they match the input precision */
1169 data->temp[MIN][i] =
1170 adt7475_read(TEMP_MIN_REG(i)) << 2;
1171 data->temp[MAX][i] =
1172 adt7475_read(TEMP_MAX_REG(i)) << 2;
1173 data->temp[AUTOMIN][i] =
1174 adt7475_read(TEMP_TMIN_REG(i)) << 2;
1175 data->temp[THERM][i] =
1176 adt7475_read(TEMP_THERM_REG(i)) << 2;
1177 data->temp[OFFSET][i] =
1178 adt7475_read(TEMP_OFFSET_REG(i));
1179 }
1180 adt7475_read_hystersis(client);
1181
1182 for (i = 0; i < ADT7475_TACH_COUNT; i++)
1183 data->tach[MIN][i] =
1184 adt7475_read_word(client, TACH_MIN_REG(i));
1185
1186 for (i = 0; i < ADT7475_PWM_COUNT; i++) {
1187 data->pwm[MAX][i] = adt7475_read(PWM_MAX_REG(i));
1188 data->pwm[MIN][i] = adt7475_read(PWM_MIN_REG(i));
1189 /* Set the channel and control information */
1190 adt7475_read_pwm(client, i);
1191 }
1192
1193 data->range[0] = adt7475_read(TEMP_TRANGE_REG(0));
1194 data->range[1] = adt7475_read(TEMP_TRANGE_REG(1));
1195 data->range[2] = adt7475_read(TEMP_TRANGE_REG(2));
1196
1197 data->limits_updated = jiffies;
1198 data->valid = 1;
1199 }
1200
1201 mutex_unlock(&data->lock);
1202
1203 return data;
1204}
1205
1206static int __init sensors_adt7475_init(void)
1207{
1208 return i2c_add_driver(&adt7475_driver);
1209}
1210
1211static void __exit sensors_adt7475_exit(void)
1212{
1213 i2c_del_driver(&adt7475_driver);
1214}
1215
1216MODULE_AUTHOR("Advanced Micro Devices, Inc");
1217MODULE_DESCRIPTION("adt7475 driver");
1218MODULE_LICENSE("GPL");
1219
1220module_init(sensors_adt7475_init);
1221module_exit(sensors_adt7475_exit);
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index dca47a591baf..e30186236588 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -590,6 +590,11 @@ static ssize_t applesmc_light_show(struct device *dev,
590 } 590 }
591 591
592 ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); 592 ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
593 /* newer macbooks report a single 10-bit bigendian value */
594 if (data_length == 10) {
595 left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
596 goto out;
597 }
593 left = buffer[2]; 598 left = buffer[2];
594 if (ret) 599 if (ret)
595 goto out; 600 goto out;
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index bf8d40580577..03705240000f 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007-2008 Yan Burman 4 * Copyright (C) 2007-2008 Yan Burman
5 * Copyright (C) 2008 Eric Piel 5 * Copyright (C) 2008 Eric Piel
6 * Copyright (C) 2008 Pavel Machek 6 * Copyright (C) 2008-2009 Pavel Machek
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@
36#include <linux/freezer.h> 36#include <linux/freezer.h>
37#include <linux/version.h> 37#include <linux/version.h>
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39#include <linux/leds.h>
39#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
40#include <asm/atomic.h> 41#include <asm/atomic.h>
41#include "lis3lv02d.h" 42#include "lis3lv02d.h"
@@ -43,6 +44,36 @@
43#define DRIVER_NAME "lis3lv02d" 44#define DRIVER_NAME "lis3lv02d"
44#define ACPI_MDPS_CLASS "accelerometer" 45#define ACPI_MDPS_CLASS "accelerometer"
45 46
47/* Delayed LEDs infrastructure ------------------------------------ */
48
49/* Special LED class that can defer work */
50struct delayed_led_classdev {
51 struct led_classdev led_classdev;
52 struct work_struct work;
53 enum led_brightness new_brightness;
54
55 unsigned int led; /* For driver */
56 void (*set_brightness)(struct delayed_led_classdev *data, enum led_brightness value);
57};
58
59static inline void delayed_set_status_worker(struct work_struct *work)
60{
61 struct delayed_led_classdev *data =
62 container_of(work, struct delayed_led_classdev, work);
63
64 data->set_brightness(data, data->new_brightness);
65}
66
67static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
68 enum led_brightness brightness)
69{
70 struct delayed_led_classdev *data = container_of(led_cdev,
71 struct delayed_led_classdev, led_classdev);
72 data->new_brightness = brightness;
73 schedule_work(&data->work);
74}
75
76/* HP-specific accelerometer driver ------------------------------------ */
46 77
47/* For automatic insertion of the module */ 78/* For automatic insertion of the module */
48static struct acpi_device_id lis3lv02d_device_ids[] = { 79static struct acpi_device_id lis3lv02d_device_ids[] = {
@@ -154,10 +185,33 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
154 */ 185 */
155}; 186};
156 187
188static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value)
189{
190 acpi_handle handle = adev.device->handle;
191 unsigned long long ret; /* Not used when writing */
192 union acpi_object in_obj[1];
193 struct acpi_object_list args = { 1, in_obj };
194
195 in_obj[0].type = ACPI_TYPE_INTEGER;
196 in_obj[0].integer.value = !!value;
197
198 acpi_evaluate_integer(handle, "ALED", &args, &ret);
199}
200
201static struct delayed_led_classdev hpled_led = {
202 .led_classdev = {
203 .name = "hp::hddprotect",
204 .default_trigger = "none",
205 .brightness_set = delayed_sysfs_set,
206 .flags = LED_CORE_SUSPENDRESUME,
207 },
208 .set_brightness = hpled_set,
209};
157 210
158static int lis3lv02d_add(struct acpi_device *device) 211static int lis3lv02d_add(struct acpi_device *device)
159{ 212{
160 u8 val; 213 u8 val;
214 int ret;
161 215
162 if (!device) 216 if (!device)
163 return -EINVAL; 217 return -EINVAL;
@@ -183,7 +237,19 @@ static int lis3lv02d_add(struct acpi_device *device)
183 adev.ac = lis3lv02d_axis_normal; 237 adev.ac = lis3lv02d_axis_normal;
184 } 238 }
185 239
186 return lis3lv02d_init_device(&adev); 240 INIT_WORK(&hpled_led.work, delayed_set_status_worker);
241 ret = led_classdev_register(NULL, &hpled_led.led_classdev);
242 if (ret)
243 return ret;
244
245 ret = lis3lv02d_init_device(&adev);
246 if (ret) {
247 flush_work(&hpled_led.work);
248 led_classdev_unregister(&hpled_led.led_classdev);
249 return ret;
250 }
251
252 return ret;
187} 253}
188 254
189static int lis3lv02d_remove(struct acpi_device *device, int type) 255static int lis3lv02d_remove(struct acpi_device *device, int type)
@@ -194,6 +260,9 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
194 lis3lv02d_joystick_disable(); 260 lis3lv02d_joystick_disable();
195 lis3lv02d_poweroff(device->handle); 261 lis3lv02d_poweroff(device->handle);
196 262
263 flush_work(&hpled_led.work);
264 led_classdev_unregister(&hpled_led.led_classdev);
265
197 return lis3lv02d_remove_fs(); 266 return lis3lv02d_remove_fs();
198} 267}
199 268
@@ -256,7 +325,7 @@ static void __exit lis3lv02d_exit_module(void)
256 acpi_bus_unregister_driver(&lis3lv02d_driver); 325 acpi_bus_unregister_driver(&lis3lv02d_driver);
257} 326}
258 327
259MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS"); 328MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED.");
260MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); 329MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
261MODULE_LICENSE("GPL"); 330MODULE_LICENSE("GPL");
262 331
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index bd2bde0ef95e..1fe995111841 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -31,6 +31,7 @@
31#include <linux/hwmon-sysfs.h> 31#include <linux/hwmon-sysfs.h>
32#include <linux/err.h> 32#include <linux/err.h>
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <asm/processor.h>
34 35
35#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) 36#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000)
36#define REG_TEMP 0xe4 37#define REG_TEMP 0xe4
@@ -47,6 +48,8 @@ struct k8temp_data {
47 /* registers values */ 48 /* registers values */
48 u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ 49 u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */
49 u32 temp[2][2]; /* core, place */ 50 u32 temp[2][2]; /* core, place */
51 u8 swap_core_select; /* meaning of SEL_CORE is inverted */
52 u32 temp_offset;
50}; 53};
51 54
52static struct k8temp_data *k8temp_update_device(struct device *dev) 55static struct k8temp_data *k8temp_update_device(struct device *dev)
@@ -114,10 +117,15 @@ static ssize_t show_temp(struct device *dev,
114 to_sensor_dev_attr_2(devattr); 117 to_sensor_dev_attr_2(devattr);
115 int core = attr->nr; 118 int core = attr->nr;
116 int place = attr->index; 119 int place = attr->index;
120 int temp;
117 struct k8temp_data *data = k8temp_update_device(dev); 121 struct k8temp_data *data = k8temp_update_device(dev);
118 122
119 return sprintf(buf, "%d\n", 123 if (data->swap_core_select)
120 TEMP_FROM_REG(data->temp[core][place])); 124 core = core ? 0 : 1;
125
126 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
127
128 return sprintf(buf, "%d\n", temp);
121} 129}
122 130
123/* core, place */ 131/* core, place */
@@ -141,20 +149,49 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
141 int err; 149 int err;
142 u8 scfg; 150 u8 scfg;
143 u32 temp; 151 u32 temp;
152 u8 model, stepping;
144 struct k8temp_data *data; 153 struct k8temp_data *data;
145 u32 cpuid = cpuid_eax(1);
146
147 /* this feature should be available since SH-C0 core */
148 if ((cpuid == 0xf40) || (cpuid == 0xf50) || (cpuid == 0xf51)) {
149 err = -ENODEV;
150 goto exit;
151 }
152 154
153 if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { 155 if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) {
154 err = -ENOMEM; 156 err = -ENOMEM;
155 goto exit; 157 goto exit;
156 } 158 }
157 159
160 model = boot_cpu_data.x86_model;
161 stepping = boot_cpu_data.x86_mask;
162
163 switch (boot_cpu_data.x86) {
164 case 0xf:
165 /* feature available since SH-C0, exclude older revisions */
166 if (((model == 4) && (stepping == 0)) ||
167 ((model == 5) && (stepping <= 1))) {
168 err = -ENODEV;
169 goto exit_free;
170 }
171
172 /*
173 * AMD NPT family 0fh, i.e. RevF and RevG:
174 * meaning of SEL_CORE bit is inverted
175 */
176 if (model >= 0x40) {
177 data->swap_core_select = 1;
178 dev_warn(&pdev->dev, "Temperature readouts might be "
179 "wrong - check erratum #141\n");
180 }
181
182 if ((model >= 0x69) &&
183 !(model == 0xc1 || model == 0x6c || model == 0x7c)) {
184 /*
185 * RevG desktop CPUs (i.e. no socket S1G1 parts)
186 * need additional offset, otherwise reported
187 * temperature is below ambient temperature
188 */
189 data->temp_offset = 21000;
190 }
191
192 break;
193 }
194
158 pci_read_config_byte(pdev, REG_TEMP, &scfg); 195 pci_read_config_byte(pdev, REG_TEMP, &scfg);
159 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ 196 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
160 pci_write_config_byte(pdev, REG_TEMP, scfg); 197 pci_write_config_byte(pdev, REG_TEMP, scfg);
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 59c3d23f5bdc..b9bef04b7be4 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -139,15 +139,4 @@ config SENSORS_TSL2550
139 This driver can also be built as a module. If so, the module 139 This driver can also be built as a module. If so, the module
140 will be called tsl2550. 140 will be called tsl2550.
141 141
142config MCU_MPC8349EMITX
143 tristate "MPC8349E-mITX MCU driver"
144 depends on I2C && PPC_83xx
145 select GENERIC_GPIO
146 select ARCH_REQUIRE_GPIOLIB
147 help
148 Say Y here to enable soft power-off functionality on the Freescale
149 boards with the MPC8349E-mITX-compatible MCU chips. This driver will
150 also register MCU GPIOs with the generic GPIO API, so you'll able
151 to use MCU pins as GPIOs.
152
153endmenu 142endmenu
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 83accaaf8164..00fcb5193ac2 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
19obj-$(CONFIG_PCF8575) += pcf8575.o 19obj-$(CONFIG_PCF8575) += pcf8575.o
20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
21obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 21obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
22obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
23 22
24ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) 23ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
25EXTRA_CFLAGS += -DDEBUG 24EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 3f9503867e6b..b1c6f68d98ce 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -701,11 +701,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
701 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX 701 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX
702endchoice 702endchoice
703 703
704config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
705 int "Maximum transfer size (KB) per request (up to 128)"
706 default "128"
707 depends on BLK_DEV_IDE_AU1XXX
708
709config BLK_DEV_IDE_TX4938 704config BLK_DEV_IDE_TX4938
710 tristate "TX4938 internal IDE support" 705 tristate "TX4938 internal IDE support"
711 depends on SOC_TX4938 706 depends on SOC_TX4938
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 4088a622873e..806760d24cef 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -633,7 +633,7 @@ static void ide_disk_setup(ide_drive_t *drive)
633 printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, 633 printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name,
634 q->max_sectors / 2); 634 q->max_sectors / 2);
635 635
636 if (ata_id_is_ssd(id) || ata_id_is_cfa(id)) 636 if (ata_id_is_ssd(id))
637 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); 637 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
638 638
639 /* calculate drive capacity, and select LBA if possible */ 639 /* calculate drive capacity, and select LBA if possible */
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index e728cfe7273f..753b92ebe0ae 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -493,7 +493,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti
493 stat = tp_ops->read_status(hwif); 493 stat = tp_ops->read_status(hwif);
494 494
495 if (stat & ATA_BUSY) { 495 if (stat & ATA_BUSY) {
496 local_irq_save(flags); 496 local_save_flags(flags);
497 local_irq_enable_in_hardirq(); 497 local_irq_enable_in_hardirq();
498 timeout += jiffies; 498 timeout += jiffies;
499 while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { 499 while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) {
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index 4b3bf6a06b70..60538d9c84ee 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -186,12 +186,10 @@ void ide_complete_pm_request(ide_drive_t *drive, struct request *rq)
186 blk_pm_suspend_request(rq) ? "suspend" : "resume"); 186 blk_pm_suspend_request(rq) ? "suspend" : "resume");
187#endif 187#endif
188 spin_lock_irqsave(q->queue_lock, flags); 188 spin_lock_irqsave(q->queue_lock, flags);
189 if (blk_pm_suspend_request(rq)) { 189 if (blk_pm_suspend_request(rq))
190 blk_stop_queue(q); 190 blk_stop_queue(q);
191 } else { 191 else
192 drive->dev_flags &= ~IDE_DFLAG_BLOCKED; 192 drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
193 blk_start_queue(q);
194 }
195 spin_unlock_irqrestore(q->queue_lock, flags); 193 spin_unlock_irqrestore(q->queue_lock, flags);
196 194
197 drive->hwif->rq = NULL; 195 drive->hwif->rq = NULL;
@@ -219,6 +217,8 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
219 * point. 217 * point.
220 */ 218 */
221 ide_hwif_t *hwif = drive->hwif; 219 ide_hwif_t *hwif = drive->hwif;
220 struct request_queue *q = drive->queue;
221 unsigned long flags;
222 int rc; 222 int rc;
223#ifdef DEBUG_PM 223#ifdef DEBUG_PM
224 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); 224 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name);
@@ -231,5 +231,9 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
231 rc = ide_wait_not_busy(hwif, 100000); 231 rc = ide_wait_not_busy(hwif, 100000);
232 if (rc) 232 if (rc)
233 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); 233 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
234
235 spin_lock_irqsave(q->queue_lock, flags);
236 blk_start_queue(q);
237 spin_unlock_irqrestore(q->queue_lock, flags);
234 } 238 }
235} 239}
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 0ccbb4459fb9..312127ea443a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -796,7 +796,7 @@ static int ide_probe_port(ide_hwif_t *hwif)
796 if (irqd) 796 if (irqd)
797 disable_irq(hwif->irq); 797 disable_irq(hwif->irq);
798 798
799 local_irq_save(flags); 799 local_save_flags(flags);
800 local_irq_enable_in_hardirq(); 800 local_irq_enable_in_hardirq();
801 801
802 if (ide_port_wait_ready(hwif) == -EBUSY) 802 if (ide_port_wait_ready(hwif) == -EBUSY)
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index 0be27ac1f077..e1c4f5437396 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -68,6 +68,8 @@
68 68
69#define DRV_NAME "it821x" 69#define DRV_NAME "it821x"
70 70
71#define QUIRK_VORTEX86 1
72
71struct it821x_dev 73struct it821x_dev
72{ 74{
73 unsigned int smart:1, /* Are we in smart raid mode */ 75 unsigned int smart:1, /* Are we in smart raid mode */
@@ -79,6 +81,7 @@ struct it821x_dev
79 u16 pio[2]; /* Cached PIO values */ 81 u16 pio[2]; /* Cached PIO values */
80 u16 mwdma[2]; /* Cached MWDMA values */ 82 u16 mwdma[2]; /* Cached MWDMA values */
81 u16 udma[2]; /* Cached UDMA values (per drive) */ 83 u16 udma[2]; /* Cached UDMA values (per drive) */
84 u16 quirks;
82}; 85};
83 86
84#define ATA_66 0 87#define ATA_66 0
@@ -557,8 +560,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
557 * this is necessary. 560 * this is necessary.
558 */ 561 */
559 562
560 pci_read_config_byte(dev, 0x08, &conf); 563 if (dev->revision == 0x10) {
561 if (conf == 0x10) {
562 idev->timing10 = 1; 564 idev->timing10 = 1;
563 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 565 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
564 if (idev->smart == 0) 566 if (idev->smart == 0)
@@ -577,6 +579,12 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
577 579
578 hwif->ultra_mask = ATA_UDMA6; 580 hwif->ultra_mask = ATA_UDMA6;
579 hwif->mwdma_mask = ATA_MWDMA2; 581 hwif->mwdma_mask = ATA_MWDMA2;
582
583 /* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */
584 if (idev->quirks & QUIRK_VORTEX86) {
585 if (dev->revision == 0x11)
586 hwif->ultra_mask = 0;
587 }
580} 588}
581 589
582static void it8212_disable_raid(struct pci_dev *dev) 590static void it8212_disable_raid(struct pci_dev *dev)
@@ -649,6 +657,8 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic
649 return -ENOMEM; 657 return -ENOMEM;
650 } 658 }
651 659
660 itdevs->quirks = id->driver_data;
661
652 rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); 662 rc = ide_pci_init_one(dev, &it821x_chipset, itdevs);
653 if (rc) 663 if (rc)
654 kfree(itdevs); 664 kfree(itdevs);
@@ -668,6 +678,7 @@ static void __devexit it821x_remove(struct pci_dev *dev)
668static const struct pci_device_id it821x_pci_tbl[] = { 678static const struct pci_device_id it821x_pci_tbl[] = {
669 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, 679 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 },
670 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, 680 { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 },
681 { PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1010), QUIRK_VORTEX86 },
671 { 0, }, 682 { 0, },
672}; 683};
673 684
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index 48cc748c5043..6297956507c0 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -310,10 +310,6 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = {
310 .dma_ops = &sl82c105_dma_ops, 310 .dma_ops = &sl82c105_dma_ops,
311 .host_flags = IDE_HFLAG_IO_32BIT | 311 .host_flags = IDE_HFLAG_IO_32BIT |
312 IDE_HFLAG_UNMASK_IRQS | 312 IDE_HFLAG_UNMASK_IRQS |
313/* FIXME: check for Compatibility mode in generic IDE PCI code */
314#if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT)
315 IDE_HFLAG_FORCE_LEGACY_IRQS |
316#endif
317 IDE_HFLAG_SERIALIZE_DMA | 313 IDE_HFLAG_SERIALIZE_DMA |
318 IDE_HFLAG_NO_AUTODMA, 314 IDE_HFLAG_NO_AUTODMA,
319 .pio_mask = ATA_PIO5, 315 .pio_mask = ATA_PIO5,
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index b4ef218072cd..d9095345f7ca 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -202,7 +202,6 @@ static const struct ide_tp_ops tx4938ide_tp_ops = {
202 .exec_command = ide_exec_command, 202 .exec_command = ide_exec_command,
203 .read_status = ide_read_status, 203 .read_status = ide_read_status,
204 .read_altstatus = ide_read_altstatus, 204 .read_altstatus = ide_read_altstatus,
205 .read_sff_dma_status = ide_read_sff_dma_status,
206 205
207 .set_irq = ide_set_irq, 206 .set_irq = ide_set_irq,
208 207
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c
index fecc0e03c3fc..703c3eeb20a8 100644
--- a/drivers/ide/via82cxxx.c
+++ b/drivers/ide/via82cxxx.c
@@ -432,8 +432,6 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
432 if (via_clock < 20000 || via_clock > 50000) { 432 if (via_clock < 20000 || via_clock > 50000) {
433 printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " 433 printk(KERN_WARNING DRV_NAME ": User given PCI clock speed "
434 "impossible (%d), using 33 MHz instead.\n", via_clock); 434 "impossible (%d), using 33 MHz instead.\n", via_clock);
435 printk(KERN_WARNING DRV_NAME ": Use ide0=ata66 if you want "
436 "to assume 80-wire cable.\n");
437 via_clock = 33333; 435 via_clock = 33333;
438 } 436 }
439 437
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 3b77b674cbf6..c7b8a506af65 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -955,7 +955,7 @@ void ehca_poll_eqs(unsigned long data)
955 struct ehca_eq *eq = &shca->eq; 955 struct ehca_eq *eq = &shca->eq;
956 int max = 3; 956 int max = 3;
957 volatile u64 q_ofs, q_ofs2; 957 volatile u64 q_ofs, q_ofs2;
958 u64 flags; 958 unsigned long flags;
959 spin_lock_irqsave(&eq->spinlock, flags); 959 spin_lock_irqsave(&eq->spinlock, flags);
960 q_ofs = eq->ipz_queue.current_q_offset; 960 q_ofs = eq->ipz_queue.current_q_offset;
961 spin_unlock_irqrestore(&eq->spinlock, flags); 961 spin_unlock_irqrestore(&eq->spinlock, flags);
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index dcefe1fceb5c..61588bd273bd 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -543,14 +543,21 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
543{ 543{
544 static int mlx4_ib_version_printed; 544 static int mlx4_ib_version_printed;
545 struct mlx4_ib_dev *ibdev; 545 struct mlx4_ib_dev *ibdev;
546 int num_ports = 0;
546 int i; 547 int i;
547 548
548
549 if (!mlx4_ib_version_printed) { 549 if (!mlx4_ib_version_printed) {
550 printk(KERN_INFO "%s", mlx4_ib_version); 550 printk(KERN_INFO "%s", mlx4_ib_version);
551 ++mlx4_ib_version_printed; 551 ++mlx4_ib_version_printed;
552 } 552 }
553 553
554 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
555 num_ports++;
556
557 /* No point in registering a device with no ports... */
558 if (num_ports == 0)
559 return NULL;
560
554 ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); 561 ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev);
555 if (!ibdev) { 562 if (!ibdev) {
556 dev_err(&dev->pdev->dev, "Device struct alloc failed\n"); 563 dev_err(&dev->pdev->dev, "Device struct alloc failed\n");
@@ -574,9 +581,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
574 ibdev->ib_dev.owner = THIS_MODULE; 581 ibdev->ib_dev.owner = THIS_MODULE;
575 ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; 582 ibdev->ib_dev.node_type = RDMA_NODE_IB_CA;
576 ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; 583 ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey;
577 ibdev->num_ports = 0; 584 ibdev->num_ports = num_ports;
578 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
579 ibdev->num_ports++;
580 ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; 585 ibdev->ib_dev.phys_port_cnt = ibdev->num_ports;
581 ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; 586 ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors;
582 ibdev->ib_dev.dma_device = &dev->pdev->dev; 587 ibdev->ib_dev.dma_device = &dev->pdev->dev;
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 6ba57e91d7ab..a01b4488208b 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -778,12 +778,13 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,
778 unsigned long flags; 778 unsigned long flags;
779 struct list_head *hte; 779 struct list_head *hte;
780 struct nes_cm_node *cm_node; 780 struct nes_cm_node *cm_node;
781 __be32 tmp_addr = cpu_to_be32(loc_addr);
781 782
782 /* get a handle on the hte */ 783 /* get a handle on the hte */
783 hte = &cm_core->connected_nodes; 784 hte = &cm_core->connected_nodes;
784 785
785 nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n", 786 nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n",
786 &loc_addr, loc_port, cm_core, hte); 787 &tmp_addr, loc_port, cm_core, hte);
787 788
788 /* walk list and find cm_node associated with this session ID */ 789 /* walk list and find cm_node associated with this session ID */
789 spin_lock_irqsave(&cm_core->ht_lock, flags); 790 spin_lock_irqsave(&cm_core->ht_lock, flags);
@@ -816,6 +817,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
816{ 817{
817 unsigned long flags; 818 unsigned long flags;
818 struct nes_cm_listener *listen_node; 819 struct nes_cm_listener *listen_node;
820 __be32 tmp_addr = cpu_to_be32(dst_addr);
819 821
820 /* walk list and find cm_node associated with this session ID */ 822 /* walk list and find cm_node associated with this session ID */
821 spin_lock_irqsave(&cm_core->listen_list_lock, flags); 823 spin_lock_irqsave(&cm_core->listen_list_lock, flags);
@@ -833,7 +835,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
833 spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); 835 spin_unlock_irqrestore(&cm_core->listen_list_lock, flags);
834 836
835 nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n", 837 nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n",
836 &dst_addr, dst_port); 838 &tmp_addr, dst_port);
837 839
838 /* no listener */ 840 /* no listener */
839 return NULL; 841 return NULL;
@@ -2059,6 +2061,7 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
2059 struct tcphdr *tcph; 2061 struct tcphdr *tcph;
2060 struct nes_cm_info nfo; 2062 struct nes_cm_info nfo;
2061 int skb_handled = 1; 2063 int skb_handled = 1;
2064 __be32 tmp_daddr, tmp_saddr;
2062 2065
2063 if (!skb) 2066 if (!skb)
2064 return 0; 2067 return 0;
@@ -2074,8 +2077,11 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
2074 nfo.rem_addr = ntohl(iph->saddr); 2077 nfo.rem_addr = ntohl(iph->saddr);
2075 nfo.rem_port = ntohs(tcph->source); 2078 nfo.rem_port = ntohs(tcph->source);
2076 2079
2080 tmp_daddr = cpu_to_be32(iph->daddr);
2081 tmp_saddr = cpu_to_be32(iph->saddr);
2082
2077 nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n", 2083 nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n",
2078 &iph->daddr, tcph->dest, &iph->saddr, tcph->source); 2084 &tmp_daddr, tcph->dest, &tmp_saddr, tcph->source);
2079 2085
2080 do { 2086 do {
2081 cm_node = find_node(cm_core, 2087 cm_node = find_node(cm_core,
diff --git a/drivers/infiniband/hw/nes/nes_utils.c b/drivers/infiniband/hw/nes/nes_utils.c
index aa9b7348c728..6f3bc1b6bf22 100644
--- a/drivers/infiniband/hw/nes/nes_utils.c
+++ b/drivers/infiniband/hw/nes/nes_utils.c
@@ -655,6 +655,7 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
655 struct nes_adapter *nesadapter = nesdev->nesadapter; 655 struct nes_adapter *nesadapter = nesdev->nesadapter;
656 int arp_index; 656 int arp_index;
657 int err = 0; 657 int err = 0;
658 __be32 tmp_addr;
658 659
659 for (arp_index = 0; (u32) arp_index < nesadapter->arp_table_size; arp_index++) { 660 for (arp_index = 0; (u32) arp_index < nesadapter->arp_table_size; arp_index++) {
660 if (nesadapter->arp_table[arp_index].ip_addr == ip_addr) 661 if (nesadapter->arp_table[arp_index].ip_addr == ip_addr)
@@ -682,8 +683,9 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
682 683
683 /* DELETE or RESOLVE */ 684 /* DELETE or RESOLVE */
684 if (arp_index == nesadapter->arp_table_size) { 685 if (arp_index == nesadapter->arp_table_size) {
686 tmp_addr = cpu_to_be32(ip_addr);
685 nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n", 687 nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n",
686 &ip_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete"); 688 &tmp_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete");
687 return -1; 689 return -1;
688 } 690 }
689 691
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 19e06bc38b39..dce0443f9d69 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -711,26 +711,26 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
711 711
712 neigh = *to_ipoib_neigh(skb->dst->neighbour); 712 neigh = *to_ipoib_neigh(skb->dst->neighbour);
713 713
714 if (neigh->ah) 714 if (unlikely((memcmp(&neigh->dgid.raw,
715 if (unlikely((memcmp(&neigh->dgid.raw, 715 skb->dst->neighbour->ha + 4,
716 skb->dst->neighbour->ha + 4, 716 sizeof(union ib_gid))) ||
717 sizeof(union ib_gid))) || 717 (neigh->dev != dev))) {
718 (neigh->dev != dev))) { 718 spin_lock_irqsave(&priv->lock, flags);
719 spin_lock_irqsave(&priv->lock, flags); 719 /*
720 /* 720 * It's safe to call ipoib_put_ah() inside
721 * It's safe to call ipoib_put_ah() inside 721 * priv->lock here, because we know that
722 * priv->lock here, because we know that 722 * path->ah will always hold one more reference,
723 * path->ah will always hold one more reference, 723 * so ipoib_put_ah() will never do more than
724 * so ipoib_put_ah() will never do more than 724 * decrement the ref count.
725 * decrement the ref count. 725 */
726 */ 726 if (neigh->ah)
727 ipoib_put_ah(neigh->ah); 727 ipoib_put_ah(neigh->ah);
728 list_del(&neigh->list); 728 list_del(&neigh->list);
729 ipoib_neigh_free(dev, neigh); 729 ipoib_neigh_free(dev, neigh);
730 spin_unlock_irqrestore(&priv->lock, flags); 730 spin_unlock_irqrestore(&priv->lock, flags);
731 ipoib_path_lookup(skb, dev); 731 ipoib_path_lookup(skb, dev);
732 return NETDEV_TX_OK; 732 return NETDEV_TX_OK;
733 } 733 }
734 734
735 if (ipoib_cm_get(neigh)) { 735 if (ipoib_cm_get(neigh)) {
736 if (ipoib_cm_up(neigh)) { 736 if (ipoib_cm_up(neigh)) {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index a2eb3b9789eb..59d02e0b8df1 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -529,6 +529,9 @@ void ipoib_mcast_join_task(struct work_struct *work)
529 if (!priv->broadcast) { 529 if (!priv->broadcast) {
530 struct ipoib_mcast *broadcast; 530 struct ipoib_mcast *broadcast;
531 531
532 if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
533 return;
534
532 broadcast = ipoib_mcast_alloc(dev, 1); 535 broadcast = ipoib_mcast_alloc(dev, 1);
533 if (!broadcast) { 536 if (!broadcast) {
534 ipoib_warn(priv, "failed to allocate broadcast group\n"); 537 ipoib_warn(priv, "failed to allocate broadcast group\n");
diff --git a/drivers/infiniband/ulp/iser/Kconfig b/drivers/infiniband/ulp/iser/Kconfig
index 77dedba829e6..b411c51842da 100644
--- a/drivers/infiniband/ulp/iser/Kconfig
+++ b/drivers/infiniband/ulp/iser/Kconfig
@@ -1,6 +1,6 @@
1config INFINIBAND_ISER 1config INFINIBAND_ISER
2 tristate "iSCSI Extensions for RDMA (iSER)" 2 tristate "iSCSI Extensions for RDMA (iSER)"
3 depends on SCSI && INET 3 depends on SCSI && INET && INFINIBAND_ADDR_TRANS
4 select SCSI_ISCSI_ATTRS 4 select SCSI_ISCSI_ATTRS
5 ---help--- 5 ---help---
6 Support for the iSCSI Extensions for RDMA (iSER) Protocol 6 Support for the iSCSI Extensions for RDMA (iSER) Protocol
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index a4a1ae214630..742713611bc5 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -119,13 +119,6 @@ config LEDS_GPIO
119 outputs. To be useful the particular board must have LEDs 119 outputs. To be useful the particular board must have LEDs
120 and they must be connected to the GPIO lines. 120 and they must be connected to the GPIO lines.
121 121
122config LEDS_HP_DISK
123 tristate "LED Support for disk protection LED on HP notebooks"
124 depends on LEDS_CLASS && ACPI
125 help
126 This option enable support for disk protection LED, found on
127 newer HP notebooks.
128
129config LEDS_CLEVO_MAIL 122config LEDS_CLEVO_MAIL
130 tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" 123 tristate "Mail LED on Clevo notebook (EXPERIMENTAL)"
131 depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL 124 depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index bc247cb02e82..9d76f0f160a4 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
23obj-$(CONFIG_LEDS_FSG) += leds-fsg.o 23obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
24obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o 24obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
25obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o 25obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
26obj-$(CONFIG_LEDS_HP_DISK) += leds-hp-disk.o
27obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o 26obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
28 27
29# LED Triggers 28# LED Triggers
diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c
deleted file mode 100644
index d786adc8c5e3..000000000000
--- a/drivers/leds/leds-hp-disk.c
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * leds-hp-disk.c - driver for HP "hard disk protection" LED
3 *
4 * Copyright (C) 2008 Pavel Machek
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/dmi.h>
24#include <linux/module.h>
25#include <linux/types.h>
26#include <linux/platform_device.h>
27#include <linux/interrupt.h>
28#include <linux/input.h>
29#include <linux/kthread.h>
30#include <linux/leds.h>
31#include <acpi/acpi_drivers.h>
32
33#define DRIVER_NAME "leds-hp-disk"
34#define ACPI_MDPS_CLASS "led"
35
36/* For automatic insertion of the module */
37static struct acpi_device_id hpled_device_ids[] = {
38 {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
39 {"", 0},
40};
41MODULE_DEVICE_TABLE(acpi, hpled_device_ids);
42
43struct acpi_hpled {
44 struct acpi_device *device; /* The ACPI device */
45};
46
47static struct acpi_hpled adev;
48
49static acpi_status hpled_acpi_write(acpi_handle handle, int reg)
50{
51 unsigned long long ret; /* Not used when writing */
52 union acpi_object in_obj[1];
53 struct acpi_object_list args = { 1, in_obj };
54
55 in_obj[0].type = ACPI_TYPE_INTEGER;
56 in_obj[0].integer.value = reg;
57
58 return acpi_evaluate_integer(handle, "ALED", &args, &ret);
59}
60
61static void hpled_set(struct led_classdev *led_cdev,
62 enum led_brightness value)
63{
64 hpled_acpi_write(adev.device->handle, !!value);
65}
66
67static struct led_classdev hpled_led = {
68 .name = "hp:red:hddprotection",
69 .default_trigger = "heartbeat",
70 .brightness_set = hpled_set,
71 .flags = LED_CORE_SUSPENDRESUME,
72};
73
74static int hpled_add(struct acpi_device *device)
75{
76 int ret;
77
78 if (!device)
79 return -EINVAL;
80
81 adev.device = device;
82 strcpy(acpi_device_name(device), DRIVER_NAME);
83 strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);
84 device->driver_data = &adev;
85
86 ret = led_classdev_register(NULL, &hpled_led);
87 return ret;
88}
89
90static int hpled_remove(struct acpi_device *device, int type)
91{
92 if (!device)
93 return -EINVAL;
94
95 led_classdev_unregister(&hpled_led);
96 return 0;
97}
98
99
100
101static struct acpi_driver leds_hp_driver = {
102 .name = DRIVER_NAME,
103 .class = ACPI_MDPS_CLASS,
104 .ids = hpled_device_ids,
105 .ops = {
106 .add = hpled_add,
107 .remove = hpled_remove,
108 }
109};
110
111static int __init hpled_init_module(void)
112{
113 int ret;
114
115 if (acpi_disabled)
116 return -ENODEV;
117
118 ret = acpi_bus_register_driver(&leds_hp_driver);
119 if (ret < 0)
120 return ret;
121
122 printk(KERN_INFO DRIVER_NAME " driver loaded.\n");
123
124 return 0;
125}
126
127static void __exit hpled_exit_module(void)
128{
129 acpi_bus_unregister_driver(&leds_hp_driver);
130}
131
132MODULE_DESCRIPTION("Driver for HP disk protection LED");
133MODULE_AUTHOR("Pavel Machek <pavel@suse.cz>");
134MODULE_LICENSE("GPL");
135
136module_init(hpled_init_module);
137module_exit(hpled_exit_module);
diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h
index 10b6ef758725..11c0f461320e 100644
--- a/drivers/message/fusion/lsi/mpi.h
+++ b/drivers/message/fusion/lsi/mpi.h
@@ -6,7 +6,7 @@
6 * Title: MPI Message independent structures and definitions 6 * Title: MPI Message independent structures and definitions
7 * Creation Date: July 27, 2000 7 * Creation Date: July 27, 2000
8 * 8 *
9 * mpi.h Version: 01.05.13 9 * mpi.h Version: 01.05.16
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -79,6 +79,9 @@
79 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. 79 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
80 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. 80 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT.
81 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. 81 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT.
82 * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT.
83 * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT.
84 * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT.
82 * -------------------------------------------------------------------------- 85 * --------------------------------------------------------------------------
83 */ 86 */
84 87
@@ -109,7 +112,7 @@
109/* Note: The major versions of 0xe0 through 0xff are reserved */ 112/* Note: The major versions of 0xe0 through 0xff are reserved */
110 113
111/* versioning for this MPI header set */ 114/* versioning for this MPI header set */
112#define MPI_HEADER_VERSION_UNIT (0x10) 115#define MPI_HEADER_VERSION_UNIT (0x13)
113#define MPI_HEADER_VERSION_DEV (0x00) 116#define MPI_HEADER_VERSION_DEV (0x00)
114#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) 117#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00)
115#define MPI_HEADER_VERSION_UNIT_SHIFT (8) 118#define MPI_HEADER_VERSION_UNIT_SHIFT (8)
diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h b/drivers/message/fusion/lsi/mpi_cnfg.h
index b2db3330c591..013c7d881948 100644
--- a/drivers/message/fusion/lsi/mpi_cnfg.h
+++ b/drivers/message/fusion/lsi/mpi_cnfg.h
@@ -6,7 +6,7 @@
6 * Title: MPI Config message, structures, and Pages 6 * Title: MPI Config message, structures, and Pages
7 * Creation Date: July 27, 2000 7 * Creation Date: July 27, 2000
8 * 8 *
9 * mpi_cnfg.h Version: 01.05.15 9 * mpi_cnfg.h Version: 01.05.18
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -308,6 +308,20 @@
308 * Expander Page 0 Flags field. 308 * Expander Page 0 Flags field.
309 * Fixed define for 309 * Fixed define for
310 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. 310 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
311 * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
312 * define.
313 * Added BIOS Page 4 structure.
314 * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
315 * Physcial Disk Page 1.
316 * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of
317 * Manufacturing Page 4.
318 * Added Solid State Drives Supported bit to IOC Page 6
319 * Capabilities Flags.
320 * Added new value for AccessStatus field of SAS Device
321 * Page 0 (_SATA_NEEDS_INITIALIZATION).
322 * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field
323 * to control coercion size and the mixing of SAS and SATA
324 * SSD drives.
311 * -------------------------------------------------------------------------- 325 * --------------------------------------------------------------------------
312 */ 326 */
313 327
@@ -686,6 +700,14 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_4
686#define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01) 700#define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA (0x01)
687 701
688/* defines for the ExtFlags field */ 702/* defines for the ExtFlags field */
703#define MPI_MANPAGE4_EXTFLAGS_MASK_COERCION_SIZE (0x0180)
704#define MPI_MANPAGE4_EXTFLAGS_SHIFT_COERCION_SIZE (7)
705#define MPI_MANPAGE4_EXTFLAGS_1GB_COERCION_SIZE (0)
706#define MPI_MANPAGE4_EXTFLAGS_128MB_COERCION_SIZE (1)
707
708#define MPI_MANPAGE4_EXTFLAGS_NO_MIX_SSD_SAS_SATA (0x0040)
709#define MPI_MANPAGE4_EXTFLAGS_MIX_SSD_AND_NON_SSD (0x0020)
710#define MPI_MANPAGE4_EXTFLAGS_DUAL_PORT_SUPPORT (0x0010)
689#define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008) 711#define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA (0x0008)
690#define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004) 712#define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE (0x0004)
691#define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002) 713#define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE (0x0002)
@@ -1159,6 +1181,8 @@ typedef struct _CONFIG_PAGE_IOC_6
1159 1181
1160/* IOC Page 6 Capabilities Flags */ 1182/* IOC Page 6 Capabilities Flags */
1161 1183
1184#define MPI_IOCPAGE6_CAP_FLAGS_SSD_SUPPORT (0x00000020)
1185#define MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT (0x00000010)
1162#define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008) 1186#define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING (0x00000008)
1163 1187
1164#define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006) 1188#define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE (0x00000006)
@@ -1428,6 +1452,15 @@ typedef struct _CONFIG_PAGE_BIOS_2
1428#define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05) 1452#define MPI_BIOSPAGE2_FORM_SAS_WWN (0x05)
1429#define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06) 1453#define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT (0x06)
1430 1454
1455typedef struct _CONFIG_PAGE_BIOS_4
1456{
1457 CONFIG_PAGE_HEADER Header; /* 00h */
1458 U64 ReassignmentBaseWWID; /* 04h */
1459} CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4,
1460 BIOSPage4_t, MPI_POINTER pBIOSPage4_t;
1461
1462#define MPI_BIOSPAGE4_PAGEVERSION (0x00)
1463
1431 1464
1432/**************************************************************************** 1465/****************************************************************************
1433* SCSI Port Config Pages 1466* SCSI Port Config Pages
@@ -2419,6 +2452,15 @@ typedef struct _RAID_PHYS_DISK1_PATH
2419#define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002) 2452#define MPI_RAID_PHYSDISK1_FLAG_BROKEN (0x0002)
2420#define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001) 2453#define MPI_RAID_PHYSDISK1_FLAG_INVALID (0x0001)
2421 2454
2455
2456/*
2457 * Host code (drivers, BIOS, utilities, etc.) should leave this define set to
2458 * one and check Header.PageLength or NumPhysDiskPaths at runtime.
2459 */
2460#ifndef MPI_RAID_PHYS_DISK1_PATH_MAX
2461#define MPI_RAID_PHYS_DISK1_PATH_MAX (1)
2462#endif
2463
2422typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1 2464typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
2423{ 2465{
2424 CONFIG_PAGE_HEADER Header; /* 00h */ 2466 CONFIG_PAGE_HEADER Header; /* 00h */
@@ -2426,7 +2468,7 @@ typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
2426 U8 PhysDiskNum; /* 05h */ 2468 U8 PhysDiskNum; /* 05h */
2427 U16 Reserved2; /* 06h */ 2469 U16 Reserved2; /* 06h */
2428 U32 Reserved1; /* 08h */ 2470 U32 Reserved1; /* 08h */
2429 RAID_PHYS_DISK1_PATH Path[1]; /* 0Ch */ 2471 RAID_PHYS_DISK1_PATH Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */
2430} CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1, 2472} CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1,
2431 RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t; 2473 RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t;
2432 2474
@@ -2844,6 +2886,7 @@ typedef struct _CONFIG_PAGE_SAS_DEVICE_0
2844#define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01) 2886#define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED (0x01)
2845#define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02) 2887#define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED (0x02)
2846#define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03) 2888#define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT (0x03)
2889#define MPI_SAS_DEVICE0_ASTATUS_SATA_NEEDS_INITIALIZATION (0x04)
2847/* specific values for SATA Init failures */ 2890/* specific values for SATA Init failures */
2848#define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10) 2891#define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN (0x10)
2849#define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11) 2892#define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT (0x11)
diff --git a/drivers/message/fusion/lsi/mpi_fc.h b/drivers/message/fusion/lsi/mpi_fc.h
index 627acfbb8623..7d663ce76f8c 100644
--- a/drivers/message/fusion/lsi/mpi_fc.h
+++ b/drivers/message/fusion/lsi/mpi_fc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_fc.h 5 * Name: mpi_fc.h
diff --git a/drivers/message/fusion/lsi/mpi_history.txt b/drivers/message/fusion/lsi/mpi_history.txt
index 3f15fcfe4a2e..693e4b511354 100644
--- a/drivers/message/fusion/lsi/mpi_history.txt
+++ b/drivers/message/fusion/lsi/mpi_history.txt
@@ -3,28 +3,28 @@
3 MPI Header File Change History 3 MPI Header File Change History
4 ============================== 4 ==============================
5 5
6 Copyright (c) 2000-2007 LSI Corporation. 6 Copyright (c) 2000-2008 LSI Corporation.
7 7
8 --------------------------------------- 8 ---------------------------------------
9 Header Set Release Version: 01.05.16 9 Header Set Release Version: 01.05.19
10 Header Set Release Date: 05-24-07 10 Header Set Release Date: 03-28-08
11 --------------------------------------- 11 ---------------------------------------
12 12
13 Filename Current version Prior version 13 Filename Current version Prior version
14 ---------- --------------- ------------- 14 ---------- --------------- -------------
15 mpi.h 01.05.13 01.05.12 15 mpi.h 01.05.16 01.05.15
16 mpi_ioc.h 01.05.14 01.05.13 16 mpi_ioc.h 01.05.16 01.05.15
17 mpi_cnfg.h 01.05.15 01.05.14 17 mpi_cnfg.h 01.05.18 01.05.17
18 mpi_init.h 01.05.09 01.05.09 18 mpi_init.h 01.05.09 01.05.09
19 mpi_targ.h 01.05.06 01.05.06 19 mpi_targ.h 01.05.06 01.05.06
20 mpi_fc.h 01.05.01 01.05.01 20 mpi_fc.h 01.05.01 01.05.01
21 mpi_lan.h 01.05.01 01.05.01 21 mpi_lan.h 01.05.01 01.05.01
22 mpi_raid.h 01.05.03 01.05.03 22 mpi_raid.h 01.05.05 01.05.05
23 mpi_tool.h 01.05.03 01.05.03 23 mpi_tool.h 01.05.03 01.05.03
24 mpi_inb.h 01.05.01 01.05.01 24 mpi_inb.h 01.05.01 01.05.01
25 mpi_sas.h 01.05.04 01.05.04 25 mpi_sas.h 01.05.05 01.05.05
26 mpi_type.h 01.05.02 01.05.02 26 mpi_type.h 01.05.02 01.05.02
27 mpi_history.txt 01.05.14 01.05.14 27 mpi_history.txt 01.05.19 01.05.18
28 28
29 29
30 * Date Version Description 30 * Date Version Description
@@ -96,6 +96,9 @@ mpi.h
96 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT. 96 * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
97 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT. 97 * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT.
98 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT. 98 * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT.
99 * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT.
100 * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT.
101 * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT.
99 * -------------------------------------------------------------------------- 102 * --------------------------------------------------------------------------
100 103
101mpi_ioc.h 104mpi_ioc.h
@@ -127,7 +130,7 @@ mpi_ioc.h
127 * 08-08-01 01.02.01 Original release for v1.2 work. 130 * 08-08-01 01.02.01 Original release for v1.2 work.
128 * New format for FWVersion and ProductId in 131 * New format for FWVersion and ProductId in
129 * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER. 132 * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER.
130 * 08-31-01 01.02.02 Added event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and 133 * 08-31-01 01.02.02 Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and
131 * related structure and defines. 134 * related structure and defines.
132 * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED. 135 * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED.
133 * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE. 136 * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE.
@@ -187,7 +190,7 @@ mpi_ioc.h
187 * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED. 190 * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED.
188 * Added MaxInitiators field to PortFacts reply. 191 * Added MaxInitiators field to PortFacts reply.
189 * Added SAS Device Status Change ReasonCode for 192 * Added SAS Device Status Change ReasonCode for
190 * asynchronous notification. 193 * asynchronous notificaiton.
191 * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event 194 * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event
192 * data structure. 195 * data structure.
193 * Added new ImageType values for FWDownload and FWUpload 196 * Added new ImageType values for FWDownload and FWUpload
@@ -199,6 +202,16 @@ mpi_ioc.h
199 * added _MULTI_PORT_DOMAIN. 202 * added _MULTI_PORT_DOMAIN.
200 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. 203 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request.
201 * Added Common Boot Block type to FWUpload Request. 204 * Added Common Boot Block type to FWUpload Request.
205 * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
206 * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
207 * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
208 * Added SASAddress field to SAS Initiator Device Table
209 * Overflow event data structure.
210 * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status
211 * Change Event data to indicate completion of internally
212 * generated task management.
213 * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
214 * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
202 * -------------------------------------------------------------------------- 215 * --------------------------------------------------------------------------
203 216
204mpi_cnfg.h 217mpi_cnfg.h
@@ -213,7 +226,7 @@ mpi_cnfg.h
213 * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1 226 * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1
214 * page and updated the page version. 227 * page and updated the page version.
215 * Added Information field and _INFO_PARAMS_NEGOTIATED 228 * Added Information field and _INFO_PARAMS_NEGOTIATED
216 * definition to SCSI_DEVICE_0 page. 229 * definitionto SCSI_DEVICE_0 page.
217 * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the 230 * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the
218 * page version. 231 * page version.
219 * Added BucketsRemaining to LAN_1 page, redefined the 232 * Added BucketsRemaining to LAN_1 page, redefined the
@@ -496,6 +509,20 @@ mpi_cnfg.h
496 * Expander Page 0 Flags field. 509 * Expander Page 0 Flags field.
497 * Fixed define for 510 * Fixed define for
498 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED. 511 * MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
512 * 08-07-07 01.05.16 Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
513 * define.
514 * Added BIOS Page 4 structure.
515 * Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
516 * Physcial Disk Page 1.
517 * 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of
518 * Manufacturing Page 4.
519 * Added Solid State Drives Supported bit to IOC Page 6
520 * Capabilities Flags.
521 * Added new value for AccessStatus field of SAS Device
522 * Page 0 (_SATA_NEEDS_INITIALIZATION).
523 * 03-28-08 01.05.18 Defined new bits in Manufacturing Page 4 ExtFlags field
524 * to control coercion size and the mixing of SAS and SATA
525 * SSD drives.
499 * -------------------------------------------------------------------------- 526 * --------------------------------------------------------------------------
500 527
501mpi_init.h 528mpi_init.h
@@ -661,6 +688,9 @@ mpi_raid.h
661 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. 688 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
662 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and 689 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and
663 * associated defines. 690 * associated defines.
691 * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord
692 * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
693 * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
664 * -------------------------------------------------------------------------- 694 * --------------------------------------------------------------------------
665 695
666mpi_tool.h 696mpi_tool.h
@@ -694,6 +724,10 @@ mpi_sas.h
694 * reply. 724 * reply.
695 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO 725 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO
696 * Unit Control request. 726 * Unit Control request.
727 * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
728 * including adding IOCParameter and IOCParameter value
729 * fields to SAS IO Unit Control Request.
730 * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
697 * -------------------------------------------------------------------------- 731 * --------------------------------------------------------------------------
698 732
699mpi_type.h 733mpi_type.h
@@ -709,20 +743,20 @@ mpi_type.h
709 743
710mpi_history.txt Parts list history 744mpi_history.txt Parts list history
711 745
712Filename 01.05.15 01.05.15 746Filename 01.05.19 01.05.18 01.05.17 01.05.16 01.05.15
713---------- -------- -------- 747---------- -------- -------- -------- -------- --------
714mpi.h 01.05.12 01.05.13 748mpi.h 01.05.16 01.05.15 01.05.14 01.05.13 01.05.12
715mpi_ioc.h 01.05.13 01.05.14 749mpi_ioc.h 01.05.16 01.05.15 01.05.15 01.05.14 01.05.13
716mpi_cnfg.h 01.05.14 01.05.15 750mpi_cnfg.h 01.05.18 01.05.17 01.05.16 01.05.15 01.05.14
717mpi_init.h 01.05.09 01.05.09 751mpi_init.h 01.05.09 01.05.09 01.05.09 01.05.09 01.05.09
718mpi_targ.h 01.05.06 01.05.06 752mpi_targ.h 01.05.06 01.05.06 01.05.06 01.05.06 01.05.06
719mpi_fc.h 01.05.01 01.05.01 753mpi_fc.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
720mpi_lan.h 01.05.01 01.05.01 754mpi_lan.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
721mpi_raid.h 01.05.03 01.05.03 755mpi_raid.h 01.05.05 01.05.05 01.05.04 01.05.03 01.05.03
722mpi_tool.h 01.05.03 01.05.03 756mpi_tool.h 01.05.03 01.05.03 01.05.03 01.05.03 01.05.03
723mpi_inb.h 01.05.01 01.05.01 757mpi_inb.h 01.05.01 01.05.01 01.05.01 01.05.01 01.05.01
724mpi_sas.h 01.05.04 01.05.04 758mpi_sas.h 01.05.05 01.05.05 01.05.04 01.05.04 01.05.04
725mpi_type.h 01.05.02 01.05.02 759mpi_type.h 01.05.02 01.05.02 01.05.02 01.05.02 01.05.02
726 760
727Filename 01.05.14 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09 761Filename 01.05.14 01.05.13 01.05.12 01.05.11 01.05.10 01.05.09
728---------- -------- -------- -------- -------- -------- -------- 762---------- -------- -------- -------- -------- -------- --------
diff --git a/drivers/message/fusion/lsi/mpi_init.h b/drivers/message/fusion/lsi/mpi_init.h
index a9e3693601a7..4295d062caa7 100644
--- a/drivers/message/fusion/lsi/mpi_init.h
+++ b/drivers/message/fusion/lsi/mpi_init.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2007 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_init.h 5 * Name: mpi_init.h
diff --git a/drivers/message/fusion/lsi/mpi_ioc.h b/drivers/message/fusion/lsi/mpi_ioc.h
index 5cbb6bd048e1..8faa4fab7b89 100644
--- a/drivers/message/fusion/lsi/mpi_ioc.h
+++ b/drivers/message/fusion/lsi/mpi_ioc.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2000-2007 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_ioc.h 5 * Name: mpi_ioc.h
6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages 6 * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages
7 * Creation Date: August 11, 2000 7 * Creation Date: August 11, 2000
8 * 8 *
9 * mpi_ioc.h Version: 01.05.14 9 * mpi_ioc.h Version: 01.05.16
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -113,6 +113,16 @@
113 * added _MULTI_PORT_DOMAIN. 113 * added _MULTI_PORT_DOMAIN.
114 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. 114 * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request.
115 * Added Common Boot Block type to FWUpload Request. 115 * Added Common Boot Block type to FWUpload Request.
116 * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
117 * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
118 * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
119 * Added SASAddress field to SAS Initiator Device Table
120 * Overflow event data structure.
121 * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status
122 * Change Event data to indicate completion of internally
123 * generated task management.
124 * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
125 * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
116 * -------------------------------------------------------------------------- 126 * --------------------------------------------------------------------------
117 */ 127 */
118 128
@@ -612,6 +622,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE
612#define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) 622#define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B)
613#define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) 623#define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C)
614#define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) 624#define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D)
625#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET (0x0E)
626#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL (0x0F)
615 627
616 628
617/* SCSI Event data for Queue Full event */ 629/* SCSI Event data for Queue Full event */
@@ -708,6 +720,8 @@ typedef struct _MPI_EVENT_DATA_IR2
708#define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) 720#define MPI_EVENT_IR2_RC_PD_REMOVED (0x05)
709#define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) 721#define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06)
710#define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) 722#define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07)
723#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED (0x08)
724#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED (0x09)
711 725
712/* defines for logical disk states */ 726/* defines for logical disk states */
713#define MPI_LD_STATE_OPTIMAL (0x00) 727#define MPI_LD_STATE_OPTIMAL (0x00)
@@ -867,6 +881,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERROR
867#define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) 881#define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800)
868#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) 882#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000)
869#define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) 883#define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000)
884#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE (0x00004000)
870 885
871/* SAS SMP Error Event data */ 886/* SAS SMP Error Event data */
872 887
@@ -902,6 +917,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE
902 917
903/* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ 918/* defines for the ReasonCode field of the SAS Initiator Device Status Change event */
904#define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) 919#define MPI_EVENT_SAS_INIT_RC_ADDED (0x01)
920#define MPI_EVENT_SAS_INIT_RC_REMOVED (0x02)
921#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE (0x03)
905 922
906/* SAS Initiator Device Table Overflow Event data */ 923/* SAS Initiator Device Table Overflow Event data */
907 924
@@ -910,6 +927,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW
910 U8 MaxInit; /* 00h */ 927 U8 MaxInit; /* 00h */
911 U8 CurrentInit; /* 01h */ 928 U8 CurrentInit; /* 01h */
912 U16 Reserved1; /* 02h */ 929 U16 Reserved1; /* 02h */
930 U64 SASAddress; /* 04h */
913} EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, 931} EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
914 MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, 932 MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
915 MpiEventDataSasInitTableOverflow_t, 933 MpiEventDataSasInitTableOverflow_t,
diff --git a/drivers/message/fusion/lsi/mpi_lan.h b/drivers/message/fusion/lsi/mpi_lan.h
index 03253b53b785..f41fcb69b359 100644
--- a/drivers/message/fusion/lsi/mpi_lan.h
+++ b/drivers/message/fusion/lsi/mpi_lan.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_lan.h 5 * Name: mpi_lan.h
diff --git a/drivers/message/fusion/lsi/mpi_log_fc.h b/drivers/message/fusion/lsi/mpi_log_fc.h
index e4dafcefeecd..face6e7acc72 100644
--- a/drivers/message/fusion/lsi/mpi_log_fc.h
+++ b/drivers/message/fusion/lsi/mpi_log_fc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2001 LSI Corporation. All rights reserved. 2 * Copyright (c) 2000-2008 LSI Corporation. All rights reserved.
3 * 3 *
4 * NAME: fc_log.h 4 * NAME: fc_log.h
5 * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips 5 * SUMMARY: MPI IocLogInfo definitions for the SYMFC9xx chips
diff --git a/drivers/message/fusion/lsi/mpi_log_sas.h b/drivers/message/fusion/lsi/mpi_log_sas.h
index af9da03e95e5..691620dbedd2 100644
--- a/drivers/message/fusion/lsi/mpi_log_sas.h
+++ b/drivers/message/fusion/lsi/mpi_log_sas.h
@@ -1,6 +1,6 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * Copyright 2003 LSI Corporation. All rights reserved. * 3 * Copyright (c) 2000-2008 LSI Corporation. All rights reserved. *
4 * * 4 * *
5 * Description * 5 * Description *
6 * ------------ * 6 * ------------ *
@@ -73,6 +73,8 @@
73#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO (0x00070004) 73#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO (0x00070004)
74#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ (0x00070005) 74#define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ (0x00070005)
75 75
76#define IOP_LOGINFO_CODE_LOG_TIMESTAMP_EVENT (0x00080000)
77
76/****************************************************************************/ 78/****************************************************************************/
77/* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL */ 79/* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL */
78/****************************************************************************/ 80/****************************************************************************/
@@ -92,7 +94,7 @@
92#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP (0x0000000C) 94#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP (0x0000000C)
93#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D (0x0000000D) 95#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D (0x0000000D)
94#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL (0x0000000E) 96#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL (0x0000000E)
95#define PL_LOGINFO_SUB CODE_OPEN_FAIL_BAD_DEST (0x00000011) 97#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_BAD_DEST (0x00000011)
96#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP (0x00000012) 98#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP (0x00000012)
97#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP (0x00000013) 99#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP (0x00000013)
98#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0 (0x00000014) 100#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0 (0x00000014)
@@ -159,10 +161,11 @@
159 161
160#define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200) 162#define PL_LOGINFO_SUB_CODE_INVALID_SGL (0x00000200)
161#define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300) 163#define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH (0x00000300)
162#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */ 164#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400)
163 /* Bit 0 is Status Bit 0: FrameXferErr */ 165/* Bits 0-3 encode Transport Status Register (offset 0x08) */
164 /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ 166/* Bit 0 is Status Bit 0: FrameXferErr */
165 /* Bit 3 is Status Bit 18 WriteDataLengthGTDataLengthErr */ 167/* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
168/* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
166 169
167#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) 170#define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500)
168#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) 171#define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600)
@@ -177,6 +180,11 @@
177#define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01) 180#define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET (0x00000E01)
178#define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00) 181#define PL_LOGINFO_SUB_CODE_SECOND_OPEN (0x00000F00)
179#define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000) 182#define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT (0x00001000)
183#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION (0x00002000)
184/* not currently used in mainline */
185#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK (0x00003000)
186#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP (0x00004000)
187#define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD (0x00005000)
180 188
181#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */ 189#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */
182#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */ 190#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */
@@ -243,6 +251,8 @@
243#define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014) 251#define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED (0x00010014)
244/* Activation failed trying to import the volume */ 252/* Activation failed trying to import the volume */
245#define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015) 253#define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED (0x00010015)
254/* Activation failed trying to import the volume */
255#define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_PHYS_DISKS (0x00010016)
246 256
247/* Phys Disk failed, too many phys disks */ 257/* Phys Disk failed, too many phys disks */
248#define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020) 258#define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS (0x00010020)
@@ -285,6 +295,21 @@
285/* Compatibility Error : IME size limited to < 2TB */ 295/* Compatibility Error : IME size limited to < 2TB */
286#define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D) 296#define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D)
287 297
298/* Device Firmware Update: DFU can only be started once */
299#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DFU_IN_PROGRESS (0x00010050)
300/* Device Firmware Update: Volume must be Optimal/Active/non-Quiesced */
301#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DEVICE_IN_INVALID_STATE (0x00010051)
302/* Device Firmware Update: DFU Timeout cannot be zero */
303#define IR_LOGINFO_DEV_FW_UPDATE_ERR_INVALID_TIMEOUT (0x00010052)
304/* Device Firmware Update: CREATE TIMER FAILED */
305#define IR_LOGINFO_DEV_FW_UPDATE_ERR_NO_TIMERS (0x00010053)
306/* Device Firmware Update: Failed to read SAS_IO_UNIT_PG_1 */
307#define IR_LOGINFO_DEV_FW_UPDATE_ERR_READING_CFG_PAGE (0x00010054)
308/* Device Firmware Update: Invalid SAS_IO_UNIT_PG_1 value(s) */
309#define IR_LOGINFO_DEV_FW_UPDATE_ERR_PORT_IO_TIMEOUTS_REQUIRED (0x00010055)
310/* Device Firmware Update: Unable to allocate memory for page */
311#define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE (0x00010056)
312
288 313
289/****************************************************************************/ 314/****************************************************************************/
290/* Defines for convenience */ 315/* Defines for convenience */
diff --git a/drivers/message/fusion/lsi/mpi_raid.h b/drivers/message/fusion/lsi/mpi_raid.h
index 2856108421d7..add60cc85be1 100644
--- a/drivers/message/fusion/lsi/mpi_raid.h
+++ b/drivers/message/fusion/lsi/mpi_raid.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2001-2007 LSI Corporation. 2 * Copyright (c) 2001-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_raid.h 5 * Name: mpi_raid.h
6 * Title: MPI RAID message and structures 6 * Title: MPI RAID message and structures
7 * Creation Date: February 27, 2001 7 * Creation Date: February 27, 2001
8 * 8 *
9 * mpi_raid.h Version: 01.05.03 9 * mpi_raid.h Version: 01.05.05
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -34,6 +34,9 @@
34 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE. 34 * _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
35 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and 35 * 02-28-07 01.05.03 Added new RAID Action, Device FW Update Mode, and
36 * associated defines. 36 * associated defines.
37 * 08-07-07 01.05.04 Added Disable Full Rebuild bit to the ActionDataWord
38 * for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
39 * 01-15-08 01.05.05 Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
37 * -------------------------------------------------------------------------- 40 * --------------------------------------------------------------------------
38 */ 41 */
39 42
@@ -93,6 +96,7 @@ typedef struct _MSG_RAID_ACTION
93#define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13) 96#define MPI_RAID_ACTION_SET_RESYNC_RATE (0x13)
94#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14) 97#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE (0x14)
95#define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15) 98#define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE (0x15)
99#define MPI_RAID_ACTION_SET_VOLUME_NAME (0x16)
96 100
97/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */ 101/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
98#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001) 102#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC (0x00000001)
@@ -105,6 +109,9 @@ typedef struct _MSG_RAID_ACTION
105#define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) 109#define MPI_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000)
106#define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002) 110#define MPI_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000002)
107 111
112/* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
113#define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD (0x00000001)
114
108/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */ 115/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
109#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001) 116#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL (0x00000001)
110 117
diff --git a/drivers/message/fusion/lsi/mpi_sas.h b/drivers/message/fusion/lsi/mpi_sas.h
index 33fca83cefc2..ab410036bbfc 100644
--- a/drivers/message/fusion/lsi/mpi_sas.h
+++ b/drivers/message/fusion/lsi/mpi_sas.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2004-2006 LSI Corporation. 2 * Copyright (c) 2004-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_sas.h 5 * Name: mpi_sas.h
6 * Title: MPI Serial Attached SCSI structures and definitions 6 * Title: MPI Serial Attached SCSI structures and definitions
7 * Creation Date: August 19, 2004 7 * Creation Date: August 19, 2004
8 * 8 *
9 * mpi_sas.h Version: 01.05.04 9 * mpi_sas.h Version: 01.05.05
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
@@ -23,6 +23,10 @@
23 * reply. 23 * reply.
24 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO 24 * 10-11-06 01.05.04 Fixed the name of a define for Operation field of SAS IO
25 * Unit Control request. 25 * Unit Control request.
26 * 01-15-08 01.05.05 Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
27 * including adding IOCParameter and IOCParameter value
28 * fields to SAS IO Unit Control Request.
29 * Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
26 * -------------------------------------------------------------------------- 30 * --------------------------------------------------------------------------
27 */ 31 */
28 32
@@ -60,6 +64,8 @@
60 * Values for the SAS DeviceInfo field used in SAS Device Status Change Event 64 * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
61 * data and SAS IO Unit Configuration pages. 65 * data and SAS IO Unit Configuration pages.
62 */ 66 */
67#define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC (0xF0000000)
68
63#define MPI_SAS_DEVICE_INFO_SEP (0x00004000) 69#define MPI_SAS_DEVICE_INFO_SEP (0x00004000)
64#define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) 70#define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000)
65#define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) 71#define MPI_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000)
@@ -216,7 +222,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
216 U8 ChainOffset; /* 02h */ 222 U8 ChainOffset; /* 02h */
217 U8 Function; /* 03h */ 223 U8 Function; /* 03h */
218 U16 DevHandle; /* 04h */ 224 U16 DevHandle; /* 04h */
219 U8 Reserved3; /* 06h */ 225 U8 IOCParameter; /* 06h */
220 U8 MsgFlags; /* 07h */ 226 U8 MsgFlags; /* 07h */
221 U32 MsgContext; /* 08h */ 227 U32 MsgContext; /* 08h */
222 U8 TargetID; /* 0Ch */ 228 U8 TargetID; /* 0Ch */
@@ -225,7 +231,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
225 U8 PrimFlags; /* 0Fh */ 231 U8 PrimFlags; /* 0Fh */
226 U32 Primitive; /* 10h */ 232 U32 Primitive; /* 10h */
227 U64 SASAddress; /* 14h */ 233 U64 SASAddress; /* 14h */
228 U32 Reserved4; /* 1Ch */ 234 U32 IOCParameterValue; /* 1Ch */
229} MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST, 235} MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
230 SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t; 236 SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
231 237
@@ -241,6 +247,8 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
241#define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) 247#define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C)
242#define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */ 248#define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE (0x0D) /* obsolete name */
243#define MPI_SAS_OP_REMOVE_DEVICE (0x0D) 249#define MPI_SAS_OP_REMOVE_DEVICE (0x0D)
250#define MPI_SAS_OP_SET_IOC_PARAMETER (0x0E)
251#define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN (0x80)
244 252
245/* values for the PrimFlags field */ 253/* values for the PrimFlags field */
246#define MPI_SAS_PRIMFLAGS_SINGLE (0x08) 254#define MPI_SAS_PRIMFLAGS_SINGLE (0x08)
@@ -256,7 +264,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
256 U8 MsgLength; /* 02h */ 264 U8 MsgLength; /* 02h */
257 U8 Function; /* 03h */ 265 U8 Function; /* 03h */
258 U16 DevHandle; /* 04h */ 266 U16 DevHandle; /* 04h */
259 U8 Reserved3; /* 06h */ 267 U8 IOCParameter; /* 06h */
260 U8 MsgFlags; /* 07h */ 268 U8 MsgFlags; /* 07h */
261 U32 MsgContext; /* 08h */ 269 U32 MsgContext; /* 08h */
262 U16 Reserved4; /* 0Ch */ 270 U16 Reserved4; /* 0Ch */
diff --git a/drivers/message/fusion/lsi/mpi_targ.h b/drivers/message/fusion/lsi/mpi_targ.h
index ff8c37d3fdcb..c3dea7f6909d 100644
--- a/drivers/message/fusion/lsi/mpi_targ.h
+++ b/drivers/message/fusion/lsi/mpi_targ.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_targ.h 5 * Name: mpi_targ.h
diff --git a/drivers/message/fusion/lsi/mpi_tool.h b/drivers/message/fusion/lsi/mpi_tool.h
index 8834ae6ce0f2..53cd715aa7e4 100644
--- a/drivers/message/fusion/lsi/mpi_tool.h
+++ b/drivers/message/fusion/lsi/mpi_tool.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2001-2005 LSI Corporation. 2 * Copyright (c) 2001-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_tool.h 5 * Name: mpi_tool.h
diff --git a/drivers/message/fusion/lsi/mpi_type.h b/drivers/message/fusion/lsi/mpi_type.h
index 08dad9c1e446..888b26dbc413 100644
--- a/drivers/message/fusion/lsi/mpi_type.h
+++ b/drivers/message/fusion/lsi/mpi_type.h
@@ -1,12 +1,12 @@
1/* 1/*
2 * Copyright (c) 2000-2004 LSI Corporation. 2 * Copyright (c) 2000-2008 LSI Corporation.
3 * 3 *
4 * 4 *
5 * Name: mpi_type.h 5 * Name: mpi_type.h
6 * Title: MPI Basic type definitions 6 * Title: MPI Basic type definitions
7 * Creation Date: June 6, 2000 7 * Creation Date: June 6, 2000
8 * 8 *
9 * mpi_type.h Version: 01.05.01 9 * mpi_type.h Version: 01.05.02
10 * 10 *
11 * Version History 11 * Version History
12 * --------------- 12 * ---------------
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index c4e8b9aa3827..96ac88317b8e 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -79,9 +79,22 @@ MODULE_VERSION(my_VERSION);
79/* 79/*
80 * cmd line parameters 80 * cmd line parameters
81 */ 81 */
82static int mpt_msi_enable = -1; 82
83module_param(mpt_msi_enable, int, 0); 83static int mpt_msi_enable_spi;
84MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)"); 84module_param(mpt_msi_enable_spi, int, 0);
85MODULE_PARM_DESC(mpt_msi_enable_spi, " Enable MSI Support for SPI \
86 controllers (default=0)");
87
88static int mpt_msi_enable_fc;
89module_param(mpt_msi_enable_fc, int, 0);
90MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC \
91 controllers (default=0)");
92
93static int mpt_msi_enable_sas;
94module_param(mpt_msi_enable_sas, int, 1);
95MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS \
96 controllers (default=1)");
97
85 98
86static int mpt_channel_mapping; 99static int mpt_channel_mapping;
87module_param(mpt_channel_mapping, int, 0); 100module_param(mpt_channel_mapping, int, 0);
@@ -91,7 +104,17 @@ static int mpt_debug_level;
91static int mpt_set_debug_level(const char *val, struct kernel_param *kp); 104static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
92module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int, 105module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
93 &mpt_debug_level, 0600); 106 &mpt_debug_level, 0600);
94MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)"); 107MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h \
108 - (default=0)");
109
110int mpt_fwfault_debug;
111EXPORT_SYMBOL(mpt_fwfault_debug);
112module_param_call(mpt_fwfault_debug, param_set_int, param_get_int,
113 &mpt_fwfault_debug, 0600);
114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
115 " and halt Firmware on fault - (default=0)");
116
117
95 118
96#ifdef MFCNT 119#ifdef MFCNT
97static int mfcounter = 0; 120static int mfcounter = 0;
@@ -1751,16 +1774,25 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1751 ioc->bus_type = SAS; 1774 ioc->bus_type = SAS;
1752 } 1775 }
1753 1776
1754 if (mpt_msi_enable == -1) {
1755 /* Enable on SAS, disable on FC and SPI */
1756 if (ioc->bus_type == SAS)
1757 ioc->msi_enable = 1;
1758 else
1759 ioc->msi_enable = 0;
1760 } else
1761 /* follow flag: 0 - disable; 1 - enable */
1762 ioc->msi_enable = mpt_msi_enable;
1763 1777
1778 switch (ioc->bus_type) {
1779
1780 case SAS:
1781 ioc->msi_enable = mpt_msi_enable_sas;
1782 break;
1783
1784 case SPI:
1785 ioc->msi_enable = mpt_msi_enable_spi;
1786 break;
1787
1788 case FC:
1789 ioc->msi_enable = mpt_msi_enable_fc;
1790 break;
1791
1792 default:
1793 ioc->msi_enable = 0;
1794 break;
1795 }
1764 if (ioc->errata_flag_1064) 1796 if (ioc->errata_flag_1064)
1765 pci_disable_io_access(pdev); 1797 pci_disable_io_access(pdev);
1766 1798
@@ -6313,6 +6345,33 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6313 *size = y; 6345 *size = y;
6314} 6346}
6315 6347
6348
6349/**
6350 * mpt_halt_firmware - Halts the firmware if it is operational and panic
6351 * the kernel
6352 * @ioc: Pointer to MPT_ADAPTER structure
6353 *
6354 **/
6355void
6356mpt_halt_firmware(MPT_ADAPTER *ioc)
6357{
6358 u32 ioc_raw_state;
6359
6360 ioc_raw_state = mpt_GetIocState(ioc, 0);
6361
6362 if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {
6363 printk(MYIOC_s_ERR_FMT "IOC is in FAULT state (%04xh)!!!\n",
6364 ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
6365 panic("%s: IOC Fault (%04xh)!!!\n", ioc->name,
6366 ioc_raw_state & MPI_DOORBELL_DATA_MASK);
6367 } else {
6368 CHIPREG_WRITE32(&ioc->chip->Doorbell, 0xC0FFEE00);
6369 panic("%s: Firmware is halted due to command timeout\n",
6370 ioc->name);
6371 }
6372}
6373EXPORT_SYMBOL(mpt_halt_firmware);
6374
6316/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6375/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6317/* 6376/*
6318 * Reset Handling 6377 * Reset Handling
@@ -6345,6 +6404,8 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6345 printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name); 6404 printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name);
6346 printk("MF count 0x%x !\n", ioc->mfcnt); 6405 printk("MF count 0x%x !\n", ioc->mfcnt);
6347#endif 6406#endif
6407 if (mpt_fwfault_debug)
6408 mpt_halt_firmware(ioc);
6348 6409
6349 /* Reset the adapter. Prevent more than 1 call to 6410 /* Reset the adapter. Prevent more than 1 call to
6350 * mpt_do_ioc_recovery at any instant in time. 6411 * mpt_do_ioc_recovery at any instant in time.
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index dff048cfa101..b3e981d2a506 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -922,11 +922,14 @@ extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
922extern int mpt_findImVolumes(MPT_ADAPTER *ioc); 922extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
923extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); 923extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
924extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk); 924extern int mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk);
925extern void mpt_halt_firmware(MPT_ADAPTER *ioc);
926
925 927
926/* 928/*
927 * Public data decl's... 929 * Public data decl's...
928 */ 930 */
929extern struct list_head ioc_list; 931extern struct list_head ioc_list;
932extern int mpt_fwfault_debug;
930 933
931/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 934/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
932#endif /* } __KERNEL__ */ 935#endif /* } __KERNEL__ */
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index ee090413e598..e62c6bc4ad33 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1846,6 +1846,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1846 if (hd->timeouts < -1) 1846 if (hd->timeouts < -1)
1847 hd->timeouts++; 1847 hd->timeouts++;
1848 1848
1849 if (mpt_fwfault_debug)
1850 mpt_halt_firmware(ioc);
1851
1849 /* Most important! Set TaskMsgContext to SCpnt's MsgContext! 1852 /* Most important! Set TaskMsgContext to SCpnt's MsgContext!
1850 * (the IO to be ABORT'd) 1853 * (the IO to be ABORT'd)
1851 * 1854 *
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index 074b11ffbf41..e7ab0035d305 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -649,7 +649,7 @@ static inline int __init unprotect_pm_master(void)
649 return e; 649 return e;
650} 650}
651 651
652static void __init clocks_init(void) 652static void __init clocks_init(struct device *dev)
653{ 653{
654 int e = 0; 654 int e = 0;
655 struct clk *osc; 655 struct clk *osc;
@@ -658,9 +658,9 @@ static void __init clocks_init(void)
658 658
659#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 659#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
660 if (cpu_is_omap2430()) 660 if (cpu_is_omap2430())
661 osc = clk_get(NULL, "osc_ck"); 661 osc = clk_get(dev, "osc_ck");
662 else 662 else
663 osc = clk_get(NULL, "osc_sys_ck"); 663 osc = clk_get(dev, "osc_sys_ck");
664 664
665 if (IS_ERR(osc)) { 665 if (IS_ERR(osc)) {
666 printk(KERN_WARNING "Skipping twl4030 internal clock init and " 666 printk(KERN_WARNING "Skipping twl4030 internal clock init and "
@@ -776,7 +776,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
776 inuse = true; 776 inuse = true;
777 777
778 /* setup clock framework */ 778 /* setup clock framework */
779 clocks_init(); 779 clocks_init(&client->dev);
780 780
781 /* Maybe init the T2 Interrupt subsystem */ 781 /* Maybe init the T2 Interrupt subsystem */
782 if (client->irq 782 if (client->irq
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
index 73b7fb8de47a..82fb9958f22f 100644
--- a/drivers/misc/sgi-xp/xpc_sn2.c
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -899,7 +899,7 @@ xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
899 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", 899 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
900 part_sn2->remote_vars_pa); 900 part_sn2->remote_vars_pa);
901 901
902 part->last_heartbeat = remote_vars->heartbeat; 902 part->last_heartbeat = remote_vars->heartbeat - 1;
903 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", 903 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
904 part->last_heartbeat); 904 part->last_heartbeat);
905 905
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index e3131ea629cd..dfe92264e825 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -132,7 +132,7 @@ void ehea_dump(void *adr, int len, char *msg)
132 int x; 132 int x;
133 unsigned char *deb = adr; 133 unsigned char *deb = adr;
134 for (x = 0; x < len; x += 16) { 134 for (x = 0; x < len; x += 16) {
135 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, 135 printk(DRV_NAME " %s adr=%p ofs=%04x %016llx %016llx\n", msg,
136 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); 136 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8]));
137 deb += 16; 137 deb += 16;
138 } 138 }
@@ -883,7 +883,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
883 883
884 while (eqe) { 884 while (eqe) {
885 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 885 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
886 ehea_error("QP aff_err: entry=0x%lx, token=0x%x", 886 ehea_error("QP aff_err: entry=0x%llx, token=0x%x",
887 eqe->entry, qp_token); 887 eqe->entry, qp_token);
888 888
889 qp = port->port_res[qp_token].qp; 889 qp = port->port_res[qp_token].qp;
@@ -1159,7 +1159,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
1159 netif_stop_queue(port->netdev); 1159 netif_stop_queue(port->netdev);
1160 break; 1160 break;
1161 default: 1161 default:
1162 ehea_error("unknown event code %x, eqe=0x%lX", ec, eqe); 1162 ehea_error("unknown event code %x, eqe=0x%llX", ec, eqe);
1163 break; 1163 break;
1164 } 1164 }
1165} 1165}
@@ -1971,7 +1971,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
1971 } 1971 }
1972 1972
1973 if (dev->mc_count > port->adapter->max_mc_mac) { 1973 if (dev->mc_count > port->adapter->max_mc_mac) {
1974 ehea_info("Mcast registration limit reached (0x%lx). " 1974 ehea_info("Mcast registration limit reached (0x%llx). "
1975 "Use ALLMULTI!", 1975 "Use ALLMULTI!",
1976 port->adapter->max_mc_mac); 1976 port->adapter->max_mc_mac);
1977 goto out; 1977 goto out;
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 225c692b5d99..49d766ebbcf4 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -168,7 +168,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
168 cq->fw_handle, rpage, 1); 168 cq->fw_handle, rpage, 1);
169 if (hret < H_SUCCESS) { 169 if (hret < H_SUCCESS) {
170 ehea_error("register_rpage_cq failed ehea_cq=%p " 170 ehea_error("register_rpage_cq failed ehea_cq=%p "
171 "hret=%lx counter=%i act_pages=%i", 171 "hret=%llx counter=%i act_pages=%i",
172 cq, hret, counter, cq->attr.nr_pages); 172 cq, hret, counter, cq->attr.nr_pages);
173 goto out_kill_hwq; 173 goto out_kill_hwq;
174 } 174 }
@@ -178,13 +178,13 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
178 178
179 if ((hret != H_SUCCESS) || (vpage)) { 179 if ((hret != H_SUCCESS) || (vpage)) {
180 ehea_error("registration of pages not " 180 ehea_error("registration of pages not "
181 "complete hret=%lx\n", hret); 181 "complete hret=%llx\n", hret);
182 goto out_kill_hwq; 182 goto out_kill_hwq;
183 } 183 }
184 } else { 184 } else {
185 if (hret != H_PAGE_REGISTERED) { 185 if (hret != H_PAGE_REGISTERED) {
186 ehea_error("CQ: registration of page failed " 186 ehea_error("CQ: registration of page failed "
187 "hret=%lx\n", hret); 187 "hret=%llx\n", hret);
188 goto out_kill_hwq; 188 goto out_kill_hwq;
189 } 189 }
190 } 190 }
@@ -986,15 +986,15 @@ void print_error_data(u64 *data)
986 length = EHEA_PAGESIZE; 986 length = EHEA_PAGESIZE;
987 987
988 if (type == 0x8) /* Queue Pair */ 988 if (type == 0x8) /* Queue Pair */
989 ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, " 989 ehea_error("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, "
990 "port=%lX", resource, data[6], data[12], data[22]); 990 "port=%llX", resource, data[6], data[12], data[22]);
991 991
992 if (type == 0x4) /* Completion Queue */ 992 if (type == 0x4) /* Completion Queue */
993 ehea_error("CQ (resource=%lX) state: AER=0x%lX", resource, 993 ehea_error("CQ (resource=%llX) state: AER=0x%llX", resource,
994 data[6]); 994 data[6]);
995 995
996 if (type == 0x3) /* Event Queue */ 996 if (type == 0x3) /* Event Queue */
997 ehea_error("EQ (resource=%lX) state: AER=0x%lX", resource, 997 ehea_error("EQ (resource=%llX) state: AER=0x%llX", resource,
998 data[6]); 998 data[6]);
999 999
1000 ehea_dump(data, length, "error data"); 1000 ehea_dump(data, length, "error data");
@@ -1016,11 +1016,11 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
1016 rblock); 1016 rblock);
1017 1017
1018 if (ret == H_R_STATE) 1018 if (ret == H_R_STATE)
1019 ehea_error("No error data is available: %lX.", res_handle); 1019 ehea_error("No error data is available: %llX.", res_handle);
1020 else if (ret == H_SUCCESS) 1020 else if (ret == H_SUCCESS)
1021 print_error_data(rblock); 1021 print_error_data(rblock);
1022 else 1022 else
1023 ehea_error("Error data could not be fetched: %lX", res_handle); 1023 ehea_error("Error data could not be fetched: %llX", res_handle);
1024 1024
1025 kfree(rblock); 1025 kfree(rblock);
1026} 1026}
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index ca3bb9f7321b..dfa6348ac1dc 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -602,7 +602,7 @@ static int ibmveth_open(struct net_device *netdev)
602 602
603 if(lpar_rc != H_SUCCESS) { 603 if(lpar_rc != H_SUCCESS) {
604 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); 604 ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc);
605 ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", 605 ibmveth_error_printk("buffer TCE:0x%llx filter TCE:0x%llx rxq desc:0x%llx MAC:0x%llx\n",
606 adapter->buffer_list_dma, 606 adapter->buffer_list_dma,
607 adapter->filter_list_dma, 607 adapter->filter_list_dma,
608 rxq_desc.desc, 608 rxq_desc.desc,
@@ -1378,13 +1378,13 @@ static int ibmveth_show(struct seq_file *seq, void *v)
1378 seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); 1378 seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac);
1379 1379
1380 seq_printf(seq, "\nAdapter Statistics:\n"); 1380 seq_printf(seq, "\nAdapter Statistics:\n");
1381 seq_printf(seq, " TX: vio_map_single failres: %ld\n", adapter->tx_map_failed); 1381 seq_printf(seq, " TX: vio_map_single failres: %lld\n", adapter->tx_map_failed);
1382 seq_printf(seq, " send failures: %ld\n", adapter->tx_send_failed); 1382 seq_printf(seq, " send failures: %lld\n", adapter->tx_send_failed);
1383 seq_printf(seq, " RX: replenish task cycles: %ld\n", adapter->replenish_task_cycles); 1383 seq_printf(seq, " RX: replenish task cycles: %lld\n", adapter->replenish_task_cycles);
1384 seq_printf(seq, " alloc_skb_failures: %ld\n", adapter->replenish_no_mem); 1384 seq_printf(seq, " alloc_skb_failures: %lld\n", adapter->replenish_no_mem);
1385 seq_printf(seq, " add buffer failures: %ld\n", adapter->replenish_add_buff_failure); 1385 seq_printf(seq, " add buffer failures: %lld\n", adapter->replenish_add_buff_failure);
1386 seq_printf(seq, " invalid buffers: %ld\n", adapter->rx_invalid_buffer); 1386 seq_printf(seq, " invalid buffers: %lld\n", adapter->rx_invalid_buffer);
1387 seq_printf(seq, " no buffers: %ld\n", adapter->rx_no_buffer); 1387 seq_printf(seq, " no buffers: %lld\n", adapter->rx_no_buffer);
1388 1388
1389 return 0; 1389 return 0;
1390} 1390}
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index c7457f97259d..cb793c2bade2 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -429,7 +429,7 @@ SIMPLE_PORT_ATTR(promiscuous);
429SIMPLE_PORT_ATTR(num_mcast); 429SIMPLE_PORT_ATTR(num_mcast);
430CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); 430CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map);
431CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); 431CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map);
432CUSTOM_PORT_ATTR(mac_addr, "0x%lX\n", port->mac_addr); 432CUSTOM_PORT_ATTR(mac_addr, "0x%llX\n", port->mac_addr);
433 433
434#define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) 434#define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr)
435static struct attribute *veth_port_default_attrs[] = { 435static struct attribute *veth_port_default_attrs[] = {
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 710c79e7a2db..6ef2490d5c3e 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -912,8 +912,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
912 int i; 912 int i;
913 913
914 if (msi_x) { 914 if (msi_x) {
915 nreq = min(dev->caps.num_eqs - dev->caps.reserved_eqs, 915 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
916 num_possible_cpus() + 1); 916 num_possible_cpus() + 1);
917 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 917 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
918 if (!entries) 918 if (!entries)
919 goto no_msi; 919 goto no_msi;
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 5b7a574ce571..d0349e7d73ea 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -712,7 +712,7 @@ static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac,
712 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); 712 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
713 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); 713 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno));
714 714
715 printk(KERN_ERR "pasemi_mac: rx error. macrx %016lx, rx status %lx\n", 715 printk(KERN_ERR "pasemi_mac: rx error. macrx %016llx, rx status %llx\n",
716 macrx, *chan->status); 716 macrx, *chan->status);
717 717
718 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", 718 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n",
@@ -730,8 +730,8 @@ static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac,
730 730
731 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); 731 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno));
732 732
733 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016lx, "\ 733 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016llx, "\
734 "tx status 0x%016lx\n", mactx, *chan->status); 734 "tx status 0x%016llx\n", mactx, *chan->status);
735 735
736 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); 736 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta);
737} 737}
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index d17dc5214c9a..0d0fa91c0251 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
1297 /* setup */ 1297 /* setup */
1298 spin_lock_irq(&serial->serial_lock); 1298 spin_lock_irq(&serial->serial_lock);
1299 tty->driver_data = serial; 1299 tty->driver_data = serial;
1300 tty_kref_put(serial->tty);
1300 serial->tty = tty_kref_get(tty); 1301 serial->tty = tty_kref_get(tty);
1301 spin_unlock_irq(&serial->serial_lock); 1302 spin_unlock_irq(&serial->serial_lock);
1302 1303
@@ -2043,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2043 return -2; 2044 return -2;
2044 } 2045 }
2045 2046
2046 spin_lock(&serial->serial_lock); 2047 /* All callers to put_rxbuf_data hold serial_lock */
2047 tty = tty_kref_get(serial->tty); 2048 tty = tty_kref_get(serial->tty);
2048 spin_unlock(&serial->serial_lock);
2049 2049
2050 /* Push data to tty */ 2050 /* Push data to tty */
2051 if (tty) { 2051 if (tty) {
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2053 serial->curr_rx_urb_offset; 2053 serial->curr_rx_urb_offset;
2054 D1("data to push to tty"); 2054 D1("data to push to tty");
2055 while (write_length_remaining) { 2055 while (write_length_remaining) {
2056 if (test_bit(TTY_THROTTLED, &tty->flags)) 2056 if (test_bit(TTY_THROTTLED, &tty->flags)) {
2057 tty_kref_put(tty);
2057 return -1; 2058 return -1;
2059 }
2058 curr_write_len = tty_insert_flip_string 2060 curr_write_len = tty_insert_flip_string
2059 (tty, urb->transfer_buffer + 2061 (tty, urb->transfer_buffer +
2060 serial->curr_rx_urb_offset, 2062 serial->curr_rx_urb_offset,
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index e1b0ad6e918f..fa65a2b2ae2e 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -66,4 +66,23 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
66} 66}
67EXPORT_SYMBOL(of_register_i2c_devices); 67EXPORT_SYMBOL(of_register_i2c_devices);
68 68
69static int of_dev_node_match(struct device *dev, void *data)
70{
71 return dev_archdata_get_node(&dev->archdata) == data;
72}
73
74/* must call put_device() when done with returned i2c_client device */
75struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
76{
77 struct device *dev;
78
79 dev = bus_find_device(&i2c_bus_type, NULL, node,
80 of_dev_node_match);
81 if (!dev)
82 return NULL;
83
84 return to_i2c_client(dev);
85}
86EXPORT_SYMBOL(of_find_i2c_device_by_node);
87
69MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 1e93c837514f..4fa3bb2ddfe4 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -405,7 +405,6 @@ static void __init superio_serial_init(void)
405 serial_port.type = PORT_16550A; 405 serial_port.type = PORT_16550A;
406 serial_port.uartclk = 115200*16; 406 serial_port.uartclk = 115200*16;
407 serial_port.fifosize = 16; 407 serial_port.fifosize = 16;
408 spin_lock_init(&serial_port.lock);
409 408
410 /* serial port #1 */ 409 /* serial port #1 */
411 serial_port.iobase = sio_dev.sp1_base; 410 serial_port.iobase = sio_dev.sp1_base;
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 235fb7a5a8a5..3dfecb20d5e7 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -438,7 +438,8 @@ static struct intel_iommu *device_to_iommu(u8 bus, u8 devfn)
438 continue; 438 continue;
439 439
440 for (i = 0; i < drhd->devices_cnt; i++) 440 for (i = 0; i < drhd->devices_cnt; i++)
441 if (drhd->devices[i]->bus->number == bus && 441 if (drhd->devices[i] &&
442 drhd->devices[i]->bus->number == bus &&
442 drhd->devices[i]->devfn == devfn) 443 drhd->devices[i]->devfn == devfn)
443 return drhd->iommu; 444 return drhd->iommu;
444 445
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c12f6c790698..e491fdedf705 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1260,15 +1260,14 @@ void pci_pm_init(struct pci_dev *dev)
1260 /* find PCI PM capability in list */ 1260 /* find PCI PM capability in list */
1261 pm = pci_find_capability(dev, PCI_CAP_ID_PM); 1261 pm = pci_find_capability(dev, PCI_CAP_ID_PM);
1262 if (!pm) 1262 if (!pm)
1263 goto Exit; 1263 return;
1264
1265 /* Check device's ability to generate PME# */ 1264 /* Check device's ability to generate PME# */
1266 pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc); 1265 pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc);
1267 1266
1268 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { 1267 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
1269 dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n", 1268 dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n",
1270 pmc & PCI_PM_CAP_VER_MASK); 1269 pmc & PCI_PM_CAP_VER_MASK);
1271 goto Exit; 1270 return;
1272 } 1271 }
1273 1272
1274 dev->pm_cap = pm; 1273 dev->pm_cap = pm;
@@ -1307,9 +1306,6 @@ void pci_pm_init(struct pci_dev *dev)
1307 } else { 1306 } else {
1308 dev->pme_support = 0; 1307 dev->pme_support = 0;
1309 } 1308 }
1310
1311 Exit:
1312 pci_update_current_state(dev, PCI_D0);
1313} 1309}
1314 1310
1315/** 1311/**
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index 645d7a60e412..ec22284eed30 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -14,10 +14,8 @@
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include "pci.h" 15#include "pci.h"
16 16
17asmlinkage long 17SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
18sys_pciconfig_read(unsigned long bus, unsigned long dfn, 18 unsigned long, off, unsigned long, len, void __user *, buf)
19 unsigned long off, unsigned long len,
20 void __user *buf)
21{ 19{
22 struct pci_dev *dev; 20 struct pci_dev *dev;
23 u8 byte; 21 u8 byte;
@@ -86,10 +84,8 @@ error:
86 return err; 84 return err;
87} 85}
88 86
89asmlinkage long 87SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
90sys_pciconfig_write(unsigned long bus, unsigned long dfn, 88 unsigned long, off, unsigned long, len, void __user *, buf)
91 unsigned long off, unsigned long len,
92 void __user *buf)
93{ 89{
94 struct pci_dev *dev; 90 struct pci_dev *dev;
95 u8 byte; 91 u8 byte;
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index a34284b1482a..d187ba4c5e0e 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -297,7 +297,7 @@ static int __devinit electra_cf_probe(struct of_device *ofdev,
297 goto fail3; 297 goto fail3;
298 } 298 }
299 299
300 dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n", 300 dev_info(device, "at mem 0x%lx io 0x%llx irq %d\n",
301 cf->mem_phys, io.start, cf->irq); 301 cf->mem_phys, io.start, cf->irq);
302 302
303 cf->active = 1; 303 cf->active = 1;
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index 204158cf7a55..fe96793e3f08 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -732,7 +732,7 @@ static u64 pm_signal_group_to_ps3_lv1_signal_group(u64 group)
732 case 8: 732 case 8:
733 return pm_translate_signal_group_number_on_island8(subgroup); 733 return pm_translate_signal_group_number_on_island8(subgroup);
734 default: 734 default:
735 dev_dbg(sbd_core(), "%s:%u: island not found: %lu\n", __func__, 735 dev_dbg(sbd_core(), "%s:%u: island not found: %llu\n", __func__,
736 __LINE__, group); 736 __LINE__, group);
737 BUG(); 737 BUG();
738 break; 738 break;
@@ -765,7 +765,7 @@ static int __ps3_set_signal(u64 lv1_signal_group, u64 bus_select,
765 signal_select, attr1, attr2, attr3); 765 signal_select, attr1, attr2, attr3);
766 if (ret) 766 if (ret)
767 dev_err(sbd_core(), 767 dev_err(sbd_core(),
768 "%s:%u: error:%d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", 768 "%s:%u: error:%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n",
769 __func__, __LINE__, ret, lv1_signal_group, bus_select, 769 __func__, __LINE__, ret, lv1_signal_group, bus_select,
770 signal_select, attr1, attr2, attr3); 770 signal_select, attr1, attr2, attr3);
771 771
@@ -908,7 +908,7 @@ void ps3_disable_pm(u32 cpu)
908 908
909 lpm_priv->tb_count = tmp; 909 lpm_priv->tb_count = tmp;
910 910
911 dev_dbg(sbd_core(), "%s:%u: tb_count %lu (%lxh)\n", __func__, __LINE__, 911 dev_dbg(sbd_core(), "%s:%u: tb_count %llu (%llxh)\n", __func__, __LINE__,
912 lpm_priv->tb_count, lpm_priv->tb_count); 912 lpm_priv->tb_count, lpm_priv->tb_count);
913} 913}
914EXPORT_SYMBOL_GPL(ps3_disable_pm); 914EXPORT_SYMBOL_GPL(ps3_disable_pm);
@@ -938,7 +938,7 @@ int ps3_lpm_copy_tb(unsigned long offset, void *buf, unsigned long count,
938 if (offset >= lpm_priv->tb_count) 938 if (offset >= lpm_priv->tb_count)
939 return 0; 939 return 0;
940 940
941 count = min(count, lpm_priv->tb_count - offset); 941 count = min_t(u64, count, lpm_priv->tb_count - offset);
942 942
943 while (*bytes_copied < count) { 943 while (*bytes_copied < count) {
944 const unsigned long request = count - *bytes_copied; 944 const unsigned long request = count - *bytes_copied;
@@ -993,7 +993,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
993 if (offset >= lpm_priv->tb_count) 993 if (offset >= lpm_priv->tb_count)
994 return 0; 994 return 0;
995 995
996 count = min(count, lpm_priv->tb_count - offset); 996 count = min_t(u64, count, lpm_priv->tb_count - offset);
997 997
998 while (*bytes_copied < count) { 998 while (*bytes_copied < count) {
999 const unsigned long request = count - *bytes_copied; 999 const unsigned long request = count - *bytes_copied;
@@ -1013,7 +1013,7 @@ int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf,
1013 result = copy_to_user(buf, lpm_priv->tb_cache, tmp); 1013 result = copy_to_user(buf, lpm_priv->tb_cache, tmp);
1014 1014
1015 if (result) { 1015 if (result) {
1016 dev_dbg(sbd_core(), "%s:%u: 0x%lx bytes at 0x%p\n", 1016 dev_dbg(sbd_core(), "%s:%u: 0x%llx bytes at 0x%p\n",
1017 __func__, __LINE__, tmp, buf); 1017 __func__, __LINE__, tmp, buf);
1018 dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n", 1018 dev_err(sbd_core(), "%s:%u: copy_to_user failed: %d\n",
1019 __func__, __LINE__, result); 1019 __func__, __LINE__, result);
@@ -1148,8 +1148,8 @@ int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache,
1148 lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT; 1148 lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT;
1149 lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT; 1149 lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT;
1150 1150
1151 dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%lx, outlet_id 0x%lx, " 1151 dev_dbg(sbd_core(), "%s:%u: lpm_id 0x%llx, outlet_id 0x%llx, "
1152 "tb_size 0x%lx\n", __func__, __LINE__, lpm_priv->lpm_id, 1152 "tb_size 0x%llx\n", __func__, __LINE__, lpm_priv->lpm_id,
1153 lpm_priv->outlet_id, tb_size); 1153 lpm_priv->outlet_id, tb_size);
1154 1154
1155 return 0; 1155 return 0;
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
index 90c097a7a47a..e4ad5ba5d0a3 100644
--- a/drivers/ps3/ps3-vuart.c
+++ b/drivers/ps3/ps3-vuart.c
@@ -114,7 +114,7 @@ struct ports_bmp {
114static void __maybe_unused _dump_ports_bmp( 114static void __maybe_unused _dump_ports_bmp(
115 const struct ports_bmp *bmp, const char *func, int line) 115 const struct ports_bmp *bmp, const char *func, int line)
116{ 116{
117 pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status); 117 pr_debug("%s:%d: ports_bmp: %016llxh\n", func, line, bmp->status);
118} 118}
119 119
120#define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__) 120#define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__)
@@ -159,11 +159,13 @@ int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev,
159 struct vuart_triggers *trig) 159 struct vuart_triggers *trig)
160{ 160{
161 int result; 161 int result;
162 unsigned long size; 162 u64 size;
163 unsigned long val; 163 u64 val;
164 u64 tx;
164 165
165 result = lv1_get_virtual_uart_param(dev->port_number, 166 result = lv1_get_virtual_uart_param(dev->port_number,
166 PARAM_TX_TRIGGER, &trig->tx); 167 PARAM_TX_TRIGGER, &tx);
168 trig->tx = tx;
167 169
168 if (result) { 170 if (result) {
169 dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n", 171 dev_dbg(&dev->core, "%s:%d: tx_trigger failed: %s\n",
@@ -201,7 +203,7 @@ int ps3_vuart_set_triggers(struct ps3_system_bus_device *dev, unsigned int tx,
201 unsigned int rx) 203 unsigned int rx)
202{ 204{
203 int result; 205 int result;
204 unsigned long size; 206 u64 size;
205 207
206 result = lv1_set_virtual_uart_param(dev->port_number, 208 result = lv1_set_virtual_uart_param(dev->port_number,
207 PARAM_TX_TRIGGER, tx); 209 PARAM_TX_TRIGGER, tx);
@@ -248,7 +250,7 @@ static int ps3_vuart_get_rx_bytes_waiting(struct ps3_system_bus_device *dev,
248 dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n", 250 dev_dbg(&dev->core, "%s:%d: rx_bytes failed: %s\n",
249 __func__, __LINE__, ps3_result(result)); 251 __func__, __LINE__, ps3_result(result));
250 252
251 dev_dbg(&dev->core, "%s:%d: %lxh\n", __func__, __LINE__, 253 dev_dbg(&dev->core, "%s:%d: %llxh\n", __func__, __LINE__,
252 *bytes_waiting); 254 *bytes_waiting);
253 return result; 255 return result;
254} 256}
@@ -295,7 +297,7 @@ static int ps3_vuart_get_interrupt_status(struct ps3_system_bus_device *dev,
295 297
296 *status = tmp & priv->interrupt_mask; 298 *status = tmp & priv->interrupt_mask;
297 299
298 dev_dbg(&dev->core, "%s:%d: m %lxh, s %lxh, m&s %lxh\n", 300 dev_dbg(&dev->core, "%s:%d: m %llxh, s %llxh, m&s %lxh\n",
299 __func__, __LINE__, priv->interrupt_mask, tmp, *status); 301 __func__, __LINE__, priv->interrupt_mask, tmp, *status);
300 302
301 return result; 303 return result;
@@ -363,7 +365,7 @@ int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev)
363 */ 365 */
364 366
365static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, 367static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
366 const void *buf, unsigned int bytes, unsigned long *bytes_written) 368 const void *buf, unsigned int bytes, u64 *bytes_written)
367{ 369{
368 int result; 370 int result;
369 struct ps3_vuart_port_priv *priv = to_port_priv(dev); 371 struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -379,7 +381,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
379 381
380 priv->stats.bytes_written += *bytes_written; 382 priv->stats.bytes_written += *bytes_written;
381 383
382 dev_dbg(&dev->core, "%s:%d: wrote %lxh/%xh=>%lxh\n", __func__, __LINE__, 384 dev_dbg(&dev->core, "%s:%d: wrote %llxh/%xh=>%lxh\n", __func__, __LINE__,
383 *bytes_written, bytes, priv->stats.bytes_written); 385 *bytes_written, bytes, priv->stats.bytes_written);
384 386
385 return result; 387 return result;
@@ -393,7 +395,7 @@ static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
393 */ 395 */
394 396
395static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf, 397static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf,
396 unsigned int bytes, unsigned long *bytes_read) 398 unsigned int bytes, u64 *bytes_read)
397{ 399{
398 int result; 400 int result;
399 struct ps3_vuart_port_priv *priv = to_port_priv(dev); 401 struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -411,7 +413,7 @@ static int ps3_vuart_raw_read(struct ps3_system_bus_device *dev, void *buf,
411 413
412 priv->stats.bytes_read += *bytes_read; 414 priv->stats.bytes_read += *bytes_read;
413 415
414 dev_dbg(&dev->core, "%s:%d: read %lxh/%xh=>%lxh\n", __func__, __LINE__, 416 dev_dbg(&dev->core, "%s:%d: read %llxh/%xh=>%lxh\n", __func__, __LINE__,
415 *bytes_read, bytes, priv->stats.bytes_read); 417 *bytes_read, bytes, priv->stats.bytes_read);
416 418
417 return result; 419 return result;
@@ -500,7 +502,7 @@ int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
500 spin_lock_irqsave(&priv->tx_list.lock, flags); 502 spin_lock_irqsave(&priv->tx_list.lock, flags);
501 503
502 if (list_empty(&priv->tx_list.head)) { 504 if (list_empty(&priv->tx_list.head)) {
503 unsigned long bytes_written; 505 u64 bytes_written;
504 506
505 result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written); 507 result = ps3_vuart_raw_write(dev, buf, bytes, &bytes_written);
506 508
@@ -592,7 +594,7 @@ static int ps3_vuart_queue_rx_bytes(struct ps3_system_bus_device *dev,
592 list_add_tail(&lb->link, &priv->rx_list.head); 594 list_add_tail(&lb->link, &priv->rx_list.head);
593 priv->rx_list.bytes_held += bytes; 595 priv->rx_list.bytes_held += bytes;
594 596
595 dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %lxh bytes\n", 597 dev_dbg(&dev->core, "%s:%d: buf_%lu: queued %llxh bytes\n",
596 __func__, __LINE__, lb->dbg_number, bytes); 598 __func__, __LINE__, lb->dbg_number, bytes);
597 599
598 *bytes_queued = bytes; 600 *bytes_queued = bytes;
@@ -745,7 +747,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev)
745 747
746 list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) { 748 list_for_each_entry_safe(lb, n, &priv->tx_list.head, link) {
747 749
748 unsigned long bytes_written; 750 u64 bytes_written;
749 751
750 result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head, 752 result = ps3_vuart_raw_write(dev, lb->head, lb->tail - lb->head,
751 &bytes_written); 753 &bytes_written);
@@ -762,7 +764,7 @@ static int ps3_vuart_handle_interrupt_tx(struct ps3_system_bus_device *dev)
762 if (bytes_written < lb->tail - lb->head) { 764 if (bytes_written < lb->tail - lb->head) {
763 lb->head += bytes_written; 765 lb->head += bytes_written;
764 dev_dbg(&dev->core, 766 dev_dbg(&dev->core,
765 "%s:%d cleared buf_%lu, %lxh bytes\n", 767 "%s:%d cleared buf_%lu, %llxh bytes\n",
766 __func__, __LINE__, lb->dbg_number, 768 __func__, __LINE__, lb->dbg_number,
767 bytes_written); 769 bytes_written);
768 goto port_full; 770 goto port_full;
diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
index 55955f16ad91..18066d555397 100644
--- a/drivers/ps3/ps3stor_lib.c
+++ b/drivers/ps3/ps3stor_lib.c
@@ -70,7 +70,7 @@ static int ps3stor_probe_access(struct ps3_storage_device *dev)
70 __func__, __LINE__, n); 70 __func__, __LINE__, n);
71 dev->region_idx = __ffs(dev->accessible_regions); 71 dev->region_idx = __ffs(dev->accessible_regions);
72 dev_info(&dev->sbd.core, 72 dev_info(&dev->sbd.core,
73 "First accessible region has index %u start %lu size %lu\n", 73 "First accessible region has index %u start %llu size %llu\n",
74 dev->region_idx, dev->regions[dev->region_idx].start, 74 dev->region_idx, dev->regions[dev->region_idx].start,
75 dev->regions[dev->region_idx].size); 75 dev->regions[dev->region_idx].size);
76 76
@@ -220,7 +220,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
220 const char *op = write ? "write" : "read"; 220 const char *op = write ? "write" : "read";
221 int res; 221 int res;
222 222
223 dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n", 223 dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n",
224 __func__, __LINE__, op, sectors, start_sector); 224 __func__, __LINE__, op, sectors, start_sector);
225 225
226 init_completion(&dev->done); 226 init_completion(&dev->done);
@@ -238,7 +238,7 @@ u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
238 238
239 wait_for_completion(&dev->done); 239 wait_for_completion(&dev->done);
240 if (dev->lv1_status) { 240 if (dev->lv1_status) {
241 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__, 241 dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
242 __LINE__, op, dev->lv1_status); 242 __LINE__, op, dev->lv1_status);
243 return dev->lv1_status; 243 return dev->lv1_status;
244 } 244 }
@@ -268,7 +268,7 @@ u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd, u64 arg1,
268{ 268{
269 int res; 269 int res;
270 270
271 dev_dbg(&dev->sbd.core, "%s:%u: send device command 0x%lx\n", __func__, 271 dev_dbg(&dev->sbd.core, "%s:%u: send device command 0x%llx\n", __func__,
272 __LINE__, cmd); 272 __LINE__, cmd);
273 273
274 init_completion(&dev->done); 274 init_completion(&dev->done);
@@ -277,19 +277,19 @@ u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd, u64 arg1,
277 arg2, arg3, arg4, &dev->tag); 277 arg2, arg3, arg4, &dev->tag);
278 if (res) { 278 if (res) {
279 dev_err(&dev->sbd.core, 279 dev_err(&dev->sbd.core,
280 "%s:%u: send_device_command 0x%lx failed %d\n", 280 "%s:%u: send_device_command 0x%llx failed %d\n",
281 __func__, __LINE__, cmd, res); 281 __func__, __LINE__, cmd, res);
282 return -1; 282 return -1;
283 } 283 }
284 284
285 wait_for_completion(&dev->done); 285 wait_for_completion(&dev->done);
286 if (dev->lv1_status) { 286 if (dev->lv1_status) {
287 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%lx failed 0x%lx\n", 287 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%llx failed 0x%llx\n",
288 __func__, __LINE__, cmd, dev->lv1_status); 288 __func__, __LINE__, cmd, dev->lv1_status);
289 return dev->lv1_status; 289 return dev->lv1_status;
290 } 290 }
291 291
292 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%lx completed\n", __func__, 292 dev_dbg(&dev->sbd.core, "%s:%u: command 0x%llx completed\n", __func__,
293 __LINE__, cmd); 293 __LINE__, cmd);
294 294
295 return 0; 295 return 0;
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index cc7eb8767b82..bd56a033bfd0 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -27,6 +27,8 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <mach/hardware.h>
31
30#define TIMER_FREQ CLOCK_TICK_RATE 32#define TIMER_FREQ CLOCK_TICK_RATE
31#define RTC_DEF_DIVIDER (32768 - 1) 33#define RTC_DEF_DIVIDER (32768 - 1)
32#define RTC_DEF_TRIM 0 34#define RTC_DEF_TRIM 0
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index 8ce5f74ee45b..ad35f76c46b7 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -120,7 +120,7 @@ static int twl4030_rtc_write_u8(u8 data, u8 reg)
120static unsigned char rtc_irq_bits; 120static unsigned char rtc_irq_bits;
121 121
122/* 122/*
123 * Enable timer and/or alarm interrupts. 123 * Enable 1/second update and/or alarm interrupts.
124 */ 124 */
125static int set_rtc_irq_bit(unsigned char bit) 125static int set_rtc_irq_bit(unsigned char bit)
126{ 126{
@@ -128,6 +128,7 @@ static int set_rtc_irq_bit(unsigned char bit)
128 int ret; 128 int ret;
129 129
130 val = rtc_irq_bits | bit; 130 val = rtc_irq_bits | bit;
131 val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M;
131 ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); 132 ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
132 if (ret == 0) 133 if (ret == 0)
133 rtc_irq_bits = val; 134 rtc_irq_bits = val;
@@ -136,7 +137,7 @@ static int set_rtc_irq_bit(unsigned char bit)
136} 137}
137 138
138/* 139/*
139 * Disable timer and/or alarm interrupts. 140 * Disable update and/or alarm interrupts.
140 */ 141 */
141static int mask_rtc_irq_bit(unsigned char bit) 142static int mask_rtc_irq_bit(unsigned char bit)
142{ 143{
@@ -151,7 +152,7 @@ static int mask_rtc_irq_bit(unsigned char bit)
151 return ret; 152 return ret;
152} 153}
153 154
154static inline int twl4030_rtc_alarm_irq_set_state(int enabled) 155static int twl4030_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
155{ 156{
156 int ret; 157 int ret;
157 158
@@ -163,7 +164,7 @@ static inline int twl4030_rtc_alarm_irq_set_state(int enabled)
163 return ret; 164 return ret;
164} 165}
165 166
166static inline int twl4030_rtc_irq_set_state(int enabled) 167static int twl4030_rtc_update_irq_enable(struct device *dev, unsigned enabled)
167{ 168{
168 int ret; 169 int ret;
169 170
@@ -292,7 +293,7 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
292 unsigned char alarm_data[ALL_TIME_REGS + 1]; 293 unsigned char alarm_data[ALL_TIME_REGS + 1];
293 int ret; 294 int ret;
294 295
295 ret = twl4030_rtc_alarm_irq_set_state(0); 296 ret = twl4030_rtc_alarm_irq_enable(dev, 0);
296 if (ret) 297 if (ret)
297 goto out; 298 goto out;
298 299
@@ -312,35 +313,11 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
312 } 313 }
313 314
314 if (alm->enabled) 315 if (alm->enabled)
315 ret = twl4030_rtc_alarm_irq_set_state(1); 316 ret = twl4030_rtc_alarm_irq_enable(dev, 1);
316out: 317out:
317 return ret; 318 return ret;
318} 319}
319 320
320#ifdef CONFIG_RTC_INTF_DEV
321
322static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
323 unsigned long arg)
324{
325 switch (cmd) {
326 case RTC_AIE_OFF:
327 return twl4030_rtc_alarm_irq_set_state(0);
328 case RTC_AIE_ON:
329 return twl4030_rtc_alarm_irq_set_state(1);
330 case RTC_UIE_OFF:
331 return twl4030_rtc_irq_set_state(0);
332 case RTC_UIE_ON:
333 return twl4030_rtc_irq_set_state(1);
334
335 default:
336 return -ENOIOCTLCMD;
337 }
338}
339
340#else
341#define twl4030_rtc_ioctl NULL
342#endif
343
344static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) 321static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
345{ 322{
346 unsigned long events = 0; 323 unsigned long events = 0;
@@ -400,11 +377,12 @@ out:
400} 377}
401 378
402static struct rtc_class_ops twl4030_rtc_ops = { 379static struct rtc_class_ops twl4030_rtc_ops = {
403 .ioctl = twl4030_rtc_ioctl,
404 .read_time = twl4030_rtc_read_time, 380 .read_time = twl4030_rtc_read_time,
405 .set_time = twl4030_rtc_set_time, 381 .set_time = twl4030_rtc_set_time,
406 .read_alarm = twl4030_rtc_read_alarm, 382 .read_alarm = twl4030_rtc_read_alarm,
407 .set_alarm = twl4030_rtc_set_alarm, 383 .set_alarm = twl4030_rtc_set_alarm,
384 .alarm_irq_enable = twl4030_rtc_alarm_irq_enable,
385 .update_irq_enable = twl4030_rtc_update_irq_enable,
408}; 386};
409 387
410/*----------------------------------------------------------------------*/ 388/*----------------------------------------------------------------------*/
@@ -422,7 +400,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
422 rtc = rtc_device_register(pdev->name, 400 rtc = rtc_device_register(pdev->name,
423 &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); 401 &pdev->dev, &twl4030_rtc_ops, THIS_MODULE);
424 if (IS_ERR(rtc)) { 402 if (IS_ERR(rtc)) {
425 ret = -EINVAL; 403 ret = PTR_ERR(rtc);
426 dev_err(&pdev->dev, "can't register RTC device, err %ld\n", 404 dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
427 PTR_ERR(rtc)); 405 PTR_ERR(rtc));
428 goto out0; 406 goto out0;
@@ -432,7 +410,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
432 platform_set_drvdata(pdev, rtc); 410 platform_set_drvdata(pdev, rtc);
433 411
434 ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); 412 ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
435
436 if (ret < 0) 413 if (ret < 0)
437 goto out1; 414 goto out1;
438 415
@@ -475,7 +452,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
475 452
476 return ret; 453 return ret;
477 454
478
479out2: 455out2:
480 free_irq(irq, rtc); 456 free_irq(irq, rtc);
481out1: 457out1:
@@ -506,8 +482,9 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev)
506 482
507static void twl4030_rtc_shutdown(struct platform_device *pdev) 483static void twl4030_rtc_shutdown(struct platform_device *pdev)
508{ 484{
509 mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M | 485 /* mask timer interrupts, but leave alarm interrupts on to enable
510 BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); 486 power-on when alarm is triggered */
487 mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
511} 488}
512 489
513#ifdef CONFIG_PM 490#ifdef CONFIG_PM
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index ee0739b217b6..91ef669d98f6 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -933,7 +933,7 @@ static void ibmvfc_get_host_speed(struct Scsi_Host *shost)
933 fc_host_speed(shost) = FC_PORTSPEED_16GBIT; 933 fc_host_speed(shost) = FC_PORTSPEED_16GBIT;
934 break; 934 break;
935 default: 935 default:
936 ibmvfc_log(vhost, 3, "Unknown port speed: %ld Gbit\n", 936 ibmvfc_log(vhost, 3, "Unknown port speed: %lld Gbit\n",
937 vhost->login_buf->resp.link_speed / 100); 937 vhost->login_buf->resp.link_speed / 100);
938 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 938 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
939 break; 939 break;
@@ -2149,8 +2149,8 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
2149{ 2149{
2150 const char *desc = ibmvfc_get_ae_desc(crq->event); 2150 const char *desc = ibmvfc_get_ae_desc(crq->event);
2151 2151
2152 ibmvfc_log(vhost, 3, "%s event received. scsi_id: %lx, wwpn: %lx," 2152 ibmvfc_log(vhost, 3, "%s event received. scsi_id: %llx, wwpn: %llx,"
2153 " node_name: %lx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name); 2153 " node_name: %llx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name);
2154 2154
2155 switch (crq->event) { 2155 switch (crq->event) {
2156 case IBMVFC_AE_LINK_UP: 2156 case IBMVFC_AE_LINK_UP:
@@ -2184,7 +2184,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
2184 ibmvfc_link_down(vhost, IBMVFC_HALTED); 2184 ibmvfc_link_down(vhost, IBMVFC_HALTED);
2185 break; 2185 break;
2186 default: 2186 default:
2187 dev_err(vhost->dev, "Unknown async event received: %ld\n", crq->event); 2187 dev_err(vhost->dev, "Unknown async event received: %lld\n", crq->event);
2188 break; 2188 break;
2189 }; 2189 };
2190} 2190}
@@ -2261,13 +2261,13 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost)
2261 * actually sent 2261 * actually sent
2262 */ 2262 */
2263 if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) { 2263 if (unlikely(!ibmvfc_valid_event(&vhost->pool, evt))) {
2264 dev_err(vhost->dev, "Returned correlation_token 0x%08lx is invalid!\n", 2264 dev_err(vhost->dev, "Returned correlation_token 0x%08llx is invalid!\n",
2265 crq->ioba); 2265 crq->ioba);
2266 return; 2266 return;
2267 } 2267 }
2268 2268
2269 if (unlikely(atomic_read(&evt->free))) { 2269 if (unlikely(atomic_read(&evt->free))) {
2270 dev_err(vhost->dev, "Received duplicate correlation_token 0x%08lx!\n", 2270 dev_err(vhost->dev, "Received duplicate correlation_token 0x%08llx!\n",
2271 crq->ioba); 2271 crq->ioba);
2272 return; 2272 return;
2273 } 2273 }
@@ -3259,7 +3259,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id)
3259 3259
3260 tgt = mempool_alloc(vhost->tgt_pool, GFP_KERNEL); 3260 tgt = mempool_alloc(vhost->tgt_pool, GFP_KERNEL);
3261 if (!tgt) { 3261 if (!tgt) {
3262 dev_err(vhost->dev, "Target allocation failure for scsi id %08lx\n", 3262 dev_err(vhost->dev, "Target allocation failure for scsi id %08llx\n",
3263 scsi_id); 3263 scsi_id);
3264 return -ENOMEM; 3264 return -ENOMEM;
3265 } 3265 }
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index babdf3db59df..87dafd0f8d44 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -691,13 +691,13 @@ struct ibmvfc_host {
691#define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0) 691#define DBG_CMD(CMD) do { if (ibmvfc_debug) CMD; } while (0)
692 692
693#define tgt_dbg(t, fmt, ...) \ 693#define tgt_dbg(t, fmt, ...) \
694 DBG_CMD(dev_info((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__)) 694 DBG_CMD(dev_info((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__))
695 695
696#define tgt_info(t, fmt, ...) \ 696#define tgt_info(t, fmt, ...) \
697 dev_info((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__) 697 dev_info((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__)
698 698
699#define tgt_err(t, fmt, ...) \ 699#define tgt_err(t, fmt, ...) \
700 dev_err((t)->vhost->dev, "%lX: " fmt, (t)->scsi_id, ##__VA_ARGS__) 700 dev_err((t)->vhost->dev, "%llX: " fmt, (t)->scsi_id, ##__VA_ARGS__)
701 701
702#define ibmvfc_dbg(vhost, ...) \ 702#define ibmvfc_dbg(vhost, ...) \
703 DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__)) 703 DBG_CMD(dev_info((vhost)->dev, ##__VA_ARGS__))
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 5c541f7850f9..74d07d137dae 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1061,7 +1061,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1061 } 1061 }
1062 1062
1063 sdev_printk(KERN_INFO, cmd->device, 1063 sdev_printk(KERN_INFO, cmd->device,
1064 "aborting command. lun 0x%lx, tag 0x%lx\n", 1064 "aborting command. lun 0x%llx, tag 0x%llx\n",
1065 (((u64) lun) << 48), (u64) found_evt); 1065 (((u64) lun) << 48), (u64) found_evt);
1066 1066
1067 wait_for_completion(&evt->comp); 1067 wait_for_completion(&evt->comp);
@@ -1082,7 +1082,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1082 if (rsp_rc) { 1082 if (rsp_rc) {
1083 if (printk_ratelimit()) 1083 if (printk_ratelimit())
1084 sdev_printk(KERN_WARNING, cmd->device, 1084 sdev_printk(KERN_WARNING, cmd->device,
1085 "abort code %d for task tag 0x%lx\n", 1085 "abort code %d for task tag 0x%llx\n",
1086 rsp_rc, tsk_mgmt->task_tag); 1086 rsp_rc, tsk_mgmt->task_tag);
1087 return FAILED; 1087 return FAILED;
1088 } 1088 }
@@ -1102,12 +1102,12 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
1102 1102
1103 if (found_evt == NULL) { 1103 if (found_evt == NULL) {
1104 spin_unlock_irqrestore(hostdata->host->host_lock, flags); 1104 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
1105 sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%lx completed\n", 1105 sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%llx completed\n",
1106 tsk_mgmt->task_tag); 1106 tsk_mgmt->task_tag);
1107 return SUCCESS; 1107 return SUCCESS;
1108 } 1108 }
1109 1109
1110 sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%lx\n", 1110 sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%llx\n",
1111 tsk_mgmt->task_tag); 1111 tsk_mgmt->task_tag);
1112 1112
1113 cmd->result = (DID_ABORT << 16); 1113 cmd->result = (DID_ABORT << 16);
@@ -1182,7 +1182,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1182 return FAILED; 1182 return FAILED;
1183 } 1183 }
1184 1184
1185 sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%lx\n", 1185 sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%llx\n",
1186 (((u64) lun) << 48)); 1186 (((u64) lun) << 48));
1187 1187
1188 wait_for_completion(&evt->comp); 1188 wait_for_completion(&evt->comp);
@@ -1203,7 +1203,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
1203 if (rsp_rc) { 1203 if (rsp_rc) {
1204 if (printk_ratelimit()) 1204 if (printk_ratelimit())
1205 sdev_printk(KERN_WARNING, cmd->device, 1205 sdev_printk(KERN_WARNING, cmd->device,
1206 "reset code %d for task tag 0x%lx\n", 1206 "reset code %d for task tag 0x%llx\n",
1207 rsp_rc, tsk_mgmt->task_tag); 1207 rsp_rc, tsk_mgmt->task_tag);
1208 return FAILED; 1208 return FAILED;
1209 } 1209 }
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 841f460edbc4..07829009a8be 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4912,7 +4912,7 @@ static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
4912 if (res && ipr_is_gata(res)) { 4912 if (res && ipr_is_gata(res)) {
4913 if (cmd == HDIO_GET_IDENTITY) 4913 if (cmd == HDIO_GET_IDENTITY)
4914 return -ENOTTY; 4914 return -ENOTTY;
4915 return ata_scsi_ioctl(sdev, cmd, arg); 4915 return ata_sas_scsi_ioctl(res->sata_port->ap, sdev, cmd, arg);
4916 } 4916 }
4917 4917
4918 return -EINVAL; 4918 return -EINVAL;
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index a745f91d2928..e7705d3532c9 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -177,7 +177,6 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
177 struct iscsi_segment *segment, int recv, 177 struct iscsi_segment *segment, int recv,
178 unsigned copied) 178 unsigned copied)
179{ 179{
180 static unsigned char padbuf[ISCSI_PAD_LEN];
181 struct scatterlist sg; 180 struct scatterlist sg;
182 unsigned int pad; 181 unsigned int pad;
183 182
@@ -233,7 +232,7 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
233 debug_tcp("consume %d pad bytes\n", pad); 232 debug_tcp("consume %d pad bytes\n", pad);
234 segment->total_size += pad; 233 segment->total_size += pad;
235 segment->size = pad; 234 segment->size = pad;
236 segment->data = padbuf; 235 segment->data = segment->padbuf;
237 return 0; 236 return 0;
238 } 237 }
239 } 238 }
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 744838780ada..1c558d3bce18 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -717,7 +717,7 @@ int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
717 struct domain_device *dev = sdev_to_domain_dev(sdev); 717 struct domain_device *dev = sdev_to_domain_dev(sdev);
718 718
719 if (dev_is_sata(dev)) 719 if (dev_is_sata(dev))
720 return ata_scsi_ioctl(sdev, cmd, arg); 720 return ata_sas_scsi_ioctl(dev->sata_dev.ap, sdev, cmd, arg);
721 721
722 return -EINVAL; 722 return -EINVAL;
723} 723}
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index ce48e2d0193c..ca0dd33497ec 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -290,11 +290,11 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data)
290 290
291 if (tag != dev->tag) 291 if (tag != dev->tag)
292 dev_err(&dev->sbd.core, 292 dev_err(&dev->sbd.core,
293 "%s:%u: tag mismatch, got %lx, expected %lx\n", 293 "%s:%u: tag mismatch, got %llx, expected %llx\n",
294 __func__, __LINE__, tag, dev->tag); 294 __func__, __LINE__, tag, dev->tag);
295 295
296 if (res) { 296 if (res) {
297 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n", 297 dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
298 __func__, __LINE__, res, status); 298 __func__, __LINE__, res, status);
299 return IRQ_HANDLED; 299 return IRQ_HANDLED;
300 } 300 }
@@ -364,7 +364,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev)
364 364
365 if (dev->blk_size != CD_FRAMESIZE) { 365 if (dev->blk_size != CD_FRAMESIZE) {
366 dev_err(&dev->sbd.core, 366 dev_err(&dev->sbd.core,
367 "%s:%u: cannot handle block size %lu\n", __func__, 367 "%s:%u: cannot handle block size %llu\n", __func__,
368 __LINE__, dev->blk_size); 368 __LINE__, dev->blk_size);
369 return -EINVAL; 369 return -EINVAL;
370 } 370 }
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2d4f32b4df5c..9ad4d0968e5c 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
1258{ 1258{
1259 int rval; 1259 int rval;
1260 unsigned long flags = 0; 1260 unsigned long flags = 0;
1261 int cnt; 1261 int cnt, que;
1262 struct qla_hw_data *ha = vha->hw; 1262 struct qla_hw_data *ha = vha->hw;
1263 struct req_que *req = ha->req_q_map[0]; 1263 struct req_que *req;
1264 struct rsp_que *rsp = ha->rsp_q_map[0]; 1264 struct rsp_que *rsp;
1265 struct scsi_qla_host *vp;
1265 struct mid_init_cb_24xx *mid_init_cb = 1266 struct mid_init_cb_24xx *mid_init_cb =
1266 (struct mid_init_cb_24xx *) ha->init_cb; 1267 (struct mid_init_cb_24xx *) ha->init_cb;
1267 1268
1268 spin_lock_irqsave(&ha->hardware_lock, flags); 1269 spin_lock_irqsave(&ha->hardware_lock, flags);
1269 1270
1270 /* Clear outstanding commands array. */ 1271 /* Clear outstanding commands array. */
1271 for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) 1272 for (que = 0; que < ha->max_queues; que++) {
1272 req->outstanding_cmds[cnt] = NULL; 1273 req = ha->req_q_map[que];
1274 if (!req)
1275 continue;
1276 for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
1277 req->outstanding_cmds[cnt] = NULL;
1273 1278
1274 req->current_outstanding_cmd = 0; 1279 req->current_outstanding_cmd = 0;
1275 1280
1276 /* Clear RSCN queue. */ 1281 /* Initialize firmware. */
1277 vha->rscn_in_ptr = 0; 1282 req->ring_ptr = req->ring;
1278 vha->rscn_out_ptr = 0; 1283 req->ring_index = 0;
1284 req->cnt = req->length;
1285 }
1279 1286
1280 /* Initialize firmware. */ 1287 for (que = 0; que < ha->max_queues; que++) {
1281 req->ring_ptr = req->ring; 1288 rsp = ha->rsp_q_map[que];
1282 req->ring_index = 0; 1289 if (!rsp)
1283 req->cnt = req->length; 1290 continue;
1284 rsp->ring_ptr = rsp->ring; 1291 rsp->ring_ptr = rsp->ring;
1285 rsp->ring_index = 0; 1292 rsp->ring_index = 0;
1286 1293
1287 /* Initialize response queue entries */ 1294 /* Initialize response queue entries */
1288 qla2x00_init_response_q_entries(rsp); 1295 qla2x00_init_response_q_entries(rsp);
1296 }
1289 1297
1298 /* Clear RSCN queue. */
1299 list_for_each_entry(vp, &ha->vp_list, list) {
1300 vp->rscn_in_ptr = 0;
1301 vp->rscn_out_ptr = 0;
1302 }
1290 ha->isp_ops->config_rings(vha); 1303 ha->isp_ops->config_rings(vha);
1291 1304
1292 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1305 spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -3212,8 +3225,8 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
3212 int rval = QLA_SUCCESS; 3225 int rval = QLA_SUCCESS;
3213 uint32_t wait_time; 3226 uint32_t wait_time;
3214 struct qla_hw_data *ha = vha->hw; 3227 struct qla_hw_data *ha = vha->hw;
3215 struct req_que *req = ha->req_q_map[0]; 3228 struct req_que *req = ha->req_q_map[vha->req_ques[0]];
3216 struct rsp_que *rsp = ha->rsp_q_map[0]; 3229 struct rsp_que *rsp = req->rsp;
3217 3230
3218 atomic_set(&vha->loop_state, LOOP_UPDATE); 3231 atomic_set(&vha->loop_state, LOOP_UPDATE);
3219 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); 3232 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
@@ -3492,6 +3505,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
3492 } 3505 }
3493 req = ha->req_q_map[i]; 3506 req = ha->req_q_map[i];
3494 if (req) { 3507 if (req) {
3508 /* Clear outstanding commands array. */
3495 req->options &= ~BIT_0; 3509 req->options &= ~BIT_0;
3496 ret = qla25xx_init_req_que(base_vha, req, req->options); 3510 ret = qla25xx_init_req_que(base_vha, req, req->options);
3497 if (ret != QLA_SUCCESS) 3511 if (ret != QLA_SUCCESS)
@@ -3500,7 +3514,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
3500 req->id)); 3514 req->id));
3501 else 3515 else
3502 DEBUG2_17(printk(KERN_WARNING 3516 DEBUG2_17(printk(KERN_WARNING
3503 "%s Rsp que:%d inited\n", __func__, 3517 "%s Req que:%d inited\n", __func__,
3504 req->id)); 3518 req->id));
3505 } 3519 }
3506 } 3520 }
@@ -4151,8 +4165,8 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
4151 uint16_t mb[MAILBOX_REGISTER_COUNT]; 4165 uint16_t mb[MAILBOX_REGISTER_COUNT];
4152 struct qla_hw_data *ha = vha->hw; 4166 struct qla_hw_data *ha = vha->hw;
4153 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); 4167 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
4154 struct req_que *req = ha->req_q_map[0]; 4168 struct req_que *req = ha->req_q_map[vha->req_ques[0]];
4155 struct rsp_que *rsp = ha->rsp_q_map[0]; 4169 struct rsp_que *rsp = req->rsp;
4156 4170
4157 if (!vha->vp_idx) 4171 if (!vha->vp_idx)
4158 return -EINVAL; 4172 return -EINVAL;
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 886323130fcc..f53179c46423 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -629,6 +629,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
629 req->ring_index = 0; 629 req->ring_index = 0;
630 req->cnt = req->length; 630 req->cnt = req->length;
631 req->id = que_id; 631 req->id = que_id;
632 req->max_q_depth = ha->req_q_map[0]->max_q_depth;
632 mutex_unlock(&ha->vport_lock); 633 mutex_unlock(&ha->vport_lock);
633 634
634 ret = qla25xx_init_req_que(base_vha, req, options); 635 ret = qla25xx_init_req_que(base_vha, req, options);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 4a71f522f925..cf32653fe01a 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1158,8 +1158,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
1158 struct req_que *req; 1158 struct req_que *req;
1159 1159
1160 spin_lock_irqsave(&ha->hardware_lock, flags); 1160 spin_lock_irqsave(&ha->hardware_lock, flags);
1161 for (que = 0; que < QLA_MAX_HOST_QUES; que++) { 1161 for (que = 0; que < ha->max_queues; que++) {
1162 req = ha->req_q_map[vha->req_ques[que]]; 1162 req = ha->req_q_map[que];
1163 if (!req) 1163 if (!req)
1164 continue; 1164 continue;
1165 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { 1165 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
@@ -1193,7 +1193,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1193 scsi_qla_host_t *vha = shost_priv(sdev->host); 1193 scsi_qla_host_t *vha = shost_priv(sdev->host);
1194 struct qla_hw_data *ha = vha->hw; 1194 struct qla_hw_data *ha = vha->hw;
1195 struct fc_rport *rport = starget_to_rport(sdev->sdev_target); 1195 struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
1196 struct req_que *req = ha->req_q_map[0]; 1196 struct req_que *req = ha->req_q_map[vha->req_ques[0]];
1197 1197
1198 if (sdev->tagged_supported) 1198 if (sdev->tagged_supported)
1199 scsi_activate_tcq(sdev, req->max_q_depth); 1199 scsi_activate_tcq(sdev, req->max_q_depth);
@@ -1998,7 +1998,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1998 return 0; 1998 return 0;
1999 1999
2000probe_failed: 2000probe_failed:
2001 qla2x00_free_que(ha, req, rsp);
2002 qla2x00_free_device(base_vha); 2001 qla2x00_free_device(base_vha);
2003 2002
2004 scsi_host_put(base_vha->host); 2003 scsi_host_put(base_vha->host);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 42e72a2c1f98..cbcd3f681b62 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1095,7 +1095,8 @@ EXPORT_SYMBOL(__starget_for_each_device);
1095 * Description: Looks up the scsi_device with the specified @lun for a given 1095 * Description: Looks up the scsi_device with the specified @lun for a given
1096 * @starget. The returned scsi_device does not have an additional 1096 * @starget. The returned scsi_device does not have an additional
1097 * reference. You must hold the host's host_lock over this call and 1097 * reference. You must hold the host's host_lock over this call and
1098 * any access to the returned scsi_device. 1098 * any access to the returned scsi_device. A scsi_device in state
1099 * SDEV_DEL is skipped.
1099 * 1100 *
1100 * Note: The only reason why drivers should use this is because 1101 * Note: The only reason why drivers should use this is because
1101 * they need to access the device list in irq context. Otherwise you 1102 * they need to access the device list in irq context. Otherwise you
@@ -1107,6 +1108,8 @@ struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget,
1107 struct scsi_device *sdev; 1108 struct scsi_device *sdev;
1108 1109
1109 list_for_each_entry(sdev, &starget->devices, same_target_siblings) { 1110 list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
1111 if (sdev->sdev_state == SDEV_DEL)
1112 continue;
1110 if (sdev->lun ==lun) 1113 if (sdev->lun ==lun)
1111 return sdev; 1114 return sdev;
1112 } 1115 }
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 4969e4ec75ea..099b5455bbce 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -224,6 +224,7 @@ static struct {
224 {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, 224 {"SGI", "TP9100", "*", BLIST_REPORTLUN2},
225 {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 225 {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
226 {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 226 {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
227 {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
227 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, 228 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
228 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, 229 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
229 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ 230 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 1889a63ebc22..0d934bfbdd9b 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2839,6 +2839,8 @@ int __init early_serial_setup(struct uart_port *port)
2839 p->flags = port->flags; 2839 p->flags = port->flags;
2840 p->mapbase = port->mapbase; 2840 p->mapbase = port->mapbase;
2841 p->private_data = port->private_data; 2841 p->private_data = port->private_data;
2842 p->type = port->type;
2843 p->line = port->line;
2842 2844
2843 set_io_from_upio(p); 2845 set_io_from_upio(p);
2844 if (port->serial_in) 2846 if (port->serial_in)
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index c088146b7513..2a3671233b15 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -602,6 +602,10 @@ static int pci_netmos_init(struct pci_dev *dev)
602 /* subdevice 0x00PS means <P> parallel, <S> serial */ 602 /* subdevice 0x00PS means <P> parallel, <S> serial */
603 unsigned int num_serial = dev->subsystem_device & 0xf; 603 unsigned int num_serial = dev->subsystem_device & 0xf;
604 604
605 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
606 dev->subsystem_device == 0x0299)
607 return 0;
608
605 if (num_serial == 0) 609 if (num_serial == 0)
606 return -ENODEV; 610 return -ENODEV;
607 return num_serial; 611 return num_serial;
@@ -3096,6 +3100,10 @@ static struct pci_device_id serial_pci_tbl[] = {
3096 0, 3100 0,
3097 pbn_b0_8_115200 }, 3101 pbn_b0_8_115200 },
3098 3102
3103 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
3104 PCI_VENDOR_ID_IBM, 0x0299,
3105 0, 0, pbn_b0_bt_2_115200 },
3106
3099 /* 3107 /*
3100 * These entries match devices with class COMMUNICATION_SERIAL, 3108 * These entries match devices with class COMMUNICATION_SERIAL,
3101 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL 3109 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index fde7f9ccf57e..bbcfc26a3b6d 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -270,6 +270,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
270 { "RSS0250", 0 }, 270 { "RSS0250", 0 },
271 /* SupraExpress 28.8 Data/Fax PnP modem */ 271 /* SupraExpress 28.8 Data/Fax PnP modem */
272 { "SUP1310", 0 }, 272 { "SUP1310", 0 },
273 /* SupraExpress 336i PnP Voice Modem */
274 { "SUP1381", 0 },
273 /* SupraExpress 33.6 Data/Fax PnP modem */ 275 /* SupraExpress 33.6 Data/Fax PnP modem */
274 { "SUP1421", 0 }, 276 { "SUP1421", 0 },
275 /* SupraExpress 33.6 Data/Fax PnP modem */ 277 /* SupraExpress 33.6 Data/Fax PnP modem */
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index d5efd6c77904..89362d733d62 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -579,7 +579,7 @@ static void atmel_tx_dma(struct uart_port *port)
579 /* disable PDC transmit */ 579 /* disable PDC transmit */
580 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); 580 UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
581 581
582 if (!uart_circ_empty(xmit)) { 582 if (!uart_circ_empty(xmit) && !uart_tx_stopped(port)) {
583 dma_sync_single_for_device(port->dev, 583 dma_sync_single_for_device(port->dev,
584 pdc->dma_addr, 584 pdc->dma_addr,
585 pdc->dma_size, 585 pdc->dma_size,
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index a821e3a3d664..14f8fa9135be 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -163,6 +163,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
163 { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, 163 { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, },
164 { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, 164 { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, },
165 { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, 165 { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, },
166 { .type = "serial", .compatible = "ns16850", .data = (void *)PORT_16850, },
166#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL 167#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
167 { .type = "serial", .compatible = "ibm,qpace-nwp-serial", 168 { .type = "serial", .compatible = "ibm,qpace-nwp-serial",
168 .data = (void *)PORT_NWPSERIAL, }, 169 .data = (void *)PORT_NWPSERIAL, },
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 22e30d21225e..1bb8f1b45767 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | 187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); 188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { 189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
190 ch = serial_in(sport, PNX8XXX_FIFO); 190 ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
191 191
192 sport->port.icount.rx++; 192 sport->port.icount.rx++;
193 193
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
198 * out of the main execution path 198 * out of the main execution path
199 */ 199 */
200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | 200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
201 PNX8XXX_UART_FIFO_RXPAR) | 201 PNX8XXX_UART_FIFO_RXPAR |
202 PNX8XXX_UART_FIFO_RXBRK) |
202 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { 203 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
203 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) 204 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) {
205 status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
206 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR));
207 sport->port.icount.brk++;
208 if (uart_handle_break(&sport->port))
209 goto ignore_char;
210 } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
204 sport->port.icount.parity++; 211 sport->port.icount.parity++;
205 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) 212 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
206 sport->port.icount.frame++; 213 sport->port.icount.frame++;
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
284 /* Get the interrupts */ 291 /* Get the interrupts */
285 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); 292 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
286 293
287 /* Break signal received */ 294 /* Byte or break signal received */
288 if (status & PNX8XXX_UART_INT_BREAK) { 295 if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK))
289 sport->port.icount.brk++;
290 uart_handle_break(&sport->port);
291 }
292
293 /* Byte received */
294 if (status & PNX8XXX_UART_INT_RX)
295 pnx8xxx_rx_chars(sport); 296 pnx8xxx_rx_chars(sport);
296 297
297 /* TX holding register empty - transmit a byte */ 298 /* TX holding register empty - transmit a byte */
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 5e39bac9c51b..56ff3e6864ea 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -670,8 +670,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
670 dev_dbg(controller, "new message %p submitted for %s\n", 670 dev_dbg(controller, "new message %p submitted for %s\n",
671 msg, spi->dev.bus_id); 671 msg, spi->dev.bus_id);
672 672
673 if (unlikely(list_empty(&msg->transfers) 673 if (unlikely(list_empty(&msg->transfers)))
674 || !spi->max_speed_hz))
675 return -EINVAL; 674 return -EINVAL;
676 675
677 if (as->stopping) 676 if (as->stopping)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 68d6f4988fb5..fe7e5f35e5d0 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -15,12 +15,15 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18
19#include <linux/of_platform.h>
20#include <linux/of_device.h>
21#include <linux/of_spi.h>
22
18#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
19#include <linux/spi/spi_bitbang.h> 24#include <linux/spi/spi_bitbang.h>
20#include <linux/io.h> 25#include <linux/io.h>
21 26
22#include <syslib/virtex_devices.h>
23
24#define XILINX_SPI_NAME "xilinx_spi" 27#define XILINX_SPI_NAME "xilinx_spi"
25 28
26/* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e) 29/* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e)
@@ -144,23 +147,14 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
144 struct spi_transfer *t) 147 struct spi_transfer *t)
145{ 148{
146 u8 bits_per_word; 149 u8 bits_per_word;
147 u32 hz;
148 struct xilinx_spi *xspi = spi_master_get_devdata(spi->master);
149 150
150 bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; 151 bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
151 hz = (t) ? t->speed_hz : spi->max_speed_hz;
152 if (bits_per_word != 8) { 152 if (bits_per_word != 8) {
153 dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", 153 dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
154 __func__, bits_per_word); 154 __func__, bits_per_word);
155 return -EINVAL; 155 return -EINVAL;
156 } 156 }
157 157
158 if (hz && xspi->speed_hz > hz) {
159 dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n",
160 __func__, hz);
161 return -EINVAL;
162 }
163
164 return 0; 158 return 0;
165} 159}
166 160
@@ -304,32 +298,38 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
304 return IRQ_HANDLED; 298 return IRQ_HANDLED;
305} 299}
306 300
307static int __init xilinx_spi_probe(struct platform_device *dev) 301static int __init xilinx_spi_of_probe(struct of_device *ofdev,
302 const struct of_device_id *match)
308{ 303{
309 int ret = 0;
310 struct spi_master *master; 304 struct spi_master *master;
311 struct xilinx_spi *xspi; 305 struct xilinx_spi *xspi;
312 struct xspi_platform_data *pdata; 306 struct resource r_irq_struct;
313 struct resource *r; 307 struct resource r_mem_struct;
308
309 struct resource *r_irq = &r_irq_struct;
310 struct resource *r_mem = &r_mem_struct;
311 int rc = 0;
312 const u32 *prop;
313 int len;
314 314
315 /* Get resources(memory, IRQ) associated with the device */ 315 /* Get resources(memory, IRQ) associated with the device */
316 master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); 316 master = spi_alloc_master(&ofdev->dev, sizeof(struct xilinx_spi));
317 317
318 if (master == NULL) { 318 if (master == NULL) {
319 return -ENOMEM; 319 return -ENOMEM;
320 } 320 }
321 321
322 platform_set_drvdata(dev, master); 322 dev_set_drvdata(&ofdev->dev, master);
323 pdata = dev->dev.platform_data;
324 323
325 if (pdata == NULL) { 324 rc = of_address_to_resource(ofdev->node, 0, r_mem);
326 ret = -ENODEV; 325 if (rc) {
326 dev_warn(&ofdev->dev, "invalid address\n");
327 goto put_master; 327 goto put_master;
328 } 328 }
329 329
330 r = platform_get_resource(dev, IORESOURCE_MEM, 0); 330 rc = of_irq_to_resource(ofdev->node, 0, r_irq);
331 if (r == NULL) { 331 if (rc == NO_IRQ) {
332 ret = -ENODEV; 332 dev_warn(&ofdev->dev, "no IRQ found\n");
333 goto put_master; 333 goto put_master;
334 } 334 }
335 335
@@ -341,47 +341,57 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
341 xspi->bitbang.master->setup = xilinx_spi_setup; 341 xspi->bitbang.master->setup = xilinx_spi_setup;
342 init_completion(&xspi->done); 342 init_completion(&xspi->done);
343 343
344 if (!request_mem_region(r->start, 344 xspi->irq = r_irq->start;
345 r->end - r->start + 1, XILINX_SPI_NAME)) { 345
346 ret = -ENXIO; 346 if (!request_mem_region(r_mem->start,
347 r_mem->end - r_mem->start + 1, XILINX_SPI_NAME)) {
348 rc = -ENXIO;
349 dev_warn(&ofdev->dev, "memory request failure\n");
347 goto put_master; 350 goto put_master;
348 } 351 }
349 352
350 xspi->regs = ioremap(r->start, r->end - r->start + 1); 353 xspi->regs = ioremap(r_mem->start, r_mem->end - r_mem->start + 1);
351 if (xspi->regs == NULL) { 354 if (xspi->regs == NULL) {
352 ret = -ENOMEM; 355 rc = -ENOMEM;
356 dev_warn(&ofdev->dev, "ioremap failure\n");
353 goto put_master; 357 goto put_master;
354 } 358 }
359 xspi->irq = r_irq->start;
355 360
356 ret = platform_get_irq(dev, 0); 361 /* dynamic bus assignment */
357 if (ret < 0) { 362 master->bus_num = -1;
358 ret = -ENXIO;
359 goto unmap_io;
360 }
361 xspi->irq = ret;
362 363
363 master->bus_num = pdata->bus_num; 364 /* number of slave select bits is required */
364 master->num_chipselect = pdata->num_chipselect; 365 prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len);
365 xspi->speed_hz = pdata->speed_hz; 366 if (!prop || len < sizeof(*prop)) {
367 dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n");
368 goto put_master;
369 }
370 master->num_chipselect = *prop;
366 371
367 /* SPI controller initializations */ 372 /* SPI controller initializations */
368 xspi_init_hw(xspi->regs); 373 xspi_init_hw(xspi->regs);
369 374
370 /* Register for SPI Interrupt */ 375 /* Register for SPI Interrupt */
371 ret = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); 376 rc = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi);
372 if (ret != 0) 377 if (rc != 0) {
378 dev_warn(&ofdev->dev, "irq request failure: %d\n", xspi->irq);
373 goto unmap_io; 379 goto unmap_io;
380 }
374 381
375 ret = spi_bitbang_start(&xspi->bitbang); 382 rc = spi_bitbang_start(&xspi->bitbang);
376 if (ret != 0) { 383 if (rc != 0) {
377 dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); 384 dev_err(&ofdev->dev, "spi_bitbang_start FAILED\n");
378 goto free_irq; 385 goto free_irq;
379 } 386 }
380 387
381 dev_info(&dev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", 388 dev_info(&ofdev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n",
382 r->start, (u32)xspi->regs, xspi->irq); 389 (unsigned int)r_mem->start, (u32)xspi->regs, xspi->irq);
383 390
384 return ret; 391 /* Add any subnodes on the SPI bus */
392 of_register_spi_devices(master, ofdev->node);
393
394 return rc;
385 395
386free_irq: 396free_irq:
387 free_irq(xspi->irq, xspi); 397 free_irq(xspi->irq, xspi);
@@ -389,21 +399,21 @@ unmap_io:
389 iounmap(xspi->regs); 399 iounmap(xspi->regs);
390put_master: 400put_master:
391 spi_master_put(master); 401 spi_master_put(master);
392 return ret; 402 return rc;
393} 403}
394 404
395static int __devexit xilinx_spi_remove(struct platform_device *dev) 405static int __devexit xilinx_spi_remove(struct of_device *ofdev)
396{ 406{
397 struct xilinx_spi *xspi; 407 struct xilinx_spi *xspi;
398 struct spi_master *master; 408 struct spi_master *master;
399 409
400 master = platform_get_drvdata(dev); 410 master = platform_get_drvdata(ofdev);
401 xspi = spi_master_get_devdata(master); 411 xspi = spi_master_get_devdata(master);
402 412
403 spi_bitbang_stop(&xspi->bitbang); 413 spi_bitbang_stop(&xspi->bitbang);
404 free_irq(xspi->irq, xspi); 414 free_irq(xspi->irq, xspi);
405 iounmap(xspi->regs); 415 iounmap(xspi->regs);
406 platform_set_drvdata(dev, 0); 416 dev_set_drvdata(&ofdev->dev, 0);
407 spi_master_put(xspi->bitbang.master); 417 spi_master_put(xspi->bitbang.master);
408 418
409 return 0; 419 return 0;
@@ -412,27 +422,42 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev)
412/* work with hotplug and coldplug */ 422/* work with hotplug and coldplug */
413MODULE_ALIAS("platform:" XILINX_SPI_NAME); 423MODULE_ALIAS("platform:" XILINX_SPI_NAME);
414 424
415static struct platform_driver xilinx_spi_driver = { 425static int __exit xilinx_spi_of_remove(struct of_device *op)
416 .probe = xilinx_spi_probe, 426{
417 .remove = __devexit_p(xilinx_spi_remove), 427 return xilinx_spi_remove(op);
428}
429
430static struct of_device_id xilinx_spi_of_match[] = {
431 { .compatible = "xlnx,xps-spi-2.00.a", },
432 { .compatible = "xlnx,xps-spi-2.00.b", },
433 {}
434};
435
436MODULE_DEVICE_TABLE(of, xilinx_spi_of_match);
437
438static struct of_platform_driver xilinx_spi_of_driver = {
439 .owner = THIS_MODULE,
440 .name = "xilinx-xps-spi",
441 .match_table = xilinx_spi_of_match,
442 .probe = xilinx_spi_of_probe,
443 .remove = __exit_p(xilinx_spi_of_remove),
418 .driver = { 444 .driver = {
419 .name = XILINX_SPI_NAME, 445 .name = "xilinx-xps-spi",
420 .owner = THIS_MODULE, 446 .owner = THIS_MODULE,
421 }, 447 },
422}; 448};
423 449
424static int __init xilinx_spi_init(void) 450static int __init xilinx_spi_init(void)
425{ 451{
426 return platform_driver_register(&xilinx_spi_driver); 452 return of_register_platform_driver(&xilinx_spi_of_driver);
427} 453}
428module_init(xilinx_spi_init); 454module_init(xilinx_spi_init);
429 455
430static void __exit xilinx_spi_exit(void) 456static void __exit xilinx_spi_exit(void)
431{ 457{
432 platform_driver_unregister(&xilinx_spi_driver); 458 of_unregister_platform_driver(&xilinx_spi_of_driver);
433} 459}
434module_exit(xilinx_spi_exit); 460module_exit(xilinx_spi_exit);
435
436MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); 461MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>");
437MODULE_DESCRIPTION("Xilinx SPI driver"); 462MODULE_DESCRIPTION("Xilinx SPI driver");
438MODULE_LICENSE("GPL"); 463MODULE_LICENSE("GPL");
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index d5d0e40b1e2d..94d5ee263c20 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1554,7 +1554,7 @@ static int usb_configure_device_otg(struct usb_device *udev)
1554 * (Includes HNP test device.) 1554 * (Includes HNP test device.)
1555 */ 1555 */
1556 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { 1556 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
1557 err = usb_port_suspend(udev); 1557 err = usb_port_suspend(udev, PMSG_SUSPEND);
1558 if (err < 0) 1558 if (err < 0)
1559 dev_dbg(&udev->dev, "HNP fail, %d\n", err); 1559 dev_dbg(&udev->dev, "HNP fail, %d\n", err);
1560 } 1560 }
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index ef6cfa5a447f..c70a8f667d85 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2030,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work)
2030 spin_unlock_irqrestore(&priv->rx_lock, flags); 2030 spin_unlock_irqrestore(&priv->rx_lock, flags);
2031 dbg("%s - deferring remainder until unthrottled", 2031 dbg("%s - deferring remainder until unthrottled",
2032 __func__); 2032 __func__);
2033 return; 2033 goto out;
2034 } 2034 }
2035 spin_unlock_irqrestore(&priv->rx_lock, flags); 2035 spin_unlock_irqrestore(&priv->rx_lock, flags);
2036 /* if the port is closed stop trying to read */ 2036 /* if the port is closed stop trying to read */
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index 7644ed249564..37e60b1d2ed9 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -335,7 +335,20 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var,
335 struct fb_info *info) 335 struct fb_info *info)
336{ 336{
337 337
338 if (var->bits_per_pixel != LCD_BPP) { 338 switch (var->bits_per_pixel) {
339 case 24:/* TRUECOLOUR, 16m */
340 var->red.offset = 16;
341 var->green.offset = 8;
342 var->blue.offset = 0;
343 var->red.length = var->green.length = var->blue.length = 8;
344 var->transp.offset = 0;
345 var->transp.length = 0;
346 var->transp.msb_right = 0;
347 var->red.msb_right = 0;
348 var->green.msb_right = 0;
349 var->blue.msb_right = 0;
350 break;
351 default:
339 pr_debug("%s: depth not supported: %u BPP\n", __func__, 352 pr_debug("%s: depth not supported: %u BPP\n", __func__,
340 var->bits_per_pixel); 353 var->bits_per_pixel);
341 return -EINVAL; 354 return -EINVAL;
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
index a9b3ada05d99..2a423d3a2a8e 100644
--- a/drivers/video/bfin-t350mcqb-fb.c
+++ b/drivers/video/bfin-t350mcqb-fb.c
@@ -254,7 +254,20 @@ static int bfin_t350mcqb_fb_check_var(struct fb_var_screeninfo *var,
254 struct fb_info *info) 254 struct fb_info *info)
255{ 255{
256 256
257 if (var->bits_per_pixel != LCD_BPP) { 257 switch (var->bits_per_pixel) {
258 case 24:/* TRUECOLOUR, 16m */
259 var->red.offset = 0;
260 var->green.offset = 8;
261 var->blue.offset = 16;
262 var->red.length = var->green.length = var->blue.length = 8;
263 var->transp.offset = 0;
264 var->transp.length = 0;
265 var->transp.msb_right = 0;
266 var->red.msb_right = 0;
267 var->green.msb_right = 0;
268 var->blue.msb_right = 0;
269 break;
270 default:
258 pr_debug("%s: depth not supported: %u BPP\n", __func__, 271 pr_debug("%s: depth not supported: %u BPP\n", __func__,
259 var->bits_per_pixel); 272 var->bits_per_pixel);
260 return -EINVAL; 273 return -EINVAL;
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 38ac805db97d..87f826e4c958 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1006,7 +1006,7 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev)
1006 __func__, status); 1006 __func__, status);
1007 return -ENXIO; 1007 return -ENXIO;
1008 } 1008 }
1009 dev_dbg(dev, "video:%p ioif:%lx lpar:%lx size:%lx\n", 1009 dev_dbg(dev, "video:%p ioif:%lx lpar:%llx size:%lx\n",
1010 ps3fb_videomemory.address, GPU_IOIF, xdr_lpar, 1010 ps3fb_videomemory.address, GPU_IOIF, xdr_lpar,
1011 ps3fb_videomemory.size); 1011 ps3fb_videomemory.size);
1012 1012
@@ -1133,7 +1133,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1133 __func__, status); 1133 __func__, status);
1134 goto err; 1134 goto err;
1135 } 1135 }
1136 dev_dbg(&dev->core, "ddr:lpar:0x%lx\n", ddr_lpar); 1136 dev_dbg(&dev->core, "ddr:lpar:0x%llx\n", ddr_lpar);
1137 1137
1138 status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0, 1138 status = lv1_gpu_context_allocate(ps3fb.memory_handle, 0,
1139 &ps3fb.context_handle, 1139 &ps3fb.context_handle,
diff --git a/fs/aio.c b/fs/aio.c
index d6f89d3c15e8..8fa77e233944 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1270,7 +1270,7 @@ static void io_destroy(struct kioctx *ioctx)
1270 * pointer is passed for ctxp. Will fail with -ENOSYS if not 1270 * pointer is passed for ctxp. Will fail with -ENOSYS if not
1271 * implemented. 1271 * implemented.
1272 */ 1272 */
1273asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp) 1273SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
1274{ 1274{
1275 struct kioctx *ioctx = NULL; 1275 struct kioctx *ioctx = NULL;
1276 unsigned long ctx; 1276 unsigned long ctx;
@@ -1308,7 +1308,7 @@ out:
1308 * implemented. May fail with -EFAULT if the context pointed to 1308 * implemented. May fail with -EFAULT if the context pointed to
1309 * is invalid. 1309 * is invalid.
1310 */ 1310 */
1311asmlinkage long sys_io_destroy(aio_context_t ctx) 1311SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
1312{ 1312{
1313 struct kioctx *ioctx = lookup_ioctx(ctx); 1313 struct kioctx *ioctx = lookup_ioctx(ctx);
1314 if (likely(NULL != ioctx)) { 1314 if (likely(NULL != ioctx)) {
@@ -1662,8 +1662,8 @@ out_put_req:
1662 * are available to queue any iocbs. Will return 0 if nr is 0. Will 1662 * are available to queue any iocbs. Will return 0 if nr is 0. Will
1663 * fail with -ENOSYS if not implemented. 1663 * fail with -ENOSYS if not implemented.
1664 */ 1664 */
1665asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr, 1665SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
1666 struct iocb __user * __user *iocbpp) 1666 struct iocb __user * __user *, iocbpp)
1667{ 1667{
1668 struct kioctx *ctx; 1668 struct kioctx *ctx;
1669 long ret = 0; 1669 long ret = 0;
@@ -1737,8 +1737,8 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
1737 * invalid. May fail with -EAGAIN if the iocb specified was not 1737 * invalid. May fail with -EAGAIN if the iocb specified was not
1738 * cancelled. Will fail with -ENOSYS if not implemented. 1738 * cancelled. Will fail with -ENOSYS if not implemented.
1739 */ 1739 */
1740asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, 1740SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
1741 struct io_event __user *result) 1741 struct io_event __user *, result)
1742{ 1742{
1743 int (*cancel)(struct kiocb *iocb, struct io_event *res); 1743 int (*cancel)(struct kiocb *iocb, struct io_event *res);
1744 struct kioctx *ctx; 1744 struct kioctx *ctx;
@@ -1799,11 +1799,11 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1799 * will be updated if not NULL and the operation blocks. Will fail 1799 * will be updated if not NULL and the operation blocks. Will fail
1800 * with -ENOSYS if not implemented. 1800 * with -ENOSYS if not implemented.
1801 */ 1801 */
1802asmlinkage long sys_io_getevents(aio_context_t ctx_id, 1802SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
1803 long min_nr, 1803 long, min_nr,
1804 long nr, 1804 long, nr,
1805 struct io_event __user *events, 1805 struct io_event __user *, events,
1806 struct timespec __user *timeout) 1806 struct timespec __user *, timeout)
1807{ 1807{
1808 struct kioctx *ioctx = lookup_ioctx(ctx_id); 1808 struct kioctx *ioctx = lookup_ioctx(ctx_id);
1809 long ret = -EINVAL; 1809 long ret = -EINVAL;
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index 78049ea208db..b320b103fa13 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -22,13 +22,20 @@
22 22
23#define BTRFS_IOCTL_MAGIC 0x94 23#define BTRFS_IOCTL_MAGIC 0x94
24#define BTRFS_VOL_NAME_MAX 255 24#define BTRFS_VOL_NAME_MAX 255
25#define BTRFS_PATH_NAME_MAX 3072 25#define BTRFS_PATH_NAME_MAX 4087
26 26
27/* this should be 4k */
27struct btrfs_ioctl_vol_args { 28struct btrfs_ioctl_vol_args {
28 __s64 fd; 29 __s64 fd;
29 char name[BTRFS_PATH_NAME_MAX + 1]; 30 char name[BTRFS_PATH_NAME_MAX + 1];
30}; 31};
31 32
33struct btrfs_ioctl_clone_range_args {
34 __s64 src_fd;
35 __u64 src_offset, src_length;
36 __u64 dest_offset;
37};
38
32#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ 39#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
33 struct btrfs_ioctl_vol_args) 40 struct btrfs_ioctl_vol_args)
34#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ 41#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -52,11 +59,6 @@ struct btrfs_ioctl_vol_args {
52 struct btrfs_ioctl_vol_args) 59 struct btrfs_ioctl_vol_args)
53#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ 60#define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
54 struct btrfs_ioctl_vol_args) 61 struct btrfs_ioctl_vol_args)
55struct btrfs_ioctl_clone_range_args {
56 __s64 src_fd;
57 __u64 src_offset, src_length;
58 __u64 dest_offset;
59};
60 62
61#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ 63#define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
62 struct btrfs_ioctl_clone_range_args) 64 struct btrfs_ioctl_clone_range_args)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0a14b495532f..db9fb3bc1e33 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -38,6 +38,7 @@
38#include <linux/namei.h> 38#include <linux/namei.h>
39#include <linux/miscdevice.h> 39#include <linux/miscdevice.h>
40#include <linux/version.h> 40#include <linux/version.h>
41#include <linux/magic.h>
41#include "compat.h" 42#include "compat.h"
42#include "ctree.h" 43#include "ctree.h"
43#include "disk-io.h" 44#include "disk-io.h"
@@ -51,7 +52,6 @@
51#include "export.h" 52#include "export.h"
52#include "compression.h" 53#include "compression.h"
53 54
54#define BTRFS_SUPER_MAGIC 0x9123683E
55 55
56static struct super_operations btrfs_super_ops; 56static struct super_operations btrfs_super_ops;
57 57
@@ -582,7 +582,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
582{ 582{
583 struct btrfs_ioctl_vol_args *vol; 583 struct btrfs_ioctl_vol_args *vol;
584 struct btrfs_fs_devices *fs_devices; 584 struct btrfs_fs_devices *fs_devices;
585 int ret = 0; 585 int ret = -ENOTTY;
586 int len; 586 int len;
587 587
588 if (!capable(CAP_SYS_ADMIN)) 588 if (!capable(CAP_SYS_ADMIN))
@@ -594,6 +594,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
594 goto out; 594 goto out;
595 } 595 }
596 len = strnlen(vol->name, BTRFS_PATH_NAME_MAX); 596 len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
597
597 switch (cmd) { 598 switch (cmd) {
598 case BTRFS_IOC_SCAN_DEV: 599 case BTRFS_IOC_SCAN_DEV:
599 ret = btrfs_scan_one_device(vol->name, FMODE_READ, 600 ret = btrfs_scan_one_device(vol->name, FMODE_READ,
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b187b537888e..3451e1cca2b5 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -220,6 +220,7 @@ loop:
220 tail->bi_next = old_head; 220 tail->bi_next = old_head;
221 else 221 else
222 device->pending_bio_tail = tail; 222 device->pending_bio_tail = tail;
223 device->running_pending = 0;
223 224
224 spin_unlock(&device->io_lock); 225 spin_unlock(&device->io_lock);
225 btrfs_requeue_work(&device->work); 226 btrfs_requeue_work(&device->work);
diff --git a/fs/buffer.c b/fs/buffer.c
index b6e8b8632e2f..b58208f1640a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3243,7 +3243,7 @@ void block_sync_page(struct page *page)
3243 * Use of bdflush() is deprecated and will be removed in a future kernel. 3243 * Use of bdflush() is deprecated and will be removed in a future kernel.
3244 * The `pdflush' kernel threads fully replace bdflush daemons and this call. 3244 * The `pdflush' kernel threads fully replace bdflush daemons and this call.
3245 */ 3245 */
3246asmlinkage long sys_bdflush(int func, long data) 3246SYSCALL_DEFINE2(bdflush, int, func, long, data)
3247{ 3247{
3248 static int msg_count; 3248 static int msg_count;
3249 3249
diff --git a/fs/compat.c b/fs/compat.c
index 30f2faa22f5c..65a070e705ab 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1709,7 +1709,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
1709} 1709}
1710 1710
1711#ifdef HAVE_SET_RESTORE_SIGMASK 1711#ifdef HAVE_SET_RESTORE_SIGMASK
1712asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp, 1712static long do_compat_pselect(int n, compat_ulong_t __user *inp,
1713 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1713 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
1714 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask, 1714 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask,
1715 compat_size_t sigsetsize) 1715 compat_size_t sigsetsize)
@@ -1775,8 +1775,8 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
1775 (compat_size_t __user *)(sig+sizeof(up)))) 1775 (compat_size_t __user *)(sig+sizeof(up))))
1776 return -EFAULT; 1776 return -EFAULT;
1777 } 1777 }
1778 return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up), 1778 return do_compat_pselect(n, inp, outp, exp, tsp, compat_ptr(up),
1779 sigsetsize); 1779 sigsetsize);
1780} 1780}
1781 1781
1782asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 1782asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
diff --git a/fs/dcache.c b/fs/dcache.c
index 4547f66884a0..937df0fb0da5 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2092,7 +2092,7 @@ Elong:
2092 * return NULL; 2092 * return NULL;
2093 * } 2093 * }
2094 */ 2094 */
2095asmlinkage long sys_getcwd(char __user *buf, unsigned long size) 2095SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
2096{ 2096{
2097 int error; 2097 int error;
2098 struct path pwd, root; 2098 struct path pwd, root;
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 180e9fec4ad8..a21cabdbd87b 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -145,7 +145,7 @@ out:
145/* And here is where the userspace process can look up the cookie value 145/* And here is where the userspace process can look up the cookie value
146 * to retrieve the path. 146 * to retrieve the path.
147 */ 147 */
148asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) 148SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
149{ 149{
150 unsigned long cookie = (unsigned long)cookie64; 150 unsigned long cookie = (unsigned long)cookie64;
151 int err = -EINVAL; 151 int err = -EINVAL;
@@ -198,7 +198,13 @@ out:
198 mutex_unlock(&dcookie_mutex); 198 mutex_unlock(&dcookie_mutex);
199 return err; 199 return err;
200} 200}
201 201#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
202asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len)
203{
204 return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len);
205}
206SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie);
207#endif
202 208
203static int dcookie_init(void) 209static int dcookie_init(void)
204{ 210{
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 08bf558d0408..5de2c2db3aa2 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -198,7 +198,7 @@ struct file *eventfd_fget(int fd)
198 return file; 198 return file;
199} 199}
200 200
201asmlinkage long sys_eventfd2(unsigned int count, int flags) 201SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
202{ 202{
203 int fd; 203 int fd;
204 struct eventfd_ctx *ctx; 204 struct eventfd_ctx *ctx;
@@ -228,8 +228,7 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags)
228 return fd; 228 return fd;
229} 229}
230 230
231asmlinkage long sys_eventfd(unsigned int count) 231SYSCALL_DEFINE1(eventfd, unsigned int, count)
232{ 232{
233 return sys_eventfd2(count, 0); 233 return sys_eventfd2(count, 0);
234} 234}
235
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 96355d505347..ba2f9ec71192 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1110,7 +1110,7 @@ retry:
1110/* 1110/*
1111 * Open an eventpoll file descriptor. 1111 * Open an eventpoll file descriptor.
1112 */ 1112 */
1113asmlinkage long sys_epoll_create1(int flags) 1113SYSCALL_DEFINE1(epoll_create1, int, flags)
1114{ 1114{
1115 int error, fd = -1; 1115 int error, fd = -1;
1116 struct eventpoll *ep; 1116 struct eventpoll *ep;
@@ -1150,7 +1150,7 @@ error_return:
1150 return fd; 1150 return fd;
1151} 1151}
1152 1152
1153asmlinkage long sys_epoll_create(int size) 1153SYSCALL_DEFINE1(epoll_create, int, size)
1154{ 1154{
1155 if (size < 0) 1155 if (size < 0)
1156 return -EINVAL; 1156 return -EINVAL;
@@ -1163,8 +1163,8 @@ asmlinkage long sys_epoll_create(int size)
1163 * the eventpoll file that enables the insertion/removal/change of 1163 * the eventpoll file that enables the insertion/removal/change of
1164 * file descriptors inside the interest set. 1164 * file descriptors inside the interest set.
1165 */ 1165 */
1166asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, 1166SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
1167 struct epoll_event __user *event) 1167 struct epoll_event __user *, event)
1168{ 1168{
1169 int error; 1169 int error;
1170 struct file *file, *tfile; 1170 struct file *file, *tfile;
@@ -1261,8 +1261,8 @@ error_return:
1261 * Implement the event wait interface for the eventpoll file. It is the kernel 1261 * Implement the event wait interface for the eventpoll file. It is the kernel
1262 * part of the user space epoll_wait(2). 1262 * part of the user space epoll_wait(2).
1263 */ 1263 */
1264asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, 1264SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events,
1265 int maxevents, int timeout) 1265 int, maxevents, int, timeout)
1266{ 1266{
1267 int error; 1267 int error;
1268 struct file *file; 1268 struct file *file;
@@ -1319,9 +1319,9 @@ error_return:
1319 * Implement the event wait interface for the eventpoll file. It is the kernel 1319 * Implement the event wait interface for the eventpoll file. It is the kernel
1320 * part of the user space epoll_pwait(2). 1320 * part of the user space epoll_pwait(2).
1321 */ 1321 */
1322asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events, 1322SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
1323 int maxevents, int timeout, const sigset_t __user *sigmask, 1323 int, maxevents, int, timeout, const sigset_t __user *, sigmask,
1324 size_t sigsetsize) 1324 size_t, sigsetsize)
1325{ 1325{
1326 int error; 1326 int error;
1327 sigset_t ksigmask, sigsaved; 1327 sigset_t ksigmask, sigsaved;
diff --git a/fs/exec.c b/fs/exec.c
index 71a6efe5d8bd..0dd60a01f1b4 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -99,7 +99,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
99 * 99 *
100 * Also note that we take the address to load from from the file itself. 100 * Also note that we take the address to load from from the file itself.
101 */ 101 */
102asmlinkage long sys_uselib(const char __user * library) 102SYSCALL_DEFINE1(uselib, const char __user *, library)
103{ 103{
104 struct file *file; 104 struct file *file;
105 struct nameidata nd; 105 struct nameidata nd;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 9a0fc400f91c..2999d72153b7 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -95,10 +95,13 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
95 mark_inode_dirty(dir); 95 mark_inode_dirty(dir);
96 } 96 }
97 97
98 if (IS_DIRSYNC(dir)) 98 if (IS_DIRSYNC(dir)) {
99 err = write_one_page(page, 1); 99 err = write_one_page(page, 1);
100 else 100 if (!err)
101 err = ext2_sync_inode(dir);
102 } else {
101 unlock_page(page); 103 unlock_page(page);
104 }
102 105
103 return err; 106 return err;
104} 107}
diff --git a/fs/fcntl.c b/fs/fcntl.c
index cdc141946724..bd215cc791da 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -50,7 +50,7 @@ static int get_close_on_exec(unsigned int fd)
50 return res; 50 return res;
51} 51}
52 52
53asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags) 53SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
54{ 54{
55 int err = -EBADF; 55 int err = -EBADF;
56 struct file * file, *tofree; 56 struct file * file, *tofree;
@@ -113,7 +113,7 @@ out_unlock:
113 return err; 113 return err;
114} 114}
115 115
116asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) 116SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
117{ 117{
118 if (unlikely(newfd == oldfd)) { /* corner case */ 118 if (unlikely(newfd == oldfd)) { /* corner case */
119 struct files_struct *files = current->files; 119 struct files_struct *files = current->files;
@@ -126,7 +126,7 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
126 return sys_dup3(oldfd, newfd, 0); 126 return sys_dup3(oldfd, newfd, 0);
127} 127}
128 128
129asmlinkage long sys_dup(unsigned int fildes) 129SYSCALL_DEFINE1(dup, unsigned int, fildes)
130{ 130{
131 int ret = -EBADF; 131 int ret = -EBADF;
132 struct file *file = fget(fildes); 132 struct file *file = fget(fildes);
@@ -335,7 +335,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
335 return err; 335 return err;
336} 336}
337 337
338asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) 338SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
339{ 339{
340 struct file *filp; 340 struct file *filp;
341 long err = -EBADF; 341 long err = -EBADF;
@@ -358,7 +358,8 @@ out:
358} 358}
359 359
360#if BITS_PER_LONG == 32 360#if BITS_PER_LONG == 32
361asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) 361SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
362 unsigned long, arg)
362{ 363{
363 struct file * filp; 364 struct file * filp;
364 long err; 365 long err;
diff --git a/fs/filesystems.c b/fs/filesystems.c
index d488dcd7f2bb..1aa70260e6d1 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -179,7 +179,7 @@ static int fs_maxindex(void)
179/* 179/*
180 * Whee.. Weird sysv syscall. 180 * Whee.. Weird sysv syscall.
181 */ 181 */
182asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2) 182SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
183{ 183{
184 int retval = -EINVAL; 184 int retval = -EINVAL;
185 185
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 20b0a8a24c6b..240ec63984cb 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -542,7 +542,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
542 return error; 542 return error;
543} 543}
544 544
545asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) 545SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
546{ 546{
547 struct file *filp; 547 struct file *filp;
548 int error = -EBADF; 548 int error = -EBADF;
diff --git a/fs/ioprio.c b/fs/ioprio.c
index 1a39ac370942..c7c0b28d7d21 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -72,7 +72,7 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
72} 72}
73EXPORT_SYMBOL_GPL(set_task_ioprio); 73EXPORT_SYMBOL_GPL(set_task_ioprio);
74 74
75asmlinkage long sys_ioprio_set(int which, int who, int ioprio) 75SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
76{ 76{
77 int class = IOPRIO_PRIO_CLASS(ioprio); 77 int class = IOPRIO_PRIO_CLASS(ioprio);
78 int data = IOPRIO_PRIO_DATA(ioprio); 78 int data = IOPRIO_PRIO_DATA(ioprio);
@@ -188,7 +188,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
188 return aprio; 188 return aprio;
189} 189}
190 190
191asmlinkage long sys_ioprio_get(int which, int who) 191SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
192{ 192{
193 struct task_struct *g, *p; 193 struct task_struct *g, *p;
194 struct user_struct *user; 194 struct user_struct *user;
@@ -252,4 +252,3 @@ asmlinkage long sys_ioprio_get(int which, int who)
252 read_unlock(&tasklist_lock); 252 read_unlock(&tasklist_lock);
253 return ret; 253 return ret;
254} 254}
255
diff --git a/fs/locks.c b/fs/locks.c
index 46a2e12f7d42..ec3deea29e37 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1564,7 +1564,7 @@ EXPORT_SYMBOL(flock_lock_file_wait);
1564 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other 1564 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other
1565 * processes read and write access respectively. 1565 * processes read and write access respectively.
1566 */ 1566 */
1567asmlinkage long sys_flock(unsigned int fd, unsigned int cmd) 1567SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
1568{ 1568{
1569 struct file *filp; 1569 struct file *filp;
1570 struct file_lock *lock; 1570 struct file_lock *lock;
diff --git a/fs/namei.c b/fs/namei.c
index f05bed242422..bbc15c237558 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1962,8 +1962,8 @@ static int may_mknod(mode_t mode)
1962 } 1962 }
1963} 1963}
1964 1964
1965asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode, 1965SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode,
1966 unsigned dev) 1966 unsigned, dev)
1967{ 1967{
1968 int error; 1968 int error;
1969 char *tmp; 1969 char *tmp;
@@ -2017,7 +2017,7 @@ out_unlock:
2017 return error; 2017 return error;
2018} 2018}
2019 2019
2020asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev) 2020SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev)
2021{ 2021{
2022 return sys_mknodat(AT_FDCWD, filename, mode, dev); 2022 return sys_mknodat(AT_FDCWD, filename, mode, dev);
2023} 2023}
@@ -2044,7 +2044,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2044 return error; 2044 return error;
2045} 2045}
2046 2046
2047asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode) 2047SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode)
2048{ 2048{
2049 int error = 0; 2049 int error = 0;
2050 char * tmp; 2050 char * tmp;
@@ -2081,7 +2081,7 @@ out_err:
2081 return error; 2081 return error;
2082} 2082}
2083 2083
2084asmlinkage long sys_mkdir(const char __user *pathname, int mode) 2084SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode)
2085{ 2085{
2086 return sys_mkdirat(AT_FDCWD, pathname, mode); 2086 return sys_mkdirat(AT_FDCWD, pathname, mode);
2087} 2087}
@@ -2195,7 +2195,7 @@ exit1:
2195 return error; 2195 return error;
2196} 2196}
2197 2197
2198asmlinkage long sys_rmdir(const char __user *pathname) 2198SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
2199{ 2199{
2200 return do_rmdir(AT_FDCWD, pathname); 2200 return do_rmdir(AT_FDCWD, pathname);
2201} 2201}
@@ -2291,7 +2291,7 @@ slashes:
2291 goto exit2; 2291 goto exit2;
2292} 2292}
2293 2293
2294asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag) 2294SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
2295{ 2295{
2296 if ((flag & ~AT_REMOVEDIR) != 0) 2296 if ((flag & ~AT_REMOVEDIR) != 0)
2297 return -EINVAL; 2297 return -EINVAL;
@@ -2302,7 +2302,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag)
2302 return do_unlinkat(dfd, pathname); 2302 return do_unlinkat(dfd, pathname);
2303} 2303}
2304 2304
2305asmlinkage long sys_unlink(const char __user *pathname) 2305SYSCALL_DEFINE1(unlink, const char __user *, pathname)
2306{ 2306{
2307 return do_unlinkat(AT_FDCWD, pathname); 2307 return do_unlinkat(AT_FDCWD, pathname);
2308} 2308}
@@ -2328,8 +2328,8 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2328 return error; 2328 return error;
2329} 2329}
2330 2330
2331asmlinkage long sys_symlinkat(const char __user *oldname, 2331SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
2332 int newdfd, const char __user *newname) 2332 int, newdfd, const char __user *, newname)
2333{ 2333{
2334 int error; 2334 int error;
2335 char *from; 2335 char *from;
@@ -2370,7 +2370,7 @@ out_putname:
2370 return error; 2370 return error;
2371} 2371}
2372 2372
2373asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname) 2373SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
2374{ 2374{
2375 return sys_symlinkat(oldname, AT_FDCWD, newname); 2375 return sys_symlinkat(oldname, AT_FDCWD, newname);
2376} 2376}
@@ -2422,9 +2422,8 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2422 * with linux 2.0, and to avoid hard-linking to directories 2422 * with linux 2.0, and to avoid hard-linking to directories
2423 * and other special files. --ADM 2423 * and other special files. --ADM
2424 */ 2424 */
2425asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 2425SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
2426 int newdfd, const char __user *newname, 2426 int, newdfd, const char __user *, newname, int, flags)
2427 int flags)
2428{ 2427{
2429 struct dentry *new_dentry; 2428 struct dentry *new_dentry;
2430 struct nameidata nd; 2429 struct nameidata nd;
@@ -2473,7 +2472,7 @@ out:
2473 return error; 2472 return error;
2474} 2473}
2475 2474
2476asmlinkage long sys_link(const char __user *oldname, const char __user *newname) 2475SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname)
2477{ 2476{
2478 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); 2477 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
2479} 2478}
@@ -2624,8 +2623,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2624 return error; 2623 return error;
2625} 2624}
2626 2625
2627asmlinkage long sys_renameat(int olddfd, const char __user *oldname, 2626SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
2628 int newdfd, const char __user *newname) 2627 int, newdfd, const char __user *, newname)
2629{ 2628{
2630 struct dentry *old_dir, *new_dir; 2629 struct dentry *old_dir, *new_dir;
2631 struct dentry *old_dentry, *new_dentry; 2630 struct dentry *old_dentry, *new_dentry;
@@ -2718,7 +2717,7 @@ exit:
2718 return error; 2717 return error;
2719} 2718}
2720 2719
2721asmlinkage long sys_rename(const char __user *oldname, const char __user *newname) 2720SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname)
2722{ 2721{
2723 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname); 2722 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname);
2724} 2723}
diff --git a/fs/namespace.c b/fs/namespace.c
index a40685d800a8..228d8c4bfd18 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1128,7 +1128,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1128 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD 1128 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
1129 */ 1129 */
1130 1130
1131asmlinkage long sys_umount(char __user * name, int flags) 1131SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1132{ 1132{
1133 struct path path; 1133 struct path path;
1134 int retval; 1134 int retval;
@@ -1160,7 +1160,7 @@ out:
1160/* 1160/*
1161 * The 2.0 compatible umount. No flags. 1161 * The 2.0 compatible umount. No flags.
1162 */ 1162 */
1163asmlinkage long sys_oldumount(char __user * name) 1163SYSCALL_DEFINE1(oldumount, char __user *, name)
1164{ 1164{
1165 return sys_umount(name, 0); 1165 return sys_umount(name, 0);
1166} 1166}
@@ -2045,9 +2045,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
2045 return new_ns; 2045 return new_ns;
2046} 2046}
2047 2047
2048asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, 2048SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
2049 char __user * type, unsigned long flags, 2049 char __user *, type, unsigned long, flags, void __user *, data)
2050 void __user * data)
2051{ 2050{
2052 int retval; 2051 int retval;
2053 unsigned long data_page; 2052 unsigned long data_page;
@@ -2172,8 +2171,8 @@ static void chroot_fs_refs(struct path *old_root, struct path *new_root)
2172 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root 2171 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
2173 * first. 2172 * first.
2174 */ 2173 */
2175asmlinkage long sys_pivot_root(const char __user * new_root, 2174SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2176 const char __user * put_old) 2175 const char __user *, put_old)
2177{ 2176{
2178 struct vfsmount *tmp; 2177 struct vfsmount *tmp;
2179 struct path new, old, parent_path, root_parent, root; 2178 struct path new, old, parent_path, root_parent, root;
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index b27451909dff..8f9a20556f79 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -86,8 +86,8 @@ static struct {
86 }, 86 },
87}; 87};
88 88
89long 89SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg,
90asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res) 90 void __user *, res)
91{ 91{
92 struct file *file; 92 struct file *file;
93 void __user *p = &arg->u; 93 void __user *p = &arg->u;
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 81b8644b0136..d53a1838d6e8 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -576,7 +576,7 @@ static const struct inotify_operations inotify_user_ops = {
576 .destroy_watch = free_inotify_user_watch, 576 .destroy_watch = free_inotify_user_watch,
577}; 577};
578 578
579asmlinkage long sys_inotify_init1(int flags) 579SYSCALL_DEFINE1(inotify_init1, int, flags)
580{ 580{
581 struct inotify_device *dev; 581 struct inotify_device *dev;
582 struct inotify_handle *ih; 582 struct inotify_handle *ih;
@@ -655,12 +655,13 @@ out_put_fd:
655 return ret; 655 return ret;
656} 656}
657 657
658asmlinkage long sys_inotify_init(void) 658SYSCALL_DEFINE0(inotify_init)
659{ 659{
660 return sys_inotify_init1(0); 660 return sys_inotify_init1(0);
661} 661}
662 662
663asmlinkage long sys_inotify_add_watch(int fd, const char __user *pathname, u32 mask) 663SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
664 u32, mask)
664{ 665{
665 struct inode *inode; 666 struct inode *inode;
666 struct inotify_device *dev; 667 struct inotify_device *dev;
@@ -704,7 +705,7 @@ fput_and_out:
704 return ret; 705 return ret;
705} 706}
706 707
707asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd) 708SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
708{ 709{
709 struct file *filp; 710 struct file *filp;
710 struct inotify_device *dev; 711 struct inotify_device *dev;
diff --git a/fs/open.c b/fs/open.c
index d882fd2351d6..a3a78ceb2a2b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -122,7 +122,7 @@ static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
122 return 0; 122 return 0;
123} 123}
124 124
125asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf) 125SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf)
126{ 126{
127 struct path path; 127 struct path path;
128 int error; 128 int error;
@@ -138,8 +138,7 @@ asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * b
138 return error; 138 return error;
139} 139}
140 140
141 141SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf)
142asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf)
143{ 142{
144 struct path path; 143 struct path path;
145 long error; 144 long error;
@@ -157,8 +156,7 @@ asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct stat
157 return error; 156 return error;
158} 157}
159 158
160 159SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf)
161asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
162{ 160{
163 struct file * file; 161 struct file * file;
164 struct statfs tmp; 162 struct statfs tmp;
@@ -176,7 +174,7 @@ out:
176 return error; 174 return error;
177} 175}
178 176
179asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf) 177SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf)
180{ 178{
181 struct file * file; 179 struct file * file;
182 struct statfs64 tmp; 180 struct statfs64 tmp;
@@ -289,7 +287,7 @@ out:
289 return error; 287 return error;
290} 288}
291 289
292asmlinkage long sys_truncate(const char __user * path, unsigned long length) 290SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length)
293{ 291{
294 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ 292 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
295 return do_sys_truncate(path, (long)length); 293 return do_sys_truncate(path, (long)length);
@@ -341,7 +339,7 @@ out:
341 return error; 339 return error;
342} 340}
343 341
344asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) 342SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
345{ 343{
346 long ret = do_sys_ftruncate(fd, length, 1); 344 long ret = do_sys_ftruncate(fd, length, 1);
347 /* avoid REGPARM breakage on x86: */ 345 /* avoid REGPARM breakage on x86: */
@@ -351,21 +349,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
351 349
352/* LFS versions of truncate are only needed on 32 bit machines */ 350/* LFS versions of truncate are only needed on 32 bit machines */
353#if BITS_PER_LONG == 32 351#if BITS_PER_LONG == 32
354asmlinkage long sys_truncate64(const char __user * path, loff_t length) 352SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
355{ 353{
356 return do_sys_truncate(path, length); 354 return do_sys_truncate(path, length);
357} 355}
356#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
357asmlinkage long SyS_truncate64(long path, loff_t length)
358{
359 return SYSC_truncate64((const char __user *) path, length);
360}
361SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
362#endif
358 363
359asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 364SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
360{ 365{
361 long ret = do_sys_ftruncate(fd, length, 0); 366 long ret = do_sys_ftruncate(fd, length, 0);
362 /* avoid REGPARM breakage on x86: */ 367 /* avoid REGPARM breakage on x86: */
363 asmlinkage_protect(2, ret, fd, length); 368 asmlinkage_protect(2, ret, fd, length);
364 return ret; 369 return ret;
365} 370}
371#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
372asmlinkage long SyS_ftruncate64(long fd, loff_t length)
373{
374 return SYSC_ftruncate64((unsigned int) fd, length);
375}
376SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
366#endif 377#endif
378#endif /* BITS_PER_LONG == 32 */
367 379
368asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len) 380SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
369{ 381{
370 struct file *file; 382 struct file *file;
371 struct inode *inode; 383 struct inode *inode;
@@ -422,13 +434,20 @@ out_fput:
422out: 434out:
423 return ret; 435 return ret;
424} 436}
437#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
438asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
439{
440 return SYSC_fallocate((int)fd, (int)mode, offset, len);
441}
442SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
443#endif
425 444
426/* 445/*
427 * access() needs to use the real uid/gid, not the effective uid/gid. 446 * access() needs to use the real uid/gid, not the effective uid/gid.
428 * We do this by temporarily clearing all FS-related capabilities and 447 * We do this by temporarily clearing all FS-related capabilities and
429 * switching the fsuid/fsgid around to the real ones. 448 * switching the fsuid/fsgid around to the real ones.
430 */ 449 */
431asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) 450SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
432{ 451{
433 const struct cred *old_cred; 452 const struct cred *old_cred;
434 struct cred *override_cred; 453 struct cred *override_cred;
@@ -498,12 +517,12 @@ out:
498 return res; 517 return res;
499} 518}
500 519
501asmlinkage long sys_access(const char __user *filename, int mode) 520SYSCALL_DEFINE2(access, const char __user *, filename, int, mode)
502{ 521{
503 return sys_faccessat(AT_FDCWD, filename, mode); 522 return sys_faccessat(AT_FDCWD, filename, mode);
504} 523}
505 524
506asmlinkage long sys_chdir(const char __user * filename) 525SYSCALL_DEFINE1(chdir, const char __user *, filename)
507{ 526{
508 struct path path; 527 struct path path;
509 int error; 528 int error;
@@ -524,7 +543,7 @@ out:
524 return error; 543 return error;
525} 544}
526 545
527asmlinkage long sys_fchdir(unsigned int fd) 546SYSCALL_DEFINE1(fchdir, unsigned int, fd)
528{ 547{
529 struct file *file; 548 struct file *file;
530 struct inode *inode; 549 struct inode *inode;
@@ -550,7 +569,7 @@ out:
550 return error; 569 return error;
551} 570}
552 571
553asmlinkage long sys_chroot(const char __user * filename) 572SYSCALL_DEFINE1(chroot, const char __user *, filename)
554{ 573{
555 struct path path; 574 struct path path;
556 int error; 575 int error;
@@ -575,7 +594,7 @@ out:
575 return error; 594 return error;
576} 595}
577 596
578asmlinkage long sys_fchmod(unsigned int fd, mode_t mode) 597SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode)
579{ 598{
580 struct inode * inode; 599 struct inode * inode;
581 struct dentry * dentry; 600 struct dentry * dentry;
@@ -609,8 +628,7 @@ out:
609 return err; 628 return err;
610} 629}
611 630
612asmlinkage long sys_fchmodat(int dfd, const char __user *filename, 631SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode)
613 mode_t mode)
614{ 632{
615 struct path path; 633 struct path path;
616 struct inode *inode; 634 struct inode *inode;
@@ -639,7 +657,7 @@ out:
639 return error; 657 return error;
640} 658}
641 659
642asmlinkage long sys_chmod(const char __user *filename, mode_t mode) 660SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode)
643{ 661{
644 return sys_fchmodat(AT_FDCWD, filename, mode); 662 return sys_fchmodat(AT_FDCWD, filename, mode);
645} 663}
@@ -669,7 +687,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
669 return error; 687 return error;
670} 688}
671 689
672asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group) 690SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
673{ 691{
674 struct path path; 692 struct path path;
675 int error; 693 int error;
@@ -688,8 +706,8 @@ out:
688 return error; 706 return error;
689} 707}
690 708
691asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 709SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
692 gid_t group, int flag) 710 gid_t, group, int, flag)
693{ 711{
694 struct path path; 712 struct path path;
695 int error = -EINVAL; 713 int error = -EINVAL;
@@ -713,7 +731,7 @@ out:
713 return error; 731 return error;
714} 732}
715 733
716asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group) 734SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
717{ 735{
718 struct path path; 736 struct path path;
719 int error; 737 int error;
@@ -732,8 +750,7 @@ out:
732 return error; 750 return error;
733} 751}
734 752
735 753SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
736asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
737{ 754{
738 struct file * file; 755 struct file * file;
739 int error = -EBADF; 756 int error = -EBADF;
@@ -1029,7 +1046,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
1029 return fd; 1046 return fd;
1030} 1047}
1031 1048
1032asmlinkage long sys_open(const char __user *filename, int flags, int mode) 1049SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
1033{ 1050{
1034 long ret; 1051 long ret;
1035 1052
@@ -1042,8 +1059,8 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1042 return ret; 1059 return ret;
1043} 1060}
1044 1061
1045asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1062SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
1046 int mode) 1063 int, mode)
1047{ 1064{
1048 long ret; 1065 long ret;
1049 1066
@@ -1062,7 +1079,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1062 * For backward compatibility? Maybe this should be moved 1079 * For backward compatibility? Maybe this should be moved
1063 * into arch/i386 instead? 1080 * into arch/i386 instead?
1064 */ 1081 */
1065asmlinkage long sys_creat(const char __user * pathname, int mode) 1082SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode)
1066{ 1083{
1067 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); 1084 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1068} 1085}
@@ -1098,7 +1115,7 @@ EXPORT_SYMBOL(filp_close);
1098 * releasing the fd. This ensures that one clone task can't release 1115 * releasing the fd. This ensures that one clone task can't release
1099 * an fd while another clone is opening it. 1116 * an fd while another clone is opening it.
1100 */ 1117 */
1101asmlinkage long sys_close(unsigned int fd) 1118SYSCALL_DEFINE1(close, unsigned int, fd)
1102{ 1119{
1103 struct file * filp; 1120 struct file * filp;
1104 struct files_struct *files = current->files; 1121 struct files_struct *files = current->files;
@@ -1131,14 +1148,13 @@ out_unlock:
1131 spin_unlock(&files->file_lock); 1148 spin_unlock(&files->file_lock);
1132 return -EBADF; 1149 return -EBADF;
1133} 1150}
1134
1135EXPORT_SYMBOL(sys_close); 1151EXPORT_SYMBOL(sys_close);
1136 1152
1137/* 1153/*
1138 * This routine simulates a hangup on the tty, to arrange that users 1154 * This routine simulates a hangup on the tty, to arrange that users
1139 * are given clean terminals at login time. 1155 * are given clean terminals at login time.
1140 */ 1156 */
1141asmlinkage long sys_vhangup(void) 1157SYSCALL_DEFINE0(vhangup)
1142{ 1158{
1143 if (capable(CAP_SYS_TTY_CONFIG)) { 1159 if (capable(CAP_SYS_TTY_CONFIG)) {
1144 tty_vhangup_self(); 1160 tty_vhangup_self();
diff --git a/fs/pipe.c b/fs/pipe.c
index 891697112f66..3a48ba5179d5 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1043,7 +1043,7 @@ int do_pipe(int *fd)
1043 * sys_pipe() is the normal C calling standard for creating 1043 * sys_pipe() is the normal C calling standard for creating
1044 * a pipe. It's not the way Unix traditionally does this, though. 1044 * a pipe. It's not the way Unix traditionally does this, though.
1045 */ 1045 */
1046asmlinkage long __weak sys_pipe2(int __user *fildes, int flags) 1046SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
1047{ 1047{
1048 int fd[2]; 1048 int fd[2];
1049 int error; 1049 int error;
@@ -1059,7 +1059,7 @@ asmlinkage long __weak sys_pipe2(int __user *fildes, int flags)
1059 return error; 1059 return error;
1060} 1060}
1061 1061
1062asmlinkage long __weak sys_pipe(int __user *fildes) 1062SYSCALL_DEFINE1(pipe, int __user *, fildes)
1063{ 1063{
1064 return sys_pipe2(fildes, 0); 1064 return sys_pipe2(fildes, 0);
1065} 1065}
diff --git a/fs/quota.c b/fs/quota.c
index 4a8c94f05f76..d76ada914f98 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -371,7 +371,8 @@ static inline struct super_block *quotactl_block(const char __user *special)
371 * calls. Maybe we need to add the process quotas etc. in the future, 371 * calls. Maybe we need to add the process quotas etc. in the future,
372 * but we probably should use rlimits for that. 372 * but we probably should use rlimits for that.
373 */ 373 */
374asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr) 374SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
375 qid_t, id, void __user *, addr)
375{ 376{
376 uint cmds, type; 377 uint cmds, type;
377 struct super_block *sb = NULL; 378 struct super_block *sb = NULL;
diff --git a/fs/read_write.c b/fs/read_write.c
index 5cc6924eb158..400fe81c973e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -147,7 +147,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
147} 147}
148EXPORT_SYMBOL(vfs_llseek); 148EXPORT_SYMBOL(vfs_llseek);
149 149
150asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin) 150SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
151{ 151{
152 off_t retval; 152 off_t retval;
153 struct file * file; 153 struct file * file;
@@ -171,9 +171,9 @@ bad:
171} 171}
172 172
173#ifdef __ARCH_WANT_SYS_LLSEEK 173#ifdef __ARCH_WANT_SYS_LLSEEK
174asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 174SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
175 unsigned long offset_low, loff_t __user * result, 175 unsigned long, offset_low, loff_t __user *, result,
176 unsigned int origin) 176 unsigned int, origin)
177{ 177{
178 int retval; 178 int retval;
179 struct file * file; 179 struct file * file;
@@ -369,7 +369,7 @@ static inline void file_pos_write(struct file *file, loff_t pos)
369 file->f_pos = pos; 369 file->f_pos = pos;
370} 370}
371 371
372asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) 372SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
373{ 373{
374 struct file *file; 374 struct file *file;
375 ssize_t ret = -EBADF; 375 ssize_t ret = -EBADF;
@@ -386,7 +386,8 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
386 return ret; 386 return ret;
387} 387}
388 388
389asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) 389SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
390 size_t, count)
390{ 391{
391 struct file *file; 392 struct file *file;
392 ssize_t ret = -EBADF; 393 ssize_t ret = -EBADF;
@@ -403,8 +404,8 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co
403 return ret; 404 return ret;
404} 405}
405 406
406asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, 407SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
407 size_t count, loff_t pos) 408 size_t count, loff_t pos)
408{ 409{
409 struct file *file; 410 struct file *file;
410 ssize_t ret = -EBADF; 411 ssize_t ret = -EBADF;
@@ -423,9 +424,17 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
423 424
424 return ret; 425 return ret;
425} 426}
427#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
428asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
429{
430 return SYSC_pread64((unsigned int) fd, (char __user *) buf,
431 (size_t) count, pos);
432}
433SYSCALL_ALIAS(sys_pread64, SyS_pread64);
434#endif
426 435
427asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, 436SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
428 size_t count, loff_t pos) 437 size_t count, loff_t pos)
429{ 438{
430 struct file *file; 439 struct file *file;
431 ssize_t ret = -EBADF; 440 ssize_t ret = -EBADF;
@@ -444,6 +453,14 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
444 453
445 return ret; 454 return ret;
446} 455}
456#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
457asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
458{
459 return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
460 (size_t) count, pos);
461}
462SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
463#endif
447 464
448/* 465/*
449 * Reduce an iovec's length in-place. Return the resulting number of segments 466 * Reduce an iovec's length in-place. Return the resulting number of segments
@@ -672,8 +689,8 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
672 689
673EXPORT_SYMBOL(vfs_writev); 690EXPORT_SYMBOL(vfs_writev);
674 691
675asmlinkage ssize_t 692SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec,
676sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) 693 unsigned long, vlen)
677{ 694{
678 struct file *file; 695 struct file *file;
679 ssize_t ret = -EBADF; 696 ssize_t ret = -EBADF;
@@ -693,8 +710,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
693 return ret; 710 return ret;
694} 711}
695 712
696asmlinkage ssize_t 713SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
697sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) 714 unsigned long, vlen)
698{ 715{
699 struct file *file; 716 struct file *file;
700 ssize_t ret = -EBADF; 717 ssize_t ret = -EBADF;
@@ -812,7 +829,7 @@ out:
812 return retval; 829 return retval;
813} 830}
814 831
815asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count) 832SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count)
816{ 833{
817 loff_t pos; 834 loff_t pos;
818 off_t off; 835 off_t off;
@@ -831,7 +848,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz
831 return do_sendfile(out_fd, in_fd, NULL, count, 0); 848 return do_sendfile(out_fd, in_fd, NULL, count, 0);
832} 849}
833 850
834asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count) 851SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count)
835{ 852{
836 loff_t pos; 853 loff_t pos;
837 ssize_t ret; 854 ssize_t ret;
diff --git a/fs/readdir.c b/fs/readdir.c
index b318d9b5af2e..7723401f8d8b 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -102,7 +102,8 @@ efault:
102 return -EFAULT; 102 return -EFAULT;
103} 103}
104 104
105asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * dirent, unsigned int count) 105SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
106 struct old_linux_dirent __user *, dirent, unsigned int, count)
106{ 107{
107 int error; 108 int error;
108 struct file * file; 109 struct file * file;
@@ -187,7 +188,8 @@ efault:
187 return -EFAULT; 188 return -EFAULT;
188} 189}
189 190
190asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) 191SYSCALL_DEFINE3(getdents, unsigned int, fd,
192 struct linux_dirent __user *, dirent, unsigned int, count)
191{ 193{
192 struct file * file; 194 struct file * file;
193 struct linux_dirent __user * lastdirent; 195 struct linux_dirent __user * lastdirent;
@@ -268,7 +270,8 @@ efault:
268 return -EFAULT; 270 return -EFAULT;
269} 271}
270 272
271asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) 273SYSCALL_DEFINE3(getdents64, unsigned int, fd,
274 struct linux_dirent64 __user *, dirent, unsigned int, count)
272{ 275{
273 struct file * file; 276 struct file * file;
274 struct linux_dirent64 __user * lastdirent; 277 struct linux_dirent64 __user * lastdirent;
diff --git a/fs/select.c b/fs/select.c
index 08b91beed806..0fe0e1469df3 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -557,8 +557,8 @@ out_nofds:
557 return ret; 557 return ret;
558} 558}
559 559
560asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 560SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
561 fd_set __user *exp, struct timeval __user *tvp) 561 fd_set __user *, exp, struct timeval __user *, tvp)
562{ 562{
563 struct timespec end_time, *to = NULL; 563 struct timespec end_time, *to = NULL;
564 struct timeval tv; 564 struct timeval tv;
@@ -582,9 +582,9 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
582} 582}
583 583
584#ifdef HAVE_SET_RESTORE_SIGMASK 584#ifdef HAVE_SET_RESTORE_SIGMASK
585asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, 585static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp,
586 fd_set __user *exp, struct timespec __user *tsp, 586 fd_set __user *exp, struct timespec __user *tsp,
587 const sigset_t __user *sigmask, size_t sigsetsize) 587 const sigset_t __user *sigmask, size_t sigsetsize)
588{ 588{
589 sigset_t ksigmask, sigsaved; 589 sigset_t ksigmask, sigsaved;
590 struct timespec ts, end_time, *to = NULL; 590 struct timespec ts, end_time, *to = NULL;
@@ -610,7 +610,7 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
610 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); 610 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
611 } 611 }
612 612
613 ret = core_sys_select(n, inp, outp, exp, &end_time); 613 ret = core_sys_select(n, inp, outp, exp, to);
614 ret = poll_select_copy_remaining(&end_time, tsp, 0, ret); 614 ret = poll_select_copy_remaining(&end_time, tsp, 0, ret);
615 615
616 if (ret == -ERESTARTNOHAND) { 616 if (ret == -ERESTARTNOHAND) {
@@ -636,8 +636,9 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
636 * which has a pointer to the sigset_t itself followed by a size_t containing 636 * which has a pointer to the sigset_t itself followed by a size_t containing
637 * the sigset size. 637 * the sigset size.
638 */ 638 */
639asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, 639SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
640 fd_set __user *exp, struct timespec __user *tsp, void __user *sig) 640 fd_set __user *, exp, struct timespec __user *, tsp,
641 void __user *, sig)
641{ 642{
642 size_t sigsetsize = 0; 643 size_t sigsetsize = 0;
643 sigset_t __user *up = NULL; 644 sigset_t __user *up = NULL;
@@ -650,7 +651,7 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
650 return -EFAULT; 651 return -EFAULT;
651 } 652 }
652 653
653 return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize); 654 return do_pselect(n, inp, outp, exp, tsp, up, sigsetsize);
654} 655}
655#endif /* HAVE_SET_RESTORE_SIGMASK */ 656#endif /* HAVE_SET_RESTORE_SIGMASK */
656 657
@@ -854,8 +855,8 @@ static long do_restart_poll(struct restart_block *restart_block)
854 return ret; 855 return ret;
855} 856}
856 857
857asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 858SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
858 long timeout_msecs) 859 long, timeout_msecs)
859{ 860{
860 struct timespec end_time, *to = NULL; 861 struct timespec end_time, *to = NULL;
861 int ret; 862 int ret;
@@ -889,9 +890,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
889} 890}
890 891
891#ifdef HAVE_SET_RESTORE_SIGMASK 892#ifdef HAVE_SET_RESTORE_SIGMASK
892asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, 893SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds,
893 struct timespec __user *tsp, const sigset_t __user *sigmask, 894 struct timespec __user *, tsp, const sigset_t __user *, sigmask,
894 size_t sigsetsize) 895 size_t, sigsetsize)
895{ 896{
896 sigset_t ksigmask, sigsaved; 897 sigset_t ksigmask, sigsaved;
897 struct timespec ts, end_time, *to = NULL; 898 struct timespec ts, end_time, *to = NULL;
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 9c39bc7f8431..b07565c94386 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -205,8 +205,8 @@ static const struct file_operations signalfd_fops = {
205 .read = signalfd_read, 205 .read = signalfd_read,
206}; 206};
207 207
208asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, 208SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
209 size_t sizemask, int flags) 209 size_t, sizemask, int, flags)
210{ 210{
211 sigset_t sigmask; 211 sigset_t sigmask;
212 struct signalfd_ctx *ctx; 212 struct signalfd_ctx *ctx;
@@ -259,8 +259,8 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
259 return ufd; 259 return ufd;
260} 260}
261 261
262asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, 262SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
263 size_t sizemask) 263 size_t, sizemask)
264{ 264{
265 return sys_signalfd4(ufd, user_mask, sizemask, 0); 265 return sys_signalfd4(ufd, user_mask, sizemask, 0);
266} 266}
diff --git a/fs/splice.c b/fs/splice.c
index a54b3e3f10a7..4ed0ba44a966 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1435,8 +1435,8 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
1435 * Currently we punt and implement it as a normal copy, see pipe_to_user(). 1435 * Currently we punt and implement it as a normal copy, see pipe_to_user().
1436 * 1436 *
1437 */ 1437 */
1438asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, 1438SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
1439 unsigned long nr_segs, unsigned int flags) 1439 unsigned long, nr_segs, unsigned int, flags)
1440{ 1440{
1441 struct file *file; 1441 struct file *file;
1442 long error; 1442 long error;
@@ -1461,9 +1461,9 @@ asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
1461 return error; 1461 return error;
1462} 1462}
1463 1463
1464asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, 1464SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
1465 int fd_out, loff_t __user *off_out, 1465 int, fd_out, loff_t __user *, off_out,
1466 size_t len, unsigned int flags) 1466 size_t, len, unsigned int, flags)
1467{ 1467{
1468 long error; 1468 long error;
1469 struct file *in, *out; 1469 struct file *in, *out;
@@ -1685,7 +1685,7 @@ static long do_tee(struct file *in, struct file *out, size_t len,
1685 return ret; 1685 return ret;
1686} 1686}
1687 1687
1688asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags) 1688SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
1689{ 1689{
1690 struct file *in; 1690 struct file *in;
1691 int error, fput_in; 1691 int error, fput_in;
diff --git a/fs/squashfs/squashfs_fs.h b/fs/squashfs/squashfs_fs.h
index 6840da1bf21e..283daafc568e 100644
--- a/fs/squashfs/squashfs_fs.h
+++ b/fs/squashfs/squashfs_fs.h
@@ -26,7 +26,6 @@
26#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE 26#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE
27#define SQUASHFS_MAJOR 4 27#define SQUASHFS_MAJOR 4
28#define SQUASHFS_MINOR 0 28#define SQUASHFS_MINOR 0
29#define SQUASHFS_MAGIC 0x73717368
30#define SQUASHFS_START 0 29#define SQUASHFS_START 0
31 30
32/* size of metadata (inode and directory) blocks */ 31/* size of metadata (inode and directory) blocks */
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index a0466d7467b2..071df5b5b491 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/zlib.h> 37#include <linux/zlib.h>
38#include <linux/magic.h>
38 39
39#include "squashfs_fs.h" 40#include "squashfs_fs.h"
40#include "squashfs_fs_sb.h" 41#include "squashfs_fs_sb.h"
diff --git a/fs/stat.c b/fs/stat.c
index 7e12a6f82795..2db740a0cfb5 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -152,7 +152,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
152 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 152 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
153} 153}
154 154
155asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf) 155SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
156{ 156{
157 struct kstat stat; 157 struct kstat stat;
158 int error = vfs_stat_fd(AT_FDCWD, filename, &stat); 158 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
@@ -162,7 +162,8 @@ asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user
162 162
163 return error; 163 return error;
164} 164}
165asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf) 165
166SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
166{ 167{
167 struct kstat stat; 168 struct kstat stat;
168 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); 169 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
@@ -172,7 +173,8 @@ asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __use
172 173
173 return error; 174 return error;
174} 175}
175asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf) 176
177SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf)
176{ 178{
177 struct kstat stat; 179 struct kstat stat;
178 int error = vfs_fstat(fd, &stat); 180 int error = vfs_fstat(fd, &stat);
@@ -235,7 +237,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
235 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 237 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
236} 238}
237 239
238asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) 240SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
239{ 241{
240 struct kstat stat; 242 struct kstat stat;
241 int error = vfs_stat_fd(AT_FDCWD, filename, &stat); 243 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
@@ -246,7 +248,7 @@ asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf)
246 return error; 248 return error;
247} 249}
248 250
249asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) 251SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf)
250{ 252{
251 struct kstat stat; 253 struct kstat stat;
252 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); 254 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
@@ -258,8 +260,8 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf)
258} 260}
259 261
260#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) 262#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
261asmlinkage long sys_newfstatat(int dfd, char __user *filename, 263SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
262 struct stat __user *statbuf, int flag) 264 struct stat __user *, statbuf, int, flag)
263{ 265{
264 struct kstat stat; 266 struct kstat stat;
265 int error = -EINVAL; 267 int error = -EINVAL;
@@ -280,7 +282,7 @@ out:
280} 282}
281#endif 283#endif
282 284
283asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) 285SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
284{ 286{
285 struct kstat stat; 287 struct kstat stat;
286 int error = vfs_fstat(fd, &stat); 288 int error = vfs_fstat(fd, &stat);
@@ -291,8 +293,8 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf)
291 return error; 293 return error;
292} 294}
293 295
294asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, 296SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
295 char __user *buf, int bufsiz) 297 char __user *, buf, int, bufsiz)
296{ 298{
297 struct path path; 299 struct path path;
298 int error; 300 int error;
@@ -318,8 +320,8 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname,
318 return error; 320 return error;
319} 321}
320 322
321asmlinkage long sys_readlink(const char __user *path, char __user *buf, 323SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
322 int bufsiz) 324 int, bufsiz)
323{ 325{
324 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); 326 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz);
325} 327}
@@ -365,7 +367,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
365 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 367 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
366} 368}
367 369
368asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf) 370SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf)
369{ 371{
370 struct kstat stat; 372 struct kstat stat;
371 int error = vfs_stat(filename, &stat); 373 int error = vfs_stat(filename, &stat);
@@ -375,7 +377,8 @@ asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbu
375 377
376 return error; 378 return error;
377} 379}
378asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf) 380
381SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf)
379{ 382{
380 struct kstat stat; 383 struct kstat stat;
381 int error = vfs_lstat(filename, &stat); 384 int error = vfs_lstat(filename, &stat);
@@ -385,7 +388,8 @@ asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statb
385 388
386 return error; 389 return error;
387} 390}
388asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) 391
392SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf)
389{ 393{
390 struct kstat stat; 394 struct kstat stat;
391 int error = vfs_fstat(fd, &stat); 395 int error = vfs_fstat(fd, &stat);
@@ -396,8 +400,8 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf)
396 return error; 400 return error;
397} 401}
398 402
399asmlinkage long sys_fstatat64(int dfd, char __user *filename, 403SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
400 struct stat64 __user *statbuf, int flag) 404 struct stat64 __user *, statbuf, int, flag)
401{ 405{
402 struct kstat stat; 406 struct kstat stat;
403 int error = -EINVAL; 407 int error = -EINVAL;
diff --git a/fs/super.c b/fs/super.c
index ed080c417167..645e5403f2a0 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -544,7 +544,7 @@ rescan:
544 return NULL; 544 return NULL;
545} 545}
546 546
547asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) 547SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
548{ 548{
549 struct super_block *s; 549 struct super_block *s;
550 struct ustat tmp; 550 struct ustat tmp;
diff --git a/fs/sync.c b/fs/sync.c
index ac02b56548bc..a16d53e5fe9d 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -36,7 +36,7 @@ static void do_sync(unsigned long wait)
36 laptop_sync_completion(); 36 laptop_sync_completion();
37} 37}
38 38
39asmlinkage long sys_sync(void) 39SYSCALL_DEFINE0(sync)
40{ 40{
41 do_sync(1); 41 do_sync(1);
42 return 0; 42 return 0;
@@ -144,12 +144,12 @@ static int do_fsync(unsigned int fd, int datasync)
144 return ret; 144 return ret;
145} 145}
146 146
147asmlinkage long sys_fsync(unsigned int fd) 147SYSCALL_DEFINE1(fsync, unsigned int, fd)
148{ 148{
149 return do_fsync(fd, 0); 149 return do_fsync(fd, 0);
150} 150}
151 151
152asmlinkage long sys_fdatasync(unsigned int fd) 152SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
153{ 153{
154 return do_fsync(fd, 1); 154 return do_fsync(fd, 1);
155} 155}
@@ -201,8 +201,8 @@ asmlinkage long sys_fdatasync(unsigned int fd)
201 * already-instantiated disk blocks, there are no guarantees here that the data 201 * already-instantiated disk blocks, there are no guarantees here that the data
202 * will be available after a crash. 202 * will be available after a crash.
203 */ 203 */
204asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, 204SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
205 unsigned int flags) 205 unsigned int flags)
206{ 206{
207 int ret; 207 int ret;
208 struct file *file; 208 struct file *file;
@@ -262,14 +262,32 @@ out_put:
262out: 262out:
263 return ret; 263 return ret;
264} 264}
265#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
266asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes,
267 long flags)
268{
269 return SYSC_sync_file_range((int) fd, offset, nbytes,
270 (unsigned int) flags);
271}
272SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range);
273#endif
265 274
266/* It would be nice if people remember that not all the world's an i386 275/* It would be nice if people remember that not all the world's an i386
267 when they introduce new system calls */ 276 when they introduce new system calls */
268asmlinkage long sys_sync_file_range2(int fd, unsigned int flags, 277SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags,
269 loff_t offset, loff_t nbytes) 278 loff_t offset, loff_t nbytes)
270{ 279{
271 return sys_sync_file_range(fd, offset, nbytes, flags); 280 return sys_sync_file_range(fd, offset, nbytes, flags);
272} 281}
282#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
283asmlinkage long SyS_sync_file_range2(long fd, long flags,
284 loff_t offset, loff_t nbytes)
285{
286 return SYSC_sync_file_range2((int) fd, (unsigned int) flags,
287 offset, nbytes);
288}
289SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2);
290#endif
273 291
274/* 292/*
275 * `endbyte' is inclusive 293 * `endbyte' is inclusive
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 0862f0e49d0c..6a123b8ff3f5 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -177,7 +177,7 @@ static struct file *timerfd_fget(int fd)
177 return file; 177 return file;
178} 178}
179 179
180asmlinkage long sys_timerfd_create(int clockid, int flags) 180SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
181{ 181{
182 int ufd; 182 int ufd;
183 struct timerfd_ctx *ctx; 183 struct timerfd_ctx *ctx;
@@ -208,9 +208,9 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
208 return ufd; 208 return ufd;
209} 209}
210 210
211asmlinkage long sys_timerfd_settime(int ufd, int flags, 211SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
212 const struct itimerspec __user *utmr, 212 const struct itimerspec __user *, utmr,
213 struct itimerspec __user *otmr) 213 struct itimerspec __user *, otmr)
214{ 214{
215 struct file *file; 215 struct file *file;
216 struct timerfd_ctx *ctx; 216 struct timerfd_ctx *ctx;
@@ -265,7 +265,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
265 return 0; 265 return 0;
266} 266}
267 267
268asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr) 268SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
269{ 269{
270 struct file *file; 270 struct file *file;
271 struct timerfd_ctx *ctx; 271 struct timerfd_ctx *ctx;
diff --git a/fs/utimes.c b/fs/utimes.c
index 6929e3e91d05..e4c75db5d373 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -24,7 +24,7 @@
24 * must be owner or have write permission. 24 * must be owner or have write permission.
25 * Else, update from *times, must be owner or super user. 25 * Else, update from *times, must be owner or super user.
26 */ 26 */
27asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times) 27SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times)
28{ 28{
29 struct timespec tv[2]; 29 struct timespec tv[2];
30 30
@@ -170,7 +170,8 @@ out:
170 return error; 170 return error;
171} 171}
172 172
173asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __user *utimes, int flags) 173SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename,
174 struct timespec __user *, utimes, int, flags)
174{ 175{
175 struct timespec tstimes[2]; 176 struct timespec tstimes[2];
176 177
@@ -187,7 +188,8 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __
187 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 188 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags);
188} 189}
189 190
190asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __user *utimes) 191SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename,
192 struct timeval __user *, utimes)
191{ 193{
192 struct timeval times[2]; 194 struct timeval times[2];
193 struct timespec tstimes[2]; 195 struct timespec tstimes[2];
@@ -214,7 +216,8 @@ asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __u
214 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0); 216 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0);
215} 217}
216 218
217asmlinkage long sys_utimes(char __user *filename, struct timeval __user *utimes) 219SYSCALL_DEFINE2(utimes, char __user *, filename,
220 struct timeval __user *, utimes)
218{ 221{
219 return sys_futimesat(AT_FDCWD, filename, utimes); 222 return sys_futimesat(AT_FDCWD, filename, utimes);
220} 223}
diff --git a/fs/xattr.c b/fs/xattr.c
index 237804cd6b56..197c4fcac032 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -251,9 +251,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
251 return error; 251 return error;
252} 252}
253 253
254asmlinkage long 254SYSCALL_DEFINE5(setxattr, const char __user *, pathname,
255sys_setxattr(const char __user *pathname, const char __user *name, 255 const char __user *, name, const void __user *, value,
256 const void __user *value, size_t size, int flags) 256 size_t, size, int, flags)
257{ 257{
258 struct path path; 258 struct path path;
259 int error; 259 int error;
@@ -270,9 +270,9 @@ sys_setxattr(const char __user *pathname, const char __user *name,
270 return error; 270 return error;
271} 271}
272 272
273asmlinkage long 273SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname,
274sys_lsetxattr(const char __user *pathname, const char __user *name, 274 const char __user *, name, const void __user *, value,
275 const void __user *value, size_t size, int flags) 275 size_t, size, int, flags)
276{ 276{
277 struct path path; 277 struct path path;
278 int error; 278 int error;
@@ -289,9 +289,8 @@ sys_lsetxattr(const char __user *pathname, const char __user *name,
289 return error; 289 return error;
290} 290}
291 291
292asmlinkage long 292SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
293sys_fsetxattr(int fd, const char __user *name, const void __user *value, 293 const void __user *,value, size_t, size, int, flags)
294 size_t size, int flags)
295{ 294{
296 struct file *f; 295 struct file *f;
297 struct dentry *dentry; 296 struct dentry *dentry;
@@ -349,9 +348,8 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
349 return error; 348 return error;
350} 349}
351 350
352asmlinkage ssize_t 351SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
353sys_getxattr(const char __user *pathname, const char __user *name, 352 const char __user *, name, void __user *, value, size_t, size)
354 void __user *value, size_t size)
355{ 353{
356 struct path path; 354 struct path path;
357 ssize_t error; 355 ssize_t error;
@@ -364,9 +362,8 @@ sys_getxattr(const char __user *pathname, const char __user *name,
364 return error; 362 return error;
365} 363}
366 364
367asmlinkage ssize_t 365SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname,
368sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value, 366 const char __user *, name, void __user *, value, size_t, size)
369 size_t size)
370{ 367{
371 struct path path; 368 struct path path;
372 ssize_t error; 369 ssize_t error;
@@ -379,8 +376,8 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user
379 return error; 376 return error;
380} 377}
381 378
382asmlinkage ssize_t 379SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
383sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) 380 void __user *, value, size_t, size)
384{ 381{
385 struct file *f; 382 struct file *f;
386 ssize_t error = -EBADF; 383 ssize_t error = -EBADF;
@@ -424,8 +421,8 @@ listxattr(struct dentry *d, char __user *list, size_t size)
424 return error; 421 return error;
425} 422}
426 423
427asmlinkage ssize_t 424SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list,
428sys_listxattr(const char __user *pathname, char __user *list, size_t size) 425 size_t, size)
429{ 426{
430 struct path path; 427 struct path path;
431 ssize_t error; 428 ssize_t error;
@@ -438,8 +435,8 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size)
438 return error; 435 return error;
439} 436}
440 437
441asmlinkage ssize_t 438SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list,
442sys_llistxattr(const char __user *pathname, char __user *list, size_t size) 439 size_t, size)
443{ 440{
444 struct path path; 441 struct path path;
445 ssize_t error; 442 ssize_t error;
@@ -452,8 +449,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
452 return error; 449 return error;
453} 450}
454 451
455asmlinkage ssize_t 452SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
456sys_flistxattr(int fd, char __user *list, size_t size)
457{ 453{
458 struct file *f; 454 struct file *f;
459 ssize_t error = -EBADF; 455 ssize_t error = -EBADF;
@@ -485,8 +481,8 @@ removexattr(struct dentry *d, const char __user *name)
485 return vfs_removexattr(d, kname); 481 return vfs_removexattr(d, kname);
486} 482}
487 483
488asmlinkage long 484SYSCALL_DEFINE2(removexattr, const char __user *, pathname,
489sys_removexattr(const char __user *pathname, const char __user *name) 485 const char __user *, name)
490{ 486{
491 struct path path; 487 struct path path;
492 int error; 488 int error;
@@ -503,8 +499,8 @@ sys_removexattr(const char __user *pathname, const char __user *name)
503 return error; 499 return error;
504} 500}
505 501
506asmlinkage long 502SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
507sys_lremovexattr(const char __user *pathname, const char __user *name) 503 const char __user *, name)
508{ 504{
509 struct path path; 505 struct path path;
510 int error; 506 int error;
@@ -521,8 +517,7 @@ sys_lremovexattr(const char __user *pathname, const char __user *name)
521 return error; 517 return error;
522} 518}
523 519
524asmlinkage long 520SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
525sys_fremovexattr(int fd, const char __user *name)
526{ 521{
527 struct file *f; 522 struct file *f;
528 struct dentry *dentry; 523 struct dentry *dentry;
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
index 7b26f5ff9692..1dd528849755 100644
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -21,8 +21,6 @@
21extern struct workqueue_struct *xfsdatad_workqueue; 21extern struct workqueue_struct *xfsdatad_workqueue;
22extern mempool_t *xfs_ioend_pool; 22extern mempool_t *xfs_ioend_pool;
23 23
24typedef void (*xfs_ioend_func_t)(void *);
25
26/* 24/*
27 * xfs_ioend struct manages large extent writes for XFS. 25 * xfs_ioend struct manages large extent writes for XFS.
28 * It can manage several multi-page bio's at once. 26 * It can manage several multi-page bio's at once.
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index cb329edc925b..d71dc44e21ed 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -166,75 +166,6 @@ test_page_region(
166} 166}
167 167
168/* 168/*
169 * Mapping of multi-page buffers into contiguous virtual space
170 */
171
172typedef struct a_list {
173 void *vm_addr;
174 struct a_list *next;
175} a_list_t;
176
177static a_list_t *as_free_head;
178static int as_list_len;
179static DEFINE_SPINLOCK(as_lock);
180
181/*
182 * Try to batch vunmaps because they are costly.
183 */
184STATIC void
185free_address(
186 void *addr)
187{
188 a_list_t *aentry;
189
190#ifdef CONFIG_XEN
191 /*
192 * Xen needs to be able to make sure it can get an exclusive
193 * RO mapping of pages it wants to turn into a pagetable. If
194 * a newly allocated page is also still being vmap()ed by xfs,
195 * it will cause pagetable construction to fail. This is a
196 * quick workaround to always eagerly unmap pages so that Xen
197 * is happy.
198 */
199 vunmap(addr);
200 return;
201#endif
202
203 aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
204 if (likely(aentry)) {
205 spin_lock(&as_lock);
206 aentry->next = as_free_head;
207 aentry->vm_addr = addr;
208 as_free_head = aentry;
209 as_list_len++;
210 spin_unlock(&as_lock);
211 } else {
212 vunmap(addr);
213 }
214}
215
216STATIC void
217purge_addresses(void)
218{
219 a_list_t *aentry, *old;
220
221 if (as_free_head == NULL)
222 return;
223
224 spin_lock(&as_lock);
225 aentry = as_free_head;
226 as_free_head = NULL;
227 as_list_len = 0;
228 spin_unlock(&as_lock);
229
230 while ((old = aentry) != NULL) {
231 vunmap(aentry->vm_addr);
232 aentry = aentry->next;
233 kfree(old);
234 }
235}
236
237/*
238 * Internal xfs_buf_t object manipulation 169 * Internal xfs_buf_t object manipulation
239 */ 170 */
240 171
@@ -333,7 +264,7 @@ xfs_buf_free(
333 uint i; 264 uint i;
334 265
335 if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) 266 if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1))
336 free_address(bp->b_addr - bp->b_offset); 267 vm_unmap_ram(bp->b_addr - bp->b_offset, bp->b_page_count);
337 268
338 for (i = 0; i < bp->b_page_count; i++) { 269 for (i = 0; i < bp->b_page_count; i++) {
339 struct page *page = bp->b_pages[i]; 270 struct page *page = bp->b_pages[i];
@@ -455,10 +386,8 @@ _xfs_buf_map_pages(
455 bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset; 386 bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset;
456 bp->b_flags |= XBF_MAPPED; 387 bp->b_flags |= XBF_MAPPED;
457 } else if (flags & XBF_MAPPED) { 388 } else if (flags & XBF_MAPPED) {
458 if (as_list_len > 64) 389 bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count,
459 purge_addresses(); 390 -1, PAGE_KERNEL);
460 bp->b_addr = vmap(bp->b_pages, bp->b_page_count,
461 VM_MAP, PAGE_KERNEL);
462 if (unlikely(bp->b_addr == NULL)) 391 if (unlikely(bp->b_addr == NULL))
463 return -ENOMEM; 392 return -ENOMEM;
464 bp->b_addr += bp->b_offset; 393 bp->b_addr += bp->b_offset;
@@ -1743,8 +1672,6 @@ xfsbufd(
1743 count++; 1672 count++;
1744 } 1673 }
1745 1674
1746 if (as_list_len > 0)
1747 purge_addresses();
1748 if (count) 1675 if (count)
1749 blk_run_address_space(target->bt_mapping); 1676 blk_run_address_space(target->bt_mapping);
1750 1677
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 595751f78350..87b8cbd23d4b 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -126,11 +126,26 @@ xfs_nfs_get_inode(
126 if (ino == 0) 126 if (ino == 0)
127 return ERR_PTR(-ESTALE); 127 return ERR_PTR(-ESTALE);
128 128
129 error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, 0); 129 /*
130 if (error) 130 * The XFS_IGET_BULKSTAT means that an invalid inode number is just
131 * fine and not an indication of a corrupted filesystem. Because
132 * clients can send any kind of invalid file handle, e.g. after
133 * a restore on the server we have to deal with this case gracefully.
134 */
135 error = xfs_iget(mp, NULL, ino, XFS_IGET_BULKSTAT,
136 XFS_ILOCK_SHARED, &ip, 0);
137 if (error) {
138 /*
139 * EINVAL means the inode cluster doesn't exist anymore.
140 * This implies the filehandle is stale, so we should
141 * translate it here.
142 * We don't use ESTALE directly down the chain to not
143 * confuse applications using bulkstat that expect EINVAL.
144 */
145 if (error == EINVAL)
146 error = ESTALE;
131 return ERR_PTR(-error); 147 return ERR_PTR(-error);
132 if (!ip) 148 }
133 return ERR_PTR(-EIO);
134 149
135 if (ip->i_d.di_gen != generation) { 150 if (ip->i_d.di_gen != generation) {
136 xfs_iput_new(ip, XFS_ILOCK_SHARED); 151 xfs_iput_new(ip, XFS_ILOCK_SHARED);
diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h
index a4e293b93efa..642f1db4def4 100644
--- a/fs/xfs/xfs_acl.h
+++ b/fs/xfs/xfs_acl.h
@@ -22,7 +22,6 @@
22 * Access Control Lists 22 * Access Control Lists
23 */ 23 */
24typedef __uint16_t xfs_acl_perm_t; 24typedef __uint16_t xfs_acl_perm_t;
25typedef __int32_t xfs_acl_type_t;
26typedef __int32_t xfs_acl_tag_t; 25typedef __int32_t xfs_acl_tag_t;
27typedef __int32_t xfs_acl_id_t; 26typedef __int32_t xfs_acl_id_t;
28 27
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index f2e21817a226..d3b3cf742999 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -231,7 +231,7 @@ typedef struct xfs_perag
231#define XFS_FSB_TO_AGNO(mp,fsbno) \ 231#define XFS_FSB_TO_AGNO(mp,fsbno) \
232 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog)) 232 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
233#define XFS_FSB_TO_AGBNO(mp,fsbno) \ 233#define XFS_FSB_TO_AGBNO(mp,fsbno) \
234 ((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog))) 234 ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
235#define XFS_AGB_TO_DADDR(mp,agno,agbno) \ 235#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
236 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \ 236 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
237 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno))) 237 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 79da6b2ea99e..6c323f8a4cd1 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -736,7 +736,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp)
736 continue; /* don't copy partial entries */ 736 continue; /* don't copy partial entries */
737 if (!(entry->flags & XFS_ATTR_LOCAL)) 737 if (!(entry->flags & XFS_ATTR_LOCAL))
738 return(0); 738 return(0);
739 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); 739 name_loc = xfs_attr_leaf_name_local(leaf, i);
740 if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX) 740 if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX)
741 return(0); 741 return(0);
742 if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX) 742 if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX)
@@ -823,7 +823,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
823 if (!entry->nameidx) 823 if (!entry->nameidx)
824 continue; 824 continue;
825 ASSERT(entry->flags & XFS_ATTR_LOCAL); 825 ASSERT(entry->flags & XFS_ATTR_LOCAL);
826 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); 826 name_loc = xfs_attr_leaf_name_local(leaf, i);
827 nargs.name = (char *)name_loc->nameval; 827 nargs.name = (char *)name_loc->nameval;
828 nargs.namelen = name_loc->namelen; 828 nargs.namelen = name_loc->namelen;
829 nargs.value = (char *)&name_loc->nameval[nargs.namelen]; 829 nargs.value = (char *)&name_loc->nameval[nargs.namelen];
@@ -1141,14 +1141,14 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1141 * as part of this transaction (a split operation for example). 1141 * as part of this transaction (a split operation for example).
1142 */ 1142 */
1143 if (entry->flags & XFS_ATTR_LOCAL) { 1143 if (entry->flags & XFS_ATTR_LOCAL) {
1144 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); 1144 name_loc = xfs_attr_leaf_name_local(leaf, args->index);
1145 name_loc->namelen = args->namelen; 1145 name_loc->namelen = args->namelen;
1146 name_loc->valuelen = cpu_to_be16(args->valuelen); 1146 name_loc->valuelen = cpu_to_be16(args->valuelen);
1147 memcpy((char *)name_loc->nameval, args->name, args->namelen); 1147 memcpy((char *)name_loc->nameval, args->name, args->namelen);
1148 memcpy((char *)&name_loc->nameval[args->namelen], args->value, 1148 memcpy((char *)&name_loc->nameval[args->namelen], args->value,
1149 be16_to_cpu(name_loc->valuelen)); 1149 be16_to_cpu(name_loc->valuelen));
1150 } else { 1150 } else {
1151 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 1151 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
1152 name_rmt->namelen = args->namelen; 1152 name_rmt->namelen = args->namelen;
1153 memcpy((char *)name_rmt->name, args->name, args->namelen); 1153 memcpy((char *)name_rmt->name, args->name, args->namelen);
1154 entry->flags |= XFS_ATTR_INCOMPLETE; 1154 entry->flags |= XFS_ATTR_INCOMPLETE;
@@ -1159,7 +1159,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1159 args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen); 1159 args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen);
1160 } 1160 }
1161 xfs_da_log_buf(args->trans, bp, 1161 xfs_da_log_buf(args->trans, bp,
1162 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), 1162 XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index),
1163 xfs_attr_leaf_entsize(leaf, args->index))); 1163 xfs_attr_leaf_entsize(leaf, args->index)));
1164 1164
1165 /* 1165 /*
@@ -1749,10 +1749,10 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1749 /* 1749 /*
1750 * Compress the remaining entries and zero out the removed stuff. 1750 * Compress the remaining entries and zero out the removed stuff.
1751 */ 1751 */
1752 memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize); 1752 memset(xfs_attr_leaf_name(leaf, args->index), 0, entsize);
1753 be16_add_cpu(&hdr->usedbytes, -entsize); 1753 be16_add_cpu(&hdr->usedbytes, -entsize);
1754 xfs_da_log_buf(args->trans, bp, 1754 xfs_da_log_buf(args->trans, bp,
1755 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), 1755 XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index),
1756 entsize)); 1756 entsize));
1757 1757
1758 tmp = (be16_to_cpu(hdr->count) - args->index) 1758 tmp = (be16_to_cpu(hdr->count) - args->index)
@@ -1985,7 +1985,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args)
1985 continue; 1985 continue;
1986 } 1986 }
1987 if (entry->flags & XFS_ATTR_LOCAL) { 1987 if (entry->flags & XFS_ATTR_LOCAL) {
1988 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, probe); 1988 name_loc = xfs_attr_leaf_name_local(leaf, probe);
1989 if (name_loc->namelen != args->namelen) 1989 if (name_loc->namelen != args->namelen)
1990 continue; 1990 continue;
1991 if (memcmp(args->name, (char *)name_loc->nameval, args->namelen) != 0) 1991 if (memcmp(args->name, (char *)name_loc->nameval, args->namelen) != 0)
@@ -1995,7 +1995,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args)
1995 args->index = probe; 1995 args->index = probe;
1996 return(XFS_ERROR(EEXIST)); 1996 return(XFS_ERROR(EEXIST));
1997 } else { 1997 } else {
1998 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, probe); 1998 name_rmt = xfs_attr_leaf_name_remote(leaf, probe);
1999 if (name_rmt->namelen != args->namelen) 1999 if (name_rmt->namelen != args->namelen)
2000 continue; 2000 continue;
2001 if (memcmp(args->name, (char *)name_rmt->name, 2001 if (memcmp(args->name, (char *)name_rmt->name,
@@ -2035,7 +2035,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args)
2035 2035
2036 entry = &leaf->entries[args->index]; 2036 entry = &leaf->entries[args->index];
2037 if (entry->flags & XFS_ATTR_LOCAL) { 2037 if (entry->flags & XFS_ATTR_LOCAL) {
2038 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); 2038 name_loc = xfs_attr_leaf_name_local(leaf, args->index);
2039 ASSERT(name_loc->namelen == args->namelen); 2039 ASSERT(name_loc->namelen == args->namelen);
2040 ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); 2040 ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);
2041 valuelen = be16_to_cpu(name_loc->valuelen); 2041 valuelen = be16_to_cpu(name_loc->valuelen);
@@ -2050,7 +2050,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args)
2050 args->valuelen = valuelen; 2050 args->valuelen = valuelen;
2051 memcpy(args->value, &name_loc->nameval[args->namelen], valuelen); 2051 memcpy(args->value, &name_loc->nameval[args->namelen], valuelen);
2052 } else { 2052 } else {
2053 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2053 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2054 ASSERT(name_rmt->namelen == args->namelen); 2054 ASSERT(name_rmt->namelen == args->namelen);
2055 ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0); 2055 ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);
2056 valuelen = be32_to_cpu(name_rmt->valuelen); 2056 valuelen = be32_to_cpu(name_rmt->valuelen);
@@ -2143,7 +2143,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2143 * off for 6.2, should be revisited later. 2143 * off for 6.2, should be revisited later.
2144 */ 2144 */
2145 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ 2145 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */
2146 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2146 memset(xfs_attr_leaf_name(leaf_s, start_s + i), 0, tmp);
2147 be16_add_cpu(&hdr_s->usedbytes, -tmp); 2147 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2148 be16_add_cpu(&hdr_s->count, -1); 2148 be16_add_cpu(&hdr_s->count, -1);
2149 entry_d--; /* to compensate for ++ in loop hdr */ 2149 entry_d--; /* to compensate for ++ in loop hdr */
@@ -2160,11 +2160,11 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2160 entry_d->flags = entry_s->flags; 2160 entry_d->flags = entry_s->flags;
2161 ASSERT(be16_to_cpu(entry_d->nameidx) + tmp 2161 ASSERT(be16_to_cpu(entry_d->nameidx) + tmp
2162 <= XFS_LBSIZE(mp)); 2162 <= XFS_LBSIZE(mp));
2163 memmove(XFS_ATTR_LEAF_NAME(leaf_d, desti), 2163 memmove(xfs_attr_leaf_name(leaf_d, desti),
2164 XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), tmp); 2164 xfs_attr_leaf_name(leaf_s, start_s + i), tmp);
2165 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp 2165 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp
2166 <= XFS_LBSIZE(mp)); 2166 <= XFS_LBSIZE(mp));
2167 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2167 memset(xfs_attr_leaf_name(leaf_s, start_s + i), 0, tmp);
2168 be16_add_cpu(&hdr_s->usedbytes, -tmp); 2168 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2169 be16_add_cpu(&hdr_d->usedbytes, tmp); 2169 be16_add_cpu(&hdr_d->usedbytes, tmp);
2170 be16_add_cpu(&hdr_s->count, -1); 2170 be16_add_cpu(&hdr_s->count, -1);
@@ -2276,12 +2276,12 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)
2276 2276
2277 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); 2277 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC);
2278 if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { 2278 if (leaf->entries[index].flags & XFS_ATTR_LOCAL) {
2279 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); 2279 name_loc = xfs_attr_leaf_name_local(leaf, index);
2280 size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, 2280 size = xfs_attr_leaf_entsize_local(name_loc->namelen,
2281 be16_to_cpu(name_loc->valuelen)); 2281 be16_to_cpu(name_loc->valuelen));
2282 } else { 2282 } else {
2283 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, index); 2283 name_rmt = xfs_attr_leaf_name_remote(leaf, index);
2284 size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(name_rmt->namelen); 2284 size = xfs_attr_leaf_entsize_remote(name_rmt->namelen);
2285 } 2285 }
2286 return(size); 2286 return(size);
2287} 2287}
@@ -2297,13 +2297,13 @@ xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local)
2297{ 2297{
2298 int size; 2298 int size;
2299 2299
2300 size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(namelen, valuelen); 2300 size = xfs_attr_leaf_entsize_local(namelen, valuelen);
2301 if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) { 2301 if (size < xfs_attr_leaf_entsize_local_max(blocksize)) {
2302 if (local) { 2302 if (local) {
2303 *local = 1; 2303 *local = 1;
2304 } 2304 }
2305 } else { 2305 } else {
2306 size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(namelen); 2306 size = xfs_attr_leaf_entsize_remote(namelen);
2307 if (local) { 2307 if (local) {
2308 *local = 0; 2308 *local = 0;
2309 } 2309 }
@@ -2372,7 +2372,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
2372 2372
2373 if (entry->flags & XFS_ATTR_LOCAL) { 2373 if (entry->flags & XFS_ATTR_LOCAL) {
2374 xfs_attr_leaf_name_local_t *name_loc = 2374 xfs_attr_leaf_name_local_t *name_loc =
2375 XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); 2375 xfs_attr_leaf_name_local(leaf, i);
2376 2376
2377 retval = context->put_listent(context, 2377 retval = context->put_listent(context,
2378 entry->flags, 2378 entry->flags,
@@ -2384,7 +2384,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
2384 return retval; 2384 return retval;
2385 } else { 2385 } else {
2386 xfs_attr_leaf_name_remote_t *name_rmt = 2386 xfs_attr_leaf_name_remote_t *name_rmt =
2387 XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); 2387 xfs_attr_leaf_name_remote(leaf, i);
2388 2388
2389 int valuelen = be32_to_cpu(name_rmt->valuelen); 2389 int valuelen = be32_to_cpu(name_rmt->valuelen);
2390 2390
@@ -2468,11 +2468,11 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
2468 2468
2469#ifdef DEBUG 2469#ifdef DEBUG
2470 if (entry->flags & XFS_ATTR_LOCAL) { 2470 if (entry->flags & XFS_ATTR_LOCAL) {
2471 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); 2471 name_loc = xfs_attr_leaf_name_local(leaf, args->index);
2472 namelen = name_loc->namelen; 2472 namelen = name_loc->namelen;
2473 name = (char *)name_loc->nameval; 2473 name = (char *)name_loc->nameval;
2474 } else { 2474 } else {
2475 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2475 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2476 namelen = name_rmt->namelen; 2476 namelen = name_rmt->namelen;
2477 name = (char *)name_rmt->name; 2477 name = (char *)name_rmt->name;
2478 } 2478 }
@@ -2487,7 +2487,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
2487 2487
2488 if (args->rmtblkno) { 2488 if (args->rmtblkno) {
2489 ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0); 2489 ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0);
2490 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2490 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2491 name_rmt->valueblk = cpu_to_be32(args->rmtblkno); 2491 name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2492 name_rmt->valuelen = cpu_to_be32(args->valuelen); 2492 name_rmt->valuelen = cpu_to_be32(args->valuelen);
2493 xfs_da_log_buf(args->trans, bp, 2493 xfs_da_log_buf(args->trans, bp,
@@ -2534,7 +2534,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args)
2534 xfs_da_log_buf(args->trans, bp, 2534 xfs_da_log_buf(args->trans, bp,
2535 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry))); 2535 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
2536 if ((entry->flags & XFS_ATTR_LOCAL) == 0) { 2536 if ((entry->flags & XFS_ATTR_LOCAL) == 0) {
2537 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); 2537 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2538 name_rmt->valueblk = 0; 2538 name_rmt->valueblk = 0;
2539 name_rmt->valuelen = 0; 2539 name_rmt->valuelen = 0;
2540 xfs_da_log_buf(args->trans, bp, 2540 xfs_da_log_buf(args->trans, bp,
@@ -2607,20 +2607,20 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2607 2607
2608#ifdef DEBUG 2608#ifdef DEBUG
2609 if (entry1->flags & XFS_ATTR_LOCAL) { 2609 if (entry1->flags & XFS_ATTR_LOCAL) {
2610 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf1, args->index); 2610 name_loc = xfs_attr_leaf_name_local(leaf1, args->index);
2611 namelen1 = name_loc->namelen; 2611 namelen1 = name_loc->namelen;
2612 name1 = (char *)name_loc->nameval; 2612 name1 = (char *)name_loc->nameval;
2613 } else { 2613 } else {
2614 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf1, args->index); 2614 name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index);
2615 namelen1 = name_rmt->namelen; 2615 namelen1 = name_rmt->namelen;
2616 name1 = (char *)name_rmt->name; 2616 name1 = (char *)name_rmt->name;
2617 } 2617 }
2618 if (entry2->flags & XFS_ATTR_LOCAL) { 2618 if (entry2->flags & XFS_ATTR_LOCAL) {
2619 name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf2, args->index2); 2619 name_loc = xfs_attr_leaf_name_local(leaf2, args->index2);
2620 namelen2 = name_loc->namelen; 2620 namelen2 = name_loc->namelen;
2621 name2 = (char *)name_loc->nameval; 2621 name2 = (char *)name_loc->nameval;
2622 } else { 2622 } else {
2623 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); 2623 name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2);
2624 namelen2 = name_rmt->namelen; 2624 namelen2 = name_rmt->namelen;
2625 name2 = (char *)name_rmt->name; 2625 name2 = (char *)name_rmt->name;
2626 } 2626 }
@@ -2637,7 +2637,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2637 XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1))); 2637 XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1)));
2638 if (args->rmtblkno) { 2638 if (args->rmtblkno) {
2639 ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0); 2639 ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0);
2640 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf1, args->index); 2640 name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index);
2641 name_rmt->valueblk = cpu_to_be32(args->rmtblkno); 2641 name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2642 name_rmt->valuelen = cpu_to_be32(args->valuelen); 2642 name_rmt->valuelen = cpu_to_be32(args->valuelen);
2643 xfs_da_log_buf(args->trans, bp1, 2643 xfs_da_log_buf(args->trans, bp1,
@@ -2648,7 +2648,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2648 xfs_da_log_buf(args->trans, bp2, 2648 xfs_da_log_buf(args->trans, bp2,
2649 XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2))); 2649 XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2)));
2650 if ((entry2->flags & XFS_ATTR_LOCAL) == 0) { 2650 if ((entry2->flags & XFS_ATTR_LOCAL) == 0) {
2651 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); 2651 name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2);
2652 name_rmt->valueblk = 0; 2652 name_rmt->valueblk = 0;
2653 name_rmt->valuelen = 0; 2653 name_rmt->valuelen = 0;
2654 xfs_da_log_buf(args->trans, bp2, 2654 xfs_da_log_buf(args->trans, bp2,
@@ -2855,7 +2855,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
2855 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { 2855 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
2856 if (be16_to_cpu(entry->nameidx) && 2856 if (be16_to_cpu(entry->nameidx) &&
2857 ((entry->flags & XFS_ATTR_LOCAL) == 0)) { 2857 ((entry->flags & XFS_ATTR_LOCAL) == 0)) {
2858 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); 2858 name_rmt = xfs_attr_leaf_name_remote(leaf, i);
2859 if (name_rmt->valueblk) 2859 if (name_rmt->valueblk)
2860 count++; 2860 count++;
2861 } 2861 }
@@ -2883,7 +2883,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
2883 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { 2883 for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
2884 if (be16_to_cpu(entry->nameidx) && 2884 if (be16_to_cpu(entry->nameidx) &&
2885 ((entry->flags & XFS_ATTR_LOCAL) == 0)) { 2885 ((entry->flags & XFS_ATTR_LOCAL) == 0)) {
2886 name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); 2886 name_rmt = xfs_attr_leaf_name_remote(leaf, i);
2887 if (name_rmt->valueblk) { 2887 if (name_rmt->valueblk) {
2888 lp->valueblk = be32_to_cpu(name_rmt->valueblk); 2888 lp->valueblk = be32_to_cpu(name_rmt->valueblk);
2889 lp->valuelen = XFS_B_TO_FSB(dp->i_mount, 2889 lp->valuelen = XFS_B_TO_FSB(dp->i_mount,
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h
index 83e9af417ca2..9c7d22fdcf4d 100644
--- a/fs/xfs/xfs_attr_leaf.h
+++ b/fs/xfs/xfs_attr_leaf.h
@@ -151,8 +151,6 @@ typedef struct xfs_attr_leafblock {
151/* 151/*
152 * Cast typed pointers for "local" and "remote" name/value structs. 152 * Cast typed pointers for "local" and "remote" name/value structs.
153 */ 153 */
154#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \
155 xfs_attr_leaf_name_remote(leafp,idx)
156static inline xfs_attr_leaf_name_remote_t * 154static inline xfs_attr_leaf_name_remote_t *
157xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) 155xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
158{ 156{
@@ -160,8 +158,6 @@ xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
160 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; 158 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
161} 159}
162 160
163#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \
164 xfs_attr_leaf_name_local(leafp,idx)
165static inline xfs_attr_leaf_name_local_t * 161static inline xfs_attr_leaf_name_local_t *
166xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) 162xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
167{ 163{
@@ -169,8 +165,6 @@ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
169 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; 165 &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
170} 166}
171 167
172#define XFS_ATTR_LEAF_NAME(leafp,idx) \
173 xfs_attr_leaf_name(leafp,idx)
174static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) 168static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
175{ 169{
176 return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; 170 return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
@@ -181,24 +175,18 @@ static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)
181 * a "local" name/value structure, a "remote" name/value structure, and 175 * a "local" name/value structure, a "remote" name/value structure, and
182 * a pointer which might be either. 176 * a pointer which might be either.
183 */ 177 */
184#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \
185 xfs_attr_leaf_entsize_remote(nlen)
186static inline int xfs_attr_leaf_entsize_remote(int nlen) 178static inline int xfs_attr_leaf_entsize_remote(int nlen)
187{ 179{
188 return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ 180 return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
189 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); 181 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
190} 182}
191 183
192#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \
193 xfs_attr_leaf_entsize_local(nlen,vlen)
194static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) 184static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
195{ 185{
196 return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + 186 return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) +
197 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); 187 XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
198} 188}
199 189
200#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \
201 xfs_attr_leaf_entsize_local_max(bsize)
202static inline int xfs_attr_leaf_entsize_local_max(int bsize) 190static inline int xfs_attr_leaf_entsize_local_max(int bsize)
203{ 191{
204 return (((bsize) >> 1) + ((bsize) >> 2)); 192 return (((bsize) >> 1) + ((bsize) >> 2));
diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h
index bca7b243c319..f1e3c907044d 100644
--- a/fs/xfs/xfs_bit.h
+++ b/fs/xfs/xfs_bit.h
@@ -23,24 +23,16 @@
23 */ 23 */
24 24
25/* 25/*
26 * masks with n high/low bits set, 32-bit values & 64-bit values 26 * masks with n high/low bits set, 64-bit values
27 */ 27 */
28#define XFS_MASK32HI(n) xfs_mask32hi(n)
29static inline __uint32_t xfs_mask32hi(int n)
30{
31 return (__uint32_t)-1 << (32 - (n));
32}
33#define XFS_MASK64HI(n) xfs_mask64hi(n)
34static inline __uint64_t xfs_mask64hi(int n) 28static inline __uint64_t xfs_mask64hi(int n)
35{ 29{
36 return (__uint64_t)-1 << (64 - (n)); 30 return (__uint64_t)-1 << (64 - (n));
37} 31}
38#define XFS_MASK32LO(n) xfs_mask32lo(n)
39static inline __uint32_t xfs_mask32lo(int n) 32static inline __uint32_t xfs_mask32lo(int n)
40{ 33{
41 return ((__uint32_t)1 << (n)) - 1; 34 return ((__uint32_t)1 << (n)) - 1;
42} 35}
43#define XFS_MASK64LO(n) xfs_mask64lo(n)
44static inline __uint64_t xfs_mask64lo(int n) 36static inline __uint64_t xfs_mask64lo(int n)
45{ 37{
46 return ((__uint64_t)1 << (n)) - 1; 38 return ((__uint64_t)1 << (n)) - 1;
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 8f1ec73725d3..ba6b08c2fb02 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -110,16 +110,16 @@ __xfs_bmbt_get_all(
110 110
111 ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN)); 111 ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN));
112 s->br_startoff = ((xfs_fileoff_t)l0 & 112 s->br_startoff = ((xfs_fileoff_t)l0 &
113 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 113 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
114#if XFS_BIG_BLKNOS 114#if XFS_BIG_BLKNOS
115 s->br_startblock = (((xfs_fsblock_t)l0 & XFS_MASK64LO(9)) << 43) | 115 s->br_startblock = (((xfs_fsblock_t)l0 & xfs_mask64lo(9)) << 43) |
116 (((xfs_fsblock_t)l1) >> 21); 116 (((xfs_fsblock_t)l1) >> 21);
117#else 117#else
118#ifdef DEBUG 118#ifdef DEBUG
119 { 119 {
120 xfs_dfsbno_t b; 120 xfs_dfsbno_t b;
121 121
122 b = (((xfs_dfsbno_t)l0 & XFS_MASK64LO(9)) << 43) | 122 b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
123 (((xfs_dfsbno_t)l1) >> 21); 123 (((xfs_dfsbno_t)l1) >> 21);
124 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); 124 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
125 s->br_startblock = (xfs_fsblock_t)b; 125 s->br_startblock = (xfs_fsblock_t)b;
@@ -128,7 +128,7 @@ __xfs_bmbt_get_all(
128 s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21); 128 s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21);
129#endif /* DEBUG */ 129#endif /* DEBUG */
130#endif /* XFS_BIG_BLKNOS */ 130#endif /* XFS_BIG_BLKNOS */
131 s->br_blockcount = (xfs_filblks_t)(l1 & XFS_MASK64LO(21)); 131 s->br_blockcount = (xfs_filblks_t)(l1 & xfs_mask64lo(21));
132 /* This is xfs_extent_state() in-line */ 132 /* This is xfs_extent_state() in-line */
133 if (ext_flag) { 133 if (ext_flag) {
134 ASSERT(s->br_blockcount != 0); /* saved for DMIG */ 134 ASSERT(s->br_blockcount != 0); /* saved for DMIG */
@@ -153,7 +153,7 @@ xfs_filblks_t
153xfs_bmbt_get_blockcount( 153xfs_bmbt_get_blockcount(
154 xfs_bmbt_rec_host_t *r) 154 xfs_bmbt_rec_host_t *r)
155{ 155{
156 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21)); 156 return (xfs_filblks_t)(r->l1 & xfs_mask64lo(21));
157} 157}
158 158
159/* 159/*
@@ -164,13 +164,13 @@ xfs_bmbt_get_startblock(
164 xfs_bmbt_rec_host_t *r) 164 xfs_bmbt_rec_host_t *r)
165{ 165{
166#if XFS_BIG_BLKNOS 166#if XFS_BIG_BLKNOS
167 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) | 167 return (((xfs_fsblock_t)r->l0 & xfs_mask64lo(9)) << 43) |
168 (((xfs_fsblock_t)r->l1) >> 21); 168 (((xfs_fsblock_t)r->l1) >> 21);
169#else 169#else
170#ifdef DEBUG 170#ifdef DEBUG
171 xfs_dfsbno_t b; 171 xfs_dfsbno_t b;
172 172
173 b = (((xfs_dfsbno_t)r->l0 & XFS_MASK64LO(9)) << 43) | 173 b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
174 (((xfs_dfsbno_t)r->l1) >> 21); 174 (((xfs_dfsbno_t)r->l1) >> 21);
175 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); 175 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
176 return (xfs_fsblock_t)b; 176 return (xfs_fsblock_t)b;
@@ -188,7 +188,7 @@ xfs_bmbt_get_startoff(
188 xfs_bmbt_rec_host_t *r) 188 xfs_bmbt_rec_host_t *r)
189{ 189{
190 return ((xfs_fileoff_t)r->l0 & 190 return ((xfs_fileoff_t)r->l0 &
191 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 191 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
192} 192}
193 193
194xfs_exntst_t 194xfs_exntst_t
@@ -219,7 +219,7 @@ xfs_filblks_t
219xfs_bmbt_disk_get_blockcount( 219xfs_bmbt_disk_get_blockcount(
220 xfs_bmbt_rec_t *r) 220 xfs_bmbt_rec_t *r)
221{ 221{
222 return (xfs_filblks_t)(be64_to_cpu(r->l1) & XFS_MASK64LO(21)); 222 return (xfs_filblks_t)(be64_to_cpu(r->l1) & xfs_mask64lo(21));
223} 223}
224 224
225/* 225/*
@@ -230,7 +230,7 @@ xfs_bmbt_disk_get_startoff(
230 xfs_bmbt_rec_t *r) 230 xfs_bmbt_rec_t *r)
231{ 231{
232 return ((xfs_fileoff_t)be64_to_cpu(r->l0) & 232 return ((xfs_fileoff_t)be64_to_cpu(r->l0) &
233 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 233 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
234} 234}
235 235
236 236
@@ -248,33 +248,33 @@ xfs_bmbt_set_allf(
248 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1; 248 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
249 249
250 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN); 250 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
251 ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0); 251 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
252 ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0); 252 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
253 253
254#if XFS_BIG_BLKNOS 254#if XFS_BIG_BLKNOS
255 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 255 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
256 256
257 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 257 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
258 ((xfs_bmbt_rec_base_t)startoff << 9) | 258 ((xfs_bmbt_rec_base_t)startoff << 9) |
259 ((xfs_bmbt_rec_base_t)startblock >> 43); 259 ((xfs_bmbt_rec_base_t)startblock >> 43);
260 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) | 260 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
261 ((xfs_bmbt_rec_base_t)blockcount & 261 ((xfs_bmbt_rec_base_t)blockcount &
262 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 262 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
263#else /* !XFS_BIG_BLKNOS */ 263#else /* !XFS_BIG_BLKNOS */
264 if (ISNULLSTARTBLOCK(startblock)) { 264 if (ISNULLSTARTBLOCK(startblock)) {
265 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 265 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
266 ((xfs_bmbt_rec_base_t)startoff << 9) | 266 ((xfs_bmbt_rec_base_t)startoff << 9) |
267 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 267 (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
268 r->l1 = XFS_MASK64HI(11) | 268 r->l1 = xfs_mask64hi(11) |
269 ((xfs_bmbt_rec_base_t)startblock << 21) | 269 ((xfs_bmbt_rec_base_t)startblock << 21) |
270 ((xfs_bmbt_rec_base_t)blockcount & 270 ((xfs_bmbt_rec_base_t)blockcount &
271 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 271 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
272 } else { 272 } else {
273 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 273 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
274 ((xfs_bmbt_rec_base_t)startoff << 9); 274 ((xfs_bmbt_rec_base_t)startoff << 9);
275 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) | 275 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
276 ((xfs_bmbt_rec_base_t)blockcount & 276 ((xfs_bmbt_rec_base_t)blockcount &
277 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 277 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
278 } 278 }
279#endif /* XFS_BIG_BLKNOS */ 279#endif /* XFS_BIG_BLKNOS */
280} 280}
@@ -306,11 +306,11 @@ xfs_bmbt_disk_set_allf(
306 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1; 306 int extent_flag = (state == XFS_EXT_NORM) ? 0 : 1;
307 307
308 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN); 308 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
309 ASSERT((startoff & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0); 309 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
310 ASSERT((blockcount & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0); 310 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
311 311
312#if XFS_BIG_BLKNOS 312#if XFS_BIG_BLKNOS
313 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 313 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
314 314
315 r->l0 = cpu_to_be64( 315 r->l0 = cpu_to_be64(
316 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 316 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -319,17 +319,17 @@ xfs_bmbt_disk_set_allf(
319 r->l1 = cpu_to_be64( 319 r->l1 = cpu_to_be64(
320 ((xfs_bmbt_rec_base_t)startblock << 21) | 320 ((xfs_bmbt_rec_base_t)startblock << 21) |
321 ((xfs_bmbt_rec_base_t)blockcount & 321 ((xfs_bmbt_rec_base_t)blockcount &
322 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 322 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
323#else /* !XFS_BIG_BLKNOS */ 323#else /* !XFS_BIG_BLKNOS */
324 if (ISNULLSTARTBLOCK(startblock)) { 324 if (ISNULLSTARTBLOCK(startblock)) {
325 r->l0 = cpu_to_be64( 325 r->l0 = cpu_to_be64(
326 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 326 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
327 ((xfs_bmbt_rec_base_t)startoff << 9) | 327 ((xfs_bmbt_rec_base_t)startoff << 9) |
328 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); 328 (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
329 r->l1 = cpu_to_be64(XFS_MASK64HI(11) | 329 r->l1 = cpu_to_be64(xfs_mask64hi(11) |
330 ((xfs_bmbt_rec_base_t)startblock << 21) | 330 ((xfs_bmbt_rec_base_t)startblock << 21) |
331 ((xfs_bmbt_rec_base_t)blockcount & 331 ((xfs_bmbt_rec_base_t)blockcount &
332 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 332 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
333 } else { 333 } else {
334 r->l0 = cpu_to_be64( 334 r->l0 = cpu_to_be64(
335 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 335 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -337,7 +337,7 @@ xfs_bmbt_disk_set_allf(
337 r->l1 = cpu_to_be64( 337 r->l1 = cpu_to_be64(
338 ((xfs_bmbt_rec_base_t)startblock << 21) | 338 ((xfs_bmbt_rec_base_t)startblock << 21) |
339 ((xfs_bmbt_rec_base_t)blockcount & 339 ((xfs_bmbt_rec_base_t)blockcount &
340 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 340 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
341 } 341 }
342#endif /* XFS_BIG_BLKNOS */ 342#endif /* XFS_BIG_BLKNOS */
343} 343}
@@ -362,9 +362,9 @@ xfs_bmbt_set_blockcount(
362 xfs_bmbt_rec_host_t *r, 362 xfs_bmbt_rec_host_t *r,
363 xfs_filblks_t v) 363 xfs_filblks_t v)
364{ 364{
365 ASSERT((v & XFS_MASK64HI(43)) == 0); 365 ASSERT((v & xfs_mask64hi(43)) == 0);
366 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64HI(43)) | 366 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64hi(43)) |
367 (xfs_bmbt_rec_base_t)(v & XFS_MASK64LO(21)); 367 (xfs_bmbt_rec_base_t)(v & xfs_mask64lo(21));
368} 368}
369 369
370/* 370/*
@@ -376,21 +376,21 @@ xfs_bmbt_set_startblock(
376 xfs_fsblock_t v) 376 xfs_fsblock_t v)
377{ 377{
378#if XFS_BIG_BLKNOS 378#if XFS_BIG_BLKNOS
379 ASSERT((v & XFS_MASK64HI(12)) == 0); 379 ASSERT((v & xfs_mask64hi(12)) == 0);
380 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)XFS_MASK64HI(55)) | 380 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64hi(55)) |
381 (xfs_bmbt_rec_base_t)(v >> 43); 381 (xfs_bmbt_rec_base_t)(v >> 43);
382 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)) | 382 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
383 (xfs_bmbt_rec_base_t)(v << 21); 383 (xfs_bmbt_rec_base_t)(v << 21);
384#else /* !XFS_BIG_BLKNOS */ 384#else /* !XFS_BIG_BLKNOS */
385 if (ISNULLSTARTBLOCK(v)) { 385 if (ISNULLSTARTBLOCK(v)) {
386 r->l0 |= (xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 386 r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
387 r->l1 = (xfs_bmbt_rec_base_t)XFS_MASK64HI(11) | 387 r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
388 ((xfs_bmbt_rec_base_t)v << 21) | 388 ((xfs_bmbt_rec_base_t)v << 21) |
389 (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 389 (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
390 } else { 390 } else {
391 r->l0 &= ~(xfs_bmbt_rec_base_t)XFS_MASK64LO(9); 391 r->l0 &= ~(xfs_bmbt_rec_base_t)xfs_mask64lo(9);
392 r->l1 = ((xfs_bmbt_rec_base_t)v << 21) | 392 r->l1 = ((xfs_bmbt_rec_base_t)v << 21) |
393 (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)); 393 (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
394 } 394 }
395#endif /* XFS_BIG_BLKNOS */ 395#endif /* XFS_BIG_BLKNOS */
396} 396}
@@ -403,10 +403,10 @@ xfs_bmbt_set_startoff(
403 xfs_bmbt_rec_host_t *r, 403 xfs_bmbt_rec_host_t *r,
404 xfs_fileoff_t v) 404 xfs_fileoff_t v)
405{ 405{
406 ASSERT((v & XFS_MASK64HI(9)) == 0); 406 ASSERT((v & xfs_mask64hi(9)) == 0);
407 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t) XFS_MASK64HI(1)) | 407 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t) xfs_mask64hi(1)) |
408 ((xfs_bmbt_rec_base_t)v << 9) | 408 ((xfs_bmbt_rec_base_t)v << 9) |
409 (r->l0 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); 409 (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
410} 410}
411 411
412/* 412/*
@@ -419,9 +419,9 @@ xfs_bmbt_set_state(
419{ 419{
420 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN); 420 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN);
421 if (v == XFS_EXT_NORM) 421 if (v == XFS_EXT_NORM)
422 r->l0 &= XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN); 422 r->l0 &= xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN);
423 else 423 else
424 r->l0 |= XFS_MASK64HI(BMBT_EXNTFLAG_BITLEN); 424 r->l0 |= xfs_mask64hi(BMBT_EXNTFLAG_BITLEN);
425} 425}
426 426
427/* 427/*
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 7ed59267420d..2c3ef20f8842 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -730,8 +730,8 @@ xfs_btree_readahead_lblock(
730 struct xfs_btree_block *block) 730 struct xfs_btree_block *block)
731{ 731{
732 int rval = 0; 732 int rval = 0;
733 xfs_fsblock_t left = be64_to_cpu(block->bb_u.l.bb_leftsib); 733 xfs_dfsbno_t left = be64_to_cpu(block->bb_u.l.bb_leftsib);
734 xfs_fsblock_t right = be64_to_cpu(block->bb_u.l.bb_rightsib); 734 xfs_dfsbno_t right = be64_to_cpu(block->bb_u.l.bb_rightsib);
735 735
736 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) { 736 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) {
737 xfs_btree_reada_bufl(cur->bc_mp, left, 1); 737 xfs_btree_reada_bufl(cur->bc_mp, left, 1);
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index e2fa0a1d8e96..e1f0a06aaf04 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -517,9 +517,9 @@ xfs_dir2_block_getdents(
517 /* 517 /*
518 * If it didn't fit, set the final offset to here & return. 518 * If it didn't fit, set the final offset to here & return.
519 */ 519 */
520 if (filldir(dirent, dep->name, dep->namelen, cook, 520 if (filldir(dirent, dep->name, dep->namelen, cook & 0x7fffffff,
521 ino, DT_UNKNOWN)) { 521 ino, DT_UNKNOWN)) {
522 *offset = cook; 522 *offset = cook & 0x7fffffff;
523 xfs_da_brelse(NULL, bp); 523 xfs_da_brelse(NULL, bp);
524 return 0; 524 return 0;
525 } 525 }
@@ -529,7 +529,8 @@ xfs_dir2_block_getdents(
529 * Reached the end of the block. 529 * Reached the end of the block.
530 * Set the offset to a non-existent block 1 and return. 530 * Set the offset to a non-existent block 1 and return.
531 */ 531 */
532 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0); 532 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
533 0x7fffffff;
533 xfs_da_brelse(NULL, bp); 534 xfs_da_brelse(NULL, bp);
534 return 0; 535 return 0;
535} 536}
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 93535992cb60..ef805a374eec 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -1092,7 +1092,7 @@ xfs_dir2_leaf_getdents(
1092 * Won't fit. Return to caller. 1092 * Won't fit. Return to caller.
1093 */ 1093 */
1094 if (filldir(dirent, dep->name, dep->namelen, 1094 if (filldir(dirent, dep->name, dep->namelen,
1095 xfs_dir2_byte_to_dataptr(mp, curoff), 1095 xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff,
1096 ino, DT_UNKNOWN)) 1096 ino, DT_UNKNOWN))
1097 break; 1097 break;
1098 1098
@@ -1108,9 +1108,9 @@ xfs_dir2_leaf_getdents(
1108 * All done. Set output offset value to current offset. 1108 * All done. Set output offset value to current offset.
1109 */ 1109 */
1110 if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR)) 1110 if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR))
1111 *offset = XFS_DIR2_MAX_DATAPTR; 1111 *offset = XFS_DIR2_MAX_DATAPTR & 0x7fffffff;
1112 else 1112 else
1113 *offset = xfs_dir2_byte_to_dataptr(mp, curoff); 1113 *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff;
1114 kmem_free(map); 1114 kmem_free(map);
1115 if (bp) 1115 if (bp)
1116 xfs_da_brelse(NULL, bp); 1116 xfs_da_brelse(NULL, bp);
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index b46af0013ec9..a8a8a6efad5b 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -752,8 +752,8 @@ xfs_dir2_sf_getdents(
752#if XFS_BIG_INUMS 752#if XFS_BIG_INUMS
753 ino += mp->m_inoadd; 753 ino += mp->m_inoadd;
754#endif 754#endif
755 if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) { 755 if (filldir(dirent, ".", 1, dot_offset & 0x7fffffff, ino, DT_DIR)) {
756 *offset = dot_offset; 756 *offset = dot_offset & 0x7fffffff;
757 return 0; 757 return 0;
758 } 758 }
759 } 759 }
@@ -766,8 +766,8 @@ xfs_dir2_sf_getdents(
766#if XFS_BIG_INUMS 766#if XFS_BIG_INUMS
767 ino += mp->m_inoadd; 767 ino += mp->m_inoadd;
768#endif 768#endif
769 if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) { 769 if (filldir(dirent, "..", 2, dotdot_offset & 0x7fffffff, ino, DT_DIR)) {
770 *offset = dotdot_offset; 770 *offset = dotdot_offset & 0x7fffffff;
771 return 0; 771 return 0;
772 } 772 }
773 } 773 }
@@ -791,14 +791,15 @@ xfs_dir2_sf_getdents(
791#endif 791#endif
792 792
793 if (filldir(dirent, sfep->name, sfep->namelen, 793 if (filldir(dirent, sfep->name, sfep->namelen,
794 off, ino, DT_UNKNOWN)) { 794 off & 0x7fffffff, ino, DT_UNKNOWN)) {
795 *offset = off; 795 *offset = off & 0x7fffffff;
796 return 0; 796 return 0;
797 } 797 }
798 sfep = xfs_dir2_sf_nextentry(sfp, sfep); 798 sfep = xfs_dir2_sf_nextentry(sfp, sfep);
799 } 799 }
800 800
801 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0); 801 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
802 0x7fffffff;
802 return 0; 803 return 0;
803} 804}
804 805
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index 0f5191644ab2..b2f724502f1b 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -45,7 +45,7 @@ typedef __uint32_t prid_t; /* project ID */
45typedef __uint32_t inst_t; /* an instruction */ 45typedef __uint32_t inst_t; /* an instruction */
46 46
47typedef __s64 xfs_off_t; /* <file offset> type */ 47typedef __s64 xfs_off_t; /* <file offset> type */
48typedef __u64 xfs_ino_t; /* <inode> type */ 48typedef unsigned long long xfs_ino_t; /* <inode> type */
49typedef __s64 xfs_daddr_t; /* <disk address> type */ 49typedef __s64 xfs_daddr_t; /* <disk address> type */
50typedef char * xfs_caddr_t; /* <core address> type */ 50typedef char * xfs_caddr_t; /* <core address> type */
51typedef __u32 xfs_dev_t; 51typedef __u32 xfs_dev_t;
@@ -111,8 +111,6 @@ typedef __uint64_t xfs_fileoff_t; /* block number in a file */
111typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ 111typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
112typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ 112typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
113 113
114typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */
115
116/* 114/*
117 * Null values for the types. 115 * Null values for the types.
118 */ 116 */
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index 1f44e7c76995..0f8956def738 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -3,4 +3,3 @@ include include/asm-generic/Kbuild.asm
3header-y += registers.h 3header-y += registers.h
4 4
5unifdef-y += termios.h 5unifdef-y += termios.h
6unifdef-y += swab.h
diff --git a/include/asm-frv/byteorder.h b/include/asm-frv/byteorder.h
index 1187e51ecd13..f29b7593e088 100644
--- a/include/asm-frv/byteorder.h
+++ b/include/asm-frv/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_BYTEORDER_H 1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H 2#define _ASM_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _ASM_BYTEORDER_H */ 6#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 1870d5e05f1c..70d185534b9d 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -31,6 +31,7 @@ unifdef-y += socket.h
31unifdef-y += sockios.h 31unifdef-y += sockios.h
32unifdef-y += stat.h 32unifdef-y += stat.h
33unifdef-y += statfs.h 33unifdef-y += statfs.h
34unifdef-y += swab.h
34unifdef-y += termbits.h 35unifdef-y += termbits.h
35unifdef-y += termios.h 36unifdef-y += termios.h
36unifdef-y += types.h 37unifdef-y += types.h
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 72ebe91005a8..8e6d0ca70aba 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -301,7 +301,7 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
301 * track_pfn_vma_new is called when a _new_ pfn mapping is being established 301 * track_pfn_vma_new is called when a _new_ pfn mapping is being established
302 * for physical range indicated by pfn and size. 302 * for physical range indicated by pfn and size.
303 */ 303 */
304static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot, 304static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
305 unsigned long pfn, unsigned long size) 305 unsigned long pfn, unsigned long size)
306{ 306{
307 return 0; 307 return 0;
@@ -332,7 +332,7 @@ static inline void untrack_pfn_vma(struct vm_area_struct *vma,
332{ 332{
333} 333}
334#else 334#else
335extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot, 335extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
336 unsigned long pfn, unsigned long size); 336 unsigned long pfn, unsigned long size);
337extern int track_pfn_vma_copy(struct vm_area_struct *vma); 337extern int track_pfn_vma_copy(struct vm_area_struct *vma);
338extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, 338extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index 89061c1a67d4..763e3b060f43 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -42,7 +42,7 @@ static inline unsigned char rtc_is_updating(void)
42 return uip; 42 return uip;
43} 43}
44 44
45static inline unsigned int get_rtc_time(struct rtc_time *time) 45static inline unsigned int __get_rtc_time(struct rtc_time *time)
46{ 46{
47 unsigned char ctrl; 47 unsigned char ctrl;
48 unsigned long flags; 48 unsigned long flags;
@@ -108,8 +108,12 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
108 return RTC_24H; 108 return RTC_24H;
109} 109}
110 110
111#ifndef get_rtc_time
112#define get_rtc_time __get_rtc_time
113#endif
114
111/* Set the current date and time in the real time clock. */ 115/* Set the current date and time in the real time clock. */
112static inline int set_rtc_time(struct rtc_time *time) 116static inline int __set_rtc_time(struct rtc_time *time)
113{ 117{
114 unsigned long flags; 118 unsigned long flags;
115 unsigned char mon, day, hrs, min, sec; 119 unsigned char mon, day, hrs, min, sec;
@@ -190,11 +194,15 @@ static inline int set_rtc_time(struct rtc_time *time)
190 return 0; 194 return 0;
191} 195}
192 196
197#ifndef set_rtc_time
198#define set_rtc_time __set_rtc_time
199#endif
200
193static inline unsigned int get_rtc_ss(void) 201static inline unsigned int get_rtc_ss(void)
194{ 202{
195 struct rtc_time h; 203 struct rtc_time h;
196 204
197 get_rtc_time(&h); 205 __get_rtc_time(&h);
198 return h.tm_sec; 206 return h.tm_sec;
199} 207}
200 208
diff --git a/include/asm-m32r/Kbuild b/include/asm-m32r/Kbuild
index 27b108a86b39..c68e1680da01 100644
--- a/include/asm-m32r/Kbuild
+++ b/include/asm-m32r/Kbuild
@@ -1,2 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h
index 61ff9cfd8451..21855d8b028b 100644
--- a/include/asm-m32r/byteorder.h
+++ b/include/asm-m32r/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_BYTEORDER_H 1#ifndef _ASM_M32R_BYTEORDER_H
2#define _ASM_M32R_BYTEORDER_H 2#define _ASM_M32R_BYTEORDER_H
3 3
4#include <asm/swab.h>
5
6#if defined(__LITTLE_ENDIAN__) 4#if defined(__LITTLE_ENDIAN__)
7# include <linux/byteorder/little_endian.h> 5# include <linux/byteorder/little_endian.h>
8#else 6#else
diff --git a/include/asm-m68k/Kbuild b/include/asm-m68k/Kbuild
index 52fd96b4142a..1a922fad76f7 100644
--- a/include/asm-m68k/Kbuild
+++ b/include/asm-m68k/Kbuild
@@ -1,3 +1,2 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2header-y += cachectl.h 2header-y += cachectl.h
3unifdef-y += swab.h
diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h
index 300866523b86..31b260a88803 100644
--- a/include/asm-m68k/byteorder.h
+++ b/include/asm-m68k/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _M68K_BYTEORDER_H 1#ifndef _M68K_BYTEORDER_H
2#define _M68K_BYTEORDER_H 2#define _M68K_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/big_endian.h> 4#include <linux/byteorder/big_endian.h>
6 5
7#endif /* _M68K_BYTEORDER_H */ 6#endif /* _M68K_BYTEORDER_H */
diff --git a/include/asm-mn10300/Kbuild b/include/asm-mn10300/Kbuild
index 27b108a86b39..c68e1680da01 100644
--- a/include/asm-mn10300/Kbuild
+++ b/include/asm-mn10300/Kbuild
@@ -1,2 +1 @@
1include include/asm-generic/Kbuild.asm include include/asm-generic/Kbuild.asm
2unifdef-y += swab.h
diff --git a/include/asm-mn10300/byteorder.h b/include/asm-mn10300/byteorder.h
index 45b18ded19e6..5dd0bdd9feee 100644
--- a/include/asm-mn10300/byteorder.h
+++ b/include/asm-mn10300/byteorder.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_BYTEORDER_H 1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H 2#define _ASM_BYTEORDER_H
3 3
4#include <asm/swab.h>
5#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
6 5
7#endif /* _ASM_BYTEORDER_H */ 6#endif /* _ASM_BYTEORDER_H */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 0acb07f31fa4..47809ac94bc3 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -395,7 +395,7 @@ struct drm_connector_funcs {
395 void (*save)(struct drm_connector *connector); 395 void (*save)(struct drm_connector *connector);
396 void (*restore)(struct drm_connector *connector); 396 void (*restore)(struct drm_connector *connector);
397 enum drm_connector_status (*detect)(struct drm_connector *connector); 397 enum drm_connector_status (*detect)(struct drm_connector *connector);
398 void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); 398 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
399 int (*set_property)(struct drm_connector *connector, struct drm_property *property, 399 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
400 uint64_t val); 400 uint64_t val);
401 void (*destroy)(struct drm_connector *connector); 401 void (*destroy)(struct drm_connector *connector);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 4bc04cf460a7..0c6f0e11b41b 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -88,7 +88,7 @@ struct drm_connector_helper_funcs {
88 struct drm_encoder *(*best_encoder)(struct drm_connector *connector); 88 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
89}; 89};
90 90
91extern void drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 91extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
92extern void drm_helper_disable_unused_functions(struct drm_device *dev); 92extern void drm_helper_disable_unused_functions(struct drm_device *dev);
93extern int drm_helper_hotplug_stage_two(struct drm_device *dev); 93extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
94extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); 94extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow);
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index c8fdb6e658e1..110c600c885f 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -52,7 +52,6 @@
52 52
53#ifndef __KERNEL__ 53#ifndef __KERNEL__
54#include <linux/types.h> 54#include <linux/types.h>
55#include <asm/types.h>
56 55
57struct agp_version { 56struct agp_version {
58 __u16 major; 57 __u16 major;
diff --git a/include/linux/atm_idt77105.h b/include/linux/atm_idt77105.h
index 05621cf20709..8b724000aa50 100644
--- a/include/linux/atm_idt77105.h
+++ b/include/linux/atm_idt77105.h
@@ -7,7 +7,7 @@
7#ifndef LINUX_ATM_IDT77105_H 7#ifndef LINUX_ATM_IDT77105_H
8#define LINUX_ATM_IDT77105_H 8#define LINUX_ATM_IDT77105_H
9 9
10#include <asm/types.h> 10#include <linux/types.h>
11#include <linux/atmioc.h> 11#include <linux/atmioc.h>
12#include <linux/atmdev.h> 12#include <linux/atmdev.h>
13 13
diff --git a/include/linux/capi.h b/include/linux/capi.h
index fdebaaa9f66e..65100d6cb89b 100644
--- a/include/linux/capi.h
+++ b/include/linux/capi.h
@@ -12,7 +12,7 @@
12#ifndef __LINUX_CAPI_H__ 12#ifndef __LINUX_CAPI_H__
13#define __LINUX_CAPI_H__ 13#define __LINUX_CAPI_H__
14 14
15#include <asm/types.h> 15#include <linux/types.h>
16#include <linux/ioctl.h> 16#include <linux/ioctl.h>
17#ifndef __KERNEL__ 17#ifndef __KERNEL__
18#include <linux/kernelcapi.h> 18#include <linux/kernelcapi.h>
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e88f3ecf38b4..3fd2194ff573 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -280,5 +280,18 @@ asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
280asmlinkage long compat_sys_timerfd_gettime(int ufd, 280asmlinkage long compat_sys_timerfd_gettime(int ufd,
281 struct compat_itimerspec __user *otmr); 281 struct compat_itimerspec __user *otmr);
282 282
283asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
284 __u32 __user *pages,
285 const int __user *nodes,
286 int __user *status,
287 int flags);
288asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
289 struct compat_timeval __user *t);
290asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
291 struct compat_stat __user *statbuf,
292 int flag);
293asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
294 int flags, int mode);
295
283#endif /* CONFIG_COMPAT */ 296#endif /* CONFIG_COMPAT */
284#endif /* _LINUX_COMPAT_H */ 297#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 5c7f9468f753..34f2789d9b9b 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -22,7 +22,7 @@
22#ifndef __CONNECTOR_H 22#ifndef __CONNECTOR_H
23#define __CONNECTOR_H 23#define __CONNECTOR_H
24 24
25#include <asm/types.h> 25#include <linux/types.h>
26 26
27#define CN_IDX_CONNECTOR 0xffffffff 27#define CN_IDX_CONNECTOR 0xffffffff
28#define CN_VAL_CONNECTOR 0xffffffff 28#define CN_VAL_CONNECTOR 0xffffffff
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 2d3d1e04ba92..d06fbf286346 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -150,8 +150,6 @@ struct CYZ_BOOT_CTRL {
150 * architectures and compilers. 150 * architectures and compilers.
151 */ 151 */
152 152
153#include <asm/types.h>
154
155typedef __u64 ucdouble; /* 64 bits, unsigned */ 153typedef __u64 ucdouble; /* 64 bits, unsigned */
156typedef __u32 uclong; /* 32 bits, unsigned */ 154typedef __u32 uclong; /* 32 bits, unsigned */
157typedef __u16 ucshort; /* 16 bits, unsigned */ 155typedef __u16 ucshort; /* 16 bits, unsigned */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1ee63df5be92..818fe21257e8 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_FB_H 1#ifndef _LINUX_FB_H
2#define _LINUX_FB_H 2#define _LINUX_FB_H
3 3
4#include <asm/types.h> 4#include <linux/types.h>
5#include <linux/i2c.h> 5#include <linux/i2c.h>
6 6
7struct dentry; 7struct dentry;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3644f6323384..194da5a4b0d6 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -871,7 +871,7 @@ struct ide_host {
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 871 ide_hwif_t *cur_port; /* for hosts requiring serialization */
872 872
873 /* used for hosts requiring serialization */ 873 /* used for hosts requiring serialization */
874 volatile long host_busy; 874 volatile unsigned long host_busy;
875}; 875};
876 876
877#define IDE_HOST_BUSY 0 877#define IDE_HOST_BUSY 0
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index a7d6a2234b31..c7a66882b6d0 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -15,7 +15,7 @@
15#ifndef __LINUX_IF_PPPOL2TP_H 15#ifndef __LINUX_IF_PPPOL2TP_H
16#define __LINUX_IF_PPPOL2TP_H 16#define __LINUX_IF_PPPOL2TP_H
17 17
18#include <asm/types.h> 18#include <linux/types.h>
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/in.h> 21#include <linux/in.h>
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 6fb7f1788570..30c88b2245ff 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -17,7 +17,7 @@
17#define __LINUX_IF_PPPOX_H 17#define __LINUX_IF_PPPOX_H
18 18
19 19
20#include <asm/types.h> 20#include <linux/types.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22 22
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
diff --git a/include/linux/input.h b/include/linux/input.h
index 9a6355f74db2..1249a0c20a38 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -16,7 +16,7 @@
16#include <sys/time.h> 16#include <sys/time.h>
17#include <sys/ioctl.h> 17#include <sys/ioctl.h>
18#include <sys/types.h> 18#include <sys/types.h>
19#include <asm/types.h> 19#include <linux/types.h>
20#endif 20#endif
21 21
22/* 22/*
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index f6bb2ca8e3ba..32e4b2f72294 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -143,7 +143,8 @@ static inline unsigned long resource_type(struct resource *res)
143 143
144extern struct resource * __request_region(struct resource *, 144extern struct resource * __request_region(struct resource *,
145 resource_size_t start, 145 resource_size_t start,
146 resource_size_t n, const char *name, int relaxed); 146 resource_size_t n,
147 const char *name, int flags);
147 148
148/* Compatibility cruft */ 149/* Compatibility cruft */
149#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 150#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 6384b19efe64..64246dce5663 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -614,6 +614,8 @@ struct transaction_s
614 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 614 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
615 * number that will fit in j_blocksize 615 * number that will fit in j_blocksize
616 * @j_last_sync_writer: most recent pid which did a synchronous write 616 * @j_last_sync_writer: most recent pid which did a synchronous write
617 * @j_average_commit_time: the average amount of time in nanoseconds it
618 * takes to commit a transaction to the disk.
617 * @j_private: An opaque pointer to fs-private information. 619 * @j_private: An opaque pointer to fs-private information.
618 */ 620 */
619 621
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index b5e051295a67..9e20c29c1e14 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -27,7 +27,7 @@
27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic 27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
28 */ 28 */
29 29
30#include <asm/types.h> 30#include <linux/types.h>
31#include <linux/input.h> 31#include <linux/input.h>
32 32
33/* 33/*
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 35525ac63337..5715f1907601 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -7,7 +7,7 @@
7 * Note: you must update KVM_API_VERSION if you change this interface. 7 * Note: you must update KVM_API_VERSION if you change this interface.
8 */ 8 */
9 9
10#include <asm/types.h> 10#include <linux/types.h>
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/ioctl.h> 12#include <linux/ioctl.h>
13#include <asm/kvm.h> 13#include <asm/kvm.h>
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b6b8a7f3ec66..2c6bd66209ff 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -401,12 +401,14 @@ enum {
401 ATA_TIMING_CYC8B, 401 ATA_TIMING_CYC8B,
402 ATA_TIMING_ACTIVE = (1 << 4), 402 ATA_TIMING_ACTIVE = (1 << 4),
403 ATA_TIMING_RECOVER = (1 << 5), 403 ATA_TIMING_RECOVER = (1 << 5),
404 ATA_TIMING_CYCLE = (1 << 6), 404 ATA_TIMING_DMACK_HOLD = (1 << 6),
405 ATA_TIMING_UDMA = (1 << 7), 405 ATA_TIMING_CYCLE = (1 << 7),
406 ATA_TIMING_UDMA = (1 << 8),
406 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | 407 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
407 ATA_TIMING_REC8B | ATA_TIMING_CYC8B | 408 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
408 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | 409 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
409 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 410 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE |
411 ATA_TIMING_UDMA,
410}; 412};
411 413
412enum ata_xfer_mask { 414enum ata_xfer_mask {
@@ -866,6 +868,7 @@ struct ata_timing {
866 unsigned short cyc8b; /* t0 for 8-bit I/O */ 868 unsigned short cyc8b; /* t0 for 8-bit I/O */
867 unsigned short active; /* t2 or tD */ 869 unsigned short active; /* t2 or tD */
868 unsigned short recover; /* t2i or tK */ 870 unsigned short recover; /* t2i or tK */
871 unsigned short dmack_hold; /* tj */
869 unsigned short cycle; /* t0 */ 872 unsigned short cycle; /* t0 */
870 unsigned short udma; /* t2CYCTYP/2 */ 873 unsigned short udma; /* t2CYCTYP/2 */
871}; 874};
@@ -927,6 +930,8 @@ extern void ata_host_init(struct ata_host *, struct device *,
927extern int ata_scsi_detect(struct scsi_host_template *sht); 930extern int ata_scsi_detect(struct scsi_host_template *sht);
928extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 931extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
929extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 932extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
933extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
934 int cmd, void __user *arg);
930extern void ata_sas_port_destroy(struct ata_port *); 935extern void ata_sas_port_destroy(struct ata_port *);
931extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 936extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
932 struct ata_port_info *, struct Scsi_Host *); 937 struct ata_port_info *, struct Scsi_Host *);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 46169a7b559b..6ffd6db5bb0d 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -80,7 +80,7 @@ enum {
80}; 80};
81 81
82#include <asm/posix_types.h> /* for __kernel_old_dev_t */ 82#include <asm/posix_types.h> /* for __kernel_old_dev_t */
83#include <asm/types.h> /* for __u64 */ 83#include <linux/types.h> /* for __u64 */
84 84
85/* Backwards compatibility version */ 85/* Backwards compatibility version */
86struct loop_info { 86struct loop_info {
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 439f6f3cb0c4..0b4df7eba852 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -10,11 +10,13 @@
10#define SYSFS_MAGIC 0x62656572 10#define SYSFS_MAGIC 0x62656572
11#define SECURITYFS_MAGIC 0x73636673 11#define SECURITYFS_MAGIC 0x73636673
12#define TMPFS_MAGIC 0x01021994 12#define TMPFS_MAGIC 0x01021994
13#define SQUASHFS_MAGIC 0x73717368
13#define EFS_SUPER_MAGIC 0x414A53 14#define EFS_SUPER_MAGIC 0x414A53
14#define EXT2_SUPER_MAGIC 0xEF53 15#define EXT2_SUPER_MAGIC 0xEF53
15#define EXT3_SUPER_MAGIC 0xEF53 16#define EXT3_SUPER_MAGIC 0xEF53
16#define XENFS_SUPER_MAGIC 0xabba1974 17#define XENFS_SUPER_MAGIC 0xabba1974
17#define EXT4_SUPER_MAGIC 0xEF53 18#define EXT4_SUPER_MAGIC 0xEF53
19#define BTRFS_SUPER_MAGIC 0x9123683E
18#define HPFS_SUPER_MAGIC 0xf995e849 20#define HPFS_SUPER_MAGIC 0xf995e849
19#define ISOFS_SUPER_MAGIC 0x9660 21#define ISOFS_SUPER_MAGIC 0x9660
20#define JFFS2_SUPER_MAGIC 0x72b6 22#define JFFS2_SUPER_MAGIC 0x72b6
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index ae5b09493062..404f678e734b 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -2,7 +2,7 @@
2#define __LINUX_MATROXFB_H__ 2#define __LINUX_MATROXFB_H__
3 3
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5#include <asm/types.h> 5#include <linux/types.h>
6#include <linux/videodev2.h> 6#include <linux/videodev2.h>
7 7
8struct matroxioc_output_mode { 8struct matroxioc_output_mode {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b91a73fd1bcc..e8ddc98b8405 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -260,7 +260,6 @@ static inline int put_page_testzero(struct page *page)
260 */ 260 */
261static inline int get_page_unless_zero(struct page *page) 261static inline int get_page_unless_zero(struct page *page)
262{ 262{
263 VM_BUG_ON(PageTail(page));
264 return atomic_inc_not_zero(&page->_count); 263 return atomic_inc_not_zero(&page->_count);
265} 264}
266 265
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index bd2a870ec296..34974b5a76f7 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -17,4 +17,7 @@
17void of_register_i2c_devices(struct i2c_adapter *adap, 17void of_register_i2c_devices(struct i2c_adapter *adap,
18 struct device_node *adap_node); 18 struct device_node *adap_node);
19 19
20/* must call put_device() when done with returned i2c_client device */
21struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22
20#endif /* __LINUX_OF_I2C_H */ 23#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d543365518ab..d56ad9c21c09 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2174,6 +2174,7 @@
2174#define PCI_DEVICE_ID_RDC_R6040 0x6040 2174#define PCI_DEVICE_ID_RDC_R6040 0x6040
2175#define PCI_DEVICE_ID_RDC_R6060 0x6060 2175#define PCI_DEVICE_ID_RDC_R6060 0x6060
2176#define PCI_DEVICE_ID_RDC_R6061 0x6061 2176#define PCI_DEVICE_ID_RDC_R6061 0x6061
2177#define PCI_DEVICE_ID_RDC_D1010 0x1010
2177 2178
2178#define PCI_VENDOR_ID_LENOVO 0x17aa 2179#define PCI_VENDOR_ID_LENOVO 0x17aa
2179 2180
diff --git a/include/linux/phantom.h b/include/linux/phantom.h
index 02268c54c250..94dd6645c60a 100644
--- a/include/linux/phantom.h
+++ b/include/linux/phantom.h
@@ -10,7 +10,7 @@
10#ifndef __PHANTOM_H 10#ifndef __PHANTOM_H
11#define __PHANTOM_H 11#define __PHANTOM_H
12 12
13#include <asm/types.h> 13#include <linux/types.h>
14 14
15/* PHN_(G/S)ET_REG param */ 15/* PHN_(G/S)ET_REG param */
16struct phm_reg { 16struct phm_reg {
diff --git a/include/linux/radeonfb.h b/include/linux/radeonfb.h
index 5bd8975ed78e..8c4bbdecc44f 100644
--- a/include/linux/radeonfb.h
+++ b/include/linux/radeonfb.h
@@ -2,7 +2,7 @@
2#define __LINUX_RADEONFB_H__ 2#define __LINUX_RADEONFB_H__
3 3
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5#include <asm/types.h> 5#include <linux/types.h>
6 6
7#define ATY_RADEON_LCD_ON 0x00000001 7#define ATY_RADEON_LCD_ON 0x00000001
8#define ATY_RADEON_CRT_ON 0x00000002 8#define ATY_RADEON_CRT_ON 0x00000002
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index dede0a2cfc45..4c5bcf6ca7e8 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Pavel Emelianov <xemul@openvz.org> 10 * Author: Pavel Emelianov <xemul@openvz.org>
11 * 11 *
12 * See Documentation/controllers/resource_counter.txt for more 12 * See Documentation/cgroups/resource_counter.txt for more
13 * info about what this counter is. 13 * info about what this counter is.
14 */ 14 */
15 15
diff --git a/include/linux/swab.h b/include/linux/swab.h
index be5284d4a053..ea0c02fd5163 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <asm/byteorder.h> 6#include <asm/swab.h>
7 7
8/* 8/*
9 * casts are necessary for constants, because we never know how for sure 9 * casts are necessary for constants, because we never know how for sure
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 18d0a243a7b3..16875f89e6a7 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -54,6 +54,7 @@ struct compat_stat;
54struct compat_timeval; 54struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache; 56struct getcpu_cache;
57struct old_linux_dirent;
57 58
58#include <linux/types.h> 59#include <linux/types.h>
59#include <linux/aio_abi.h> 60#include <linux/aio_abi.h>
@@ -65,6 +66,74 @@ struct getcpu_cache;
65#include <linux/quota.h> 66#include <linux/quota.h>
66#include <linux/key.h> 67#include <linux/key.h>
67 68
69#define __SC_DECL1(t1, a1) t1 a1
70#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__)
71#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__)
72#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__)
73#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__)
74#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__)
75
76#define __SC_LONG1(t1, a1) long a1
77#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__)
78#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__)
79#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__)
80#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__)
81#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__)
82
83#define __SC_CAST1(t1, a1) (t1) a1
84#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__)
85#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__)
86#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__)
87#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__)
88#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__)
89
90#define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long))
91#define __SC_TEST1(t1, a1) __SC_TEST(t1)
92#define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__)
93#define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__)
94#define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__)
95#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
96#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
97
98#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
99#define SYSCALL_DEFINE1(...) SYSCALL_DEFINEx(1, __VA_ARGS__)
100#define SYSCALL_DEFINE2(...) SYSCALL_DEFINEx(2, __VA_ARGS__)
101#define SYSCALL_DEFINE3(...) SYSCALL_DEFINEx(3, __VA_ARGS__)
102#define SYSCALL_DEFINE4(...) SYSCALL_DEFINEx(4, __VA_ARGS__)
103#define SYSCALL_DEFINE5(...) SYSCALL_DEFINEx(5, __VA_ARGS__)
104#define SYSCALL_DEFINE6(...) SYSCALL_DEFINEx(6, __VA_ARGS__)
105
106#ifdef CONFIG_PPC64
107#define SYSCALL_ALIAS(alias, name) \
108 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
109 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
110#else
111#define SYSCALL_ALIAS(alias, name) \
112 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
113#endif
114
115#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
116
117#define SYSCALL_DEFINE(name) static inline long SYSC_##name
118#define SYSCALL_DEFINEx(x, name, ...) \
119 asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__)); \
120 static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__)); \
121 asmlinkage long SyS_##name(__SC_LONG##x(__VA_ARGS__)) \
122 { \
123 __SC_TEST##x(__VA_ARGS__); \
124 return (long) SYSC_##name(__SC_CAST##x(__VA_ARGS__)); \
125 } \
126 SYSCALL_ALIAS(sys_##name, SyS_##name); \
127 static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__))
128
129#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
130
131#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
132#define SYSCALL_DEFINEx(x, name, ...) \
133 asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__))
134
135#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
136
68asmlinkage long sys_time(time_t __user *tloc); 137asmlinkage long sys_time(time_t __user *tloc);
69asmlinkage long sys_stime(time_t __user *tptr); 138asmlinkage long sys_stime(time_t __user *tptr);
70asmlinkage long sys_gettimeofday(struct timeval __user *tv, 139asmlinkage long sys_gettimeofday(struct timeval __user *tv,
@@ -77,7 +146,7 @@ asmlinkage long sys_times(struct tms __user *tbuf);
77 146
78asmlinkage long sys_gettid(void); 147asmlinkage long sys_gettid(void);
79asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp); 148asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp);
80asmlinkage unsigned long sys_alarm(unsigned int seconds); 149asmlinkage long sys_alarm(unsigned int seconds);
81asmlinkage long sys_getpid(void); 150asmlinkage long sys_getpid(void);
82asmlinkage long sys_getppid(void); 151asmlinkage long sys_getppid(void);
83asmlinkage long sys_getuid(void); 152asmlinkage long sys_getuid(void);
@@ -166,7 +235,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
166 unsigned long flags); 235 unsigned long flags);
167 236
168asmlinkage long sys_exit(int error_code); 237asmlinkage long sys_exit(int error_code);
169asmlinkage void sys_exit_group(int error_code); 238asmlinkage long sys_exit_group(int error_code);
170asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, 239asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
171 int options, struct rusage __user *ru); 240 int options, struct rusage __user *ru);
172asmlinkage long sys_waitid(int which, pid_t pid, 241asmlinkage long sys_waitid(int which, pid_t pid,
@@ -196,7 +265,7 @@ asmlinkage long sys_tkill(int pid, int sig);
196asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo); 265asmlinkage long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo);
197asmlinkage long sys_sgetmask(void); 266asmlinkage long sys_sgetmask(void);
198asmlinkage long sys_ssetmask(int newmask); 267asmlinkage long sys_ssetmask(int newmask);
199asmlinkage unsigned long sys_signal(int sig, __sighandler_t handler); 268asmlinkage long sys_signal(int sig, __sighandler_t handler);
200asmlinkage long sys_pause(void); 269asmlinkage long sys_pause(void);
201 270
202asmlinkage long sys_sync(void); 271asmlinkage long sys_sync(void);
@@ -246,29 +315,29 @@ asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
246 const void __user *value, size_t size, int flags); 315 const void __user *value, size_t size, int flags);
247asmlinkage long sys_fsetxattr(int fd, const char __user *name, 316asmlinkage long sys_fsetxattr(int fd, const char __user *name,
248 const void __user *value, size_t size, int flags); 317 const void __user *value, size_t size, int flags);
249asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name, 318asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
250 void __user *value, size_t size); 319 void __user *value, size_t size);
251asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name, 320asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
252 void __user *value, size_t size); 321 void __user *value, size_t size);
253asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name, 322asmlinkage long sys_fgetxattr(int fd, const char __user *name,
254 void __user *value, size_t size); 323 void __user *value, size_t size);
255asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list, 324asmlinkage long sys_listxattr(const char __user *path, char __user *list,
256 size_t size); 325 size_t size);
257asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list, 326asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
258 size_t size); 327 size_t size);
259asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size); 328asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
260asmlinkage long sys_removexattr(const char __user *path, 329asmlinkage long sys_removexattr(const char __user *path,
261 const char __user *name); 330 const char __user *name);
262asmlinkage long sys_lremovexattr(const char __user *path, 331asmlinkage long sys_lremovexattr(const char __user *path,
263 const char __user *name); 332 const char __user *name);
264asmlinkage long sys_fremovexattr(int fd, const char __user *name); 333asmlinkage long sys_fremovexattr(int fd, const char __user *name);
265 334
266asmlinkage unsigned long sys_brk(unsigned long brk); 335asmlinkage long sys_brk(unsigned long brk);
267asmlinkage long sys_mprotect(unsigned long start, size_t len, 336asmlinkage long sys_mprotect(unsigned long start, size_t len,
268 unsigned long prot); 337 unsigned long prot);
269asmlinkage unsigned long sys_mremap(unsigned long addr, 338asmlinkage long sys_mremap(unsigned long addr,
270 unsigned long old_len, unsigned long new_len, 339 unsigned long old_len, unsigned long new_len,
271 unsigned long flags, unsigned long new_addr); 340 unsigned long flags, unsigned long new_addr);
272asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, 341asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
273 unsigned long prot, unsigned long pgoff, 342 unsigned long prot, unsigned long pgoff,
274 unsigned long flags); 343 unsigned long flags);
@@ -321,10 +390,10 @@ asmlinkage long sys_io_submit(aio_context_t, long,
321 struct iocb __user * __user *); 390 struct iocb __user * __user *);
322asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, 391asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
323 struct io_event __user *result); 392 struct io_event __user *result);
324asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, 393asmlinkage long sys_sendfile(int out_fd, int in_fd,
325 off_t __user *offset, size_t count); 394 off_t __user *offset, size_t count);
326asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, 395asmlinkage long sys_sendfile64(int out_fd, int in_fd,
327 loff_t __user *offset, size_t count); 396 loff_t __user *offset, size_t count);
328asmlinkage long sys_readlink(const char __user *path, 397asmlinkage long sys_readlink(const char __user *path,
329 char __user *buf, int bufsiz); 398 char __user *buf, int bufsiz);
330asmlinkage long sys_creat(const char __user *pathname, int mode); 399asmlinkage long sys_creat(const char __user *pathname, int mode);
@@ -368,26 +437,25 @@ asmlinkage long sys_utime(char __user *filename,
368 struct utimbuf __user *times); 437 struct utimbuf __user *times);
369asmlinkage long sys_utimes(char __user *filename, 438asmlinkage long sys_utimes(char __user *filename,
370 struct timeval __user *utimes); 439 struct timeval __user *utimes);
371asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, 440asmlinkage long sys_lseek(unsigned int fd, off_t offset,
372 unsigned int origin); 441 unsigned int origin);
373asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 442asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
374 unsigned long offset_low, loff_t __user *result, 443 unsigned long offset_low, loff_t __user *result,
375 unsigned int origin); 444 unsigned int origin);
376asmlinkage ssize_t sys_read(unsigned int fd, char __user *buf, 445asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
377 size_t count); 446asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
378asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); 447asmlinkage long sys_readv(unsigned long fd,
379asmlinkage ssize_t sys_readv(unsigned long fd, 448 const struct iovec __user *vec,
380 const struct iovec __user *vec, 449 unsigned long vlen);
381 unsigned long vlen); 450asmlinkage long sys_write(unsigned int fd, const char __user *buf,
382asmlinkage ssize_t sys_write(unsigned int fd, const char __user *buf, 451 size_t count);
383 size_t count); 452asmlinkage long sys_writev(unsigned long fd,
384asmlinkage ssize_t sys_writev(unsigned long fd, 453 const struct iovec __user *vec,
385 const struct iovec __user *vec, 454 unsigned long vlen);
386 unsigned long vlen); 455asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
387asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, 456 size_t count, loff_t pos);
388 size_t count, loff_t pos); 457asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
389asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, 458 size_t count, loff_t pos);
390 size_t count, loff_t pos);
391asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 459asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
392asmlinkage long sys_mkdir(const char __user *pathname, int mode); 460asmlinkage long sys_mkdir(const char __user *pathname, int mode);
393asmlinkage long sys_chdir(const char __user *filename); 461asmlinkage long sys_chdir(const char __user *filename);
@@ -476,7 +544,7 @@ asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
476asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); 544asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
477asmlinkage long sys_mq_unlink(const char __user *name); 545asmlinkage long sys_mq_unlink(const char __user *name);
478asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); 546asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
479asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); 547asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
480asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); 548asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
481asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); 549asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
482 550
@@ -530,11 +598,6 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
530 const int __user *nodes, 598 const int __user *nodes,
531 int __user *status, 599 int __user *status,
532 int flags); 600 int flags);
533asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
534 __u32 __user *pages,
535 const int __user *nodes,
536 int __user *status,
537 int flags);
538asmlinkage long sys_mbind(unsigned long start, unsigned long len, 601asmlinkage long sys_mbind(unsigned long start, unsigned long len,
539 unsigned long mode, 602 unsigned long mode,
540 unsigned long __user *nmask, 603 unsigned long __user *nmask,
@@ -583,13 +646,6 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *bu
583 int bufsiz); 646 int bufsiz);
584asmlinkage long sys_utimensat(int dfd, char __user *filename, 647asmlinkage long sys_utimensat(int dfd, char __user *filename,
585 struct timespec __user *utimes, int flags); 648 struct timespec __user *utimes, int flags);
586asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename,
587 struct compat_timeval __user *t);
588asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
589 struct compat_stat __user *statbuf,
590 int flag);
591asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
592 int flags, int mode);
593asmlinkage long sys_unshare(unsigned long unshare_flags); 649asmlinkage long sys_unshare(unsigned long unshare_flags);
594 650
595asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, 651asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
@@ -621,6 +677,15 @@ asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
621asmlinkage long sys_eventfd(unsigned int count); 677asmlinkage long sys_eventfd(unsigned int count);
622asmlinkage long sys_eventfd2(unsigned int count, int flags); 678asmlinkage long sys_eventfd2(unsigned int count, int flags);
623asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 679asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
680asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
681asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
682 fd_set __user *, struct timespec __user *,
683 void __user *);
684asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
685 struct timespec __user *, const sigset_t __user *,
686 size_t);
687asmlinkage long sys_pipe2(int __user *, int);
688asmlinkage long sys_pipe(int __user *);
624 689
625int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 690int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
626 691
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 83e32f6d7859..9e3182e659db 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -39,6 +39,7 @@ struct iscsi_segment {
39 unsigned int total_copied; 39 unsigned int total_copied;
40 40
41 struct hash_desc *hash; 41 struct hash_desc *hash;
42 unsigned char padbuf[ISCSI_PAD_LEN];
42 unsigned char recv_digest[ISCSI_DIGEST_SIZE]; 43 unsigned char recv_digest[ISCSI_DIGEST_SIZE];
43 unsigned char digest[ISCSI_DIGEST_SIZE]; 44 unsigned char digest[ISCSI_DIGEST_SIZE];
44 unsigned int digest_len; 45 unsigned int digest_len;
diff --git a/init/Kconfig b/init/Kconfig
index a724a149bf3f..2af83825634e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -323,26 +323,26 @@ config CGROUP_SCHED
323 This option allows you to create arbitrary task groups 323 This option allows you to create arbitrary task groups
324 using the "cgroup" pseudo filesystem and control 324 using the "cgroup" pseudo filesystem and control
325 the cpu bandwidth allocated to each such task group. 325 the cpu bandwidth allocated to each such task group.
326 Refer to Documentation/cgroups.txt for more information 326 Refer to Documentation/cgroups/cgroups.txt for more
327 on "cgroup" pseudo filesystem. 327 information on "cgroup" pseudo filesystem.
328 328
329endchoice 329endchoice
330 330
331menu "Control Group support" 331menuconfig CGROUPS
332config CGROUPS 332 boolean "Control Group support"
333 bool "Control Group support"
334 help 333 help
335 This option add support for grouping sets of processes together, for 334 This option adds support for grouping sets of processes together, for
336 use with process control subsystems such as Cpusets, CFS, memory 335 use with process control subsystems such as Cpusets, CFS, memory
337 controls or device isolation. 336 controls or device isolation.
338 See 337 See
339 - Documentation/cpusets.txt (Cpusets)
340 - Documentation/scheduler/sched-design-CFS.txt (CFS) 338 - Documentation/scheduler/sched-design-CFS.txt (CFS)
341 - Documentation/cgroups/ (features for grouping, isolation) 339 - Documentation/cgroups/ (features for grouping, isolation
342 - Documentation/controllers/ (features for resource control) 340 and resource control)
343 341
344 Say N if unsure. 342 Say N if unsure.
345 343
344if CGROUPS
345
346config CGROUP_DEBUG 346config CGROUP_DEBUG
347 bool "Example debug cgroup subsystem" 347 bool "Example debug cgroup subsystem"
348 depends on CGROUPS 348 depends on CGROUPS
@@ -350,24 +350,24 @@ config CGROUP_DEBUG
350 help 350 help
351 This option enables a simple cgroup subsystem that 351 This option enables a simple cgroup subsystem that
352 exports useful debugging information about the cgroups 352 exports useful debugging information about the cgroups
353 framework 353 framework.
354 354
355 Say N if unsure 355 Say N if unsure.
356 356
357config CGROUP_NS 357config CGROUP_NS
358 bool "Namespace cgroup subsystem" 358 bool "Namespace cgroup subsystem"
359 depends on CGROUPS 359 depends on CGROUPS
360 help 360 help
361 Provides a simple namespace cgroup subsystem to 361 Provides a simple namespace cgroup subsystem to
362 provide hierarchical naming of sets of namespaces, 362 provide hierarchical naming of sets of namespaces,
363 for instance virtual servers and checkpoint/restart 363 for instance virtual servers and checkpoint/restart
364 jobs. 364 jobs.
365 365
366config CGROUP_FREEZER 366config CGROUP_FREEZER
367 bool "control group freezer subsystem" 367 bool "Freezer cgroup subsystem"
368 depends on CGROUPS 368 depends on CGROUPS
369 help 369 help
370 Provides a way to freeze and unfreeze all tasks in a 370 Provides a way to freeze and unfreeze all tasks in a
371 cgroup. 371 cgroup.
372 372
373config CGROUP_DEVICE 373config CGROUP_DEVICE
@@ -388,18 +388,23 @@ config CPUSETS
388 388
389 Say N if unsure. 389 Say N if unsure.
390 390
391config PROC_PID_CPUSET
392 bool "Include legacy /proc/<pid>/cpuset file"
393 depends on CPUSETS
394 default y
395
391config CGROUP_CPUACCT 396config CGROUP_CPUACCT
392 bool "Simple CPU accounting cgroup subsystem" 397 bool "Simple CPU accounting cgroup subsystem"
393 depends on CGROUPS 398 depends on CGROUPS
394 help 399 help
395 Provides a simple Resource Controller for monitoring the 400 Provides a simple Resource Controller for monitoring the
396 total CPU consumed by the tasks in a cgroup 401 total CPU consumed by the tasks in a cgroup.
397 402
398config RESOURCE_COUNTERS 403config RESOURCE_COUNTERS
399 bool "Resource counters" 404 bool "Resource counters"
400 help 405 help
401 This option enables controller independent resource accounting 406 This option enables controller independent resource accounting
402 infrastructure that works with cgroups 407 infrastructure that works with cgroups.
403 depends on CGROUPS 408 depends on CGROUPS
404 409
405config CGROUP_MEM_RES_CTLR 410config CGROUP_MEM_RES_CTLR
@@ -425,9 +430,6 @@ config CGROUP_MEM_RES_CTLR
425 This config option also selects MM_OWNER config option, which 430 This config option also selects MM_OWNER config option, which
426 could in turn add some fork/exit overhead. 431 could in turn add some fork/exit overhead.
427 432
428config MM_OWNER
429 bool
430
431config CGROUP_MEM_RES_CTLR_SWAP 433config CGROUP_MEM_RES_CTLR_SWAP
432 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)" 434 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)"
433 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL 435 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL
@@ -444,8 +446,10 @@ config CGROUP_MEM_RES_CTLR_SWAP
444 there will be no overhead from this. Even when you set this config=y, 446 there will be no overhead from this. Even when you set this config=y,
445 if boot option "noswapaccount" is set, swap will not be accounted. 447 if boot option "noswapaccount" is set, swap will not be accounted.
446 448
449endif # CGROUPS
447 450
448endmenu 451config MM_OWNER
452 bool
449 453
450config SYSFS_DEPRECATED 454config SYSFS_DEPRECATED
451 bool 455 bool
@@ -483,11 +487,6 @@ config SYSFS_DEPRECATED_V2
483 if the original kernel, that came with your distribution, has 487 if the original kernel, that came with your distribution, has
484 this option set to N. 488 this option set to N.
485 489
486config PROC_PID_CPUSET
487 bool "Include legacy /proc/<pid>/cpuset file"
488 depends on CPUSETS
489 default y
490
491config RELAY 490config RELAY
492 bool "Kernel->user space relay support (formerly relayfs)" 491 bool "Kernel->user space relay support (formerly relayfs)"
493 help 492 help
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 23fdb8492b8e..54b4077fed79 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -650,8 +650,8 @@ static struct file *do_open(struct dentry *dentry, int oflag)
650 return dentry_open(dentry, mqueue_mnt, oflag, cred); 650 return dentry_open(dentry, mqueue_mnt, oflag, cred);
651} 651}
652 652
653asmlinkage long sys_mq_open(const char __user *u_name, int oflag, mode_t mode, 653SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode,
654 struct mq_attr __user *u_attr) 654 struct mq_attr __user *, u_attr)
655{ 655{
656 struct dentry *dentry; 656 struct dentry *dentry;
657 struct file *filp; 657 struct file *filp;
@@ -721,7 +721,7 @@ out_putname:
721 return fd; 721 return fd;
722} 722}
723 723
724asmlinkage long sys_mq_unlink(const char __user *u_name) 724SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
725{ 725{
726 int err; 726 int err;
727 char *name; 727 char *name;
@@ -814,9 +814,9 @@ static inline void pipelined_receive(struct mqueue_inode_info *info)
814 sender->state = STATE_READY; 814 sender->state = STATE_READY;
815} 815}
816 816
817asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, 817SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
818 size_t msg_len, unsigned int msg_prio, 818 size_t, msg_len, unsigned int, msg_prio,
819 const struct timespec __user *u_abs_timeout) 819 const struct timespec __user *, u_abs_timeout)
820{ 820{
821 struct file *filp; 821 struct file *filp;
822 struct inode *inode; 822 struct inode *inode;
@@ -907,9 +907,9 @@ out:
907 return ret; 907 return ret;
908} 908}
909 909
910asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, 910SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
911 size_t msg_len, unsigned int __user *u_msg_prio, 911 size_t, msg_len, unsigned int __user *, u_msg_prio,
912 const struct timespec __user *u_abs_timeout) 912 const struct timespec __user *, u_abs_timeout)
913{ 913{
914 long timeout; 914 long timeout;
915 ssize_t ret; 915 ssize_t ret;
@@ -997,8 +997,8 @@ out:
997 * and he isn't currently owner of notification, will be silently discarded. 997 * and he isn't currently owner of notification, will be silently discarded.
998 * It isn't explicitly defined in the POSIX. 998 * It isn't explicitly defined in the POSIX.
999 */ 999 */
1000asmlinkage long sys_mq_notify(mqd_t mqdes, 1000SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
1001 const struct sigevent __user *u_notification) 1001 const struct sigevent __user *, u_notification)
1002{ 1002{
1003 int ret; 1003 int ret;
1004 struct file *filp; 1004 struct file *filp;
@@ -1123,9 +1123,9 @@ out:
1123 return ret; 1123 return ret;
1124} 1124}
1125 1125
1126asmlinkage long sys_mq_getsetattr(mqd_t mqdes, 1126SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
1127 const struct mq_attr __user *u_mqstat, 1127 const struct mq_attr __user *, u_mqstat,
1128 struct mq_attr __user *u_omqstat) 1128 struct mq_attr __user *, u_omqstat)
1129{ 1129{
1130 int ret; 1130 int ret;
1131 struct mq_attr mqstat, omqstat; 1131 struct mq_attr mqstat, omqstat;
diff --git a/ipc/msg.c b/ipc/msg.c
index b4eee1c6101d..2ceab7f12fcb 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -309,7 +309,7 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
309 return security_msg_queue_associate(msq, msgflg); 309 return security_msg_queue_associate(msq, msgflg);
310} 310}
311 311
312asmlinkage long sys_msgget(key_t key, int msgflg) 312SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
313{ 313{
314 struct ipc_namespace *ns; 314 struct ipc_namespace *ns;
315 struct ipc_ops msg_ops; 315 struct ipc_ops msg_ops;
@@ -466,7 +466,7 @@ out_up:
466 return err; 466 return err;
467} 467}
468 468
469asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf) 469SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
470{ 470{
471 struct msg_queue *msq; 471 struct msg_queue *msq;
472 int err, version; 472 int err, version;
@@ -723,8 +723,8 @@ out_free:
723 return err; 723 return err;
724} 724}
725 725
726asmlinkage long 726SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
727sys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg) 727 int, msgflg)
728{ 728{
729 long mtype; 729 long mtype;
730 730
@@ -904,8 +904,8 @@ out_unlock:
904 return msgsz; 904 return msgsz;
905} 905}
906 906
907asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz, 907SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
908 long msgtyp, int msgflg) 908 long, msgtyp, int, msgflg)
909{ 909{
910 long err, mtype; 910 long err, mtype;
911 911
diff --git a/ipc/sem.c b/ipc/sem.c
index c68cd3f8f0c9..16a2189e96f9 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -308,7 +308,7 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
308 return 0; 308 return 0;
309} 309}
310 310
311asmlinkage long sys_semget(key_t key, int nsems, int semflg) 311SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
312{ 312{
313 struct ipc_namespace *ns; 313 struct ipc_namespace *ns;
314 struct ipc_ops sem_ops; 314 struct ipc_ops sem_ops;
@@ -887,7 +887,7 @@ out_up:
887 return err; 887 return err;
888} 888}
889 889
890asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg) 890SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
891{ 891{
892 int err = -EINVAL; 892 int err = -EINVAL;
893 int version; 893 int version;
@@ -923,6 +923,13 @@ asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg)
923 return -EINVAL; 923 return -EINVAL;
924 } 924 }
925} 925}
926#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
927asmlinkage long SyS_semctl(int semid, int semnum, int cmd, union semun arg)
928{
929 return SYSC_semctl((int) semid, (int) semnum, (int) cmd, arg);
930}
931SYSCALL_ALIAS(sys_semctl, SyS_semctl);
932#endif
926 933
927/* If the task doesn't already have a undo_list, then allocate one 934/* If the task doesn't already have a undo_list, then allocate one
928 * here. We guarantee there is only one thread using this undo list, 935 * here. We guarantee there is only one thread using this undo list,
@@ -1048,8 +1055,8 @@ out:
1048 return un; 1055 return un;
1049} 1056}
1050 1057
1051asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops, 1058SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1052 unsigned nsops, const struct timespec __user *timeout) 1059 unsigned, nsops, const struct timespec __user *, timeout)
1053{ 1060{
1054 int error = -EINVAL; 1061 int error = -EINVAL;
1055 struct sem_array *sma; 1062 struct sem_array *sma;
@@ -1225,7 +1232,8 @@ out_free:
1225 return error; 1232 return error;
1226} 1233}
1227 1234
1228asmlinkage long sys_semop (int semid, struct sembuf __user *tsops, unsigned nsops) 1235SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops,
1236 unsigned, nsops)
1229{ 1237{
1230 return sys_semtimedop(semid, tsops, nsops, NULL); 1238 return sys_semtimedop(semid, tsops, nsops, NULL);
1231} 1239}
diff --git a/ipc/shm.c b/ipc/shm.c
index d0ab5527bf45..a9e09ad2263e 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -440,7 +440,7 @@ static inline int shm_more_checks(struct kern_ipc_perm *ipcp,
440 return 0; 440 return 0;
441} 441}
442 442
443asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) 443SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
444{ 444{
445 struct ipc_namespace *ns; 445 struct ipc_namespace *ns;
446 struct ipc_ops shm_ops; 446 struct ipc_ops shm_ops;
@@ -621,7 +621,7 @@ out_up:
621 return err; 621 return err;
622} 622}
623 623
624asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf) 624SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
625{ 625{
626 struct shmid_kernel *shp; 626 struct shmid_kernel *shp;
627 int err, version; 627 int err, version;
@@ -939,7 +939,7 @@ out_put_dentry:
939 goto out_nattch; 939 goto out_nattch;
940} 940}
941 941
942asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg) 942SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
943{ 943{
944 unsigned long ret; 944 unsigned long ret;
945 long err; 945 long err;
@@ -955,7 +955,7 @@ asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
955 * detach and kill segment if marked destroyed. 955 * detach and kill segment if marked destroyed.
956 * The work is done in shm_close. 956 * The work is done in shm_close.
957 */ 957 */
958asmlinkage long sys_shmdt(char __user *shmaddr) 958SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
959{ 959{
960 struct mm_struct *mm = current->mm; 960 struct mm_struct *mm = current->mm;
961 struct vm_area_struct *vma, *next; 961 struct vm_area_struct *vma, *next;
diff --git a/kernel/Makefile b/kernel/Makefile
index 2aebc4cd7878..170a9213c1b6 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -40,9 +40,8 @@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
40obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o 40obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
41obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o 41obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
42obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o 42obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
43ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y) 43obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
44obj-y += smp.o 44ifneq ($(CONFIG_SMP),y)
45else
46obj-y += up.o 45obj-y += up.o
47endif 46endif
48obj-$(CONFIG_SMP) += spinlock.o 47obj-$(CONFIG_SMP) += spinlock.o
diff --git a/kernel/acct.c b/kernel/acct.c
index d57b7cbb98b6..7afa31564162 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -277,7 +277,7 @@ static int acct_on(char *name)
277 * should be written. If the filename is NULL, accounting will be 277 * should be written. If the filename is NULL, accounting will be
278 * shutdown. 278 * shutdown.
279 */ 279 */
280asmlinkage long sys_acct(const char __user *name) 280SYSCALL_DEFINE1(acct, const char __user *, name)
281{ 281{
282 int error; 282 int error;
283 283
diff --git a/kernel/capability.c b/kernel/capability.c
index 688926e496be..4e17041963f5 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -161,7 +161,7 @@ static inline int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp,
161 * 161 *
162 * Returns 0 on success and < 0 on error. 162 * Returns 0 on success and < 0 on error.
163 */ 163 */
164asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) 164SYSCALL_DEFINE2(capget, cap_user_header_t, header, cap_user_data_t, dataptr)
165{ 165{
166 int ret = 0; 166 int ret = 0;
167 pid_t pid; 167 pid_t pid;
@@ -235,7 +235,7 @@ asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
235 * 235 *
236 * Returns 0 on success and < 0 on error. 236 * Returns 0 on success and < 0 on error.
237 */ 237 */
238asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) 238SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
239{ 239{
240 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S]; 240 struct __user_cap_data_struct kdata[_KERNEL_CAPABILITY_U32S];
241 unsigned i, tocopy; 241 unsigned i, tocopy;
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 647c77a88fcb..a85678865c5e 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -568,7 +568,7 @@ update_domain_attr_tree(struct sched_domain_attr *dattr, struct cpuset *c)
568 * load balancing domains (sched domains) as specified by that partial 568 * load balancing domains (sched domains) as specified by that partial
569 * partition. 569 * partition.
570 * 570 *
571 * See "What is sched_load_balance" in Documentation/cpusets.txt 571 * See "What is sched_load_balance" in Documentation/cgroups/cpusets.txt
572 * for a background explanation of this. 572 * for a background explanation of this.
573 * 573 *
574 * Does not return errors, on the theory that the callers of this 574 * Does not return errors, on the theory that the callers of this
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 0511716e9424..667c841c2952 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -209,8 +209,7 @@ static int __init proc_execdomains_init(void)
209module_init(proc_execdomains_init); 209module_init(proc_execdomains_init);
210#endif 210#endif
211 211
212asmlinkage long 212SYSCALL_DEFINE1(personality, u_long, personality)
213sys_personality(u_long personality)
214{ 213{
215 u_long old = current->personality; 214 u_long old = current->personality;
216 215
diff --git a/kernel/exit.c b/kernel/exit.c
index c7740fa3252c..f80dec3f1875 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1141,7 +1141,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code)
1141 1141
1142EXPORT_SYMBOL(complete_and_exit); 1142EXPORT_SYMBOL(complete_and_exit);
1143 1143
1144asmlinkage long sys_exit(int error_code) 1144SYSCALL_DEFINE1(exit, int, error_code)
1145{ 1145{
1146 do_exit((error_code&0xff)<<8); 1146 do_exit((error_code&0xff)<<8);
1147} 1147}
@@ -1182,9 +1182,11 @@ do_group_exit(int exit_code)
1182 * wait4()-ing process will get the correct exit code - even if this 1182 * wait4()-ing process will get the correct exit code - even if this
1183 * thread is not the thread group leader. 1183 * thread is not the thread group leader.
1184 */ 1184 */
1185asmlinkage void sys_exit_group(int error_code) 1185SYSCALL_DEFINE1(exit_group, int, error_code)
1186{ 1186{
1187 do_group_exit((error_code & 0xff) << 8); 1187 do_group_exit((error_code & 0xff) << 8);
1188 /* NOTREACHED */
1189 return 0;
1188} 1190}
1189 1191
1190static struct pid *task_pid_type(struct task_struct *task, enum pid_type type) 1192static struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
@@ -1752,9 +1754,8 @@ end:
1752 return retval; 1754 return retval;
1753} 1755}
1754 1756
1755asmlinkage long sys_waitid(int which, pid_t upid, 1757SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
1756 struct siginfo __user *infop, int options, 1758 infop, int, options, struct rusage __user *, ru)
1757 struct rusage __user *ru)
1758{ 1759{
1759 struct pid *pid = NULL; 1760 struct pid *pid = NULL;
1760 enum pid_type type; 1761 enum pid_type type;
@@ -1793,8 +1794,8 @@ asmlinkage long sys_waitid(int which, pid_t upid,
1793 return ret; 1794 return ret;
1794} 1795}
1795 1796
1796asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr, 1797SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr,
1797 int options, struct rusage __user *ru) 1798 int, options, struct rusage __user *, ru)
1798{ 1799{
1799 struct pid *pid = NULL; 1800 struct pid *pid = NULL;
1800 enum pid_type type; 1801 enum pid_type type;
@@ -1831,7 +1832,7 @@ asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr,
1831 * sys_waitpid() remains for compatibility. waitpid() should be 1832 * sys_waitpid() remains for compatibility. waitpid() should be
1832 * implemented by calling sys_wait4() from libc.a. 1833 * implemented by calling sys_wait4() from libc.a.
1833 */ 1834 */
1834asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options) 1835SYSCALL_DEFINE3(waitpid, pid_t, pid, int __user *, stat_addr, int, options)
1835{ 1836{
1836 return sys_wait4(pid, stat_addr, options, NULL); 1837 return sys_wait4(pid, stat_addr, options, NULL);
1837} 1838}
diff --git a/kernel/fork.c b/kernel/fork.c
index 1d68f1255dd8..bf0cef8bbdf2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -901,7 +901,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p)
901 clear_freeze_flag(p); 901 clear_freeze_flag(p);
902} 902}
903 903
904asmlinkage long sys_set_tid_address(int __user *tidptr) 904SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
905{ 905{
906 current->clear_child_tid = tidptr; 906 current->clear_child_tid = tidptr;
907 907
@@ -1603,7 +1603,7 @@ static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp
1603 * constructed. Here we are modifying the current, active, 1603 * constructed. Here we are modifying the current, active,
1604 * task_struct. 1604 * task_struct.
1605 */ 1605 */
1606asmlinkage long sys_unshare(unsigned long unshare_flags) 1606SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1607{ 1607{
1608 int err = 0; 1608 int err = 0;
1609 struct fs_struct *fs, *new_fs = NULL; 1609 struct fs_struct *fs, *new_fs = NULL;
diff --git a/kernel/futex.c b/kernel/futex.c
index 002aa189eb09..f89d373a9c6d 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1733,9 +1733,8 @@ pi_faulted:
1733 * @head: pointer to the list-head 1733 * @head: pointer to the list-head
1734 * @len: length of the list-head, as userspace expects 1734 * @len: length of the list-head, as userspace expects
1735 */ 1735 */
1736asmlinkage long 1736SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
1737sys_set_robust_list(struct robust_list_head __user *head, 1737 size_t, len)
1738 size_t len)
1739{ 1738{
1740 if (!futex_cmpxchg_enabled) 1739 if (!futex_cmpxchg_enabled)
1741 return -ENOSYS; 1740 return -ENOSYS;
@@ -1756,9 +1755,9 @@ sys_set_robust_list(struct robust_list_head __user *head,
1756 * @head_ptr: pointer to a list-head pointer, the kernel fills it in 1755 * @head_ptr: pointer to a list-head pointer, the kernel fills it in
1757 * @len_ptr: pointer to a length field, the kernel fills in the header size 1756 * @len_ptr: pointer to a length field, the kernel fills in the header size
1758 */ 1757 */
1759asmlinkage long 1758SYSCALL_DEFINE3(get_robust_list, int, pid,
1760sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, 1759 struct robust_list_head __user * __user *, head_ptr,
1761 size_t __user *len_ptr) 1760 size_t __user *, len_ptr)
1762{ 1761{
1763 struct robust_list_head __user *head; 1762 struct robust_list_head __user *head;
1764 unsigned long ret; 1763 unsigned long ret;
@@ -1978,9 +1977,9 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
1978} 1977}
1979 1978
1980 1979
1981asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, 1980SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
1982 struct timespec __user *utime, u32 __user *uaddr2, 1981 struct timespec __user *, utime, u32 __user *, uaddr2,
1983 u32 val3) 1982 u32, val3)
1984{ 1983{
1985 struct timespec ts; 1984 struct timespec ts;
1986 ktime_t t, *tp = NULL; 1985 ktime_t t, *tp = NULL;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 1455b7651b6b..2dc30c59c5fd 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1467,8 +1467,8 @@ out:
1467 return ret; 1467 return ret;
1468} 1468}
1469 1469
1470asmlinkage long 1470SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
1471sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) 1471 struct timespec __user *, rmtp)
1472{ 1472{
1473 struct timespec tu; 1473 struct timespec tu;
1474 1474
diff --git a/kernel/itimer.c b/kernel/itimer.c
index db7c358b9a02..6a5fe93dd8bd 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -100,7 +100,7 @@ int do_getitimer(int which, struct itimerval *value)
100 return 0; 100 return 0;
101} 101}
102 102
103asmlinkage long sys_getitimer(int which, struct itimerval __user *value) 103SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value)
104{ 104{
105 int error = -EFAULT; 105 int error = -EFAULT;
106 struct itimerval get_buffer; 106 struct itimerval get_buffer;
@@ -260,9 +260,8 @@ unsigned int alarm_setitimer(unsigned int seconds)
260 return it_old.it_value.tv_sec; 260 return it_old.it_value.tv_sec;
261} 261}
262 262
263asmlinkage long sys_setitimer(int which, 263SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
264 struct itimerval __user *value, 264 struct itimerval __user *, ovalue)
265 struct itimerval __user *ovalue)
266{ 265{
267 struct itimerval set_buffer, get_buffer; 266 struct itimerval set_buffer, get_buffer;
268 int error; 267 int error;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 3fb855ad6aa0..8a6d7b08864e 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -934,9 +934,8 @@ struct kimage *kexec_crash_image;
934 934
935static DEFINE_MUTEX(kexec_mutex); 935static DEFINE_MUTEX(kexec_mutex);
936 936
937asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 937SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
938 struct kexec_segment __user *segments, 938 struct kexec_segment __user *, segments, unsigned long, flags)
939 unsigned long flags)
940{ 939{
941 struct kimage **dest_image, *image; 940 struct kimage **dest_image, *image;
942 int result; 941 int result;
diff --git a/kernel/module.c b/kernel/module.c
index c9332c90d5a0..e8b51d41dd72 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -743,8 +743,8 @@ static void wait_for_zero_refcount(struct module *mod)
743 mutex_lock(&module_mutex); 743 mutex_lock(&module_mutex);
744} 744}
745 745
746asmlinkage long 746SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
747sys_delete_module(const char __user *name_user, unsigned int flags) 747 unsigned int, flags)
748{ 748{
749 struct module *mod; 749 struct module *mod;
750 char name[MODULE_NAME_LEN]; 750 char name[MODULE_NAME_LEN];
@@ -2296,10 +2296,8 @@ static noinline struct module *load_module(void __user *umod,
2296} 2296}
2297 2297
2298/* This is where the real work happens */ 2298/* This is where the real work happens */
2299asmlinkage long 2299SYSCALL_DEFINE3(init_module, void __user *, umod,
2300sys_init_module(void __user *umod, 2300 unsigned long, len, const char __user *, uargs)
2301 unsigned long len,
2302 const char __user *uargs)
2303{ 2301{
2304 struct module *mod; 2302 struct module *mod;
2305 int ret = 0; 2303 int ret = 0;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 887c63787de6..052ec4d195c7 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -477,10 +477,9 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set)
477 477
478/* Create a POSIX.1b interval timer. */ 478/* Create a POSIX.1b interval timer. */
479 479
480asmlinkage long 480SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
481sys_timer_create(const clockid_t which_clock, 481 struct sigevent __user *, timer_event_spec,
482 struct sigevent __user *timer_event_spec, 482 timer_t __user *, created_timer_id)
483 timer_t __user * created_timer_id)
484{ 483{
485 struct k_itimer *new_timer; 484 struct k_itimer *new_timer;
486 int error, new_timer_id; 485 int error, new_timer_id;
@@ -661,8 +660,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
661} 660}
662 661
663/* Get the time remaining on a POSIX.1b interval timer. */ 662/* Get the time remaining on a POSIX.1b interval timer. */
664asmlinkage long 663SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
665sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting) 664 struct itimerspec __user *, setting)
666{ 665{
667 struct k_itimer *timr; 666 struct k_itimer *timr;
668 struct itimerspec cur_setting; 667 struct itimerspec cur_setting;
@@ -691,8 +690,7 @@ sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting)
691 * the call back to do_schedule_next_timer(). So all we need to do is 690 * the call back to do_schedule_next_timer(). So all we need to do is
692 * to pick up the frozen overrun. 691 * to pick up the frozen overrun.
693 */ 692 */
694asmlinkage long 693SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id)
695sys_timer_getoverrun(timer_t timer_id)
696{ 694{
697 struct k_itimer *timr; 695 struct k_itimer *timr;
698 int overrun; 696 int overrun;
@@ -760,10 +758,9 @@ common_timer_set(struct k_itimer *timr, int flags,
760} 758}
761 759
762/* Set a POSIX.1b interval timer */ 760/* Set a POSIX.1b interval timer */
763asmlinkage long 761SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
764sys_timer_settime(timer_t timer_id, int flags, 762 const struct itimerspec __user *, new_setting,
765 const struct itimerspec __user *new_setting, 763 struct itimerspec __user *, old_setting)
766 struct itimerspec __user *old_setting)
767{ 764{
768 struct k_itimer *timr; 765 struct k_itimer *timr;
769 struct itimerspec new_spec, old_spec; 766 struct itimerspec new_spec, old_spec;
@@ -816,8 +813,7 @@ static inline int timer_delete_hook(struct k_itimer *timer)
816} 813}
817 814
818/* Delete a POSIX.1b interval timer. */ 815/* Delete a POSIX.1b interval timer. */
819asmlinkage long 816SYSCALL_DEFINE1(timer_delete, timer_t, timer_id)
820sys_timer_delete(timer_t timer_id)
821{ 817{
822 struct k_itimer *timer; 818 struct k_itimer *timer;
823 unsigned long flags; 819 unsigned long flags;
@@ -903,8 +899,8 @@ int do_posix_clock_nonanosleep(const clockid_t clock, int flags,
903} 899}
904EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep); 900EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep);
905 901
906asmlinkage long sys_clock_settime(const clockid_t which_clock, 902SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
907 const struct timespec __user *tp) 903 const struct timespec __user *, tp)
908{ 904{
909 struct timespec new_tp; 905 struct timespec new_tp;
910 906
@@ -916,8 +912,8 @@ asmlinkage long sys_clock_settime(const clockid_t which_clock,
916 return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp)); 912 return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp));
917} 913}
918 914
919asmlinkage long 915SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
920sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp) 916 struct timespec __user *,tp)
921{ 917{
922 struct timespec kernel_tp; 918 struct timespec kernel_tp;
923 int error; 919 int error;
@@ -933,8 +929,8 @@ sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp)
933 929
934} 930}
935 931
936asmlinkage long 932SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
937sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp) 933 struct timespec __user *, tp)
938{ 934{
939 struct timespec rtn_tp; 935 struct timespec rtn_tp;
940 int error; 936 int error;
@@ -963,10 +959,9 @@ static int common_nsleep(const clockid_t which_clock, int flags,
963 which_clock); 959 which_clock);
964} 960}
965 961
966asmlinkage long 962SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
967sys_clock_nanosleep(const clockid_t which_clock, int flags, 963 const struct timespec __user *, rqtp,
968 const struct timespec __user *rqtp, 964 struct timespec __user *, rmtp)
969 struct timespec __user *rmtp)
970{ 965{
971 struct timespec t; 966 struct timespec t;
972 967
diff --git a/kernel/printk.c b/kernel/printk.c
index 7015733793e8..69188f226a93 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -382,7 +382,7 @@ out:
382 return error; 382 return error;
383} 383}
384 384
385asmlinkage long sys_syslog(int type, char __user *buf, int len) 385SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
386{ 386{
387 return do_syslog(type, buf, len); 387 return do_syslog(type, buf, len);
388} 388}
@@ -742,11 +742,6 @@ EXPORT_SYMBOL(vprintk);
742 742
743#else 743#else
744 744
745asmlinkage long sys_syslog(int type, char __user *buf, int len)
746{
747 return -ENOSYS;
748}
749
750static void call_console_drivers(unsigned start, unsigned end) 745static void call_console_drivers(unsigned start, unsigned end)
751{ 746{
752} 747}
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 29dc700e198c..c9cf48b21f05 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -574,7 +574,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
574#define arch_ptrace_attach(child) do { } while (0) 574#define arch_ptrace_attach(child) do { } while (0)
575#endif 575#endif
576 576
577asmlinkage long sys_ptrace(long request, long pid, long addr, long data) 577SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data)
578{ 578{
579 struct task_struct *child; 579 struct task_struct *child;
580 long ret; 580 long ret;
diff --git a/kernel/resource.c b/kernel/resource.c
index ca6a1536b205..fd5d7d574bb9 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -620,6 +620,7 @@ resource_size_t resource_alignment(struct resource *res)
620 * @start: resource start address 620 * @start: resource start address
621 * @n: resource region size 621 * @n: resource region size
622 * @name: reserving caller's ID string 622 * @name: reserving caller's ID string
623 * @flags: IO resource flags
623 */ 624 */
624struct resource * __request_region(struct resource *parent, 625struct resource * __request_region(struct resource *parent,
625 resource_size_t start, resource_size_t n, 626 resource_size_t start, resource_size_t n,
diff --git a/kernel/sched.c b/kernel/sched.c
index 8be2c13b50d0..52bbf1c842a8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1323,8 +1323,8 @@ static inline void update_load_sub(struct load_weight *lw, unsigned long dec)
1323 * slice expiry etc. 1323 * slice expiry etc.
1324 */ 1324 */
1325 1325
1326#define WEIGHT_IDLEPRIO 2 1326#define WEIGHT_IDLEPRIO 3
1327#define WMULT_IDLEPRIO (1 << 31) 1327#define WMULT_IDLEPRIO 1431655765
1328 1328
1329/* 1329/*
1330 * Nice levels are multiplicative, with a gentle 10% change for every 1330 * Nice levels are multiplicative, with a gentle 10% change for every
@@ -4440,7 +4440,7 @@ void __kprobes sub_preempt_count(int val)
4440 /* 4440 /*
4441 * Underflow? 4441 * Underflow?
4442 */ 4442 */
4443 if (DEBUG_LOCKS_WARN_ON(val > preempt_count() - (!!kernel_locked()))) 4443 if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
4444 return; 4444 return;
4445 /* 4445 /*
4446 * Is the spinlock portion underflowing? 4446 * Is the spinlock portion underflowing?
@@ -5126,7 +5126,7 @@ int can_nice(const struct task_struct *p, const int nice)
5126 * sys_setpriority is a more generic, but much slower function that 5126 * sys_setpriority is a more generic, but much slower function that
5127 * does similar things. 5127 * does similar things.
5128 */ 5128 */
5129asmlinkage long sys_nice(int increment) 5129SYSCALL_DEFINE1(nice, int, increment)
5130{ 5130{
5131 long nice, retval; 5131 long nice, retval;
5132 5132
@@ -5433,8 +5433,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5433 * @policy: new policy. 5433 * @policy: new policy.
5434 * @param: structure containing the new RT priority. 5434 * @param: structure containing the new RT priority.
5435 */ 5435 */
5436asmlinkage long 5436SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
5437sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) 5437 struct sched_param __user *, param)
5438{ 5438{
5439 /* negative values for policy are not valid */ 5439 /* negative values for policy are not valid */
5440 if (policy < 0) 5440 if (policy < 0)
@@ -5448,7 +5448,7 @@ sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
5448 * @pid: the pid in question. 5448 * @pid: the pid in question.
5449 * @param: structure containing the new RT priority. 5449 * @param: structure containing the new RT priority.
5450 */ 5450 */
5451asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param) 5451SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
5452{ 5452{
5453 return do_sched_setscheduler(pid, -1, param); 5453 return do_sched_setscheduler(pid, -1, param);
5454} 5454}
@@ -5457,7 +5457,7 @@ asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param)
5457 * sys_sched_getscheduler - get the policy (scheduling class) of a thread 5457 * sys_sched_getscheduler - get the policy (scheduling class) of a thread
5458 * @pid: the pid in question. 5458 * @pid: the pid in question.
5459 */ 5459 */
5460asmlinkage long sys_sched_getscheduler(pid_t pid) 5460SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
5461{ 5461{
5462 struct task_struct *p; 5462 struct task_struct *p;
5463 int retval; 5463 int retval;
@@ -5482,7 +5482,7 @@ asmlinkage long sys_sched_getscheduler(pid_t pid)
5482 * @pid: the pid in question. 5482 * @pid: the pid in question.
5483 * @param: structure containing the RT priority. 5483 * @param: structure containing the RT priority.
5484 */ 5484 */
5485asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param) 5485SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
5486{ 5486{
5487 struct sched_param lp; 5487 struct sched_param lp;
5488 struct task_struct *p; 5488 struct task_struct *p;
@@ -5600,8 +5600,8 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
5600 * @len: length in bytes of the bitmask pointed to by user_mask_ptr 5600 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
5601 * @user_mask_ptr: user-space pointer to the new cpu mask 5601 * @user_mask_ptr: user-space pointer to the new cpu mask
5602 */ 5602 */
5603asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, 5603SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
5604 unsigned long __user *user_mask_ptr) 5604 unsigned long __user *, user_mask_ptr)
5605{ 5605{
5606 cpumask_var_t new_mask; 5606 cpumask_var_t new_mask;
5607 int retval; 5607 int retval;
@@ -5648,8 +5648,8 @@ out_unlock:
5648 * @len: length in bytes of the bitmask pointed to by user_mask_ptr 5648 * @len: length in bytes of the bitmask pointed to by user_mask_ptr
5649 * @user_mask_ptr: user-space pointer to hold the current cpu mask 5649 * @user_mask_ptr: user-space pointer to hold the current cpu mask
5650 */ 5650 */
5651asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, 5651SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
5652 unsigned long __user *user_mask_ptr) 5652 unsigned long __user *, user_mask_ptr)
5653{ 5653{
5654 int ret; 5654 int ret;
5655 cpumask_var_t mask; 5655 cpumask_var_t mask;
@@ -5678,7 +5678,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
5678 * This function yields the current CPU to other tasks. If there are no 5678 * This function yields the current CPU to other tasks. If there are no
5679 * other threads running on this CPU then this function will return. 5679 * other threads running on this CPU then this function will return.
5680 */ 5680 */
5681asmlinkage long sys_sched_yield(void) 5681SYSCALL_DEFINE0(sched_yield)
5682{ 5682{
5683 struct rq *rq = this_rq_lock(); 5683 struct rq *rq = this_rq_lock();
5684 5684
@@ -5819,7 +5819,7 @@ long __sched io_schedule_timeout(long timeout)
5819 * this syscall returns the maximum rt_priority that can be used 5819 * this syscall returns the maximum rt_priority that can be used
5820 * by a given scheduling class. 5820 * by a given scheduling class.
5821 */ 5821 */
5822asmlinkage long sys_sched_get_priority_max(int policy) 5822SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
5823{ 5823{
5824 int ret = -EINVAL; 5824 int ret = -EINVAL;
5825 5825
@@ -5844,7 +5844,7 @@ asmlinkage long sys_sched_get_priority_max(int policy)
5844 * this syscall returns the minimum rt_priority that can be used 5844 * this syscall returns the minimum rt_priority that can be used
5845 * by a given scheduling class. 5845 * by a given scheduling class.
5846 */ 5846 */
5847asmlinkage long sys_sched_get_priority_min(int policy) 5847SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
5848{ 5848{
5849 int ret = -EINVAL; 5849 int ret = -EINVAL;
5850 5850
@@ -5869,8 +5869,8 @@ asmlinkage long sys_sched_get_priority_min(int policy)
5869 * this syscall writes the default timeslice value of a given process 5869 * this syscall writes the default timeslice value of a given process
5870 * into the user-space timespec buffer. A value of '0' means infinity. 5870 * into the user-space timespec buffer. A value of '0' means infinity.
5871 */ 5871 */
5872asmlinkage 5872SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
5873long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval) 5873 struct timespec __user *, interval)
5874{ 5874{
5875 struct task_struct *p; 5875 struct task_struct *p;
5876 unsigned int time_slice; 5876 unsigned int time_slice;
@@ -9050,6 +9050,13 @@ static int tg_schedulable(struct task_group *tg, void *data)
9050 runtime = d->rt_runtime; 9050 runtime = d->rt_runtime;
9051 } 9051 }
9052 9052
9053#ifdef CONFIG_USER_SCHED
9054 if (tg == &root_task_group) {
9055 period = global_rt_period();
9056 runtime = global_rt_runtime();
9057 }
9058#endif
9059
9053 /* 9060 /*
9054 * Cannot have more runtime than the period. 9061 * Cannot have more runtime than the period.
9055 */ 9062 */
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 8e1352c75557..5cc1c162044f 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -283,7 +283,7 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
283 struct sched_entity, 283 struct sched_entity,
284 run_node); 284 run_node);
285 285
286 if (vruntime == cfs_rq->min_vruntime) 286 if (!cfs_rq->curr)
287 vruntime = se->vruntime; 287 vruntime = se->vruntime;
288 else 288 else
289 vruntime = min_vruntime(vruntime, se->vruntime); 289 vruntime = min_vruntime(vruntime, se->vruntime);
@@ -429,7 +429,10 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
429 u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq); 429 u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq);
430 430
431 for_each_sched_entity(se) { 431 for_each_sched_entity(se) {
432 struct load_weight *load = &cfs_rq->load; 432 struct load_weight *load;
433
434 cfs_rq = cfs_rq_of(se);
435 load = &cfs_rq->load;
433 436
434 if (unlikely(!se->on_rq)) { 437 if (unlikely(!se->on_rq)) {
435 struct load_weight lw = cfs_rq->load; 438 struct load_weight lw = cfs_rq->load;
@@ -677,9 +680,13 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
677 unsigned long thresh = sysctl_sched_latency; 680 unsigned long thresh = sysctl_sched_latency;
678 681
679 /* 682 /*
680 * convert the sleeper threshold into virtual time 683 * Convert the sleeper threshold into virtual time.
684 * SCHED_IDLE is a special sub-class. We care about
685 * fairness only relative to other SCHED_IDLE tasks,
686 * all of which have the same weight.
681 */ 687 */
682 if (sched_feat(NORMALIZED_SLEEPER)) 688 if (sched_feat(NORMALIZED_SLEEPER) &&
689 task_of(se)->policy != SCHED_IDLE)
683 thresh = calc_delta_fair(thresh, se); 690 thresh = calc_delta_fair(thresh, se);
684 691
685 vruntime -= thresh; 692 vruntime -= thresh;
@@ -1340,14 +1347,18 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
1340 1347
1341static void set_last_buddy(struct sched_entity *se) 1348static void set_last_buddy(struct sched_entity *se)
1342{ 1349{
1343 for_each_sched_entity(se) 1350 if (likely(task_of(se)->policy != SCHED_IDLE)) {
1344 cfs_rq_of(se)->last = se; 1351 for_each_sched_entity(se)
1352 cfs_rq_of(se)->last = se;
1353 }
1345} 1354}
1346 1355
1347static void set_next_buddy(struct sched_entity *se) 1356static void set_next_buddy(struct sched_entity *se)
1348{ 1357{
1349 for_each_sched_entity(se) 1358 if (likely(task_of(se)->policy != SCHED_IDLE)) {
1350 cfs_rq_of(se)->next = se; 1359 for_each_sched_entity(se)
1360 cfs_rq_of(se)->next = se;
1361 }
1351} 1362}
1352 1363
1353/* 1364/*
@@ -1393,12 +1404,18 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
1393 return; 1404 return;
1394 1405
1395 /* 1406 /*
1396 * Batch tasks do not preempt (their preemption is driven by 1407 * Batch and idle tasks do not preempt (their preemption is driven by
1397 * the tick): 1408 * the tick):
1398 */ 1409 */
1399 if (unlikely(p->policy == SCHED_BATCH)) 1410 if (unlikely(p->policy != SCHED_NORMAL))
1400 return; 1411 return;
1401 1412
1413 /* Idle tasks are by definition preempted by everybody. */
1414 if (unlikely(curr->policy == SCHED_IDLE)) {
1415 resched_task(curr);
1416 return;
1417 }
1418
1402 if (!sched_feat(WAKEUP_PREEMPT)) 1419 if (!sched_feat(WAKEUP_PREEMPT))
1403 return; 1420 return;
1404 1421
diff --git a/kernel/signal.c b/kernel/signal.c
index 3152ac3b62e2..e73759783dc8 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1961,7 +1961,7 @@ EXPORT_SYMBOL(unblock_all_signals);
1961 * System call entry points. 1961 * System call entry points.
1962 */ 1962 */
1963 1963
1964asmlinkage long sys_restart_syscall(void) 1964SYSCALL_DEFINE0(restart_syscall)
1965{ 1965{
1966 struct restart_block *restart = &current_thread_info()->restart_block; 1966 struct restart_block *restart = &current_thread_info()->restart_block;
1967 return restart->fn(restart); 1967 return restart->fn(restart);
@@ -2014,8 +2014,8 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
2014 return error; 2014 return error;
2015} 2015}
2016 2016
2017asmlinkage long 2017SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, set,
2018sys_rt_sigprocmask(int how, sigset_t __user *set, sigset_t __user *oset, size_t sigsetsize) 2018 sigset_t __user *, oset, size_t, sigsetsize)
2019{ 2019{
2020 int error = -EINVAL; 2020 int error = -EINVAL;
2021 sigset_t old_set, new_set; 2021 sigset_t old_set, new_set;
@@ -2074,8 +2074,7 @@ out:
2074 return error; 2074 return error;
2075} 2075}
2076 2076
2077asmlinkage long 2077SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
2078sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize)
2079{ 2078{
2080 return do_sigpending(set, sigsetsize); 2079 return do_sigpending(set, sigsetsize);
2081} 2080}
@@ -2146,11 +2145,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
2146 2145
2147#endif 2146#endif
2148 2147
2149asmlinkage long 2148SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2150sys_rt_sigtimedwait(const sigset_t __user *uthese, 2149 siginfo_t __user *, uinfo, const struct timespec __user *, uts,
2151 siginfo_t __user *uinfo, 2150 size_t, sigsetsize)
2152 const struct timespec __user *uts,
2153 size_t sigsetsize)
2154{ 2151{
2155 int ret, sig; 2152 int ret, sig;
2156 sigset_t these; 2153 sigset_t these;
@@ -2223,8 +2220,7 @@ sys_rt_sigtimedwait(const sigset_t __user *uthese,
2223 return ret; 2220 return ret;
2224} 2221}
2225 2222
2226asmlinkage long 2223SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
2227sys_kill(pid_t pid, int sig)
2228{ 2224{
2229 struct siginfo info; 2225 struct siginfo info;
2230 2226
@@ -2283,7 +2279,7 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig)
2283 * exists but it's not belonging to the target process anymore. This 2279 * exists but it's not belonging to the target process anymore. This
2284 * method solves the problem of threads exiting and PIDs getting reused. 2280 * method solves the problem of threads exiting and PIDs getting reused.
2285 */ 2281 */
2286asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig) 2282SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
2287{ 2283{
2288 /* This is only valid for single tasks */ 2284 /* This is only valid for single tasks */
2289 if (pid <= 0 || tgid <= 0) 2285 if (pid <= 0 || tgid <= 0)
@@ -2295,8 +2291,7 @@ asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig)
2295/* 2291/*
2296 * Send a signal to only one task, even if it's a CLONE_THREAD task. 2292 * Send a signal to only one task, even if it's a CLONE_THREAD task.
2297 */ 2293 */
2298asmlinkage long 2294SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
2299sys_tkill(pid_t pid, int sig)
2300{ 2295{
2301 /* This is only valid for single tasks */ 2296 /* This is only valid for single tasks */
2302 if (pid <= 0) 2297 if (pid <= 0)
@@ -2305,8 +2300,8 @@ sys_tkill(pid_t pid, int sig)
2305 return do_tkill(0, pid, sig); 2300 return do_tkill(0, pid, sig);
2306} 2301}
2307 2302
2308asmlinkage long 2303SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
2309sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo) 2304 siginfo_t __user *, uinfo)
2310{ 2305{
2311 siginfo_t info; 2306 siginfo_t info;
2312 2307
@@ -2434,8 +2429,7 @@ out:
2434 2429
2435#ifdef __ARCH_WANT_SYS_SIGPENDING 2430#ifdef __ARCH_WANT_SYS_SIGPENDING
2436 2431
2437asmlinkage long 2432SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
2438sys_sigpending(old_sigset_t __user *set)
2439{ 2433{
2440 return do_sigpending(set, sizeof(*set)); 2434 return do_sigpending(set, sizeof(*set));
2441} 2435}
@@ -2446,8 +2440,8 @@ sys_sigpending(old_sigset_t __user *set)
2446/* Some platforms have their own version with special arguments others 2440/* Some platforms have their own version with special arguments others
2447 support only sys_rt_sigprocmask. */ 2441 support only sys_rt_sigprocmask. */
2448 2442
2449asmlinkage long 2443SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
2450sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset) 2444 old_sigset_t __user *, oset)
2451{ 2445{
2452 int error; 2446 int error;
2453 old_sigset_t old_set, new_set; 2447 old_sigset_t old_set, new_set;
@@ -2497,11 +2491,10 @@ out:
2497#endif /* __ARCH_WANT_SYS_SIGPROCMASK */ 2491#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
2498 2492
2499#ifdef __ARCH_WANT_SYS_RT_SIGACTION 2493#ifdef __ARCH_WANT_SYS_RT_SIGACTION
2500asmlinkage long 2494SYSCALL_DEFINE4(rt_sigaction, int, sig,
2501sys_rt_sigaction(int sig, 2495 const struct sigaction __user *, act,
2502 const struct sigaction __user *act, 2496 struct sigaction __user *, oact,
2503 struct sigaction __user *oact, 2497 size_t, sigsetsize)
2504 size_t sigsetsize)
2505{ 2498{
2506 struct k_sigaction new_sa, old_sa; 2499 struct k_sigaction new_sa, old_sa;
2507 int ret = -EINVAL; 2500 int ret = -EINVAL;
@@ -2531,15 +2524,13 @@ out:
2531/* 2524/*
2532 * For backwards compatibility. Functionality superseded by sigprocmask. 2525 * For backwards compatibility. Functionality superseded by sigprocmask.
2533 */ 2526 */
2534asmlinkage long 2527SYSCALL_DEFINE0(sgetmask)
2535sys_sgetmask(void)
2536{ 2528{
2537 /* SMP safe */ 2529 /* SMP safe */
2538 return current->blocked.sig[0]; 2530 return current->blocked.sig[0];
2539} 2531}
2540 2532
2541asmlinkage long 2533SYSCALL_DEFINE1(ssetmask, int, newmask)
2542sys_ssetmask(int newmask)
2543{ 2534{
2544 int old; 2535 int old;
2545 2536
@@ -2559,8 +2550,7 @@ sys_ssetmask(int newmask)
2559/* 2550/*
2560 * For backwards compatibility. Functionality superseded by sigaction. 2551 * For backwards compatibility. Functionality superseded by sigaction.
2561 */ 2552 */
2562asmlinkage unsigned long 2553SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
2563sys_signal(int sig, __sighandler_t handler)
2564{ 2554{
2565 struct k_sigaction new_sa, old_sa; 2555 struct k_sigaction new_sa, old_sa;
2566 int ret; 2556 int ret;
@@ -2577,8 +2567,7 @@ sys_signal(int sig, __sighandler_t handler)
2577 2567
2578#ifdef __ARCH_WANT_SYS_PAUSE 2568#ifdef __ARCH_WANT_SYS_PAUSE
2579 2569
2580asmlinkage long 2570SYSCALL_DEFINE0(pause)
2581sys_pause(void)
2582{ 2571{
2583 current->state = TASK_INTERRUPTIBLE; 2572 current->state = TASK_INTERRUPTIBLE;
2584 schedule(); 2573 schedule();
@@ -2588,7 +2577,7 @@ sys_pause(void)
2588#endif 2577#endif
2589 2578
2590#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND 2579#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND
2591asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) 2580SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
2592{ 2581{
2593 sigset_t newset; 2582 sigset_t newset;
2594 2583
diff --git a/kernel/sys.c b/kernel/sys.c
index 763c3c17ded3..e7dc0e10a485 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -143,7 +143,7 @@ out:
143 return error; 143 return error;
144} 144}
145 145
146asmlinkage long sys_setpriority(int which, int who, int niceval) 146SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
147{ 147{
148 struct task_struct *g, *p; 148 struct task_struct *g, *p;
149 struct user_struct *user; 149 struct user_struct *user;
@@ -208,7 +208,7 @@ out:
208 * has been offset by 20 (ie it returns 40..1 instead of -20..19) 208 * has been offset by 20 (ie it returns 40..1 instead of -20..19)
209 * to stay compatible. 209 * to stay compatible.
210 */ 210 */
211asmlinkage long sys_getpriority(int which, int who) 211SYSCALL_DEFINE2(getpriority, int, which, int, who)
212{ 212{
213 struct task_struct *g, *p; 213 struct task_struct *g, *p;
214 struct user_struct *user; 214 struct user_struct *user;
@@ -355,7 +355,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
355 * 355 *
356 * reboot doesn't sync: do that yourself before calling this. 356 * reboot doesn't sync: do that yourself before calling this.
357 */ 357 */
358asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user * arg) 358SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
359 void __user *, arg)
359{ 360{
360 char buffer[256]; 361 char buffer[256];
361 362
@@ -478,7 +479,7 @@ void ctrl_alt_del(void)
478 * SMP: There are not races, the GIDs are checked only by filesystem 479 * SMP: There are not races, the GIDs are checked only by filesystem
479 * operations (as far as semantic preservation is concerned). 480 * operations (as far as semantic preservation is concerned).
480 */ 481 */
481asmlinkage long sys_setregid(gid_t rgid, gid_t egid) 482SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
482{ 483{
483 const struct cred *old; 484 const struct cred *old;
484 struct cred *new; 485 struct cred *new;
@@ -529,7 +530,7 @@ error:
529 * 530 *
530 * SMP: Same implicit races as above. 531 * SMP: Same implicit races as above.
531 */ 532 */
532asmlinkage long sys_setgid(gid_t gid) 533SYSCALL_DEFINE1(setgid, gid_t, gid)
533{ 534{
534 const struct cred *old; 535 const struct cred *old;
535 struct cred *new; 536 struct cred *new;
@@ -597,7 +598,7 @@ static int set_user(struct cred *new)
597 * 100% compatible with BSD. A program which uses just setuid() will be 598 * 100% compatible with BSD. A program which uses just setuid() will be
598 * 100% compatible with POSIX with saved IDs. 599 * 100% compatible with POSIX with saved IDs.
599 */ 600 */
600asmlinkage long sys_setreuid(uid_t ruid, uid_t euid) 601SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
601{ 602{
602 const struct cred *old; 603 const struct cred *old;
603 struct cred *new; 604 struct cred *new;
@@ -661,7 +662,7 @@ error:
661 * will allow a root program to temporarily drop privileges and be able to 662 * will allow a root program to temporarily drop privileges and be able to
662 * regain them by swapping the real and effective uid. 663 * regain them by swapping the real and effective uid.
663 */ 664 */
664asmlinkage long sys_setuid(uid_t uid) 665SYSCALL_DEFINE1(setuid, uid_t, uid)
665{ 666{
666 const struct cred *old; 667 const struct cred *old;
667 struct cred *new; 668 struct cred *new;
@@ -705,7 +706,7 @@ error:
705 * This function implements a generic ability to update ruid, euid, 706 * This function implements a generic ability to update ruid, euid,
706 * and suid. This allows you to implement the 4.4 compatible seteuid(). 707 * and suid. This allows you to implement the 4.4 compatible seteuid().
707 */ 708 */
708asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) 709SYSCALL_DEFINE3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
709{ 710{
710 const struct cred *old; 711 const struct cred *old;
711 struct cred *new; 712 struct cred *new;
@@ -756,7 +757,7 @@ error:
756 return retval; 757 return retval;
757} 758}
758 759
759asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid) 760SYSCALL_DEFINE3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid)
760{ 761{
761 const struct cred *cred = current_cred(); 762 const struct cred *cred = current_cred();
762 int retval; 763 int retval;
@@ -771,7 +772,7 @@ asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __us
771/* 772/*
772 * Same as above, but for rgid, egid, sgid. 773 * Same as above, but for rgid, egid, sgid.
773 */ 774 */
774asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid) 775SYSCALL_DEFINE3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
775{ 776{
776 const struct cred *old; 777 const struct cred *old;
777 struct cred *new; 778 struct cred *new;
@@ -814,7 +815,7 @@ error:
814 return retval; 815 return retval;
815} 816}
816 817
817asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid) 818SYSCALL_DEFINE3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid)
818{ 819{
819 const struct cred *cred = current_cred(); 820 const struct cred *cred = current_cred();
820 int retval; 821 int retval;
@@ -833,7 +834,7 @@ asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __us
833 * whatever uid it wants to). It normally shadows "euid", except when 834 * whatever uid it wants to). It normally shadows "euid", except when
834 * explicitly set by setfsuid() or for access.. 835 * explicitly set by setfsuid() or for access..
835 */ 836 */
836asmlinkage long sys_setfsuid(uid_t uid) 837SYSCALL_DEFINE1(setfsuid, uid_t, uid)
837{ 838{
838 const struct cred *old; 839 const struct cred *old;
839 struct cred *new; 840 struct cred *new;
@@ -870,7 +871,7 @@ change_okay:
870/* 871/*
871 * Samma på svenska.. 872 * Samma på svenska..
872 */ 873 */
873asmlinkage long sys_setfsgid(gid_t gid) 874SYSCALL_DEFINE1(setfsgid, gid_t, gid)
874{ 875{
875 const struct cred *old; 876 const struct cred *old;
876 struct cred *new; 877 struct cred *new;
@@ -919,7 +920,7 @@ void do_sys_times(struct tms *tms)
919 tms->tms_cstime = cputime_to_clock_t(cstime); 920 tms->tms_cstime = cputime_to_clock_t(cstime);
920} 921}
921 922
922asmlinkage long sys_times(struct tms __user * tbuf) 923SYSCALL_DEFINE1(times, struct tms __user *, tbuf)
923{ 924{
924 if (tbuf) { 925 if (tbuf) {
925 struct tms tmp; 926 struct tms tmp;
@@ -944,7 +945,7 @@ asmlinkage long sys_times(struct tms __user * tbuf)
944 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. 945 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
945 * LBT 04.03.94 946 * LBT 04.03.94
946 */ 947 */
947asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) 948SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
948{ 949{
949 struct task_struct *p; 950 struct task_struct *p;
950 struct task_struct *group_leader = current->group_leader; 951 struct task_struct *group_leader = current->group_leader;
@@ -1015,7 +1016,7 @@ out:
1015 return err; 1016 return err;
1016} 1017}
1017 1018
1018asmlinkage long sys_getpgid(pid_t pid) 1019SYSCALL_DEFINE1(getpgid, pid_t, pid)
1019{ 1020{
1020 struct task_struct *p; 1021 struct task_struct *p;
1021 struct pid *grp; 1022 struct pid *grp;
@@ -1045,14 +1046,14 @@ out:
1045 1046
1046#ifdef __ARCH_WANT_SYS_GETPGRP 1047#ifdef __ARCH_WANT_SYS_GETPGRP
1047 1048
1048asmlinkage long sys_getpgrp(void) 1049SYSCALL_DEFINE0(getpgrp)
1049{ 1050{
1050 return sys_getpgid(0); 1051 return sys_getpgid(0);
1051} 1052}
1052 1053
1053#endif 1054#endif
1054 1055
1055asmlinkage long sys_getsid(pid_t pid) 1056SYSCALL_DEFINE1(getsid, pid_t, pid)
1056{ 1057{
1057 struct task_struct *p; 1058 struct task_struct *p;
1058 struct pid *sid; 1059 struct pid *sid;
@@ -1080,7 +1081,7 @@ out:
1080 return retval; 1081 return retval;
1081} 1082}
1082 1083
1083asmlinkage long sys_setsid(void) 1084SYSCALL_DEFINE0(setsid)
1084{ 1085{
1085 struct task_struct *group_leader = current->group_leader; 1086 struct task_struct *group_leader = current->group_leader;
1086 struct pid *sid = task_pid(group_leader); 1087 struct pid *sid = task_pid(group_leader);
@@ -1311,7 +1312,7 @@ int set_current_groups(struct group_info *group_info)
1311 1312
1312EXPORT_SYMBOL(set_current_groups); 1313EXPORT_SYMBOL(set_current_groups);
1313 1314
1314asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) 1315SYSCALL_DEFINE2(getgroups, int, gidsetsize, gid_t __user *, grouplist)
1315{ 1316{
1316 const struct cred *cred = current_cred(); 1317 const struct cred *cred = current_cred();
1317 int i; 1318 int i;
@@ -1340,7 +1341,7 @@ out:
1340 * without another task interfering. 1341 * without another task interfering.
1341 */ 1342 */
1342 1343
1343asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist) 1344SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
1344{ 1345{
1345 struct group_info *group_info; 1346 struct group_info *group_info;
1346 int retval; 1347 int retval;
@@ -1394,7 +1395,7 @@ EXPORT_SYMBOL(in_egroup_p);
1394 1395
1395DECLARE_RWSEM(uts_sem); 1396DECLARE_RWSEM(uts_sem);
1396 1397
1397asmlinkage long sys_newuname(struct new_utsname __user * name) 1398SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
1398{ 1399{
1399 int errno = 0; 1400 int errno = 0;
1400 1401
@@ -1405,7 +1406,7 @@ asmlinkage long sys_newuname(struct new_utsname __user * name)
1405 return errno; 1406 return errno;
1406} 1407}
1407 1408
1408asmlinkage long sys_sethostname(char __user *name, int len) 1409SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
1409{ 1410{
1410 int errno; 1411 int errno;
1411 char tmp[__NEW_UTS_LEN]; 1412 char tmp[__NEW_UTS_LEN];
@@ -1429,7 +1430,7 @@ asmlinkage long sys_sethostname(char __user *name, int len)
1429 1430
1430#ifdef __ARCH_WANT_SYS_GETHOSTNAME 1431#ifdef __ARCH_WANT_SYS_GETHOSTNAME
1431 1432
1432asmlinkage long sys_gethostname(char __user *name, int len) 1433SYSCALL_DEFINE2(gethostname, char __user *, name, int, len)
1433{ 1434{
1434 int i, errno; 1435 int i, errno;
1435 struct new_utsname *u; 1436 struct new_utsname *u;
@@ -1454,7 +1455,7 @@ asmlinkage long sys_gethostname(char __user *name, int len)
1454 * Only setdomainname; getdomainname can be implemented by calling 1455 * Only setdomainname; getdomainname can be implemented by calling
1455 * uname() 1456 * uname()
1456 */ 1457 */
1457asmlinkage long sys_setdomainname(char __user *name, int len) 1458SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len)
1458{ 1459{
1459 int errno; 1460 int errno;
1460 char tmp[__NEW_UTS_LEN]; 1461 char tmp[__NEW_UTS_LEN];
@@ -1477,7 +1478,7 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
1477 return errno; 1478 return errno;
1478} 1479}
1479 1480
1480asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim) 1481SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
1481{ 1482{
1482 if (resource >= RLIM_NLIMITS) 1483 if (resource >= RLIM_NLIMITS)
1483 return -EINVAL; 1484 return -EINVAL;
@@ -1496,7 +1497,8 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
1496 * Back compatibility for getrlimit. Needed for some apps. 1497 * Back compatibility for getrlimit. Needed for some apps.
1497 */ 1498 */
1498 1499
1499asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim) 1500SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
1501 struct rlimit __user *, rlim)
1500{ 1502{
1501 struct rlimit x; 1503 struct rlimit x;
1502 if (resource >= RLIM_NLIMITS) 1504 if (resource >= RLIM_NLIMITS)
@@ -1514,7 +1516,7 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
1514 1516
1515#endif 1517#endif
1516 1518
1517asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim) 1519SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
1518{ 1520{
1519 struct rlimit new_rlim, *old_rlim; 1521 struct rlimit new_rlim, *old_rlim;
1520 int retval; 1522 int retval;
@@ -1687,7 +1689,7 @@ int getrusage(struct task_struct *p, int who, struct rusage __user *ru)
1687 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; 1689 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
1688} 1690}
1689 1691
1690asmlinkage long sys_getrusage(int who, struct rusage __user *ru) 1692SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
1691{ 1693{
1692 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN && 1694 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
1693 who != RUSAGE_THREAD) 1695 who != RUSAGE_THREAD)
@@ -1695,14 +1697,14 @@ asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
1695 return getrusage(current, who, ru); 1697 return getrusage(current, who, ru);
1696} 1698}
1697 1699
1698asmlinkage long sys_umask(int mask) 1700SYSCALL_DEFINE1(umask, int, mask)
1699{ 1701{
1700 mask = xchg(&current->fs->umask, mask & S_IRWXUGO); 1702 mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
1701 return mask; 1703 return mask;
1702} 1704}
1703 1705
1704asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, 1706SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
1705 unsigned long arg4, unsigned long arg5) 1707 unsigned long, arg4, unsigned long, arg5)
1706{ 1708{
1707 struct task_struct *me = current; 1709 struct task_struct *me = current;
1708 unsigned char comm[sizeof(me->comm)]; 1710 unsigned char comm[sizeof(me->comm)];
@@ -1815,8 +1817,8 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
1815 return error; 1817 return error;
1816} 1818}
1817 1819
1818asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, 1820SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep,
1819 struct getcpu_cache __user *unused) 1821 struct getcpu_cache __user *, unused)
1820{ 1822{
1821 int err = 0; 1823 int err = 0;
1822 int cpu = raw_smp_processor_id(); 1824 int cpu = raw_smp_processor_id();
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index e14a23281707..27dad2967387 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -131,6 +131,7 @@ cond_syscall(sys_io_destroy);
131cond_syscall(sys_io_submit); 131cond_syscall(sys_io_submit);
132cond_syscall(sys_io_cancel); 132cond_syscall(sys_io_cancel);
133cond_syscall(sys_io_getevents); 133cond_syscall(sys_io_getevents);
134cond_syscall(sys_syslog);
134 135
135/* arch-specific weak syscall entries */ 136/* arch-specific weak syscall entries */
136cond_syscall(sys_pciconfig_read); 137cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 89d74436318c..368d1638ee78 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -144,6 +144,7 @@ extern int acct_parm[];
144 144
145#ifdef CONFIG_IA64 145#ifdef CONFIG_IA64
146extern int no_unaligned_warning; 146extern int no_unaligned_warning;
147extern int unaligned_dump_stack;
147#endif 148#endif
148 149
149#ifdef CONFIG_RT_MUTEXES 150#ifdef CONFIG_RT_MUTEXES
@@ -781,6 +782,14 @@ static struct ctl_table kern_table[] = {
781 .mode = 0644, 782 .mode = 0644,
782 .proc_handler = &proc_dointvec, 783 .proc_handler = &proc_dointvec,
783 }, 784 },
785 {
786 .ctl_name = CTL_UNNUMBERED,
787 .procname = "unaligned-dump-stack",
788 .data = &unaligned_dump_stack,
789 .maxlen = sizeof (int),
790 .mode = 0644,
791 .proc_handler = &proc_dointvec,
792 },
784#endif 793#endif
785#ifdef CONFIG_DETECT_SOFTLOCKUP 794#ifdef CONFIG_DETECT_SOFTLOCKUP
786 { 795 {
@@ -1688,7 +1697,7 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol
1688 return error; 1697 return error;
1689} 1698}
1690 1699
1691asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 1700SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1692{ 1701{
1693 struct __sysctl_args tmp; 1702 struct __sysctl_args tmp;
1694 int error; 1703 int error;
@@ -2989,7 +2998,7 @@ int sysctl_ms_jiffies(struct ctl_table *table,
2989#else /* CONFIG_SYSCTL_SYSCALL */ 2998#else /* CONFIG_SYSCTL_SYSCALL */
2990 2999
2991 3000
2992asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 3001SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
2993{ 3002{
2994 struct __sysctl_args tmp; 3003 struct __sysctl_args tmp;
2995 int error; 3004 int error;
diff --git a/kernel/time.c b/kernel/time.c
index 4886e3ce83a4..29511943871a 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(sys_tz);
60 * why not move it into the appropriate arch directory (for those 60 * why not move it into the appropriate arch directory (for those
61 * architectures that need it). 61 * architectures that need it).
62 */ 62 */
63asmlinkage long sys_time(time_t __user * tloc) 63SYSCALL_DEFINE1(time, time_t __user *, tloc)
64{ 64{
65 time_t i = get_seconds(); 65 time_t i = get_seconds();
66 66
@@ -79,7 +79,7 @@ asmlinkage long sys_time(time_t __user * tloc)
79 * architectures that need it). 79 * architectures that need it).
80 */ 80 */
81 81
82asmlinkage long sys_stime(time_t __user *tptr) 82SYSCALL_DEFINE1(stime, time_t __user *, tptr)
83{ 83{
84 struct timespec tv; 84 struct timespec tv;
85 int err; 85 int err;
@@ -99,8 +99,8 @@ asmlinkage long sys_stime(time_t __user *tptr)
99 99
100#endif /* __ARCH_WANT_SYS_TIME */ 100#endif /* __ARCH_WANT_SYS_TIME */
101 101
102asmlinkage long sys_gettimeofday(struct timeval __user *tv, 102SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
103 struct timezone __user *tz) 103 struct timezone __user *, tz)
104{ 104{
105 if (likely(tv != NULL)) { 105 if (likely(tv != NULL)) {
106 struct timeval ktv; 106 struct timeval ktv;
@@ -184,8 +184,8 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
184 return 0; 184 return 0;
185} 185}
186 186
187asmlinkage long sys_settimeofday(struct timeval __user *tv, 187SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
188 struct timezone __user *tz) 188 struct timezone __user *, tz)
189{ 189{
190 struct timeval user_tv; 190 struct timeval user_tv;
191 struct timespec new_ts; 191 struct timespec new_ts;
@@ -205,7 +205,7 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv,
205 return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); 205 return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
206} 206}
207 207
208asmlinkage long sys_adjtimex(struct timex __user *txc_p) 208SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
209{ 209{
210 struct timex txc; /* Local copy of parameter */ 210 struct timex txc; /* Local copy of parameter */
211 int ret; 211 int ret;
diff --git a/kernel/timer.c b/kernel/timer.c
index dee3f641a7a7..13dd64fe143d 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1129,7 +1129,7 @@ void do_timer(unsigned long ticks)
1129 * For backwards compatibility? This can be done in libc so Alpha 1129 * For backwards compatibility? This can be done in libc so Alpha
1130 * and all newer ports shouldn't need it. 1130 * and all newer ports shouldn't need it.
1131 */ 1131 */
1132asmlinkage unsigned long sys_alarm(unsigned int seconds) 1132SYSCALL_DEFINE1(alarm, unsigned int, seconds)
1133{ 1133{
1134 return alarm_setitimer(seconds); 1134 return alarm_setitimer(seconds);
1135} 1135}
@@ -1152,7 +1152,7 @@ asmlinkage unsigned long sys_alarm(unsigned int seconds)
1152 * 1152 *
1153 * This is SMP safe as current->tgid does not change. 1153 * This is SMP safe as current->tgid does not change.
1154 */ 1154 */
1155asmlinkage long sys_getpid(void) 1155SYSCALL_DEFINE0(getpid)
1156{ 1156{
1157 return task_tgid_vnr(current); 1157 return task_tgid_vnr(current);
1158} 1158}
@@ -1163,7 +1163,7 @@ asmlinkage long sys_getpid(void)
1163 * value of ->real_parent under rcu_read_lock(), see 1163 * value of ->real_parent under rcu_read_lock(), see
1164 * release_task()->call_rcu(delayed_put_task_struct). 1164 * release_task()->call_rcu(delayed_put_task_struct).
1165 */ 1165 */
1166asmlinkage long sys_getppid(void) 1166SYSCALL_DEFINE0(getppid)
1167{ 1167{
1168 int pid; 1168 int pid;
1169 1169
@@ -1174,25 +1174,25 @@ asmlinkage long sys_getppid(void)
1174 return pid; 1174 return pid;
1175} 1175}
1176 1176
1177asmlinkage long sys_getuid(void) 1177SYSCALL_DEFINE0(getuid)
1178{ 1178{
1179 /* Only we change this so SMP safe */ 1179 /* Only we change this so SMP safe */
1180 return current_uid(); 1180 return current_uid();
1181} 1181}
1182 1182
1183asmlinkage long sys_geteuid(void) 1183SYSCALL_DEFINE0(geteuid)
1184{ 1184{
1185 /* Only we change this so SMP safe */ 1185 /* Only we change this so SMP safe */
1186 return current_euid(); 1186 return current_euid();
1187} 1187}
1188 1188
1189asmlinkage long sys_getgid(void) 1189SYSCALL_DEFINE0(getgid)
1190{ 1190{
1191 /* Only we change this so SMP safe */ 1191 /* Only we change this so SMP safe */
1192 return current_gid(); 1192 return current_gid();
1193} 1193}
1194 1194
1195asmlinkage long sys_getegid(void) 1195SYSCALL_DEFINE0(getegid)
1196{ 1196{
1197 /* Only we change this so SMP safe */ 1197 /* Only we change this so SMP safe */
1198 return current_egid(); 1198 return current_egid();
@@ -1308,7 +1308,7 @@ signed long __sched schedule_timeout_uninterruptible(signed long timeout)
1308EXPORT_SYMBOL(schedule_timeout_uninterruptible); 1308EXPORT_SYMBOL(schedule_timeout_uninterruptible);
1309 1309
1310/* Thread ID - the internal kernel "pid" */ 1310/* Thread ID - the internal kernel "pid" */
1311asmlinkage long sys_gettid(void) 1311SYSCALL_DEFINE0(gettid)
1312{ 1312{
1313 return task_pid_vnr(current); 1313 return task_pid_vnr(current);
1314} 1314}
@@ -1400,7 +1400,7 @@ out:
1400 return 0; 1400 return 0;
1401} 1401}
1402 1402
1403asmlinkage long sys_sysinfo(struct sysinfo __user *info) 1403SYSCALL_DEFINE1(sysinfo, struct sysinfo __user *, info)
1404{ 1404{
1405 struct sysinfo val; 1405 struct sysinfo val;
1406 1406
diff --git a/kernel/uid16.c b/kernel/uid16.c
index 2460c3199b5a..0314501688b9 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -17,7 +17,7 @@
17 17
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19 19
20asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) 20SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
21{ 21{
22 long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); 22 long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
23 /* avoid REGPARM breakage on x86: */ 23 /* avoid REGPARM breakage on x86: */
@@ -25,7 +25,7 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gi
25 return ret; 25 return ret;
26} 26}
27 27
28asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group) 28SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
29{ 29{
30 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); 30 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
31 /* avoid REGPARM breakage on x86: */ 31 /* avoid REGPARM breakage on x86: */
@@ -33,7 +33,7 @@ asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_g
33 return ret; 33 return ret;
34} 34}
35 35
36asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) 36SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group)
37{ 37{
38 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); 38 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
39 /* avoid REGPARM breakage on x86: */ 39 /* avoid REGPARM breakage on x86: */
@@ -41,7 +41,7 @@ asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
41 return ret; 41 return ret;
42} 42}
43 43
44asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) 44SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid)
45{ 45{
46 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); 46 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
47 /* avoid REGPARM breakage on x86: */ 47 /* avoid REGPARM breakage on x86: */
@@ -49,7 +49,7 @@ asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
49 return ret; 49 return ret;
50} 50}
51 51
52asmlinkage long sys_setgid16(old_gid_t gid) 52SYSCALL_DEFINE1(setgid16, old_gid_t, gid)
53{ 53{
54 long ret = sys_setgid(low2highgid(gid)); 54 long ret = sys_setgid(low2highgid(gid));
55 /* avoid REGPARM breakage on x86: */ 55 /* avoid REGPARM breakage on x86: */
@@ -57,7 +57,7 @@ asmlinkage long sys_setgid16(old_gid_t gid)
57 return ret; 57 return ret;
58} 58}
59 59
60asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) 60SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid)
61{ 61{
62 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); 62 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
63 /* avoid REGPARM breakage on x86: */ 63 /* avoid REGPARM breakage on x86: */
@@ -65,7 +65,7 @@ asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
65 return ret; 65 return ret;
66} 66}
67 67
68asmlinkage long sys_setuid16(old_uid_t uid) 68SYSCALL_DEFINE1(setuid16, old_uid_t, uid)
69{ 69{
70 long ret = sys_setuid(low2highuid(uid)); 70 long ret = sys_setuid(low2highuid(uid));
71 /* avoid REGPARM breakage on x86: */ 71 /* avoid REGPARM breakage on x86: */
@@ -73,7 +73,7 @@ asmlinkage long sys_setuid16(old_uid_t uid)
73 return ret; 73 return ret;
74} 74}
75 75
76asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) 76SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid)
77{ 77{
78 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), 78 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
79 low2highuid(suid)); 79 low2highuid(suid));
@@ -82,7 +82,7 @@ asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
82 return ret; 82 return ret;
83} 83}
84 84
85asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid) 85SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruid, old_uid_t __user *, euid, old_uid_t __user *, suid)
86{ 86{
87 const struct cred *cred = current_cred(); 87 const struct cred *cred = current_cred();
88 int retval; 88 int retval;
@@ -94,7 +94,7 @@ asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid,
94 return retval; 94 return retval;
95} 95}
96 96
97asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) 97SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid)
98{ 98{
99 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), 99 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
100 low2highgid(sgid)); 100 low2highgid(sgid));
@@ -103,7 +103,8 @@ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
103 return ret; 103 return ret;
104} 104}
105 105
106asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid) 106
107SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgid, old_gid_t __user *, egid, old_gid_t __user *, sgid)
107{ 108{
108 const struct cred *cred = current_cred(); 109 const struct cred *cred = current_cred();
109 int retval; 110 int retval;
@@ -115,7 +116,7 @@ asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid,
115 return retval; 116 return retval;
116} 117}
117 118
118asmlinkage long sys_setfsuid16(old_uid_t uid) 119SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid)
119{ 120{
120 long ret = sys_setfsuid(low2highuid(uid)); 121 long ret = sys_setfsuid(low2highuid(uid));
121 /* avoid REGPARM breakage on x86: */ 122 /* avoid REGPARM breakage on x86: */
@@ -123,7 +124,7 @@ asmlinkage long sys_setfsuid16(old_uid_t uid)
123 return ret; 124 return ret;
124} 125}
125 126
126asmlinkage long sys_setfsgid16(old_gid_t gid) 127SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid)
127{ 128{
128 long ret = sys_setfsgid(low2highgid(gid)); 129 long ret = sys_setfsgid(low2highgid(gid));
129 /* avoid REGPARM breakage on x86: */ 130 /* avoid REGPARM breakage on x86: */
@@ -161,7 +162,7 @@ static int groups16_from_user(struct group_info *group_info,
161 return 0; 162 return 0;
162} 163}
163 164
164asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist) 165SYSCALL_DEFINE2(getgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
165{ 166{
166 const struct cred *cred = current_cred(); 167 const struct cred *cred = current_cred();
167 int i; 168 int i;
@@ -184,7 +185,7 @@ out:
184 return i; 185 return i;
185} 186}
186 187
187asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist) 188SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
188{ 189{
189 struct group_info *group_info; 190 struct group_info *group_info;
190 int retval; 191 int retval;
@@ -209,22 +210,22 @@ asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist)
209 return retval; 210 return retval;
210} 211}
211 212
212asmlinkage long sys_getuid16(void) 213SYSCALL_DEFINE0(getuid16)
213{ 214{
214 return high2lowuid(current_uid()); 215 return high2lowuid(current_uid());
215} 216}
216 217
217asmlinkage long sys_geteuid16(void) 218SYSCALL_DEFINE0(geteuid16)
218{ 219{
219 return high2lowuid(current_euid()); 220 return high2lowuid(current_euid());
220} 221}
221 222
222asmlinkage long sys_getgid16(void) 223SYSCALL_DEFINE0(getgid16)
223{ 224{
224 return high2lowgid(current_gid()); 225 return high2lowgid(current_gid());
225} 226}
226 227
227asmlinkage long sys_getegid16(void) 228SYSCALL_DEFINE0(getegid16)
228{ 229{
229 return high2lowgid(current_egid()); 230 return high2lowgid(current_egid());
230} 231}
diff --git a/kernel/up.c b/kernel/up.c
index c04b9dcfcebe..1ff27a28bb7d 100644
--- a/kernel/up.c
+++ b/kernel/up.c
@@ -2,6 +2,7 @@
2 * Uniprocessor-only support functions. The counterpart to kernel/smp.c 2 * Uniprocessor-only support functions. The counterpart to kernel/smp.c
3 */ 3 */
4 4
5#include <linux/interrupt.h>
5#include <linux/kernel.h> 6#include <linux/kernel.h>
6#include <linux/module.h> 7#include <linux/module.h>
7#include <linux/smp.h> 8#include <linux/smp.h>
diff --git a/lib/idr.c b/lib/idr.c
index 1c4f9281f412..c11c5765cdef 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -121,7 +121,7 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
121{ 121{
122 while (idp->id_free_cnt < IDR_FREE_MAX) { 122 while (idp->id_free_cnt < IDR_FREE_MAX) {
123 struct idr_layer *new; 123 struct idr_layer *new;
124 new = kmem_cache_alloc(idr_layer_cache, gfp_mask); 124 new = kmem_cache_zalloc(idr_layer_cache, gfp_mask);
125 if (new == NULL) 125 if (new == NULL)
126 return (0); 126 return (0);
127 move_to_free_list(idp, new); 127 move_to_free_list(idp, new);
@@ -292,7 +292,7 @@ static int idr_get_new_above_int(struct idr *idp, void *ptr, int starting_id)
292 * and go back to the idr_pre_get() call. If the idr is full, it will 292 * and go back to the idr_pre_get() call. If the idr is full, it will
293 * return -ENOSPC. 293 * return -ENOSPC.
294 * 294 *
295 * @id returns a value in the range 0 ... 0x7fffffff 295 * @id returns a value in the range @starting_id ... 0x7fffffff
296 */ 296 */
297int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) 297int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
298{ 298{
@@ -623,16 +623,10 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
623} 623}
624EXPORT_SYMBOL(idr_replace); 624EXPORT_SYMBOL(idr_replace);
625 625
626static void idr_cache_ctor(void *idr_layer)
627{
628 memset(idr_layer, 0, sizeof(struct idr_layer));
629}
630
631void __init idr_init_cache(void) 626void __init idr_init_cache(void)
632{ 627{
633 idr_layer_cache = kmem_cache_create("idr_layer_cache", 628 idr_layer_cache = kmem_cache_create("idr_layer_cache",
634 sizeof(struct idr_layer), 0, SLAB_PANIC, 629 sizeof(struct idr_layer), 0, SLAB_PANIC, NULL);
635 idr_cache_ctor);
636} 630}
637 631
638/** 632/**
@@ -723,7 +717,7 @@ EXPORT_SYMBOL(ida_pre_get);
723 * and go back to the ida_pre_get() call. If the ida is full, it will 717 * and go back to the ida_pre_get() call. If the ida is full, it will
724 * return -ENOSPC. 718 * return -ENOSPC.
725 * 719 *
726 * @p_id returns a value in the range 0 ... 0x7fffffff. 720 * @p_id returns a value in the range @starting_id ... 0x7fffffff.
727 */ 721 */
728int ida_get_new_above(struct ida *ida, int starting_id, int *p_id) 722int ida_get_new_above(struct ida *ida, int starting_id, int *p_id)
729{ 723{
diff --git a/mm/fadvise.c b/mm/fadvise.c
index a1da969bd980..54a0f8040afa 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -24,7 +24,7 @@
24 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could 24 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
25 * deactivate the pages and clear PG_Referenced. 25 * deactivate the pages and clear PG_Referenced.
26 */ 26 */
27asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) 27SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
28{ 28{
29 struct file *file = fget(fd); 29 struct file *file = fget(fd);
30 struct address_space *mapping; 30 struct address_space *mapping;
@@ -126,12 +126,26 @@ out:
126 fput(file); 126 fput(file);
127 return ret; 127 return ret;
128} 128}
129#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
130asmlinkage long SyS_fadvise64_64(long fd, loff_t offset, loff_t len, long advice)
131{
132 return SYSC_fadvise64_64((int) fd, offset, len, (int) advice);
133}
134SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64);
135#endif
129 136
130#ifdef __ARCH_WANT_SYS_FADVISE64 137#ifdef __ARCH_WANT_SYS_FADVISE64
131 138
132asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice) 139SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice)
133{ 140{
134 return sys_fadvise64_64(fd, offset, len, advice); 141 return sys_fadvise64_64(fd, offset, len, advice);
135} 142}
143#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
144asmlinkage long SyS_fadvise64(long fd, loff_t offset, long len, long advice)
145{
146 return SYSC_fadvise64((int) fd, offset, (size_t)len, (int)advice);
147}
148SYSCALL_ALIAS(sys_fadvise64, SyS_fadvise64);
149#endif
136 150
137#endif 151#endif
diff --git a/mm/filemap.c b/mm/filemap.c
index ceba0bd03662..23acefe51808 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1374,7 +1374,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
1374 return 0; 1374 return 0;
1375} 1375}
1376 1376
1377asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) 1377SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count)
1378{ 1378{
1379 ssize_t ret; 1379 ssize_t ret;
1380 struct file *file; 1380 struct file *file;
@@ -1393,6 +1393,13 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
1393 } 1393 }
1394 return ret; 1394 return ret;
1395} 1395}
1396#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
1397asmlinkage long SyS_readahead(long fd, loff_t offset, long count)
1398{
1399 return SYSC_readahead((int) fd, offset, (size_t) count);
1400}
1401SYSCALL_ALIAS(sys_readahead, SyS_readahead);
1402#endif
1396 1403
1397#ifdef CONFIG_MMU 1404#ifdef CONFIG_MMU
1398/** 1405/**
diff --git a/mm/fremap.c b/mm/fremap.c
index 62d5bbda921a..736ba7f3306a 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -120,8 +120,8 @@ static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma,
120 * and the vma's default protection is used. Arbitrary protections 120 * and the vma's default protection is used. Arbitrary protections
121 * might be implemented in the future. 121 * might be implemented in the future.
122 */ 122 */
123asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, 123SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
124 unsigned long prot, unsigned long pgoff, unsigned long flags) 124 unsigned long, prot, unsigned long, pgoff, unsigned long, flags)
125{ 125{
126 struct mm_struct *mm = current->mm; 126 struct mm_struct *mm = current->mm;
127 struct address_space *mapping; 127 struct address_space *mapping;
diff --git a/mm/madvise.c b/mm/madvise.c
index f9349c18a1b5..b9ce574827c8 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -281,7 +281,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev,
281 * -EBADF - map exists, but area maps something that isn't a file. 281 * -EBADF - map exists, but area maps something that isn't a file.
282 * -EAGAIN - a kernel resource was temporarily unavailable. 282 * -EAGAIN - a kernel resource was temporarily unavailable.
283 */ 283 */
284asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior) 284SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
285{ 285{
286 unsigned long end, tmp; 286 unsigned long end, tmp;
287 struct vm_area_struct * vma, *prev; 287 struct vm_area_struct * vma, *prev;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e2996b80601f..4d0ea3ceba6d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -358,6 +358,10 @@ void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru)
358 return; 358 return;
359 359
360 pc = lookup_page_cgroup(page); 360 pc = lookup_page_cgroup(page);
361 /*
362 * Used bit is set without atomic ops but after smp_wmb().
363 * For making pc->mem_cgroup visible, insert smp_rmb() here.
364 */
361 smp_rmb(); 365 smp_rmb();
362 /* unused page is not rotated. */ 366 /* unused page is not rotated. */
363 if (!PageCgroupUsed(pc)) 367 if (!PageCgroupUsed(pc))
@@ -374,7 +378,10 @@ void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru)
374 if (mem_cgroup_disabled()) 378 if (mem_cgroup_disabled())
375 return; 379 return;
376 pc = lookup_page_cgroup(page); 380 pc = lookup_page_cgroup(page);
377 /* barrier to sync with "charge" */ 381 /*
382 * Used bit is set without atomic ops but after smp_wmb().
383 * For making pc->mem_cgroup visible, insert smp_rmb() here.
384 */
378 smp_rmb(); 385 smp_rmb();
379 if (!PageCgroupUsed(pc)) 386 if (!PageCgroupUsed(pc))
380 return; 387 return;
@@ -559,6 +566,14 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
559 return NULL; 566 return NULL;
560 567
561 pc = lookup_page_cgroup(page); 568 pc = lookup_page_cgroup(page);
569 /*
570 * Used bit is set without atomic ops but after smp_wmb().
571 * For making pc->mem_cgroup visible, insert smp_rmb() here.
572 */
573 smp_rmb();
574 if (!PageCgroupUsed(pc))
575 return NULL;
576
562 mz = page_cgroup_zoneinfo(pc); 577 mz = page_cgroup_zoneinfo(pc);
563 if (!mz) 578 if (!mz)
564 return NULL; 579 return NULL;
@@ -618,7 +633,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
618 * called with hierarchy_mutex held 633 * called with hierarchy_mutex held
619 */ 634 */
620static struct mem_cgroup * 635static struct mem_cgroup *
621mem_cgroup_get_next_node(struct mem_cgroup *curr, struct mem_cgroup *root_mem) 636__mem_cgroup_get_next_node(struct mem_cgroup *curr, struct mem_cgroup *root_mem)
622{ 637{
623 struct cgroup *cgroup, *curr_cgroup, *root_cgroup; 638 struct cgroup *cgroup, *curr_cgroup, *root_cgroup;
624 639
@@ -629,19 +644,16 @@ mem_cgroup_get_next_node(struct mem_cgroup *curr, struct mem_cgroup *root_mem)
629 /* 644 /*
630 * Walk down to children 645 * Walk down to children
631 */ 646 */
632 mem_cgroup_put(curr);
633 cgroup = list_entry(curr_cgroup->children.next, 647 cgroup = list_entry(curr_cgroup->children.next,
634 struct cgroup, sibling); 648 struct cgroup, sibling);
635 curr = mem_cgroup_from_cont(cgroup); 649 curr = mem_cgroup_from_cont(cgroup);
636 mem_cgroup_get(curr);
637 goto done; 650 goto done;
638 } 651 }
639 652
640visit_parent: 653visit_parent:
641 if (curr_cgroup == root_cgroup) { 654 if (curr_cgroup == root_cgroup) {
642 mem_cgroup_put(curr); 655 /* caller handles NULL case */
643 curr = root_mem; 656 curr = NULL;
644 mem_cgroup_get(curr);
645 goto done; 657 goto done;
646 } 658 }
647 659
@@ -649,11 +661,9 @@ visit_parent:
649 * Goto next sibling 661 * Goto next sibling
650 */ 662 */
651 if (curr_cgroup->sibling.next != &curr_cgroup->parent->children) { 663 if (curr_cgroup->sibling.next != &curr_cgroup->parent->children) {
652 mem_cgroup_put(curr);
653 cgroup = list_entry(curr_cgroup->sibling.next, struct cgroup, 664 cgroup = list_entry(curr_cgroup->sibling.next, struct cgroup,
654 sibling); 665 sibling);
655 curr = mem_cgroup_from_cont(cgroup); 666 curr = mem_cgroup_from_cont(cgroup);
656 mem_cgroup_get(curr);
657 goto done; 667 goto done;
658 } 668 }
659 669
@@ -664,7 +674,6 @@ visit_parent:
664 goto visit_parent; 674 goto visit_parent;
665 675
666done: 676done:
667 root_mem->last_scanned_child = curr;
668 return curr; 677 return curr;
669} 678}
670 679
@@ -674,40 +683,46 @@ done:
674 * that to reclaim free pages from. 683 * that to reclaim free pages from.
675 */ 684 */
676static struct mem_cgroup * 685static struct mem_cgroup *
677mem_cgroup_get_first_node(struct mem_cgroup *root_mem) 686mem_cgroup_get_next_node(struct mem_cgroup *root_mem)
678{ 687{
679 struct cgroup *cgroup; 688 struct cgroup *cgroup;
680 struct mem_cgroup *ret; 689 struct mem_cgroup *orig, *next;
681 bool obsolete; 690 bool obsolete;
682 691
683 obsolete = mem_cgroup_is_obsolete(root_mem->last_scanned_child);
684
685 /* 692 /*
686 * Scan all children under the mem_cgroup mem 693 * Scan all children under the mem_cgroup mem
687 */ 694 */
688 mutex_lock(&mem_cgroup_subsys.hierarchy_mutex); 695 mutex_lock(&mem_cgroup_subsys.hierarchy_mutex);
696
697 orig = root_mem->last_scanned_child;
698 obsolete = mem_cgroup_is_obsolete(orig);
699
689 if (list_empty(&root_mem->css.cgroup->children)) { 700 if (list_empty(&root_mem->css.cgroup->children)) {
690 ret = root_mem; 701 /*
702 * root_mem might have children before and last_scanned_child
703 * may point to one of them. We put it later.
704 */
705 if (orig)
706 VM_BUG_ON(!obsolete);
707 next = NULL;
691 goto done; 708 goto done;
692 } 709 }
693 710
694 if (!root_mem->last_scanned_child || obsolete) { 711 if (!orig || obsolete) {
695
696 if (obsolete && root_mem->last_scanned_child)
697 mem_cgroup_put(root_mem->last_scanned_child);
698
699 cgroup = list_first_entry(&root_mem->css.cgroup->children, 712 cgroup = list_first_entry(&root_mem->css.cgroup->children,
700 struct cgroup, sibling); 713 struct cgroup, sibling);
701 ret = mem_cgroup_from_cont(cgroup); 714 next = mem_cgroup_from_cont(cgroup);
702 mem_cgroup_get(ret);
703 } else 715 } else
704 ret = mem_cgroup_get_next_node(root_mem->last_scanned_child, 716 next = __mem_cgroup_get_next_node(orig, root_mem);
705 root_mem);
706 717
707done: 718done:
708 root_mem->last_scanned_child = ret; 719 if (next)
720 mem_cgroup_get(next);
721 root_mem->last_scanned_child = next;
722 if (orig)
723 mem_cgroup_put(orig);
709 mutex_unlock(&mem_cgroup_subsys.hierarchy_mutex); 724 mutex_unlock(&mem_cgroup_subsys.hierarchy_mutex);
710 return ret; 725 return (next) ? next : root_mem;
711} 726}
712 727
713static bool mem_cgroup_check_under_limit(struct mem_cgroup *mem) 728static bool mem_cgroup_check_under_limit(struct mem_cgroup *mem)
@@ -758,28 +773,25 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
758 * but there might be left over accounting, even after children 773 * but there might be left over accounting, even after children
759 * have left. 774 * have left.
760 */ 775 */
761 ret = try_to_free_mem_cgroup_pages(root_mem, gfp_mask, noswap, 776 ret += try_to_free_mem_cgroup_pages(root_mem, gfp_mask, noswap,
762 get_swappiness(root_mem)); 777 get_swappiness(root_mem));
763 if (mem_cgroup_check_under_limit(root_mem)) 778 if (mem_cgroup_check_under_limit(root_mem))
764 return 0; 779 return 1; /* indicate reclaim has succeeded */
765 if (!root_mem->use_hierarchy) 780 if (!root_mem->use_hierarchy)
766 return ret; 781 return ret;
767 782
768 next_mem = mem_cgroup_get_first_node(root_mem); 783 next_mem = mem_cgroup_get_next_node(root_mem);
769 784
770 while (next_mem != root_mem) { 785 while (next_mem != root_mem) {
771 if (mem_cgroup_is_obsolete(next_mem)) { 786 if (mem_cgroup_is_obsolete(next_mem)) {
772 mem_cgroup_put(next_mem); 787 next_mem = mem_cgroup_get_next_node(root_mem);
773 next_mem = mem_cgroup_get_first_node(root_mem);
774 continue; 788 continue;
775 } 789 }
776 ret = try_to_free_mem_cgroup_pages(next_mem, gfp_mask, noswap, 790 ret += try_to_free_mem_cgroup_pages(next_mem, gfp_mask, noswap,
777 get_swappiness(next_mem)); 791 get_swappiness(next_mem));
778 if (mem_cgroup_check_under_limit(root_mem)) 792 if (mem_cgroup_check_under_limit(root_mem))
779 return 0; 793 return 1; /* indicate reclaim has succeeded */
780 mutex_lock(&mem_cgroup_subsys.hierarchy_mutex); 794 next_mem = mem_cgroup_get_next_node(root_mem);
781 next_mem = mem_cgroup_get_next_node(next_mem, root_mem);
782 mutex_unlock(&mem_cgroup_subsys.hierarchy_mutex);
783 } 795 }
784 return ret; 796 return ret;
785} 797}
@@ -863,6 +875,8 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
863 875
864 ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, gfp_mask, 876 ret = mem_cgroup_hierarchical_reclaim(mem_over_limit, gfp_mask,
865 noswap); 877 noswap);
878 if (ret)
879 continue;
866 880
867 /* 881 /*
868 * try_to_free_mem_cgroup_pages() might not give us a full 882 * try_to_free_mem_cgroup_pages() might not give us a full
@@ -979,14 +993,15 @@ static int mem_cgroup_move_account(struct page_cgroup *pc,
979 if (pc->mem_cgroup != from) 993 if (pc->mem_cgroup != from)
980 goto out; 994 goto out;
981 995
982 css_put(&from->css);
983 res_counter_uncharge(&from->res, PAGE_SIZE); 996 res_counter_uncharge(&from->res, PAGE_SIZE);
984 mem_cgroup_charge_statistics(from, pc, false); 997 mem_cgroup_charge_statistics(from, pc, false);
985 if (do_swap_account) 998 if (do_swap_account)
986 res_counter_uncharge(&from->memsw, PAGE_SIZE); 999 res_counter_uncharge(&from->memsw, PAGE_SIZE);
1000 css_put(&from->css);
1001
1002 css_get(&to->css);
987 pc->mem_cgroup = to; 1003 pc->mem_cgroup = to;
988 mem_cgroup_charge_statistics(to, pc, true); 1004 mem_cgroup_charge_statistics(to, pc, true);
989 css_get(&to->css);
990 ret = 0; 1005 ret = 0;
991out: 1006out:
992 unlock_page_cgroup(pc); 1007 unlock_page_cgroup(pc);
@@ -1019,8 +1034,10 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
1019 if (ret || !parent) 1034 if (ret || !parent)
1020 return ret; 1035 return ret;
1021 1036
1022 if (!get_page_unless_zero(page)) 1037 if (!get_page_unless_zero(page)) {
1023 return -EBUSY; 1038 ret = -EBUSY;
1039 goto uncharge;
1040 }
1024 1041
1025 ret = isolate_lru_page(page); 1042 ret = isolate_lru_page(page);
1026 1043
@@ -1029,19 +1046,23 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
1029 1046
1030 ret = mem_cgroup_move_account(pc, child, parent); 1047 ret = mem_cgroup_move_account(pc, child, parent);
1031 1048
1032 /* drop extra refcnt by try_charge() (move_account increment one) */
1033 css_put(&parent->css);
1034 putback_lru_page(page); 1049 putback_lru_page(page);
1035 if (!ret) { 1050 if (!ret) {
1036 put_page(page); 1051 put_page(page);
1052 /* drop extra refcnt by try_charge() */
1053 css_put(&parent->css);
1037 return 0; 1054 return 0;
1038 } 1055 }
1039 /* uncharge if move fails */ 1056
1040cancel: 1057cancel:
1058 put_page(page);
1059uncharge:
1060 /* drop extra refcnt by try_charge() */
1061 css_put(&parent->css);
1062 /* uncharge if move fails */
1041 res_counter_uncharge(&parent->res, PAGE_SIZE); 1063 res_counter_uncharge(&parent->res, PAGE_SIZE);
1042 if (do_swap_account) 1064 if (do_swap_account)
1043 res_counter_uncharge(&parent->memsw, PAGE_SIZE); 1065 res_counter_uncharge(&parent->memsw, PAGE_SIZE);
1044 put_page(page);
1045 return ret; 1066 return ret;
1046} 1067}
1047 1068
@@ -1971,6 +1992,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
1971{ 1992{
1972 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); 1993 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
1973 struct mem_cgroup *parent; 1994 struct mem_cgroup *parent;
1995
1974 if (val > 100) 1996 if (val > 100)
1975 return -EINVAL; 1997 return -EINVAL;
1976 1998
@@ -1978,15 +2000,22 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
1978 return -EINVAL; 2000 return -EINVAL;
1979 2001
1980 parent = mem_cgroup_from_cont(cgrp->parent); 2002 parent = mem_cgroup_from_cont(cgrp->parent);
2003
2004 cgroup_lock();
2005
1981 /* If under hierarchy, only empty-root can set this value */ 2006 /* If under hierarchy, only empty-root can set this value */
1982 if ((parent->use_hierarchy) || 2007 if ((parent->use_hierarchy) ||
1983 (memcg->use_hierarchy && !list_empty(&cgrp->children))) 2008 (memcg->use_hierarchy && !list_empty(&cgrp->children))) {
2009 cgroup_unlock();
1984 return -EINVAL; 2010 return -EINVAL;
2011 }
1985 2012
1986 spin_lock(&memcg->reclaim_param_lock); 2013 spin_lock(&memcg->reclaim_param_lock);
1987 memcg->swappiness = val; 2014 memcg->swappiness = val;
1988 spin_unlock(&memcg->reclaim_param_lock); 2015 spin_unlock(&memcg->reclaim_param_lock);
1989 2016
2017 cgroup_unlock();
2018
1990 return 0; 2019 return 0;
1991} 2020}
1992 2021
@@ -2181,7 +2210,7 @@ static void __init enable_swap_cgroup(void)
2181} 2210}
2182#endif 2211#endif
2183 2212
2184static struct cgroup_subsys_state * 2213static struct cgroup_subsys_state * __ref
2185mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) 2214mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
2186{ 2215{
2187 struct mem_cgroup *mem, *parent; 2216 struct mem_cgroup *mem, *parent;
@@ -2232,7 +2261,14 @@ static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss,
2232static void mem_cgroup_destroy(struct cgroup_subsys *ss, 2261static void mem_cgroup_destroy(struct cgroup_subsys *ss,
2233 struct cgroup *cont) 2262 struct cgroup *cont)
2234{ 2263{
2235 mem_cgroup_put(mem_cgroup_from_cont(cont)); 2264 struct mem_cgroup *mem = mem_cgroup_from_cont(cont);
2265 struct mem_cgroup *last_scanned_child = mem->last_scanned_child;
2266
2267 if (last_scanned_child) {
2268 VM_BUG_ON(!mem_cgroup_is_obsolete(last_scanned_child));
2269 mem_cgroup_put(last_scanned_child);
2270 }
2271 mem_cgroup_put(mem);
2236} 2272}
2237 2273
2238static int mem_cgroup_populate(struct cgroup_subsys *ss, 2274static int mem_cgroup_populate(struct cgroup_subsys *ss,
diff --git a/mm/memory.c b/mm/memory.c
index e009ce870859..22bfa7a47a0b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1511,6 +1511,7 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1511 unsigned long pfn) 1511 unsigned long pfn)
1512{ 1512{
1513 int ret; 1513 int ret;
1514 pgprot_t pgprot = vma->vm_page_prot;
1514 /* 1515 /*
1515 * Technically, architectures with pte_special can avoid all these 1516 * Technically, architectures with pte_special can avoid all these
1516 * restrictions (same for remap_pfn_range). However we would like 1517 * restrictions (same for remap_pfn_range). However we would like
@@ -1525,10 +1526,10 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1525 1526
1526 if (addr < vma->vm_start || addr >= vma->vm_end) 1527 if (addr < vma->vm_start || addr >= vma->vm_end)
1527 return -EFAULT; 1528 return -EFAULT;
1528 if (track_pfn_vma_new(vma, vma->vm_page_prot, pfn, PAGE_SIZE)) 1529 if (track_pfn_vma_new(vma, &pgprot, pfn, PAGE_SIZE))
1529 return -EINVAL; 1530 return -EINVAL;
1530 1531
1531 ret = insert_pfn(vma, addr, pfn, vma->vm_page_prot); 1532 ret = insert_pfn(vma, addr, pfn, pgprot);
1532 1533
1533 if (ret) 1534 if (ret)
1534 untrack_pfn_vma(vma, pfn, PAGE_SIZE); 1535 untrack_pfn_vma(vma, pfn, PAGE_SIZE);
@@ -1671,9 +1672,15 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
1671 1672
1672 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; 1673 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
1673 1674
1674 err = track_pfn_vma_new(vma, prot, pfn, PAGE_ALIGN(size)); 1675 err = track_pfn_vma_new(vma, &prot, pfn, PAGE_ALIGN(size));
1675 if (err) 1676 if (err) {
1677 /*
1678 * To indicate that track_pfn related cleanup is not
1679 * needed from higher level routine calling unmap_vmas
1680 */
1681 vma->vm_flags &= ~(VM_IO | VM_RESERVED | VM_PFNMAP);
1676 return -EINVAL; 1682 return -EINVAL;
1683 }
1677 1684
1678 BUG_ON(addr >= end); 1685 BUG_ON(addr >= end);
1679 pfn -= addr >> PAGE_SHIFT; 1686 pfn -= addr >> PAGE_SHIFT;
@@ -3165,6 +3172,15 @@ void print_vma_addr(char *prefix, unsigned long ip)
3165#ifdef CONFIG_PROVE_LOCKING 3172#ifdef CONFIG_PROVE_LOCKING
3166void might_fault(void) 3173void might_fault(void)
3167{ 3174{
3175 /*
3176 * Some code (nfs/sunrpc) uses socket ops on kernel memory while
3177 * holding the mmap_sem, this is safe because kernel memory doesn't
3178 * get paged out, therefore we'll never actually fault, and the
3179 * below annotations will generate false positives.
3180 */
3181 if (segment_eq(get_fs(), KERNEL_DS))
3182 return;
3183
3168 might_sleep(); 3184 might_sleep();
3169 /* 3185 /*
3170 * it would be nicer only to annotate paths which are not under 3186 * it would be nicer only to annotate paths which are not under
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index e412ffa8e52e..3eb4a6fdc043 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1068,10 +1068,9 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
1068 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0; 1068 return copy_to_user(mask, nodes_addr(*nodes), copy) ? -EFAULT : 0;
1069} 1069}
1070 1070
1071asmlinkage long sys_mbind(unsigned long start, unsigned long len, 1071SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
1072 unsigned long mode, 1072 unsigned long, mode, unsigned long __user *, nmask,
1073 unsigned long __user *nmask, unsigned long maxnode, 1073 unsigned long, maxnode, unsigned, flags)
1074 unsigned flags)
1075{ 1074{
1076 nodemask_t nodes; 1075 nodemask_t nodes;
1077 int err; 1076 int err;
@@ -1091,8 +1090,8 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
1091} 1090}
1092 1091
1093/* Set the process memory policy */ 1092/* Set the process memory policy */
1094asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 1093SYSCALL_DEFINE3(set_mempolicy, int, mode, unsigned long __user *, nmask,
1095 unsigned long maxnode) 1094 unsigned long, maxnode)
1096{ 1095{
1097 int err; 1096 int err;
1098 nodemask_t nodes; 1097 nodemask_t nodes;
@@ -1110,9 +1109,9 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
1110 return do_set_mempolicy(mode, flags, &nodes); 1109 return do_set_mempolicy(mode, flags, &nodes);
1111} 1110}
1112 1111
1113asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, 1112SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
1114 const unsigned long __user *old_nodes, 1113 const unsigned long __user *, old_nodes,
1115 const unsigned long __user *new_nodes) 1114 const unsigned long __user *, new_nodes)
1116{ 1115{
1117 const struct cred *cred = current_cred(), *tcred; 1116 const struct cred *cred = current_cred(), *tcred;
1118 struct mm_struct *mm; 1117 struct mm_struct *mm;
@@ -1185,10 +1184,9 @@ out:
1185 1184
1186 1185
1187/* Retrieve NUMA policy */ 1186/* Retrieve NUMA policy */
1188asmlinkage long sys_get_mempolicy(int __user *policy, 1187SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1189 unsigned long __user *nmask, 1188 unsigned long __user *, nmask, unsigned long, maxnode,
1190 unsigned long maxnode, 1189 unsigned long, addr, unsigned long, flags)
1191 unsigned long addr, unsigned long flags)
1192{ 1190{
1193 int err; 1191 int err;
1194 int uninitialized_var(pval); 1192 int uninitialized_var(pval);
diff --git a/mm/migrate.c b/mm/migrate.c
index a30ea5fcf9f1..2bb4e1d63520 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1055,10 +1055,10 @@ out:
1055 * Move a list of pages in the address space of the currently executing 1055 * Move a list of pages in the address space of the currently executing
1056 * process. 1056 * process.
1057 */ 1057 */
1058asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, 1058SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
1059 const void __user * __user *pages, 1059 const void __user * __user *, pages,
1060 const int __user *nodes, 1060 const int __user *, nodes,
1061 int __user *status, int flags) 1061 int __user *, status, int, flags)
1062{ 1062{
1063 const struct cred *cred = current_cred(), *tcred; 1063 const struct cred *cred = current_cred(), *tcred;
1064 struct task_struct *task; 1064 struct task_struct *task;
diff --git a/mm/mincore.c b/mm/mincore.c
index 5178800bc129..8cb508f84ea4 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -177,8 +177,8 @@ none_mapped:
177 * mapped 177 * mapped
178 * -EAGAIN - A kernel resource was temporarily unavailable. 178 * -EAGAIN - A kernel resource was temporarily unavailable.
179 */ 179 */
180asmlinkage long sys_mincore(unsigned long start, size_t len, 180SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
181 unsigned char __user * vec) 181 unsigned char __user *, vec)
182{ 182{
183 long retval; 183 long retval;
184 unsigned long pages; 184 unsigned long pages;
diff --git a/mm/mlock.c b/mm/mlock.c
index e125156c664e..2904a347e476 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -530,7 +530,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
530 return error; 530 return error;
531} 531}
532 532
533asmlinkage long sys_mlock(unsigned long start, size_t len) 533SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
534{ 534{
535 unsigned long locked; 535 unsigned long locked;
536 unsigned long lock_limit; 536 unsigned long lock_limit;
@@ -558,7 +558,7 @@ asmlinkage long sys_mlock(unsigned long start, size_t len)
558 return error; 558 return error;
559} 559}
560 560
561asmlinkage long sys_munlock(unsigned long start, size_t len) 561SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
562{ 562{
563 int ret; 563 int ret;
564 564
@@ -595,7 +595,7 @@ out:
595 return 0; 595 return 0;
596} 596}
597 597
598asmlinkage long sys_mlockall(int flags) 598SYSCALL_DEFINE1(mlockall, int, flags)
599{ 599{
600 unsigned long lock_limit; 600 unsigned long lock_limit;
601 int ret = -EINVAL; 601 int ret = -EINVAL;
@@ -623,7 +623,7 @@ out:
623 return ret; 623 return ret;
624} 624}
625 625
626asmlinkage long sys_munlockall(void) 626SYSCALL_DEFINE0(munlockall)
627{ 627{
628 int ret; 628 int ret;
629 629
diff --git a/mm/mmap.c b/mm/mmap.c
index 749623196cb9..8d95902e9a38 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -245,7 +245,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
245 return next; 245 return next;
246} 246}
247 247
248asmlinkage unsigned long sys_brk(unsigned long brk) 248SYSCALL_DEFINE1(brk, unsigned long, brk)
249{ 249{
250 unsigned long rlim, retval; 250 unsigned long rlim, retval;
251 unsigned long newbrk, oldbrk; 251 unsigned long newbrk, oldbrk;
@@ -1948,7 +1948,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
1948 1948
1949EXPORT_SYMBOL(do_munmap); 1949EXPORT_SYMBOL(do_munmap);
1950 1950
1951asmlinkage long sys_munmap(unsigned long addr, size_t len) 1951SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1952{ 1952{
1953 int ret; 1953 int ret;
1954 struct mm_struct *mm = current->mm; 1954 struct mm_struct *mm = current->mm;
diff --git a/mm/mprotect.c b/mm/mprotect.c
index d0f6e7ce09f1..abe2694e13f4 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -217,8 +217,8 @@ fail:
217 return error; 217 return error;
218} 218}
219 219
220asmlinkage long 220SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
221sys_mprotect(unsigned long start, size_t len, unsigned long prot) 221 unsigned long, prot)
222{ 222{
223 unsigned long vm_flags, nstart, end, tmp, reqprot; 223 unsigned long vm_flags, nstart, end, tmp, reqprot;
224 struct vm_area_struct *vma, *prev; 224 struct vm_area_struct *vma, *prev;
diff --git a/mm/mremap.c b/mm/mremap.c
index 646de959aa58..a39b7b91be46 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -420,9 +420,9 @@ out_nc:
420 return ret; 420 return ret;
421} 421}
422 422
423asmlinkage unsigned long sys_mremap(unsigned long addr, 423SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
424 unsigned long old_len, unsigned long new_len, 424 unsigned long, new_len, unsigned long, flags,
425 unsigned long flags, unsigned long new_addr) 425 unsigned long, new_addr)
426{ 426{
427 unsigned long ret; 427 unsigned long ret;
428 428
diff --git a/mm/msync.c b/mm/msync.c
index 07dae08cf31c..4083209b7f02 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -28,7 +28,7 @@
28 * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to 28 * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to
29 * applications. 29 * applications.
30 */ 30 */
31asmlinkage long sys_msync(unsigned long start, size_t len, int flags) 31SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
32{ 32{
33 unsigned long end; 33 unsigned long end;
34 struct mm_struct *mm = current->mm; 34 struct mm_struct *mm = current->mm;
diff --git a/mm/nommu.c b/mm/nommu.c
index 60ed8375c986..8cee8c8ff0f2 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -416,7 +416,7 @@ EXPORT_SYMBOL(vm_insert_page);
416 * to a regular file. in this case, the unmapping will need 416 * to a regular file. in this case, the unmapping will need
417 * to invoke file system routines that need the global lock. 417 * to invoke file system routines that need the global lock.
418 */ 418 */
419asmlinkage unsigned long sys_brk(unsigned long brk) 419SYSCALL_DEFINE1(brk, unsigned long, brk)
420{ 420{
421 struct mm_struct *mm = current->mm; 421 struct mm_struct *mm = current->mm;
422 422
@@ -1573,7 +1573,7 @@ erase_whole_vma:
1573} 1573}
1574EXPORT_SYMBOL(do_munmap); 1574EXPORT_SYMBOL(do_munmap);
1575 1575
1576asmlinkage long sys_munmap(unsigned long addr, size_t len) 1576SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1577{ 1577{
1578 int ret; 1578 int ret;
1579 struct mm_struct *mm = current->mm; 1579 struct mm_struct *mm = current->mm;
@@ -1657,10 +1657,9 @@ unsigned long do_mremap(unsigned long addr,
1657} 1657}
1658EXPORT_SYMBOL(do_mremap); 1658EXPORT_SYMBOL(do_mremap);
1659 1659
1660asmlinkage 1660SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
1661unsigned long sys_mremap(unsigned long addr, 1661 unsigned long, new_len, unsigned long, flags,
1662 unsigned long old_len, unsigned long new_len, 1662 unsigned long, new_addr)
1663 unsigned long flags, unsigned long new_addr)
1664{ 1663{
1665 unsigned long ret; 1664 unsigned long ret;
1666 1665
diff --git a/mm/swapfile.c b/mm/swapfile.c
index da422c47e2ee..f48b831e5e5c 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1377,7 +1377,7 @@ out:
1377 return ret; 1377 return ret;
1378} 1378}
1379 1379
1380asmlinkage long sys_swapoff(const char __user * specialfile) 1380SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
1381{ 1381{
1382 struct swap_info_struct * p = NULL; 1382 struct swap_info_struct * p = NULL;
1383 unsigned short *swap_map; 1383 unsigned short *swap_map;
@@ -1633,7 +1633,7 @@ late_initcall(max_swapfiles_check);
1633 * 1633 *
1634 * The swapon system call 1634 * The swapon system call
1635 */ 1635 */
1636asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) 1636SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
1637{ 1637{
1638 struct swap_info_struct * p; 1638 struct swap_info_struct * p;
1639 char *name = NULL; 1639 char *name = NULL;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index c5db9a7264d9..75f49d312e8c 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -14,7 +14,6 @@
14#include <linux/highmem.h> 14#include <linux/highmem.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/mutex.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
@@ -24,6 +23,7 @@
24#include <linux/rbtree.h> 23#include <linux/rbtree.h>
25#include <linux/radix-tree.h> 24#include <linux/radix-tree.h>
26#include <linux/rcupdate.h> 25#include <linux/rcupdate.h>
26#include <linux/bootmem.h>
27 27
28#include <asm/atomic.h> 28#include <asm/atomic.h>
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -495,7 +495,7 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
495static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, 495static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
496 int sync, int force_flush) 496 int sync, int force_flush)
497{ 497{
498 static DEFINE_MUTEX(purge_lock); 498 static DEFINE_SPINLOCK(purge_lock);
499 LIST_HEAD(valist); 499 LIST_HEAD(valist);
500 struct vmap_area *va; 500 struct vmap_area *va;
501 int nr = 0; 501 int nr = 0;
@@ -506,10 +506,10 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
506 * the case that isn't actually used at the moment anyway. 506 * the case that isn't actually used at the moment anyway.
507 */ 507 */
508 if (!sync && !force_flush) { 508 if (!sync && !force_flush) {
509 if (!mutex_trylock(&purge_lock)) 509 if (!spin_trylock(&purge_lock))
510 return; 510 return;
511 } else 511 } else
512 mutex_lock(&purge_lock); 512 spin_lock(&purge_lock);
513 513
514 rcu_read_lock(); 514 rcu_read_lock();
515 list_for_each_entry_rcu(va, &vmap_area_list, list) { 515 list_for_each_entry_rcu(va, &vmap_area_list, list) {
@@ -541,7 +541,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
541 __free_vmap_area(va); 541 __free_vmap_area(va);
542 spin_unlock(&vmap_area_lock); 542 spin_unlock(&vmap_area_lock);
543 } 543 }
544 mutex_unlock(&purge_lock); 544 spin_unlock(&purge_lock);
545} 545}
546 546
547/* 547/*
@@ -984,6 +984,8 @@ EXPORT_SYMBOL(vm_map_ram);
984 984
985void __init vmalloc_init(void) 985void __init vmalloc_init(void)
986{ 986{
987 struct vmap_area *va;
988 struct vm_struct *tmp;
987 int i; 989 int i;
988 990
989 for_each_possible_cpu(i) { 991 for_each_possible_cpu(i) {
@@ -996,6 +998,14 @@ void __init vmalloc_init(void)
996 vbq->nr_dirty = 0; 998 vbq->nr_dirty = 0;
997 } 999 }
998 1000
1001 /* Import existing vmlist entries. */
1002 for (tmp = vmlist; tmp; tmp = tmp->next) {
1003 va = alloc_bootmem(sizeof(struct vmap_area));
1004 va->flags = tmp->flags | VM_VM_AREA;
1005 va->va_start = (unsigned long)tmp->addr;
1006 va->va_end = va->va_start + tmp->size;
1007 __insert_vmap_area(va);
1008 }
999 vmap_initialized = true; 1009 vmap_initialized = true;
1000} 1010}
1001 1011
diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index 0663f99e977a..7ed75c7bd5d1 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -23,7 +23,7 @@ config NET_9P_VIRTIO
23 guest partitions and a host partition. 23 guest partitions and a host partition.
24 24
25config NET_9P_RDMA 25config NET_9P_RDMA
26 depends on INET && INFINIBAND && EXPERIMENTAL 26 depends on INET && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL
27 tristate "9P RDMA Transport (Experimental)" 27 tristate "9P RDMA Transport (Experimental)"
28 help 28 help
29 This builds support for an RDMA transport. 29 This builds support for an RDMA transport.
diff --git a/net/socket.c b/net/socket.c
index 06603d73c411..35dd7371752a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1214,7 +1214,7 @@ int sock_create_kern(int family, int type, int protocol, struct socket **res)
1214 return __sock_create(&init_net, family, type, protocol, res, 1); 1214 return __sock_create(&init_net, family, type, protocol, res, 1);
1215} 1215}
1216 1216
1217asmlinkage long sys_socket(int family, int type, int protocol) 1217SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
1218{ 1218{
1219 int retval; 1219 int retval;
1220 struct socket *sock; 1220 struct socket *sock;
@@ -1255,8 +1255,8 @@ out_release:
1255 * Create a pair of connected sockets. 1255 * Create a pair of connected sockets.
1256 */ 1256 */
1257 1257
1258asmlinkage long sys_socketpair(int family, int type, int protocol, 1258SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
1259 int __user *usockvec) 1259 int __user *, usockvec)
1260{ 1260{
1261 struct socket *sock1, *sock2; 1261 struct socket *sock1, *sock2;
1262 int fd1, fd2, err; 1262 int fd1, fd2, err;
@@ -1356,7 +1356,7 @@ out_fd1:
1356 * the protocol layer (having also checked the address is ok). 1356 * the protocol layer (having also checked the address is ok).
1357 */ 1357 */
1358 1358
1359asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen) 1359SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
1360{ 1360{
1361 struct socket *sock; 1361 struct socket *sock;
1362 struct sockaddr_storage address; 1362 struct sockaddr_storage address;
@@ -1385,7 +1385,7 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
1385 * ready for listening. 1385 * ready for listening.
1386 */ 1386 */
1387 1387
1388asmlinkage long sys_listen(int fd, int backlog) 1388SYSCALL_DEFINE2(listen, int, fd, int, backlog)
1389{ 1389{
1390 struct socket *sock; 1390 struct socket *sock;
1391 int err, fput_needed; 1391 int err, fput_needed;
@@ -1418,8 +1418,8 @@ asmlinkage long sys_listen(int fd, int backlog)
1418 * clean when we restucture accept also. 1418 * clean when we restucture accept also.
1419 */ 1419 */
1420 1420
1421asmlinkage long sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, 1421SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
1422 int __user *upeer_addrlen, int flags) 1422 int __user *, upeer_addrlen, int, flags)
1423{ 1423{
1424 struct socket *sock, *newsock; 1424 struct socket *sock, *newsock;
1425 struct file *newfile; 1425 struct file *newfile;
@@ -1502,8 +1502,8 @@ out_fd:
1502 goto out_put; 1502 goto out_put;
1503} 1503}
1504 1504
1505asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, 1505SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr,
1506 int __user *upeer_addrlen) 1506 int __user *, upeer_addrlen)
1507{ 1507{
1508 return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0); 1508 return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0);
1509} 1509}
@@ -1520,8 +1520,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
1520 * include the -EINPROGRESS status for such sockets. 1520 * include the -EINPROGRESS status for such sockets.
1521 */ 1521 */
1522 1522
1523asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, 1523SYSCALL_DEFINE3(connect, int, fd, struct sockaddr __user *, uservaddr,
1524 int addrlen) 1524 int, addrlen)
1525{ 1525{
1526 struct socket *sock; 1526 struct socket *sock;
1527 struct sockaddr_storage address; 1527 struct sockaddr_storage address;
@@ -1552,8 +1552,8 @@ out:
1552 * name to user space. 1552 * name to user space.
1553 */ 1553 */
1554 1554
1555asmlinkage long sys_getsockname(int fd, struct sockaddr __user *usockaddr, 1555SYSCALL_DEFINE3(getsockname, int, fd, struct sockaddr __user *, usockaddr,
1556 int __user *usockaddr_len) 1556 int __user *, usockaddr_len)
1557{ 1557{
1558 struct socket *sock; 1558 struct socket *sock;
1559 struct sockaddr_storage address; 1559 struct sockaddr_storage address;
@@ -1583,8 +1583,8 @@ out:
1583 * name to user space. 1583 * name to user space.
1584 */ 1584 */
1585 1585
1586asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr, 1586SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr,
1587 int __user *usockaddr_len) 1587 int __user *, usockaddr_len)
1588{ 1588{
1589 struct socket *sock; 1589 struct socket *sock;
1590 struct sockaddr_storage address; 1590 struct sockaddr_storage address;
@@ -1615,9 +1615,9 @@ asmlinkage long sys_getpeername(int fd, struct sockaddr __user *usockaddr,
1615 * the protocol. 1615 * the protocol.
1616 */ 1616 */
1617 1617
1618asmlinkage long sys_sendto(int fd, void __user *buff, size_t len, 1618SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len,
1619 unsigned flags, struct sockaddr __user *addr, 1619 unsigned, flags, struct sockaddr __user *, addr,
1620 int addr_len) 1620 int, addr_len)
1621{ 1621{
1622 struct socket *sock; 1622 struct socket *sock;
1623 struct sockaddr_storage address; 1623 struct sockaddr_storage address;
@@ -1660,7 +1660,8 @@ out:
1660 * Send a datagram down a socket. 1660 * Send a datagram down a socket.
1661 */ 1661 */
1662 1662
1663asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags) 1663SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len,
1664 unsigned, flags)
1664{ 1665{
1665 return sys_sendto(fd, buff, len, flags, NULL, 0); 1666 return sys_sendto(fd, buff, len, flags, NULL, 0);
1666} 1667}
@@ -1671,9 +1672,9 @@ asmlinkage long sys_send(int fd, void __user *buff, size_t len, unsigned flags)
1671 * sender address from kernel to user space. 1672 * sender address from kernel to user space.
1672 */ 1673 */
1673 1674
1674asmlinkage long sys_recvfrom(int fd, void __user *ubuf, size_t size, 1675SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
1675 unsigned flags, struct sockaddr __user *addr, 1676 unsigned, flags, struct sockaddr __user *, addr,
1676 int __user *addr_len) 1677 int __user *, addr_len)
1677{ 1678{
1678 struct socket *sock; 1679 struct socket *sock;
1679 struct iovec iov; 1680 struct iovec iov;
@@ -1725,8 +1726,8 @@ asmlinkage long sys_recv(int fd, void __user *ubuf, size_t size,
1725 * to pass the user mode parameter for the protocols to sort out. 1726 * to pass the user mode parameter for the protocols to sort out.
1726 */ 1727 */
1727 1728
1728asmlinkage long sys_setsockopt(int fd, int level, int optname, 1729SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
1729 char __user *optval, int optlen) 1730 char __user *, optval, int, optlen)
1730{ 1731{
1731 int err, fput_needed; 1732 int err, fput_needed;
1732 struct socket *sock; 1733 struct socket *sock;
@@ -1759,8 +1760,8 @@ out_put:
1759 * to pass a user mode parameter for the protocols to sort out. 1760 * to pass a user mode parameter for the protocols to sort out.
1760 */ 1761 */
1761 1762
1762asmlinkage long sys_getsockopt(int fd, int level, int optname, 1763SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
1763 char __user *optval, int __user *optlen) 1764 char __user *, optval, int __user *, optlen)
1764{ 1765{
1765 int err, fput_needed; 1766 int err, fput_needed;
1766 struct socket *sock; 1767 struct socket *sock;
@@ -1789,7 +1790,7 @@ out_put:
1789 * Shutdown a socket. 1790 * Shutdown a socket.
1790 */ 1791 */
1791 1792
1792asmlinkage long sys_shutdown(int fd, int how) 1793SYSCALL_DEFINE2(shutdown, int, fd, int, how)
1793{ 1794{
1794 int err, fput_needed; 1795 int err, fput_needed;
1795 struct socket *sock; 1796 struct socket *sock;
@@ -1815,7 +1816,7 @@ asmlinkage long sys_shutdown(int fd, int how)
1815 * BSD sendmsg interface 1816 * BSD sendmsg interface
1816 */ 1817 */
1817 1818
1818asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags) 1819SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags)
1819{ 1820{
1820 struct compat_msghdr __user *msg_compat = 1821 struct compat_msghdr __user *msg_compat =
1821 (struct compat_msghdr __user *)msg; 1822 (struct compat_msghdr __user *)msg;
@@ -1921,8 +1922,8 @@ out:
1921 * BSD recvmsg interface 1922 * BSD recvmsg interface
1922 */ 1923 */
1923 1924
1924asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, 1925SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg,
1925 unsigned int flags) 1926 unsigned int, flags)
1926{ 1927{
1927 struct compat_msghdr __user *msg_compat = 1928 struct compat_msghdr __user *msg_compat =
1928 (struct compat_msghdr __user *)msg; 1929 (struct compat_msghdr __user *)msg;
@@ -2045,7 +2046,7 @@ static const unsigned char nargs[19]={
2045 * it is set by the callees. 2046 * it is set by the callees.
2046 */ 2047 */
2047 2048
2048asmlinkage long sys_socketcall(int call, unsigned long __user *args) 2049SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2049{ 2050{
2050 unsigned long a[6]; 2051 unsigned long a[6];
2051 unsigned long a0, a1; 2052 unsigned long a0, a1;
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7bed4ed2c519..45eb0ae98eba 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -10,7 +10,7 @@ use strict;
10my $P = $0; 10my $P = $0;
11$P =~ s@.*/@@g; 11$P =~ s@.*/@@g;
12 12
13my $V = '0.26'; 13my $V = '0.27';
14 14
15use Getopt::Long qw(:config no_auto_abbrev); 15use Getopt::Long qw(:config no_auto_abbrev);
16 16
@@ -411,13 +411,15 @@ sub ctx_statement_block {
411 411
412 my $type = ''; 412 my $type = '';
413 my $level = 0; 413 my $level = 0;
414 my @stack = ([$type, $level]); 414 my @stack = ();
415 my $p; 415 my $p;
416 my $c; 416 my $c;
417 my $len = 0; 417 my $len = 0;
418 418
419 my $remainder; 419 my $remainder;
420 while (1) { 420 while (1) {
421 @stack = (['', 0]) if ($#stack == -1);
422
421 #warn "CSB: blk<$blk> remain<$remain>\n"; 423 #warn "CSB: blk<$blk> remain<$remain>\n";
422 # If we are about to drop off the end, pull in more 424 # If we are about to drop off the end, pull in more
423 # context. 425 # context.
@@ -1663,7 +1665,7 @@ sub process {
1663 # Should not end with a space. 1665 # Should not end with a space.
1664 $to =~ s/\s+$//; 1666 $to =~ s/\s+$//;
1665 # '*'s should not have spaces between. 1667 # '*'s should not have spaces between.
1666 while ($to =~ s/(.)\s\*/$1\*/) { 1668 while ($to =~ s/\*\s+\*/\*\*/) {
1667 } 1669 }
1668 1670
1669 #print "from<$from> to<$to>\n"; 1671 #print "from<$from> to<$to>\n";
@@ -1678,7 +1680,7 @@ sub process {
1678 # Should not end with a space. 1680 # Should not end with a space.
1679 $to =~ s/\s+$//; 1681 $to =~ s/\s+$//;
1680 # '*'s should not have spaces between. 1682 # '*'s should not have spaces between.
1681 while ($to =~ s/(.)\s\*/$1\*/) { 1683 while ($to =~ s/\*\s+\*/\*\*/) {
1682 } 1684 }
1683 # Modifiers should have spaces. 1685 # Modifiers should have spaces.
1684 $to =~ s/(\b$Modifier$)/$1 /; 1686 $to =~ s/(\b$Modifier$)/$1 /;
@@ -2014,7 +2016,11 @@ sub process {
2014 2016
2015 # Flatten any parentheses 2017 # Flatten any parentheses
2016 $value =~ s/\)\(/\) \(/g; 2018 $value =~ s/\)\(/\) \(/g;
2017 while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) { 2019 while ($value =~ s/\[[^\{\}]*\]/1/ ||
2020 $value !~ /(?:$Ident|-?$Constant)\s*
2021 $Compare\s*
2022 (?:$Ident|-?$Constant)/x &&
2023 $value =~ s/\([^\(\)]*\)/1/) {
2018 } 2024 }
2019 2025
2020 if ($value =~ /^(?:$Ident|-?$Constant)$/) { 2026 if ($value =~ /^(?:$Ident|-?$Constant)$/) {
@@ -2102,6 +2108,11 @@ sub process {
2102 ERROR("trailing statements should be on next line\n" . $herecurr); 2108 ERROR("trailing statements should be on next line\n" . $herecurr);
2103 } 2109 }
2104 } 2110 }
2111# if should not continue a brace
2112 if ($line =~ /}\s*if\b/) {
2113 ERROR("trailing statements should be on next line\n" .
2114 $herecurr);
2115 }
2105# case and default should not have general statements after them 2116# case and default should not have general statements after them
2106 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && 2117 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
2107 $line !~ /\G(?: 2118 $line !~ /\G(?:
@@ -2516,9 +2527,10 @@ sub process {
2516 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); 2527 WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
2517 } 2528 }
2518# check for struct file_operations, ensure they are const. 2529# check for struct file_operations, ensure they are const.
2519 if ($line =~ /\bstruct\s+file_operations\b/ && 2530 if ($line !~ /\bconst\b/ &&
2520 $line !~ /\bconst\b/) { 2531 $line =~ /\bstruct\s+(file_operations|seq_operations)\b/) {
2521 WARN("struct file_operations should normally be const\n" . $herecurr); 2532 WARN("struct $1 should normally be const\n" .
2533 $herecurr);
2522 } 2534 }
2523 2535
2524# use of NR_CPUS is usually wrong 2536# use of NR_CPUS is usually wrong
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 09796797d122..e9335e1c6cf5 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -54,11 +54,11 @@ static int key_get_type_from_user(char *type,
54 * - returns the new key's serial number 54 * - returns the new key's serial number
55 * - implements add_key() 55 * - implements add_key()
56 */ 56 */
57asmlinkage long sys_add_key(const char __user *_type, 57SYSCALL_DEFINE5(add_key, const char __user *, _type,
58 const char __user *_description, 58 const char __user *, _description,
59 const void __user *_payload, 59 const void __user *, _payload,
60 size_t plen, 60 size_t, plen,
61 key_serial_t ringid) 61 key_serial_t, ringid)
62{ 62{
63 key_ref_t keyring_ref, key_ref; 63 key_ref_t keyring_ref, key_ref;
64 char type[32], *description; 64 char type[32], *description;
@@ -146,10 +146,10 @@ asmlinkage long sys_add_key(const char __user *_type,
146 * - if the _callout_info string is empty, it will be rendered as "-" 146 * - if the _callout_info string is empty, it will be rendered as "-"
147 * - implements request_key() 147 * - implements request_key()
148 */ 148 */
149asmlinkage long sys_request_key(const char __user *_type, 149SYSCALL_DEFINE4(request_key, const char __user *, _type,
150 const char __user *_description, 150 const char __user *, _description,
151 const char __user *_callout_info, 151 const char __user *, _callout_info,
152 key_serial_t destringid) 152 key_serial_t, destringid)
153{ 153{
154 struct key_type *ktype; 154 struct key_type *ktype;
155 struct key *key; 155 struct key *key;
@@ -1216,8 +1216,8 @@ long keyctl_get_security(key_serial_t keyid,
1216/* 1216/*
1217 * the key control system call 1217 * the key control system call
1218 */ 1218 */
1219asmlinkage long sys_keyctl(int option, unsigned long arg2, unsigned long arg3, 1219SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
1220 unsigned long arg4, unsigned long arg5) 1220 unsigned long, arg4, unsigned long, arg5)
1221{ 1221{
1222 switch (option) { 1222 switch (option) {
1223 case KEYCTL_GET_KEYRING_ID: 1223 case KEYCTL_GET_KEYRING_ID:
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 3c596da2b9b5..b7bba7dc7cf1 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2724,6 +2724,67 @@ int snd_hda_check_board_config(struct hda_codec *codec,
2724EXPORT_SYMBOL_HDA(snd_hda_check_board_config); 2724EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
2725 2725
2726/** 2726/**
2727 * snd_hda_check_board_codec_sid_config - compare the current codec
2728 subsystem ID with the
2729 config table
2730
2731 This is important for Gateway notebooks with SB450 HDA Audio
2732 where the vendor ID of the PCI device is:
2733 ATI Technologies Inc SB450 HDA Audio [1002:437b]
2734 and the vendor/subvendor are found only at the codec.
2735
2736 * @codec: the HDA codec
2737 * @num_configs: number of config enums
2738 * @models: array of model name strings
2739 * @tbl: configuration table, terminated by null entries
2740 *
2741 * Compares the modelname or PCI subsystem id of the current codec with the
2742 * given configuration table. If a matching entry is found, returns its
2743 * config value (supposed to be 0 or positive).
2744 *
2745 * If no entries are matching, the function returns a negative value.
2746 */
2747int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
2748 int num_configs, const char **models,
2749 const struct snd_pci_quirk *tbl)
2750{
2751 const struct snd_pci_quirk *q;
2752
2753 /* Search for codec ID */
2754 for (q = tbl; q->subvendor; q++) {
2755 unsigned long vendorid = (q->subdevice) | (q->subvendor << 16);
2756
2757 if (vendorid == codec->subsystem_id)
2758 break;
2759 }
2760
2761 if (!q->subvendor)
2762 return -1;
2763
2764 tbl = q;
2765
2766 if (tbl->value >= 0 && tbl->value < num_configs) {
2767#ifdef CONFIG_SND_DEBUG_DETECT
2768 char tmp[10];
2769 const char *model = NULL;
2770 if (models)
2771 model = models[tbl->value];
2772 if (!model) {
2773 sprintf(tmp, "#%d", tbl->value);
2774 model = tmp;
2775 }
2776 snd_printdd(KERN_INFO "hda_codec: model '%s' is selected "
2777 "for config %x:%x (%s)\n",
2778 model, tbl->subvendor, tbl->subdevice,
2779 (tbl->name ? tbl->name : "Unknown device"));
2780#endif
2781 return tbl->value;
2782 }
2783 return -1;
2784}
2785EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config);
2786
2787/**
2727 * snd_hda_add_new_ctls - create controls from the array 2788 * snd_hda_add_new_ctls - create controls from the array
2728 * @codec: the HDA codec 2789 * @codec: the HDA codec
2729 * @knew: the array of struct snd_kcontrol_new 2790 * @knew: the array of struct snd_kcontrol_new
@@ -2815,7 +2876,7 @@ void snd_hda_power_down(struct hda_codec *codec)
2815 return; 2876 return;
2816 if (power_save(codec)) { 2877 if (power_save(codec)) {
2817 codec->power_transition = 1; /* avoid reentrance */ 2878 codec->power_transition = 1; /* avoid reentrance */
2818 schedule_delayed_work(&codec->power_work, 2879 queue_delayed_work(codec->bus->workq, &codec->power_work,
2819 msecs_to_jiffies(power_save(codec) * 1000)); 2880 msecs_to_jiffies(power_save(codec) * 1000));
2820 } 2881 }
2821} 2882}
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 6f2fe0f9fdd8..1dd8716c387f 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -296,6 +296,9 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen);
296int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, 296int snd_hda_check_board_config(struct hda_codec *codec, int num_configs,
297 const char **modelnames, 297 const char **modelnames,
298 const struct snd_pci_quirk *pci_list); 298 const struct snd_pci_quirk *pci_list);
299int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
300 int num_configs, const char **models,
301 const struct snd_pci_quirk *tbl);
299int snd_hda_add_new_ctls(struct hda_codec *codec, 302int snd_hda_add_new_ctls(struct hda_codec *codec,
300 struct snd_kcontrol_new *knew); 303 struct snd_kcontrol_new *knew);
301 304
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index 96952a37d884..d57d8132a06e 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -160,6 +160,7 @@ static int patch_nvhdmi(struct hda_codec *codec)
160 */ 160 */
161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = { 161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = {
162 { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi }, 162 { .id = 0x10de0002, .name = "MCP78 HDMI", .patch = patch_nvhdmi },
163 { .id = 0x10de0006, .name = "MCP78 HDMI", .patch = patch_nvhdmi },
163 { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi }, 164 { .id = 0x10de0007, .name = "MCP7A HDMI", .patch = patch_nvhdmi },
164 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi }, 165 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi },
165 { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi }, 166 { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi },
@@ -167,6 +168,7 @@ static struct hda_codec_preset snd_hda_preset_nvhdmi[] = {
167}; 168};
168 169
169MODULE_ALIAS("snd-hda-codec-id:10de0002"); 170MODULE_ALIAS("snd-hda-codec-id:10de0002");
171MODULE_ALIAS("snd-hda-codec-id:10de0006");
170MODULE_ALIAS("snd-hda-codec-id:10de0007"); 172MODULE_ALIAS("snd-hda-codec-id:10de0007");
171MODULE_ALIAS("snd-hda-codec-id:10de0067"); 173MODULE_ALIAS("snd-hda-codec-id:10de0067");
172MODULE_ALIAS("snd-hda-codec-id:10de8001"); 174MODULE_ALIAS("snd-hda-codec-id:10de8001");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ea4c88fe05c4..82dd08431970 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10573,6 +10573,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
10573 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10573 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10574 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10574 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
10575 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 10575 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
10576 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10576 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 10577 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10577 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 10578 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10578 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), 10579 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 35b83dc6e19e..c39deebb588f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -55,7 +55,8 @@ enum {
55 STAC_9200_DELL_M25, 55 STAC_9200_DELL_M25,
56 STAC_9200_DELL_M26, 56 STAC_9200_DELL_M26,
57 STAC_9200_DELL_M27, 57 STAC_9200_DELL_M27,
58 STAC_9200_GATEWAY, 58 STAC_9200_M4,
59 STAC_9200_M4_2,
59 STAC_9200_PANASONIC, 60 STAC_9200_PANASONIC,
60 STAC_9200_MODELS 61 STAC_9200_MODELS
61}; 62};
@@ -89,14 +90,19 @@ enum {
89 STAC_DELL_M4_2, 90 STAC_DELL_M4_2,
90 STAC_DELL_M4_3, 91 STAC_DELL_M4_3,
91 STAC_HP_M4, 92 STAC_HP_M4,
93 STAC_HP_DV5,
92 STAC_92HD71BXX_MODELS 94 STAC_92HD71BXX_MODELS
93}; 95};
94 96
95enum { 97enum {
96 STAC_925x_REF, 98 STAC_925x_REF,
99 STAC_M1,
100 STAC_M1_2,
101 STAC_M2,
97 STAC_M2_2, 102 STAC_M2_2,
98 STAC_MA6, 103 STAC_M3,
99 STAC_PA6, 104 STAC_M5,
105 STAC_M6,
100 STAC_925x_MODELS 106 STAC_925x_MODELS
101}; 107};
102 108
@@ -331,6 +337,10 @@ static unsigned int stac92hd83xxx_pwr_mapping[4] = {
331 0x03, 0x0c, 0x10, 0x40, 337 0x03, 0x0c, 0x10, 0x40,
332}; 338};
333 339
340static hda_nid_t stac92hd83xxx_amp_nids[1] = {
341 0xc,
342};
343
334static hda_nid_t stac92hd71bxx_pwr_nids[3] = { 344static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
335 0x0a, 0x0d, 0x0f 345 0x0a, 0x0d, 0x0f
336}; 346};
@@ -875,6 +885,8 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = {
875static struct hda_verb stac925x_core_init[] = { 885static struct hda_verb stac925x_core_init[] = {
876 /* set dac0mux for dac converter */ 886 /* set dac0mux for dac converter */
877 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, 887 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
888 /* unmute and set max the selector */
889 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f },
878 {} 890 {}
879}; 891};
880 892
@@ -1334,7 +1346,16 @@ static unsigned int ref9200_pin_configs[8] = {
1334 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, 1346 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1335}; 1347};
1336 1348
1337/* 1349static unsigned int gateway9200_m4_pin_configs[8] = {
1350 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1351 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1352};
1353static unsigned int gateway9200_m4_2_pin_configs[8] = {
1354 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1355 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1356};
1357
1358/*
1338 STAC 9200 pin configs for 1359 STAC 9200 pin configs for
1339 102801A8 1360 102801A8
1340 102801DE 1361 102801DE
@@ -1464,6 +1485,8 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1464 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, 1485 [STAC_9200_DELL_M25] = dell9200_m25_pin_configs,
1465 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, 1486 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs,
1466 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, 1487 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs,
1488 [STAC_9200_M4] = gateway9200_m4_pin_configs,
1489 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,
1467 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1490 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1468}; 1491};
1469 1492
@@ -1480,7 +1503,8 @@ static const char *stac9200_models[STAC_9200_MODELS] = {
1480 [STAC_9200_DELL_M25] = "dell-m25", 1503 [STAC_9200_DELL_M25] = "dell-m25",
1481 [STAC_9200_DELL_M26] = "dell-m26", 1504 [STAC_9200_DELL_M26] = "dell-m26",
1482 [STAC_9200_DELL_M27] = "dell-m27", 1505 [STAC_9200_DELL_M27] = "dell-m27",
1483 [STAC_9200_GATEWAY] = "gateway", 1506 [STAC_9200_M4] = "gateway-m4",
1507 [STAC_9200_M4_2] = "gateway-m4-2",
1484 [STAC_9200_PANASONIC] = "panasonic", 1508 [STAC_9200_PANASONIC] = "panasonic",
1485}; 1509};
1486 1510
@@ -1550,11 +1574,9 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1550 /* Panasonic */ 1574 /* Panasonic */
1551 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1575 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1552 /* Gateway machines needs EAPD to be set on resume */ 1576 /* Gateway machines needs EAPD to be set on resume */
1553 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), 1577 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1554 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", 1578 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1555 STAC_9200_GATEWAY), 1579 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
1556 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707",
1557 STAC_9200_GATEWAY),
1558 /* OQO Mobile */ 1580 /* OQO Mobile */
1559 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), 1581 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
1560 {} /* terminator */ 1582 {} /* terminator */
@@ -1565,44 +1587,85 @@ static unsigned int ref925x_pin_configs[8] = {
1565 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, 1587 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1566}; 1588};
1567 1589
1568static unsigned int stac925x_MA6_pin_configs[8] = { 1590static unsigned int stac925xM1_pin_configs[8] = {
1569 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1591 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1570 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, 1592 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1571}; 1593};
1572 1594
1573static unsigned int stac925x_PA6_pin_configs[8] = { 1595static unsigned int stac925xM1_2_pin_configs[8] = {
1574 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1596 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1575 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, 1597 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1598};
1599
1600static unsigned int stac925xM2_pin_configs[8] = {
1601 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1602 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1576}; 1603};
1577 1604
1578static unsigned int stac925xM2_2_pin_configs[8] = { 1605static unsigned int stac925xM2_2_pin_configs[8] = {
1579 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, 1606 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1580 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, 1607 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1608};
1609
1610static unsigned int stac925xM3_pin_configs[8] = {
1611 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1612 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1613};
1614
1615static unsigned int stac925xM5_pin_configs[8] = {
1616 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1617 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1618};
1619
1620static unsigned int stac925xM6_pin_configs[8] = {
1621 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1622 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1581}; 1623};
1582 1624
1583static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 1625static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1584 [STAC_REF] = ref925x_pin_configs, 1626 [STAC_REF] = ref925x_pin_configs,
1627 [STAC_M1] = stac925xM1_pin_configs,
1628 [STAC_M1_2] = stac925xM1_2_pin_configs,
1629 [STAC_M2] = stac925xM2_pin_configs,
1585 [STAC_M2_2] = stac925xM2_2_pin_configs, 1630 [STAC_M2_2] = stac925xM2_2_pin_configs,
1586 [STAC_MA6] = stac925x_MA6_pin_configs, 1631 [STAC_M3] = stac925xM3_pin_configs,
1587 [STAC_PA6] = stac925x_PA6_pin_configs, 1632 [STAC_M5] = stac925xM5_pin_configs,
1633 [STAC_M6] = stac925xM6_pin_configs,
1588}; 1634};
1589 1635
1590static const char *stac925x_models[STAC_925x_MODELS] = { 1636static const char *stac925x_models[STAC_925x_MODELS] = {
1591 [STAC_REF] = "ref", 1637 [STAC_REF] = "ref",
1638 [STAC_M1] = "m1",
1639 [STAC_M1_2] = "m1-2",
1640 [STAC_M2] = "m2",
1592 [STAC_M2_2] = "m2-2", 1641 [STAC_M2_2] = "m2-2",
1593 [STAC_MA6] = "m6", 1642 [STAC_M3] = "m3",
1594 [STAC_PA6] = "pa6", 1643 [STAC_M5] = "m5",
1644 [STAC_M6] = "m6",
1645};
1646
1647static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1648 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1649 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1650 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1651 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
1652 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
1653 /* Not sure about the brand name for those */
1654 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1655 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1656 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1657 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
1658 {} /* terminator */
1595}; 1659};
1596 1660
1597static struct snd_pci_quirk stac925x_cfg_tbl[] = { 1661static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1598 /* SigmaTel reference board */ 1662 /* SigmaTel reference board */
1599 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), 1663 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1600 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), 1664 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1601 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), 1665
1602 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), 1666 /* Default table for unknown ID */
1603 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), 1667 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1604 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), 1668
1605 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
1606 {} /* terminator */ 1669 {} /* terminator */
1607}; 1670};
1608 1671
@@ -1682,7 +1745,7 @@ static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1682static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { 1745static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1683 /* SigmaTel reference board */ 1746 /* SigmaTel reference board */
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1747 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1685 "DFI LanParty", STAC_92HD71BXX_REF), 1748 "DFI LanParty", STAC_92HD83XXX_REF),
1686 {} /* terminator */ 1749 {} /* terminator */
1687}; 1750};
1688 1751
@@ -1716,6 +1779,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1716 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1779 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1717 [STAC_DELL_M4_3] = dell_m4_3_pin_configs, 1780 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1718 [STAC_HP_M4] = NULL, 1781 [STAC_HP_M4] = NULL,
1782 [STAC_HP_DV5] = NULL,
1719}; 1783};
1720 1784
1721static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1785static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
@@ -1724,6 +1788,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1724 [STAC_DELL_M4_2] = "dell-m4-2", 1788 [STAC_DELL_M4_2] = "dell-m4-2",
1725 [STAC_DELL_M4_3] = "dell-m4-3", 1789 [STAC_DELL_M4_3] = "dell-m4-3",
1726 [STAC_HP_M4] = "hp-m4", 1790 [STAC_HP_M4] = "hp-m4",
1791 [STAC_HP_DV5] = "hp-dv5",
1727}; 1792};
1728 1793
1729static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { 1794static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
@@ -1736,6 +1801,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1736 "HP dv7", STAC_HP_M4), 1801 "HP dv7", STAC_HP_M4),
1737 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, 1802 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
1738 "HP dv7", STAC_HP_M4), 1803 "HP dv7", STAC_HP_M4),
1804 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,
1805 "HP dv5", STAC_HP_DV5),
1739 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, 1806 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
1740 "unknown HP", STAC_HP_M4), 1807 "unknown HP", STAC_HP_M4),
1741 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 1808 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
@@ -4163,8 +4230,19 @@ static void stac92xx_hp_detect(struct hda_codec *codec)
4163 continue; 4230 continue;
4164 if (presence) 4231 if (presence)
4165 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4232 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4233#if 0 /* FIXME */
4234/* Resetting the pinctl like below may lead to (a sort of) regressions
4235 * on some devices since they use the HP pin actually for line/speaker
4236 * outs although the default pin config shows a different pin (that is
4237 * wrong and useless).
4238 *
4239 * So, it's basically a problem of default pin configs, likely a BIOS issue.
4240 * But, disabling the code below just works around it, and I'm too tired of
4241 * bug reports with such devices...
4242 */
4166 else 4243 else
4167 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); 4244 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val);
4245#endif /* FIXME */
4168 } 4246 }
4169} 4247}
4170 4248
@@ -4390,7 +4468,8 @@ static int patch_stac9200(struct hda_codec *codec)
4390 spec->num_adcs = 1; 4468 spec->num_adcs = 1;
4391 spec->num_pwrs = 0; 4469 spec->num_pwrs = 0;
4392 4470
4393 if (spec->board_config == STAC_9200_GATEWAY || 4471 if (spec->board_config == STAC_9200_M4 ||
4472 spec->board_config == STAC_9200_M4_2 ||
4394 spec->board_config == STAC_9200_OQO) 4473 spec->board_config == STAC_9200_OQO)
4395 spec->init = stac9200_eapd_init; 4474 spec->init = stac9200_eapd_init;
4396 else 4475 else
@@ -4408,6 +4487,12 @@ static int patch_stac9200(struct hda_codec *codec)
4408 return err; 4487 return err;
4409 } 4488 }
4410 4489
4490 /* CF-74 has no headphone detection, and the driver should *NOT*
4491 * do detection and HP/speaker toggle because the hardware does it.
4492 */
4493 if (spec->board_config == STAC_9200_PANASONIC)
4494 spec->hp_detect = 0;
4495
4411 codec->patch_ops = stac92xx_patch_ops; 4496 codec->patch_ops = stac92xx_patch_ops;
4412 4497
4413 return 0; 4498 return 0;
@@ -4425,12 +4510,22 @@ static int patch_stac925x(struct hda_codec *codec)
4425 codec->spec = spec; 4510 codec->spec = spec;
4426 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 4511 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
4427 spec->pin_nids = stac925x_pin_nids; 4512 spec->pin_nids = stac925x_pin_nids;
4428 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 4513
4514 /* Check first for codec ID */
4515 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
4516 STAC_925x_MODELS,
4517 stac925x_models,
4518 stac925x_codec_id_cfg_tbl);
4519
4520 /* Now checks for PCI ID, if codec ID is not found */
4521 if (spec->board_config < 0)
4522 spec->board_config = snd_hda_check_board_config(codec,
4523 STAC_925x_MODELS,
4429 stac925x_models, 4524 stac925x_models,
4430 stac925x_cfg_tbl); 4525 stac925x_cfg_tbl);
4431 again: 4526 again:
4432 if (spec->board_config < 0) { 4527 if (spec->board_config < 0) {
4433 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4528 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
4434 "using BIOS defaults\n"); 4529 "using BIOS defaults\n");
4435 err = stac92xx_save_bios_config_regs(codec); 4530 err = stac92xx_save_bios_config_regs(codec);
4436 } else 4531 } else
@@ -4672,6 +4767,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
4672 spec->dmux_nids = stac92hd83xxx_dmux_nids; 4767 spec->dmux_nids = stac92hd83xxx_dmux_nids;
4673 spec->adc_nids = stac92hd83xxx_adc_nids; 4768 spec->adc_nids = stac92hd83xxx_adc_nids;
4674 spec->pwr_nids = stac92hd83xxx_pwr_nids; 4769 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4770 spec->amp_nids = stac92hd83xxx_amp_nids;
4675 spec->pwr_mapping = stac92hd83xxx_pwr_mapping; 4771 spec->pwr_mapping = stac92hd83xxx_pwr_mapping;
4676 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); 4772 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
4677 spec->multiout.dac_nids = spec->dac_nids; 4773 spec->multiout.dac_nids = spec->dac_nids;
@@ -4689,6 +4785,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
4689 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); 4785 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids);
4690 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); 4786 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids);
4691 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); 4787 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids);
4788 spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids);
4692 spec->num_dmics = STAC92HD83XXX_NUM_DMICS; 4789 spec->num_dmics = STAC92HD83XXX_NUM_DMICS;
4693 spec->dinput_mux = &stac92hd83xxx_dmux; 4790 spec->dinput_mux = &stac92hd83xxx_dmux;
4694 spec->pin_nids = stac92hd83xxx_pin_nids; 4791 spec->pin_nids = stac92hd83xxx_pin_nids;
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 98c6a8c65d81..e9e829e83d7a 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -26,7 +26,7 @@
26 * SPI 0 -> 1st PCM1796 (front) 26 * SPI 0 -> 1st PCM1796 (front)
27 * SPI 1 -> 2nd PCM1796 (surround) 27 * SPI 1 -> 2nd PCM1796 (surround)
28 * SPI 2 -> 3rd PCM1796 (center/LFE) 28 * SPI 2 -> 3rd PCM1796 (center/LFE)
29 * SPI 4 -> 4th PCM1796 (back) 29 * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
30 * 30 *
31 * GPIO 2 -> M0 of CS5381 31 * GPIO 2 -> M0 of CS5381
32 * GPIO 3 -> M1 of CS5381 32 * GPIO 3 -> M1 of CS5381
@@ -207,6 +207,12 @@ static void xonar_gpio_changed(struct oxygen *chip);
207static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, 207static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
208 u8 reg, u8 value) 208 u8 reg, u8 value)
209{ 209{
210 /*
211 * We don't want to do writes on SPI 4 because the EEPROM, which shares
212 * the same pin, might get confused and broken. We'd better take care
213 * that the driver works with the default register values ...
214 */
215#if 0
210 /* maps ALSA channel pair number to SPI output */ 216 /* maps ALSA channel pair number to SPI output */
211 static const u8 codec_map[4] = { 217 static const u8 codec_map[4] = {
212 0, 1, 2, 4 218 0, 1, 2, 4
@@ -217,6 +223,7 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
217 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | 223 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
218 OXYGEN_SPI_CEN_LATCH_CLOCK_HI, 224 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
219 (reg << 8) | value); 225 (reg << 8) | value);
226#endif
220} 227}
221 228
222static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, 229static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
@@ -750,6 +757,9 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
750 757
751static int xonar_d2_control_filter(struct snd_kcontrol_new *template) 758static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
752{ 759{
760 if (!strncmp(template->name, "Master Playback ", 16))
761 /* disable volume/mute because they would require SPI writes */
762 return 1;
753 if (!strncmp(template->name, "CD Capture ", 11)) 763 if (!strncmp(template->name, "CD Capture ", 11))
754 /* CD in is actually connected to the video in pin */ 764 /* CD in is actually connected to the video in pin */
755 template->private_value ^= AC97_CD ^ AC97_VIDEO; 765 template->private_value ^= AC97_CD ^ AC97_VIDEO;
@@ -840,9 +850,8 @@ static const struct oxygen_model model_xonar_d2 = {
840 .dac_volume_min = 0x0f, 850 .dac_volume_min = 0x0f,
841 .dac_volume_max = 0xff, 851 .dac_volume_max = 0xff,
842 .misc_flags = OXYGEN_MISC_MIDI, 852 .misc_flags = OXYGEN_MISC_MIDI,
843 .function_flags = OXYGEN_FUNCTION_SPI | 853 .function_flags = OXYGEN_FUNCTION_SPI,
844 OXYGEN_FUNCTION_ENABLE_SPI_4_5, 854 .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
845 .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
846 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 855 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
847}; 856};
848 857
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index 8f9e3859c37c..ff321110ec02 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -477,7 +477,7 @@ static int snd_ps3_pcm_prepare(struct snd_pcm_substream *substream)
477 card->dma_start_bus_addr[SND_PS3_CH_R] = 477 card->dma_start_bus_addr[SND_PS3_CH_R] =
478 runtime->dma_addr + (runtime->dma_bytes / 2); 478 runtime->dma_addr + (runtime->dma_bytes / 2);
479 479
480 pr_debug("%s: vaddr=%p bus=%#lx\n", __func__, 480 pr_debug("%s: vaddr=%p bus=%#llx\n", __func__,
481 card->dma_start_vaddr[SND_PS3_CH_L], 481 card->dma_start_vaddr[SND_PS3_CH_L],
482 card->dma_start_bus_addr[SND_PS3_CH_L]); 482 card->dma_start_bus_addr[SND_PS3_CH_L]);
483 483
@@ -1030,7 +1030,7 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
1030 pr_info("%s: nullbuffer alloc failed\n", __func__); 1030 pr_info("%s: nullbuffer alloc failed\n", __func__);
1031 goto clean_preallocate; 1031 goto clean_preallocate;
1032 } 1032 }
1033 pr_debug("%s: null vaddr=%p dma=%#lx\n", __func__, 1033 pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__,
1034 the_card.null_buffer_start_vaddr, 1034 the_card.null_buffer_start_vaddr,
1035 the_card.null_buffer_start_dma_addr); 1035 the_card.null_buffer_start_dma_addr);
1036 /* set default sample rate/word width */ 1036 /* set default sample rate/word width */
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 493a4e8aa273..a2f1da8b4646 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -720,7 +720,8 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
720 struct snd_soc_dapm_path *path; 720 struct snd_soc_dapm_path *path;
721 int found = 0; 721 int found = 0;
722 722
723 if (widget->id != snd_soc_dapm_mux) 723 if (widget->id != snd_soc_dapm_mux &&
724 widget->id != snd_soc_dapm_value_mux)
724 return -ENODEV; 725 return -ENODEV;
725 726
726 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val)) 727 if (!snd_soc_test_bits(widget->codec, e->reg, mask, val))
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 92115755d98e..5d8ef09b9dcc 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -128,6 +128,14 @@
128 .bInterfaceClass = USB_CLASS_AUDIO, 128 .bInterfaceClass = USB_CLASS_AUDIO,
129 .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL 129 .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
130}, 130},
131{
132 USB_DEVICE(0x046d, 0x0990),
133 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
134 .vendor_name = "Logitech, Inc.",
135 .product_name = "QuickCam Pro 9000",
136 .ifnum = QUIRK_NO_INTERFACE
137 }
138},
131 139
132/* 140/*
133 * Yamaha devices 141 * Yamaha devices