aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-07-11 06:50:20 -0400
committerArnd Bergmann <arnd@arndb.de>2012-07-11 06:50:20 -0400
commit0dc19510430b20b3b2d6d1b9b796fd42fa2af64a (patch)
treea512cf400d74d72272ce6cf5c4d782538213d433
parentb52a2c472d7fcf215e31dffdd382651e1b99f138 (diff)
parentbd0a521e88aa7a06ae7aabaed7ae196ed4ad867a (diff)
Merge tag 'v3.5-rc6' into next/soc
Linux 3.5-rc6 Dependency for imx/soc changes
-rw-r--r--.mailmap1
-rw-r--r--Documentation/ABI/testing/sysfs-block-rssd21
-rw-r--r--Documentation/ABI/testing/sysfs-bus-iio31
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt.xml4
-rw-r--r--Documentation/DocBook/media/v4l/v4l2.xml2
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-create-bufs.xml5
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-dqevent.xml2
-rw-r--r--Documentation/arm/SPEAr/overview.txt2
-rw-r--r--Documentation/device-mapper/verity.txt131
-rw-r--r--Documentation/devicetree/bindings/input/fsl-mma8450.txt1
-rw-r--r--Documentation/devicetree/bindings/mfd/mc13xxx.txt4
-rw-r--r--Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt4
-rw-r--r--Documentation/devicetree/bindings/net/fsl-fec.txt2
-rw-r--r--Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt4
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt1
-rw-r--r--Documentation/hwmon/coretemp22
-rw-r--r--Documentation/prctl/no_new_privs.txt57
-rw-r--r--Documentation/stable_kernel_rules.txt6
-rw-r--r--Documentation/virtual/kvm/api.txt17
-rw-r--r--MAINTAINERS24
-rw-r--r--Makefile6
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/boot/dts/mmp2-brownstone.dts4
-rw-r--r--arch/arm/boot/dts/omap2.dtsi2
-rw-r--r--arch/arm/boot/dts/spear1310-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi2
-rw-r--r--arch/arm/boot/dts/spear1340-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi2
-rw-r--r--arch/arm/boot/dts/spear13xx.dtsi2
-rw-r--r--arch/arm/boot/dts/spear300-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear300.dtsi2
-rw-r--r--arch/arm/boot/dts/spear310-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear310.dtsi2
-rw-r--r--arch/arm/boot/dts/spear320-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear320.dtsi2
-rw-r--r--arch/arm/boot/dts/spear3xx.dtsi2
-rw-r--r--arch/arm/include/asm/atomic.h2
-rw-r--r--arch/arm/include/asm/domain.h18
-rw-r--r--arch/arm/include/asm/futex.h1
-rw-r--r--arch/arm/include/asm/hardware/sp810.h2
-rw-r--r--arch/arm/include/asm/thread_info.h5
-rw-r--r--arch/arm/kernel/entry-armv.S1
-rw-r--r--arch/arm/kernel/kprobes-test-arm.c4
-rw-r--r--arch/arm/kernel/kprobes-thumb.c2
-rw-r--r--arch/arm/kernel/perf_event.c2
-rw-r--r--arch/arm/kernel/ptrace.c3
-rw-r--r--arch/arm/kernel/signal.c46
-rw-r--r--arch/arm/kernel/signal.h2
-rw-r--r--arch/arm/kernel/traps.c2
-rw-r--r--arch/arm/kernel/vmlinux.lds.S2
-rw-r--r--arch/arm/mach-dove/include/mach/bridge-regs.h1
-rw-r--r--arch/arm/mach-dove/include/mach/dove.h1
-rw-r--r--arch/arm/mach-exynos/Kconfig8
-rw-r--r--arch/arm/mach-highbank/Makefile6
-rw-r--r--arch/arm/mach-highbank/core.h1
-rw-r--r--arch/arm/mach-highbank/highbank.c14
-rw-r--r--arch/arm/mach-highbank/smc.S27
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mach-imx/clk-imx1.c3
-rw-r--r--arch/arm/mach-imx/clk-imx21.c4
-rw-r--r--arch/arm/mach-imx/clk-imx25.c2
-rw-r--r--arch/arm/mach-imx/clk-imx27.c3
-rw-r--r--arch/arm/mach-imx/clk-imx31.c3
-rw-r--r--arch/arm/mach-imx/clk-imx35.c15
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c12
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c26
-rw-r--r--arch/arm/mach-imx/clk-pllv2.c93
-rw-r--r--arch/arm/mach-imx/crm-regs-imx5.h2
-rw-r--r--arch/arm/mach-imx/hotplug.c42
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c1
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c38
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c2
-rw-r--r--arch/arm/mach-imx/mm-imx3.c4
-rw-r--r--arch/arm/mach-imx/mm-imx5.c2
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c3
-rw-r--r--arch/arm/mach-kirkwood/common.c9
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h1
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio-pxa.h29
-rw-r--r--arch/arm/mach-mmp/irq.c7
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/bridge-regs.h1
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/mv78xx0.h2
-rw-r--r--arch/arm/mach-mxs/mach-apx4devkit.c11
-rw-r--r--arch/arm/mach-omap2/board-flash.c5
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c6
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c28
-rw-r--r--arch/arm/mach-omap2/board-overo.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c6
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c2
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c10
-rw-r--r--arch/arm/mach-omap2/cm.h11
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c4
-rw-r--r--arch/arm/mach-omap2/dsp.c3
-rw-r--r--arch/arm/mach-omap2/id.c11
-rw-r--r--arch/arm/mach-omap2/irq.c1
-rw-r--r--arch/arm/mach-omap2/mux.c4
-rw-r--r--arch/arm/mach-omap2/mux.h11
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c36
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c3
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c6
-rw-r--r--arch/arm/mach-omap2/pm34xx.c1
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c14
-rw-r--r--arch/arm/mach-omap2/serial.c67
-rw-r--r--arch/arm/mach-omap2/twl-common.c2
-rw-r--r--arch/arm/mach-omap2/usb-musb.c6
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c2
-rw-r--r--arch/arm/mach-orion5x/include/mach/bridge-regs.h2
-rw-r--r--arch/arm/mach-orion5x/include/mach/io.h22
-rw-r--r--arch/arm/mach-orion5x/include/mach/orion5x.h1
-rw-r--r--arch/arm/mach-pxa/hx4700.c15
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c1
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c1
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c1
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c3
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c8
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7779.c7
-rw-r--r--arch/arm/mach-shmobile/platsmp.c5
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/dma.h2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/generic.h2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/spear.h2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/timex.h2
-rw-r--r--arch/arm/mach-spear13xx/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-spear13xx/spear1310.c2
-rw-r--r--arch/arm/mach-spear13xx/spear1340.c2
-rw-r--r--arch/arm/mach-spear13xx/spear13xx.c2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/generic.h2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/misc_regs.h2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear.h2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/timex.h2
-rw-r--r--arch/arm/mach-spear3xx/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-spear3xx/spear300.c2
-rw-r--r--arch/arm/mach-spear3xx/spear310.c2
-rw-r--r--arch/arm/mach-spear3xx/spear320.c2
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c2
-rw-r--r--arch/arm/mach-spear6xx/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-spear6xx/include/mach/misc_regs.h2
-rw-r--r--arch/arm/mach-tegra/reset.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500.c54
-rw-r--r--arch/arm/mach-versatile/core.c19
-rw-r--r--arch/arm/mach-versatile/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-versatile/include/mach/io.h27
-rw-r--r--arch/arm/mach-versatile/pci.c19
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm/mm/mm.h2
-rw-r--r--arch/arm/mm/mmu.c74
-rw-r--r--arch/arm/net/bpf_jit_32.c5
-rw-r--r--arch/arm/net/bpf_jit_32.h4
-rw-r--r--arch/arm/plat-mxc/epit.c11
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx2_cam.h2
-rw-r--r--arch/arm/plat-mxc/time.c24
-rw-r--r--arch/arm/plat-omap/clock.c2
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h33
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h4
-rw-r--r--arch/arm/plat-orion/common.c2
-rw-r--r--arch/arm/plat-pxa/ssp.c1
-rw-r--r--arch/arm/plat-samsung/include/plat/map-s3c.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/watchdog-reset.h2
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-spear/include/plat/pl080.h2
-rw-r--r--arch/arm/plat-spear/include/plat/shirq.h2
-rw-r--r--arch/arm/plat-spear/include/plat/timex.h2
-rw-r--r--arch/arm/plat-spear/include/plat/uncompress.h2
-rw-r--r--arch/arm/plat-spear/pl080.c2
-rw-r--r--arch/arm/plat-spear/restart.c2
-rw-r--r--arch/arm/plat-spear/shirq.c2
-rw-r--r--arch/h8300/kernel/setup.c23
-rw-r--r--arch/h8300/mm/init.c17
-rw-r--r--arch/m68k/platform/coldfire/clk.c7
-rw-r--r--arch/powerpc/include/asm/hw_irq.h5
-rw-r--r--arch/powerpc/kernel/entry_64.S97
-rw-r--r--arch/powerpc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/prom_init.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv.c96
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S2
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/powerpc/net/bpf_jit_64.S2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c61
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c2
-rw-r--r--arch/powerpc/xmon/xmon.c2
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c4
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7343.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7366.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7723.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7734.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7757.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7786.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-shx3.c2
-rw-r--r--arch/sparc/kernel/vio.c2
-rw-r--r--arch/x86/ia32/ia32_signal.c2
-rw-r--r--arch/x86/include/asm/cpufeature.h2
-rw-r--r--arch/x86/include/asm/pgtable-3level.h30
-rw-r--r--arch/x86/kernel/acpi/boot.c27
-rw-r--r--arch/x86/kernel/cpu/mkcapflags.pl25
-rw-r--r--arch/x86/kernel/cpu/scattered.c2
-rw-r--r--arch/x86/kernel/kgdb.c8
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kvm/mmu.c3
-rw-r--r--arch/x86/lib/csum-wrappers_64.c2
-rw-r--r--arch/x86/platform/mrst/early_printk_mrst.c13
-rw-r--r--arch/xtensa/Makefile4
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S3
-rw-r--r--arch/xtensa/mm/init.c18
-rw-r--r--block/blk-cgroup.c9
-rw-r--r--block/blk-core.c25
-rw-r--r--block/blk-timeout.c41
-rw-r--r--block/cfq-iosched.c30
-rw-r--r--block/scsi_ioctl.c5
-rw-r--r--drivers/acpi/acpi_pad.c7
-rw-r--r--drivers/acpi/apei/apei-base.c17
-rw-r--r--drivers/acpi/apei/apei-internal.h9
-rw-r--r--drivers/acpi/apei/ghes.c6
-rw-r--r--drivers/acpi/processor_idle.c32
-rw-r--r--drivers/acpi/sysfs.c4
-rw-r--r--drivers/acpi/video.c2
-rw-r--r--drivers/ata/pata_arasan_cf.c4
-rw-r--r--drivers/base/dd.c2
-rw-r--r--drivers/base/power/main.c6
-rw-r--r--drivers/block/drbd/drbd_bitmap.c11
-rw-r--r--drivers/block/drbd/drbd_req.c66
-rw-r--r--drivers/block/floppy.c1
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c166
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h5
-rw-r--r--drivers/block/umem.c40
-rw-r--r--drivers/block/xen-blkback/common.h2
-rw-r--r--drivers/block/xen-blkfront.c58
-rw-r--r--drivers/bluetooth/ath3k.c3
-rw-r--r--drivers/bluetooth/btmrvl_drv.h2
-rw-r--r--drivers/bluetooth/btmrvl_main.c14
-rw-r--r--drivers/bluetooth/btmrvl_sdio.c8
-rw-r--r--drivers/bluetooth/btusb.c2
-rw-r--r--drivers/char/hw_random/atmel-rng.c2
-rw-r--r--drivers/clk/clk.c38
-rw-r--r--drivers/clk/mxs/clk-imx23.c12
-rw-r--r--drivers/clk/mxs/clk-imx28.c32
-rw-r--r--drivers/clk/spear/clk-aux-synth.c2
-rw-r--r--drivers/clk/spear/clk-frac-synth.c2
-rw-r--r--drivers/clk/spear/clk-gpt-synth.c2
-rw-r--r--drivers/clk/spear/clk-vco-pll.c2
-rw-r--r--drivers/clk/spear/clk.c2
-rw-r--r--drivers/clk/spear/clk.h2
-rw-r--r--drivers/clk/spear/spear1310_clock.c2
-rw-r--r--drivers/clk/spear/spear1340_clock.c2
-rw-r--r--drivers/clk/spear/spear3xx_clock.c2
-rw-r--r--drivers/clk/spear/spear6xx_clock.c4
-rw-r--r--drivers/dma/dw_dmac.c2
-rw-r--r--drivers/dma/imx-sdma.c6
-rw-r--r--drivers/dma/pl330.c30
-rw-r--r--drivers/edac/edac_mc.c2
-rw-r--r--drivers/edac/i7core_edac.c15
-rw-r--r--drivers/edac/mpc85xx_edac.c3
-rw-r--r--drivers/edac/sb_edac.c10
-rw-r--r--drivers/extcon/extcon-max8997.c5
-rw-r--r--drivers/extcon/extcon_class.c2
-rw-r--r--drivers/extcon/extcon_gpio.c2
-rw-r--r--drivers/gpu/drm/drm_edid.c29
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c37
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c1
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c5
-rw-r--r--drivers/gpu/drm/i915/intel_display.c18
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c60
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_prime.c23
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c10
-rw-r--r--drivers/gpu/drm/radeon/atombios_encoders.c4
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c3
-rw-r--r--drivers/gpu/drm/radeon/evergreen_hdmi.c3
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h1
-rw-r--r--drivers/gpu/drm/radeon/ni.c5
-rw-r--r--drivers/gpu/drm/radeon/r600.c1
-rw-r--r--drivers/gpu/drm/radeon/r600_audio.c2
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c42
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c7
-rw-r--r--drivers/gpu/drm/radeon/r600d.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_prime.c10
-rw-r--r--drivers/gpu/drm/radeon/rv770.c5
-rw-r--r--drivers/gpu/drm/radeon/rv770d.h3
-rw-r--r--drivers/gpu/drm/radeon/si.c4
-rw-r--r--drivers/gpu/drm/radeon/si_reg.h72
-rw-r--r--drivers/gpu/drm/sis/sis_drv.c2
-rw-r--r--drivers/gpu/drm/udl/udl_drv.c15
-rw-r--r--drivers/gpu/drm/udl/udl_main.c2
-rw-r--r--drivers/gpu/drm/via/via_map.c3
-rw-r--r--drivers/hid/Kconfig43
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/hid-logitech-dj.c38
-rw-r--r--drivers/hid/hid-magicmouse.c6
-rw-r--r--drivers/hid/usbhid/Kconfig8
-rw-r--r--drivers/hwmon/applesmc.c6
-rw-r--r--drivers/hwmon/coretemp.c37
-rw-r--r--drivers/hwmon/emc2103.c12
-rw-r--r--drivers/hwmon/jc42.c2
-rw-r--r--drivers/hwmon/lineage-pem.c2
-rw-r--r--drivers/hwmon/ltc4261.c2
-rw-r--r--drivers/hwmon/max16065.c2
-rw-r--r--drivers/iio/Kconfig3
-rw-r--r--drivers/iio/industrialio-core.c16
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma.h1
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_hw.c18
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_main.c63
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_sli.h5
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_verbs.c12
-rw-r--r--drivers/input/joystick/as5011.c5
-rw-r--r--drivers/input/keyboard/mcs_touchkey.c3
-rw-r--r--drivers/input/keyboard/mpr121_touchkey.c2
-rw-r--r--drivers/input/keyboard/qt1070.c3
-rw-r--r--drivers/input/keyboard/tca6416-keypad.c3
-rw-r--r--drivers/input/keyboard/tca8418_keypad.c2
-rw-r--r--drivers/input/keyboard/tnetv107x-keypad.c8
-rw-r--r--drivers/input/misc/ad714x.c8
-rw-r--r--drivers/input/misc/dm355evm_keys.c3
-rw-r--r--drivers/input/tablet/wacom_sys.c6
-rw-r--r--drivers/input/touchscreen/ad7879.c2
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c3
-rw-r--r--drivers/input/touchscreen/bu21013_ts.c3
-rw-r--r--drivers/input/touchscreen/cy8ctmg110_ts.c3
-rw-r--r--drivers/input/touchscreen/intel-mid-touch.c2
-rw-r--r--drivers/input/touchscreen/pixcir_i2c_ts.c2
-rw-r--r--drivers/input/touchscreen/tnetv107x-ts.c2
-rw-r--r--drivers/input/touchscreen/tsc2005.c3
-rw-r--r--drivers/leds/ledtrig-heartbeat.c16
-rw-r--r--drivers/md/dm-thin.c7
-rw-r--r--drivers/md/md.c8
-rw-r--r--drivers/md/multipath.c3
-rw-r--r--drivers/md/persistent-data/dm-space-map-checker.c54
-rw-r--r--drivers/md/persistent-data/dm-space-map-disk.c11
-rw-r--r--drivers/md/persistent-data/dm-transaction-manager.c11
-rw-r--r--drivers/md/raid1.c13
-rw-r--r--drivers/md/raid10.c26
-rw-r--r--drivers/md/raid5.c67
-rw-r--r--drivers/media/common/saa7146_fops.c5
-rw-r--r--drivers/media/dvb/frontends/cx24110.c4
-rw-r--r--drivers/media/dvb/frontends/cxd2820r_c.c2
-rw-r--r--drivers/media/dvb/frontends/lg2160.c2
-rw-r--r--drivers/media/dvb/siano/smsusb.c2
-rw-r--r--drivers/media/radio/radio-maxiradio.c2
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c2
-rw-r--r--drivers/media/radio/si470x/radio-si470x-usb.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c84
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c5
-rw-r--r--drivers/media/video/bt8xx/bttv.h1
-rw-r--r--drivers/media/video/bt8xx/bttvp.h1
-rw-r--r--drivers/media/video/bw-qcam.c47
-rw-r--r--drivers/media/video/cx18/cx18-driver.c10
-rw-r--r--drivers/media/video/cx18/cx18-driver.h2
-rw-r--r--drivers/media/video/cx18/cx18-firmware.c9
-rw-r--r--drivers/media/video/cx18/cx18-mailbox.c15
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c2
-rw-r--r--drivers/media/video/gspca/gspca.c4
-rw-r--r--drivers/media/video/gspca/ov534.c32
-rw-r--r--drivers/media/video/gspca/ov534_9.c1
-rw-r--r--drivers/media/video/gspca/pac7311.c2
-rw-r--r--drivers/media/video/gspca/sn9c20x.c24
-rw-r--r--drivers/media/video/gspca/sonixj.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c18
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h2
-rw-r--r--drivers/media/video/mem2mem_testdev.c50
-rw-r--r--drivers/media/video/mx2_camera.c52
-rw-r--r--drivers/media/video/pms.c1
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c2
-rw-r--r--drivers/media/video/s5p-mfc/regs-mfc.h5
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_dec.c4
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_enc.c12
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_opr.h4
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_shm.h3
-rw-r--r--drivers/media/video/smiapp/Kconfig2
-rw-r--r--drivers/media/video/smiapp/smiapp-core.c1
-rw-r--r--drivers/media/video/tuner-core.c2
-rw-r--r--drivers/media/video/v4l2-dev.c4
-rw-r--r--drivers/media/video/v4l2-ioctl.c1
-rw-r--r--drivers/media/video/vino.c4
-rw-r--r--drivers/media/video/vivi.c6
-rw-r--r--drivers/mfd/stmpe-i2c.c2
-rw-r--r--drivers/mfd/stmpe-spi.c4
-rw-r--r--drivers/misc/mei/interrupt.c2
-rw-r--r--drivers/misc/mei/main.c9
-rw-r--r--drivers/misc/mei/wd.c2
-rw-r--r--drivers/mmc/card/block.c14
-rw-r--r--drivers/mmc/core/mmc.c2
-rw-r--r--drivers/mmc/core/sd.c6
-rw-r--r--drivers/mmc/core/sdio.c6
-rw-r--r--drivers/mmc/host/atmel-mci-regs.h14
-rw-r--r--drivers/mmc/host/atmel-mci.c12
-rw-r--r--drivers/mmc/host/dw_mmc.c36
-rw-r--r--drivers/mmc/host/mmci.c19
-rw-r--r--drivers/mmc/host/mxs-mmc.c2
-rw-r--r--drivers/mmc/host/omap.c18
-rw-r--r--drivers/mmc/host/omap_hsmmc.c15
-rw-r--r--drivers/mmc/host/sdhci-s3c.c2
-rw-r--r--drivers/mmc/host/sdhci-spear.c4
-rw-r--r--drivers/mmc/host/sdhci.c4
-rw-r--r--drivers/mtd/mtdoops.c22
-rw-r--r--drivers/mtd/nand/cafe_nand.c2
-rw-r--r--drivers/mtd/nand/nand_base.c7
-rw-r--r--drivers/mtd/ubi/debug.c8
-rw-r--r--drivers/net/bonding/bond_procfs.c15
-rw-r--r--drivers/net/caif/caif_hsi.c5
-rw-r--r--drivers/net/can/c_can/c_can.c4
-rw-r--r--drivers/net/can/flexcan.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c8
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c54
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c12
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c2
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c10
-rw-r--r--drivers/net/ethernet/intel/Kconfig10
-rw-r--r--drivers/net/ethernet/intel/e1000e/defines.h1
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c75
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c2
-rw-r--r--drivers/net/ethernet/intel/igbvf/ethtool.c29
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h4
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c16
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c1
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c12
-rw-r--r--drivers/net/ethernet/ti/davinci_cpdma.c1
-rw-r--r--drivers/net/phy/micrel.c8
-rw-r--r--drivers/net/usb/ipheth.c5
-rw-r--r--drivers/net/usb/qmi_wwan.c87
-rw-r--r--drivers/net/usb/usbnet.c53
-rw-r--r--drivers/net/wireless/airo.c4
-rw-r--r--drivers/net/wireless/ath/ath.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c16
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c27
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c31
-rw-r--r--drivers/net/wireless/ath/key.c4
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c12
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c5
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.h7
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c25
-rw-r--r--drivers/net/wireless/mwifiex/ie.c1
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c6
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c9
-rw-r--r--drivers/net/wireless/mwifiex/txrx.c10
-rw-r--r--drivers/net/wireless/mwifiex/uap_cmd.c11
-rw-r--r--drivers/net/wireless/mwifiex/usb.c28
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c3
-rw-r--r--drivers/net/wireless/rndis_wlan.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c3
-rw-r--r--drivers/net/wireless/ti/wl1251/acx.c2
-rw-r--r--drivers/net/wireless/ti/wl1251/event.c3
-rw-r--r--drivers/net/wireless/ti/wl1251/spi.c4
-rw-r--r--drivers/net/wireless/ti/wlcore/Kconfig1
-rw-r--r--drivers/net/xen-netfront.c8
-rw-r--r--drivers/of/base.c30
-rw-r--r--drivers/of/platform.c1
-rw-r--r--drivers/oprofile/oprofile_perf.c2
-rw-r--r--drivers/pinctrl/pinctrl-mxs.c2
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c22
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.h2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1310.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1340.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear300.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear310.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear320.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear3xx.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear3xx.h2
-rw-r--r--drivers/regulator/ab8500.c22
-rw-r--r--drivers/regulator/db8500-prcmu.c40
-rw-r--r--drivers/regulator/palmas-regulator.c7
-rw-r--r--drivers/regulator/s5m8767.c2
-rw-r--r--drivers/regulator/tps65023-regulator.c2
-rw-r--r--drivers/regulator/tps6524x-regulator.c2
-rw-r--r--drivers/remoteproc/omap_remoteproc.c2
-rw-r--r--drivers/remoteproc/remoteproc_core.c10
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c35
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/spi/spi-omap2-mcspi.c3
-rw-r--r--drivers/staging/comedi/drivers.c5
-rw-r--r--drivers/staging/gdm72xx/netlink_k.c2
-rw-r--r--drivers/staging/iio/Documentation/device.txt2
-rw-r--r--drivers/staging/iio/adc/Kconfig1
-rw-r--r--drivers/staging/iio/adc/ad7606_core.c3
-rw-r--r--drivers/staging/media/lirc/lirc_serial.c6
-rw-r--r--drivers/staging/omapdrm/omap_fbdev.c10
-rw-r--r--drivers/staging/rtl8712/usb_intf.c2
-rw-r--r--drivers/target/tcm_fc/tfc_sess.c3
-rw-r--r--drivers/tty/serial/8250/8250.c2
-rw-r--r--drivers/tty/serial/amba-pl011.c45
-rw-r--r--drivers/tty/serial/serial_txx9.c2
-rw-r--r--drivers/usb/Makefile2
-rw-r--r--drivers/usb/dwc3/gadget.c3
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.h4
-rw-r--r--drivers/usb/gadget/lpc32xx_udc.c1
-rw-r--r--drivers/usb/musb/musb_host.c14
-rw-r--r--drivers/usb/otg/twl6030-usb.c15
-rw-r--r--drivers/usb/phy/Kconfig4
-rw-r--r--drivers/usb/serial/cp210x.c11
-rw-r--r--drivers/usb/serial/option.c8
-rw-r--r--drivers/usb/storage/scsiglue.c6
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/vhost/vhost.c3
-rw-r--r--drivers/watchdog/hpwdt.c4
-rw-r--r--drivers/watchdog/iTCO_wdt.c1
-rw-r--r--drivers/watchdog/sp805_wdt.c4
-rw-r--r--drivers/watchdog/watchdog_dev.c2
-rw-r--r--fs/btrfs/backref.c109
-rw-r--r--fs/btrfs/ctree.c60
-rw-r--r--fs/btrfs/ctree.h9
-rw-r--r--fs/btrfs/disk-io.c35
-rw-r--r--fs/btrfs/extent-tree.c11
-rw-r--r--fs/btrfs/extent_io.c14
-rw-r--r--fs/btrfs/file.c13
-rw-r--r--fs/btrfs/free-space-cache.c145
-rw-r--r--fs/btrfs/inode.c61
-rw-r--r--fs/btrfs/ioctl.h2
-rw-r--r--fs/btrfs/super.c4
-rw-r--r--fs/btrfs/tree-log.c6
-rw-r--r--fs/btrfs/volumes.c95
-rw-r--r--fs/btrfs/volumes.h3
-rw-r--r--fs/ceph/addr.c21
-rw-r--r--fs/cifs/connect.c41
-rw-r--r--fs/ecryptfs/kthread.c2
-rw-r--r--fs/ecryptfs/miscdev.c48
-rw-r--r--fs/exec.c2
-rw-r--r--fs/hfsplus/ioctl.c9
-rw-r--r--fs/hfsplus/wrapper.c2
-rw-r--r--fs/nfs/client.c1
-rw-r--r--fs/nfs/direct.c1
-rw-r--r--fs/nfs/idmap.c13
-rw-r--r--fs/nfs/inode.c2
-rw-r--r--fs/nfs/pnfs.c13
-rw-r--r--fs/nilfs2/gcinode.c2
-rw-r--r--fs/nilfs2/segment.c2
-rw-r--r--fs/ocfs2/dlmglue.c33
-rw-r--r--fs/ocfs2/extent_map.c2
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/quota_global.c2
-rw-r--r--fs/open.c6
-rw-r--r--fs/pstore/inode.c2
-rw-r--r--fs/pstore/platform.c34
-rw-r--r--fs/pstore/ram.c3
-rw-r--r--fs/pstore/ram_core.c27
-rw-r--r--fs/splice.c35
-rw-r--r--fs/ubifs/debug.c8
-rw-r--r--fs/ubifs/find.c4
-rw-r--r--fs/udf/super.c102
-rw-r--r--fs/xfs/xfs_alloc.c3
-rw-r--r--fs/xfs/xfs_aops.c11
-rw-r--r--fs/xfs/xfs_buf.c16
-rw-r--r--fs/xfs/xfs_inode_item.c17
-rw-r--r--fs/xfs/xfs_log.c77
-rw-r--r--fs/xfs/xfs_log_cil.c22
-rw-r--r--fs/xfs/xfs_log_priv.h46
-rw-r--r--fs/xfs/xfs_log_recover.c38
-rw-r--r--fs/xfs/xfs_mount.h4
-rw-r--r--fs/xfs/xfs_sync.c32
-rw-r--r--fs/xfs/xfs_trace.h18
-rw-r--r--include/asm-generic/bug.h19
-rw-r--r--include/asm-generic/pgtable.h10
-rw-r--r--include/drm/drm_pciids.h4
-rw-r--r--include/linux/aio.h1
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/compiler-gcc.h6
-rw-r--r--include/linux/input.h1
-rw-r--r--include/linux/irq.h2
-rw-r--r--include/linux/kmsg_dump.h45
-rw-r--r--include/linux/kvm_host.h4
-rw-r--r--include/linux/mm_types.h10
-rw-r--r--include/linux/mmc/sdhci-spear.h2
-rw-r--r--include/linux/mmc/sdio.h2
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/pata_arasan_cf_data.h2
-rw-r--r--include/linux/prctl.h2
-rw-r--r--include/linux/pstore_ram.h2
-rw-r--r--include/linux/pxa2xx_ssp.h2
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/spi/pxa2xx_spi.h2
-rw-r--r--include/linux/splice.h8
-rw-r--r--include/linux/vga_switcheroo.h6
-rw-r--r--include/linux/videodev2.h6
-rw-r--r--include/net/bluetooth/hci.h6
-rw-r--r--include/net/mac80211.h6
-rw-r--r--include/net/phonet/gprs.h2
-rw-r--r--include/net/sctp/structs.h4
-rw-r--r--include/net/sctp/tsnmap.h3
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/sound/tea575x-tuner.h3
-rw-r--r--kernel/cgroup.c13
-rw-r--r--kernel/events/core.c10
-rw-r--r--kernel/exit.c19
-rw-r--r--kernel/pid_namespace.c20
-rw-r--r--kernel/printk.c532
-rw-r--r--kernel/rcutree.c14
-rw-r--r--kernel/relay.c5
-rw-r--r--kernel/sys.c6
-rw-r--r--kernel/trace/trace.c6
-rw-r--r--lib/fault-inject.c4
-rw-r--r--mm/madvise.c18
-rw-r--r--mm/memblock.c48
-rw-r--r--mm/memcontrol.c6
-rw-r--r--mm/memory.c12
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/oom_kill.c17
-rw-r--r--mm/page_cgroup.c4
-rw-r--r--mm/pagewalk.c1
-rw-r--r--mm/percpu-vm.c1
-rw-r--r--mm/shmem.c3
-rw-r--r--net/9p/protocol.c2
-rw-r--r--net/9p/trans_virtio.c2
-rw-r--r--net/batman-adv/routing.c2
-rw-r--r--net/batman-adv/translation-table.c12
-rw-r--r--net/bluetooth/hci_event.c48
-rw-r--r--net/bluetooth/hidp/Kconfig2
-rw-r--r--net/bluetooth/l2cap_core.c21
-rw-r--r--net/bluetooth/mgmt.c20
-rw-r--r--net/bluetooth/smp.c11
-rw-r--r--net/bridge/br_if.c1
-rw-r--r--net/bridge/br_netlink.c2
-rw-r--r--net/bridge/br_private.h1
-rw-r--r--net/caif/caif_dev.c3
-rw-r--r--net/caif/caif_socket.c1
-rw-r--r--net/can/raw.c3
-rw-r--r--net/ceph/ceph_common.c7
-rw-r--r--net/ceph/messenger.c4
-rw-r--r--net/ceph/mon_client.c8
-rw-r--r--net/ceph/osd_client.c12
-rw-r--r--net/core/dev.c27
-rw-r--r--net/core/skbuff.c1
-rw-r--r--net/ipv6/ip6_fib.c4
-rw-r--r--net/ipv6/route.c41
-rw-r--r--net/ipv6/tcp_ipv6.c3
-rw-r--r--net/iucv/af_iucv.c1
-rw-r--r--net/l2tp/l2tp_eth.c45
-rw-r--r--net/mac80211/cfg.c3
-rw-r--r--net/mac80211/mlme.c15
-rw-r--r--net/mac80211/rx.c5
-rw-r--r--net/mac80211/sta_info.h5
-rw-r--r--net/mac802154/tx.c3
-rw-r--r--net/netfilter/ipset/ip_set_core.c12
-rw-r--r--net/netfilter/ipset/ip_set_hash_netiface.c32
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c14
-rw-r--r--net/netfilter/nfnetlink.c4
-rw-r--r--net/nfc/nci/ntf.c10
-rw-r--r--net/nfc/rawsock.c5
-rw-r--r--net/phonet/af_phonet.c4
-rw-r--r--net/phonet/datagram.c4
-rw-r--r--net/phonet/pep-gprs.c2
-rw-r--r--net/phonet/pep.c2
-rw-r--r--net/phonet/pn_dev.c4
-rw-r--r--net/phonet/pn_netlink.c4
-rw-r--r--net/phonet/socket.c4
-rw-r--r--net/phonet/sysctl.c2
-rw-r--r--net/sctp/associola.c1
-rw-r--r--net/sctp/output.c5
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/sm_make_chunk.c16
-rw-r--r--net/sctp/sm_sideeffect.c2
-rw-r--r--net/sctp/transport.c2
-rw-r--r--net/sctp/tsnmap.c6
-rw-r--r--net/sctp/ulpevent.c3
-rw-r--r--net/sctp/ulpqueue.c2
-rw-r--r--net/wireless/reg.c2
-rw-r--r--net/wireless/util.c2
-rwxr-xr-xscripts/get_maintainer.pl3
-rwxr-xr-x[-rw-r--r--]scripts/gfp-translate0
-rw-r--r--security/security.c1
-rw-r--r--sound/i2c/other/tea575x-tuner.c21
-rw-r--r--sound/pci/es1968.c2
-rw-r--r--sound/pci/fm801.c4
-rw-r--r--sound/pci/hda/Kconfig13
-rw-r--r--sound/pci/hda/hda_auto_parser.c1
-rw-r--r--sound/pci/hda/hda_auto_parser.h10
-rw-r--r--sound/pci/hda/hda_codec.c50
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_intel.c2
-rw-r--r--sound/pci/hda/patch_conexant.c6
-rw-r--r--sound/pci/hda/patch_realtek.c43
-rw-r--r--sound/pci/hda/patch_sigmatel.c7
-rw-r--r--sound/soc/codecs/tlv320aic3x.c4
-rw-r--r--sound/soc/codecs/tlv320aic3x.h1
-rw-r--r--sound/soc/codecs/wm2200.c1
-rw-r--r--sound/soc/codecs/wm8904.c26
-rw-r--r--sound/soc/codecs/wm8994.c3
-rw-r--r--sound/soc/codecs/wm8996.c8
-rw-r--r--sound/soc/pxa/pxa-ssp.c38
-rw-r--r--sound/soc/tegra/tegra_wm8903.c13
-rw-r--r--sound/usb/6fire/firmware.c2
-rw-r--r--sound/usb/mixer_maps.c8
-rw-r--r--sound/usb/pcm.c21
-rw-r--r--sound/usb/quirks-table.h30
-rw-r--r--tools/hv/hv_kvp_daemon.c10
-rw-r--r--tools/perf/builtin-stat.c8
-rw-r--r--tools/perf/util/header.c48
-rw-r--r--tools/perf/util/include/linux/bitops.h2
-rw-r--r--tools/perf/util/session.c10
-rw-r--r--tools/perf/util/session.h1
-rw-r--r--virt/kvm/assigned-dev.c4
-rw-r--r--virt/kvm/eventfd.c23
-rw-r--r--virt/kvm/kvm_main.c3
725 files changed, 5368 insertions, 3198 deletions
diff --git a/.mailmap b/.mailmap
index 2909c33bc54e..658003aa9446 100644
--- a/.mailmap
+++ b/.mailmap
@@ -111,6 +111,7 @@ Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
111Uwe Kleine-König <ukl@pengutronix.de> 111Uwe Kleine-König <ukl@pengutronix.de>
112Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> 112Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
113Valdis Kletnieks <Valdis.Kletnieks@vt.edu> 113Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
114Viresh Kumar <viresh.linux@gmail.com> <viresh.kumar@st.com>
114Takashi YOSHII <takashi.yoshii.zj@renesas.com> 115Takashi YOSHII <takashi.yoshii.zj@renesas.com>
115Yusuke Goda <goda.yusuke@renesas.com> 116Yusuke Goda <goda.yusuke@renesas.com>
116Gustavo Padovan <gustavo@las.ic.unicamp.br> 117Gustavo Padovan <gustavo@las.ic.unicamp.br>
diff --git a/Documentation/ABI/testing/sysfs-block-rssd b/Documentation/ABI/testing/sysfs-block-rssd
index 679ce3543122..beef30c046b0 100644
--- a/Documentation/ABI/testing/sysfs-block-rssd
+++ b/Documentation/ABI/testing/sysfs-block-rssd
@@ -1,26 +1,5 @@
1What: /sys/block/rssd*/registers
2Date: March 2012
3KernelVersion: 3.3
4Contact: Asai Thambi S P <asamymuthupa@micron.com>
5Description: This is a read-only file. Dumps below driver information and
6 hardware registers.
7 - S ACTive
8 - Command Issue
9 - Completed
10 - PORT IRQ STAT
11 - HOST IRQ STAT
12 - Allocated
13 - Commands in Q
14
15What: /sys/block/rssd*/status 1What: /sys/block/rssd*/status
16Date: April 2012 2Date: April 2012
17KernelVersion: 3.4 3KernelVersion: 3.4
18Contact: Asai Thambi S P <asamymuthupa@micron.com> 4Contact: Asai Thambi S P <asamymuthupa@micron.com>
19Description: This is a read-only file. Indicates the status of the device. 5Description: This is a read-only file. Indicates the status of the device.
20
21What: /sys/block/rssd*/flags
22Date: May 2012
23KernelVersion: 3.5
24Contact: Asai Thambi S P <asamymuthupa@micron.com>
25Description: This is a read-only file. Dumps the flags in port and driver
26 data structure
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index 5bc8a476c15e..cfedf63cce15 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -219,6 +219,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_scale
219What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale 219What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_supply_scale
220What: /sys/bus/iio/devices/iio:deviceX/in_voltage_scale 220What: /sys/bus/iio/devices/iio:deviceX/in_voltage_scale
221What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_scale 221What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_scale
222What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_scale
222What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale 223What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale
223What: /sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale 224What: /sys/bus/iio/devices/iio:deviceX/in_accel_peak_scale
224What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_scale 225What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_scale
@@ -273,6 +274,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_accel_scale_available
273What: /sys/.../iio:deviceX/in_voltageX_scale_available 274What: /sys/.../iio:deviceX/in_voltageX_scale_available
274What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available 275What: /sys/.../iio:deviceX/in_voltage-voltage_scale_available
275What: /sys/.../iio:deviceX/out_voltageX_scale_available 276What: /sys/.../iio:deviceX/out_voltageX_scale_available
277What: /sys/.../iio:deviceX/out_altvoltageX_scale_available
276What: /sys/.../iio:deviceX/in_capacitance_scale_available 278What: /sys/.../iio:deviceX/in_capacitance_scale_available
277KernelVersion: 2.635 279KernelVersion: 2.635
278Contact: linux-iio@vger.kernel.org 280Contact: linux-iio@vger.kernel.org
@@ -298,14 +300,19 @@ Description:
298 gives the 3dB frequency of the filter in Hz. 300 gives the 3dB frequency of the filter in Hz.
299 301
300What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_raw 302What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_raw
303What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_raw
301KernelVersion: 2.6.37 304KernelVersion: 2.6.37
302Contact: linux-iio@vger.kernel.org 305Contact: linux-iio@vger.kernel.org
303Description: 306Description:
304 Raw (unscaled, no bias etc.) output voltage for 307 Raw (unscaled, no bias etc.) output voltage for
305 channel Y. The number must always be specified and 308 channel Y. The number must always be specified and
306 unique if the output corresponds to a single channel. 309 unique if the output corresponds to a single channel.
310 While DAC like devices typically use out_voltage,
311 a continuous frequency generating device, such as
312 a DDS or PLL should use out_altvoltage.
307 313
308What: /sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw 314What: /sys/bus/iio/devices/iio:deviceX/out_voltageY&Z_raw
315What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY&Z_raw
309KernelVersion: 2.6.37 316KernelVersion: 2.6.37
310Contact: linux-iio@vger.kernel.org 317Contact: linux-iio@vger.kernel.org
311Description: 318Description:
@@ -316,6 +323,8 @@ Description:
316 323
317What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode 324What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown_mode
318What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode 325What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode
326What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown_mode
327What: /sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown_mode
319KernelVersion: 2.6.38 328KernelVersion: 2.6.38
320Contact: linux-iio@vger.kernel.org 329Contact: linux-iio@vger.kernel.org
321Description: 330Description:
@@ -330,6 +339,8 @@ Description:
330 339
331What: /sys/.../iio:deviceX/out_votlageY_powerdown_mode_available 340What: /sys/.../iio:deviceX/out_votlageY_powerdown_mode_available
332What: /sys/.../iio:deviceX/out_voltage_powerdown_mode_available 341What: /sys/.../iio:deviceX/out_voltage_powerdown_mode_available
342What: /sys/.../iio:deviceX/out_altvotlageY_powerdown_mode_available
343What: /sys/.../iio:deviceX/out_altvoltage_powerdown_mode_available
333KernelVersion: 2.6.38 344KernelVersion: 2.6.38
334Contact: linux-iio@vger.kernel.org 345Contact: linux-iio@vger.kernel.org
335Description: 346Description:
@@ -338,6 +349,8 @@ Description:
338 349
339What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown 350What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown
340What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown 351What: /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown
352What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_powerdown
353What: /sys/bus/iio/devices/iio:deviceX/out_altvoltage_powerdown
341KernelVersion: 2.6.38 354KernelVersion: 2.6.38
342Contact: linux-iio@vger.kernel.org 355Contact: linux-iio@vger.kernel.org
343Description: 356Description:
@@ -346,6 +359,24 @@ Description:
346 normal operation. Y may be suppressed if all outputs are 359 normal operation. Y may be suppressed if all outputs are
347 controlled together. 360 controlled together.
348 361
362What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_frequency
363KernelVersion: 3.4.0
364Contact: linux-iio@vger.kernel.org
365Description:
366 Output frequency for channel Y in Hz. The number must always be
367 specified and unique if the output corresponds to a single
368 channel.
369
370What: /sys/bus/iio/devices/iio:deviceX/out_altvoltageY_phase
371KernelVersion: 3.4.0
372Contact: linux-iio@vger.kernel.org
373Description:
374 Phase in radians of one frequency/clock output Y
375 (out_altvoltageY) relative to another frequency/clock output
376 (out_altvoltageZ) of the device X. The number must always be
377 specified and unique if the output corresponds to a single
378 channel.
379
349What: /sys/bus/iio/devices/iio:deviceX/events 380What: /sys/bus/iio/devices/iio:deviceX/events
350KernelVersion: 2.6.35 381KernelVersion: 2.6.35
351Contact: linux-iio@vger.kernel.org 382Contact: linux-iio@vger.kernel.org
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml
index f5ac15ed0549..e58934c92895 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -986,13 +986,13 @@ http://www.thedirks.org/winnov/</ulink></para></entry>
986 <row id="V4L2-PIX-FMT-Y4"> 986 <row id="V4L2-PIX-FMT-Y4">
987 <entry><constant>V4L2_PIX_FMT_Y4</constant></entry> 987 <entry><constant>V4L2_PIX_FMT_Y4</constant></entry>
988 <entry>'Y04 '</entry> 988 <entry>'Y04 '</entry>
989 <entry>Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, 989 <entry>Old 4-bit greyscale format. Only the most significant 4 bits of each byte are used,
990the other bits are set to 0.</entry> 990the other bits are set to 0.</entry>
991 </row> 991 </row>
992 <row id="V4L2-PIX-FMT-Y6"> 992 <row id="V4L2-PIX-FMT-Y6">
993 <entry><constant>V4L2_PIX_FMT_Y6</constant></entry> 993 <entry><constant>V4L2_PIX_FMT_Y6</constant></entry>
994 <entry>'Y06 '</entry> 994 <entry>'Y06 '</entry>
995 <entry>Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, 995 <entry>Old 6-bit greyscale format. Only the most significant 6 bits of each byte are used,
996the other bits are set to 0.</entry> 996the other bits are set to 0.</entry>
997 </row> 997 </row>
998 </tbody> 998 </tbody>
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index 015c561754b7..008c2d73a484 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -560,6 +560,7 @@ and discussions on the V4L mailing list.</revremark>
560 &sub-g-tuner; 560 &sub-g-tuner;
561 &sub-log-status; 561 &sub-log-status;
562 &sub-overlay; 562 &sub-overlay;
563 &sub-prepare-buf;
563 &sub-qbuf; 564 &sub-qbuf;
564 &sub-querybuf; 565 &sub-querybuf;
565 &sub-querycap; 566 &sub-querycap;
@@ -567,7 +568,6 @@ and discussions on the V4L mailing list.</revremark>
567 &sub-query-dv-preset; 568 &sub-query-dv-preset;
568 &sub-query-dv-timings; 569 &sub-query-dv-timings;
569 &sub-querystd; 570 &sub-querystd;
570 &sub-prepare-buf;
571 &sub-reqbufs; 571 &sub-reqbufs;
572 &sub-s-hw-freq-seek; 572 &sub-s-hw-freq-seek;
573 &sub-streamon; 573 &sub-streamon;
diff --git a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
index 765549ff8a71..a2474ecb574a 100644
--- a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
@@ -108,10 +108,9 @@ information.</para>
108/></entry> 108/></entry>
109 </row> 109 </row>
110 <row> 110 <row>
111 <entry>__u32</entry> 111 <entry>struct&nbsp;v4l2_format</entry>
112 <entry><structfield>format</structfield></entry> 112 <entry><structfield>format</structfield></entry>
113 <entry>Filled in by the application, preserved by the driver. 113 <entry>Filled in by the application, preserved by the driver.</entry>
114 See <xref linkend="v4l2-format" />.</entry>
115 </row> 114 </row>
116 <row> 115 <row>
117 <entry>__u32</entry> 116 <entry>__u32</entry>
diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index e8714aa16433..98a856f9ec30 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -89,7 +89,7 @@
89 <row> 89 <row>
90 <entry></entry> 90 <entry></entry>
91 <entry>&v4l2-event-frame-sync;</entry> 91 <entry>&v4l2-event-frame-sync;</entry>
92 <entry><structfield>frame</structfield></entry> 92 <entry><structfield>frame_sync</structfield></entry>
93 <entry>Event data for event V4L2_EVENT_FRAME_SYNC.</entry> 93 <entry>Event data for event V4L2_EVENT_FRAME_SYNC.</entry>
94 </row> 94 </row>
95 <row> 95 <row>
diff --git a/Documentation/arm/SPEAr/overview.txt b/Documentation/arm/SPEAr/overview.txt
index 57aae7765c74..65610bf52ebf 100644
--- a/Documentation/arm/SPEAr/overview.txt
+++ b/Documentation/arm/SPEAr/overview.txt
@@ -60,4 +60,4 @@ Introduction
60 Document Author 60 Document Author
61 --------------- 61 ---------------
62 62
63 Viresh Kumar <viresh.kumar@st.com>, (c) 2010-2012 ST Microelectronics 63 Viresh Kumar <viresh.linux@gmail.com>, (c) 2010-2012 ST Microelectronics
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.txt
index 32e48797a14f..9884681535ee 100644
--- a/Documentation/device-mapper/verity.txt
+++ b/Documentation/device-mapper/verity.txt
@@ -7,39 +7,39 @@ This target is read-only.
7 7
8Construction Parameters 8Construction Parameters
9======================= 9=======================
10 <version> <dev> <hash_dev> <hash_start> 10 <version> <dev> <hash_dev>
11 <data_block_size> <hash_block_size> 11 <data_block_size> <hash_block_size>
12 <num_data_blocks> <hash_start_block> 12 <num_data_blocks> <hash_start_block>
13 <algorithm> <digest> <salt> 13 <algorithm> <digest> <salt>
14 14
15<version> 15<version>
16 This is the version number of the on-disk format. 16 This is the type of the on-disk hash format.
17 17
18 0 is the original format used in the Chromium OS. 18 0 is the original format used in the Chromium OS.
19 The salt is appended when hashing, digests are stored continuously and 19 The salt is appended when hashing, digests are stored continuously and
20 the rest of the block is padded with zeros. 20 the rest of the block is padded with zeros.
21 21
22 1 is the current format that should be used for new devices. 22 1 is the current format that should be used for new devices.
23 The salt is prepended when hashing and each digest is 23 The salt is prepended when hashing and each digest is
24 padded with zeros to the power of two. 24 padded with zeros to the power of two.
25 25
26<dev> 26<dev>
27 This is the device containing the data the integrity of which needs to be 27 This is the device containing data, the integrity of which needs to be
28 checked. It may be specified as a path, like /dev/sdaX, or a device number, 28 checked. It may be specified as a path, like /dev/sdaX, or a device number,
29 <major>:<minor>. 29 <major>:<minor>.
30 30
31<hash_dev> 31<hash_dev>
32 This is the device that that supplies the hash tree data. It may be 32 This is the device that supplies the hash tree data. It may be
33 specified similarly to the device path and may be the same device. If the 33 specified similarly to the device path and may be the same device. If the
34 same device is used, the hash_start should be outside of the dm-verity 34 same device is used, the hash_start should be outside the configured
35 configured device size. 35 dm-verity device.
36 36
37<data_block_size> 37<data_block_size>
38 The block size on a data device. Each block corresponds to one digest on 38 The block size on a data device in bytes.
39 the hash device. 39 Each block corresponds to one digest on the hash device.
40 40
41<hash_block_size> 41<hash_block_size>
42 The size of a hash block. 42 The size of a hash block in bytes.
43 43
44<num_data_blocks> 44<num_data_blocks>
45 The number of data blocks on the data device. Additional blocks are 45 The number of data blocks on the data device. Additional blocks are
@@ -65,7 +65,7 @@ Construction Parameters
65Theory of operation 65Theory of operation
66=================== 66===================
67 67
68dm-verity is meant to be setup as part of a verified boot path. This 68dm-verity is meant to be set up as part of a verified boot path. This
69may be anything ranging from a boot using tboot or trustedgrub to just 69may be anything ranging from a boot using tboot or trustedgrub to just
70booting from a known-good device (like a USB drive or CD). 70booting from a known-good device (like a USB drive or CD).
71 71
@@ -73,20 +73,20 @@ When a dm-verity device is configured, it is expected that the caller
73has been authenticated in some way (cryptographic signatures, etc). 73has been authenticated in some way (cryptographic signatures, etc).
74After instantiation, all hashes will be verified on-demand during 74After instantiation, all hashes will be verified on-demand during
75disk access. If they cannot be verified up to the root node of the 75disk access. If they cannot be verified up to the root node of the
76tree, the root hash, then the I/O will fail. This should identify 76tree, the root hash, then the I/O will fail. This should detect
77tampering with any data on the device and the hash data. 77tampering with any data on the device and the hash data.
78 78
79Cryptographic hashes are used to assert the integrity of the device on a 79Cryptographic hashes are used to assert the integrity of the device on a
80per-block basis. This allows for a lightweight hash computation on first read 80per-block basis. This allows for a lightweight hash computation on first read
81into the page cache. Block hashes are stored linearly-aligned to the nearest 81into the page cache. Block hashes are stored linearly, aligned to the nearest
82block the size of a page. 82block size.
83 83
84Hash Tree 84Hash Tree
85--------- 85---------
86 86
87Each node in the tree is a cryptographic hash. If it is a leaf node, the hash 87Each node in the tree is a cryptographic hash. If it is a leaf node, the hash
88is of some block data on disk. If it is an intermediary node, then the hash is 88of some data block on disk is calculated. If it is an intermediary node,
89of a number of child nodes. 89the hash of a number of child nodes is calculated.
90 90
91Each entry in the tree is a collection of neighboring nodes that fit in one 91Each entry in the tree is a collection of neighboring nodes that fit in one
92block. The number is determined based on block_size and the size of the 92block. The number is determined based on block_size and the size of the
@@ -110,63 +110,23 @@ alg = sha256, num_blocks = 32768, block_size = 4096
110On-disk format 110On-disk format
111============== 111==============
112 112
113Below is the recommended on-disk format. The verity kernel code does not 113The verity kernel code does not read the verity metadata on-disk header.
114read the on-disk header. It only reads the hash blocks which directly 114It only reads the hash blocks which directly follow the header.
115follow the header. It is expected that a user-space tool will verify the 115It is expected that a user-space tool will verify the integrity of the
116integrity of the verity_header and then call dmsetup with the correct 116verity header.
117parameters. Alternatively, the header can be omitted and the dmsetup
118parameters can be passed via the kernel command-line in a rooted chain
119of trust where the command-line is verified.
120 117
121The on-disk format is especially useful in cases where the hash blocks 118Alternatively, the header can be omitted and the dmsetup parameters can
122are on a separate partition. The magic number allows easy identification 119be passed via the kernel command-line in a rooted chain of trust where
123of the partition contents. Alternatively, the hash blocks can be stored 120the command-line is verified.
124in the same partition as the data to be verified. In such a configuration
125the filesystem on the partition would be sized a little smaller than
126the full-partition, leaving room for the hash blocks.
127
128struct superblock {
129 uint8_t signature[8]
130 "verity\0\0";
131
132 uint8_t version;
133 1 - current format
134
135 uint8_t data_block_bits;
136 log2(data block size)
137
138 uint8_t hash_block_bits;
139 log2(hash block size)
140
141 uint8_t pad1[1];
142 zero padding
143
144 uint16_t salt_size;
145 big-endian salt size
146
147 uint8_t pad2[2];
148 zero padding
149
150 uint32_t data_blocks_hi;
151 big-endian high 32 bits of the 64-bit number of data blocks
152
153 uint32_t data_blocks_lo;
154 big-endian low 32 bits of the 64-bit number of data blocks
155
156 uint8_t algorithm[16];
157 cryptographic algorithm
158
159 uint8_t salt[384];
160 salt (the salt size is specified above)
161
162 uint8_t pad3[88];
163 zero padding to 512-byte boundary
164}
165 121
166Directly following the header (and with sector number padded to the next hash 122Directly following the header (and with sector number padded to the next hash
167block boundary) are the hash blocks which are stored a depth at a time 123block boundary) are the hash blocks which are stored a depth at a time
168(starting from the root), sorted in order of increasing index. 124(starting from the root), sorted in order of increasing index.
169 125
126The full specification of kernel parameters and on-disk metadata format
127is available at the cryptsetup project's wiki page
128 http://code.google.com/p/cryptsetup/wiki/DMVerity
129
170Status 130Status
171====== 131======
172V (for Valid) is returned if every check performed so far was valid. 132V (for Valid) is returned if every check performed so far was valid.
@@ -174,21 +134,22 @@ If any check failed, C (for Corruption) is returned.
174 134
175Example 135Example
176======= 136=======
177 137Set up a device:
178Setup a device: 138 # dmsetup create vroot --readonly --table \
179 dmsetup create vroot --table \ 139 "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\
180 "0 2097152 "\
181 "verity 1 /dev/sda1 /dev/sda2 4096 4096 2097152 1 "\
182 "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ 140 "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\
183 "1234000000000000000000000000000000000000000000000000000000000000" 141 "1234000000000000000000000000000000000000000000000000000000000000"
184 142
185A command line tool veritysetup is available to compute or verify 143A command line tool veritysetup is available to compute or verify
186the hash tree or activate the kernel driver. This is available from 144the hash tree or activate the kernel device. This is available from
187the LVM2 upstream repository and may be supplied as a package called 145the cryptsetup upstream repository http://code.google.com/p/cryptsetup/
188device-mapper-verity-tools: 146(as a libcryptsetup extension).
189 git://sources.redhat.com/git/lvm2 147
190 http://sourceware.org/git/?p=lvm2.git 148Create hash on the device:
191 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/verity?cvsroot=lvm2 149 # veritysetup format /dev/sda1 /dev/sda2
192 150 ...
193veritysetup -a vroot /dev/sda1 /dev/sda2 \ 151 Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
194 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 152
153Activate the device:
154 # veritysetup create vroot /dev/sda1 /dev/sda2 \
155 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
diff --git a/Documentation/devicetree/bindings/input/fsl-mma8450.txt b/Documentation/devicetree/bindings/input/fsl-mma8450.txt
index a00c94ccbdee..0b96e5737d3a 100644
--- a/Documentation/devicetree/bindings/input/fsl-mma8450.txt
+++ b/Documentation/devicetree/bindings/input/fsl-mma8450.txt
@@ -2,6 +2,7 @@
2 2
3Required properties: 3Required properties:
4- compatible : "fsl,mma8450". 4- compatible : "fsl,mma8450".
5- reg: the I2C address of MMA8450
5 6
6Example: 7Example:
7 8
diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
index 19f6af47a792..baf07987ae68 100644
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
@@ -46,8 +46,8 @@ Examples:
46 46
47ecspi@70010000 { /* ECSPI1 */ 47ecspi@70010000 { /* ECSPI1 */
48 fsl,spi-num-chipselects = <2>; 48 fsl,spi-num-chipselects = <2>;
49 cs-gpios = <&gpio3 24 0>, /* GPIO4_24 */ 49 cs-gpios = <&gpio4 24 0>, /* GPIO4_24 */
50 <&gpio3 25 0>; /* GPIO4_25 */ 50 <&gpio4 25 0>; /* GPIO4_25 */
51 status = "okay"; 51 status = "okay";
52 52
53 pmic: mc13892@0 { 53 pmic: mc13892@0 {
diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
index c7e404b3ef05..fea541ee8b34 100644
--- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
+++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
@@ -29,6 +29,6 @@ esdhc@70008000 {
29 compatible = "fsl,imx51-esdhc"; 29 compatible = "fsl,imx51-esdhc";
30 reg = <0x70008000 0x4000>; 30 reg = <0x70008000 0x4000>;
31 interrupts = <2>; 31 interrupts = <2>;
32 cd-gpios = <&gpio0 6 0>; /* GPIO1_6 */ 32 cd-gpios = <&gpio1 6 0>; /* GPIO1_6 */
33 wp-gpios = <&gpio0 5 0>; /* GPIO1_5 */ 33 wp-gpios = <&gpio1 5 0>; /* GPIO1_5 */
34}; 34};
diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt
index 7ab9e1a2d8be..4616fc28ee86 100644
--- a/Documentation/devicetree/bindings/net/fsl-fec.txt
+++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
@@ -19,6 +19,6 @@ ethernet@83fec000 {
19 reg = <0x83fec000 0x4000>; 19 reg = <0x83fec000 0x4000>;
20 interrupts = <87>; 20 interrupts = <87>;
21 phy-mode = "mii"; 21 phy-mode = "mii";
22 phy-reset-gpios = <&gpio1 14 0>; /* GPIO2_14 */ 22 phy-reset-gpios = <&gpio2 14 0>; /* GPIO2_14 */
23 local-mac-address = [00 04 9F 01 1B B9]; 23 local-mac-address = [00 04 9F 01 1B B9];
24}; 24};
diff --git a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt
index 9841057d112b..4256a6df9b79 100644
--- a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt
+++ b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt
@@ -17,6 +17,6 @@ ecspi@70010000 {
17 reg = <0x70010000 0x4000>; 17 reg = <0x70010000 0x4000>;
18 interrupts = <36>; 18 interrupts = <36>;
19 fsl,spi-num-chipselects = <2>; 19 fsl,spi-num-chipselects = <2>;
20 cs-gpios = <&gpio3 24 0>, /* GPIO4_24 */ 20 cs-gpios = <&gpio3 24 0>, /* GPIO3_24 */
21 <&gpio3 25 0>; /* GPIO4_25 */ 21 <&gpio3 25 0>; /* GPIO3_25 */
22}; 22};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 6eab91747a86..db4d3af3643c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -3,6 +3,7 @@ Device tree binding vendor prefix registry. Keep list in alphabetical order.
3This isn't an exhaustive list, but you should add new prefixes to it before 3This isn't an exhaustive list, but you should add new prefixes to it before
4using them to avoid name-space collisions. 4using them to avoid name-space collisions.
5 5
6ad Avionic Design GmbH
6adi Analog Devices, Inc. 7adi Analog Devices, Inc.
7amcc Applied Micro Circuits Corporation (APM, formally AMCC) 8amcc Applied Micro Circuits Corporation (APM, formally AMCC)
8apm Applied Micro Circuits Corporation (APM) 9apm Applied Micro Circuits Corporation (APM)
diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index 84d46c0c71a3..c86b50c03ea8 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -6,7 +6,9 @@ Supported chips:
6 Prefix: 'coretemp' 6 Prefix: 'coretemp'
7 CPUID: family 0x6, models 0xe (Pentium M DC), 0xf (Core 2 DC 65nm), 7 CPUID: family 0x6, models 0xe (Pentium M DC), 0xf (Core 2 DC 65nm),
8 0x16 (Core 2 SC 65nm), 0x17 (Penryn 45nm), 8 0x16 (Core 2 SC 65nm), 0x17 (Penryn 45nm),
9 0x1a (Nehalem), 0x1c (Atom), 0x1e (Lynnfield) 9 0x1a (Nehalem), 0x1c (Atom), 0x1e (Lynnfield),
10 0x26 (Tunnel Creek Atom), 0x27 (Medfield Atom),
11 0x36 (Cedar Trail Atom)
10 Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual 12 Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual
11 Volume 3A: System Programming Guide 13 Volume 3A: System Programming Guide
12 http://softwarecommunity.intel.com/Wiki/Mobility/720.htm 14 http://softwarecommunity.intel.com/Wiki/Mobility/720.htm
@@ -52,6 +54,17 @@ Some information comes from ark.intel.com
52 54
53Process Processor TjMax(C) 55Process Processor TjMax(C)
54 56
5722nm Core i5/i7 Processors
58 i7 3920XM, 3820QM, 3720QM, 3667U, 3520M 105
59 i5 3427U, 3360M/3320M 105
60 i7 3770/3770K 105
61 i5 3570/3570K, 3550, 3470/3450 105
62 i7 3770S 103
63 i5 3570S/3550S, 3475S/3470S/3450S 103
64 i7 3770T 94
65 i5 3570T 94
66 i5 3470T 91
67
5532nm Core i3/i5/i7 Processors 6832nm Core i3/i5/i7 Processors
56 i7 660UM/640/620, 640LM/620, 620M, 610E 105 69 i7 660UM/640/620, 640LM/620, 620M, 610E 105
57 i5 540UM/520/430, 540M/520/450/430 105 70 i5 540UM/520/430, 540M/520/450/430 105
@@ -65,6 +78,11 @@ Process Processor TjMax(C)
65 U3400 105 78 U3400 105
66 P4505/P4500 90 79 P4505/P4500 90
67 80
8132nm Atom Processors
82 Z2460 90
83 D2700/2550/2500 100
84 N2850/2800/2650/2600 100
85
6845nm Xeon Processors 5400 Quad-Core 8645nm Xeon Processors 5400 Quad-Core
69 X5492, X5482, X5472, X5470, X5460, X5450 85 87 X5492, X5482, X5472, X5470, X5460, X5450 85
70 E5472, E5462, E5450/40/30/20/10/05 85 88 E5472, E5462, E5450/40/30/20/10/05 85
@@ -85,6 +103,8 @@ Process Processor TjMax(C)
85 N475/470/455/450 100 103 N475/470/455/450 100
86 N280/270 90 104 N280/270 90
87 330/230 125 105 330/230 125
106 E680/660/640/620 90
107 E680T/660T/640T/620T 110
88 108
8945nm Core2 Processors 10945nm Core2 Processors
90 Solo ULV SU3500/3300 100 110 Solo ULV SU3500/3300 100
diff --git a/Documentation/prctl/no_new_privs.txt b/Documentation/prctl/no_new_privs.txt
new file mode 100644
index 000000000000..f7be84fba910
--- /dev/null
+++ b/Documentation/prctl/no_new_privs.txt
@@ -0,0 +1,57 @@
1The execve system call can grant a newly-started program privileges that
2its parent did not have. The most obvious examples are setuid/setgid
3programs and file capabilities. To prevent the parent program from
4gaining these privileges as well, the kernel and user code must be
5careful to prevent the parent from doing anything that could subvert the
6child. For example:
7
8 - The dynamic loader handles LD_* environment variables differently if
9 a program is setuid.
10
11 - chroot is disallowed to unprivileged processes, since it would allow
12 /etc/passwd to be replaced from the point of view of a process that
13 inherited chroot.
14
15 - The exec code has special handling for ptrace.
16
17These are all ad-hoc fixes. The no_new_privs bit (since Linux 3.5) is a
18new, generic mechanism to make it safe for a process to modify its
19execution environment in a manner that persists across execve. Any task
20can set no_new_privs. Once the bit is set, it is inherited across fork,
21clone, and execve and cannot be unset. With no_new_privs set, execve
22promises not to grant the privilege to do anything that could not have
23been done without the execve call. For example, the setuid and setgid
24bits will no longer change the uid or gid; file capabilities will not
25add to the permitted set, and LSMs will not relax constraints after
26execve.
27
28To set no_new_privs, use prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0).
29
30Be careful, though: LSMs might also not tighten constraints on exec
31in no_new_privs mode. (This means that setting up a general-purpose
32service launcher to set no_new_privs before execing daemons may
33interfere with LSM-based sandboxing.)
34
35Note that no_new_privs does not prevent privilege changes that do not
36involve execve. An appropriately privileged task can still call
37setuid(2) and receive SCM_RIGHTS datagrams.
38
39There are two main use cases for no_new_privs so far:
40
41 - Filters installed for the seccomp mode 2 sandbox persist across
42 execve and can change the behavior of newly-executed programs.
43 Unprivileged users are therefore only allowed to install such filters
44 if no_new_privs is set.
45
46 - By itself, no_new_privs can be used to reduce the attack surface
47 available to an unprivileged user. If everything running with a
48 given uid has no_new_privs set, then that uid will be unable to
49 escalate its privileges by directly attacking setuid, setgid, and
50 fcap-using binaries; it will need to compromise something without the
51 no_new_privs bit set first.
52
53In the future, other potentially dangerous kernel features could become
54available to unprivileged tasks if no_new_privs is set. In principle,
55several options to unshare(2) and clone(2) would be safe when
56no_new_privs is set, and no_new_privs + chroot is considerable less
57dangerous than chroot by itself.
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index f0ab5cf28fca..4a7b54bd37e8 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -12,6 +12,12 @@ Rules on what kind of patches are accepted, and which ones are not, into the
12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real 12 marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
13 security issue, or some "oh, that's not good" issue. In short, something 13 security issue, or some "oh, that's not good" issue. In short, something
14 critical. 14 critical.
15 - Serious issues as reported by a user of a distribution kernel may also
16 be considered if they fix a notable performance or interactivity issue.
17 As these fixes are not as obvious and have a higher risk of a subtle
18 regression they should only be submitted by a distribution kernel
19 maintainer and include an addendum linking to a bugzilla entry if it
20 exists and additional information on the user-visible impact.
15 - New device IDs and quirks are also accepted. 21 - New device IDs and quirks are also accepted.
16 - No "theoretical race condition" issues, unless an explanation of how the 22 - No "theoretical race condition" issues, unless an explanation of how the
17 race can be exploited is also provided. 23 race can be exploited is also provided.
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 930126698a0f..2c9948379469 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1930,6 +1930,23 @@ The "pte_enc" field provides a value that can OR'ed into the hash
1930PTE's RPN field (ie, it needs to be shifted left by 12 to OR it 1930PTE's RPN field (ie, it needs to be shifted left by 12 to OR it
1931into the hash PTE second double word). 1931into the hash PTE second double word).
1932 1932
19334.75 KVM_IRQFD
1934
1935Capability: KVM_CAP_IRQFD
1936Architectures: x86
1937Type: vm ioctl
1938Parameters: struct kvm_irqfd (in)
1939Returns: 0 on success, -1 on error
1940
1941Allows setting an eventfd to directly trigger a guest interrupt.
1942kvm_irqfd.fd specifies the file descriptor to use as the eventfd and
1943kvm_irqfd.gsi specifies the irqchip pin toggled by this event. When
1944an event is tiggered on the eventfd, an interrupt is injected into
1945the guest using the specified gsi pin. The irqfd is removed using
1946the KVM_IRQFD_FLAG_DEASSIGN flag, specifying both kvm_irqfd.fd
1947and kvm_irqfd.gsi.
1948
1949
19335. The kvm_run structure 19505. The kvm_run structure
1934------------------------ 1951------------------------
1935 1952
diff --git a/MAINTAINERS b/MAINTAINERS
index 3e30a3afe2a4..03df1d15ebf3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -579,7 +579,7 @@ F: drivers/net/appletalk/
579F: net/appletalk/ 579F: net/appletalk/
580 580
581ARASAN COMPACT FLASH PATA CONTROLLER 581ARASAN COMPACT FLASH PATA CONTROLLER
582M: Viresh Kumar <viresh.kumar@st.com> 582M: Viresh Kumar <viresh.linux@gmail.com>
583L: linux-ide@vger.kernel.org 583L: linux-ide@vger.kernel.org
584S: Maintained 584S: Maintained
585F: include/linux/pata_arasan_cf_data.h 585F: include/linux/pata_arasan_cf_data.h
@@ -4654,8 +4654,8 @@ L: netfilter@vger.kernel.org
4654L: coreteam@netfilter.org 4654L: coreteam@netfilter.org
4655W: http://www.netfilter.org/ 4655W: http://www.netfilter.org/
4656W: http://www.iptables.org/ 4656W: http://www.iptables.org/
4657T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-2.6.git 4657T: git git://1984.lsi.us.es/nf
4658T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next-2.6.git 4658T: git git://1984.lsi.us.es/nf-next
4659S: Supported 4659S: Supported
4660F: include/linux/netfilter* 4660F: include/linux/netfilter*
4661F: include/linux/netfilter/ 4661F: include/linux/netfilter/
@@ -5296,7 +5296,7 @@ S: Maintained
5296F: drivers/pinctrl/ 5296F: drivers/pinctrl/
5297 5297
5298PIN CONTROLLER - ST SPEAR 5298PIN CONTROLLER - ST SPEAR
5299M: Viresh Kumar <viresh.kumar@st.com> 5299M: Viresh Kumar <viresh.linux@gmail.com>
5300L: spear-devel@list.st.com 5300L: spear-devel@list.st.com
5301L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 5301L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
5302W: http://www.st.com/spear 5302W: http://www.st.com/spear
@@ -5873,7 +5873,7 @@ S: Maintained
5873F: drivers/tty/serial 5873F: drivers/tty/serial
5874 5874
5875SYNOPSYS DESIGNWARE DMAC DRIVER 5875SYNOPSYS DESIGNWARE DMAC DRIVER
5876M: Viresh Kumar <viresh.kumar@st.com> 5876M: Viresh Kumar <viresh.linux@gmail.com>
5877S: Maintained 5877S: Maintained
5878F: include/linux/dw_dmac.h 5878F: include/linux/dw_dmac.h
5879F: drivers/dma/dw_dmac_regs.h 5879F: drivers/dma/dw_dmac_regs.h
@@ -6021,7 +6021,7 @@ S: Maintained
6021F: drivers/mmc/host/sdhci-s3c.c 6021F: drivers/mmc/host/sdhci-s3c.c
6022 6022
6023SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER 6023SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER
6024M: Viresh Kumar <viresh.kumar@st.com> 6024M: Viresh Kumar <viresh.linux@gmail.com>
6025L: spear-devel@list.st.com 6025L: spear-devel@list.st.com
6026L: linux-mmc@vger.kernel.org 6026L: linux-mmc@vger.kernel.org
6027S: Maintained 6027S: Maintained
@@ -6377,7 +6377,7 @@ S: Maintained
6377F: include/linux/compiler.h 6377F: include/linux/compiler.h
6378 6378
6379SPEAR PLATFORM SUPPORT 6379SPEAR PLATFORM SUPPORT
6380M: Viresh Kumar <viresh.kumar@st.com> 6380M: Viresh Kumar <viresh.linux@gmail.com>
6381M: Shiraz Hashim <shiraz.hashim@st.com> 6381M: Shiraz Hashim <shiraz.hashim@st.com>
6382L: spear-devel@list.st.com 6382L: spear-devel@list.st.com
6383L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6383L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -6386,7 +6386,7 @@ S: Maintained
6386F: arch/arm/plat-spear/ 6386F: arch/arm/plat-spear/
6387 6387
6388SPEAR13XX MACHINE SUPPORT 6388SPEAR13XX MACHINE SUPPORT
6389M: Viresh Kumar <viresh.kumar@st.com> 6389M: Viresh Kumar <viresh.linux@gmail.com>
6390M: Shiraz Hashim <shiraz.hashim@st.com> 6390M: Shiraz Hashim <shiraz.hashim@st.com>
6391L: spear-devel@list.st.com 6391L: spear-devel@list.st.com
6392L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6392L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -6395,7 +6395,7 @@ S: Maintained
6395F: arch/arm/mach-spear13xx/ 6395F: arch/arm/mach-spear13xx/
6396 6396
6397SPEAR3XX MACHINE SUPPORT 6397SPEAR3XX MACHINE SUPPORT
6398M: Viresh Kumar <viresh.kumar@st.com> 6398M: Viresh Kumar <viresh.linux@gmail.com>
6399M: Shiraz Hashim <shiraz.hashim@st.com> 6399M: Shiraz Hashim <shiraz.hashim@st.com>
6400L: spear-devel@list.st.com 6400L: spear-devel@list.st.com
6401L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6401L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -6406,7 +6406,7 @@ F: arch/arm/mach-spear3xx/
6406SPEAR6XX MACHINE SUPPORT 6406SPEAR6XX MACHINE SUPPORT
6407M: Rajeev Kumar <rajeev-dlh.kumar@st.com> 6407M: Rajeev Kumar <rajeev-dlh.kumar@st.com>
6408M: Shiraz Hashim <shiraz.hashim@st.com> 6408M: Shiraz Hashim <shiraz.hashim@st.com>
6409M: Viresh Kumar <viresh.kumar@st.com> 6409M: Viresh Kumar <viresh.linux@gmail.com>
6410L: spear-devel@list.st.com 6410L: spear-devel@list.st.com
6411L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6411L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
6412W: http://www.st.com/spear 6412W: http://www.st.com/spear
@@ -6414,7 +6414,7 @@ S: Maintained
6414F: arch/arm/mach-spear6xx/ 6414F: arch/arm/mach-spear6xx/
6415 6415
6416SPEAR CLOCK FRAMEWORK SUPPORT 6416SPEAR CLOCK FRAMEWORK SUPPORT
6417M: Viresh Kumar <viresh.kumar@st.com> 6417M: Viresh Kumar <viresh.linux@gmail.com>
6418L: spear-devel@list.st.com 6418L: spear-devel@list.st.com
6419L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6419L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
6420W: http://www.st.com/spear 6420W: http://www.st.com/spear
@@ -7421,7 +7421,7 @@ F: include/linux/vlynq.h
7421 7421
7422VME SUBSYSTEM 7422VME SUBSYSTEM
7423M: Martyn Welch <martyn.welch@ge.com> 7423M: Martyn Welch <martyn.welch@ge.com>
7424M: Manohar Vanga <manohar.vanga@cern.ch> 7424M: Manohar Vanga <manohar.vanga@gmail.com>
7425M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 7425M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7426L: devel@driverdev.osuosl.org 7426L: devel@driverdev.osuosl.org
7427S: Maintained 7427S: Maintained
diff --git a/Makefile b/Makefile
index b771af583389..bf02707a5e9b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 5 2PATCHLEVEL = 5
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc6
5NAME = Saber-toothed Squirrel 5NAME = Saber-toothed Squirrel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -561,6 +561,8 @@ else
561KBUILD_CFLAGS += -O2 561KBUILD_CFLAGS += -O2
562endif 562endif
563 563
564include $(srctree)/arch/$(SRCARCH)/Makefile
565
564ifdef CONFIG_READABLE_ASM 566ifdef CONFIG_READABLE_ASM
565# Disable optimizations that make assembler listings hard to read. 567# Disable optimizations that make assembler listings hard to read.
566# reorder blocks reorders the control in the function 568# reorder blocks reorders the control in the function
@@ -571,8 +573,6 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
571 $(call cc-option,-fno-partial-inlining) 573 $(call cc-option,-fno-partial-inlining)
572endif 574endif
573 575
574include $(srctree)/arch/$(SRCARCH)/Makefile
575
576ifneq ($(CONFIG_FRAME_WARN),0) 576ifneq ($(CONFIG_FRAME_WARN),0)
577KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) 577KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
578endif 578endif
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e86fe20b7d09..8b0b743b4fb1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -293,6 +293,7 @@ config ARCH_VERSATILE
293 select ICST 293 select ICST
294 select GENERIC_CLOCKEVENTS 294 select GENERIC_CLOCKEVENTS
295 select ARCH_WANT_OPTIONAL_GPIOLIB 295 select ARCH_WANT_OPTIONAL_GPIOLIB
296 select NEED_MACH_IO_H if PCI
296 select PLAT_VERSATILE 297 select PLAT_VERSATILE
297 select PLAT_VERSATILE_CLCD 298 select PLAT_VERSATILE_CLCD
298 select PLAT_VERSATILE_FPGA_IRQ 299 select PLAT_VERSATILE_FPGA_IRQ
@@ -588,6 +589,7 @@ config ARCH_ORION5X
588 select PCI 589 select PCI
589 select ARCH_REQUIRE_GPIOLIB 590 select ARCH_REQUIRE_GPIOLIB
590 select GENERIC_CLOCKEVENTS 591 select GENERIC_CLOCKEVENTS
592 select NEED_MACH_IO_H
591 select PLAT_ORION 593 select PLAT_ORION
592 help 594 help
593 Support for the following Marvell Orion 5x series SoCs: 595 Support for the following Marvell Orion 5x series SoCs:
diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
index 153a4b2d12b5..c9b4f27d191e 100644
--- a/arch/arm/boot/dts/mmp2-brownstone.dts
+++ b/arch/arm/boot/dts/mmp2-brownstone.dts
@@ -11,7 +11,7 @@
11/include/ "mmp2.dtsi" 11/include/ "mmp2.dtsi"
12 12
13/ { 13/ {
14 model = "Marvell MMP2 Aspenite Development Board"; 14 model = "Marvell MMP2 Brownstone Development Board";
15 compatible = "mrvl,mmp2-brownstone", "mrvl,mmp2"; 15 compatible = "mrvl,mmp2-brownstone", "mrvl,mmp2";
16 16
17 chosen { 17 chosen {
@@ -19,7 +19,7 @@
19 }; 19 };
20 20
21 memory { 21 memory {
22 reg = <0x00000000 0x04000000>; 22 reg = <0x00000000 0x08000000>;
23 }; 23 };
24 24
25 soc { 25 soc {
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index f2ab4ea7cc0e..581cb081cb0f 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -44,6 +44,8 @@
44 compatible = "ti,omap2-intc"; 44 compatible = "ti,omap2-intc";
45 interrupt-controller; 45 interrupt-controller;
46 #interrupt-cells = <1>; 46 #interrupt-cells = <1>;
47 ti,intc-size = <96>;
48 reg = <0x480FE000 0x1000>;
47 }; 49 };
48 50
49 uart1: serial@4806a000 { 51 uart1: serial@4806a000 {
diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts
index 8314e4171884..dd4358bc26e2 100644
--- a/arch/arm/boot/dts/spear1310-evb.dts
+++ b/arch/arm/boot/dts/spear1310-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr1310 Evaluation Baord 2 * DTS file for SPEAr1310 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 9e61da404d57..419ea7413d23 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr1310 SoCs 2 * DTS file for all SPEAr1310 SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts
index 0d8472e5ab9f..c9a54e06fb68 100644
--- a/arch/arm/boot/dts/spear1340-evb.dts
+++ b/arch/arm/boot/dts/spear1340-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr1340 Evaluation Baord 2 * DTS file for SPEAr1340 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index a26fc47a55e8..d71fe2a68f09 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr1340 SoCs 2 * DTS file for all SPEAr1340 SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi
index 1f8e1e1481df..10dcec7e7321 100644
--- a/arch/arm/boot/dts/spear13xx.dtsi
+++ b/arch/arm/boot/dts/spear13xx.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr13xx SoCs 2 * DTS file for all SPEAr13xx SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear300-evb.dts b/arch/arm/boot/dts/spear300-evb.dts
index fc82b1a26458..d71b8d581e3d 100644
--- a/arch/arm/boot/dts/spear300-evb.dts
+++ b/arch/arm/boot/dts/spear300-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr300 Evaluation Baord 2 * DTS file for SPEAr300 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear300.dtsi b/arch/arm/boot/dts/spear300.dtsi
index 01c5e358fdb2..ed3627c116cc 100644
--- a/arch/arm/boot/dts/spear300.dtsi
+++ b/arch/arm/boot/dts/spear300.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr300 SoC 2 * DTS file for SPEAr300 SoC
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear310-evb.dts b/arch/arm/boot/dts/spear310-evb.dts
index dc5e2d445a93..b00544e0cd5d 100644
--- a/arch/arm/boot/dts/spear310-evb.dts
+++ b/arch/arm/boot/dts/spear310-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr310 Evaluation Baord 2 * DTS file for SPEAr310 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index e47081c494d9..62fc4fb3e5f9 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr310 SoC 2 * DTS file for SPEAr310 SoC
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts
index 6308fa3bec1e..c13fd1f3b09f 100644
--- a/arch/arm/boot/dts/spear320-evb.dts
+++ b/arch/arm/boot/dts/spear320-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr320 Evaluation Baord 2 * DTS file for SPEAr320 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index 5372ca399b1f..1f49d69595a0 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr320 SoC 2 * DTS file for SPEAr320 SoC
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi
index 91072553963f..3a8bb5736928 100644
--- a/arch/arm/boot/dts/spear3xx.dtsi
+++ b/arch/arm/boot/dts/spear3xx.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr3xx SoCs 2 * DTS file for all SPEAr3xx SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com> 4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index 68374ba6a943..c79f61faa3a5 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -243,7 +243,7 @@ typedef struct {
243 243
244#define ATOMIC64_INIT(i) { (i) } 244#define ATOMIC64_INIT(i) { (i) }
245 245
246static inline u64 atomic64_read(atomic64_t *v) 246static inline u64 atomic64_read(const atomic64_t *v)
247{ 247{
248 u64 result; 248 u64 result;
249 249
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index 3d2220498abc..6ddbe446425e 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -60,13 +60,13 @@
60#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
61 61
62#ifdef CONFIG_CPU_USE_DOMAINS 62#ifdef CONFIG_CPU_USE_DOMAINS
63#define set_domain(x) \ 63static inline void set_domain(unsigned val)
64 do { \ 64{
65 __asm__ __volatile__( \ 65 asm volatile(
66 "mcr p15, 0, %0, c3, c0 @ set domain" \ 66 "mcr p15, 0, %0, c3, c0 @ set domain"
67 : : "r" (x)); \ 67 : : "r" (val));
68 isb(); \ 68 isb();
69 } while (0) 69}
70 70
71#define modify_domain(dom,type) \ 71#define modify_domain(dom,type) \
72 do { \ 72 do { \
@@ -78,8 +78,8 @@
78 } while (0) 78 } while (0)
79 79
80#else 80#else
81#define set_domain(x) do { } while (0) 81static inline void set_domain(unsigned val) { }
82#define modify_domain(dom,type) do { } while (0) 82static inline void modify_domain(unsigned dom, unsigned type) { }
83#endif 83#endif
84 84
85/* 85/*
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
index 7be54690aeec..e42cf597f6e6 100644
--- a/arch/arm/include/asm/futex.h
+++ b/arch/arm/include/asm/futex.h
@@ -19,6 +19,7 @@
19 " .long 1b, 4f, 2b, 4f\n" \ 19 " .long 1b, 4f, 2b, 4f\n" \
20 " .popsection\n" \ 20 " .popsection\n" \
21 " .pushsection .fixup,\"ax\"\n" \ 21 " .pushsection .fixup,\"ax\"\n" \
22 " .align 2\n" \
22 "4: mov %0, " err_reg "\n" \ 23 "4: mov %0, " err_reg "\n" \
23 " b 3b\n" \ 24 " b 3b\n" \
24 " .popsection" 25 " .popsection"
diff --git a/arch/arm/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h
index e0d1c0cfa548..6b9b077d86b3 100644
--- a/arch/arm/include/asm/hardware/sp810.h
+++ b/arch/arm/include/asm/hardware/sp810.h
@@ -4,7 +4,7 @@
4 * ARM PrimeXsys System Controller SP810 header file 4 * ARM PrimeXsys System Controller SP810 header file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index b79f8e97f775..af7b0bda3355 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -148,7 +148,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
148#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 148#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
149#define TIF_SYSCALL_TRACE 8 149#define TIF_SYSCALL_TRACE 8
150#define TIF_SYSCALL_AUDIT 9 150#define TIF_SYSCALL_AUDIT 9
151#define TIF_SYSCALL_RESTARTSYS 10
152#define TIF_POLLING_NRFLAG 16 151#define TIF_POLLING_NRFLAG 16
153#define TIF_USING_IWMMXT 17 152#define TIF_USING_IWMMXT 17
154#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 153#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
@@ -164,11 +163,9 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
164#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 163#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
165#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) 164#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
166#define _TIF_SECCOMP (1 << TIF_SECCOMP) 165#define _TIF_SECCOMP (1 << TIF_SECCOMP)
167#define _TIF_SYSCALL_RESTARTSYS (1 << TIF_SYSCALL_RESTARTSYS)
168 166
169/* Checks for any syscall work in entry-common.S */ 167/* Checks for any syscall work in entry-common.S */
170#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 168#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT)
171 _TIF_SYSCALL_RESTARTSYS)
172 169
173/* 170/*
174 * Change these and you break ASM code in entry-common.S 171 * Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 437f0c426517..0d1851ca6eb9 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -495,6 +495,7 @@ ENDPROC(__und_usr)
495 * The out of line fixup for the ldrt above. 495 * The out of line fixup for the ldrt above.
496 */ 496 */
497 .pushsection .fixup, "ax" 497 .pushsection .fixup, "ax"
498 .align 2
4984: mov pc, r9 4994: mov pc, r9
499 .popsection 500 .popsection
500 .pushsection __ex_table,"a" 501 .pushsection __ex_table,"a"
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index ba32b393b3f0..38c1a3b103a0 100644
--- a/arch/arm/kernel/kprobes-test-arm.c
+++ b/arch/arm/kernel/kprobes-test-arm.c
@@ -187,8 +187,8 @@ void kprobe_arm_test_cases(void)
187 TEST_BF_R ("mov pc, r",0,2f,"") 187 TEST_BF_R ("mov pc, r",0,2f,"")
188 TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"") 188 TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"")
189 TEST_BB( "sub pc, pc, #1b-2b+8") 189 TEST_BB( "sub pc, pc, #1b-2b+8")
190#if __LINUX_ARM_ARCH__ >= 6 190#if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7)
191 TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before ARMv6 */ 191 TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */
192#endif 192#endif
193 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"") 193 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"")
194 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc") 194 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")
diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c
index 8f96ec778e8d..6123daf397a7 100644
--- a/arch/arm/kernel/kprobes-thumb.c
+++ b/arch/arm/kernel/kprobes-thumb.c
@@ -660,7 +660,7 @@ static const union decode_item t32_table_1111_100x[] = {
660 /* LDRSB (literal) 1111 1001 x001 1111 xxxx xxxx xxxx xxxx */ 660 /* LDRSB (literal) 1111 1001 x001 1111 xxxx xxxx xxxx xxxx */
661 /* LDRH (literal) 1111 1000 x011 1111 xxxx xxxx xxxx xxxx */ 661 /* LDRH (literal) 1111 1000 x011 1111 xxxx xxxx xxxx xxxx */
662 /* LDRSH (literal) 1111 1001 x011 1111 xxxx xxxx xxxx xxxx */ 662 /* LDRSH (literal) 1111 1001 x011 1111 xxxx xxxx xxxx xxxx */
663 DECODE_EMULATEX (0xfe5f0000, 0xf81f0000, t32_simulate_ldr_literal, 663 DECODE_SIMULATEX(0xfe5f0000, 0xf81f0000, t32_simulate_ldr_literal,
664 REGS(PC, NOSPPCX, 0, 0, 0)), 664 REGS(PC, NOSPPCX, 0, 0, 0)),
665 665
666 /* STRB (immediate) 1111 1000 0000 xxxx xxxx 1xxx xxxx xxxx */ 666 /* STRB (immediate) 1111 1000 0000 xxxx xxxx 1xxx xxxx xxxx */
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 186c8cb982c5..a02eada3aa5d 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -503,7 +503,7 @@ __hw_perf_event_init(struct perf_event *event)
503 event_requires_mode_exclusion(&event->attr)) { 503 event_requires_mode_exclusion(&event->attr)) {
504 pr_debug("ARM performance counters do not support " 504 pr_debug("ARM performance counters do not support "
505 "mode exclusion\n"); 505 "mode exclusion\n");
506 return -EPERM; 506 return -EOPNOTSUPP;
507 } 507 }
508 508
509 /* 509 /*
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 5700a7ae7f0b..14e38261cd31 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -25,7 +25,6 @@
25#include <linux/regset.h> 25#include <linux/regset.h>
26#include <linux/audit.h> 26#include <linux/audit.h>
27#include <linux/tracehook.h> 27#include <linux/tracehook.h>
28#include <linux/unistd.h>
29 28
30#include <asm/pgtable.h> 29#include <asm/pgtable.h>
31#include <asm/traps.h> 30#include <asm/traps.h>
@@ -918,8 +917,6 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
918 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, 917 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0,
919 regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); 918 regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);
920 919
921 if (why == 0 && test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS))
922 scno = __NR_restart_syscall - __NR_SYSCALL_BASE;
923 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 920 if (!test_thread_flag(TIF_SYSCALL_TRACE))
924 return scno; 921 return scno;
925 922
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index fd2392a17ac1..536c5d6b340b 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -27,6 +27,7 @@
27 */ 27 */
28#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 28#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE))
29#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 29#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE))
30#define SWI_SYS_RESTART (0xef000000|__NR_restart_syscall|__NR_OABI_SYSCALL_BASE)
30 31
31/* 32/*
32 * With EABI, the syscall number has to be loaded into r7. 33 * With EABI, the syscall number has to be loaded into r7.
@@ -47,6 +48,18 @@ const unsigned long sigreturn_codes[7] = {
47}; 48};
48 49
49/* 50/*
51 * Either we support OABI only, or we have EABI with the OABI
52 * compat layer enabled. In the later case we don't know if
53 * user space is EABI or not, and if not we must not clobber r7.
54 * Always using the OABI syscall solves that issue and works for
55 * all those cases.
56 */
57const unsigned long syscall_restart_code[2] = {
58 SWI_SYS_RESTART, /* swi __NR_restart_syscall */
59 0xe49df004, /* ldr pc, [sp], #4 */
60};
61
62/*
50 * atomically swap in the new signal mask, and wait for a signal. 63 * atomically swap in the new signal mask, and wait for a signal.
51 */ 64 */
52asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) 65asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask)
@@ -592,10 +605,12 @@ static void do_signal(struct pt_regs *regs, int syscall)
592 case -ERESTARTNOHAND: 605 case -ERESTARTNOHAND:
593 case -ERESTARTSYS: 606 case -ERESTARTSYS:
594 case -ERESTARTNOINTR: 607 case -ERESTARTNOINTR:
595 case -ERESTART_RESTARTBLOCK:
596 regs->ARM_r0 = regs->ARM_ORIG_r0; 608 regs->ARM_r0 = regs->ARM_ORIG_r0;
597 regs->ARM_pc = restart_addr; 609 regs->ARM_pc = restart_addr;
598 break; 610 break;
611 case -ERESTART_RESTARTBLOCK:
612 regs->ARM_r0 = -EINTR;
613 break;
599 } 614 }
600 } 615 }
601 616
@@ -611,14 +626,12 @@ static void do_signal(struct pt_regs *regs, int syscall)
611 * debugger has chosen to restart at a different PC. 626 * debugger has chosen to restart at a different PC.
612 */ 627 */
613 if (regs->ARM_pc == restart_addr) { 628 if (regs->ARM_pc == restart_addr) {
614 if (retval == -ERESTARTNOHAND || 629 if (retval == -ERESTARTNOHAND
615 retval == -ERESTART_RESTARTBLOCK
616 || (retval == -ERESTARTSYS 630 || (retval == -ERESTARTSYS
617 && !(ka.sa.sa_flags & SA_RESTART))) { 631 && !(ka.sa.sa_flags & SA_RESTART))) {
618 regs->ARM_r0 = -EINTR; 632 regs->ARM_r0 = -EINTR;
619 regs->ARM_pc = continue_addr; 633 regs->ARM_pc = continue_addr;
620 } 634 }
621 clear_thread_flag(TIF_SYSCALL_RESTARTSYS);
622 } 635 }
623 636
624 handle_signal(signr, &ka, &info, regs); 637 handle_signal(signr, &ka, &info, regs);
@@ -632,8 +645,29 @@ static void do_signal(struct pt_regs *regs, int syscall)
632 * ignore the restart. 645 * ignore the restart.
633 */ 646 */
634 if (retval == -ERESTART_RESTARTBLOCK 647 if (retval == -ERESTART_RESTARTBLOCK
635 && regs->ARM_pc == restart_addr) 648 && regs->ARM_pc == continue_addr) {
636 set_thread_flag(TIF_SYSCALL_RESTARTSYS); 649 if (thumb_mode(regs)) {
650 regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;
651 regs->ARM_pc -= 2;
652 } else {
653#if defined(CONFIG_AEABI) && !defined(CONFIG_OABI_COMPAT)
654 regs->ARM_r7 = __NR_restart_syscall;
655 regs->ARM_pc -= 4;
656#else
657 u32 __user *usp;
658
659 regs->ARM_sp -= 4;
660 usp = (u32 __user *)regs->ARM_sp;
661
662 if (put_user(regs->ARM_pc, usp) == 0) {
663 regs->ARM_pc = KERN_RESTART_CODE;
664 } else {
665 regs->ARM_sp += 4;
666 force_sigsegv(0, current);
667 }
668#endif
669 }
670 }
637 } 671 }
638 672
639 restore_saved_sigmask(); 673 restore_saved_sigmask();
diff --git a/arch/arm/kernel/signal.h b/arch/arm/kernel/signal.h
index 5ff067b7c752..6fcfe8398aa4 100644
--- a/arch/arm/kernel/signal.h
+++ b/arch/arm/kernel/signal.h
@@ -8,5 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500) 10#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500)
11#define KERN_RESTART_CODE (KERN_SIGRETURN_CODE + sizeof(sigreturn_codes))
11 12
12extern const unsigned long sigreturn_codes[7]; 13extern const unsigned long sigreturn_codes[7];
14extern const unsigned long syscall_restart_code[2];
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 4928d89758f4..3647170e9a16 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -820,6 +820,8 @@ void __init early_trap_init(void *vectors_base)
820 */ 820 */
821 memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), 821 memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE),
822 sigreturn_codes, sizeof(sigreturn_codes)); 822 sigreturn_codes, sizeof(sigreturn_codes));
823 memcpy((void *)(vectors + KERN_RESTART_CODE - CONFIG_VECTORS_BASE),
824 syscall_restart_code, sizeof(syscall_restart_code));
823 825
824 flush_icache_range(vectors, vectors + PAGE_SIZE); 826 flush_icache_range(vectors, vectors + PAGE_SIZE);
825 modify_domain(DOMAIN_USER, DOMAIN_CLIENT); 827 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 43a31fb06318..36ff15bbfdd4 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -183,7 +183,9 @@ SECTIONS
183 } 183 }
184#endif 184#endif
185 185
186#ifdef CONFIG_SMP
186 PERCPU_SECTION(L1_CACHE_BYTES) 187 PERCPU_SECTION(L1_CACHE_BYTES)
188#endif
187 189
188#ifdef CONFIG_XIP_KERNEL 190#ifdef CONFIG_XIP_KERNEL
189 __data_loc = ALIGN(4); /* location in binary */ 191 __data_loc = ALIGN(4); /* location in binary */
diff --git a/arch/arm/mach-dove/include/mach/bridge-regs.h b/arch/arm/mach-dove/include/mach/bridge-regs.h
index 226949dc4ac0..f953bb54aa9d 100644
--- a/arch/arm/mach-dove/include/mach/bridge-regs.h
+++ b/arch/arm/mach-dove/include/mach/bridge-regs.h
@@ -50,5 +50,6 @@
50#define POWER_MANAGEMENT (BRIDGE_VIRT_BASE | 0x011c) 50#define POWER_MANAGEMENT (BRIDGE_VIRT_BASE | 0x011c)
51 51
52#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300) 52#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
53#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE | 0x0300)
53 54
54#endif 55#endif
diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
index ad1165d488c1..d52b0ef313b7 100644
--- a/arch/arm/mach-dove/include/mach/dove.h
+++ b/arch/arm/mach-dove/include/mach/dove.h
@@ -78,6 +78,7 @@
78 78
79/* North-South Bridge */ 79/* North-South Bridge */
80#define BRIDGE_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x20000) 80#define BRIDGE_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE | 0x20000)
81#define BRIDGE_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x20000)
81 82
82/* Cryptographic Engine */ 83/* Cryptographic Engine */
83#define DOVE_CRYPT_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x30000) 84#define DOVE_CRYPT_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE | 0x30000)
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 573be57d3d28..6f6d13f91e4c 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -212,7 +212,7 @@ config MACH_SMDKV310
212 select EXYNOS_DEV_SYSMMU 212 select EXYNOS_DEV_SYSMMU
213 select EXYNOS4_DEV_AHCI 213 select EXYNOS4_DEV_AHCI
214 select SAMSUNG_DEV_KEYPAD 214 select SAMSUNG_DEV_KEYPAD
215 select EXYNOS4_DEV_DMA 215 select EXYNOS_DEV_DMA
216 select SAMSUNG_DEV_PWM 216 select SAMSUNG_DEV_PWM
217 select EXYNOS4_DEV_USB_OHCI 217 select EXYNOS4_DEV_USB_OHCI
218 select EXYNOS4_SETUP_FIMD0 218 select EXYNOS4_SETUP_FIMD0
@@ -264,7 +264,7 @@ config MACH_UNIVERSAL_C210
264 select S5P_DEV_ONENAND 264 select S5P_DEV_ONENAND
265 select S5P_DEV_TV 265 select S5P_DEV_TV
266 select EXYNOS_DEV_SYSMMU 266 select EXYNOS_DEV_SYSMMU
267 select EXYNOS4_DEV_DMA 267 select EXYNOS_DEV_DMA
268 select EXYNOS_DEV_DRM 268 select EXYNOS_DEV_DRM
269 select EXYNOS4_SETUP_FIMD0 269 select EXYNOS4_SETUP_FIMD0
270 select EXYNOS4_SETUP_I2C1 270 select EXYNOS4_SETUP_I2C1
@@ -303,7 +303,7 @@ config MACH_NURI
303 select S5P_DEV_MFC 303 select S5P_DEV_MFC
304 select S5P_DEV_USB_EHCI 304 select S5P_DEV_USB_EHCI
305 select S5P_SETUP_MIPIPHY 305 select S5P_SETUP_MIPIPHY
306 select EXYNOS4_DEV_DMA 306 select EXYNOS_DEV_DMA
307 select EXYNOS_DEV_DRM 307 select EXYNOS_DEV_DRM
308 select EXYNOS4_SETUP_FIMC 308 select EXYNOS4_SETUP_FIMC
309 select EXYNOS4_SETUP_FIMD0 309 select EXYNOS4_SETUP_FIMD0
@@ -341,7 +341,7 @@ config MACH_ORIGEN
341 select SAMSUNG_DEV_PWM 341 select SAMSUNG_DEV_PWM
342 select EXYNOS_DEV_DRM 342 select EXYNOS_DEV_DRM
343 select EXYNOS_DEV_SYSMMU 343 select EXYNOS_DEV_SYSMMU
344 select EXYNOS4_DEV_DMA 344 select EXYNOS_DEV_DMA
345 select EXYNOS4_DEV_USB_OHCI 345 select EXYNOS4_DEV_USB_OHCI
346 select EXYNOS4_SETUP_FIMD0 346 select EXYNOS4_SETUP_FIMD0
347 select EXYNOS4_SETUP_SDHCI 347 select EXYNOS4_SETUP_SDHCI
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index f8437dd238c2..ded4652ada80 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -1,4 +1,8 @@
1obj-y := clock.o highbank.o system.o 1obj-y := clock.o highbank.o system.o smc.o
2
3plus_sec := $(call as-instr,.arch_extension sec,+sec)
4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)
5
2obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o 6obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o
3obj-$(CONFIG_SMP) += platsmp.o 7obj-$(CONFIG_SMP) += platsmp.o
4obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 8obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index d8e2d0be64ac..141ed5171826 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -8,3 +8,4 @@ extern void highbank_lluart_map_io(void);
8static inline void highbank_lluart_map_io(void) {} 8static inline void highbank_lluart_map_io(void) {}
9#endif 9#endif
10 10
11extern void highbank_smc1(int fn, int arg);
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 410a112bb52e..8777612b1a42 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -85,10 +85,24 @@ const static struct of_device_id irq_match[] = {
85 {} 85 {}
86}; 86};
87 87
88#ifdef CONFIG_CACHE_L2X0
89static void highbank_l2x0_disable(void)
90{
91 /* Disable PL310 L2 Cache controller */
92 highbank_smc1(0x102, 0x0);
93}
94#endif
95
88static void __init highbank_init_irq(void) 96static void __init highbank_init_irq(void)
89{ 97{
90 of_irq_init(irq_match); 98 of_irq_init(irq_match);
99
100#ifdef CONFIG_CACHE_L2X0
101 /* Enable PL310 L2 Cache controller */
102 highbank_smc1(0x102, 0x1);
91 l2x0_of_init(0, ~0UL); 103 l2x0_of_init(0, ~0UL);
104 outer_cache.disable = highbank_l2x0_disable;
105#endif
92} 106}
93 107
94static void __init highbank_timer_init(void) 108static void __init highbank_timer_init(void)
diff --git a/arch/arm/mach-highbank/smc.S b/arch/arm/mach-highbank/smc.S
new file mode 100644
index 000000000000..407d17baaaa9
--- /dev/null
+++ b/arch/arm/mach-highbank/smc.S
@@ -0,0 +1,27 @@
1/*
2 * Copied from omap44xx-smc.S Copyright (C) 2010 Texas Instruments, Inc.
3 * Copyright 2012 Calxeda, Inc.
4 *
5 * This program is free software,you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/linkage.h>
11
12/*
13 * This is common routine to manage secure monitor API
14 * used to modify the PL310 secure registers.
15 * 'r0' contains the value to be modified and 'r12' contains
16 * the monitor API number.
17 * Function signature : void highbank_smc1(u32 fn, u32 arg)
18 */
19
20ENTRY(highbank_smc1)
21 stmfd sp!, {r4-r11, lr}
22 mov r12, r0
23 mov r0, r1
24 dsb
25 smc #0
26 ldmfd sp!, {r4-r11, pc}
27ENDPROC(highbank_smc1)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 0021f726b153..eff4db5de0dd 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -477,6 +477,7 @@ config MACH_MX31_3DS
477 select IMX_HAVE_PLATFORM_IMX2_WDT 477 select IMX_HAVE_PLATFORM_IMX2_WDT
478 select IMX_HAVE_PLATFORM_IMX_I2C 478 select IMX_HAVE_PLATFORM_IMX_I2C
479 select IMX_HAVE_PLATFORM_IMX_KEYPAD 479 select IMX_HAVE_PLATFORM_IMX_KEYPAD
480 select IMX_HAVE_PLATFORM_IMX_SSI
480 select IMX_HAVE_PLATFORM_IMX_UART 481 select IMX_HAVE_PLATFORM_IMX_UART
481 select IMX_HAVE_PLATFORM_IPU_CORE 482 select IMX_HAVE_PLATFORM_IPU_CORE
482 select IMX_HAVE_PLATFORM_MXC_EHCI 483 select IMX_HAVE_PLATFORM_MXC_EHCI
diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 0f0beb580b73..516ddee1948e 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -108,8 +108,7 @@ int __init mx1_clocks_init(unsigned long fref)
108 clk_register_clkdev(clk[clk32], NULL, "mxc_rtc.0"); 108 clk_register_clkdev(clk[clk32], NULL, "mxc_rtc.0");
109 clk_register_clkdev(clk[clko], "clko", NULL); 109 clk_register_clkdev(clk[clko], "clko", NULL);
110 110
111 mxc_timer_init(NULL, MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), 111 mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
112 MX1_TIM1_INT);
113 112
114 return 0; 113 return 0;
115} 114}
diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c
index 4e4f384ee8dd..ea13e61bd5f3 100644
--- a/arch/arm/mach-imx/clk-imx21.c
+++ b/arch/arm/mach-imx/clk-imx21.c
@@ -180,7 +180,7 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
180 clk_register_clkdev(clk[sdhc1_ipg_gate], "sdhc1", NULL); 180 clk_register_clkdev(clk[sdhc1_ipg_gate], "sdhc1", NULL);
181 clk_register_clkdev(clk[sdhc2_ipg_gate], "sdhc2", NULL); 181 clk_register_clkdev(clk[sdhc2_ipg_gate], "sdhc2", NULL);
182 182
183 mxc_timer_init(NULL, MX21_IO_ADDRESS(MX21_GPT1_BASE_ADDR), 183 mxc_timer_init(MX21_IO_ADDRESS(MX21_GPT1_BASE_ADDR), MX21_INT_GPT1);
184 MX21_INT_GPT1); 184
185 return 0; 185 return 0;
186} 186}
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index d9833bb5fd61..fdd8cc87c9fe 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -243,6 +243,6 @@ int __init mx25_clocks_init(void)
243 clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); 243 clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma");
244 clk_register_clkdev(clk[iim_ipg], "iim", NULL); 244 clk_register_clkdev(clk[iim_ipg], "iim", NULL);
245 245
246 mxc_timer_init(NULL, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); 246 mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
247 return 0; 247 return 0;
248} 248}
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 50a7ebd8d1b2..295cbd7c08dc 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -263,8 +263,7 @@ int __init mx27_clocks_init(unsigned long fref)
263 clk_register_clkdev(clk[ssi1_baud_gate], "bitrate" , "imx-ssi.0"); 263 clk_register_clkdev(clk[ssi1_baud_gate], "bitrate" , "imx-ssi.0");
264 clk_register_clkdev(clk[ssi2_baud_gate], "bitrate" , "imx-ssi.1"); 264 clk_register_clkdev(clk[ssi2_baud_gate], "bitrate" , "imx-ssi.1");
265 265
266 mxc_timer_init(NULL, MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), 266 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
267 MX27_INT_GPT1);
268 267
269 clk_prepare_enable(clk[emi_ahb_gate]); 268 clk_prepare_enable(clk[emi_ahb_gate]);
270 269
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index a854b9cae5ea..c9a06d800f8e 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -175,8 +175,7 @@ int __init mx31_clocks_init(unsigned long fref)
175 mx31_revision(); 175 mx31_revision();
176 clk_disable_unprepare(clk[iim_gate]); 176 clk_disable_unprepare(clk[iim_gate]);
177 177
178 mxc_timer_init(NULL, MX31_IO_ADDRESS(MX31_GPT1_BASE_ADDR), 178 mxc_timer_init(MX31_IO_ADDRESS(MX31_GPT1_BASE_ADDR), MX31_INT_GPT);
179 MX31_INT_GPT);
180 179
181 return 0; 180 return 0;
182} 181}
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index a9e60bf7dd75..c6422fb10bae 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -201,7 +201,6 @@ int __init mx35_clocks_init()
201 pr_err("i.MX35 clk %d: register failed with %ld\n", 201 pr_err("i.MX35 clk %d: register failed with %ld\n",
202 i, PTR_ERR(clk[i])); 202 i, PTR_ERR(clk[i]));
203 203
204
205 clk_register_clkdev(clk[pata_gate], NULL, "pata_imx"); 204 clk_register_clkdev(clk[pata_gate], NULL, "pata_imx");
206 clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0"); 205 clk_register_clkdev(clk[can1_gate], NULL, "flexcan.0");
207 clk_register_clkdev(clk[can2_gate], NULL, "flexcan.1"); 206 clk_register_clkdev(clk[can2_gate], NULL, "flexcan.1");
@@ -264,14 +263,20 @@ int __init mx35_clocks_init()
264 clk_prepare_enable(clk[iim_gate]); 263 clk_prepare_enable(clk[iim_gate]);
265 clk_prepare_enable(clk[emi_gate]); 264 clk_prepare_enable(clk[emi_gate]);
266 265
266 /*
267 * SCC is needed to boot via mmc after a watchdog reset. The clock code
268 * before conversion to common clk also enabled UART1 (which isn't
269 * handled here and not needed for mmc) and IIM (which is enabled
270 * unconditionally above).
271 */
272 clk_prepare_enable(clk[scc_gate]);
273
267 imx_print_silicon_rev("i.MX35", mx35_revision()); 274 imx_print_silicon_rev("i.MX35", mx35_revision());
268 275
269#ifdef CONFIG_MXC_USE_EPIT 276#ifdef CONFIG_MXC_USE_EPIT
270 epit_timer_init(&epit1_clk, 277 epit_timer_init(MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
271 MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
272#else 278#else
273 mxc_timer_init(NULL, MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), 279 mxc_timer_init(MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT);
274 MX35_INT_GPT);
275#endif 280#endif
276 281
277 return 0; 282 return 0;
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index fcd94f3b0f0e..a2200c77bf70 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -104,12 +104,12 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
104 periph_apm_sel, ARRAY_SIZE(periph_apm_sel)); 104 periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
105 clk[main_bus] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1, 105 clk[main_bus] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
106 main_bus_sel, ARRAY_SIZE(main_bus_sel)); 106 main_bus_sel, ARRAY_SIZE(main_bus_sel));
107 clk[per_lp_apm] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCDR, 1, 1, 107 clk[per_lp_apm] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1,
108 per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel)); 108 per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel));
109 clk[per_pred1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2); 109 clk[per_pred1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2);
110 clk[per_pred2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3); 110 clk[per_pred2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3);
111 clk[per_podf] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3); 111 clk[per_podf] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3);
112 clk[per_root] = imx_clk_mux("per_root", MXC_CCM_CBCDR, 1, 0, 112 clk[per_root] = imx_clk_mux("per_root", MXC_CCM_CBCMR, 0, 1,
113 per_root_sel, ARRAY_SIZE(per_root_sel)); 113 per_root_sel, ARRAY_SIZE(per_root_sel));
114 clk[ahb] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3); 114 clk[ahb] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3);
115 clk[ahb_max] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28); 115 clk[ahb_max] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28);
@@ -172,7 +172,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
172 clk[pwm1_hf_gate] = imx_clk_gate2("pwm1_hf_gate", "ipg", MXC_CCM_CCGR2, 12); 172 clk[pwm1_hf_gate] = imx_clk_gate2("pwm1_hf_gate", "ipg", MXC_CCM_CCGR2, 12);
173 clk[pwm2_ipg_gate] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14); 173 clk[pwm2_ipg_gate] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14);
174 clk[pwm2_hf_gate] = imx_clk_gate2("pwm2_hf_gate", "ipg", MXC_CCM_CCGR2, 16); 174 clk[pwm2_hf_gate] = imx_clk_gate2("pwm2_hf_gate", "ipg", MXC_CCM_CCGR2, 16);
175 clk[gpt_gate] = imx_clk_gate2("gpt_gate", "ipg", MXC_CCM_CCGR2, 18); 175 clk[gpt_gate] = imx_clk_gate2("gpt_gate", "per_root", MXC_CCM_CCGR2, 18);
176 clk[fec_gate] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24); 176 clk[fec_gate] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24);
177 clk[usboh3_gate] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26); 177 clk[usboh3_gate] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26);
178 clk[usboh3_per_gate] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28); 178 clk[usboh3_per_gate] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28);
@@ -366,8 +366,7 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
366 clk_set_rate(clk[esdhc_b_podf], 166250000); 366 clk_set_rate(clk[esdhc_b_podf], 166250000);
367 367
368 /* System timer */ 368 /* System timer */
369 mxc_timer_init(NULL, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), 369 mxc_timer_init(MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), MX51_INT_GPT);
370 MX51_INT_GPT);
371 370
372 clk_prepare_enable(clk[iim_gate]); 371 clk_prepare_enable(clk[iim_gate]);
373 imx_print_silicon_rev("i.MX51", mx51_revision()); 372 imx_print_silicon_rev("i.MX51", mx51_revision());
@@ -452,8 +451,7 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
452 clk_set_rate(clk[esdhc_b_podf], 200000000); 451 clk_set_rate(clk[esdhc_b_podf], 200000000);
453 452
454 /* System timer */ 453 /* System timer */
455 mxc_timer_init(NULL, MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR), 454 mxc_timer_init(MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR), MX53_INT_GPT);
456 MX53_INT_GPT);
457 455
458 clk_prepare_enable(clk[iim_gate]); 456 clk_prepare_enable(clk[iim_gate]);
459 imx_print_silicon_rev("i.MX53", mx53_revision()); 457 imx_print_silicon_rev("i.MX53", mx53_revision());
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index cab02d0a15d6..e1a17ac7b3b4 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -122,10 +122,6 @@ static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5
122 "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0", 122 "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0",
123 "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_audio", }; 123 "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_audio", };
124 124
125static const char * const clks_init_on[] __initconst = {
126 "mmdc_ch0_axi", "mmdc_ch1_axi", "usboh3",
127};
128
129enum mx6q_clks { 125enum mx6q_clks {
130 dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m, 126 dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m,
131 pll3_pfd0_720m, pll3_pfd1_540m, pll3_pfd2_508m, pll3_pfd3_454m, 127 pll3_pfd0_720m, pll3_pfd1_540m, pll3_pfd2_508m, pll3_pfd3_454m,
@@ -156,16 +152,20 @@ enum mx6q_clks {
156 ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3, 152 ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3,
157 usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg, 153 usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg,
158 pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg, 154 pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg,
159 ssi2_ipg, ssi3_ipg, clk_max 155 ssi2_ipg, ssi3_ipg, rom,
156 clk_max
160}; 157};
161 158
162static struct clk *clk[clk_max]; 159static struct clk *clk[clk_max];
163 160
161static enum mx6q_clks const clks_init_on[] __initconst = {
162 mmdc_ch0_axi, rom,
163};
164
164int __init mx6q_clocks_init(void) 165int __init mx6q_clocks_init(void)
165{ 166{
166 struct device_node *np; 167 struct device_node *np;
167 void __iomem *base; 168 void __iomem *base;
168 struct clk *c;
169 int i, irq; 169 int i, irq;
170 170
171 clk[dummy] = imx_clk_fixed("dummy", 0); 171 clk[dummy] = imx_clk_fixed("dummy", 0);
@@ -365,6 +365,7 @@ int __init mx6q_clocks_init(void)
365 clk[gpmi_bch] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); 365 clk[gpmi_bch] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26);
366 clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); 366 clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28);
367 clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); 367 clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30);
368 clk[rom] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0);
368 clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); 369 clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4);
369 clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 370 clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6);
370 clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 371 clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
@@ -424,21 +425,14 @@ int __init mx6q_clocks_init(void)
424 clk_register_clkdev(clk[ahb], "ahb", NULL); 425 clk_register_clkdev(clk[ahb], "ahb", NULL);
425 clk_register_clkdev(clk[cko1], "cko1", NULL); 426 clk_register_clkdev(clk[cko1], "cko1", NULL);
426 427
427 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) { 428 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
428 c = clk_get_sys(clks_init_on[i], NULL); 429 clk_prepare_enable(clk[clks_init_on[i]]);
429 if (IS_ERR(c)) {
430 pr_err("%s: failed to get clk %s", __func__,
431 clks_init_on[i]);
432 return PTR_ERR(c);
433 }
434 clk_prepare_enable(c);
435 }
436 430
437 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); 431 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt");
438 base = of_iomap(np, 0); 432 base = of_iomap(np, 0);
439 WARN_ON(!base); 433 WARN_ON(!base);
440 irq = irq_of_parse_and_map(np, 0); 434 irq = irq_of_parse_and_map(np, 0);
441 mxc_timer_init(NULL, base, irq); 435 mxc_timer_init(base, irq);
442 436
443 return 0; 437 return 0;
444} 438}
diff --git a/arch/arm/mach-imx/clk-pllv2.c b/arch/arm/mach-imx/clk-pllv2.c
index 4685919deb63..0440379e3628 100644
--- a/arch/arm/mach-imx/clk-pllv2.c
+++ b/arch/arm/mach-imx/clk-pllv2.c
@@ -74,30 +74,15 @@ struct clk_pllv2 {
74 void __iomem *base; 74 void __iomem *base;
75}; 75};
76 76
77static unsigned long clk_pllv2_recalc_rate(struct clk_hw *hw, 77static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate,
78 unsigned long parent_rate) 78 u32 dp_ctl, u32 dp_op, u32 dp_mfd, u32 dp_mfn)
79{ 79{
80 long mfi, mfn, mfd, pdf, ref_clk, mfn_abs; 80 long mfi, mfn, mfd, pdf, ref_clk, mfn_abs;
81 unsigned long dp_op, dp_mfd, dp_mfn, dp_ctl, pll_hfsm, dbl; 81 unsigned long dbl;
82 void __iomem *pllbase;
83 s64 temp; 82 s64 temp;
84 struct clk_pllv2 *pll = to_clk_pllv2(hw);
85
86 pllbase = pll->base;
87 83
88 dp_ctl = __raw_readl(pllbase + MXC_PLL_DP_CTL);
89 pll_hfsm = dp_ctl & MXC_PLL_DP_CTL_HFSM;
90 dbl = dp_ctl & MXC_PLL_DP_CTL_DPDCK0_2_EN; 84 dbl = dp_ctl & MXC_PLL_DP_CTL_DPDCK0_2_EN;
91 85
92 if (pll_hfsm == 0) {
93 dp_op = __raw_readl(pllbase + MXC_PLL_DP_OP);
94 dp_mfd = __raw_readl(pllbase + MXC_PLL_DP_MFD);
95 dp_mfn = __raw_readl(pllbase + MXC_PLL_DP_MFN);
96 } else {
97 dp_op = __raw_readl(pllbase + MXC_PLL_DP_HFS_OP);
98 dp_mfd = __raw_readl(pllbase + MXC_PLL_DP_HFS_MFD);
99 dp_mfn = __raw_readl(pllbase + MXC_PLL_DP_HFS_MFN);
100 }
101 pdf = dp_op & MXC_PLL_DP_OP_PDF_MASK; 86 pdf = dp_op & MXC_PLL_DP_OP_PDF_MASK;
102 mfi = (dp_op & MXC_PLL_DP_OP_MFI_MASK) >> MXC_PLL_DP_OP_MFI_OFFSET; 87 mfi = (dp_op & MXC_PLL_DP_OP_MFI_MASK) >> MXC_PLL_DP_OP_MFI_OFFSET;
103 mfi = (mfi <= 5) ? 5 : mfi; 88 mfi = (mfi <= 5) ? 5 : mfi;
@@ -123,18 +108,30 @@ static unsigned long clk_pllv2_recalc_rate(struct clk_hw *hw,
123 return temp; 108 return temp;
124} 109}
125 110
126static int clk_pllv2_set_rate(struct clk_hw *hw, unsigned long rate, 111static unsigned long clk_pllv2_recalc_rate(struct clk_hw *hw,
127 unsigned long parent_rate) 112 unsigned long parent_rate)
128{ 113{
114 u32 dp_op, dp_mfd, dp_mfn, dp_ctl;
115 void __iomem *pllbase;
129 struct clk_pllv2 *pll = to_clk_pllv2(hw); 116 struct clk_pllv2 *pll = to_clk_pllv2(hw);
117
118 pllbase = pll->base;
119
120 dp_ctl = __raw_readl(pllbase + MXC_PLL_DP_CTL);
121 dp_op = __raw_readl(pllbase + MXC_PLL_DP_OP);
122 dp_mfd = __raw_readl(pllbase + MXC_PLL_DP_MFD);
123 dp_mfn = __raw_readl(pllbase + MXC_PLL_DP_MFN);
124
125 return __clk_pllv2_recalc_rate(parent_rate, dp_ctl, dp_op, dp_mfd, dp_mfn);
126}
127
128static int __clk_pllv2_set_rate(unsigned long rate, unsigned long parent_rate,
129 u32 *dp_op, u32 *dp_mfd, u32 *dp_mfn)
130{
130 u32 reg; 131 u32 reg;
131 void __iomem *pllbase;
132 long mfi, pdf, mfn, mfd = 999999; 132 long mfi, pdf, mfn, mfd = 999999;
133 s64 temp64; 133 s64 temp64;
134 unsigned long quad_parent_rate; 134 unsigned long quad_parent_rate;
135 unsigned long pll_hfsm, dp_ctl;
136
137 pllbase = pll->base;
138 135
139 quad_parent_rate = 4 * parent_rate; 136 quad_parent_rate = 4 * parent_rate;
140 pdf = mfi = -1; 137 pdf = mfi = -1;
@@ -144,25 +141,41 @@ static int clk_pllv2_set_rate(struct clk_hw *hw, unsigned long rate,
144 return -EINVAL; 141 return -EINVAL;
145 pdf--; 142 pdf--;
146 143
147 temp64 = rate * (pdf+1) - quad_parent_rate * mfi; 144 temp64 = rate * (pdf + 1) - quad_parent_rate * mfi;
148 do_div(temp64, quad_parent_rate/1000000); 145 do_div(temp64, quad_parent_rate / 1000000);
149 mfn = (long)temp64; 146 mfn = (long)temp64;
150 147
148 reg = mfi << 4 | pdf;
149
150 *dp_op = reg;
151 *dp_mfd = mfd;
152 *dp_mfn = mfn;
153
154 return 0;
155}
156
157static int clk_pllv2_set_rate(struct clk_hw *hw, unsigned long rate,
158 unsigned long parent_rate)
159{
160 struct clk_pllv2 *pll = to_clk_pllv2(hw);
161 void __iomem *pllbase;
162 u32 dp_ctl, dp_op, dp_mfd, dp_mfn;
163 int ret;
164
165 pllbase = pll->base;
166
167
168 ret = __clk_pllv2_set_rate(rate, parent_rate, &dp_op, &dp_mfd, &dp_mfn);
169 if (ret)
170 return ret;
171
151 dp_ctl = __raw_readl(pllbase + MXC_PLL_DP_CTL); 172 dp_ctl = __raw_readl(pllbase + MXC_PLL_DP_CTL);
152 /* use dpdck0_2 */ 173 /* use dpdck0_2 */
153 __raw_writel(dp_ctl | 0x1000L, pllbase + MXC_PLL_DP_CTL); 174 __raw_writel(dp_ctl | 0x1000L, pllbase + MXC_PLL_DP_CTL);
154 pll_hfsm = dp_ctl & MXC_PLL_DP_CTL_HFSM; 175
155 if (pll_hfsm == 0) { 176 __raw_writel(dp_op, pllbase + MXC_PLL_DP_OP);
156 reg = mfi << 4 | pdf; 177 __raw_writel(dp_mfd, pllbase + MXC_PLL_DP_MFD);
157 __raw_writel(reg, pllbase + MXC_PLL_DP_OP); 178 __raw_writel(dp_mfn, pllbase + MXC_PLL_DP_MFN);
158 __raw_writel(mfd, pllbase + MXC_PLL_DP_MFD);
159 __raw_writel(mfn, pllbase + MXC_PLL_DP_MFN);
160 } else {
161 reg = mfi << 4 | pdf;
162 __raw_writel(reg, pllbase + MXC_PLL_DP_HFS_OP);
163 __raw_writel(mfd, pllbase + MXC_PLL_DP_HFS_MFD);
164 __raw_writel(mfn, pllbase + MXC_PLL_DP_HFS_MFN);
165 }
166 179
167 return 0; 180 return 0;
168} 181}
@@ -170,7 +183,11 @@ static int clk_pllv2_set_rate(struct clk_hw *hw, unsigned long rate,
170static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate, 183static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate,
171 unsigned long *prate) 184 unsigned long *prate)
172{ 185{
173 return rate; 186 u32 dp_op, dp_mfd, dp_mfn;
187
188 __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
189 return __clk_pllv2_recalc_rate(*prate, MXC_PLL_DP_CTL_DPDCK0_2_EN,
190 dp_op, dp_mfd, dp_mfn);
174} 191}
175 192
176static int clk_pllv2_prepare(struct clk_hw *hw) 193static int clk_pllv2_prepare(struct clk_hw *hw)
diff --git a/arch/arm/mach-imx/crm-regs-imx5.h b/arch/arm/mach-imx/crm-regs-imx5.h
index 5e11ba7daee2..5e3f1f0f4cab 100644
--- a/arch/arm/mach-imx/crm-regs-imx5.h
+++ b/arch/arm/mach-imx/crm-regs-imx5.h
@@ -23,7 +23,7 @@
23#define MX53_DPLL1_BASE MX53_IO_ADDRESS(MX53_PLL1_BASE_ADDR) 23#define MX53_DPLL1_BASE MX53_IO_ADDRESS(MX53_PLL1_BASE_ADDR)
24#define MX53_DPLL2_BASE MX53_IO_ADDRESS(MX53_PLL2_BASE_ADDR) 24#define MX53_DPLL2_BASE MX53_IO_ADDRESS(MX53_PLL2_BASE_ADDR)
25#define MX53_DPLL3_BASE MX53_IO_ADDRESS(MX53_PLL3_BASE_ADDR) 25#define MX53_DPLL3_BASE MX53_IO_ADDRESS(MX53_PLL3_BASE_ADDR)
26#define MX53_DPLL4_BASE MX53_IO_ADDRESS(MX53_PLL3_BASE_ADDR) 26#define MX53_DPLL4_BASE MX53_IO_ADDRESS(MX53_PLL4_BASE_ADDR)
27 27
28/* PLL Register Offsets */ 28/* PLL Register Offsets */
29#define MXC_PLL_DP_CTL 0x00 29#define MXC_PLL_DP_CTL 0x00
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 89493abd497c..20ed2d56c1af 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/cp15.h>
15#include <mach/common.h> 16#include <mach/common.h>
16 17
17int platform_cpu_kill(unsigned int cpu) 18int platform_cpu_kill(unsigned int cpu)
@@ -19,6 +20,44 @@ int platform_cpu_kill(unsigned int cpu)
19 return 1; 20 return 1;
20} 21}
21 22
23static inline void cpu_enter_lowpower(void)
24{
25 unsigned int v;
26
27 flush_cache_all();
28 asm volatile(
29 "mcr p15, 0, %1, c7, c5, 0\n"
30 " mcr p15, 0, %1, c7, c10, 4\n"
31 /*
32 * Turn off coherency
33 */
34 " mrc p15, 0, %0, c1, c0, 1\n"
35 " bic %0, %0, %3\n"
36 " mcr p15, 0, %0, c1, c0, 1\n"
37 " mrc p15, 0, %0, c1, c0, 0\n"
38 " bic %0, %0, %2\n"
39 " mcr p15, 0, %0, c1, c0, 0\n"
40 : "=&r" (v)
41 : "r" (0), "Ir" (CR_C), "Ir" (0x40)
42 : "cc");
43}
44
45static inline void cpu_leave_lowpower(void)
46{
47 unsigned int v;
48
49 asm volatile(
50 "mrc p15, 0, %0, c1, c0, 0\n"
51 " orr %0, %0, %1\n"
52 " mcr p15, 0, %0, c1, c0, 0\n"
53 " mrc p15, 0, %0, c1, c0, 1\n"
54 " orr %0, %0, %2\n"
55 " mcr p15, 0, %0, c1, c0, 1\n"
56 : "=&r" (v)
57 : "Ir" (CR_C), "Ir" (0x40)
58 : "cc");
59}
60
22/* 61/*
23 * platform-specific code to shutdown a CPU 62 * platform-specific code to shutdown a CPU
24 * 63 *
@@ -26,9 +65,10 @@ int platform_cpu_kill(unsigned int cpu)
26 */ 65 */
27void platform_cpu_die(unsigned int cpu) 66void platform_cpu_die(unsigned int cpu)
28{ 67{
29 flush_cache_all(); 68 cpu_enter_lowpower();
30 imx_enable_cpu(cpu, false); 69 imx_enable_cpu(cpu, false);
31 cpu_do_idle(); 70 cpu_do_idle();
71 cpu_leave_lowpower();
32 72
33 /* We should never return from idle */ 73 /* We should never return from idle */
34 panic("cpu %d unexpectedly exit from shutdown\n", cpu); 74 panic("cpu %d unexpectedly exit from shutdown\n", cpu);
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index c515f8ede1a1..6450303f1a7a 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -70,7 +70,6 @@ static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
70 I2C_BOARD_INFO("pcf8563", 0x51), 70 I2C_BOARD_INFO("pcf8563", 0x51),
71 }, { 71 }, {
72 I2C_BOARD_INFO("tsc2007", 0x48), 72 I2C_BOARD_INFO("tsc2007", 0x48),
73 .type = "tsc2007",
74 .platform_data = &tsc2007_info, 73 .platform_data = &tsc2007_info,
75 .irq = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO), 74 .irq = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO),
76 }, 75 },
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
index ac50f1671e38..1e09de50cbcd 100644
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c
@@ -142,7 +142,6 @@ static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
142 I2C_BOARD_INFO("pcf8563", 0x51), 142 I2C_BOARD_INFO("pcf8563", 0x51),
143 }, { 143 }, {
144 I2C_BOARD_INFO("tsc2007", 0x49), 144 I2C_BOARD_INFO("tsc2007", 0x49),
145 .type = "tsc2007",
146 .platform_data = &tsc2007_info, 145 .platform_data = &tsc2007_info,
147 }, 146 },
148}; 147};
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index dff82eb57cd9..ba09552fe5fe 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -38,7 +38,7 @@
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <asm/system.h> 41#include <asm/system_info.h>
42#include <mach/common.h> 42#include <mach/common.h>
43#include <mach/iomux-mx27.h> 43#include <mach/iomux-mx27.h>
44 44
@@ -116,6 +116,8 @@ static const int visstrim_m10_pins[] __initconst = {
116 PB23_PF_USB_PWR, 116 PB23_PF_USB_PWR,
117 PB24_PF_USB_OC, 117 PB24_PF_USB_OC,
118 /* CSI */ 118 /* CSI */
119 TVP5150_RSTN | GPIO_GPIO | GPIO_OUT,
120 TVP5150_PWDN | GPIO_GPIO | GPIO_OUT,
119 PB10_PF_CSI_D0, 121 PB10_PF_CSI_D0,
120 PB11_PF_CSI_D1, 122 PB11_PF_CSI_D1,
121 PB12_PF_CSI_D2, 123 PB12_PF_CSI_D2,
@@ -147,6 +149,24 @@ static struct gpio visstrim_m10_version_gpios[] = {
147 { MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" }, 149 { MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" },
148}; 150};
149 151
152static const struct gpio visstrim_m10_gpios[] __initconst = {
153 {
154 .gpio = TVP5150_RSTN,
155 .flags = GPIOF_DIR_OUT | GPIOF_INIT_HIGH,
156 .label = "tvp5150_rstn",
157 },
158 {
159 .gpio = TVP5150_PWDN,
160 .flags = GPIOF_DIR_OUT | GPIOF_INIT_LOW,
161 .label = "tvp5150_pwdn",
162 },
163 {
164 .gpio = OTG_PHY_CS_GPIO,
165 .flags = GPIOF_DIR_OUT | GPIOF_INIT_LOW,
166 .label = "usbotg_cs",
167 },
168};
169
150/* Camera */ 170/* Camera */
151static int visstrim_camera_power(struct device *dev, int on) 171static int visstrim_camera_power(struct device *dev, int on)
152{ 172{
@@ -190,13 +210,6 @@ static void __init visstrim_camera_init(void)
190 struct platform_device *pdev; 210 struct platform_device *pdev;
191 int dma; 211 int dma;
192 212
193 /* Initialize tvp5150 gpios */
194 mxc_gpio_mode(TVP5150_RSTN | GPIO_GPIO | GPIO_OUT);
195 mxc_gpio_mode(TVP5150_PWDN | GPIO_GPIO | GPIO_OUT);
196 gpio_set_value(TVP5150_RSTN, 1);
197 gpio_set_value(TVP5150_PWDN, 0);
198 ndelay(1);
199
200 gpio_set_value(TVP5150_PWDN, 1); 213 gpio_set_value(TVP5150_PWDN, 1);
201 ndelay(1); 214 ndelay(1);
202 gpio_set_value(TVP5150_RSTN, 0); 215 gpio_set_value(TVP5150_RSTN, 0);
@@ -377,10 +390,6 @@ static struct i2c_board_info visstrim_m10_i2c_devices[] = {
377/* USB OTG */ 390/* USB OTG */
378static int otg_phy_init(struct platform_device *pdev) 391static int otg_phy_init(struct platform_device *pdev)
379{ 392{
380 gpio_set_value(OTG_PHY_CS_GPIO, 0);
381
382 mdelay(10);
383
384 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); 393 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
385} 394}
386 395
@@ -435,6 +444,11 @@ static void __init visstrim_m10_board_init(void)
435 if (ret) 444 if (ret)
436 pr_err("Failed to setup pins (%d)\n", ret); 445 pr_err("Failed to setup pins (%d)\n", ret);
437 446
447 ret = gpio_request_array(visstrim_m10_gpios,
448 ARRAY_SIZE(visstrim_m10_gpios));
449 if (ret)
450 pr_err("Failed to request gpios (%d)\n", ret);
451
438 imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata); 452 imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata);
439 imx27_add_imx_uart0(&uart_pdata); 453 imx27_add_imx_uart0(&uart_pdata);
440 454
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index d14bbe949a4f..3e7401fca76c 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -32,7 +32,7 @@
32 * Memory-mapped I/O on MX21ADS base board 32 * Memory-mapped I/O on MX21ADS base board
33 */ 33 */
34#define MX21ADS_MMIO_BASE_ADDR 0xf5000000 34#define MX21ADS_MMIO_BASE_ADDR 0xf5000000
35#define MX21ADS_MMIO_SIZE SZ_16M 35#define MX21ADS_MMIO_SIZE 0xc00000
36 36
37#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ 37#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \
38 (MX21ADS_MMIO_BASE_ADDR + (offset)) 38 (MX21ADS_MMIO_BASE_ADDR + (offset))
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 967ed5b35a45..a8983b9778d1 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -86,6 +86,7 @@ static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size,
86 86
87void __init imx3_init_l2x0(void) 87void __init imx3_init_l2x0(void)
88{ 88{
89#ifdef CONFIG_CACHE_L2X0
89 void __iomem *l2x0_base; 90 void __iomem *l2x0_base;
90 void __iomem *clkctl_base; 91 void __iomem *clkctl_base;
91 92
@@ -115,6 +116,7 @@ void __init imx3_init_l2x0(void)
115 } 116 }
116 117
117 l2x0_init(l2x0_base, 0x00030024, 0x00000000); 118 l2x0_init(l2x0_base, 0x00030024, 0x00000000);
119#endif
118} 120}
119 121
120#ifdef CONFIG_SOC_IMX31 122#ifdef CONFIG_SOC_IMX31
@@ -179,6 +181,8 @@ void __init imx31_soc_init(void)
179 mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0); 181 mxc_register_gpio("imx31-gpio", 1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
180 mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0); 182 mxc_register_gpio("imx31-gpio", 2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
181 183
184 pinctrl_provide_dummies();
185
182 if (to_version == 1) { 186 if (to_version == 1) {
183 strncpy(imx31_sdma_pdata.fw_name, "sdma-imx31-to1.bin", 187 strncpy(imx31_sdma_pdata.fw_name, "sdma-imx31-to1.bin",
184 strlen(imx31_sdma_pdata.fw_name)); 188 strlen(imx31_sdma_pdata.fw_name));
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index feeee17da96b..1d003053d562 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -202,6 +202,8 @@ void __init imx51_soc_init(void)
202 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_INT_GPIO3_LOW, MX51_INT_GPIO3_HIGH); 202 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_INT_GPIO3_LOW, MX51_INT_GPIO3_HIGH);
203 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_INT_GPIO4_LOW, MX51_INT_GPIO4_HIGH); 203 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_INT_GPIO4_LOW, MX51_INT_GPIO4_HIGH);
204 204
205 pinctrl_provide_dummies();
206
205 /* i.mx51 has the i.mx35 type sdma */ 207 /* i.mx51 has the i.mx35 type sdma */
206 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata); 208 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
207 209
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index 2222c5739519..b0d3cc49269d 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -20,9 +20,6 @@
20#include <linux/mv643xx_eth.h> 20#include <linux/mv643xx_eth.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/leds.h> 22#include <linux/leds.h>
23#include <linux/spi/flash.h>
24#include <linux/spi/spi.h>
25#include <linux/spi/orion_spi.h>
26#include <linux/i2c.h> 23#include <linux/i2c.h>
27#include <linux/input.h> 24#include <linux/input.h>
28#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 25fb3fd418ef..f261cd242643 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -159,6 +159,7 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
159 gate_fn->gate.flags = clk_gate_flags; 159 gate_fn->gate.flags = clk_gate_flags;
160 gate_fn->gate.lock = lock; 160 gate_fn->gate.lock = lock;
161 gate_fn->gate.hw.init = &init; 161 gate_fn->gate.hw.init = &init;
162 gate_fn->fn = fn;
162 163
163 /* ops is the gate ops, but with our disable function */ 164 /* ops is the gate ops, but with our disable function */
164 if (clk_gate_fn_ops.disable != clk_gate_fn_disable) { 165 if (clk_gate_fn_ops.disable != clk_gate_fn_disable) {
@@ -193,9 +194,11 @@ static struct clk __init *kirkwood_register_gate_fn(const char *name,
193 bit_idx, 0, &gating_lock, fn); 194 bit_idx, 0, &gating_lock, fn);
194} 195}
195 196
197static struct clk *ge0, *ge1;
198
196void __init kirkwood_clk_init(void) 199void __init kirkwood_clk_init(void)
197{ 200{
198 struct clk *runit, *ge0, *ge1, *sata0, *sata1, *usb0, *sdio; 201 struct clk *runit, *sata0, *sata1, *usb0, *sdio;
199 struct clk *crypto, *xor0, *xor1, *pex0, *pex1, *audio; 202 struct clk *crypto, *xor0, *xor1, *pex0, *pex1, *audio;
200 203
201 tclk = clk_register_fixed_rate(NULL, "tclk", NULL, 204 tclk = clk_register_fixed_rate(NULL, "tclk", NULL,
@@ -257,6 +260,9 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
257 orion_ge00_init(eth_data, 260 orion_ge00_init(eth_data,
258 GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM, 261 GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
259 IRQ_KIRKWOOD_GE00_ERR); 262 IRQ_KIRKWOOD_GE00_ERR);
263 /* The interface forgets the MAC address assigned by u-boot if
264 the clock is turned off, so claim the clk now. */
265 clk_prepare_enable(ge0);
260} 266}
261 267
262 268
@@ -268,6 +274,7 @@ void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
268 orion_ge01_init(eth_data, 274 orion_ge01_init(eth_data,
269 GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM, 275 GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
270 IRQ_KIRKWOOD_GE01_ERR); 276 IRQ_KIRKWOOD_GE01_ERR);
277 clk_prepare_enable(ge1);
271} 278}
272 279
273 280
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index 3eee37a3b501..a115142f8690 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -38,6 +38,7 @@
38#define IRQ_MASK_HIGH_OFF 0x0014 38#define IRQ_MASK_HIGH_OFF 0x0014
39 39
40#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300) 40#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
41#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE | 0x0300)
41 42
42#define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128) 43#define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128)
43#define L2_WRITETHROUGH 0x00000010 44#define L2_WRITETHROUGH 0x00000010
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index fede3d503efa..c5b68510776b 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -80,6 +80,7 @@
80#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100) 80#define UART1_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2100)
81 81
82#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000) 82#define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000)
83#define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x20000)
83 84
84#define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x30000) 85#define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x30000)
85 86
diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
deleted file mode 100644
index 0e135a599f3e..000000000000
--- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef __ASM_MACH_GPIO_PXA_H
2#define __ASM_MACH_GPIO_PXA_H
3
4#include <mach/addr-map.h>
5#include <mach/cputype.h>
6#include <mach/irqs.h>
7
8#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
9
10#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
11#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
12
13#define gpio_to_bank(gpio) ((gpio) >> 5)
14
15/* NOTE: these macros are defined here to make optimization of
16 * gpio_{get,set}_value() to work when 'gpio' is a constant.
17 * Usage of these macros otherwise is no longer recommended,
18 * use generic GPIO API whenever possible.
19 */
20#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
21
22#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
23#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
24#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
25#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
26
27#include <plat/gpio-pxa.h>
28
29#endif /* __ASM_MACH_GPIO_PXA_H */
diff --git a/arch/arm/mach-mmp/irq.c b/arch/arm/mach-mmp/irq.c
index fcfe0e3bd701..e60c7d98922b 100644
--- a/arch/arm/mach-mmp/irq.c
+++ b/arch/arm/mach-mmp/irq.c
@@ -241,6 +241,7 @@ void __init mmp2_init_icu(void)
241 icu_data[1].clr_mfp_irq_base = IRQ_MMP2_PMIC_BASE; 241 icu_data[1].clr_mfp_irq_base = IRQ_MMP2_PMIC_BASE;
242 icu_data[1].clr_mfp_hwirq = IRQ_MMP2_PMIC - IRQ_MMP2_PMIC_BASE; 242 icu_data[1].clr_mfp_hwirq = IRQ_MMP2_PMIC - IRQ_MMP2_PMIC_BASE;
243 icu_data[1].nr_irqs = 2; 243 icu_data[1].nr_irqs = 2;
244 icu_data[1].cascade_irq = 4;
244 icu_data[1].virq_base = IRQ_MMP2_PMIC_BASE; 245 icu_data[1].virq_base = IRQ_MMP2_PMIC_BASE;
245 icu_data[1].domain = irq_domain_add_legacy(NULL, icu_data[1].nr_irqs, 246 icu_data[1].domain = irq_domain_add_legacy(NULL, icu_data[1].nr_irqs,
246 icu_data[1].virq_base, 0, 247 icu_data[1].virq_base, 0,
@@ -249,6 +250,7 @@ void __init mmp2_init_icu(void)
249 icu_data[2].reg_status = mmp_icu_base + 0x154; 250 icu_data[2].reg_status = mmp_icu_base + 0x154;
250 icu_data[2].reg_mask = mmp_icu_base + 0x16c; 251 icu_data[2].reg_mask = mmp_icu_base + 0x16c;
251 icu_data[2].nr_irqs = 2; 252 icu_data[2].nr_irqs = 2;
253 icu_data[2].cascade_irq = 5;
252 icu_data[2].virq_base = IRQ_MMP2_RTC_BASE; 254 icu_data[2].virq_base = IRQ_MMP2_RTC_BASE;
253 icu_data[2].domain = irq_domain_add_legacy(NULL, icu_data[2].nr_irqs, 255 icu_data[2].domain = irq_domain_add_legacy(NULL, icu_data[2].nr_irqs,
254 icu_data[2].virq_base, 0, 256 icu_data[2].virq_base, 0,
@@ -257,6 +259,7 @@ void __init mmp2_init_icu(void)
257 icu_data[3].reg_status = mmp_icu_base + 0x180; 259 icu_data[3].reg_status = mmp_icu_base + 0x180;
258 icu_data[3].reg_mask = mmp_icu_base + 0x17c; 260 icu_data[3].reg_mask = mmp_icu_base + 0x17c;
259 icu_data[3].nr_irqs = 3; 261 icu_data[3].nr_irqs = 3;
262 icu_data[3].cascade_irq = 9;
260 icu_data[3].virq_base = IRQ_MMP2_KEYPAD_BASE; 263 icu_data[3].virq_base = IRQ_MMP2_KEYPAD_BASE;
261 icu_data[3].domain = irq_domain_add_legacy(NULL, icu_data[3].nr_irqs, 264 icu_data[3].domain = irq_domain_add_legacy(NULL, icu_data[3].nr_irqs,
262 icu_data[3].virq_base, 0, 265 icu_data[3].virq_base, 0,
@@ -265,6 +268,7 @@ void __init mmp2_init_icu(void)
265 icu_data[4].reg_status = mmp_icu_base + 0x158; 268 icu_data[4].reg_status = mmp_icu_base + 0x158;
266 icu_data[4].reg_mask = mmp_icu_base + 0x170; 269 icu_data[4].reg_mask = mmp_icu_base + 0x170;
267 icu_data[4].nr_irqs = 5; 270 icu_data[4].nr_irqs = 5;
271 icu_data[4].cascade_irq = 17;
268 icu_data[4].virq_base = IRQ_MMP2_TWSI_BASE; 272 icu_data[4].virq_base = IRQ_MMP2_TWSI_BASE;
269 icu_data[4].domain = irq_domain_add_legacy(NULL, icu_data[4].nr_irqs, 273 icu_data[4].domain = irq_domain_add_legacy(NULL, icu_data[4].nr_irqs,
270 icu_data[4].virq_base, 0, 274 icu_data[4].virq_base, 0,
@@ -273,6 +277,7 @@ void __init mmp2_init_icu(void)
273 icu_data[5].reg_status = mmp_icu_base + 0x15c; 277 icu_data[5].reg_status = mmp_icu_base + 0x15c;
274 icu_data[5].reg_mask = mmp_icu_base + 0x174; 278 icu_data[5].reg_mask = mmp_icu_base + 0x174;
275 icu_data[5].nr_irqs = 15; 279 icu_data[5].nr_irqs = 15;
280 icu_data[5].cascade_irq = 35;
276 icu_data[5].virq_base = IRQ_MMP2_MISC_BASE; 281 icu_data[5].virq_base = IRQ_MMP2_MISC_BASE;
277 icu_data[5].domain = irq_domain_add_legacy(NULL, icu_data[5].nr_irqs, 282 icu_data[5].domain = irq_domain_add_legacy(NULL, icu_data[5].nr_irqs,
278 icu_data[5].virq_base, 0, 283 icu_data[5].virq_base, 0,
@@ -281,6 +286,7 @@ void __init mmp2_init_icu(void)
281 icu_data[6].reg_status = mmp_icu_base + 0x160; 286 icu_data[6].reg_status = mmp_icu_base + 0x160;
282 icu_data[6].reg_mask = mmp_icu_base + 0x178; 287 icu_data[6].reg_mask = mmp_icu_base + 0x178;
283 icu_data[6].nr_irqs = 2; 288 icu_data[6].nr_irqs = 2;
289 icu_data[6].cascade_irq = 51;
284 icu_data[6].virq_base = IRQ_MMP2_MIPI_HSI1_BASE; 290 icu_data[6].virq_base = IRQ_MMP2_MIPI_HSI1_BASE;
285 icu_data[6].domain = irq_domain_add_legacy(NULL, icu_data[6].nr_irqs, 291 icu_data[6].domain = irq_domain_add_legacy(NULL, icu_data[6].nr_irqs,
286 icu_data[6].virq_base, 0, 292 icu_data[6].virq_base, 0,
@@ -289,6 +295,7 @@ void __init mmp2_init_icu(void)
289 icu_data[7].reg_status = mmp_icu_base + 0x188; 295 icu_data[7].reg_status = mmp_icu_base + 0x188;
290 icu_data[7].reg_mask = mmp_icu_base + 0x184; 296 icu_data[7].reg_mask = mmp_icu_base + 0x184;
291 icu_data[7].nr_irqs = 2; 297 icu_data[7].nr_irqs = 2;
298 icu_data[7].cascade_irq = 55;
292 icu_data[7].virq_base = IRQ_MMP2_MIPI_HSI0_BASE; 299 icu_data[7].virq_base = IRQ_MMP2_MIPI_HSI0_BASE;
293 icu_data[7].domain = irq_domain_add_legacy(NULL, icu_data[7].nr_irqs, 300 icu_data[7].domain = irq_domain_add_legacy(NULL, icu_data[7].nr_irqs,
294 icu_data[7].virq_base, 0, 301 icu_data[7].virq_base, 0,
diff --git a/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h b/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
index c64dbb96dbad..eb187e0e059b 100644
--- a/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
+++ b/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
@@ -31,5 +31,6 @@
31#define IRQ_MASK_HIGH_OFF 0x0014 31#define IRQ_MASK_HIGH_OFF 0x0014
32 32
33#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300) 33#define TIMER_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0300)
34#define TIMER_PHYS_BASE (BRIDGE_PHYS_BASE | 0x0300)
34 35
35#endif 36#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index 3674497162e3..e807c4c52a0b 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -42,6 +42,7 @@
42#define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000 42#define MV78XX0_CORE0_REGS_PHYS_BASE 0xf1020000
43#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000 43#define MV78XX0_CORE1_REGS_PHYS_BASE 0xf1024000
44#define MV78XX0_CORE_REGS_VIRT_BASE 0xfe400000 44#define MV78XX0_CORE_REGS_VIRT_BASE 0xfe400000
45#define MV78XX0_CORE_REGS_PHYS_BASE 0xfe400000
45#define MV78XX0_CORE_REGS_SIZE SZ_16K 46#define MV78XX0_CORE_REGS_SIZE SZ_16K
46 47
47#define MV78XX0_PCIE_IO_PHYS_BASE(i) (0xf0800000 + ((i) << 20)) 48#define MV78XX0_PCIE_IO_PHYS_BASE(i) (0xf0800000 + ((i) << 20))
@@ -59,6 +60,7 @@
59 * Core-specific peripheral registers. 60 * Core-specific peripheral registers.
60 */ 61 */
61#define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE) 62#define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE)
63#define BRIDGE_PHYS_BASE (MV78XX0_CORE_REGS_PHYS_BASE)
62 64
63/* 65/*
64 * Register Map 66 * Register Map
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 5e90b9dcdef8..f5f061757deb 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -205,6 +205,16 @@ static int apx4devkit_phy_fixup(struct phy_device *phy)
205 return 0; 205 return 0;
206} 206}
207 207
208static void __init apx4devkit_fec_phy_clk_enable(void)
209{
210 struct clk *clk;
211
212 /* Enable fec phy clock */
213 clk = clk_get_sys("enet_out", NULL);
214 if (!IS_ERR(clk))
215 clk_prepare_enable(clk);
216}
217
208static void __init apx4devkit_init(void) 218static void __init apx4devkit_init(void)
209{ 219{
210 mx28_soc_init(); 220 mx28_soc_init();
@@ -225,6 +235,7 @@ static void __init apx4devkit_init(void)
225 phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, 235 phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK,
226 apx4devkit_phy_fixup); 236 apx4devkit_phy_fixup);
227 237
238 apx4devkit_fec_phy_clk_enable();
228 mx28_add_fec(0, &mx28_fec_pdata); 239 mx28_add_fec(0, &mx28_fec_pdata);
229 240
230 mx28_add_mxs_mmc(0, &apx4devkit_mmc_pdata); 241 mx28_add_mxs_mmc(0, &apx4devkit_mmc_pdata);
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index 70a81f900bb5..53c39d239d6e 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -97,11 +97,6 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
97 97
98 gpmc_onenand_init(&board_onenand_data); 98 gpmc_onenand_init(&board_onenand_data);
99} 99}
100#else
101void
102__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
103{
104}
105#endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */ 100#endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */
106 101
107#if defined(CONFIG_MTD_NAND_OMAP2) || \ 102#if defined(CONFIG_MTD_NAND_OMAP2) || \
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 8ca14e88a31a..2c5d0ed75285 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -83,11 +83,9 @@ static struct musb_hdrc_config musb_config = {
83}; 83};
84 84
85static struct musb_hdrc_platform_data tusb_data = { 85static struct musb_hdrc_platform_data tusb_data = {
86#if defined(CONFIG_USB_MUSB_OTG) 86#ifdef CONFIG_USB_GADGET_MUSB_HDRC
87 .mode = MUSB_OTG, 87 .mode = MUSB_OTG,
88#elif defined(CONFIG_USB_MUSB_PERIPHERAL) 88#else
89 .mode = MUSB_PERIPHERAL,
90#else /* defined(CONFIG_USB_MUSB_HOST) */
91 .mode = MUSB_HOST, 89 .mode = MUSB_HOST,
92#endif 90#endif
93 .set_power = tusb_set_power, 91 .set_power = tusb_set_power,
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 79c6909eeb78..580fd17208da 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
81static struct { 81static struct {
82 int mmc1_gpio_wp; 82 int mmc1_gpio_wp;
83 int usb_pwr_level; 83 int usb_pwr_level;
84 int reset_gpio; 84 int dvi_pd_gpio;
85 int usr_button_gpio; 85 int usr_button_gpio;
86 int mmc_caps; 86 int mmc_caps;
87} beagle_config = { 87} beagle_config = {
88 .mmc1_gpio_wp = -EINVAL, 88 .mmc1_gpio_wp = -EINVAL,
89 .usb_pwr_level = GPIOF_OUT_INIT_LOW, 89 .usb_pwr_level = GPIOF_OUT_INIT_LOW,
90 .reset_gpio = 129, 90 .dvi_pd_gpio = -EINVAL,
91 .usr_button_gpio = 4, 91 .usr_button_gpio = 4,
92 .mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 92 .mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
93}; 93};
@@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
126 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); 126 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
127 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; 127 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
128 beagle_config.mmc1_gpio_wp = 29; 128 beagle_config.mmc1_gpio_wp = 29;
129 beagle_config.reset_gpio = 170; 129 beagle_config.dvi_pd_gpio = 170;
130 beagle_config.usr_button_gpio = 7; 130 beagle_config.usr_button_gpio = 7;
131 break; 131 break;
132 case 6: 132 case 6:
133 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); 133 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
134 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; 134 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
135 beagle_config.mmc1_gpio_wp = 23; 135 beagle_config.mmc1_gpio_wp = 23;
136 beagle_config.reset_gpio = 170; 136 beagle_config.dvi_pd_gpio = 170;
137 beagle_config.usr_button_gpio = 7; 137 beagle_config.usr_button_gpio = 7;
138 break; 138 break;
139 case 5: 139 case 5:
140 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); 140 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
141 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; 141 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
142 beagle_config.mmc1_gpio_wp = 23; 142 beagle_config.mmc1_gpio_wp = 23;
143 beagle_config.reset_gpio = 170; 143 beagle_config.dvi_pd_gpio = 170;
144 beagle_config.usr_button_gpio = 7; 144 beagle_config.usr_button_gpio = 7;
145 break; 145 break;
146 case 0: 146 case 0:
@@ -274,11 +274,9 @@ static int beagle_twl_gpio_setup(struct device *dev,
274 if (r) 274 if (r)
275 pr_err("%s: unable to configure nDVI_PWR_EN\n", 275 pr_err("%s: unable to configure nDVI_PWR_EN\n",
276 __func__); 276 __func__);
277 r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, 277
278 "DVI_LDO_EN"); 278 beagle_config.dvi_pd_gpio = gpio + 2;
279 if (r) 279
280 pr_err("%s: unable to configure DVI_LDO_EN\n",
281 __func__);
282 } else { 280 } else {
283 /* 281 /*
284 * REVISIT: need ehci-omap hooks for external VBUS 282 * REVISIT: need ehci-omap hooks for external VBUS
@@ -287,7 +285,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
287 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 285 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
288 pr_err("%s: unable to configure EHCI_nOC\n", __func__); 286 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
289 } 287 }
290 dvi_panel.power_down_gpio = beagle_config.reset_gpio; 288 dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
291 289
292 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, 290 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
293 "nEN_USB_PWR"); 291 "nEN_USB_PWR");
@@ -499,7 +497,7 @@ static void __init omap3_beagle_init(void)
499 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 497 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
500 omap3_beagle_init_rev(); 498 omap3_beagle_init_rev();
501 499
502 if (beagle_config.mmc1_gpio_wp != -EINVAL) 500 if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
503 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT); 501 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
504 mmc[0].caps = beagle_config.mmc_caps; 502 mmc[0].caps = beagle_config.mmc_caps;
505 omap_hsmmc_init(mmc); 503 omap_hsmmc_init(mmc);
@@ -510,15 +508,13 @@ static void __init omap3_beagle_init(void)
510 508
511 platform_add_devices(omap3_beagle_devices, 509 platform_add_devices(omap3_beagle_devices,
512 ARRAY_SIZE(omap3_beagle_devices)); 510 ARRAY_SIZE(omap3_beagle_devices));
511 if (gpio_is_valid(beagle_config.dvi_pd_gpio))
512 omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT);
513 omap_display_init(&beagle_dss_data); 513 omap_display_init(&beagle_dss_data);
514 omap_serial_init(); 514 omap_serial_init();
515 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 515 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
516 mt46h32m32lf6_sdrc_params); 516 mt46h32m32lf6_sdrc_params);
517 517
518 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
519 /* REVISIT leave DVI powered down until it's needed ... */
520 gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
521
522 usb_musb_init(NULL); 518 usb_musb_init(NULL);
523 usbhs_init(&usbhs_bdata); 519 usbhs_init(&usbhs_bdata);
524 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 520 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 8fa2fc3a4c3c..779734d8ba37 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -494,8 +494,8 @@ static void __init overo_init(void)
494 494
495 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 495 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
496 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 496 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
497 omap_hsmmc_init(mmc);
498 overo_i2c_init(); 497 overo_i2c_init();
498 omap_hsmmc_init(mmc);
499 omap_display_init(&overo_dss_data); 499 omap_display_init(&overo_dss_data);
500 omap_serial_init(); 500 omap_serial_init();
501 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 501 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ff53deccecab..df2534de3361 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -144,7 +144,6 @@ static struct lis3lv02d_platform_data rx51_lis3lv02d_data = {
144 .release_resources = lis302_release, 144 .release_resources = lis302_release,
145 .st_min_limits = {-32, 3, 3}, 145 .st_min_limits = {-32, 3, 3},
146 .st_max_limits = {-3, 32, 32}, 146 .st_max_limits = {-3, 32, 32},
147 .irq2 = OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO),
148}; 147};
149#endif 148#endif
150 149
@@ -1030,7 +1029,6 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = {
1030 { 1029 {
1031 I2C_BOARD_INFO("lis3lv02d", 0x1d), 1030 I2C_BOARD_INFO("lis3lv02d", 0x1d),
1032 .platform_data = &rx51_lis3lv02d_data, 1031 .platform_data = &rx51_lis3lv02d_data,
1033 .irq = OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO),
1034 }, 1032 },
1035#endif 1033#endif
1036}; 1034};
@@ -1056,6 +1054,10 @@ static int __init rx51_i2c_init(void)
1056 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata); 1054 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
1057 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 1055 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
1058 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 1056 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
1057#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
1058 rx51_lis3lv02d_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
1059 rx51_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
1060#endif
1059 omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3, 1061 omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3,
1060 ARRAY_SIZE(rx51_peripherals_i2c_board_info_3)); 1062 ARRAY_SIZE(rx51_peripherals_i2c_board_info_3));
1061 return 0; 1063 return 0;
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0e8cc8..1efdec236ae8 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3514,7 +3514,7 @@ int __init omap3xxx_clk_init(void)
3514 struct omap_clk *c; 3514 struct omap_clk *c;
3515 u32 cpu_clkflg = 0; 3515 u32 cpu_clkflg = 0;
3516 3516
3517 if (cpu_is_omap3517()) { 3517 if (soc_is_am35xx()) {
3518 cpu_mask = RATE_IN_34XX; 3518 cpu_mask = RATE_IN_34XX;
3519 cpu_clkflg = CK_AM35XX; 3519 cpu_clkflg = CK_AM35XX;
3520 } else if (cpu_is_omap3630()) { 3520 } else if (cpu_is_omap3630()) {
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f6603848..ba6f9a0a43e9 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -84,6 +84,7 @@ static struct clk slimbus_clk = {
84 84
85static struct clk sys_32k_ck = { 85static struct clk sys_32k_ck = {
86 .name = "sys_32k_ck", 86 .name = "sys_32k_ck",
87 .clkdm_name = "prm_clkdm",
87 .rate = 32768, 88 .rate = 32768,
88 .ops = &clkops_null, 89 .ops = &clkops_null,
89}; 90};
@@ -512,6 +513,7 @@ static struct clk ddrphy_ck = {
512 .name = "ddrphy_ck", 513 .name = "ddrphy_ck",
513 .parent = &dpll_core_m2_ck, 514 .parent = &dpll_core_m2_ck,
514 .ops = &clkops_null, 515 .ops = &clkops_null,
516 .clkdm_name = "l3_emif_clkdm",
515 .fixed_div = 2, 517 .fixed_div = 2,
516 .recalc = &omap_fixed_divisor_recalc, 518 .recalc = &omap_fixed_divisor_recalc,
517}; 519};
@@ -769,6 +771,7 @@ static const struct clksel dpll_mpu_m2_div[] = {
769static struct clk dpll_mpu_m2_ck = { 771static struct clk dpll_mpu_m2_ck = {
770 .name = "dpll_mpu_m2_ck", 772 .name = "dpll_mpu_m2_ck",
771 .parent = &dpll_mpu_ck, 773 .parent = &dpll_mpu_ck,
774 .clkdm_name = "cm_clkdm",
772 .clksel = dpll_mpu_m2_div, 775 .clksel = dpll_mpu_m2_div,
773 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU, 776 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
774 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 777 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
@@ -1149,6 +1152,7 @@ static const struct clksel l3_div_div[] = {
1149static struct clk l3_div_ck = { 1152static struct clk l3_div_ck = {
1150 .name = "l3_div_ck", 1153 .name = "l3_div_ck",
1151 .parent = &div_core_ck, 1154 .parent = &div_core_ck,
1155 .clkdm_name = "cm_clkdm",
1152 .clksel = l3_div_div, 1156 .clksel = l3_div_div,
1153 .clksel_reg = OMAP4430_CM_CLKSEL_CORE, 1157 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1154 .clksel_mask = OMAP4430_CLKSEL_L3_MASK, 1158 .clksel_mask = OMAP4430_CLKSEL_L3_MASK,
@@ -2824,6 +2828,7 @@ static const struct clksel trace_clk_div_div[] = {
2824static struct clk trace_clk_div_ck = { 2828static struct clk trace_clk_div_ck = {
2825 .name = "trace_clk_div_ck", 2829 .name = "trace_clk_div_ck",
2826 .parent = &pmd_trace_clk_mux_ck, 2830 .parent = &pmd_trace_clk_mux_ck,
2831 .clkdm_name = "emu_sys_clkdm",
2827 .clksel = trace_clk_div_div, 2832 .clksel = trace_clk_div_div,
2828 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, 2833 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2829 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK, 2834 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
@@ -3412,9 +3417,12 @@ int __init omap4xxx_clk_init(void)
3412 if (cpu_is_omap443x()) { 3417 if (cpu_is_omap443x()) {
3413 cpu_mask = RATE_IN_4430; 3418 cpu_mask = RATE_IN_4430;
3414 cpu_clkflg = CK_443X; 3419 cpu_clkflg = CK_443X;
3415 } else if (cpu_is_omap446x()) { 3420 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
3416 cpu_mask = RATE_IN_4460 | RATE_IN_4430; 3421 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
3417 cpu_clkflg = CK_446X | CK_443X; 3422 cpu_clkflg = CK_446X | CK_443X;
3423
3424 if (cpu_is_omap447x())
3425 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
3418 } else { 3426 } else {
3419 return 0; 3427 return 0;
3420 } 3428 }
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index a7bc096bd407..f24e3f7a2bbc 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -22,4 +22,15 @@
22 */ 22 */
23#define MAX_MODULE_READY_TIME 2000 23#define MAX_MODULE_READY_TIME 2000
24 24
25/*
26 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
27 * the PRCM to request that a module enter the inactive state in the
28 * case of OMAP2 & 3. In the case of OMAP4 this is the max duration
29 * in microseconds for the module to reach the inactive state from
30 * a functional state.
31 * XXX FSUSB on OMAP4430 takes ~4ms to idle after reset during
32 * kernel init.
33 */
34#define MAX_MODULE_DISABLE_TIME 5000
35
25#endif 36#endif
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 8c86d294b1a3..1a39945d9ff8 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -313,9 +313,9 @@ int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_off
313 313
314 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) == 314 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) ==
315 CLKCTRL_IDLEST_DISABLED), 315 CLKCTRL_IDLEST_DISABLED),
316 MAX_MODULE_READY_TIME, i); 316 MAX_MODULE_DISABLE_TIME, i);
317 317
318 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 318 return (i < MAX_MODULE_DISABLE_TIME) ? 0 : -EBUSY;
319} 319}
320 320
321/** 321/**
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index 845309f146fe..88ffa1e645cd 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -20,6 +20,9 @@
20 20
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23
24#include <asm/memblock.h>
25
23#include "cm2xxx_3xxx.h" 26#include "cm2xxx_3xxx.h"
24#include "prm2xxx_3xxx.h" 27#include "prm2xxx_3xxx.h"
25#ifdef CONFIG_BRIDGE_DVFS 28#ifdef CONFIG_BRIDGE_DVFS
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 0389b3264abe..00486a8564fd 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -247,6 +247,17 @@ void __init omap3xxx_check_features(void)
247 omap_features |= OMAP3_HAS_SDRC; 247 omap_features |= OMAP3_HAS_SDRC;
248 248
249 /* 249 /*
250 * am35x fixups:
251 * - The am35x Chip ID register has bits 12, 7:5, and 3:2 marked as
252 * reserved and therefore return 0 when read. Unfortunately,
253 * OMAP3_CHECK_FEATURE() will interpret some of those zeroes to
254 * mean that a feature is present even though it isn't so clear
255 * the incorrectly set feature bits.
256 */
257 if (soc_is_am35xx())
258 omap_features &= ~(OMAP3_HAS_IVA | OMAP3_HAS_ISP);
259
260 /*
250 * TODO: Get additional info (where applicable) 261 * TODO: Get additional info (where applicable)
251 * e.g. Size of L2 cache. 262 * e.g. Size of L2 cache.
252 */ 263 */
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 428685f65060..d5b34febd82d 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -149,6 +149,7 @@ omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
149 ct->chip.irq_ack = omap_mask_ack_irq; 149 ct->chip.irq_ack = omap_mask_ack_irq;
150 ct->chip.irq_mask = irq_gc_mask_disable_reg; 150 ct->chip.irq_mask = irq_gc_mask_disable_reg;
151 ct->chip.irq_unmask = irq_gc_unmask_enable_reg; 151 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
152 ct->chip.flags |= IRQCHIP_SKIP_SET_WAKE;
152 153
153 ct->regs.enable = INTC_MIR_CLEAR0; 154 ct->regs.enable = INTC_MIR_CLEAR0;
154 ct->regs.disable = INTC_MIR_SET0; 155 ct->regs.disable = INTC_MIR_SET0;
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 80e55c5c9998..9fe6829f4c16 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -41,6 +41,7 @@
41#include "control.h" 41#include "control.h"
42#include "mux.h" 42#include "mux.h"
43#include "prm.h" 43#include "prm.h"
44#include "common.h"
44 45
45#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */ 46#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */
46#define OMAP_MUX_BASE_SZ 0x5ca 47#define OMAP_MUX_BASE_SZ 0x5ca
@@ -217,8 +218,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
217 return -ENODEV; 218 return -ENODEV;
218} 219}
219 220
220static int __init 221int __init omap_mux_get_by_name(const char *muxname,
221omap_mux_get_by_name(const char *muxname,
222 struct omap_mux_partition **found_partition, 222 struct omap_mux_partition **found_partition,
223 struct omap_mux **found_mux) 223 struct omap_mux **found_mux)
224{ 224{
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 69fe060a0b75..471e62a74a16 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -59,6 +59,7 @@
59#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN 59#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN
60 60
61#define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) 61#define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4)
62#define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0)
62 63
63/* Flags for omapX_mux_init */ 64/* Flags for omapX_mux_init */
64#define OMAP_PACKAGE_MASK 0xffff 65#define OMAP_PACKAGE_MASK 0xffff
@@ -225,8 +226,18 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads);
225 */ 226 */
226void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); 227void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state);
227 228
229int omap_mux_get_by_name(const char *muxname,
230 struct omap_mux_partition **found_partition,
231 struct omap_mux **found_mux);
228#else 232#else
229 233
234static inline int omap_mux_get_by_name(const char *muxname,
235 struct omap_mux_partition **found_partition,
236 struct omap_mux **found_mux)
237{
238 return 0;
239}
240
230static inline int omap_mux_init_gpio(int gpio, int val) 241static inline int omap_mux_init_gpio(int gpio, int val)
231{ 242{
232 return 0; 243 return 0;
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index bf86f7e8f91f..773193670ea2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -530,7 +530,7 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
530 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) 530 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP)
531 _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART, v); 531 _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART, v);
532 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) 532 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP)
533 _set_master_standbymode(oh, HWMOD_IDLEMODE_SMART_WKUP, v); 533 _set_master_standbymode(oh, HWMOD_IDLEMODE_SMART, v);
534 534
535 /* XXX test pwrdm_get_wken for this hwmod's subsystem */ 535 /* XXX test pwrdm_get_wken for this hwmod's subsystem */
536 536
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 950454a3fa31..b7bcba5221ba 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -393,8 +393,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_counter_sysc = {
393 .rev_offs = 0x0000, 393 .rev_offs = 0x0000,
394 .sysc_offs = 0x0004, 394 .sysc_offs = 0x0004,
395 .sysc_flags = SYSC_HAS_SIDLEMODE, 395 .sysc_flags = SYSC_HAS_SIDLEMODE,
396 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 396 .idlemodes = (SIDLE_FORCE | SIDLE_NO),
397 SIDLE_SMART_WKUP),
398 .sysc_fields = &omap_hwmod_sysc_type1, 397 .sysc_fields = &omap_hwmod_sysc_type1,
399}; 398};
400 399
@@ -854,6 +853,11 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
854 .name = "dss_hdmi", 853 .name = "dss_hdmi",
855 .class = &omap44xx_hdmi_hwmod_class, 854 .class = &omap44xx_hdmi_hwmod_class,
856 .clkdm_name = "l3_dss_clkdm", 855 .clkdm_name = "l3_dss_clkdm",
856 /*
857 * HDMI audio requires to use no-idle mode. Hence,
858 * set idle mode by software.
859 */
860 .flags = HWMOD_SWSUP_SIDLE,
857 .mpu_irqs = omap44xx_dss_hdmi_irqs, 861 .mpu_irqs = omap44xx_dss_hdmi_irqs,
858 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, 862 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs,
859 .main_clk = "dss_48mhz_clk", 863 .main_clk = "dss_48mhz_clk",
@@ -1924,7 +1928,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp1_sdma_reqs[] = {
1924 1928
1925static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = { 1929static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
1926 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1930 { .role = "pad_fck", .clk = "pad_clks_ck" },
1927 { .role = "prcm_clk", .clk = "mcbsp1_sync_mux_ck" }, 1931 { .role = "prcm_fck", .clk = "mcbsp1_sync_mux_ck" },
1928}; 1932};
1929 1933
1930static struct omap_hwmod omap44xx_mcbsp1_hwmod = { 1934static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
@@ -1959,7 +1963,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp2_sdma_reqs[] = {
1959 1963
1960static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = { 1964static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = {
1961 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1965 { .role = "pad_fck", .clk = "pad_clks_ck" },
1962 { .role = "prcm_clk", .clk = "mcbsp2_sync_mux_ck" }, 1966 { .role = "prcm_fck", .clk = "mcbsp2_sync_mux_ck" },
1963}; 1967};
1964 1968
1965static struct omap_hwmod omap44xx_mcbsp2_hwmod = { 1969static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
@@ -1994,7 +1998,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp3_sdma_reqs[] = {
1994 1998
1995static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = { 1999static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = {
1996 { .role = "pad_fck", .clk = "pad_clks_ck" }, 2000 { .role = "pad_fck", .clk = "pad_clks_ck" },
1997 { .role = "prcm_clk", .clk = "mcbsp3_sync_mux_ck" }, 2001 { .role = "prcm_fck", .clk = "mcbsp3_sync_mux_ck" },
1998}; 2002};
1999 2003
2000static struct omap_hwmod omap44xx_mcbsp3_hwmod = { 2004static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
@@ -2029,7 +2033,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp4_sdma_reqs[] = {
2029 2033
2030static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = { 2034static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = {
2031 { .role = "pad_fck", .clk = "pad_clks_ck" }, 2035 { .role = "pad_fck", .clk = "pad_clks_ck" },
2032 { .role = "prcm_clk", .clk = "mcbsp4_sync_mux_ck" }, 2036 { .role = "prcm_fck", .clk = "mcbsp4_sync_mux_ck" },
2033}; 2037};
2034 2038
2035static struct omap_hwmod omap44xx_mcbsp4_hwmod = { 2039static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
@@ -3860,7 +3864,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = {
3860}; 3864};
3861 3865
3862/* usb_host_fs -> l3_main_2 */ 3866/* usb_host_fs -> l3_main_2 */
3863static struct omap_hwmod_ocp_if omap44xx_usb_host_fs__l3_main_2 = { 3867static struct omap_hwmod_ocp_if __maybe_unused omap44xx_usb_host_fs__l3_main_2 = {
3864 .master = &omap44xx_usb_host_fs_hwmod, 3868 .master = &omap44xx_usb_host_fs_hwmod,
3865 .slave = &omap44xx_l3_main_2_hwmod, 3869 .slave = &omap44xx_l3_main_2_hwmod,
3866 .clk = "l3_div_ck", 3870 .clk = "l3_div_ck",
@@ -3918,7 +3922,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_3 = {
3918}; 3922};
3919 3923
3920/* aess -> l4_abe */ 3924/* aess -> l4_abe */
3921static struct omap_hwmod_ocp_if omap44xx_aess__l4_abe = { 3925static struct omap_hwmod_ocp_if __maybe_unused omap44xx_aess__l4_abe = {
3922 .master = &omap44xx_aess_hwmod, 3926 .master = &omap44xx_aess_hwmod,
3923 .slave = &omap44xx_l4_abe_hwmod, 3927 .slave = &omap44xx_l4_abe_hwmod,
3924 .clk = "ocp_abe_iclk", 3928 .clk = "ocp_abe_iclk",
@@ -4009,7 +4013,7 @@ static struct omap_hwmod_addr_space omap44xx_aess_addrs[] = {
4009}; 4013};
4010 4014
4011/* l4_abe -> aess */ 4015/* l4_abe -> aess */
4012static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess = { 4016static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_abe__aess = {
4013 .master = &omap44xx_l4_abe_hwmod, 4017 .master = &omap44xx_l4_abe_hwmod,
4014 .slave = &omap44xx_aess_hwmod, 4018 .slave = &omap44xx_aess_hwmod,
4015 .clk = "ocp_abe_iclk", 4019 .clk = "ocp_abe_iclk",
@@ -4027,7 +4031,7 @@ static struct omap_hwmod_addr_space omap44xx_aess_dma_addrs[] = {
4027}; 4031};
4028 4032
4029/* l4_abe -> aess (dma) */ 4033/* l4_abe -> aess (dma) */
4030static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess_dma = { 4034static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_abe__aess_dma = {
4031 .master = &omap44xx_l4_abe_hwmod, 4035 .master = &omap44xx_l4_abe_hwmod,
4032 .slave = &omap44xx_aess_hwmod, 4036 .slave = &omap44xx_aess_hwmod,
4033 .clk = "ocp_abe_iclk", 4037 .clk = "ocp_abe_iclk",
@@ -5853,7 +5857,7 @@ static struct omap_hwmod_addr_space omap44xx_usb_host_fs_addrs[] = {
5853}; 5857};
5854 5858
5855/* l4_cfg -> usb_host_fs */ 5859/* l4_cfg -> usb_host_fs */
5856static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_fs = { 5860static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_cfg__usb_host_fs = {
5857 .master = &omap44xx_l4_cfg_hwmod, 5861 .master = &omap44xx_l4_cfg_hwmod,
5858 .slave = &omap44xx_usb_host_fs_hwmod, 5862 .slave = &omap44xx_usb_host_fs_hwmod,
5859 .clk = "l4_div_ck", 5863 .clk = "l4_div_ck",
@@ -6010,13 +6014,13 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6010 &omap44xx_iva__l3_main_2, 6014 &omap44xx_iva__l3_main_2,
6011 &omap44xx_l3_main_1__l3_main_2, 6015 &omap44xx_l3_main_1__l3_main_2,
6012 &omap44xx_l4_cfg__l3_main_2, 6016 &omap44xx_l4_cfg__l3_main_2,
6013 &omap44xx_usb_host_fs__l3_main_2, 6017 /* &omap44xx_usb_host_fs__l3_main_2, */
6014 &omap44xx_usb_host_hs__l3_main_2, 6018 &omap44xx_usb_host_hs__l3_main_2,
6015 &omap44xx_usb_otg_hs__l3_main_2, 6019 &omap44xx_usb_otg_hs__l3_main_2,
6016 &omap44xx_l3_main_1__l3_main_3, 6020 &omap44xx_l3_main_1__l3_main_3,
6017 &omap44xx_l3_main_2__l3_main_3, 6021 &omap44xx_l3_main_2__l3_main_3,
6018 &omap44xx_l4_cfg__l3_main_3, 6022 &omap44xx_l4_cfg__l3_main_3,
6019 &omap44xx_aess__l4_abe, 6023 /* &omap44xx_aess__l4_abe, */
6020 &omap44xx_dsp__l4_abe, 6024 &omap44xx_dsp__l4_abe,
6021 &omap44xx_l3_main_1__l4_abe, 6025 &omap44xx_l3_main_1__l4_abe,
6022 &omap44xx_mpu__l4_abe, 6026 &omap44xx_mpu__l4_abe,
@@ -6025,8 +6029,8 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6025 &omap44xx_l4_cfg__l4_wkup, 6029 &omap44xx_l4_cfg__l4_wkup,
6026 &omap44xx_mpu__mpu_private, 6030 &omap44xx_mpu__mpu_private,
6027 &omap44xx_l4_cfg__ocp_wp_noc, 6031 &omap44xx_l4_cfg__ocp_wp_noc,
6028 &omap44xx_l4_abe__aess, 6032 /* &omap44xx_l4_abe__aess, */
6029 &omap44xx_l4_abe__aess_dma, 6033 /* &omap44xx_l4_abe__aess_dma, */
6030 &omap44xx_l3_main_2__c2c, 6034 &omap44xx_l3_main_2__c2c,
6031 &omap44xx_l4_wkup__counter_32k, 6035 &omap44xx_l4_wkup__counter_32k,
6032 &omap44xx_l4_cfg__ctrl_module_core, 6036 &omap44xx_l4_cfg__ctrl_module_core,
@@ -6132,7 +6136,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6132 &omap44xx_l4_per__uart2, 6136 &omap44xx_l4_per__uart2,
6133 &omap44xx_l4_per__uart3, 6137 &omap44xx_l4_per__uart3,
6134 &omap44xx_l4_per__uart4, 6138 &omap44xx_l4_per__uart4,
6135 &omap44xx_l4_cfg__usb_host_fs, 6139 /* &omap44xx_l4_cfg__usb_host_fs, */
6136 &omap44xx_l4_cfg__usb_host_hs, 6140 &omap44xx_l4_cfg__usb_host_hs,
6137 &omap44xx_l4_cfg__usb_otg_hs, 6141 &omap44xx_l4_cfg__usb_otg_hs,
6138 &omap44xx_l4_cfg__usb_tll_hs, 6142 &omap44xx_l4_cfg__usb_tll_hs,
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c
index a05a62f9ee5b..acc216491b8a 100644
--- a/arch/arm/mach-omap2/omap_l3_smx.c
+++ b/arch/arm/mach-omap2/omap_l3_smx.c
@@ -155,10 +155,11 @@ static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
155 u8 multi = error & L3_ERROR_LOG_MULTI; 155 u8 multi = error & L3_ERROR_LOG_MULTI;
156 u32 address = omap3_l3_decode_addr(error_addr); 156 u32 address = omap3_l3_decode_addr(error_addr);
157 157
158 WARN(true, "%s seen by %s %s at address %x\n", 158 pr_err("%s seen by %s %s at address %x\n",
159 omap3_l3_code_string(code), 159 omap3_l3_code_string(code),
160 omap3_l3_initiator_string(initid), 160 omap3_l3_initiator_string(initid),
161 multi ? "Multiple Errors" : "", address); 161 multi ? "Multiple Errors" : "", address);
162 WARN_ON(1);
162 163
163 return IRQ_HANDLED; 164 return IRQ_HANDLED;
164} 165}
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 4c90477e6f82..d52651a05daa 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -239,21 +239,15 @@ void am35x_set_mode(u8 musb_mode)
239 239
240 devconf2 &= ~CONF2_OTGMODE; 240 devconf2 &= ~CONF2_OTGMODE;
241 switch (musb_mode) { 241 switch (musb_mode) {
242#ifdef CONFIG_USB_MUSB_HDRC_HCD
243 case MUSB_HOST: /* Force VBUS valid, ID = 0 */ 242 case MUSB_HOST: /* Force VBUS valid, ID = 0 */
244 devconf2 |= CONF2_FORCE_HOST; 243 devconf2 |= CONF2_FORCE_HOST;
245 break; 244 break;
246#endif
247#ifdef CONFIG_USB_GADGET_MUSB_HDRC
248 case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */ 245 case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */
249 devconf2 |= CONF2_FORCE_DEVICE; 246 devconf2 |= CONF2_FORCE_DEVICE;
250 break; 247 break;
251#endif
252#ifdef CONFIG_USB_MUSB_OTG
253 case MUSB_OTG: /* Don't override the VBUS/ID comparators */ 248 case MUSB_OTG: /* Don't override the VBUS/ID comparators */
254 devconf2 |= CONF2_NO_OVERRIDE; 249 devconf2 |= CONF2_NO_OVERRIDE;
255 break; 250 break;
256#endif
257 default: 251 default:
258 pr_info(KERN_INFO "Unsupported mode %u\n", musb_mode); 252 pr_info(KERN_INFO "Unsupported mode %u\n", musb_mode);
259 } 253 }
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a34023d0ca7c..3a595e899724 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -724,6 +724,7 @@ int __init omap3_pm_init(void)
724 ret = request_irq(omap_prcm_event_to_irq("io"), 724 ret = request_irq(omap_prcm_event_to_irq("io"),
725 _prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io", 725 _prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io",
726 omap3_pm_init); 726 omap3_pm_init);
727 enable_irq(omap_prcm_event_to_irq("io"));
727 728
728 if (ret) { 729 if (ret) {
729 pr_err("pm: Failed to request pm_io irq\n"); 730 pr_err("pm: Failed to request pm_io irq\n");
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 9ce765407ad5..21cb74003a56 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -15,6 +15,7 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/irq.h>
18 19
19#include "common.h" 20#include "common.h"
20#include <plat/cpu.h> 21#include <plat/cpu.h>
@@ -303,8 +304,15 @@ void omap3xxx_prm_restore_irqen(u32 *saved_mask)
303 304
304static int __init omap3xxx_prcm_init(void) 305static int __init omap3xxx_prcm_init(void)
305{ 306{
306 if (cpu_is_omap34xx()) 307 int ret = 0;
307 return omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); 308
308 return 0; 309 if (cpu_is_omap34xx()) {
310 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
311 if (!ret)
312 irq_set_status_flags(omap_prcm_event_to_irq("io"),
313 IRQ_NOAUTOEN);
314 }
315
316 return ret;
309} 317}
310subsys_initcall(omap3xxx_prcm_init); 318subsys_initcall(omap3xxx_prcm_init);
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 292d4aaca068..c1b93c752d70 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -57,6 +57,7 @@ struct omap_uart_state {
57 57
58 struct list_head node; 58 struct list_head node;
59 struct omap_hwmod *oh; 59 struct omap_hwmod *oh;
60 struct omap_device_pad default_omap_uart_pads[2];
60}; 61};
61 62
62static LIST_HEAD(uart_list); 63static LIST_HEAD(uart_list);
@@ -126,11 +127,70 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {}
126#endif /* CONFIG_PM */ 127#endif /* CONFIG_PM */
127 128
128#ifdef CONFIG_OMAP_MUX 129#ifdef CONFIG_OMAP_MUX
129static void omap_serial_fill_default_pads(struct omap_board_data *bdata) 130
131#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28
132static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN],
133 tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata;
134
135static void __init
136omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata,
137 struct omap_uart_state *uart)
138{
139 uart->default_omap_uart_pads[0].name = rx_pad_name;
140 uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX |
141 OMAP_DEVICE_PAD_WAKEUP;
142 uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT |
143 OMAP_MUX_MODE0;
144 uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0;
145 uart->default_omap_uart_pads[1].name = tx_pad_name;
146 uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT |
147 OMAP_MUX_MODE0;
148 bdata->pads = uart->default_omap_uart_pads;
149 bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads);
150}
151
152static void __init omap_serial_check_wakeup(struct omap_board_data *bdata,
153 struct omap_uart_state *uart)
130{ 154{
155 struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL;
156 struct omap_mux *rx_mux = NULL, *tx_mux = NULL;
157 char *rx_fmt, *tx_fmt;
158 int uart_nr = bdata->id + 1;
159
160 if (bdata->id != 2) {
161 rx_fmt = "uart%d_rx.uart%d_rx";
162 tx_fmt = "uart%d_tx.uart%d_tx";
163 } else {
164 rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx";
165 tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx";
166 }
167
168 snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt,
169 uart_nr, uart_nr);
170 snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt,
171 uart_nr, uart_nr);
172
173 if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 &&
174 omap_mux_get_by_name
175 (tx_pad_name, &tx_partition, &tx_mux) >= 0) {
176 u16 tx_mode, rx_mode;
177
178 tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset);
179 rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset);
180
181 /*
182 * Check if uart is used in default tx/rx mode i.e. in mux mode0
183 * if yes then configure rx pin for wake up capability
184 */
185 if (OMAP_MODE_UART(rx_mode) && OMAP_MODE_UART(tx_mode))
186 omap_serial_fill_uart_tx_rx_pads(bdata, uart);
187 }
131} 188}
132#else 189#else
133static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} 190static void __init omap_serial_check_wakeup(struct omap_board_data *bdata,
191 struct omap_uart_state *uart)
192{
193}
134#endif 194#endif
135 195
136static char *cmdline_find_option(char *str) 196static char *cmdline_find_option(char *str)
@@ -287,8 +347,7 @@ void __init omap_serial_board_init(struct omap_uart_port_info *info)
287 bdata.pads = NULL; 347 bdata.pads = NULL;
288 bdata.pads_cnt = 0; 348 bdata.pads_cnt = 0;
289 349
290 if (cpu_is_omap44xx() || cpu_is_omap34xx()) 350 omap_serial_check_wakeup(&bdata, uart);
291 omap_serial_fill_default_pads(&bdata);
292 351
293 if (!info) 352 if (!info)
294 omap_serial_init_port(&bdata, NULL); 353 omap_serial_init_port(&bdata, NULL);
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 119d5a910f3a..43a979075338 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -32,6 +32,7 @@
32#include "twl-common.h" 32#include "twl-common.h"
33#include "pm.h" 33#include "pm.h"
34#include "voltage.h" 34#include "voltage.h"
35#include "mux.h"
35 36
36static struct i2c_board_info __initdata pmic_i2c_board_info = { 37static struct i2c_board_info __initdata pmic_i2c_board_info = {
37 .addr = 0x48, 38 .addr = 0x48,
@@ -77,6 +78,7 @@ void __init omap4_pmic_init(const char *pmic_type,
77 struct twl6040_platform_data *twl6040_data, int twl6040_irq) 78 struct twl6040_platform_data *twl6040_data, int twl6040_irq)
78{ 79{
79 /* PMIC part*/ 80 /* PMIC part*/
81 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
80 strncpy(omap4_i2c1_board_info[0].type, pmic_type, 82 strncpy(omap4_i2c1_board_info[0].type, pmic_type,
81 sizeof(omap4_i2c1_board_info[0].type)); 83 sizeof(omap4_i2c1_board_info[0].type));
82 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N; 84 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N;
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index b19d1b43c12e..c4a576856661 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -41,12 +41,10 @@ static struct musb_hdrc_config musb_config = {
41}; 41};
42 42
43static struct musb_hdrc_platform_data musb_plat = { 43static struct musb_hdrc_platform_data musb_plat = {
44#ifdef CONFIG_USB_MUSB_OTG 44#ifdef CONFIG_USB_GADGET_MUSB_HDRC
45 .mode = MUSB_OTG, 45 .mode = MUSB_OTG,
46#elif defined(CONFIG_USB_MUSB_HDRC_HCD) 46#else
47 .mode = MUSB_HOST, 47 .mode = MUSB_HOST,
48#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
49 .mode = MUSB_PERIPHERAL,
50#endif 48#endif
51 /* .clock is set dynamically */ 49 /* .clock is set dynamically */
52 .config = &musb_config, 50 .config = &musb_config,
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index db84a46ce7fd..805bea6edf17 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -300,7 +300,7 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
300 printk(error, 3, status); 300 printk(error, 3, status);
301 return status; 301 return status;
302 } 302 }
303 tusb_resources[2].start = irq + IH_GPIO_BASE; 303 tusb_resources[2].start = gpio_to_irq(irq);
304 304
305 /* set up memory timings ... can speed them up later */ 305 /* set up memory timings ... can speed them up later */
306 if (!ps_refclk) { 306 if (!ps_refclk) {
diff --git a/arch/arm/mach-orion5x/include/mach/bridge-regs.h b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
index 96484bcd34ca..11a3c1e9801f 100644
--- a/arch/arm/mach-orion5x/include/mach/bridge-regs.h
+++ b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
@@ -35,5 +35,5 @@
35#define MAIN_IRQ_MASK (ORION5X_BRIDGE_VIRT_BASE | 0x204) 35#define MAIN_IRQ_MASK (ORION5X_BRIDGE_VIRT_BASE | 0x204)
36 36
37#define TIMER_VIRT_BASE (ORION5X_BRIDGE_VIRT_BASE | 0x300) 37#define TIMER_VIRT_BASE (ORION5X_BRIDGE_VIRT_BASE | 0x300)
38 38#define TIMER_PHYS_BASE (ORION5X_BRIDGE_PHYS_BASE | 0x300)
39#endif 39#endif
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h
new file mode 100644
index 000000000000..1aa5d0a50a0b
--- /dev/null
+++ b/arch/arm/mach-orion5x/include/mach/io.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/io.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ASM_ARCH_IO_H
10#define __ASM_ARCH_IO_H
11
12#include <mach/orion5x.h>
13#include <asm/sizes.h>
14
15#define IO_SPACE_LIMIT SZ_2M
16static inline void __iomem *__io(unsigned long addr)
17{
18 return (void __iomem *)(addr + ORION5X_PCIE_IO_VIRT_BASE);
19}
20
21#define __io(a) __io(a)
22#endif
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h
index 2745f5d95b3f..683e085ce162 100644
--- a/arch/arm/mach-orion5x/include/mach/orion5x.h
+++ b/arch/arm/mach-orion5x/include/mach/orion5x.h
@@ -82,6 +82,7 @@
82#define UART1_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE | 0x2100) 82#define UART1_VIRT_BASE (ORION5X_DEV_BUS_VIRT_BASE | 0x2100)
83 83
84#define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x20000) 84#define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x20000)
85#define ORION5X_BRIDGE_PHYS_BASE (ORION5X_REGS_PHYS_BASE | 0x20000)
85 86
86#define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x30000) 87#define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE | 0x30000)
87 88
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index d09da6a746b8..d3de84b0dcbe 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -127,7 +127,11 @@ static unsigned long hx4700_pin_config[] __initdata = {
127 GPIO19_SSP2_SCLK, 127 GPIO19_SSP2_SCLK,
128 GPIO86_SSP2_RXD, 128 GPIO86_SSP2_RXD,
129 GPIO87_SSP2_TXD, 129 GPIO87_SSP2_TXD,
130 GPIO88_GPIO, 130 GPIO88_GPIO | MFP_LPM_DRIVE_HIGH, /* TSC2046_CS */
131
132 /* BQ24022 Regulator */
133 GPIO72_GPIO | MFP_LPM_KEEP_OUTPUT, /* BQ24022_nCHARGE_EN */
134 GPIO96_GPIO | MFP_LPM_KEEP_OUTPUT, /* BQ24022_ISET2 */
131 135
132 /* HX4700 specific input GPIOs */ 136 /* HX4700 specific input GPIOs */
133 GPIO12_GPIO | WAKEUP_ON_EDGE_RISE, /* ASIC3_IRQ */ 137 GPIO12_GPIO | WAKEUP_ON_EDGE_RISE, /* ASIC3_IRQ */
@@ -135,6 +139,10 @@ static unsigned long hx4700_pin_config[] __initdata = {
135 GPIO14_GPIO, /* nWLAN_IRQ */ 139 GPIO14_GPIO, /* nWLAN_IRQ */
136 140
137 /* HX4700 specific output GPIOs */ 141 /* HX4700 specific output GPIOs */
142 GPIO61_GPIO | MFP_LPM_DRIVE_HIGH, /* W3220_nRESET */
143 GPIO71_GPIO | MFP_LPM_DRIVE_HIGH, /* ASIC3_nRESET */
144 GPIO81_GPIO | MFP_LPM_DRIVE_HIGH, /* CPU_GP_nRESET */
145 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* CPU_HW_nRESET */
138 GPIO102_GPIO | MFP_LPM_DRIVE_LOW, /* SYNAPTICS_POWER_ON */ 146 GPIO102_GPIO | MFP_LPM_DRIVE_LOW, /* SYNAPTICS_POWER_ON */
139 147
140 GPIO10_GPIO, /* GSM_IRQ */ 148 GPIO10_GPIO, /* GSM_IRQ */
@@ -872,14 +880,19 @@ static struct gpio global_gpios[] = {
872 { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" }, 880 { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
873 { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" }, 881 { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
874 { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" }, 882 { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" },
883 { GPIO61_HX4700_W3220_nRESET, GPIOF_OUT_INIT_HIGH, "W3220_nRESET" },
875 { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" }, 884 { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
885 { GPIO81_HX4700_CPU_GP_nRESET, GPIOF_OUT_INIT_HIGH, "CPU_GP_nRESET" },
876 { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" }, 886 { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
887 { GPIO116_HX4700_CPU_HW_nRESET, GPIOF_OUT_INIT_HIGH, "CPU_HW_nRESET" },
877}; 888};
878 889
879static void __init hx4700_init(void) 890static void __init hx4700_init(void)
880{ 891{
881 int ret; 892 int ret;
882 893
894 PCFR = PCFR_GPR_EN | PCFR_OPDE;
895
883 pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config)); 896 pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
884 gpio_set_wake(GPIO12_HX4700_ASIC3_IRQ, 1); 897 gpio_set_wake(GPIO12_HX4700_ASIC3_IRQ, 1);
885 ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios)); 898 ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 9e37026ef9dd..9bd135531d76 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -779,6 +779,7 @@ DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
779 .init_irq = r8a7740_init_irq, 779 .init_irq = r8a7740_init_irq,
780 .handle_irq = shmobile_handle_irq_intc, 780 .handle_irq = shmobile_handle_irq_intc,
781 .init_machine = eva_init, 781 .init_machine = eva_init,
782 .init_late = shmobile_init_late,
782 .timer = &shmobile_timer, 783 .timer = &shmobile_timer,
783 .dt_compat = eva_boards_compat_dt, 784 .dt_compat = eva_boards_compat_dt,
784MACHINE_END 785MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
index 7bc5e7d39f9b..6a33cf393428 100644
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -80,6 +80,7 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d")
80 .init_irq = emev2_init_irq, 80 .init_irq = emev2_init_irq,
81 .handle_irq = gic_handle_irq, 81 .handle_irq = gic_handle_irq,
82 .init_machine = kzm9d_add_standard_devices, 82 .init_machine = kzm9d_add_standard_devices,
83 .init_late = shmobile_init_late,
83 .timer = &shmobile_timer, 84 .timer = &shmobile_timer,
84 .dt_compat = kzm9d_boards_compat_dt, 85 .dt_compat = kzm9d_boards_compat_dt,
85MACHINE_END 86MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index d8e33b682832..c0ae815e7beb 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -455,6 +455,7 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g")
455 .init_irq = sh73a0_init_irq, 455 .init_irq = sh73a0_init_irq,
456 .handle_irq = gic_handle_irq, 456 .handle_irq = gic_handle_irq,
457 .init_machine = kzm_init, 457 .init_machine = kzm_init,
458 .init_late = shmobile_init_late,
458 .timer = &shmobile_timer, 459 .timer = &shmobile_timer,
459 .dt_compat = kzm9g_boards_compat_dt, 460 .dt_compat = kzm9g_boards_compat_dt,
460MACHINE_END 461MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index b577f7c44678..150122a44630 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -1512,6 +1512,9 @@ static void __init mackerel_init(void)
1512 gpio_request(GPIO_FN_SDHID0_1, NULL); 1512 gpio_request(GPIO_FN_SDHID0_1, NULL);
1513 gpio_request(GPIO_FN_SDHID0_0, NULL); 1513 gpio_request(GPIO_FN_SDHID0_0, NULL);
1514 1514
1515 /* SDHI0 PORT172 card-detect IRQ26 */
1516 gpio_request(GPIO_FN_IRQ26_172, NULL);
1517
1515#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 1518#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1516 /* enable SDHI1 */ 1519 /* enable SDHI1 */
1517 gpio_request(GPIO_FN_SDHICMD1, NULL); 1520 gpio_request(GPIO_FN_SDHICMD1, NULL);
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 472d1f5361e5..3946c4ba2aa8 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -475,9 +475,9 @@ static struct clk *late_main_clks[] = {
475 475
476enum { MSTP001, 476enum { MSTP001,
477 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, 477 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
478 MSTP219, 478 MSTP219, MSTP218,
479 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 479 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
480 MSTP331, MSTP329, MSTP325, MSTP323, MSTP318, 480 MSTP331, MSTP329, MSTP325, MSTP323,
481 MSTP314, MSTP313, MSTP312, MSTP311, 481 MSTP314, MSTP313, MSTP312, MSTP311,
482 MSTP303, MSTP302, MSTP301, MSTP300, 482 MSTP303, MSTP302, MSTP301, MSTP300,
483 MSTP411, MSTP410, MSTP403, 483 MSTP411, MSTP410, MSTP403,
@@ -497,6 +497,7 @@ static struct clk mstp_clks[MSTP_NR] = {
497 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ 497 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */
498 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ 498 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
499 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ 499 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */
500 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */
500 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ 501 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
501 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ 502 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
502 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ 503 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
@@ -508,7 +509,6 @@ static struct clk mstp_clks[MSTP_NR] = {
508 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 509 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
509 [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ 510 [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */
510 [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ 511 [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */
511 [MSTP318] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 18, 0), /* SY-DMAC */
512 [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */ 512 [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */
513 [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ 513 [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */
514 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ 514 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */
@@ -552,6 +552,7 @@ static struct clk_lookup lookups[] = {
552 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ 552 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
553 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ 553 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
554 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ 554 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
555 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */
555 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 556 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
556 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ 557 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
557 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ 558 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
@@ -563,7 +564,6 @@ static struct clk_lookup lookups[] = {
563 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ 564 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
564 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ 565 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
565 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ 566 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
566 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP318]), /* SY-DMAC */
567 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 567 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
568 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 568 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
569 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ 569 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 550b23df4fd4..f04fad4ec4fb 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -35,6 +35,9 @@
35#define INT2SMSKCR3 0xfe7822ac 35#define INT2SMSKCR3 0xfe7822ac
36#define INT2SMSKCR4 0xfe7822b0 36#define INT2SMSKCR4 0xfe7822b0
37 37
38#define INT2NTSR0 0xfe700060
39#define INT2NTSR1 0xfe700064
40
38static int r8a7779_set_wake(struct irq_data *data, unsigned int on) 41static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
39{ 42{
40 return 0; /* always allow wakeup */ 43 return 0; /* always allow wakeup */
@@ -49,6 +52,10 @@ void __init r8a7779_init_irq(void)
49 gic_init(0, 29, gic_dist_base, gic_cpu_base); 52 gic_init(0, 29, gic_dist_base, gic_cpu_base);
50 gic_arch_extn.irq_set_wake = r8a7779_set_wake; 53 gic_arch_extn.irq_set_wake = r8a7779_set_wake;
51 54
55 /* route all interrupts to ARM */
56 __raw_writel(0xffffffff, INT2NTSR0);
57 __raw_writel(0x3fffffff, INT2NTSR1);
58
52 /* unmask all known interrupts in INTCS2 */ 59 /* unmask all known interrupts in INTCS2 */
53 __raw_writel(0xfffffff0, INT2SMSKCR0); 60 __raw_writel(0xfffffff0, INT2SMSKCR0);
54 __raw_writel(0xfff7ffff, INT2SMSKCR1); 61 __raw_writel(0xfff7ffff, INT2SMSKCR1);
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index bacdd667e3b1..e859fcdb3d58 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -25,7 +25,12 @@
25#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \ 25#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \
26 of_machine_is_compatible("renesas,sh73a0")) 26 of_machine_is_compatible("renesas,sh73a0"))
27#define is_r8a7779() machine_is_marzen() 27#define is_r8a7779() machine_is_marzen()
28
29#ifdef CONFIG_ARCH_EMEV2
28#define is_emev2() of_machine_is_compatible("renesas,emev2") 30#define is_emev2() of_machine_is_compatible("renesas,emev2")
31#else
32#define is_emev2() (0)
33#endif
29 34
30static unsigned int __init shmobile_smp_get_core_count(void) 35static unsigned int __init shmobile_smp_get_core_count(void)
31{ 36{
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 6a4bd582c028..fafce9ce8218 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -484,7 +484,7 @@ static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
484 }, 484 },
485}; 485};
486 486
487#define SH7372_CHCLR 0x220 487#define SH7372_CHCLR (0x220 - 0x20)
488 488
489static const struct sh_dmae_channel sh7372_dmae_channels[] = { 489static const struct sh_dmae_channel sh7372_dmae_channels[] = {
490 { 490 {
diff --git a/arch/arm/mach-spear13xx/include/mach/debug-macro.S b/arch/arm/mach-spear13xx/include/mach/debug-macro.S
index ea1564609bd4..9e3ae6bfe50d 100644
--- a/arch/arm/mach-spear13xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-spear13xx/include/mach/debug-macro.S
@@ -4,7 +4,7 @@
4 * Debugging macro include header spear13xx machine family 4 * Debugging macro include header spear13xx machine family
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/dma.h b/arch/arm/mach-spear13xx/include/mach/dma.h
index 383ab04dc6c9..d50bdb605925 100644
--- a/arch/arm/mach-spear13xx/include/mach/dma.h
+++ b/arch/arm/mach-spear13xx/include/mach/dma.h
@@ -4,7 +4,7 @@
4 * DMA information for SPEAr13xx machine family 4 * DMA information for SPEAr13xx machine family
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/generic.h b/arch/arm/mach-spear13xx/include/mach/generic.h
index 6d8c45b9f298..dac57fd0cdfd 100644
--- a/arch/arm/mach-spear13xx/include/mach/generic.h
+++ b/arch/arm/mach-spear13xx/include/mach/generic.h
@@ -4,7 +4,7 @@
4 * spear13xx machine family generic header file 4 * spear13xx machine family generic header file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/gpio.h b/arch/arm/mach-spear13xx/include/mach/gpio.h
index cd6f4f86a56b..85f176311f63 100644
--- a/arch/arm/mach-spear13xx/include/mach/gpio.h
+++ b/arch/arm/mach-spear13xx/include/mach/gpio.h
@@ -4,7 +4,7 @@
4 * GPIO macros for SPEAr13xx machine family 4 * GPIO macros for SPEAr13xx machine family
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/irqs.h b/arch/arm/mach-spear13xx/include/mach/irqs.h
index f542a24aa5f2..271a62b4cd31 100644
--- a/arch/arm/mach-spear13xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear13xx/include/mach/irqs.h
@@ -4,7 +4,7 @@
4 * IRQ helper macros for spear13xx machine family 4 * IRQ helper macros for spear13xx machine family
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/spear.h b/arch/arm/mach-spear13xx/include/mach/spear.h
index 30c57ef72686..65f27def239b 100644
--- a/arch/arm/mach-spear13xx/include/mach/spear.h
+++ b/arch/arm/mach-spear13xx/include/mach/spear.h
@@ -4,7 +4,7 @@
4 * spear13xx Machine family specific definition 4 * spear13xx Machine family specific definition
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/timex.h b/arch/arm/mach-spear13xx/include/mach/timex.h
index 31af3e8d976e..3a58b8284a6a 100644
--- a/arch/arm/mach-spear13xx/include/mach/timex.h
+++ b/arch/arm/mach-spear13xx/include/mach/timex.h
@@ -4,7 +4,7 @@
4 * SPEAr3XX machine family specific timex definitions 4 * SPEAr3XX machine family specific timex definitions
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/include/mach/uncompress.h b/arch/arm/mach-spear13xx/include/mach/uncompress.h
index c7840896ae6e..70fe72f05dea 100644
--- a/arch/arm/mach-spear13xx/include/mach/uncompress.h
+++ b/arch/arm/mach-spear13xx/include/mach/uncompress.h
@@ -4,7 +4,7 @@
4 * Serial port stubs for kernel decompress status messages 4 * Serial port stubs for kernel decompress status messages
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/spear1310.c b/arch/arm/mach-spear13xx/spear1310.c
index fefd15b2f380..732d29bc7330 100644
--- a/arch/arm/mach-spear13xx/spear1310.c
+++ b/arch/arm/mach-spear13xx/spear1310.c
@@ -4,7 +4,7 @@
4 * SPEAr1310 machine source file 4 * SPEAr1310 machine source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/spear1340.c b/arch/arm/mach-spear13xx/spear1340.c
index ee38cbc56869..81e4ed76ad06 100644
--- a/arch/arm/mach-spear13xx/spear1340.c
+++ b/arch/arm/mach-spear13xx/spear1340.c
@@ -4,7 +4,7 @@
4 * SPEAr1340 machine source file 4 * SPEAr1340 machine source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear13xx/spear13xx.c
index 50b349ae863d..cf936b106e27 100644
--- a/arch/arm/mach-spear13xx/spear13xx.c
+++ b/arch/arm/mach-spear13xx/spear13xx.c
@@ -4,7 +4,7 @@
4 * SPEAr13XX machines common source file 4 * SPEAr13XX machines common source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/debug-macro.S b/arch/arm/mach-spear3xx/include/mach/debug-macro.S
index 590519f10d6e..0a6381fad5d9 100644
--- a/arch/arm/mach-spear3xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-spear3xx/include/mach/debug-macro.S
@@ -4,7 +4,7 @@
4 * Debugging macro include header spear3xx machine family 4 * Debugging macro include header spear3xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar<viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
index 4a95b9453c2a..ce19113ca791 100644
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ b/arch/arm/mach-spear3xx/include/mach/generic.h
@@ -4,7 +4,7 @@
4 * SPEAr3XX machine family generic header file 4 * SPEAr3XX machine family generic header file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar<viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/gpio.h b/arch/arm/mach-spear3xx/include/mach/gpio.h
index 451b2081bfc9..2ac74c6db7f1 100644
--- a/arch/arm/mach-spear3xx/include/mach/gpio.h
+++ b/arch/arm/mach-spear3xx/include/mach/gpio.h
@@ -4,7 +4,7 @@
4 * GPIO macros for SPEAr3xx machine family 4 * GPIO macros for SPEAr3xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar<viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h
index 51bd62a0254c..803de76f5f36 100644
--- a/arch/arm/mach-spear3xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear3xx/include/mach/irqs.h
@@ -4,7 +4,7 @@
4 * IRQ helper macros for SPEAr3xx machine family 4 * IRQ helper macros for SPEAr3xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
index 18e2ac576f25..6309bf68d6f8 100644
--- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
@@ -4,7 +4,7 @@
4 * Miscellaneous registers definitions for SPEAr3xx machine family 4 * Miscellaneous registers definitions for SPEAr3xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h
index 51eb953148a9..8cca95193d4d 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear.h
@@ -4,7 +4,7 @@
4 * SPEAr3xx Machine family specific definition 4 * SPEAr3xx Machine family specific definition
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/timex.h b/arch/arm/mach-spear3xx/include/mach/timex.h
index a38cc9de876f..9f5d08bd0c44 100644
--- a/arch/arm/mach-spear3xx/include/mach/timex.h
+++ b/arch/arm/mach-spear3xx/include/mach/timex.h
@@ -4,7 +4,7 @@
4 * SPEAr3XX machine family specific timex definitions 4 * SPEAr3XX machine family specific timex definitions
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/include/mach/uncompress.h b/arch/arm/mach-spear3xx/include/mach/uncompress.h
index 53ba8bbc0dfa..b909b011f7c8 100644
--- a/arch/arm/mach-spear3xx/include/mach/uncompress.h
+++ b/arch/arm/mach-spear3xx/include/mach/uncompress.h
@@ -4,7 +4,7 @@
4 * Serial port stubs for kernel decompress status messages 4 * Serial port stubs for kernel decompress status messages
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear3xx/spear300.c
index f74a05bdb829..0f882ecb7d81 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear3xx/spear300.c
@@ -4,7 +4,7 @@
4 * SPEAr300 machine source file 4 * SPEAr300 machine source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear3xx/spear310.c
index 84dfb0900747..bbcf4571d361 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear3xx/spear310.c
@@ -4,7 +4,7 @@
4 * SPEAr310 machine source file 4 * SPEAr310 machine source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear3xx/spear320.c
index a88fa841d29d..88d483bcd66a 100644
--- a/arch/arm/mach-spear3xx/spear320.c
+++ b/arch/arm/mach-spear3xx/spear320.c
@@ -4,7 +4,7 @@
4 * SPEAr320 machine source file 4 * SPEAr320 machine source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index f22419ed74a8..0f41bd1c47c3 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -4,7 +4,7 @@
4 * SPEAr3XX machines common source file 4 * SPEAr3XX machines common source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear6xx/include/mach/gpio.h b/arch/arm/mach-spear6xx/include/mach/gpio.h
index 3a789dbb69f7..d42cefc0356d 100644
--- a/arch/arm/mach-spear6xx/include/mach/gpio.h
+++ b/arch/arm/mach-spear6xx/include/mach/gpio.h
@@ -4,7 +4,7 @@
4 * GPIO macros for SPEAr6xx machine family 4 * GPIO macros for SPEAr6xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear6xx/include/mach/misc_regs.h b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
index 179e45774b3a..c34acc201d34 100644
--- a/arch/arm/mach-spear6xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
@@ -4,7 +4,7 @@
4 * Miscellaneous registers definitions for SPEAr6xx machine family 4 * Miscellaneous registers definitions for SPEAr6xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index 4d6a2ee99c3b..5beb7ebe2948 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -33,7 +33,7 @@
33 33
34static bool is_enabled; 34static bool is_enabled;
35 35
36static void tegra_cpu_reset_handler_enable(void) 36static void __init tegra_cpu_reset_handler_enable(void)
37{ 37{
38 void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE); 38 void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
39 void __iomem *evp_cpu_reset = 39 void __iomem *evp_cpu_reset =
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 9c74ac545849..1509a3cb5833 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -580,43 +580,12 @@ static void ux500_uart0_reset(void)
580 udelay(1); 580 udelay(1);
581} 581}
582 582
583/* This needs to be referenced by callbacks */
584struct pinctrl *u0_p;
585struct pinctrl_state *u0_def;
586struct pinctrl_state *u0_sleep;
587
588static void ux500_uart0_init(void)
589{
590 int ret;
591
592 if (IS_ERR(u0_p) || IS_ERR(u0_def))
593 return;
594
595 ret = pinctrl_select_state(u0_p, u0_def);
596 if (ret)
597 pr_err("could not set UART0 defstate\n");
598}
599
600static void ux500_uart0_exit(void)
601{
602 int ret;
603
604 if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
605 return;
606
607 ret = pinctrl_select_state(u0_p, u0_sleep);
608 if (ret)
609 pr_err("could not set UART0 idlestate\n");
610}
611
612static struct amba_pl011_data uart0_plat = { 583static struct amba_pl011_data uart0_plat = {
613#ifdef CONFIG_STE_DMA40 584#ifdef CONFIG_STE_DMA40
614 .dma_filter = stedma40_filter, 585 .dma_filter = stedma40_filter,
615 .dma_rx_param = &uart0_dma_cfg_rx, 586 .dma_rx_param = &uart0_dma_cfg_rx,
616 .dma_tx_param = &uart0_dma_cfg_tx, 587 .dma_tx_param = &uart0_dma_cfg_tx,
617#endif 588#endif
618 .init = ux500_uart0_init,
619 .exit = ux500_uart0_exit,
620 .reset = ux500_uart0_reset, 589 .reset = ux500_uart0_reset,
621}; 590};
622 591
@@ -638,28 +607,7 @@ static struct amba_pl011_data uart2_plat = {
638 607
639static void __init mop500_uart_init(struct device *parent) 608static void __init mop500_uart_init(struct device *parent)
640{ 609{
641 struct amba_device *uart0_device; 610 db8500_add_uart0(parent, &uart0_plat);
642
643 uart0_device = db8500_add_uart0(parent, &uart0_plat);
644 if (uart0_device) {
645 u0_p = pinctrl_get(&uart0_device->dev);
646 if (IS_ERR(u0_p))
647 dev_err(&uart0_device->dev,
648 "could not get UART0 pinctrl\n");
649 else {
650 u0_def = pinctrl_lookup_state(u0_p,
651 PINCTRL_STATE_DEFAULT);
652 if (IS_ERR(u0_def)) {
653 dev_err(&uart0_device->dev,
654 "could not get UART0 defstate\n");
655 }
656 u0_sleep = pinctrl_lookup_state(u0_p,
657 PINCTRL_STATE_SLEEP);
658 if (IS_ERR(u0_sleep))
659 dev_err(&uart0_device->dev,
660 "could not get UART0 idlestate\n");
661 }
662 }
663 db8500_add_uart1(parent, &uart1_plat); 611 db8500_add_uart1(parent, &uart1_plat);
664 db8500_add_uart2(parent, &uart2_plat); 612 db8500_add_uart2(parent, &uart2_plat);
665} 613}
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index cf4687ee2a7b..cd8ea3588f93 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -169,26 +169,13 @@ static struct map_desc versatile_io_desc[] __initdata = {
169 .pfn = __phys_to_pfn(VERSATILE_PCI_CFG_BASE), 169 .pfn = __phys_to_pfn(VERSATILE_PCI_CFG_BASE),
170 .length = VERSATILE_PCI_CFG_BASE_SIZE, 170 .length = VERSATILE_PCI_CFG_BASE_SIZE,
171 .type = MT_DEVICE 171 .type = MT_DEVICE
172 },
173#if 0
174 {
175 .virtual = VERSATILE_PCI_VIRT_MEM_BASE0,
176 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE0),
177 .length = SZ_16M,
178 .type = MT_DEVICE
179 }, { 172 }, {
180 .virtual = VERSATILE_PCI_VIRT_MEM_BASE1, 173 .virtual = (unsigned long)VERSATILE_PCI_VIRT_MEM_BASE0,
181 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE1), 174 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE0),
182 .length = SZ_16M, 175 .length = IO_SPACE_LIMIT,
183 .type = MT_DEVICE
184 }, {
185 .virtual = VERSATILE_PCI_VIRT_MEM_BASE2,
186 .pfn = __phys_to_pfn(VERSATILE_PCI_MEM_BASE2),
187 .length = SZ_16M,
188 .type = MT_DEVICE 176 .type = MT_DEVICE
189 }, 177 },
190#endif 178#endif
191#endif
192}; 179};
193 180
194void __init versatile_map_io(void) 181void __init versatile_map_io(void)
diff --git a/arch/arm/mach-versatile/include/mach/hardware.h b/arch/arm/mach-versatile/include/mach/hardware.h
index 4d4973dd8fba..408e58da46c6 100644
--- a/arch/arm/mach-versatile/include/mach/hardware.h
+++ b/arch/arm/mach-versatile/include/mach/hardware.h
@@ -29,8 +29,9 @@
29 */ 29 */
30#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul 30#define VERSATILE_PCI_VIRT_BASE (void __iomem *)0xe8000000ul
31#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul 31#define VERSATILE_PCI_CFG_VIRT_BASE (void __iomem *)0xe9000000ul
32#define VERSATILE_PCI_VIRT_MEM_BASE0 (void __iomem *)PCIO_BASE
32 33
33/* macro to get at IO space when running virtually */ 34/* macro to get at MMIO space when running virtually */
34#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 35#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
35 36
36#define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n)) 37#define __io_address(n) ((void __iomem __force *)IO_ADDRESS(n))
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h
new file mode 100644
index 000000000000..0406513be7d8
--- /dev/null
+++ b/arch/arm/mach-versatile/include/mach/io.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-versatile/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
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#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define PCIO_BASE 0xeb000000ul
24
25#define __io(a) ((a) + PCIO_BASE)
26
27#endif
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 15c6a00000ec..e95bf84cc837 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -169,11 +169,18 @@ static struct pci_ops pci_versatile_ops = {
169 .write = versatile_write_config, 169 .write = versatile_write_config,
170}; 170};
171 171
172static struct resource io_port = {
173 .name = "PCI",
174 .start = 0,
175 .end = IO_SPACE_LIMIT,
176 .flags = IORESOURCE_IO,
177};
178
172static struct resource io_mem = { 179static struct resource io_mem = {
173 .name = "PCI I/O space", 180 .name = "PCI I/O space",
174 .start = VERSATILE_PCI_MEM_BASE0, 181 .start = VERSATILE_PCI_MEM_BASE0,
175 .end = VERSATILE_PCI_MEM_BASE0+VERSATILE_PCI_MEM_BASE0_SIZE-1, 182 .end = VERSATILE_PCI_MEM_BASE0+VERSATILE_PCI_MEM_BASE0_SIZE-1,
176 .flags = IORESOURCE_IO, 183 .flags = IORESOURCE_MEM,
177}; 184};
178 185
179static struct resource non_mem = { 186static struct resource non_mem = {
@@ -200,6 +207,12 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys)
200 "memory region (%d)\n", ret); 207 "memory region (%d)\n", ret);
201 goto out; 208 goto out;
202 } 209 }
210 ret = request_resource(&ioport_resource, &io_port);
211 if (ret) {
212 printk(KERN_ERR "PCI: unable to allocate I/O "
213 "port region (%d)\n", ret);
214 goto out;
215 }
203 ret = request_resource(&iomem_resource, &non_mem); 216 ret = request_resource(&iomem_resource, &non_mem);
204 if (ret) { 217 if (ret) {
205 printk(KERN_ERR "PCI: unable to allocate non-prefetchable " 218 printk(KERN_ERR "PCI: unable to allocate non-prefetchable "
@@ -218,7 +231,7 @@ static int __init pci_versatile_setup_resources(struct pci_sys_data *sys)
218 * the mem resource for this bus 231 * the mem resource for this bus
219 * the prefetch mem resource for this bus 232 * the prefetch mem resource for this bus
220 */ 233 */
221 pci_add_resource_offset(&sys->resources, &io_mem, sys->io_offset); 234 pci_add_resource_offset(&sys->resources, &io_port, sys->io_offset);
222 pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); 235 pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset);
223 pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); 236 pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset);
224 237
@@ -249,6 +262,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
249 262
250 if (nr == 0) { 263 if (nr == 0) {
251 sys->mem_offset = 0; 264 sys->mem_offset = 0;
265 sys->io_offset = 0;
252 ret = pci_versatile_setup_resources(sys); 266 ret = pci_versatile_setup_resources(sys);
253 if (ret < 0) { 267 if (ret < 0) {
254 printk("pci_versatile_setup: resources... oops?\n"); 268 printk("pci_versatile_setup: resources... oops?\n");
@@ -325,7 +339,6 @@ void __init pci_versatile_preinit(void)
325static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 339static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
326{ 340{
327 int irq; 341 int irq;
328 int devslot = PCI_SLOT(dev->devfn);
329 342
330 /* slot, pin, irq 343 /* slot, pin, irq
331 * 24 1 27 344 * 24 1 27
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index d766e4256b74..4044abcf6f9d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1067,7 +1067,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t
1067 return NULL; 1067 return NULL;
1068 1068
1069 while (count) { 1069 while (count) {
1070 int j, order = __ffs(count); 1070 int j, order = __fls(count);
1071 1071
1072 pages[i] = alloc_pages(gfp | __GFP_NOWARN, order); 1072 pages[i] = alloc_pages(gfp | __GFP_NOWARN, order);
1073 while (!pages[i] && order) 1073 while (!pages[i] && order)
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index c471436c7952..2e8a1efdf7b8 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -64,7 +64,7 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
64#ifdef CONFIG_ZONE_DMA 64#ifdef CONFIG_ZONE_DMA
65extern phys_addr_t arm_dma_limit; 65extern phys_addr_t arm_dma_limit;
66#else 66#else
67#define arm_dma_limit ((u32)~0) 67#define arm_dma_limit ((phys_addr_t)~0)
68#endif 68#endif
69 69
70extern phys_addr_t arm_lowmem_limit; 70extern phys_addr_t arm_lowmem_limit;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e5dad60b558b..cf4528d51774 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -791,6 +791,79 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
791 } 791 }
792} 792}
793 793
794#ifndef CONFIG_ARM_LPAE
795
796/*
797 * The Linux PMD is made of two consecutive section entries covering 2MB
798 * (see definition in include/asm/pgtable-2level.h). However a call to
799 * create_mapping() may optimize static mappings by using individual
800 * 1MB section mappings. This leaves the actual PMD potentially half
801 * initialized if the top or bottom section entry isn't used, leaving it
802 * open to problems if a subsequent ioremap() or vmalloc() tries to use
803 * the virtual space left free by that unused section entry.
804 *
805 * Let's avoid the issue by inserting dummy vm entries covering the unused
806 * PMD halves once the static mappings are in place.
807 */
808
809static void __init pmd_empty_section_gap(unsigned long addr)
810{
811 struct vm_struct *vm;
812
813 vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm));
814 vm->addr = (void *)addr;
815 vm->size = SECTION_SIZE;
816 vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
817 vm->caller = pmd_empty_section_gap;
818 vm_area_add_early(vm);
819}
820
821static void __init fill_pmd_gaps(void)
822{
823 struct vm_struct *vm;
824 unsigned long addr, next = 0;
825 pmd_t *pmd;
826
827 /* we're still single threaded hence no lock needed here */
828 for (vm = vmlist; vm; vm = vm->next) {
829 if (!(vm->flags & VM_ARM_STATIC_MAPPING))
830 continue;
831 addr = (unsigned long)vm->addr;
832 if (addr < next)
833 continue;
834
835 /*
836 * Check if this vm starts on an odd section boundary.
837 * If so and the first section entry for this PMD is free
838 * then we block the corresponding virtual address.
839 */
840 if ((addr & ~PMD_MASK) == SECTION_SIZE) {
841 pmd = pmd_off_k(addr);
842 if (pmd_none(*pmd))
843 pmd_empty_section_gap(addr & PMD_MASK);
844 }
845
846 /*
847 * Then check if this vm ends on an odd section boundary.
848 * If so and the second section entry for this PMD is empty
849 * then we block the corresponding virtual address.
850 */
851 addr += vm->size;
852 if ((addr & ~PMD_MASK) == SECTION_SIZE) {
853 pmd = pmd_off_k(addr) + 1;
854 if (pmd_none(*pmd))
855 pmd_empty_section_gap(addr);
856 }
857
858 /* no need to look at any vm entry until we hit the next PMD */
859 next = (addr + PMD_SIZE - 1) & PMD_MASK;
860 }
861}
862
863#else
864#define fill_pmd_gaps() do { } while (0)
865#endif
866
794static void * __initdata vmalloc_min = 867static void * __initdata vmalloc_min =
795 (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET); 868 (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET);
796 869
@@ -1072,6 +1145,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
1072 */ 1145 */
1073 if (mdesc->map_io) 1146 if (mdesc->map_io)
1074 mdesc->map_io(); 1147 mdesc->map_io();
1148 fill_pmd_gaps();
1075 1149
1076 /* 1150 /*
1077 * Finally flush the caches and tlb to ensure that we're in a 1151 * Finally flush the caches and tlb to ensure that we're in a
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index 62135849f48b..c641fb685017 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -762,6 +762,11 @@ b_epilogue:
762 update_on_xread(ctx); 762 update_on_xread(ctx);
763 emit(ARM_MOV_R(r_A, r_X), ctx); 763 emit(ARM_MOV_R(r_A, r_X), ctx);
764 break; 764 break;
765 case BPF_S_ANC_ALU_XOR_X:
766 /* A ^= X */
767 update_on_xread(ctx);
768 emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
769 break;
765 case BPF_S_ANC_PROTOCOL: 770 case BPF_S_ANC_PROTOCOL:
766 /* A = ntohs(skb->protocol) */ 771 /* A = ntohs(skb->protocol) */
767 ctx->seen |= SEEN_SKB; 772 ctx->seen |= SEEN_SKB;
diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h
index 99ae5e3f46d2..7fa2f7d3cb90 100644
--- a/arch/arm/net/bpf_jit_32.h
+++ b/arch/arm/net/bpf_jit_32.h
@@ -68,6 +68,8 @@
68#define ARM_INST_CMP_R 0x01500000 68#define ARM_INST_CMP_R 0x01500000
69#define ARM_INST_CMP_I 0x03500000 69#define ARM_INST_CMP_I 0x03500000
70 70
71#define ARM_INST_EOR_R 0x00200000
72
71#define ARM_INST_LDRB_I 0x05d00000 73#define ARM_INST_LDRB_I 0x05d00000
72#define ARM_INST_LDRB_R 0x07d00000 74#define ARM_INST_LDRB_R 0x07d00000
73#define ARM_INST_LDRH_I 0x01d000b0 75#define ARM_INST_LDRH_I 0x01d000b0
@@ -132,6 +134,8 @@
132#define ARM_CMP_R(rn, rm) _AL3_R(ARM_INST_CMP, 0, rn, rm) 134#define ARM_CMP_R(rn, rm) _AL3_R(ARM_INST_CMP, 0, rn, rm)
133#define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm) 135#define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm)
134 136
137#define ARM_EOR_R(rd, rn, rm) _AL3_R(ARM_INST_EOR, rd, rn, rm)
138
135#define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \ 139#define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \
136 | (off)) 140 | (off))
137#define ARM_LDRB_I(rt, rn, off) (ARM_INST_LDRB_I | (rt) << 12 | (rn) << 16 \ 141#define ARM_LDRB_I(rt, rn, off) (ARM_INST_LDRB_I | (rt) << 12 | (rn) << 16 \
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c
index 9129c9e7d532..88726f4dbbfa 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/plat-mxc/epit.c
@@ -50,6 +50,7 @@
50#include <linux/irq.h> 50#include <linux/irq.h>
51#include <linux/clockchips.h> 51#include <linux/clockchips.h>
52#include <linux/clk.h> 52#include <linux/clk.h>
53#include <linux/err.h>
53 54
54#include <mach/hardware.h> 55#include <mach/hardware.h>
55#include <asm/mach/time.h> 56#include <asm/mach/time.h>
@@ -201,8 +202,16 @@ static int __init epit_clockevent_init(struct clk *timer_clk)
201 return 0; 202 return 0;
202} 203}
203 204
204void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) 205void __init epit_timer_init(void __iomem *base, int irq)
205{ 206{
207 struct clk *timer_clk;
208
209 timer_clk = clk_get_sys("imx-epit.0", NULL);
210 if (IS_ERR(timer_clk)) {
211 pr_err("i.MX epit: unable to get clk\n");
212 return;
213 }
214
206 clk_prepare_enable(timer_clk); 215 clk_prepare_enable(timer_clk);
207 216
208 timer_base = base; 217 timer_base = base;
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index cf663d84e7c1..e429ca1b814a 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -54,8 +54,8 @@ extern void imx50_soc_init(void);
54extern void imx51_soc_init(void); 54extern void imx51_soc_init(void);
55extern void imx53_soc_init(void); 55extern void imx53_soc_init(void);
56extern void imx51_init_late(void); 56extern void imx51_init_late(void);
57extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); 57extern void epit_timer_init(void __iomem *base, int irq);
58extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); 58extern void mxc_timer_init(void __iomem *, int);
59extern int mx1_clocks_init(unsigned long fref); 59extern int mx1_clocks_init(unsigned long fref);
60extern int mx21_clocks_init(unsigned long lref, unsigned long fref); 60extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
61extern int mx25_clocks_init(void); 61extern int mx25_clocks_init(void);
diff --git a/arch/arm/plat-mxc/include/mach/mx2_cam.h b/arch/arm/plat-mxc/include/mach/mx2_cam.h
index 7ded6f1f74bc..3c080a32dbf5 100644
--- a/arch/arm/plat-mxc/include/mach/mx2_cam.h
+++ b/arch/arm/plat-mxc/include/mach/mx2_cam.h
@@ -23,6 +23,7 @@
23#ifndef __MACH_MX2_CAM_H_ 23#ifndef __MACH_MX2_CAM_H_
24#define __MACH_MX2_CAM_H_ 24#define __MACH_MX2_CAM_H_
25 25
26#define MX2_CAMERA_SWAP16 (1 << 0)
26#define MX2_CAMERA_EXT_VSYNC (1 << 1) 27#define MX2_CAMERA_EXT_VSYNC (1 << 1)
27#define MX2_CAMERA_CCIR (1 << 2) 28#define MX2_CAMERA_CCIR (1 << 2)
28#define MX2_CAMERA_CCIR_INTERLACE (1 << 3) 29#define MX2_CAMERA_CCIR_INTERLACE (1 << 3)
@@ -30,6 +31,7 @@
30#define MX2_CAMERA_GATED_CLOCK (1 << 5) 31#define MX2_CAMERA_GATED_CLOCK (1 << 5)
31#define MX2_CAMERA_INV_DATA (1 << 6) 32#define MX2_CAMERA_INV_DATA (1 << 6)
32#define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7) 33#define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7)
34#define MX2_CAMERA_PACK_DIR_MSB (1 << 8)
33 35
34/** 36/**
35 * struct mx2_camera_platform_data - optional platform data for mx2_camera 37 * struct mx2_camera_platform_data - optional platform data for mx2_camera
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 99f958ca6cb8..00e8e659e667 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -58,6 +58,7 @@
58/* MX31, MX35, MX25, MX5 */ 58/* MX31, MX35, MX25, MX5 */
59#define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */ 59#define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */
60#define V2_TCTL_CLK_IPG (1 << 6) 60#define V2_TCTL_CLK_IPG (1 << 6)
61#define V2_TCTL_CLK_PER (2 << 6)
61#define V2_TCTL_FRR (1 << 9) 62#define V2_TCTL_FRR (1 << 9)
62#define V2_IR 0x0c 63#define V2_IR 0x0c
63#define V2_TSTAT 0x08 64#define V2_TSTAT 0x08
@@ -280,23 +281,22 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
280 return 0; 281 return 0;
281} 282}
282 283
283void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) 284void __init mxc_timer_init(void __iomem *base, int irq)
284{ 285{
285 uint32_t tctl_val; 286 uint32_t tctl_val;
287 struct clk *timer_clk;
286 struct clk *timer_ipg_clk; 288 struct clk *timer_ipg_clk;
287 289
288 if (!timer_clk) { 290 timer_clk = clk_get_sys("imx-gpt.0", "per");
289 timer_clk = clk_get_sys("imx-gpt.0", "per"); 291 if (IS_ERR(timer_clk)) {
290 if (IS_ERR(timer_clk)) { 292 pr_err("i.MX timer: unable to get clk\n");
291 pr_err("i.MX timer: unable to get clk\n"); 293 return;
292 return;
293 }
294
295 timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg");
296 if (!IS_ERR(timer_ipg_clk))
297 clk_prepare_enable(timer_ipg_clk);
298 } 294 }
299 295
296 timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg");
297 if (!IS_ERR(timer_ipg_clk))
298 clk_prepare_enable(timer_ipg_clk);
299
300 clk_prepare_enable(timer_clk); 300 clk_prepare_enable(timer_clk);
301 301
302 timer_base = base; 302 timer_base = base;
@@ -309,7 +309,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
309 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */ 309 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */
310 310
311 if (timer_is_v2()) 311 if (timer_is_v2())
312 tctl_val = V2_TCTL_CLK_IPG | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; 312 tctl_val = V2_TCTL_CLK_PER | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN;
313 else 313 else
314 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN; 314 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN;
315 315
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 62ec5c452792..706b7e29397f 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -461,6 +461,7 @@ static int clk_dbg_show_summary(struct seq_file *s, void *unused)
461 struct clk *c; 461 struct clk *c;
462 struct clk *pa; 462 struct clk *pa;
463 463
464 mutex_lock(&clocks_mutex);
464 seq_printf(s, "%-30s %-30s %-10s %s\n", 465 seq_printf(s, "%-30s %-30s %-10s %s\n",
465 "clock-name", "parent-name", "rate", "use-count"); 466 "clock-name", "parent-name", "rate", "use-count");
466 467
@@ -469,6 +470,7 @@ static int clk_dbg_show_summary(struct seq_file *s, void *unused)
469 seq_printf(s, "%-30s %-30s %-10lu %d\n", 470 seq_printf(s, "%-30s %-30s %-10lu %d\n",
470 c->name, pa ? pa->name : "none", c->rate, c->usecount); 471 c->name, pa ? pa->name : "none", c->rate, c->usecount);
471 } 472 }
473 mutex_unlock(&clocks_mutex);
472 474
473 return 0; 475 return 0;
474} 476}
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 297245dba66e..de6c0a08f461 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -252,8 +252,6 @@ IS_AM_SUBCLASS(335x, 0x335)
252 * cpu_is_omap2423(): True for OMAP2423 252 * cpu_is_omap2423(): True for OMAP2423
253 * cpu_is_omap2430(): True for OMAP2430 253 * cpu_is_omap2430(): True for OMAP2430
254 * cpu_is_omap3430(): True for OMAP3430 254 * cpu_is_omap3430(): True for OMAP3430
255 * cpu_is_omap3505(): True for OMAP3505
256 * cpu_is_omap3517(): True for OMAP3517
257 */ 255 */
258#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff) 256#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
259 257
@@ -277,8 +275,6 @@ IS_OMAP_TYPE(2422, 0x2422)
277IS_OMAP_TYPE(2423, 0x2423) 275IS_OMAP_TYPE(2423, 0x2423)
278IS_OMAP_TYPE(2430, 0x2430) 276IS_OMAP_TYPE(2430, 0x2430)
279IS_OMAP_TYPE(3430, 0x3430) 277IS_OMAP_TYPE(3430, 0x3430)
280IS_OMAP_TYPE(3505, 0x3517)
281IS_OMAP_TYPE(3517, 0x3517)
282 278
283#define cpu_is_omap310() 0 279#define cpu_is_omap310() 0
284#define cpu_is_omap730() 0 280#define cpu_is_omap730() 0
@@ -293,12 +289,6 @@ IS_OMAP_TYPE(3517, 0x3517)
293#define cpu_is_omap2422() 0 289#define cpu_is_omap2422() 0
294#define cpu_is_omap2423() 0 290#define cpu_is_omap2423() 0
295#define cpu_is_omap2430() 0 291#define cpu_is_omap2430() 0
296#define cpu_is_omap3503() 0
297#define cpu_is_omap3515() 0
298#define cpu_is_omap3525() 0
299#define cpu_is_omap3530() 0
300#define cpu_is_omap3505() 0
301#define cpu_is_omap3517() 0
302#define cpu_is_omap3430() 0 292#define cpu_is_omap3430() 0
303#define cpu_is_omap3630() 0 293#define cpu_is_omap3630() 0
304 294
@@ -350,12 +340,6 @@ IS_OMAP_TYPE(3517, 0x3517)
350 340
351#if defined(CONFIG_ARCH_OMAP3) 341#if defined(CONFIG_ARCH_OMAP3)
352# undef cpu_is_omap3430 342# undef cpu_is_omap3430
353# undef cpu_is_omap3503
354# undef cpu_is_omap3515
355# undef cpu_is_omap3525
356# undef cpu_is_omap3530
357# undef cpu_is_omap3505
358# undef cpu_is_omap3517
359# undef cpu_is_ti81xx 343# undef cpu_is_ti81xx
360# undef cpu_is_ti816x 344# undef cpu_is_ti816x
361# undef cpu_is_ti814x 345# undef cpu_is_ti814x
@@ -363,19 +347,6 @@ IS_OMAP_TYPE(3517, 0x3517)
363# undef cpu_is_am33xx 347# undef cpu_is_am33xx
364# undef cpu_is_am335x 348# undef cpu_is_am335x
365# define cpu_is_omap3430() is_omap3430() 349# define cpu_is_omap3430() is_omap3430()
366# define cpu_is_omap3503() (cpu_is_omap3430() && \
367 (!omap3_has_iva()) && \
368 (!omap3_has_sgx()))
369# define cpu_is_omap3515() (cpu_is_omap3430() && \
370 (!omap3_has_iva()) && \
371 (omap3_has_sgx()))
372# define cpu_is_omap3525() (cpu_is_omap3430() && \
373 (!omap3_has_sgx()) && \
374 (omap3_has_iva()))
375# define cpu_is_omap3530() (cpu_is_omap3430())
376# define cpu_is_omap3517() is_omap3517()
377# define cpu_is_omap3505() (cpu_is_omap3517() && \
378 !omap3_has_sgx())
379# undef cpu_is_omap3630 350# undef cpu_is_omap3630
380# define cpu_is_omap3630() is_omap363x() 351# define cpu_is_omap3630() is_omap363x()
381# define cpu_is_ti81xx() is_ti81xx() 352# define cpu_is_ti81xx() is_ti81xx()
@@ -424,10 +395,6 @@ IS_OMAP_TYPE(3517, 0x3517)
424#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8)) 395#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
425#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8)) 396#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
426 397
427#define OMAP3517_CLASS 0x35170034
428#define OMAP3517_REV_ES1_0 OMAP3517_CLASS
429#define OMAP3517_REV_ES1_1 (OMAP3517_CLASS | (0x1 << 8))
430
431#define TI816X_CLASS 0x81600034 398#define TI816X_CLASS 0x81600034
432#define TI8168_REV_ES1_0 TI816X_CLASS 399#define TI8168_REV_ES1_0 TI816X_CLASS
433#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) 400#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index a7754a886d42..5493bd95da5e 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -172,8 +172,7 @@ struct omap_mmc_platform_data {
172extern void omap_mmc_notify_cover_event(struct device *dev, int slot, 172extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
173 int is_closed); 173 int is_closed);
174 174
175#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ 175#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
176 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
177void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, 176void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
178 int nr_controllers); 177 int nr_controllers);
179void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data); 178void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
@@ -185,7 +184,6 @@ static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
185static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) 184static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
186{ 185{
187} 186}
188
189#endif 187#endif
190 188
191extern int omap_msdi_reset(struct omap_hwmod *oh); 189extern int omap_msdi_reset(struct omap_hwmod *oh);
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 61fd837624a8..c1793786aea9 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -582,7 +582,7 @@ void __init orion_spi_1_init(unsigned long mapbase)
582 * Watchdog 582 * Watchdog
583 ****************************************************************************/ 583 ****************************************************************************/
584static struct resource orion_wdt_resource = 584static struct resource orion_wdt_resource =
585 DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28); 585 DEFINE_RES_MEM(TIMER_PHYS_BASE, 0x28);
586 586
587static struct platform_device orion_wdt_device = { 587static struct platform_device orion_wdt_device = {
588 .name = "orion_wdt", 588 .name = "orion_wdt",
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index 58b79809d20c..584c9bf8ed2d 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -193,6 +193,7 @@ static const struct platform_device_id ssp_id_table[] = {
193 { "pxa25x-nssp", PXA25x_NSSP }, 193 { "pxa25x-nssp", PXA25x_NSSP },
194 { "pxa27x-ssp", PXA27x_SSP }, 194 { "pxa27x-ssp", PXA27x_SSP },
195 { "pxa168-ssp", PXA168_SSP }, 195 { "pxa168-ssp", PXA168_SSP },
196 { "pxa910-ssp", PXA910_SSP },
196 { }, 197 { },
197}; 198};
198 199
diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h b/arch/arm/plat-samsung/include/plat/map-s3c.h
index 7d048759b772..c0c70a895ca8 100644
--- a/arch/arm/plat-samsung/include/plat/map-s3c.h
+++ b/arch/arm/plat-samsung/include/plat/map-s3c.h
@@ -22,7 +22,7 @@
22#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG 22#define S3C24XX_VA_WATCHDOG S3C_VA_WATCHDOG
23 23
24#define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000) 24#define S3C2412_VA_SSMC S3C_ADDR_CPU(0x00000000)
25#define S3C2412_VA_EBI S3C_ADDR_CPU(0x00010000) 25#define S3C2412_VA_EBI S3C_ADDR_CPU(0x00100000)
26 26
27#define S3C2410_PA_UART (0x50000000) 27#define S3C2410_PA_UART (0x50000000)
28#define S3C24XX_PA_UART S3C2410_PA_UART 28#define S3C24XX_PA_UART S3C2410_PA_UART
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
index f19aff19205c..bc4db9b04e36 100644
--- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
+++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
@@ -25,7 +25,7 @@ static inline void arch_wdt_reset(void)
25 25
26 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ 26 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
27 27
28 if (s3c2410_wdtclk) 28 if (!IS_ERR(s3c2410_wdtclk))
29 clk_enable(s3c2410_wdtclk); 29 clk_enable(s3c2410_wdtclk);
30 30
31 /* put initial values into count and data */ 31 /* put initial values into count and data */
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index ab3de721c5db..75b05ad0fbad 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -4,7 +4,7 @@
4 * Debugging macro include header for spear platform 4 * Debugging macro include header for spear platform
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/include/plat/pl080.h b/arch/arm/plat-spear/include/plat/pl080.h
index e14a3e4932f9..2bc6b54460a8 100644
--- a/arch/arm/plat-spear/include/plat/pl080.h
+++ b/arch/arm/plat-spear/include/plat/pl080.h
@@ -4,7 +4,7 @@
4 * DMAC pl080 definitions for SPEAr platform 4 * DMAC pl080 definitions for SPEAr platform
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/include/plat/shirq.h b/arch/arm/plat-spear/include/plat/shirq.h
index 03ed8b585dcf..88a7fbd24793 100644
--- a/arch/arm/plat-spear/include/plat/shirq.h
+++ b/arch/arm/plat-spear/include/plat/shirq.h
@@ -4,7 +4,7 @@
4 * SPEAr platform shared irq layer header file 4 * SPEAr platform shared irq layer header file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/include/plat/timex.h b/arch/arm/plat-spear/include/plat/timex.h
index 914d09dd50fd..ef95e5b780bd 100644
--- a/arch/arm/plat-spear/include/plat/timex.h
+++ b/arch/arm/plat-spear/include/plat/timex.h
@@ -4,7 +4,7 @@
4 * SPEAr platform specific timex definitions 4 * SPEAr platform specific timex definitions
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/plat-spear/include/plat/uncompress.h
index 6dd455bafdfd..2ce6cb17a98b 100644
--- a/arch/arm/plat-spear/include/plat/uncompress.h
+++ b/arch/arm/plat-spear/include/plat/uncompress.h
@@ -4,7 +4,7 @@
4 * Serial port stubs for kernel decompress status messages 4 * Serial port stubs for kernel decompress status messages
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/pl080.c b/arch/arm/plat-spear/pl080.c
index a56a067717c1..12cf27f935f9 100644
--- a/arch/arm/plat-spear/pl080.c
+++ b/arch/arm/plat-spear/pl080.c
@@ -4,7 +4,7 @@
4 * DMAC pl080 definitions for SPEAr platform 4 * DMAC pl080 definitions for SPEAr platform
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/plat-spear/restart.c
index ea0a61302b7e..4f990115b1bd 100644
--- a/arch/arm/plat-spear/restart.c
+++ b/arch/arm/plat-spear/restart.c
@@ -4,7 +4,7 @@
4 * SPEAr platform specific restart functions 4 * SPEAr platform specific restart functions
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/plat-spear/shirq.c b/arch/arm/plat-spear/shirq.c
index 961fb7261243..853e891e1184 100644
--- a/arch/arm/plat-spear/shirq.c
+++ b/arch/arm/plat-spear/shirq.c
@@ -4,7 +4,7 @@
4 * SPEAr platform shared irq layer source file 4 * SPEAr platform shared irq layer source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
index 68d651081bd3..d0b1607f2711 100644
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -35,6 +35,7 @@
35#include <asm/setup.h> 35#include <asm/setup.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/sections.h>
38 39
39#if defined(__H8300H__) 40#if defined(__H8300H__)
40#define CPU "H8/300H" 41#define CPU "H8/300H"
@@ -54,7 +55,6 @@ unsigned long memory_end;
54 55
55char __initdata command_line[COMMAND_LINE_SIZE]; 56char __initdata command_line[COMMAND_LINE_SIZE];
56 57
57extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
58extern int _ramstart, _ramend; 58extern int _ramstart, _ramend;
59extern char _target_name[]; 59extern char _target_name[];
60extern void h8300_gpio_init(void); 60extern void h8300_gpio_init(void);
@@ -119,9 +119,9 @@ void __init setup_arch(char **cmdline_p)
119 memory_end = CONFIG_BLKDEV_RESERVE_ADDRESS; 119 memory_end = CONFIG_BLKDEV_RESERVE_ADDRESS;
120#endif 120#endif
121 121
122 init_mm.start_code = (unsigned long) &_stext; 122 init_mm.start_code = (unsigned long) _stext;
123 init_mm.end_code = (unsigned long) &_etext; 123 init_mm.end_code = (unsigned long) _etext;
124 init_mm.end_data = (unsigned long) &_edata; 124 init_mm.end_data = (unsigned long) _edata;
125 init_mm.brk = (unsigned long) 0; 125 init_mm.brk = (unsigned long) 0;
126 126
127#if (defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)) && defined(CONFIG_GDB_MAGICPRINT) 127#if (defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)) && defined(CONFIG_GDB_MAGICPRINT)
@@ -134,15 +134,12 @@ void __init setup_arch(char **cmdline_p)
134 printk(KERN_INFO "H8/300 series support by Yoshinori Sato <ysato@users.sourceforge.jp>\n"); 134 printk(KERN_INFO "H8/300 series support by Yoshinori Sato <ysato@users.sourceforge.jp>\n");
135 135
136#ifdef DEBUG 136#ifdef DEBUG
137 printk(KERN_DEBUG "KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x " 137 printk(KERN_DEBUG "KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p "
138 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext, 138 "BSS=0x%p-0x%p\n", _stext, _etext, _sdata, _edata, __bss_start,
139 (int) &_sdata, (int) &_edata, 139 __bss_stop);
140 (int) &_sbss, (int) &_ebss); 140 printk(KERN_DEBUG "KERNEL -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx "
141 printk(KERN_DEBUG "KERNEL -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x " 141 "STACK=0x%06lx-0x%p\n", __bss_stop, memory_start, memory_start,
142 "STACK=0x%06x-0x%06x\n", 142 memory_end, memory_end, &_ramend);
143 (int) &_ebss, (int) memory_start,
144 (int) memory_start, (int) memory_end,
145 (int) memory_end, (int) &_ramend);
146#endif 143#endif
147 144
148#ifdef CONFIG_DEFAULT_CMDLINE 145#ifdef CONFIG_DEFAULT_CMDLINE
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index 973369c32a95..981e25094b1a 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -36,6 +36,7 @@
36#include <asm/segment.h> 36#include <asm/segment.h>
37#include <asm/page.h> 37#include <asm/page.h>
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/sections.h>
39 40
40#undef DEBUG 41#undef DEBUG
41 42
@@ -123,7 +124,6 @@ void __init mem_init(void)
123 int codek = 0, datak = 0, initk = 0; 124 int codek = 0, datak = 0, initk = 0;
124 /* DAVIDM look at setup memory map generically with reserved area */ 125 /* DAVIDM look at setup memory map generically with reserved area */
125 unsigned long tmp; 126 unsigned long tmp;
126 extern char _etext, _stext, _sdata, _ebss, __init_begin, __init_end;
127 extern unsigned long _ramend, _ramstart; 127 extern unsigned long _ramend, _ramstart;
128 unsigned long len = &_ramend - &_ramstart; 128 unsigned long len = &_ramend - &_ramstart;
129 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */ 129 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
@@ -142,9 +142,9 @@ void __init mem_init(void)
142 /* this will put all memory onto the freelists */ 142 /* this will put all memory onto the freelists */
143 totalram_pages = free_all_bootmem(); 143 totalram_pages = free_all_bootmem();
144 144
145 codek = (&_etext - &_stext) >> 10; 145 codek = (_etext - _stext) >> 10;
146 datak = (&_ebss - &_sdata) >> 10; 146 datak = (__bss_stop - _sdata) >> 10;
147 initk = (&__init_begin - &__init_end) >> 10; 147 initk = (__init_begin - __init_end) >> 10;
148 148
149 tmp = nr_free_pages() << PAGE_SHIFT; 149 tmp = nr_free_pages() << PAGE_SHIFT;
150 printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n", 150 printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n",
@@ -178,22 +178,21 @@ free_initmem(void)
178{ 178{
179#ifdef CONFIG_RAMKERNEL 179#ifdef CONFIG_RAMKERNEL
180 unsigned long addr; 180 unsigned long addr;
181 extern char __init_begin, __init_end;
182/* 181/*
183 * the following code should be cool even if these sections 182 * the following code should be cool even if these sections
184 * are not page aligned. 183 * are not page aligned.
185 */ 184 */
186 addr = PAGE_ALIGN((unsigned long)(&__init_begin)); 185 addr = PAGE_ALIGN((unsigned long)(__init_begin));
187 /* next to check that the page we free is not a partial page */ 186 /* next to check that the page we free is not a partial page */
188 for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { 187 for (; addr + PAGE_SIZE < (unsigned long)__init_end; addr +=PAGE_SIZE) {
189 ClearPageReserved(virt_to_page(addr)); 188 ClearPageReserved(virt_to_page(addr));
190 init_page_count(virt_to_page(addr)); 189 init_page_count(virt_to_page(addr));
191 free_page(addr); 190 free_page(addr);
192 totalram_pages++; 191 totalram_pages++;
193 } 192 }
194 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n", 193 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n",
195 (addr - PAGE_ALIGN((long) &__init_begin)) >> 10, 194 (addr - PAGE_ALIGN((long) __init_begin)) >> 10,
196 (int)(PAGE_ALIGN((unsigned long)(&__init_begin))), 195 (int)(PAGE_ALIGN((unsigned long)__init_begin)),
197 (int)(addr - PAGE_SIZE)); 196 (int)(addr - PAGE_SIZE));
198#endif 197#endif
199} 198}
diff --git a/arch/m68k/platform/coldfire/clk.c b/arch/m68k/platform/coldfire/clk.c
index 9f1260c5e2ad..44da406897e5 100644
--- a/arch/m68k/platform/coldfire/clk.c
+++ b/arch/m68k/platform/coldfire/clk.c
@@ -42,4 +42,11 @@ unsigned long clk_get_rate(struct clk *clk)
42 return MCF_CLK; 42 return MCF_CLK;
43} 43}
44EXPORT_SYMBOL(clk_get_rate); 44EXPORT_SYMBOL(clk_get_rate);
45
46struct clk *devm_clk_get(struct device *dev, const char *id)
47{
48 return NULL;
49}
50EXPORT_SYMBOL(devm_clk_get);
51
45/***************************************************************************/ 52/***************************************************************************/
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 32b394f3b854..6eb75b80488c 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -103,6 +103,11 @@ static inline void hard_irq_disable(void)
103/* include/linux/interrupt.h needs hard_irq_disable to be a macro */ 103/* include/linux/interrupt.h needs hard_irq_disable to be a macro */
104#define hard_irq_disable hard_irq_disable 104#define hard_irq_disable hard_irq_disable
105 105
106static inline bool lazy_irq_pending(void)
107{
108 return !!(get_paca()->irq_happened & ~PACA_IRQ_HARD_DIS);
109}
110
106/* 111/*
107 * This is called by asynchronous interrupts to conditionally 112 * This is called by asynchronous interrupts to conditionally
108 * re-enable hard interrupts when soft-disabled after having 113 * re-enable hard interrupts when soft-disabled after having
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ed1718feb9d9..5971c85df136 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -558,27 +558,54 @@ _GLOBAL(ret_from_except_lite)
558 mtmsrd r10,1 /* Update machine state */ 558 mtmsrd r10,1 /* Update machine state */
559#endif /* CONFIG_PPC_BOOK3E */ 559#endif /* CONFIG_PPC_BOOK3E */
560 560
561#ifdef CONFIG_PREEMPT
562 clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ 561 clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */
563 li r0,_TIF_NEED_RESCHED /* bits to check */
564 ld r3,_MSR(r1) 562 ld r3,_MSR(r1)
565 ld r4,TI_FLAGS(r9) 563 ld r4,TI_FLAGS(r9)
566 /* Move MSR_PR bit in r3 to _TIF_SIGPENDING position in r0 */
567 rlwimi r0,r3,32+TIF_SIGPENDING-MSR_PR_LG,_TIF_SIGPENDING
568 and. r0,r4,r0 /* check NEED_RESCHED and maybe SIGPENDING */
569 bne do_work
570
571#else /* !CONFIG_PREEMPT */
572 ld r3,_MSR(r1) /* Returning to user mode? */
573 andi. r3,r3,MSR_PR 564 andi. r3,r3,MSR_PR
574 beq restore /* if not, just restore regs and return */ 565 beq resume_kernel
575 566
576 /* Check current_thread_info()->flags */ 567 /* Check current_thread_info()->flags */
568 andi. r0,r4,_TIF_USER_WORK_MASK
569 beq restore
570
571 andi. r0,r4,_TIF_NEED_RESCHED
572 beq 1f
573 bl .restore_interrupts
574 bl .schedule
575 b .ret_from_except_lite
576
5771: bl .save_nvgprs
578 bl .restore_interrupts
579 addi r3,r1,STACK_FRAME_OVERHEAD
580 bl .do_notify_resume
581 b .ret_from_except
582
583resume_kernel:
584#ifdef CONFIG_PREEMPT
585 /* Check if we need to preempt */
586 andi. r0,r4,_TIF_NEED_RESCHED
587 beq+ restore
588 /* Check that preempt_count() == 0 and interrupts are enabled */
589 lwz r8,TI_PREEMPT(r9)
590 cmpwi cr1,r8,0
591 ld r0,SOFTE(r1)
592 cmpdi r0,0
593 crandc eq,cr1*4+eq,eq
594 bne restore
595
596 /*
597 * Here we are preempting the current task. We want to make
598 * sure we are soft-disabled first
599 */
600 SOFT_DISABLE_INTS(r3,r4)
6011: bl .preempt_schedule_irq
602
603 /* Re-test flags and eventually loop */
577 clrrdi r9,r1,THREAD_SHIFT 604 clrrdi r9,r1,THREAD_SHIFT
578 ld r4,TI_FLAGS(r9) 605 ld r4,TI_FLAGS(r9)
579 andi. r0,r4,_TIF_USER_WORK_MASK 606 andi. r0,r4,_TIF_NEED_RESCHED
580 bne do_work 607 bne 1b
581#endif /* !CONFIG_PREEMPT */ 608#endif /* CONFIG_PREEMPT */
582 609
583 .globl fast_exc_return_irq 610 .globl fast_exc_return_irq
584fast_exc_return_irq: 611fast_exc_return_irq:
@@ -759,50 +786,6 @@ restore_check_irq_replay:
759#endif /* CONFIG_PPC_BOOK3E */ 786#endif /* CONFIG_PPC_BOOK3E */
7601: b .ret_from_except /* What else to do here ? */ 7871: b .ret_from_except /* What else to do here ? */
761 788
762
763
7643:
765do_work:
766#ifdef CONFIG_PREEMPT
767 andi. r0,r3,MSR_PR /* Returning to user mode? */
768 bne user_work
769 /* Check that preempt_count() == 0 and interrupts are enabled */
770 lwz r8,TI_PREEMPT(r9)
771 cmpwi cr1,r8,0
772 ld r0,SOFTE(r1)
773 cmpdi r0,0
774 crandc eq,cr1*4+eq,eq
775 bne restore
776
777 /*
778 * Here we are preempting the current task. We want to make
779 * sure we are soft-disabled first
780 */
781 SOFT_DISABLE_INTS(r3,r4)
7821: bl .preempt_schedule_irq
783
784 /* Re-test flags and eventually loop */
785 clrrdi r9,r1,THREAD_SHIFT
786 ld r4,TI_FLAGS(r9)
787 andi. r0,r4,_TIF_NEED_RESCHED
788 bne 1b
789 b restore
790
791user_work:
792#endif /* CONFIG_PREEMPT */
793
794 andi. r0,r4,_TIF_NEED_RESCHED
795 beq 1f
796 bl .restore_interrupts
797 bl .schedule
798 b .ret_from_except_lite
799
8001: bl .save_nvgprs
801 bl .restore_interrupts
802 addi r3,r1,STACK_FRAME_OVERHEAD
803 bl .do_notify_resume
804 b .ret_from_except
805
806unrecov_restore: 789unrecov_restore:
807 addi r3,r1,STACK_FRAME_OVERHEAD 790 addi r3,r1,STACK_FRAME_OVERHEAD
808 bl .unrecoverable_exception 791 bl .unrecoverable_exception
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 7835a5e1ea5f..1b415027ec0e 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -277,7 +277,7 @@ EXPORT_SYMBOL(arch_local_irq_restore);
277 * NOTE: This is called with interrupts hard disabled but not marked 277 * NOTE: This is called with interrupts hard disabled but not marked
278 * as such in paca->irq_happened, so we need to resync this. 278 * as such in paca->irq_happened, so we need to resync this.
279 */ 279 */
280void restore_interrupts(void) 280void notrace restore_interrupts(void)
281{ 281{
282 if (irqs_disabled()) { 282 if (irqs_disabled()) {
283 local_paca->irq_happened |= PACA_IRQ_HARD_DIS; 283 local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 1b488e5305c5..0794a3017b1b 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1312,7 +1312,7 @@ static struct opal_secondary_data {
1312 1312
1313extern char opal_secondary_entry; 1313extern char opal_secondary_entry;
1314 1314
1315static void prom_query_opal(void) 1315static void __init prom_query_opal(void)
1316{ 1316{
1317 long rc; 1317 long rc;
1318 1318
@@ -1436,7 +1436,7 @@ static void __init prom_opal_hold_cpus(void)
1436 prom_debug("prom_opal_hold_cpus: end...\n"); 1436 prom_debug("prom_opal_hold_cpus: end...\n");
1437} 1437}
1438 1438
1439static void prom_opal_takeover(void) 1439static void __init prom_opal_takeover(void)
1440{ 1440{
1441 struct opal_secondary_data *data = &RELOC(opal_secondary_data); 1441 struct opal_secondary_data *data = &RELOC(opal_secondary_data);
1442 struct opal_takeover_args *args = &data->args; 1442 struct opal_takeover_args *args = &data->args;
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index c6af1d623839..3abe1b86e583 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -268,24 +268,45 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu,
268 return err; 268 return err;
269} 269}
270 270
271static void kvmppc_update_vpa(struct kvm *kvm, struct kvmppc_vpa *vpap) 271static void kvmppc_update_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *vpap)
272{ 272{
273 struct kvm *kvm = vcpu->kvm;
273 void *va; 274 void *va;
274 unsigned long nb; 275 unsigned long nb;
276 unsigned long gpa;
275 277
276 vpap->update_pending = 0; 278 /*
277 va = NULL; 279 * We need to pin the page pointed to by vpap->next_gpa,
278 if (vpap->next_gpa) { 280 * but we can't call kvmppc_pin_guest_page under the lock
279 va = kvmppc_pin_guest_page(kvm, vpap->next_gpa, &nb); 281 * as it does get_user_pages() and down_read(). So we
280 if (nb < vpap->len) { 282 * have to drop the lock, pin the page, then get the lock
281 /* 283 * again and check that a new area didn't get registered
282 * If it's now too short, it must be that userspace 284 * in the meantime.
283 * has changed the mappings underlying guest memory, 285 */
284 * so unregister the region. 286 for (;;) {
285 */ 287 gpa = vpap->next_gpa;
288 spin_unlock(&vcpu->arch.vpa_update_lock);
289 va = NULL;
290 nb = 0;
291 if (gpa)
292 va = kvmppc_pin_guest_page(kvm, vpap->next_gpa, &nb);
293 spin_lock(&vcpu->arch.vpa_update_lock);
294 if (gpa == vpap->next_gpa)
295 break;
296 /* sigh... unpin that one and try again */
297 if (va)
286 kvmppc_unpin_guest_page(kvm, va); 298 kvmppc_unpin_guest_page(kvm, va);
287 va = NULL; 299 }
288 } 300
301 vpap->update_pending = 0;
302 if (va && nb < vpap->len) {
303 /*
304 * If it's now too short, it must be that userspace
305 * has changed the mappings underlying guest memory,
306 * so unregister the region.
307 */
308 kvmppc_unpin_guest_page(kvm, va);
309 va = NULL;
289 } 310 }
290 if (vpap->pinned_addr) 311 if (vpap->pinned_addr)
291 kvmppc_unpin_guest_page(kvm, vpap->pinned_addr); 312 kvmppc_unpin_guest_page(kvm, vpap->pinned_addr);
@@ -296,20 +317,18 @@ static void kvmppc_update_vpa(struct kvm *kvm, struct kvmppc_vpa *vpap)
296 317
297static void kvmppc_update_vpas(struct kvm_vcpu *vcpu) 318static void kvmppc_update_vpas(struct kvm_vcpu *vcpu)
298{ 319{
299 struct kvm *kvm = vcpu->kvm;
300
301 spin_lock(&vcpu->arch.vpa_update_lock); 320 spin_lock(&vcpu->arch.vpa_update_lock);
302 if (vcpu->arch.vpa.update_pending) { 321 if (vcpu->arch.vpa.update_pending) {
303 kvmppc_update_vpa(kvm, &vcpu->arch.vpa); 322 kvmppc_update_vpa(vcpu, &vcpu->arch.vpa);
304 init_vpa(vcpu, vcpu->arch.vpa.pinned_addr); 323 init_vpa(vcpu, vcpu->arch.vpa.pinned_addr);
305 } 324 }
306 if (vcpu->arch.dtl.update_pending) { 325 if (vcpu->arch.dtl.update_pending) {
307 kvmppc_update_vpa(kvm, &vcpu->arch.dtl); 326 kvmppc_update_vpa(vcpu, &vcpu->arch.dtl);
308 vcpu->arch.dtl_ptr = vcpu->arch.dtl.pinned_addr; 327 vcpu->arch.dtl_ptr = vcpu->arch.dtl.pinned_addr;
309 vcpu->arch.dtl_index = 0; 328 vcpu->arch.dtl_index = 0;
310 } 329 }
311 if (vcpu->arch.slb_shadow.update_pending) 330 if (vcpu->arch.slb_shadow.update_pending)
312 kvmppc_update_vpa(kvm, &vcpu->arch.slb_shadow); 331 kvmppc_update_vpa(vcpu, &vcpu->arch.slb_shadow);
313 spin_unlock(&vcpu->arch.vpa_update_lock); 332 spin_unlock(&vcpu->arch.vpa_update_lock);
314} 333}
315 334
@@ -800,12 +819,39 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
800 struct kvm_vcpu *vcpu, *vcpu0, *vnext; 819 struct kvm_vcpu *vcpu, *vcpu0, *vnext;
801 long ret; 820 long ret;
802 u64 now; 821 u64 now;
803 int ptid, i; 822 int ptid, i, need_vpa_update;
804 823
805 /* don't start if any threads have a signal pending */ 824 /* don't start if any threads have a signal pending */
806 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) 825 need_vpa_update = 0;
826 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
807 if (signal_pending(vcpu->arch.run_task)) 827 if (signal_pending(vcpu->arch.run_task))
808 return 0; 828 return 0;
829 need_vpa_update |= vcpu->arch.vpa.update_pending |
830 vcpu->arch.slb_shadow.update_pending |
831 vcpu->arch.dtl.update_pending;
832 }
833
834 /*
835 * Initialize *vc, in particular vc->vcore_state, so we can
836 * drop the vcore lock if necessary.
837 */
838 vc->n_woken = 0;
839 vc->nap_count = 0;
840 vc->entry_exit_count = 0;
841 vc->vcore_state = VCORE_RUNNING;
842 vc->in_guest = 0;
843 vc->napping_threads = 0;
844
845 /*
846 * Updating any of the vpas requires calling kvmppc_pin_guest_page,
847 * which can't be called with any spinlocks held.
848 */
849 if (need_vpa_update) {
850 spin_unlock(&vc->lock);
851 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
852 kvmppc_update_vpas(vcpu);
853 spin_lock(&vc->lock);
854 }
809 855
810 /* 856 /*
811 * Make sure we are running on thread 0, and that 857 * Make sure we are running on thread 0, and that
@@ -838,20 +884,10 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
838 if (vcpu->arch.ceded) 884 if (vcpu->arch.ceded)
839 vcpu->arch.ptid = ptid++; 885 vcpu->arch.ptid = ptid++;
840 886
841 vc->n_woken = 0;
842 vc->nap_count = 0;
843 vc->entry_exit_count = 0;
844 vc->vcore_state = VCORE_RUNNING;
845 vc->stolen_tb += mftb() - vc->preempt_tb; 887 vc->stolen_tb += mftb() - vc->preempt_tb;
846 vc->in_guest = 0;
847 vc->pcpu = smp_processor_id(); 888 vc->pcpu = smp_processor_id();
848 vc->napping_threads = 0;
849 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { 889 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
850 kvmppc_start_thread(vcpu); 890 kvmppc_start_thread(vcpu);
851 if (vcpu->arch.vpa.update_pending ||
852 vcpu->arch.slb_shadow.update_pending ||
853 vcpu->arch.dtl.update_pending)
854 kvmppc_update_vpas(vcpu);
855 kvmppc_create_dtl_entry(vcpu, vc); 891 kvmppc_create_dtl_entry(vcpu, vc);
856 } 892 }
857 /* Grab any remaining hw threads so they can't go into the kernel */ 893 /* Grab any remaining hw threads so they can't go into the kernel */
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index a84aafce2a12..a1044f43becd 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -810,7 +810,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
810 lwz r3,VCORE_NAPPING_THREADS(r5) 810 lwz r3,VCORE_NAPPING_THREADS(r5)
811 lwz r4,VCPU_PTID(r9) 811 lwz r4,VCPU_PTID(r9)
812 li r0,1 812 li r0,1
813 sldi r0,r0,r4 813 sld r0,r0,r4
814 andc. r3,r3,r0 /* no sense IPI'ing ourselves */ 814 andc. r3,r3,r0 /* no sense IPI'ing ourselves */
815 beq 43f 815 beq 43f
816 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */ 816 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b6edbb3b4a54..6e8f677f5646 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -635,7 +635,7 @@ static inline int __init read_usm_ranges(const u32 **usm)
635 */ 635 */
636static void __init parse_drconf_memory(struct device_node *memory) 636static void __init parse_drconf_memory(struct device_node *memory)
637{ 637{
638 const u32 *dm, *usm; 638 const u32 *uninitialized_var(dm), *usm;
639 unsigned int n, rc, ranges, is_kexec_kdump = 0; 639 unsigned int n, rc, ranges, is_kexec_kdump = 0;
640 unsigned long lmb_size, base, size, sz; 640 unsigned long lmb_size, base, size, sz;
641 int nid; 641 int nid;
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S
index 55ba3855a97f..7d3a3b5619a2 100644
--- a/arch/powerpc/net/bpf_jit_64.S
+++ b/arch/powerpc/net/bpf_jit_64.S
@@ -105,6 +105,7 @@ sk_load_byte_msh_positive_offset:
105 mr r4, r_addr; \ 105 mr r4, r_addr; \
106 li r6, SIZE; \ 106 li r6, SIZE; \
107 bl skb_copy_bits; \ 107 bl skb_copy_bits; \
108 nop; \
108 /* R3 = 0 on success */ \ 109 /* R3 = 0 on success */ \
109 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ 110 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
110 ld r0, 16(r1); \ 111 ld r0, 16(r1); \
@@ -156,6 +157,7 @@ bpf_slow_path_byte_msh:
156 mr r4, r_addr; \ 157 mr r4, r_addr; \
157 li r5, SIZE; \ 158 li r5, SIZE; \
158 bl bpf_internal_load_pointer_neg_helper; \ 159 bl bpf_internal_load_pointer_neg_helper; \
160 nop; \
159 /* R3 != 0 on success */ \ 161 /* R3 != 0 on success */ \
160 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ 162 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
161 ld r0, 16(r1); \ 163 ld r0, 16(r1); \
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 0915b1ad66ce..2d311c0caf8e 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -106,7 +106,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
106 tcep++; 106 tcep++;
107 } 107 }
108 108
109 if (tbl->it_type == TCE_PCI_SWINV_CREATE) 109 if (tbl->it_type & TCE_PCI_SWINV_CREATE)
110 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); 110 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1);
111 return 0; 111 return 0;
112} 112}
@@ -121,7 +121,7 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
121 while (npages--) 121 while (npages--)
122 *(tcep++) = 0; 122 *(tcep++) = 0;
123 123
124 if (tbl->it_type == TCE_PCI_SWINV_FREE) 124 if (tbl->it_type & TCE_PCI_SWINV_FREE)
125 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); 125 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1);
126} 126}
127 127
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 36f957f31842..8733a86ad52e 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -68,9 +68,7 @@ static const char *pseries_nvram_os_partitions[] = {
68}; 68};
69 69
70static void oops_to_nvram(struct kmsg_dumper *dumper, 70static void oops_to_nvram(struct kmsg_dumper *dumper,
71 enum kmsg_dump_reason reason, 71 enum kmsg_dump_reason reason);
72 const char *old_msgs, unsigned long old_len,
73 const char *new_msgs, unsigned long new_len);
74 72
75static struct kmsg_dumper nvram_kmsg_dumper = { 73static struct kmsg_dumper nvram_kmsg_dumper = {
76 .dump = oops_to_nvram 74 .dump = oops_to_nvram
@@ -504,28 +502,6 @@ int __init pSeries_nvram_init(void)
504} 502}
505 503
506/* 504/*
507 * Try to capture the last capture_len bytes of the printk buffer. Return
508 * the amount actually captured.
509 */
510static size_t capture_last_msgs(const char *old_msgs, size_t old_len,
511 const char *new_msgs, size_t new_len,
512 char *captured, size_t capture_len)
513{
514 if (new_len >= capture_len) {
515 memcpy(captured, new_msgs + (new_len - capture_len),
516 capture_len);
517 return capture_len;
518 } else {
519 /* Grab the end of old_msgs. */
520 size_t old_tail_len = min(old_len, capture_len - new_len);
521 memcpy(captured, old_msgs + (old_len - old_tail_len),
522 old_tail_len);
523 memcpy(captured + old_tail_len, new_msgs, new_len);
524 return old_tail_len + new_len;
525 }
526}
527
528/*
529 * Are we using the ibm,rtas-log for oops/panic reports? And if so, 505 * Are we using the ibm,rtas-log for oops/panic reports? And if so,
530 * would logging this oops/panic overwrite an RTAS event that rtas_errd 506 * would logging this oops/panic overwrite an RTAS event that rtas_errd
531 * hasn't had a chance to read and process? Return 1 if so, else 0. 507 * hasn't had a chance to read and process? Return 1 if so, else 0.
@@ -541,27 +517,6 @@ static int clobbering_unread_rtas_event(void)
541 NVRAM_RTAS_READ_TIMEOUT); 517 NVRAM_RTAS_READ_TIMEOUT);
542} 518}
543 519
544/* Squeeze out each line's <n> severity prefix. */
545static size_t elide_severities(char *buf, size_t len)
546{
547 char *in, *out, *buf_end = buf + len;
548 /* Assume a <n> at the very beginning marks the start of a line. */
549 int newline = 1;
550
551 in = out = buf;
552 while (in < buf_end) {
553 if (newline && in+3 <= buf_end &&
554 *in == '<' && isdigit(in[1]) && in[2] == '>') {
555 in += 3;
556 newline = 0;
557 } else {
558 newline = (*in == '\n');
559 *out++ = *in++;
560 }
561 }
562 return out - buf;
563}
564
565/* Derived from logfs_compress() */ 520/* Derived from logfs_compress() */
566static int nvram_compress(const void *in, void *out, size_t inlen, 521static int nvram_compress(const void *in, void *out, size_t inlen,
567 size_t outlen) 522 size_t outlen)
@@ -619,9 +574,7 @@ static int zip_oops(size_t text_len)
619 * partition. If that's too much, go back and capture uncompressed text. 574 * partition. If that's too much, go back and capture uncompressed text.
620 */ 575 */
621static void oops_to_nvram(struct kmsg_dumper *dumper, 576static void oops_to_nvram(struct kmsg_dumper *dumper,
622 enum kmsg_dump_reason reason, 577 enum kmsg_dump_reason reason)
623 const char *old_msgs, unsigned long old_len,
624 const char *new_msgs, unsigned long new_len)
625{ 578{
626 static unsigned int oops_count = 0; 579 static unsigned int oops_count = 0;
627 static bool panicking = false; 580 static bool panicking = false;
@@ -660,14 +613,14 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
660 return; 613 return;
661 614
662 if (big_oops_buf) { 615 if (big_oops_buf) {
663 text_len = capture_last_msgs(old_msgs, old_len, 616 kmsg_dump_get_buffer(dumper, false,
664 new_msgs, new_len, big_oops_buf, big_oops_buf_sz); 617 big_oops_buf, big_oops_buf_sz, &text_len);
665 text_len = elide_severities(big_oops_buf, text_len);
666 rc = zip_oops(text_len); 618 rc = zip_oops(text_len);
667 } 619 }
668 if (rc != 0) { 620 if (rc != 0) {
669 text_len = capture_last_msgs(old_msgs, old_len, 621 kmsg_dump_rewind(dumper);
670 new_msgs, new_len, oops_data, oops_data_sz); 622 kmsg_dump_get_buffer(dumper, true,
623 oops_data, oops_data_sz, &text_len);
671 err_type = ERR_TYPE_KERNEL_PANIC; 624 err_type = ERR_TYPE_KERNEL_PANIC;
672 *oops_len = (u16) text_len; 625 *oops_len = (u16) text_len;
673 } 626 }
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 41a34bc4a9a2..e61483e8e960 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -106,7 +106,7 @@ static void check_and_cede_processor(void)
106 * we first hard disable then check. 106 * we first hard disable then check.
107 */ 107 */
108 hard_irq_disable(); 108 hard_irq_disable();
109 if (get_paca()->irq_happened == 0) 109 if (!lazy_irq_pending())
110 cede_processor(); 110 cede_processor();
111} 111}
112 112
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0f3ab06d2222..eab3492a45c5 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -971,7 +971,7 @@ static int cpu_cmd(void)
971 /* print cpus waiting or in xmon */ 971 /* print cpus waiting or in xmon */
972 printf("cpus stopped:"); 972 printf("cpus stopped:");
973 count = 0; 973 count = 0;
974 for (cpu = 0; cpu < NR_CPUS; ++cpu) { 974 for_each_possible_cpu(cpu) {
975 if (cpumask_test_cpu(cpu, &cpus_in_xmon)) { 975 if (cpumask_test_cpu(cpu, &cpus_in_xmon)) {
976 if (count == 0) 976 if (count == 0)
977 printf(" %x", cpu); 977 printf(" %x", cpu);
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 158c9176e42a..43a179ce9afc 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -201,8 +201,8 @@ static struct resource kfr2r09_usb0_gadget_resources[] = {
201 .flags = IORESOURCE_MEM, 201 .flags = IORESOURCE_MEM,
202 }, 202 },
203 [1] = { 203 [1] = {
204 .start = evtirq(0xa20), 204 .start = evt2irq(0xa20),
205 .end = evtirq(0xa20), 205 .end = evt2irq(0xa20),
206 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 206 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
207 }, 207 },
208}; 208};
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index c045142f7338..9e702f2f8045 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -239,7 +239,7 @@ static int __init pcie_clk_init(struct sh7786_pcie_port *port)
239 clk->enable_reg = (void __iomem *)(chan->reg_base + SH4A_PCIEPHYCTLR); 239 clk->enable_reg = (void __iomem *)(chan->reg_base + SH4A_PCIEPHYCTLR);
240 clk->enable_bit = BITS_CKE; 240 clk->enable_bit = BITS_CKE;
241 241
242 ret = sh_clk_mstp32_register(clk, 1); 242 ret = sh_clk_mstp_register(clk, 1);
243 if (unlikely(ret < 0)) 243 if (unlikely(ret < 0))
244 goto err_phy; 244 goto err_phy;
245 245
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
index ea01a72f1b94..53638e231cd0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
@@ -283,7 +283,7 @@ int __init arch_clk_init(void)
283 ret = sh_clk_div6_register(div6_clks, DIV6_NR); 283 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
284 284
285 if (!ret) 285 if (!ret)
286 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 286 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
287 287
288 return ret; 288 return ret;
289} 289}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
index 7ac07b4f75de..22e485d1990b 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
@@ -276,7 +276,7 @@ int __init arch_clk_init(void)
276 ret = sh_clk_div6_register(div6_clks, DIV6_NR); 276 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
277 277
278 if (!ret) 278 if (!ret)
279 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 279 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
280 280
281 return ret; 281 return ret;
282} 282}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 8e1f97010c0d..c4cb740e4d10 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -261,7 +261,7 @@ int __init arch_clk_init(void)
261 ret = sh_clk_div6_register(div6_clks, DIV6_NR); 261 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
262 262
263 if (!ret) 263 if (!ret)
264 ret = sh_clk_mstp32_register(mstp_clks, HWBLK_NR); 264 ret = sh_clk_mstp_register(mstp_clks, HWBLK_NR);
265 265
266 return ret; 266 return ret;
267} 267}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index 35f75cf0c7e5..37c41c7747a3 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -311,7 +311,7 @@ int __init arch_clk_init(void)
311 ret = sh_clk_div6_register(div6_clks, DIV6_NR); 311 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
312 312
313 if (!ret) 313 if (!ret)
314 ret = sh_clk_mstp32_register(mstp_clks, HWBLK_NR); 314 ret = sh_clk_mstp_register(mstp_clks, HWBLK_NR);
315 315
316 return ret; 316 return ret;
317} 317}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 2a87901673fe..c87e78f73234 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -375,7 +375,7 @@ int __init arch_clk_init(void)
375 ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR); 375 ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
376 376
377 if (!ret) 377 if (!ret)
378 ret = sh_clk_mstp32_register(mstp_clks, HWBLK_NR); 378 ret = sh_clk_mstp_register(mstp_clks, HWBLK_NR);
379 379
380 return ret; 380 return ret;
381} 381}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
index 1697642c1f73..deb683abacf0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
@@ -260,7 +260,7 @@ int __init arch_clk_init(void)
260 &div4_table); 260 &div4_table);
261 261
262 if (!ret) 262 if (!ret)
263 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 263 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
264 264
265 return ret; 265 return ret;
266} 266}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
index 04ab5aeaf920..e84a43229b9c 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
@@ -148,7 +148,7 @@ int __init arch_clk_init(void)
148 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks), 148 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
149 &div4_table); 149 &div4_table);
150 if (!ret) 150 if (!ret)
151 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 151 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
152 152
153 return ret; 153 return ret;
154} 154}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index ab1c58f2d101..1c83788db76a 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -175,7 +175,7 @@ int __init arch_clk_init(void)
175 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks), 175 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
176 &div4_table); 176 &div4_table);
177 if (!ret) 177 if (!ret)
178 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 178 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
179 179
180 return ret; 180 return ret;
181} 181}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
index 491709483e10..8bba6f159023 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
@@ -194,7 +194,7 @@ int __init arch_clk_init(void)
194 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks), 194 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
195 &div4_table); 195 &div4_table);
196 if (!ret) 196 if (!ret)
197 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 197 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
198 198
199 return ret; 199 return ret;
200} 200}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
index 0f11b392bf46..a9422dab0ce7 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
@@ -149,7 +149,7 @@ int __init arch_clk_init(void)
149 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks), 149 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
150 &div4_table); 150 &div4_table);
151 if (!ret) 151 if (!ret)
152 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 152 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
153 153
154 return ret; 154 return ret;
155} 155}
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 5cffdc55f075..3e244f31e56b 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -443,7 +443,7 @@ static int __init vio_init(void)
443 root_vdev = vio_create_one(hp, root, NULL); 443 root_vdev = vio_create_one(hp, root, NULL);
444 err = -ENODEV; 444 err = -ENODEV;
445 if (!root_vdev) { 445 if (!root_vdev) {
446 printk(KERN_ERR "VIO: Coult not create root device.\n"); 446 printk(KERN_ERR "VIO: Could not create root device.\n");
447 goto out_release; 447 goto out_release;
448 } 448 }
449 449
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index daeca56211e3..673ac9b63d6b 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -38,7 +38,7 @@
38int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 38int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
39{ 39{
40 int err = 0; 40 int err = 0;
41 bool ia32 = is_ia32_task(); 41 bool ia32 = test_thread_flag(TIF_IA32);
42 42
43 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) 43 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
44 return -EFAULT; 44 return -EFAULT;
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 340ee49961a6..f91e80f4f180 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -176,7 +176,7 @@
176#define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */ 176#define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */
177#define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */ 177#define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */
178#define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ 178#define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */
179#define X86_FEATURE_DTS (7*32+ 7) /* Digital Thermal Sensor */ 179#define X86_FEATURE_DTHERM (7*32+ 7) /* Digital Thermal Sensor */
180#define X86_FEATURE_HW_PSTATE (7*32+ 8) /* AMD HW-PState */ 180#define X86_FEATURE_HW_PSTATE (7*32+ 8) /* AMD HW-PState */
181 181
182/* Virtualization flags: Linux defined, word 8 */ 182/* Virtualization flags: Linux defined, word 8 */
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
index 43876f16caf1..cb00ccc7d571 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -47,16 +47,26 @@ static inline void native_set_pte(pte_t *ptep, pte_t pte)
47 * they can run pmd_offset_map_lock or pmd_trans_huge or other pmd 47 * they can run pmd_offset_map_lock or pmd_trans_huge or other pmd
48 * operations. 48 * operations.
49 * 49 *
50 * Without THP if the mmap_sem is hold for reading, the 50 * Without THP if the mmap_sem is hold for reading, the pmd can only
51 * pmd can only transition from null to not null while pmd_read_atomic runs. 51 * transition from null to not null while pmd_read_atomic runs. So
52 * So there's no need of literally reading it atomically. 52 * we can always return atomic pmd values with this function.
53 * 53 *
54 * With THP if the mmap_sem is hold for reading, the pmd can become 54 * With THP if the mmap_sem is hold for reading, the pmd can become
55 * THP or null or point to a pte (and in turn become "stable") at any 55 * trans_huge or none or point to a pte (and in turn become "stable")
56 * time under pmd_read_atomic, so it's mandatory to read it atomically 56 * at any time under pmd_read_atomic. We could read it really
57 * with cmpxchg8b. 57 * atomically here with a atomic64_read for the THP enabled case (and
58 * it would be a whole lot simpler), but to avoid using cmpxchg8b we
59 * only return an atomic pmdval if the low part of the pmdval is later
60 * found stable (i.e. pointing to a pte). And we're returning a none
61 * pmdval if the low part of the pmd is none. In some cases the high
62 * and low part of the pmdval returned may not be consistent if THP is
63 * enabled (the low part may point to previously mapped hugepage,
64 * while the high part may point to a more recently mapped hugepage),
65 * but pmd_none_or_trans_huge_or_clear_bad() only needs the low part
66 * of the pmd to be read atomically to decide if the pmd is unstable
67 * or not, with the only exception of when the low part of the pmd is
68 * zero in which case we return a none pmd.
58 */ 69 */
59#ifndef CONFIG_TRANSPARENT_HUGEPAGE
60static inline pmd_t pmd_read_atomic(pmd_t *pmdp) 70static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
61{ 71{
62 pmdval_t ret; 72 pmdval_t ret;
@@ -74,12 +84,6 @@ static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
74 84
75 return (pmd_t) { ret }; 85 return (pmd_t) { ret };
76} 86}
77#else /* CONFIG_TRANSPARENT_HUGEPAGE */
78static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
79{
80 return (pmd_t) { atomic64_read((atomic64_t *)pmdp) };
81}
82#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
83 87
84static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) 88static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
85{ 89{
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 8afb69319815..b2297e58c6ed 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -422,12 +422,14 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
422 return 0; 422 return 0;
423 } 423 }
424 424
425 if (intsrc->source_irq == 0 && intsrc->global_irq == 2) { 425 if (intsrc->source_irq == 0) {
426 if (acpi_skip_timer_override) { 426 if (acpi_skip_timer_override) {
427 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); 427 printk(PREFIX "BIOS IRQ0 override ignored.\n");
428 return 0; 428 return 0;
429 } 429 }
430 if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) { 430
431 if ((intsrc->global_irq == 2) && acpi_fix_pin2_polarity
432 && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
431 intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; 433 intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK;
432 printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); 434 printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
433 } 435 }
@@ -1334,17 +1336,12 @@ static int __init dmi_disable_acpi(const struct dmi_system_id *d)
1334} 1336}
1335 1337
1336/* 1338/*
1337 * Force ignoring BIOS IRQ0 pin2 override 1339 * Force ignoring BIOS IRQ0 override
1338 */ 1340 */
1339static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) 1341static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
1340{ 1342{
1341 /*
1342 * The ati_ixp4x0_rev() early PCI quirk should have set
1343 * the acpi_skip_timer_override flag already:
1344 */
1345 if (!acpi_skip_timer_override) { 1343 if (!acpi_skip_timer_override) {
1346 WARN(1, KERN_ERR "ati_ixp4x0 quirk not complete.\n"); 1344 pr_notice("%s detected: Ignoring BIOS IRQ0 override\n",
1347 pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n",
1348 d->ident); 1345 d->ident);
1349 acpi_skip_timer_override = 1; 1346 acpi_skip_timer_override = 1;
1350 } 1347 }
@@ -1438,7 +1435,7 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
1438 * is enabled. This input is incorrectly designated the 1435 * is enabled. This input is incorrectly designated the
1439 * ISA IRQ 0 via an interrupt source override even though 1436 * ISA IRQ 0 via an interrupt source override even though
1440 * it is wired to the output of the master 8259A and INTIN0 1437 * it is wired to the output of the master 8259A and INTIN0
1441 * is not connected at all. Force ignoring BIOS IRQ0 pin2 1438 * is not connected at all. Force ignoring BIOS IRQ0
1442 * override in that cases. 1439 * override in that cases.
1443 */ 1440 */
1444 { 1441 {
@@ -1473,6 +1470,14 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
1473 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"), 1470 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
1474 }, 1471 },
1475 }, 1472 },
1473 {
1474 .callback = dmi_ignore_irq0_timer_override,
1475 .ident = "FUJITSU SIEMENS",
1476 .matches = {
1477 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
1478 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
1479 },
1480 },
1476 {} 1481 {}
1477}; 1482};
1478 1483
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl
index dfea390e1608..c7b3fe2d72e0 100644
--- a/arch/x86/kernel/cpu/mkcapflags.pl
+++ b/arch/x86/kernel/cpu/mkcapflags.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/bin/perl -w
2# 2#
3# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h 3# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h
4# 4#
@@ -11,22 +11,35 @@ open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
11print OUT "#include <asm/cpufeature.h>\n\n"; 11print OUT "#include <asm/cpufeature.h>\n\n";
12print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; 12print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
13 13
14%features = ();
15$err = 0;
16
14while (defined($line = <IN>)) { 17while (defined($line = <IN>)) {
15 if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { 18 if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
16 $macro = $1; 19 $macro = $1;
17 $feature = $2; 20 $feature = "\L$2";
18 $tail = $3; 21 $tail = $3;
19 if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { 22 if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
20 $feature = $1; 23 $feature = "\L$1";
21 } 24 }
22 25
23 if ($feature ne '') { 26 next if ($feature eq '');
24 printf OUT "\t%-32s = \"%s\",\n", 27
25 "[$macro]", "\L$feature"; 28 if ($features{$feature}++) {
29 print STDERR "$in: duplicate feature name: $feature\n";
30 $err++;
26 } 31 }
32 printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature;
27 } 33 }
28} 34}
29print OUT "};\n"; 35print OUT "};\n";
30 36
31close(IN); 37close(IN);
32close(OUT); 38close(OUT);
39
40if ($err) {
41 unlink($out);
42 exit(1);
43}
44
45exit(0);
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index addf9e82a7f2..ee8e9abc859f 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -31,7 +31,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
31 const struct cpuid_bit *cb; 31 const struct cpuid_bit *cb;
32 32
33 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { 33 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
34 { X86_FEATURE_DTS, CR_EAX, 0, 0x00000006, 0 }, 34 { X86_FEATURE_DTHERM, CR_EAX, 0, 0x00000006, 0 },
35 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, 35 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 },
36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, 36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 },
37 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, 37 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 },
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 8bfb6146f753..3f61904365cf 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -444,12 +444,12 @@ void kgdb_roundup_cpus(unsigned long flags)
444 444
445/** 445/**
446 * kgdb_arch_handle_exception - Handle architecture specific GDB packets. 446 * kgdb_arch_handle_exception - Handle architecture specific GDB packets.
447 * @vector: The error vector of the exception that happened. 447 * @e_vector: The error vector of the exception that happened.
448 * @signo: The signal number of the exception that happened. 448 * @signo: The signal number of the exception that happened.
449 * @err_code: The error code of the exception that happened. 449 * @err_code: The error code of the exception that happened.
450 * @remcom_in_buffer: The buffer of the packet we have read. 450 * @remcomInBuffer: The buffer of the packet we have read.
451 * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. 451 * @remcomOutBuffer: The buffer of %BUFMAX bytes to write a packet into.
452 * @regs: The &struct pt_regs of the current process. 452 * @linux_regs: The &struct pt_regs of the current process.
453 * 453 *
454 * This function MUST handle the 'c' and 's' command packets, 454 * This function MUST handle the 'c' and 's' command packets,
455 * as well packets to set / remove a hardware breakpoint, if used. 455 * as well packets to set / remove a hardware breakpoint, if used.
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 25b48edb847c..5de92f1abd76 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -451,6 +451,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
451 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), 451 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"),
452 }, 452 },
453 }, 453 },
454 { /* Handle problems with rebooting on the Precision M6600. */
455 .callback = set_pci_reboot,
456 .ident = "Dell OptiPlex 990",
457 .matches = {
458 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
459 DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"),
460 },
461 },
454 { } 462 { }
455}; 463};
456 464
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index be3cea4407ff..57e168e27b5b 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3934,6 +3934,9 @@ static void kvm_mmu_remove_some_alloc_mmu_pages(struct kvm *kvm,
3934{ 3934{
3935 struct kvm_mmu_page *page; 3935 struct kvm_mmu_page *page;
3936 3936
3937 if (list_empty(&kvm->arch.active_mmu_pages))
3938 return;
3939
3937 page = container_of(kvm->arch.active_mmu_pages.prev, 3940 page = container_of(kvm->arch.active_mmu_pages.prev,
3938 struct kvm_mmu_page, link); 3941 struct kvm_mmu_page, link);
3939 kvm_mmu_prepare_zap_page(kvm, page, invalid_list); 3942 kvm_mmu_prepare_zap_page(kvm, page, invalid_list);
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c
index 459b58a8a15c..25b7ae8d058a 100644
--- a/arch/x86/lib/csum-wrappers_64.c
+++ b/arch/x86/lib/csum-wrappers_64.c
@@ -115,7 +115,7 @@ EXPORT_SYMBOL(csum_partial_copy_to_user);
115 * @src: source address 115 * @src: source address
116 * @dst: destination address 116 * @dst: destination address
117 * @len: number of bytes to be copied. 117 * @len: number of bytes to be copied.
118 * @isum: initial sum that is added into the result (32bit unfolded) 118 * @sum: initial sum that is added into the result (32bit unfolded)
119 * 119 *
120 * Returns an 32bit unfolded checksum of the buffer. 120 * Returns an 32bit unfolded checksum of the buffer.
121 */ 121 */
diff --git a/arch/x86/platform/mrst/early_printk_mrst.c b/arch/x86/platform/mrst/early_printk_mrst.c
index 3c6e328483c7..028454f0c3a5 100644
--- a/arch/x86/platform/mrst/early_printk_mrst.c
+++ b/arch/x86/platform/mrst/early_printk_mrst.c
@@ -110,19 +110,16 @@ static struct kmsg_dumper dw_dumper;
110static int dumper_registered; 110static int dumper_registered;
111 111
112static void dw_kmsg_dump(struct kmsg_dumper *dumper, 112static void dw_kmsg_dump(struct kmsg_dumper *dumper,
113 enum kmsg_dump_reason reason, 113 enum kmsg_dump_reason reason)
114 const char *s1, unsigned long l1,
115 const char *s2, unsigned long l2)
116{ 114{
117 int i; 115 static char line[1024];
116 size_t len;
118 117
119 /* When run to this, we'd better re-init the HW */ 118 /* When run to this, we'd better re-init the HW */
120 mrst_early_console_init(); 119 mrst_early_console_init();
121 120
122 for (i = 0; i < l1; i++) 121 while (kmsg_dump_get_line(dumper, true, line, sizeof(line), &len))
123 early_mrst_console.write(&early_mrst_console, s1 + i, 1); 122 early_mrst_console.write(&early_mrst_console, line, len);
124 for (i = 0; i < l2; i++)
125 early_mrst_console.write(&early_mrst_console, s2 + i, 1);
126} 123}
127 124
128/* Set the ratio rate to 115200, 8n1, IRQ disabled */ 125/* Set the ratio rate to 115200, 8n1, IRQ disabled */
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 7608559de93a..f973754ddf90 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -68,8 +68,8 @@ endif
68 68
69# Only build variant and/or platform if it includes a Makefile 69# Only build variant and/or platform if it includes a Makefile
70 70
71buildvar := $(shell test -a $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/) 71buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
72buildplf := $(shell test -a $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/) 72buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
73 73
74# Find libgcc.a 74# Find libgcc.a
75 75
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 88ecea3facb4..ee2e2089483d 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -83,7 +83,6 @@ SECTIONS
83 83
84 _text = .; 84 _text = .;
85 _stext = .; 85 _stext = .;
86 _ftext = .;
87 86
88 .text : 87 .text :
89 { 88 {
@@ -112,7 +111,7 @@ SECTIONS
112 EXCEPTION_TABLE(16) 111 EXCEPTION_TABLE(16)
113 /* Data section */ 112 /* Data section */
114 113
115 _fdata = .; 114 _sdata = .;
116 RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE) 115 RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
117 _edata = .; 116 _edata = .;
118 117
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index ba150e5de2eb..db955179da2d 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -26,11 +26,7 @@
26 26
27#include <asm/bootparam.h> 27#include <asm/bootparam.h>
28#include <asm/page.h> 28#include <asm/page.h>
29 29#include <asm/sections.h>
30/* References to section boundaries */
31
32extern char _ftext, _etext, _fdata, _edata, _rodata_end;
33extern char __init_begin, __init_end;
34 30
35/* 31/*
36 * mem_reserve(start, end, must_exist) 32 * mem_reserve(start, end, must_exist)
@@ -197,9 +193,9 @@ void __init mem_init(void)
197 reservedpages++; 193 reservedpages++;
198 } 194 }
199 195
200 codesize = (unsigned long) &_etext - (unsigned long) &_ftext; 196 codesize = (unsigned long) _etext - (unsigned long) _stext;
201 datasize = (unsigned long) &_edata - (unsigned long) &_fdata; 197 datasize = (unsigned long) _edata - (unsigned long) _sdata;
202 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 198 initsize = (unsigned long) __init_end - (unsigned long) __init_begin;
203 199
204 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, " 200 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, "
205 "%ldk data, %ldk init %ldk highmem)\n", 201 "%ldk data, %ldk init %ldk highmem)\n",
@@ -237,7 +233,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
237 233
238void free_initmem(void) 234void free_initmem(void)
239{ 235{
240 free_reserved_mem(&__init_begin, &__init_end); 236 free_reserved_mem(__init_begin, __init_end);
241 printk("Freeing unused kernel memory: %dk freed\n", 237 printk("Freeing unused kernel memory: %zuk freed\n",
242 (&__init_end - &__init_begin) >> 10); 238 (__init_end - __init_begin) >> 10);
243} 239}
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 02cf6335e9bd..e7dee617358e 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -125,12 +125,8 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q)
125 125
126 blkg->pd[i] = pd; 126 blkg->pd[i] = pd;
127 pd->blkg = blkg; 127 pd->blkg = blkg;
128 }
129
130 /* invoke per-policy init */
131 for (i = 0; i < BLKCG_MAX_POLS; i++) {
132 struct blkcg_policy *pol = blkcg_policy[i];
133 128
129 /* invoke per-policy init */
134 if (blkcg_policy_enabled(blkg->q, pol)) 130 if (blkcg_policy_enabled(blkg->q, pol))
135 pol->pd_init_fn(blkg); 131 pol->pd_init_fn(blkg);
136 } 132 }
@@ -245,10 +241,9 @@ EXPORT_SYMBOL_GPL(blkg_lookup_create);
245 241
246static void blkg_destroy(struct blkcg_gq *blkg) 242static void blkg_destroy(struct blkcg_gq *blkg)
247{ 243{
248 struct request_queue *q = blkg->q;
249 struct blkcg *blkcg = blkg->blkcg; 244 struct blkcg *blkcg = blkg->blkcg;
250 245
251 lockdep_assert_held(q->queue_lock); 246 lockdep_assert_held(blkg->q->queue_lock);
252 lockdep_assert_held(&blkcg->lock); 247 lockdep_assert_held(&blkcg->lock);
253 248
254 /* Something wrong if we are trying to remove same group twice */ 249 /* Something wrong if we are trying to remove same group twice */
diff --git a/block/blk-core.c b/block/blk-core.c
index 3c923a7aeb56..93eb3e4f88ce 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -361,9 +361,10 @@ EXPORT_SYMBOL(blk_put_queue);
361 */ 361 */
362void blk_drain_queue(struct request_queue *q, bool drain_all) 362void blk_drain_queue(struct request_queue *q, bool drain_all)
363{ 363{
364 int i;
365
364 while (true) { 366 while (true) {
365 bool drain = false; 367 bool drain = false;
366 int i;
367 368
368 spin_lock_irq(q->queue_lock); 369 spin_lock_irq(q->queue_lock);
369 370
@@ -408,6 +409,18 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
408 break; 409 break;
409 msleep(10); 410 msleep(10);
410 } 411 }
412
413 /*
414 * With queue marked dead, any woken up waiter will fail the
415 * allocation path, so the wakeup chaining is lost and we're
416 * left with hung waiters. We need to wake up those waiters.
417 */
418 if (q->request_fn) {
419 spin_lock_irq(q->queue_lock);
420 for (i = 0; i < ARRAY_SIZE(q->rq.wait); i++)
421 wake_up_all(&q->rq.wait[i]);
422 spin_unlock_irq(q->queue_lock);
423 }
411} 424}
412 425
413/** 426/**
@@ -467,7 +480,6 @@ void blk_cleanup_queue(struct request_queue *q)
467 /* mark @q DEAD, no new request or merges will be allowed afterwards */ 480 /* mark @q DEAD, no new request or merges will be allowed afterwards */
468 mutex_lock(&q->sysfs_lock); 481 mutex_lock(&q->sysfs_lock);
469 queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q); 482 queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
470
471 spin_lock_irq(lock); 483 spin_lock_irq(lock);
472 484
473 /* 485 /*
@@ -485,10 +497,6 @@ void blk_cleanup_queue(struct request_queue *q)
485 queue_flag_set(QUEUE_FLAG_NOMERGES, q); 497 queue_flag_set(QUEUE_FLAG_NOMERGES, q);
486 queue_flag_set(QUEUE_FLAG_NOXMERGES, q); 498 queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
487 queue_flag_set(QUEUE_FLAG_DEAD, q); 499 queue_flag_set(QUEUE_FLAG_DEAD, q);
488
489 if (q->queue_lock != &q->__queue_lock)
490 q->queue_lock = &q->__queue_lock;
491
492 spin_unlock_irq(lock); 500 spin_unlock_irq(lock);
493 mutex_unlock(&q->sysfs_lock); 501 mutex_unlock(&q->sysfs_lock);
494 502
@@ -499,6 +507,11 @@ void blk_cleanup_queue(struct request_queue *q)
499 del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer); 507 del_timer_sync(&q->backing_dev_info.laptop_mode_wb_timer);
500 blk_sync_queue(q); 508 blk_sync_queue(q);
501 509
510 spin_lock_irq(lock);
511 if (q->queue_lock != &q->__queue_lock)
512 q->queue_lock = &q->__queue_lock;
513 spin_unlock_irq(lock);
514
502 /* @q is and will stay empty, shutdown and put */ 515 /* @q is and will stay empty, shutdown and put */
503 blk_put_queue(q); 516 blk_put_queue(q);
504} 517}
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 780354888958..6e4744cbfb56 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -197,44 +197,3 @@ void blk_add_timer(struct request *req)
197 mod_timer(&q->timeout, expiry); 197 mod_timer(&q->timeout, expiry);
198} 198}
199 199
200/**
201 * blk_abort_queue -- Abort all request on given queue
202 * @queue: pointer to queue
203 *
204 */
205void blk_abort_queue(struct request_queue *q)
206{
207 unsigned long flags;
208 struct request *rq, *tmp;
209 LIST_HEAD(list);
210
211 /*
212 * Not a request based block device, nothing to abort
213 */
214 if (!q->request_fn)
215 return;
216
217 spin_lock_irqsave(q->queue_lock, flags);
218
219 elv_abort_queue(q);
220
221 /*
222 * Splice entries to local list, to avoid deadlocking if entries
223 * get readded to the timeout list by error handling
224 */
225 list_splice_init(&q->timeout_list, &list);
226
227 list_for_each_entry_safe(rq, tmp, &list, timeout_list)
228 blk_abort_request(rq);
229
230 /*
231 * Occasionally, blk_abort_request() will return without
232 * deleting the element from the list. Make sure we add those back
233 * instead of leaving them on the local stack list.
234 */
235 list_splice(&list, &q->timeout_list);
236
237 spin_unlock_irqrestore(q->queue_lock, flags);
238
239}
240EXPORT_SYMBOL_GPL(blk_abort_queue);
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 673c977cc2bf..fb52df9744f5 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -17,8 +17,6 @@
17#include "blk.h" 17#include "blk.h"
18#include "blk-cgroup.h" 18#include "blk-cgroup.h"
19 19
20static struct blkcg_policy blkcg_policy_cfq __maybe_unused;
21
22/* 20/*
23 * tunables 21 * tunables
24 */ 22 */
@@ -418,11 +416,6 @@ static inline struct cfq_group *pd_to_cfqg(struct blkg_policy_data *pd)
418 return pd ? container_of(pd, struct cfq_group, pd) : NULL; 416 return pd ? container_of(pd, struct cfq_group, pd) : NULL;
419} 417}
420 418
421static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg)
422{
423 return pd_to_cfqg(blkg_to_pd(blkg, &blkcg_policy_cfq));
424}
425
426static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg) 419static inline struct blkcg_gq *cfqg_to_blkg(struct cfq_group *cfqg)
427{ 420{
428 return pd_to_blkg(&cfqg->pd); 421 return pd_to_blkg(&cfqg->pd);
@@ -572,6 +565,13 @@ static inline void cfqg_stats_update_avg_queue_size(struct cfq_group *cfqg) { }
572 565
573#ifdef CONFIG_CFQ_GROUP_IOSCHED 566#ifdef CONFIG_CFQ_GROUP_IOSCHED
574 567
568static struct blkcg_policy blkcg_policy_cfq;
569
570static inline struct cfq_group *blkg_to_cfqg(struct blkcg_gq *blkg)
571{
572 return pd_to_cfqg(blkg_to_pd(blkg, &blkcg_policy_cfq));
573}
574
575static inline void cfqg_get(struct cfq_group *cfqg) 575static inline void cfqg_get(struct cfq_group *cfqg)
576{ 576{
577 return blkg_get(cfqg_to_blkg(cfqg)); 577 return blkg_get(cfqg_to_blkg(cfqg));
@@ -3951,10 +3951,11 @@ static void cfq_exit_queue(struct elevator_queue *e)
3951 3951
3952 cfq_shutdown_timer_wq(cfqd); 3952 cfq_shutdown_timer_wq(cfqd);
3953 3953
3954#ifndef CONFIG_CFQ_GROUP_IOSCHED 3954#ifdef CONFIG_CFQ_GROUP_IOSCHED
3955 blkcg_deactivate_policy(q, &blkcg_policy_cfq);
3956#else
3955 kfree(cfqd->root_group); 3957 kfree(cfqd->root_group);
3956#endif 3958#endif
3957 blkcg_deactivate_policy(q, &blkcg_policy_cfq);
3958 kfree(cfqd); 3959 kfree(cfqd);
3959} 3960}
3960 3961
@@ -4194,14 +4195,15 @@ static int __init cfq_init(void)
4194#ifdef CONFIG_CFQ_GROUP_IOSCHED 4195#ifdef CONFIG_CFQ_GROUP_IOSCHED
4195 if (!cfq_group_idle) 4196 if (!cfq_group_idle)
4196 cfq_group_idle = 1; 4197 cfq_group_idle = 1;
4197#else
4198 cfq_group_idle = 0;
4199#endif
4200 4198
4201 ret = blkcg_policy_register(&blkcg_policy_cfq); 4199 ret = blkcg_policy_register(&blkcg_policy_cfq);
4202 if (ret) 4200 if (ret)
4203 return ret; 4201 return ret;
4202#else
4203 cfq_group_idle = 0;
4204#endif
4204 4205
4206 ret = -ENOMEM;
4205 cfq_pool = KMEM_CACHE(cfq_queue, 0); 4207 cfq_pool = KMEM_CACHE(cfq_queue, 0);
4206 if (!cfq_pool) 4208 if (!cfq_pool)
4207 goto err_pol_unreg; 4209 goto err_pol_unreg;
@@ -4215,13 +4217,17 @@ static int __init cfq_init(void)
4215err_free_pool: 4217err_free_pool:
4216 kmem_cache_destroy(cfq_pool); 4218 kmem_cache_destroy(cfq_pool);
4217err_pol_unreg: 4219err_pol_unreg:
4220#ifdef CONFIG_CFQ_GROUP_IOSCHED
4218 blkcg_policy_unregister(&blkcg_policy_cfq); 4221 blkcg_policy_unregister(&blkcg_policy_cfq);
4222#endif
4219 return ret; 4223 return ret;
4220} 4224}
4221 4225
4222static void __exit cfq_exit(void) 4226static void __exit cfq_exit(void)
4223{ 4227{
4228#ifdef CONFIG_CFQ_GROUP_IOSCHED
4224 blkcg_policy_unregister(&blkcg_policy_cfq); 4229 blkcg_policy_unregister(&blkcg_policy_cfq);
4230#endif
4225 elv_unregister(&iosched_cfq); 4231 elv_unregister(&iosched_cfq);
4226 kmem_cache_destroy(cfq_pool); 4232 kmem_cache_destroy(cfq_pool);
4227} 4233}
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 260fa80ef575..9a87daa6f4fb 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -721,11 +721,14 @@ int scsi_verify_blk_ioctl(struct block_device *bd, unsigned int cmd)
721 break; 721 break;
722 } 722 }
723 723
724 if (capable(CAP_SYS_RAWIO))
725 return 0;
726
724 /* In particular, rule out all resets and host-specific ioctls. */ 727 /* In particular, rule out all resets and host-specific ioctls. */
725 printk_ratelimited(KERN_WARNING 728 printk_ratelimited(KERN_WARNING
726 "%s: sending ioctl %x to a partition!\n", current->comm, cmd); 729 "%s: sending ioctl %x to a partition!\n", current->comm, cmd);
727 730
728 return capable(CAP_SYS_RAWIO) ? 0 : -ENOIOCTLCMD; 731 return -ENOIOCTLCMD;
729} 732}
730EXPORT_SYMBOL(scsi_verify_blk_ioctl); 733EXPORT_SYMBOL(scsi_verify_blk_ioctl);
731 734
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index a43fa1a57d57..1502c50273b5 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -36,6 +36,7 @@
36#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" 36#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
37#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 37#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
38static DEFINE_MUTEX(isolated_cpus_lock); 38static DEFINE_MUTEX(isolated_cpus_lock);
39static DEFINE_MUTEX(round_robin_lock);
39 40
40static unsigned long power_saving_mwait_eax; 41static unsigned long power_saving_mwait_eax;
41 42
@@ -107,7 +108,7 @@ static void round_robin_cpu(unsigned int tsk_index)
107 if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) 108 if (!alloc_cpumask_var(&tmp, GFP_KERNEL))
108 return; 109 return;
109 110
110 mutex_lock(&isolated_cpus_lock); 111 mutex_lock(&round_robin_lock);
111 cpumask_clear(tmp); 112 cpumask_clear(tmp);
112 for_each_cpu(cpu, pad_busy_cpus) 113 for_each_cpu(cpu, pad_busy_cpus)
113 cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); 114 cpumask_or(tmp, tmp, topology_thread_cpumask(cpu));
@@ -116,7 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index)
116 if (cpumask_empty(tmp)) 117 if (cpumask_empty(tmp))
117 cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); 118 cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus);
118 if (cpumask_empty(tmp)) { 119 if (cpumask_empty(tmp)) {
119 mutex_unlock(&isolated_cpus_lock); 120 mutex_unlock(&round_robin_lock);
120 return; 121 return;
121 } 122 }
122 for_each_cpu(cpu, tmp) { 123 for_each_cpu(cpu, tmp) {
@@ -131,7 +132,7 @@ static void round_robin_cpu(unsigned int tsk_index)
131 tsk_in_cpu[tsk_index] = preferred_cpu; 132 tsk_in_cpu[tsk_index] = preferred_cpu;
132 cpumask_set_cpu(preferred_cpu, pad_busy_cpus); 133 cpumask_set_cpu(preferred_cpu, pad_busy_cpus);
133 cpu_weight[preferred_cpu]++; 134 cpu_weight[preferred_cpu]++;
134 mutex_unlock(&isolated_cpus_lock); 135 mutex_unlock(&round_robin_lock);
135 136
136 set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); 137 set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu));
137} 138}
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 5577762daee1..6686b1eaf13e 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx,
243 u8 ins = entry->instruction; 243 u8 ins = entry->instruction;
244 244
245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) 245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
246 return acpi_os_map_generic_address(&entry->register_region); 246 return apei_map_generic_address(&entry->register_region);
247 247
248 return 0; 248 return 0;
249} 249}
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx,
276 u8 ins = entry->instruction; 276 u8 ins = entry->instruction;
277 277
278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) 278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
279 acpi_os_unmap_generic_address(&entry->register_region); 279 apei_unmap_generic_address(&entry->register_region);
280 280
281 return 0; 281 return 0;
282} 282}
@@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
606 return 0; 606 return 0;
607} 607}
608 608
609int apei_map_generic_address(struct acpi_generic_address *reg)
610{
611 int rc;
612 u32 access_bit_width;
613 u64 address;
614
615 rc = apei_check_gar(reg, &address, &access_bit_width);
616 if (rc)
617 return rc;
618 return acpi_os_map_generic_address(reg);
619}
620EXPORT_SYMBOL_GPL(apei_map_generic_address);
621
609/* read GAR in interrupt (including NMI) or process context */ 622/* read GAR in interrupt (including NMI) or process context */
610int apei_read(u64 *val, struct acpi_generic_address *reg) 623int apei_read(u64 *val, struct acpi_generic_address *reg)
611{ 624{
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index cca240a33038..f220d642136e 100644
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -7,6 +7,8 @@
7#define APEI_INTERNAL_H 7#define APEI_INTERNAL_H
8 8
9#include <linux/cper.h> 9#include <linux/cper.h>
10#include <linux/acpi.h>
11#include <linux/acpi_io.h>
10 12
11struct apei_exec_context; 13struct apei_exec_context;
12 14
@@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio
68/* IP has been set in instruction function */ 70/* IP has been set in instruction function */
69#define APEI_EXEC_SET_IP 1 71#define APEI_EXEC_SET_IP 1
70 72
73int apei_map_generic_address(struct acpi_generic_address *reg);
74
75static inline void apei_unmap_generic_address(struct acpi_generic_address *reg)
76{
77 acpi_os_unmap_generic_address(reg);
78}
79
71int apei_read(u64 *val, struct acpi_generic_address *reg); 80int apei_read(u64 *val, struct acpi_generic_address *reg);
72int apei_write(u64 val, struct acpi_generic_address *reg); 81int apei_write(u64 val, struct acpi_generic_address *reg);
73 82
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 9b3cac0abecc..1599566ed1fe 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
301 if (!ghes) 301 if (!ghes)
302 return ERR_PTR(-ENOMEM); 302 return ERR_PTR(-ENOMEM);
303 ghes->generic = generic; 303 ghes->generic = generic;
304 rc = acpi_os_map_generic_address(&generic->error_status_address); 304 rc = apei_map_generic_address(&generic->error_status_address);
305 if (rc) 305 if (rc)
306 goto err_free; 306 goto err_free;
307 error_block_length = generic->error_block_length; 307 error_block_length = generic->error_block_length;
@@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
321 return ghes; 321 return ghes;
322 322
323err_unmap: 323err_unmap:
324 acpi_os_unmap_generic_address(&generic->error_status_address); 324 apei_unmap_generic_address(&generic->error_status_address);
325err_free: 325err_free:
326 kfree(ghes); 326 kfree(ghes);
327 return ERR_PTR(rc); 327 return ERR_PTR(rc);
@@ -330,7 +330,7 @@ err_free:
330static void ghes_fini(struct ghes *ghes) 330static void ghes_fini(struct ghes *ghes)
331{ 331{
332 kfree(ghes->estatus); 332 kfree(ghes->estatus);
333 acpi_os_unmap_generic_address(&ghes->generic->error_status_address); 333 apei_unmap_generic_address(&ghes->generic->error_status_address);
334} 334}
335 335
336enum { 336enum {
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f3decb30223f..47a8caa89dbe 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
224/* 224/*
225 * Suspend / resume control 225 * Suspend / resume control
226 */ 226 */
227static int acpi_idle_suspend;
227static u32 saved_bm_rld; 228static u32 saved_bm_rld;
228 229
229static void acpi_idle_bm_rld_save(void) 230static void acpi_idle_bm_rld_save(void)
@@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void)
242 243
243int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) 244int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
244{ 245{
246 if (acpi_idle_suspend == 1)
247 return 0;
248
245 acpi_idle_bm_rld_save(); 249 acpi_idle_bm_rld_save();
250 acpi_idle_suspend = 1;
246 return 0; 251 return 0;
247} 252}
248 253
249int acpi_processor_resume(struct acpi_device * device) 254int acpi_processor_resume(struct acpi_device * device)
250{ 255{
256 if (acpi_idle_suspend == 0)
257 return 0;
258
251 acpi_idle_bm_rld_restore(); 259 acpi_idle_bm_rld_restore();
260 acpi_idle_suspend = 0;
252 return 0; 261 return 0;
253} 262}
254 263
@@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
754 763
755 local_irq_disable(); 764 local_irq_disable();
756 765
766 if (acpi_idle_suspend) {
767 local_irq_enable();
768 cpu_relax();
769 return -EBUSY;
770 }
771
757 lapic_timer_state_broadcast(pr, cx, 1); 772 lapic_timer_state_broadcast(pr, cx, 1);
758 kt1 = ktime_get_real(); 773 kt1 = ktime_get_real();
759 acpi_idle_do_entry(cx); 774 acpi_idle_do_entry(cx);
@@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
823 838
824 local_irq_disable(); 839 local_irq_disable();
825 840
841 if (acpi_idle_suspend) {
842 local_irq_enable();
843 cpu_relax();
844 return -EBUSY;
845 }
846
826 if (cx->entry_method != ACPI_CSTATE_FFH) { 847 if (cx->entry_method != ACPI_CSTATE_FFH) {
827 current_thread_info()->status &= ~TS_POLLING; 848 current_thread_info()->status &= ~TS_POLLING;
828 /* 849 /*
@@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
907 drv, drv->safe_state_index); 928 drv, drv->safe_state_index);
908 } else { 929 } else {
909 local_irq_disable(); 930 local_irq_disable();
910 acpi_safe_halt(); 931 if (!acpi_idle_suspend)
932 acpi_safe_halt();
911 local_irq_enable(); 933 local_irq_enable();
912 return -EINVAL; 934 return -EBUSY;
913 } 935 }
914 } 936 }
915 937
916 local_irq_disable(); 938 local_irq_disable();
917 939
940 if (acpi_idle_suspend) {
941 local_irq_enable();
942 cpu_relax();
943 return -EBUSY;
944 }
945
918 if (cx->entry_method != ACPI_CSTATE_FFH) { 946 if (cx->entry_method != ACPI_CSTATE_FFH) {
919 current_thread_info()->status &= ~TS_POLLING; 947 current_thread_info()->status &= ~TS_POLLING;
920 /* 948 /*
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 9f66181c814e..240a24400976 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -173,7 +173,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp)
173{ 173{
174 int result = 0; 174 int result = 0;
175 175
176 if (!strncmp(val, "enable", strlen("enable") - 1)) { 176 if (!strncmp(val, "enable", strlen("enable"))) {
177 result = acpi_debug_trace(trace_method_name, trace_debug_level, 177 result = acpi_debug_trace(trace_method_name, trace_debug_level,
178 trace_debug_layer, 0); 178 trace_debug_layer, 0);
179 if (result) 179 if (result)
@@ -181,7 +181,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp)
181 goto exit; 181 goto exit;
182 } 182 }
183 183
184 if (!strncmp(val, "disable", strlen("disable") - 1)) { 184 if (!strncmp(val, "disable", strlen("disable"))) {
185 int name = 0; 185 int name = 0;
186 result = acpi_debug_trace((char *)&name, trace_debug_level, 186 result = acpi_debug_trace((char *)&name, trace_debug_level,
187 trace_debug_layer, 0); 187 trace_debug_layer, 0);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index a576575617d7..1e0a9e17c31d 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -558,6 +558,8 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
558 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 558 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
559 struct acpi_object_list args = { 1, &arg0 }; 559 struct acpi_object_list args = { 1, &arg0 };
560 560
561 if (!video->cap._DOS)
562 return 0;
561 563
562 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) 564 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1)
563 return -EINVAL; 565 return -EINVAL;
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 3239517f4d90..ac6a5beb28f3 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -4,7 +4,7 @@
4 * Arasan Compact Flash host controller source file 4 * Arasan Compact Flash host controller source file
5 * 5 *
6 * Copyright (C) 2011 ST Microelectronics 6 * Copyright (C) 2011 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -959,7 +959,7 @@ static struct platform_driver arasan_cf_driver = {
959 959
960module_platform_driver(arasan_cf_driver); 960module_platform_driver(arasan_cf_driver);
961 961
962MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 962MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
963MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); 963MODULE_DESCRIPTION("Arasan ATA Compact Flash driver");
964MODULE_LICENSE("GPL"); 964MODULE_LICENSE("GPL");
965MODULE_ALIAS("platform:" DRIVER_NAME); 965MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 1b1cbb571d38..dcb8a6e48692 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -100,7 +100,7 @@ static void driver_deferred_probe_add(struct device *dev)
100 mutex_lock(&deferred_probe_mutex); 100 mutex_lock(&deferred_probe_mutex);
101 if (list_empty(&dev->p->deferred_probe)) { 101 if (list_empty(&dev->p->deferred_probe)) {
102 dev_dbg(dev, "Added to deferred list\n"); 102 dev_dbg(dev, "Added to deferred list\n");
103 list_add(&dev->p->deferred_probe, &deferred_probe_pending_list); 103 list_add_tail(&dev->p->deferred_probe, &deferred_probe_pending_list);
104 } 104 }
105 mutex_unlock(&deferred_probe_mutex); 105 mutex_unlock(&deferred_probe_mutex);
106} 106}
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e0fb5b0435a3..9cb845e49334 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1031 dpm_wait_for_children(dev, async); 1031 dpm_wait_for_children(dev, async);
1032 1032
1033 if (async_error) 1033 if (async_error)
1034 return 0; 1034 goto Complete;
1035 1035
1036 pm_runtime_get_noresume(dev); 1036 pm_runtime_get_noresume(dev);
1037 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) 1037 if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
@@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1040 if (pm_wakeup_pending()) { 1040 if (pm_wakeup_pending()) {
1041 pm_runtime_put_sync(dev); 1041 pm_runtime_put_sync(dev);
1042 async_error = -EBUSY; 1042 async_error = -EBUSY;
1043 return 0; 1043 goto Complete;
1044 } 1044 }
1045 1045
1046 device_lock(dev); 1046 device_lock(dev);
@@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1097 } 1097 }
1098 1098
1099 device_unlock(dev); 1099 device_unlock(dev);
1100
1101 Complete:
1100 complete_all(&dev->power.completion); 1102 complete_all(&dev->power.completion);
1101 1103
1102 if (error) { 1104 if (error) {
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index b5c5ff53cb57..fcb956bb4b4c 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -1475,10 +1475,17 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi
1475 first_word = 0; 1475 first_word = 0;
1476 spin_lock_irq(&b->bm_lock); 1476 spin_lock_irq(&b->bm_lock);
1477 } 1477 }
1478
1479 /* last page (respectively only page, for first page == last page) */ 1478 /* last page (respectively only page, for first page == last page) */
1480 last_word = MLPP(el >> LN2_BPL); 1479 last_word = MLPP(el >> LN2_BPL);
1481 bm_set_full_words_within_one_page(mdev->bitmap, last_page, first_word, last_word); 1480
1481 /* consider bitmap->bm_bits = 32768, bitmap->bm_number_of_pages = 1. (or multiples).
1482 * ==> e = 32767, el = 32768, last_page = 2,
1483 * and now last_word = 0.
1484 * We do not want to touch last_page in this case,
1485 * as we did not allocate it, it is not present in bitmap->bm_pages.
1486 */
1487 if (last_word)
1488 bm_set_full_words_within_one_page(mdev->bitmap, last_page, first_word, last_word);
1482 1489
1483 /* possibly trailing bits. 1490 /* possibly trailing bits.
1484 * example: (e & 63) == 63, el will be e+1. 1491 * example: (e & 63) == 63, el will be e+1.
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 9c5c84946b05..8e93a6ac9bb6 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -472,12 +472,17 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
472 req->rq_state |= RQ_LOCAL_COMPLETED; 472 req->rq_state |= RQ_LOCAL_COMPLETED;
473 req->rq_state &= ~RQ_LOCAL_PENDING; 473 req->rq_state &= ~RQ_LOCAL_PENDING;
474 474
475 D_ASSERT(!(req->rq_state & RQ_NET_MASK)); 475 if (req->rq_state & RQ_LOCAL_ABORTED) {
476 _req_may_be_done(req, m);
477 break;
478 }
476 479
477 __drbd_chk_io_error(mdev, false); 480 __drbd_chk_io_error(mdev, false);
478 481
479 goto_queue_for_net_read: 482 goto_queue_for_net_read:
480 483
484 D_ASSERT(!(req->rq_state & RQ_NET_MASK));
485
481 /* no point in retrying if there is no good remote data, 486 /* no point in retrying if there is no good remote data,
482 * or we have no connection. */ 487 * or we have no connection. */
483 if (mdev->state.pdsk != D_UP_TO_DATE) { 488 if (mdev->state.pdsk != D_UP_TO_DATE) {
@@ -765,6 +770,40 @@ static int drbd_may_do_local_read(struct drbd_conf *mdev, sector_t sector, int s
765 return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr); 770 return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr);
766} 771}
767 772
773static void maybe_pull_ahead(struct drbd_conf *mdev)
774{
775 int congested = 0;
776
777 /* If I don't even have good local storage, we can not reasonably try
778 * to pull ahead of the peer. We also need the local reference to make
779 * sure mdev->act_log is there.
780 * Note: caller has to make sure that net_conf is there.
781 */
782 if (!get_ldev_if_state(mdev, D_UP_TO_DATE))
783 return;
784
785 if (mdev->net_conf->cong_fill &&
786 atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) {
787 dev_info(DEV, "Congestion-fill threshold reached\n");
788 congested = 1;
789 }
790
791 if (mdev->act_log->used >= mdev->net_conf->cong_extents) {
792 dev_info(DEV, "Congestion-extents threshold reached\n");
793 congested = 1;
794 }
795
796 if (congested) {
797 queue_barrier(mdev); /* last barrier, after mirrored writes */
798
799 if (mdev->net_conf->on_congestion == OC_PULL_AHEAD)
800 _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL);
801 else /*mdev->net_conf->on_congestion == OC_DISCONNECT */
802 _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL);
803 }
804 put_ldev(mdev);
805}
806
768static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time) 807static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time)
769{ 808{
770 const int rw = bio_rw(bio); 809 const int rw = bio_rw(bio);
@@ -972,29 +1011,8 @@ allocate_barrier:
972 _req_mod(req, queue_for_send_oos); 1011 _req_mod(req, queue_for_send_oos);
973 1012
974 if (remote && 1013 if (remote &&
975 mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) { 1014 mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96)
976 int congested = 0; 1015 maybe_pull_ahead(mdev);
977
978 if (mdev->net_conf->cong_fill &&
979 atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) {
980 dev_info(DEV, "Congestion-fill threshold reached\n");
981 congested = 1;
982 }
983
984 if (mdev->act_log->used >= mdev->net_conf->cong_extents) {
985 dev_info(DEV, "Congestion-extents threshold reached\n");
986 congested = 1;
987 }
988
989 if (congested) {
990 queue_barrier(mdev); /* last barrier, after mirrored writes */
991
992 if (mdev->net_conf->on_congestion == OC_PULL_AHEAD)
993 _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL);
994 else /*mdev->net_conf->on_congestion == OC_DISCONNECT */
995 _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL);
996 }
997 }
998 1016
999 spin_unlock_irq(&mdev->req_lock); 1017 spin_unlock_irq(&mdev->req_lock);
1000 kfree(b); /* if someone else has beaten us to it... */ 1018 kfree(b); /* if someone else has beaten us to it... */
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index cce7df367b79..553f43a90953 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -671,6 +671,7 @@ static void __reschedule_timeout(int drive, const char *message)
671 671
672 if (drive == current_reqD) 672 if (drive == current_reqD)
673 drive = current_drive; 673 drive = current_drive;
674 __cancel_delayed_work(&fd_timeout);
674 675
675 if (drive < 0 || drive >= N_DRIVE) { 676 if (drive < 0 || drive >= N_DRIVE) {
676 delay = 20UL * HZ; 677 delay = 20UL * HZ;
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 264bc77dcb91..a8fddeb3d638 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -37,6 +37,7 @@
37#include <linux/kthread.h> 37#include <linux/kthread.h>
38#include <../drivers/ata/ahci.h> 38#include <../drivers/ata/ahci.h>
39#include <linux/export.h> 39#include <linux/export.h>
40#include <linux/debugfs.h>
40#include "mtip32xx.h" 41#include "mtip32xx.h"
41 42
42#define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) 43#define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32)
@@ -85,6 +86,7 @@ static int instance;
85 * allocated in mtip_init(). 86 * allocated in mtip_init().
86 */ 87 */
87static int mtip_major; 88static int mtip_major;
89static struct dentry *dfs_parent;
88 90
89static DEFINE_SPINLOCK(rssd_index_lock); 91static DEFINE_SPINLOCK(rssd_index_lock);
90static DEFINE_IDA(rssd_index_ida); 92static DEFINE_IDA(rssd_index_ida);
@@ -2546,7 +2548,7 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd,
2546} 2548}
2547 2549
2548/* 2550/*
2549 * Sysfs register/status dump. 2551 * Sysfs status dump.
2550 * 2552 *
2551 * @dev Pointer to the device structure, passed by the kernrel. 2553 * @dev Pointer to the device structure, passed by the kernrel.
2552 * @attr Pointer to the device_attribute structure passed by the kernel. 2554 * @attr Pointer to the device_attribute structure passed by the kernel.
@@ -2555,45 +2557,68 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd,
2555 * return value 2557 * return value
2556 * The size, in bytes, of the data copied into buf. 2558 * The size, in bytes, of the data copied into buf.
2557 */ 2559 */
2558static ssize_t mtip_hw_show_registers(struct device *dev, 2560static ssize_t mtip_hw_show_status(struct device *dev,
2559 struct device_attribute *attr, 2561 struct device_attribute *attr,
2560 char *buf) 2562 char *buf)
2561{ 2563{
2562 u32 group_allocated;
2563 struct driver_data *dd = dev_to_disk(dev)->private_data; 2564 struct driver_data *dd = dev_to_disk(dev)->private_data;
2564 int size = 0; 2565 int size = 0;
2566
2567 if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))
2568 size += sprintf(buf, "%s", "thermal_shutdown\n");
2569 else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag))
2570 size += sprintf(buf, "%s", "write_protect\n");
2571 else
2572 size += sprintf(buf, "%s", "online\n");
2573
2574 return size;
2575}
2576
2577static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL);
2578
2579static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf,
2580 size_t len, loff_t *offset)
2581{
2582 struct driver_data *dd = (struct driver_data *)f->private_data;
2583 char buf[MTIP_DFS_MAX_BUF_SIZE];
2584 u32 group_allocated;
2585 int size = *offset;
2565 int n; 2586 int n;
2566 2587
2567 size += sprintf(&buf[size], "Hardware\n--------\n"); 2588 if (!len || size)
2568 size += sprintf(&buf[size], "S ACTive : [ 0x"); 2589 return 0;
2590
2591 if (size < 0)
2592 return -EINVAL;
2593
2594 size += sprintf(&buf[size], "H/ S ACTive : [ 0x");
2569 2595
2570 for (n = dd->slot_groups-1; n >= 0; n--) 2596 for (n = dd->slot_groups-1; n >= 0; n--)
2571 size += sprintf(&buf[size], "%08X ", 2597 size += sprintf(&buf[size], "%08X ",
2572 readl(dd->port->s_active[n])); 2598 readl(dd->port->s_active[n]));
2573 2599
2574 size += sprintf(&buf[size], "]\n"); 2600 size += sprintf(&buf[size], "]\n");
2575 size += sprintf(&buf[size], "Command Issue : [ 0x"); 2601 size += sprintf(&buf[size], "H/ Command Issue : [ 0x");
2576 2602
2577 for (n = dd->slot_groups-1; n >= 0; n--) 2603 for (n = dd->slot_groups-1; n >= 0; n--)
2578 size += sprintf(&buf[size], "%08X ", 2604 size += sprintf(&buf[size], "%08X ",
2579 readl(dd->port->cmd_issue[n])); 2605 readl(dd->port->cmd_issue[n]));
2580 2606
2581 size += sprintf(&buf[size], "]\n"); 2607 size += sprintf(&buf[size], "]\n");
2582 size += sprintf(&buf[size], "Completed : [ 0x"); 2608 size += sprintf(&buf[size], "H/ Completed : [ 0x");
2583 2609
2584 for (n = dd->slot_groups-1; n >= 0; n--) 2610 for (n = dd->slot_groups-1; n >= 0; n--)
2585 size += sprintf(&buf[size], "%08X ", 2611 size += sprintf(&buf[size], "%08X ",
2586 readl(dd->port->completed[n])); 2612 readl(dd->port->completed[n]));
2587 2613
2588 size += sprintf(&buf[size], "]\n"); 2614 size += sprintf(&buf[size], "]\n");
2589 size += sprintf(&buf[size], "PORT IRQ STAT : [ 0x%08X ]\n", 2615 size += sprintf(&buf[size], "H/ PORT IRQ STAT : [ 0x%08X ]\n",
2590 readl(dd->port->mmio + PORT_IRQ_STAT)); 2616 readl(dd->port->mmio + PORT_IRQ_STAT));
2591 size += sprintf(&buf[size], "HOST IRQ STAT : [ 0x%08X ]\n", 2617 size += sprintf(&buf[size], "H/ HOST IRQ STAT : [ 0x%08X ]\n",
2592 readl(dd->mmio + HOST_IRQ_STAT)); 2618 readl(dd->mmio + HOST_IRQ_STAT));
2593 size += sprintf(&buf[size], "\n"); 2619 size += sprintf(&buf[size], "\n");
2594 2620
2595 size += sprintf(&buf[size], "Local\n-----\n"); 2621 size += sprintf(&buf[size], "L/ Allocated : [ 0x");
2596 size += sprintf(&buf[size], "Allocated : [ 0x");
2597 2622
2598 for (n = dd->slot_groups-1; n >= 0; n--) { 2623 for (n = dd->slot_groups-1; n >= 0; n--) {
2599 if (sizeof(long) > sizeof(u32)) 2624 if (sizeof(long) > sizeof(u32))
@@ -2605,7 +2630,7 @@ static ssize_t mtip_hw_show_registers(struct device *dev,
2605 } 2630 }
2606 size += sprintf(&buf[size], "]\n"); 2631 size += sprintf(&buf[size], "]\n");
2607 2632
2608 size += sprintf(&buf[size], "Commands in Q: [ 0x"); 2633 size += sprintf(&buf[size], "L/ Commands in Q : [ 0x");
2609 2634
2610 for (n = dd->slot_groups-1; n >= 0; n--) { 2635 for (n = dd->slot_groups-1; n >= 0; n--) {
2611 if (sizeof(long) > sizeof(u32)) 2636 if (sizeof(long) > sizeof(u32))
@@ -2617,44 +2642,53 @@ static ssize_t mtip_hw_show_registers(struct device *dev,
2617 } 2642 }
2618 size += sprintf(&buf[size], "]\n"); 2643 size += sprintf(&buf[size], "]\n");
2619 2644
2620 return size; 2645 *offset = size <= len ? size : len;
2646 size = copy_to_user(ubuf, buf, *offset);
2647 if (size)
2648 return -EFAULT;
2649
2650 return *offset;
2621} 2651}
2622 2652
2623static ssize_t mtip_hw_show_status(struct device *dev, 2653static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf,
2624 struct device_attribute *attr, 2654 size_t len, loff_t *offset)
2625 char *buf)
2626{ 2655{
2627 struct driver_data *dd = dev_to_disk(dev)->private_data; 2656 struct driver_data *dd = (struct driver_data *)f->private_data;
2628 int size = 0; 2657 char buf[MTIP_DFS_MAX_BUF_SIZE];
2658 int size = *offset;
2629 2659
2630 if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) 2660 if (!len || size)
2631 size += sprintf(buf, "%s", "thermal_shutdown\n"); 2661 return 0;
2632 else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag))
2633 size += sprintf(buf, "%s", "write_protect\n");
2634 else
2635 size += sprintf(buf, "%s", "online\n");
2636
2637 return size;
2638}
2639 2662
2640static ssize_t mtip_hw_show_flags(struct device *dev, 2663 if (size < 0)
2641 struct device_attribute *attr, 2664 return -EINVAL;
2642 char *buf)
2643{
2644 struct driver_data *dd = dev_to_disk(dev)->private_data;
2645 int size = 0;
2646 2665
2647 size += sprintf(&buf[size], "Flag in port struct : [ %08lX ]\n", 2666 size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n",
2648 dd->port->flags); 2667 dd->port->flags);
2649 size += sprintf(&buf[size], "Flag in dd struct : [ %08lX ]\n", 2668 size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n",
2650 dd->dd_flag); 2669 dd->dd_flag);
2651 2670
2652 return size; 2671 *offset = size <= len ? size : len;
2672 size = copy_to_user(ubuf, buf, *offset);
2673 if (size)
2674 return -EFAULT;
2675
2676 return *offset;
2653} 2677}
2654 2678
2655static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); 2679static const struct file_operations mtip_regs_fops = {
2656static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); 2680 .owner = THIS_MODULE,
2657static DEVICE_ATTR(flags, S_IRUGO, mtip_hw_show_flags, NULL); 2681 .open = simple_open,
2682 .read = mtip_hw_read_registers,
2683 .llseek = no_llseek,
2684};
2685
2686static const struct file_operations mtip_flags_fops = {
2687 .owner = THIS_MODULE,
2688 .open = simple_open,
2689 .read = mtip_hw_read_flags,
2690 .llseek = no_llseek,
2691};
2658 2692
2659/* 2693/*
2660 * Create the sysfs related attributes. 2694 * Create the sysfs related attributes.
@@ -2671,15 +2705,9 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj)
2671 if (!kobj || !dd) 2705 if (!kobj || !dd)
2672 return -EINVAL; 2706 return -EINVAL;
2673 2707
2674 if (sysfs_create_file(kobj, &dev_attr_registers.attr))
2675 dev_warn(&dd->pdev->dev,
2676 "Error creating 'registers' sysfs entry\n");
2677 if (sysfs_create_file(kobj, &dev_attr_status.attr)) 2708 if (sysfs_create_file(kobj, &dev_attr_status.attr))
2678 dev_warn(&dd->pdev->dev, 2709 dev_warn(&dd->pdev->dev,
2679 "Error creating 'status' sysfs entry\n"); 2710 "Error creating 'status' sysfs entry\n");
2680 if (sysfs_create_file(kobj, &dev_attr_flags.attr))
2681 dev_warn(&dd->pdev->dev,
2682 "Error creating 'flags' sysfs entry\n");
2683 return 0; 2711 return 0;
2684} 2712}
2685 2713
@@ -2698,13 +2726,39 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj)
2698 if (!kobj || !dd) 2726 if (!kobj || !dd)
2699 return -EINVAL; 2727 return -EINVAL;
2700 2728
2701 sysfs_remove_file(kobj, &dev_attr_registers.attr);
2702 sysfs_remove_file(kobj, &dev_attr_status.attr); 2729 sysfs_remove_file(kobj, &dev_attr_status.attr);
2703 sysfs_remove_file(kobj, &dev_attr_flags.attr);
2704 2730
2705 return 0; 2731 return 0;
2706} 2732}
2707 2733
2734static int mtip_hw_debugfs_init(struct driver_data *dd)
2735{
2736 if (!dfs_parent)
2737 return -1;
2738
2739 dd->dfs_node = debugfs_create_dir(dd->disk->disk_name, dfs_parent);
2740 if (IS_ERR_OR_NULL(dd->dfs_node)) {
2741 dev_warn(&dd->pdev->dev,
2742 "Error creating node %s under debugfs\n",
2743 dd->disk->disk_name);
2744 dd->dfs_node = NULL;
2745 return -1;
2746 }
2747
2748 debugfs_create_file("flags", S_IRUGO, dd->dfs_node, dd,
2749 &mtip_flags_fops);
2750 debugfs_create_file("registers", S_IRUGO, dd->dfs_node, dd,
2751 &mtip_regs_fops);
2752
2753 return 0;
2754}
2755
2756static void mtip_hw_debugfs_exit(struct driver_data *dd)
2757{
2758 debugfs_remove_recursive(dd->dfs_node);
2759}
2760
2761
2708/* 2762/*
2709 * Perform any init/resume time hardware setup 2763 * Perform any init/resume time hardware setup
2710 * 2764 *
@@ -3730,6 +3784,7 @@ skip_create_disk:
3730 mtip_hw_sysfs_init(dd, kobj); 3784 mtip_hw_sysfs_init(dd, kobj);
3731 kobject_put(kobj); 3785 kobject_put(kobj);
3732 } 3786 }
3787 mtip_hw_debugfs_init(dd);
3733 3788
3734 if (dd->mtip_svc_handler) { 3789 if (dd->mtip_svc_handler) {
3735 set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); 3790 set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag);
@@ -3755,6 +3810,8 @@ start_service_thread:
3755 return rv; 3810 return rv;
3756 3811
3757kthread_run_error: 3812kthread_run_error:
3813 mtip_hw_debugfs_exit(dd);
3814
3758 /* Delete our gendisk. This also removes the device from /dev */ 3815 /* Delete our gendisk. This also removes the device from /dev */
3759 del_gendisk(dd->disk); 3816 del_gendisk(dd->disk);
3760 3817
@@ -3805,6 +3862,7 @@ static int mtip_block_remove(struct driver_data *dd)
3805 kobject_put(kobj); 3862 kobject_put(kobj);
3806 } 3863 }
3807 } 3864 }
3865 mtip_hw_debugfs_exit(dd);
3808 3866
3809 /* 3867 /*
3810 * Delete our gendisk structure. This also removes the device 3868 * Delete our gendisk structure. This also removes the device
@@ -4152,10 +4210,20 @@ static int __init mtip_init(void)
4152 } 4210 }
4153 mtip_major = error; 4211 mtip_major = error;
4154 4212
4213 if (!dfs_parent) {
4214 dfs_parent = debugfs_create_dir("rssd", NULL);
4215 if (IS_ERR_OR_NULL(dfs_parent)) {
4216 printk(KERN_WARNING "Error creating debugfs parent\n");
4217 dfs_parent = NULL;
4218 }
4219 }
4220
4155 /* Register our PCI operations. */ 4221 /* Register our PCI operations. */
4156 error = pci_register_driver(&mtip_pci_driver); 4222 error = pci_register_driver(&mtip_pci_driver);
4157 if (error) 4223 if (error) {
4224 debugfs_remove(dfs_parent);
4158 unregister_blkdev(mtip_major, MTIP_DRV_NAME); 4225 unregister_blkdev(mtip_major, MTIP_DRV_NAME);
4226 }
4159 4227
4160 return error; 4228 return error;
4161} 4229}
@@ -4172,6 +4240,8 @@ static int __init mtip_init(void)
4172 */ 4240 */
4173static void __exit mtip_exit(void) 4241static void __exit mtip_exit(void)
4174{ 4242{
4243 debugfs_remove_recursive(dfs_parent);
4244
4175 /* Release the allocated major block device number. */ 4245 /* Release the allocated major block device number. */
4176 unregister_blkdev(mtip_major, MTIP_DRV_NAME); 4246 unregister_blkdev(mtip_major, MTIP_DRV_NAME);
4177 4247
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index b2c88da26b2a..f51fc23d17bb 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -26,7 +26,6 @@
26#include <linux/ata.h> 26#include <linux/ata.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/genhd.h> 28#include <linux/genhd.h>
29#include <linux/version.h>
30 29
31/* Offset of Subsystem Device ID in pci confoguration space */ 30/* Offset of Subsystem Device ID in pci confoguration space */
32#define PCI_SUBSYSTEM_DEVICEID 0x2E 31#define PCI_SUBSYSTEM_DEVICEID 0x2E
@@ -111,6 +110,8 @@
111 #define dbg_printk(format, arg...) 110 #define dbg_printk(format, arg...)
112#endif 111#endif
113 112
113#define MTIP_DFS_MAX_BUF_SIZE 1024
114
114#define __force_bit2int (unsigned int __force) 115#define __force_bit2int (unsigned int __force)
115 116
116enum { 117enum {
@@ -447,6 +448,8 @@ struct driver_data {
447 unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ 448 unsigned long dd_flag; /* NOTE: use atomic bit operations on this */
448 449
449 struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ 450 struct task_struct *mtip_svc_handler; /* task_struct of svc thd */
451
452 struct dentry *dfs_node;
450}; 453};
451 454
452#endif 455#endif
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index aa2712060bfb..9a72277a31df 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -513,6 +513,44 @@ static void process_page(unsigned long data)
513 } 513 }
514} 514}
515 515
516struct mm_plug_cb {
517 struct blk_plug_cb cb;
518 struct cardinfo *card;
519};
520
521static void mm_unplug(struct blk_plug_cb *cb)
522{
523 struct mm_plug_cb *mmcb = container_of(cb, struct mm_plug_cb, cb);
524
525 spin_lock_irq(&mmcb->card->lock);
526 activate(mmcb->card);
527 spin_unlock_irq(&mmcb->card->lock);
528 kfree(mmcb);
529}
530
531static int mm_check_plugged(struct cardinfo *card)
532{
533 struct blk_plug *plug = current->plug;
534 struct mm_plug_cb *mmcb;
535
536 if (!plug)
537 return 0;
538
539 list_for_each_entry(mmcb, &plug->cb_list, cb.list) {
540 if (mmcb->cb.callback == mm_unplug && mmcb->card == card)
541 return 1;
542 }
543 /* Not currently on the callback list */
544 mmcb = kmalloc(sizeof(*mmcb), GFP_ATOMIC);
545 if (!mmcb)
546 return 0;
547
548 mmcb->card = card;
549 mmcb->cb.callback = mm_unplug;
550 list_add(&mmcb->cb.list, &plug->cb_list);
551 return 1;
552}
553
516static void mm_make_request(struct request_queue *q, struct bio *bio) 554static void mm_make_request(struct request_queue *q, struct bio *bio)
517{ 555{
518 struct cardinfo *card = q->queuedata; 556 struct cardinfo *card = q->queuedata;
@@ -523,6 +561,8 @@ static void mm_make_request(struct request_queue *q, struct bio *bio)
523 *card->biotail = bio; 561 *card->biotail = bio;
524 bio->bi_next = NULL; 562 bio->bi_next = NULL;
525 card->biotail = &bio->bi_next; 563 card->biotail = &bio->bi_next;
564 if (bio->bi_rw & REQ_SYNC || !mm_check_plugged(card))
565 activate(card);
526 spin_unlock_irq(&card->lock); 566 spin_unlock_irq(&card->lock);
527 567
528 return; 568 return;
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 773cf27dc23f..9ad3b5ec1dc1 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -257,6 +257,7 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst,
257 break; 257 break;
258 case BLKIF_OP_DISCARD: 258 case BLKIF_OP_DISCARD:
259 dst->u.discard.flag = src->u.discard.flag; 259 dst->u.discard.flag = src->u.discard.flag;
260 dst->u.discard.id = src->u.discard.id;
260 dst->u.discard.sector_number = src->u.discard.sector_number; 261 dst->u.discard.sector_number = src->u.discard.sector_number;
261 dst->u.discard.nr_sectors = src->u.discard.nr_sectors; 262 dst->u.discard.nr_sectors = src->u.discard.nr_sectors;
262 break; 263 break;
@@ -287,6 +288,7 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst,
287 break; 288 break;
288 case BLKIF_OP_DISCARD: 289 case BLKIF_OP_DISCARD:
289 dst->u.discard.flag = src->u.discard.flag; 290 dst->u.discard.flag = src->u.discard.flag;
291 dst->u.discard.id = src->u.discard.id;
290 dst->u.discard.sector_number = src->u.discard.sector_number; 292 dst->u.discard.sector_number = src->u.discard.sector_number;
291 dst->u.discard.nr_sectors = src->u.discard.nr_sectors; 293 dst->u.discard.nr_sectors = src->u.discard.nr_sectors;
292 break; 294 break;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 60eed4bdd2e4..e4fb3374dcd2 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -141,14 +141,36 @@ static int get_id_from_freelist(struct blkfront_info *info)
141 return free; 141 return free;
142} 142}
143 143
144static void add_id_to_freelist(struct blkfront_info *info, 144static int add_id_to_freelist(struct blkfront_info *info,
145 unsigned long id) 145 unsigned long id)
146{ 146{
147 if (info->shadow[id].req.u.rw.id != id)
148 return -EINVAL;
149 if (info->shadow[id].request == NULL)
150 return -EINVAL;
147 info->shadow[id].req.u.rw.id = info->shadow_free; 151 info->shadow[id].req.u.rw.id = info->shadow_free;
148 info->shadow[id].request = NULL; 152 info->shadow[id].request = NULL;
149 info->shadow_free = id; 153 info->shadow_free = id;
154 return 0;
150} 155}
151 156
157static const char *op_name(int op)
158{
159 static const char *const names[] = {
160 [BLKIF_OP_READ] = "read",
161 [BLKIF_OP_WRITE] = "write",
162 [BLKIF_OP_WRITE_BARRIER] = "barrier",
163 [BLKIF_OP_FLUSH_DISKCACHE] = "flush",
164 [BLKIF_OP_DISCARD] = "discard" };
165
166 if (op < 0 || op >= ARRAY_SIZE(names))
167 return "unknown";
168
169 if (!names[op])
170 return "reserved";
171
172 return names[op];
173}
152static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) 174static int xlbd_reserve_minors(unsigned int minor, unsigned int nr)
153{ 175{
154 unsigned int end = minor + nr; 176 unsigned int end = minor + nr;
@@ -746,20 +768,36 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
746 768
747 bret = RING_GET_RESPONSE(&info->ring, i); 769 bret = RING_GET_RESPONSE(&info->ring, i);
748 id = bret->id; 770 id = bret->id;
771 /*
772 * The backend has messed up and given us an id that we would
773 * never have given to it (we stamp it up to BLK_RING_SIZE -
774 * look in get_id_from_freelist.
775 */
776 if (id >= BLK_RING_SIZE) {
777 WARN(1, "%s: response to %s has incorrect id (%ld)\n",
778 info->gd->disk_name, op_name(bret->operation), id);
779 /* We can't safely get the 'struct request' as
780 * the id is busted. */
781 continue;
782 }
749 req = info->shadow[id].request; 783 req = info->shadow[id].request;
750 784
751 if (bret->operation != BLKIF_OP_DISCARD) 785 if (bret->operation != BLKIF_OP_DISCARD)
752 blkif_completion(&info->shadow[id]); 786 blkif_completion(&info->shadow[id]);
753 787
754 add_id_to_freelist(info, id); 788 if (add_id_to_freelist(info, id)) {
789 WARN(1, "%s: response to %s (id %ld) couldn't be recycled!\n",
790 info->gd->disk_name, op_name(bret->operation), id);
791 continue;
792 }
755 793
756 error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; 794 error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO;
757 switch (bret->operation) { 795 switch (bret->operation) {
758 case BLKIF_OP_DISCARD: 796 case BLKIF_OP_DISCARD:
759 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { 797 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
760 struct request_queue *rq = info->rq; 798 struct request_queue *rq = info->rq;
761 printk(KERN_WARNING "blkfront: %s: discard op failed\n", 799 printk(KERN_WARNING "blkfront: %s: %s op failed\n",
762 info->gd->disk_name); 800 info->gd->disk_name, op_name(bret->operation));
763 error = -EOPNOTSUPP; 801 error = -EOPNOTSUPP;
764 info->feature_discard = 0; 802 info->feature_discard = 0;
765 info->feature_secdiscard = 0; 803 info->feature_secdiscard = 0;
@@ -771,18 +809,14 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
771 case BLKIF_OP_FLUSH_DISKCACHE: 809 case BLKIF_OP_FLUSH_DISKCACHE:
772 case BLKIF_OP_WRITE_BARRIER: 810 case BLKIF_OP_WRITE_BARRIER:
773 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { 811 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
774 printk(KERN_WARNING "blkfront: %s: write %s op failed\n", 812 printk(KERN_WARNING "blkfront: %s: %s op failed\n",
775 info->flush_op == BLKIF_OP_WRITE_BARRIER ? 813 info->gd->disk_name, op_name(bret->operation));
776 "barrier" : "flush disk cache",
777 info->gd->disk_name);
778 error = -EOPNOTSUPP; 814 error = -EOPNOTSUPP;
779 } 815 }
780 if (unlikely(bret->status == BLKIF_RSP_ERROR && 816 if (unlikely(bret->status == BLKIF_RSP_ERROR &&
781 info->shadow[id].req.u.rw.nr_segments == 0)) { 817 info->shadow[id].req.u.rw.nr_segments == 0)) {
782 printk(KERN_WARNING "blkfront: %s: empty write %s op failed\n", 818 printk(KERN_WARNING "blkfront: %s: empty %s op failed\n",
783 info->flush_op == BLKIF_OP_WRITE_BARRIER ? 819 info->gd->disk_name, op_name(bret->operation));
784 "barrier" : "flush disk cache",
785 info->gd->disk_name);
786 error = -EOPNOTSUPP; 820 error = -EOPNOTSUPP;
787 } 821 }
788 if (unlikely(error)) { 822 if (unlikely(error)) {
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index ad591bd240ec..10308cd8a7ed 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -63,6 +63,7 @@ static struct usb_device_id ath3k_table[] = {
63 63
64 /* Atheros AR3011 with sflash firmware*/ 64 /* Atheros AR3011 with sflash firmware*/
65 { USB_DEVICE(0x0CF3, 0x3002) }, 65 { USB_DEVICE(0x0CF3, 0x3002) },
66 { USB_DEVICE(0x0CF3, 0xE019) },
66 { USB_DEVICE(0x13d3, 0x3304) }, 67 { USB_DEVICE(0x13d3, 0x3304) },
67 { USB_DEVICE(0x0930, 0x0215) }, 68 { USB_DEVICE(0x0930, 0x0215) },
68 { USB_DEVICE(0x0489, 0xE03D) }, 69 { USB_DEVICE(0x0489, 0xE03D) },
@@ -77,6 +78,7 @@ static struct usb_device_id ath3k_table[] = {
77 { USB_DEVICE(0x04CA, 0x3005) }, 78 { USB_DEVICE(0x04CA, 0x3005) },
78 { USB_DEVICE(0x13d3, 0x3362) }, 79 { USB_DEVICE(0x13d3, 0x3362) },
79 { USB_DEVICE(0x0CF3, 0xE004) }, 80 { USB_DEVICE(0x0CF3, 0xE004) },
81 { USB_DEVICE(0x0930, 0x0219) },
80 82
81 /* Atheros AR5BBU12 with sflash firmware */ 83 /* Atheros AR5BBU12 with sflash firmware */
82 { USB_DEVICE(0x0489, 0xE02C) }, 84 { USB_DEVICE(0x0489, 0xE02C) },
@@ -101,6 +103,7 @@ static struct usb_device_id ath3k_blist_tbl[] = {
101 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, 103 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
102 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, 104 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
103 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, 105 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
106 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
104 107
105 /* Atheros AR5BBU22 with sflash firmware */ 108 /* Atheros AR5BBU22 with sflash firmware */
106 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, 109 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
index 94f2d65131c4..27068d149380 100644
--- a/drivers/bluetooth/btmrvl_drv.h
+++ b/drivers/bluetooth/btmrvl_drv.h
@@ -136,7 +136,7 @@ int btmrvl_remove_card(struct btmrvl_private *priv);
136 136
137void btmrvl_interrupt(struct btmrvl_private *priv); 137void btmrvl_interrupt(struct btmrvl_private *priv);
138 138
139void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); 139bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb);
140int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); 140int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb);
141 141
142int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); 142int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd);
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 681ca9d18e12..dc304def8400 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -44,23 +44,33 @@ void btmrvl_interrupt(struct btmrvl_private *priv)
44} 44}
45EXPORT_SYMBOL_GPL(btmrvl_interrupt); 45EXPORT_SYMBOL_GPL(btmrvl_interrupt);
46 46
47void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb) 47bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb)
48{ 48{
49 struct hci_event_hdr *hdr = (void *) skb->data; 49 struct hci_event_hdr *hdr = (void *) skb->data;
50 struct hci_ev_cmd_complete *ec; 50 struct hci_ev_cmd_complete *ec;
51 u16 opcode, ocf; 51 u16 opcode, ocf, ogf;
52 52
53 if (hdr->evt == HCI_EV_CMD_COMPLETE) { 53 if (hdr->evt == HCI_EV_CMD_COMPLETE) {
54 ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE); 54 ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE);
55 opcode = __le16_to_cpu(ec->opcode); 55 opcode = __le16_to_cpu(ec->opcode);
56 ocf = hci_opcode_ocf(opcode); 56 ocf = hci_opcode_ocf(opcode);
57 ogf = hci_opcode_ogf(opcode);
58
57 if (ocf == BT_CMD_MODULE_CFG_REQ && 59 if (ocf == BT_CMD_MODULE_CFG_REQ &&
58 priv->btmrvl_dev.sendcmdflag) { 60 priv->btmrvl_dev.sendcmdflag) {
59 priv->btmrvl_dev.sendcmdflag = false; 61 priv->btmrvl_dev.sendcmdflag = false;
60 priv->adapter->cmd_complete = true; 62 priv->adapter->cmd_complete = true;
61 wake_up_interruptible(&priv->adapter->cmd_wait_q); 63 wake_up_interruptible(&priv->adapter->cmd_wait_q);
62 } 64 }
65
66 if (ogf == OGF) {
67 BT_DBG("vendor event skipped: ogf 0x%4.4x", ogf);
68 kfree_skb(skb);
69 return false;
70 }
63 } 71 }
72
73 return true;
64} 74}
65EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); 75EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt);
66 76
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index a853244e7fd7..0cd61d9f07cd 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -562,10 +562,12 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
562 skb_put(skb, buf_len); 562 skb_put(skb, buf_len);
563 skb_pull(skb, SDIO_HEADER_LEN); 563 skb_pull(skb, SDIO_HEADER_LEN);
564 564
565 if (type == HCI_EVENT_PKT) 565 if (type == HCI_EVENT_PKT) {
566 btmrvl_check_evtpkt(priv, skb); 566 if (btmrvl_check_evtpkt(priv, skb))
567 hci_recv_frame(skb);
568 } else
569 hci_recv_frame(skb);
567 570
568 hci_recv_frame(skb);
569 hdev->stat.byte_rx += buf_len; 571 hdev->stat.byte_rx += buf_len;
570 break; 572 break;
571 573
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index c9463af8e564..83ebb241bfcc 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -125,6 +125,7 @@ static struct usb_device_id blacklist_table[] = {
125 125
126 /* Atheros 3011 with sflash firmware */ 126 /* Atheros 3011 with sflash firmware */
127 { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, 127 { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
128 { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
128 { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, 129 { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
129 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, 130 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
130 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, 131 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
@@ -139,6 +140,7 @@ static struct usb_device_id blacklist_table[] = {
139 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, 140 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
140 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, 141 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
141 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, 142 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
143 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
142 144
143 /* Atheros AR5BBU12 with sflash firmware */ 145 /* Atheros AR5BBU12 with sflash firmware */
144 { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, 146 { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index 6289f0eee24c..731c9046cf7b 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -34,7 +34,7 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max,
34 u32 *data = buf; 34 u32 *data = buf;
35 35
36 /* data ready? */ 36 /* data ready? */
37 if (readl(trng->base + TRNG_ODATA) & 1) { 37 if (readl(trng->base + TRNG_ISR) & 1) {
38 *data = readl(trng->base + TRNG_ODATA); 38 *data = readl(trng->base + TRNG_ODATA);
39 /* 39 /*
40 ensure data ready is only set again AFTER the next data 40 ensure data ready is only set again AFTER the next data
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 687b00d67c8a..9a1eb0cfa95f 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -850,18 +850,21 @@ static void clk_change_rate(struct clk *clk)
850{ 850{
851 struct clk *child; 851 struct clk *child;
852 unsigned long old_rate; 852 unsigned long old_rate;
853 unsigned long best_parent_rate = 0;
853 struct hlist_node *tmp; 854 struct hlist_node *tmp;
854 855
855 old_rate = clk->rate; 856 old_rate = clk->rate;
856 857
858 if (clk->parent)
859 best_parent_rate = clk->parent->rate;
860
857 if (clk->ops->set_rate) 861 if (clk->ops->set_rate)
858 clk->ops->set_rate(clk->hw, clk->new_rate, clk->parent->rate); 862 clk->ops->set_rate(clk->hw, clk->new_rate, best_parent_rate);
859 863
860 if (clk->ops->recalc_rate) 864 if (clk->ops->recalc_rate)
861 clk->rate = clk->ops->recalc_rate(clk->hw, 865 clk->rate = clk->ops->recalc_rate(clk->hw, best_parent_rate);
862 clk->parent->rate);
863 else 866 else
864 clk->rate = clk->parent->rate; 867 clk->rate = best_parent_rate;
865 868
866 if (clk->notifier_count && old_rate != clk->rate) 869 if (clk->notifier_count && old_rate != clk->rate)
867 __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); 870 __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate);
@@ -999,7 +1002,7 @@ static struct clk *__clk_init_parent(struct clk *clk)
999 1002
1000 if (!clk->parents) 1003 if (!clk->parents)
1001 clk->parents = 1004 clk->parents =
1002 kmalloc((sizeof(struct clk*) * clk->num_parents), 1005 kzalloc((sizeof(struct clk*) * clk->num_parents),
1003 GFP_KERNEL); 1006 GFP_KERNEL);
1004 1007
1005 if (!clk->parents) 1008 if (!clk->parents)
@@ -1064,21 +1067,24 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent)
1064 1067
1065 old_parent = clk->parent; 1068 old_parent = clk->parent;
1066 1069
1067 /* find index of new parent clock using cached parent ptrs */ 1070 if (!clk->parents)
1068 for (i = 0; i < clk->num_parents; i++) 1071 clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents),
1069 if (clk->parents[i] == parent) 1072 GFP_KERNEL);
1070 break;
1071 1073
1072 /* 1074 /*
1073 * find index of new parent clock using string name comparison 1075 * find index of new parent clock using cached parent ptrs,
1074 * also try to cache the parent to avoid future calls to __clk_lookup 1076 * or if not yet cached, use string name comparison and cache
1077 * them now to avoid future calls to __clk_lookup.
1075 */ 1078 */
1076 if (i == clk->num_parents) 1079 for (i = 0; i < clk->num_parents; i++) {
1077 for (i = 0; i < clk->num_parents; i++) 1080 if (clk->parents && clk->parents[i] == parent)
1078 if (!strcmp(clk->parent_names[i], parent->name)) { 1081 break;
1082 else if (!strcmp(clk->parent_names[i], parent->name)) {
1083 if (clk->parents)
1079 clk->parents[i] = __clk_lookup(parent->name); 1084 clk->parents[i] = __clk_lookup(parent->name);
1080 break; 1085 break;
1081 } 1086 }
1087 }
1082 1088
1083 if (i == clk->num_parents) { 1089 if (i == clk->num_parents) {
1084 pr_debug("%s: clock %s is not a possible parent of clock %s\n", 1090 pr_debug("%s: clock %s is not a possible parent of clock %s\n",
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index f7be225f544c..db2391c054ee 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -71,7 +71,7 @@ static void __init clk_misc_init(void)
71 __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); 71 __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC);
72} 72}
73 73
74static struct clk_lookup uart_lookups[] __initdata = { 74static struct clk_lookup uart_lookups[] = {
75 { .dev_id = "duart", }, 75 { .dev_id = "duart", },
76 { .dev_id = "mxs-auart.0", }, 76 { .dev_id = "mxs-auart.0", },
77 { .dev_id = "mxs-auart.1", }, 77 { .dev_id = "mxs-auart.1", },
@@ -80,31 +80,31 @@ static struct clk_lookup uart_lookups[] __initdata = {
80 { .dev_id = "80070000.serial", }, 80 { .dev_id = "80070000.serial", },
81}; 81};
82 82
83static struct clk_lookup hbus_lookups[] __initdata = { 83static struct clk_lookup hbus_lookups[] = {
84 { .dev_id = "imx23-dma-apbh", }, 84 { .dev_id = "imx23-dma-apbh", },
85 { .dev_id = "80004000.dma-apbh", }, 85 { .dev_id = "80004000.dma-apbh", },
86}; 86};
87 87
88static struct clk_lookup xbus_lookups[] __initdata = { 88static struct clk_lookup xbus_lookups[] = {
89 { .dev_id = "duart", .con_id = "apb_pclk"}, 89 { .dev_id = "duart", .con_id = "apb_pclk"},
90 { .dev_id = "80070000.serial", .con_id = "apb_pclk"}, 90 { .dev_id = "80070000.serial", .con_id = "apb_pclk"},
91 { .dev_id = "imx23-dma-apbx", }, 91 { .dev_id = "imx23-dma-apbx", },
92 { .dev_id = "80024000.dma-apbx", }, 92 { .dev_id = "80024000.dma-apbx", },
93}; 93};
94 94
95static struct clk_lookup ssp_lookups[] __initdata = { 95static struct clk_lookup ssp_lookups[] = {
96 { .dev_id = "imx23-mmc.0", }, 96 { .dev_id = "imx23-mmc.0", },
97 { .dev_id = "imx23-mmc.1", }, 97 { .dev_id = "imx23-mmc.1", },
98 { .dev_id = "80010000.ssp", }, 98 { .dev_id = "80010000.ssp", },
99 { .dev_id = "80034000.ssp", }, 99 { .dev_id = "80034000.ssp", },
100}; 100};
101 101
102static struct clk_lookup lcdif_lookups[] __initdata = { 102static struct clk_lookup lcdif_lookups[] = {
103 { .dev_id = "imx23-fb", }, 103 { .dev_id = "imx23-fb", },
104 { .dev_id = "80030000.lcdif", }, 104 { .dev_id = "80030000.lcdif", },
105}; 105};
106 106
107static struct clk_lookup gpmi_lookups[] __initdata = { 107static struct clk_lookup gpmi_lookups[] = {
108 { .dev_id = "imx23-gpmi-nand", }, 108 { .dev_id = "imx23-gpmi-nand", },
109 { .dev_id = "8000c000.gpmi", }, 109 { .dev_id = "8000c000.gpmi", },
110}; 110};
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 2826a2606a29..7fad6c8c13d2 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -120,7 +120,7 @@ static void __init clk_misc_init(void)
120 writel_relaxed(val, FRAC0); 120 writel_relaxed(val, FRAC0);
121} 121}
122 122
123static struct clk_lookup uart_lookups[] __initdata = { 123static struct clk_lookup uart_lookups[] = {
124 { .dev_id = "duart", }, 124 { .dev_id = "duart", },
125 { .dev_id = "mxs-auart.0", }, 125 { .dev_id = "mxs-auart.0", },
126 { .dev_id = "mxs-auart.1", }, 126 { .dev_id = "mxs-auart.1", },
@@ -135,71 +135,71 @@ static struct clk_lookup uart_lookups[] __initdata = {
135 { .dev_id = "80074000.serial", }, 135 { .dev_id = "80074000.serial", },
136}; 136};
137 137
138static struct clk_lookup hbus_lookups[] __initdata = { 138static struct clk_lookup hbus_lookups[] = {
139 { .dev_id = "imx28-dma-apbh", }, 139 { .dev_id = "imx28-dma-apbh", },
140 { .dev_id = "80004000.dma-apbh", }, 140 { .dev_id = "80004000.dma-apbh", },
141}; 141};
142 142
143static struct clk_lookup xbus_lookups[] __initdata = { 143static struct clk_lookup xbus_lookups[] = {
144 { .dev_id = "duart", .con_id = "apb_pclk"}, 144 { .dev_id = "duart", .con_id = "apb_pclk"},
145 { .dev_id = "80074000.serial", .con_id = "apb_pclk"}, 145 { .dev_id = "80074000.serial", .con_id = "apb_pclk"},
146 { .dev_id = "imx28-dma-apbx", }, 146 { .dev_id = "imx28-dma-apbx", },
147 { .dev_id = "80024000.dma-apbx", }, 147 { .dev_id = "80024000.dma-apbx", },
148}; 148};
149 149
150static struct clk_lookup ssp0_lookups[] __initdata = { 150static struct clk_lookup ssp0_lookups[] = {
151 { .dev_id = "imx28-mmc.0", }, 151 { .dev_id = "imx28-mmc.0", },
152 { .dev_id = "80010000.ssp", }, 152 { .dev_id = "80010000.ssp", },
153}; 153};
154 154
155static struct clk_lookup ssp1_lookups[] __initdata = { 155static struct clk_lookup ssp1_lookups[] = {
156 { .dev_id = "imx28-mmc.1", }, 156 { .dev_id = "imx28-mmc.1", },
157 { .dev_id = "80012000.ssp", }, 157 { .dev_id = "80012000.ssp", },
158}; 158};
159 159
160static struct clk_lookup ssp2_lookups[] __initdata = { 160static struct clk_lookup ssp2_lookups[] = {
161 { .dev_id = "imx28-mmc.2", }, 161 { .dev_id = "imx28-mmc.2", },
162 { .dev_id = "80014000.ssp", }, 162 { .dev_id = "80014000.ssp", },
163}; 163};
164 164
165static struct clk_lookup ssp3_lookups[] __initdata = { 165static struct clk_lookup ssp3_lookups[] = {
166 { .dev_id = "imx28-mmc.3", }, 166 { .dev_id = "imx28-mmc.3", },
167 { .dev_id = "80016000.ssp", }, 167 { .dev_id = "80016000.ssp", },
168}; 168};
169 169
170static struct clk_lookup lcdif_lookups[] __initdata = { 170static struct clk_lookup lcdif_lookups[] = {
171 { .dev_id = "imx28-fb", }, 171 { .dev_id = "imx28-fb", },
172 { .dev_id = "80030000.lcdif", }, 172 { .dev_id = "80030000.lcdif", },
173}; 173};
174 174
175static struct clk_lookup gpmi_lookups[] __initdata = { 175static struct clk_lookup gpmi_lookups[] = {
176 { .dev_id = "imx28-gpmi-nand", }, 176 { .dev_id = "imx28-gpmi-nand", },
177 { .dev_id = "8000c000.gpmi", }, 177 { .dev_id = "8000c000.gpmi", },
178}; 178};
179 179
180static struct clk_lookup fec_lookups[] __initdata = { 180static struct clk_lookup fec_lookups[] = {
181 { .dev_id = "imx28-fec.0", }, 181 { .dev_id = "imx28-fec.0", },
182 { .dev_id = "imx28-fec.1", }, 182 { .dev_id = "imx28-fec.1", },
183 { .dev_id = "800f0000.ethernet", }, 183 { .dev_id = "800f0000.ethernet", },
184 { .dev_id = "800f4000.ethernet", }, 184 { .dev_id = "800f4000.ethernet", },
185}; 185};
186 186
187static struct clk_lookup can0_lookups[] __initdata = { 187static struct clk_lookup can0_lookups[] = {
188 { .dev_id = "flexcan.0", }, 188 { .dev_id = "flexcan.0", },
189 { .dev_id = "80032000.can", }, 189 { .dev_id = "80032000.can", },
190}; 190};
191 191
192static struct clk_lookup can1_lookups[] __initdata = { 192static struct clk_lookup can1_lookups[] = {
193 { .dev_id = "flexcan.1", }, 193 { .dev_id = "flexcan.1", },
194 { .dev_id = "80034000.can", }, 194 { .dev_id = "80034000.can", },
195}; 195};
196 196
197static struct clk_lookup saif0_lookups[] __initdata = { 197static struct clk_lookup saif0_lookups[] = {
198 { .dev_id = "mxs-saif.0", }, 198 { .dev_id = "mxs-saif.0", },
199 { .dev_id = "80042000.saif", }, 199 { .dev_id = "80042000.saif", },
200}; 200};
201 201
202static struct clk_lookup saif1_lookups[] __initdata = { 202static struct clk_lookup saif1_lookups[] = {
203 { .dev_id = "mxs-saif.1", }, 203 { .dev_id = "mxs-saif.1", },
204 { .dev_id = "80046000.saif", }, 204 { .dev_id = "80046000.saif", },
205}; 205};
@@ -245,8 +245,8 @@ int __init mx28_clocks_init(void)
245 clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000); 245 clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000);
246 clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0); 246 clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0);
247 clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1); 247 clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1);
248 clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 2); 248 clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 2);
249 clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 3); 249 clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 3);
250 clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0); 250 clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0);
251 clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1); 251 clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1);
252 clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2); 252 clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2);
diff --git a/drivers/clk/spear/clk-aux-synth.c b/drivers/clk/spear/clk-aux-synth.c
index af34074e702b..6756e7c3bc07 100644
--- a/drivers/clk/spear/clk-aux-synth.c
+++ b/drivers/clk/spear/clk-aux-synth.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.kumar@st.com> 3 * Viresh Kumar <viresh.linux@gmail.com>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk-frac-synth.c b/drivers/clk/spear/clk-frac-synth.c
index 4dbdb3fe18e0..958aa3ad1d60 100644
--- a/drivers/clk/spear/clk-frac-synth.c
+++ b/drivers/clk/spear/clk-frac-synth.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.kumar@st.com> 3 * Viresh Kumar <viresh.linux@gmail.com>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk-gpt-synth.c b/drivers/clk/spear/clk-gpt-synth.c
index b471c9762a97..1afc18c4effc 100644
--- a/drivers/clk/spear/clk-gpt-synth.c
+++ b/drivers/clk/spear/clk-gpt-synth.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.kumar@st.com> 3 * Viresh Kumar <viresh.linux@gmail.com>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk-vco-pll.c b/drivers/clk/spear/clk-vco-pll.c
index dcd4bdf4b0d9..5f1b6badeb15 100644
--- a/drivers/clk/spear/clk-vco-pll.c
+++ b/drivers/clk/spear/clk-vco-pll.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.kumar@st.com> 3 * Viresh Kumar <viresh.linux@gmail.com>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk.c b/drivers/clk/spear/clk.c
index 376d4e5ff326..7cd63788d546 100644
--- a/drivers/clk/spear/clk.c
+++ b/drivers/clk/spear/clk.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.kumar@st.com> 3 * Viresh Kumar <viresh.linux@gmail.com>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk.h b/drivers/clk/spear/clk.h
index 3321c46a071c..931737677dfa 100644
--- a/drivers/clk/spear/clk.h
+++ b/drivers/clk/spear/clk.h
@@ -2,7 +2,7 @@
2 * Clock framework definitions for SPEAr platform 2 * Clock framework definitions for SPEAr platform
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear1310_clock.c b/drivers/clk/spear/spear1310_clock.c
index 42b68df9aeef..8f05652d53e6 100644
--- a/drivers/clk/spear/spear1310_clock.c
+++ b/drivers/clk/spear/spear1310_clock.c
@@ -4,7 +4,7 @@
4 * SPEAr1310 machine clock framework source file 4 * SPEAr1310 machine clock framework source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c
index f130919d5bf8..e3ea72162236 100644
--- a/drivers/clk/spear/spear1340_clock.c
+++ b/drivers/clk/spear/spear1340_clock.c
@@ -4,7 +4,7 @@
4 * SPEAr1340 machine clock framework source file 4 * SPEAr1340 machine clock framework source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c
index 440bb3e4c971..01dd6daff2a1 100644
--- a/drivers/clk/spear/spear3xx_clock.c
+++ b/drivers/clk/spear/spear3xx_clock.c
@@ -2,7 +2,7 @@
2 * SPEAr3xx machines clock framework source file 2 * SPEAr3xx machines clock framework source file
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear6xx_clock.c b/drivers/clk/spear/spear6xx_clock.c
index f9a20b382304..61026ae564ab 100644
--- a/drivers/clk/spear/spear6xx_clock.c
+++ b/drivers/clk/spear/spear6xx_clock.c
@@ -2,7 +2,7 @@
2 * SPEAr6xx machines clock framework source file 2 * SPEAr6xx machines clock framework source file
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -298,7 +298,7 @@ void __init spear6xx_clk_init(void)
298 298
299 clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0, PERIP1_CLK_ENB, 299 clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0, PERIP1_CLK_ENB,
300 GMAC_CLK_ENB, 0, &_lock); 300 GMAC_CLK_ENB, 0, &_lock);
301 clk_register_clkdev(clk, NULL, "gmac"); 301 clk_register_clkdev(clk, NULL, "e0800000.ethernet");
302 302
303 clk = clk_register_gate(NULL, "i2c_clk", "ahb_clk", 0, PERIP1_CLK_ENB, 303 clk = clk_register_gate(NULL, "i2c_clk", "ahb_clk", 0, PERIP1_CLK_ENB,
304 I2C_CLK_ENB, 0, &_lock); 304 I2C_CLK_ENB, 0, &_lock);
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index e23dc82d43ac..721296157577 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1626,4 +1626,4 @@ module_exit(dw_exit);
1626MODULE_LICENSE("GPL v2"); 1626MODULE_LICENSE("GPL v2");
1627MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller driver"); 1627MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller driver");
1628MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); 1628MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
1629MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 1629MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index fb4f4990f5eb..1dc2a4ad0026 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -815,8 +815,6 @@ static int sdma_request_channel(struct sdma_channel *sdmac)
815 815
816 init_completion(&sdmac->done); 816 init_completion(&sdmac->done);
817 817
818 sdmac->buf_tail = 0;
819
820 return 0; 818 return 0;
821out: 819out:
822 820
@@ -927,6 +925,8 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
927 925
928 sdmac->flags = 0; 926 sdmac->flags = 0;
929 927
928 sdmac->buf_tail = 0;
929
930 dev_dbg(sdma->dev, "setting up %d entries for channel %d.\n", 930 dev_dbg(sdma->dev, "setting up %d entries for channel %d.\n",
931 sg_len, channel); 931 sg_len, channel);
932 932
@@ -1027,6 +1027,8 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
1027 1027
1028 sdmac->status = DMA_IN_PROGRESS; 1028 sdmac->status = DMA_IN_PROGRESS;
1029 1029
1030 sdmac->buf_tail = 0;
1031
1030 sdmac->flags |= IMX_DMA_SG_LOOP; 1032 sdmac->flags |= IMX_DMA_SG_LOOP;
1031 sdmac->direction = direction; 1033 sdmac->direction = direction;
1032 ret = sdma_load_context(sdmac); 1034 ret = sdma_load_context(sdmac);
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index cbcc28e79be6..e4feba6b03c0 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -392,6 +392,8 @@ struct pl330_req {
392 struct pl330_reqcfg *cfg; 392 struct pl330_reqcfg *cfg;
393 /* Pointer to first xfer in the request. */ 393 /* Pointer to first xfer in the request. */
394 struct pl330_xfer *x; 394 struct pl330_xfer *x;
395 /* Hook to attach to DMAC's list of reqs with due callback */
396 struct list_head rqd;
395}; 397};
396 398
397/* 399/*
@@ -461,8 +463,6 @@ struct _pl330_req {
461 /* Number of bytes taken to setup MC for the req */ 463 /* Number of bytes taken to setup MC for the req */
462 u32 mc_len; 464 u32 mc_len;
463 struct pl330_req *r; 465 struct pl330_req *r;
464 /* Hook to attach to DMAC's list of reqs with due callback */
465 struct list_head rqd;
466}; 466};
467 467
468/* ToBeDone for tasklet */ 468/* ToBeDone for tasklet */
@@ -1683,7 +1683,7 @@ static void pl330_dotask(unsigned long data)
1683/* Returns 1 if state was updated, 0 otherwise */ 1683/* Returns 1 if state was updated, 0 otherwise */
1684static int pl330_update(const struct pl330_info *pi) 1684static int pl330_update(const struct pl330_info *pi)
1685{ 1685{
1686 struct _pl330_req *rqdone; 1686 struct pl330_req *rqdone, *tmp;
1687 struct pl330_dmac *pl330; 1687 struct pl330_dmac *pl330;
1688 unsigned long flags; 1688 unsigned long flags;
1689 void __iomem *regs; 1689 void __iomem *regs;
@@ -1750,7 +1750,10 @@ static int pl330_update(const struct pl330_info *pi)
1750 if (active == -1) /* Aborted */ 1750 if (active == -1) /* Aborted */
1751 continue; 1751 continue;
1752 1752
1753 rqdone = &thrd->req[active]; 1753 /* Detach the req */
1754 rqdone = thrd->req[active].r;
1755 thrd->req[active].r = NULL;
1756
1754 mark_free(thrd, active); 1757 mark_free(thrd, active);
1755 1758
1756 /* Get going again ASAP */ 1759 /* Get going again ASAP */
@@ -1762,20 +1765,11 @@ static int pl330_update(const struct pl330_info *pi)
1762 } 1765 }
1763 1766
1764 /* Now that we are in no hurry, do the callbacks */ 1767 /* Now that we are in no hurry, do the callbacks */
1765 while (!list_empty(&pl330->req_done)) { 1768 list_for_each_entry_safe(rqdone, tmp, &pl330->req_done, rqd) {
1766 struct pl330_req *r; 1769 list_del(&rqdone->rqd);
1767
1768 rqdone = container_of(pl330->req_done.next,
1769 struct _pl330_req, rqd);
1770
1771 list_del_init(&rqdone->rqd);
1772
1773 /* Detach the req */
1774 r = rqdone->r;
1775 rqdone->r = NULL;
1776 1770
1777 spin_unlock_irqrestore(&pl330->lock, flags); 1771 spin_unlock_irqrestore(&pl330->lock, flags);
1778 _callback(r, PL330_ERR_NONE); 1772 _callback(rqdone, PL330_ERR_NONE);
1779 spin_lock_irqsave(&pl330->lock, flags); 1773 spin_lock_irqsave(&pl330->lock, flags);
1780 } 1774 }
1781 1775
@@ -2321,7 +2315,7 @@ static void pl330_tasklet(unsigned long data)
2321 /* Pick up ripe tomatoes */ 2315 /* Pick up ripe tomatoes */
2322 list_for_each_entry_safe(desc, _dt, &pch->work_list, node) 2316 list_for_each_entry_safe(desc, _dt, &pch->work_list, node)
2323 if (desc->status == DONE) { 2317 if (desc->status == DONE) {
2324 if (pch->cyclic) 2318 if (!pch->cyclic)
2325 dma_cookie_complete(&desc->txd); 2319 dma_cookie_complete(&desc->txd);
2326 list_move_tail(&desc->node, &list); 2320 list_move_tail(&desc->node, &list);
2327 } 2321 }
@@ -2539,7 +2533,7 @@ static inline void _init_desc(struct dma_pl330_desc *desc)
2539} 2533}
2540 2534
2541/* Returns the number of descriptors added to the DMAC pool */ 2535/* Returns the number of descriptors added to the DMAC pool */
2542int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count) 2536static int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count)
2543{ 2537{
2544 struct dma_pl330_desc *desc; 2538 struct dma_pl330_desc *desc;
2545 unsigned long flags; 2539 unsigned long flags;
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 10f375032e96..de5ba86e8b89 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -164,7 +164,7 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems)
164 else 164 else
165 return (char *)ptr; 165 return (char *)ptr;
166 166
167 r = size % align; 167 r = (unsigned long)p % align;
168 168
169 if (r == 0) 169 if (r == 0)
170 return (char *)ptr; 170 return (char *)ptr;
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index d27778f65a5d..a499c7ed820a 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1814,12 +1814,6 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val,
1814 if (mce->bank != 8) 1814 if (mce->bank != 8)
1815 return NOTIFY_DONE; 1815 return NOTIFY_DONE;
1816 1816
1817#ifdef CONFIG_SMP
1818 /* Only handle if it is the right mc controller */
1819 if (mce->socketid != pvt->i7core_dev->socket)
1820 return NOTIFY_DONE;
1821#endif
1822
1823 smp_rmb(); 1817 smp_rmb();
1824 if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) { 1818 if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) {
1825 smp_wmb(); 1819 smp_wmb();
@@ -2116,8 +2110,6 @@ static void i7core_unregister_mci(struct i7core_dev *i7core_dev)
2116 if (pvt->enable_scrub) 2110 if (pvt->enable_scrub)
2117 disable_sdram_scrub_setting(mci); 2111 disable_sdram_scrub_setting(mci);
2118 2112
2119 mce_unregister_decode_chain(&i7_mce_dec);
2120
2121 /* Disable EDAC polling */ 2113 /* Disable EDAC polling */
2122 i7core_pci_ctl_release(pvt); 2114 i7core_pci_ctl_release(pvt);
2123 2115
@@ -2222,8 +2214,6 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev)
2222 /* DCLK for scrub rate setting */ 2214 /* DCLK for scrub rate setting */
2223 pvt->dclk_freq = get_dclk_freq(); 2215 pvt->dclk_freq = get_dclk_freq();
2224 2216
2225 mce_register_decode_chain(&i7_mce_dec);
2226
2227 return 0; 2217 return 0;
2228 2218
2229fail0: 2219fail0:
@@ -2367,8 +2357,10 @@ static int __init i7core_init(void)
2367 2357
2368 pci_rc = pci_register_driver(&i7core_driver); 2358 pci_rc = pci_register_driver(&i7core_driver);
2369 2359
2370 if (pci_rc >= 0) 2360 if (pci_rc >= 0) {
2361 mce_register_decode_chain(&i7_mce_dec);
2371 return 0; 2362 return 0;
2363 }
2372 2364
2373 i7core_printk(KERN_ERR, "Failed to register device with error %d.\n", 2365 i7core_printk(KERN_ERR, "Failed to register device with error %d.\n",
2374 pci_rc); 2366 pci_rc);
@@ -2384,6 +2376,7 @@ static void __exit i7core_exit(void)
2384{ 2376{
2385 debugf2("MC: " __FILE__ ": %s()\n", __func__); 2377 debugf2("MC: " __FILE__ ": %s()\n", __func__);
2386 pci_unregister_driver(&i7core_driver); 2378 pci_unregister_driver(&i7core_driver);
2379 mce_unregister_decode_chain(&i7_mce_dec);
2387} 2380}
2388 2381
2389module_init(i7core_init); 2382module_init(i7core_init);
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 4c402353ba98..0e374625f6f8 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -980,7 +980,8 @@ static int __devinit mpc85xx_mc_err_probe(struct platform_device *op)
980 layers[1].type = EDAC_MC_LAYER_CHANNEL; 980 layers[1].type = EDAC_MC_LAYER_CHANNEL;
981 layers[1].size = 1; 981 layers[1].size = 1;
982 layers[1].is_virt_csrow = false; 982 layers[1].is_virt_csrow = false;
983 mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), sizeof(*pdata)); 983 mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), layers,
984 sizeof(*pdata));
984 if (!mci) { 985 if (!mci) {
985 devres_release_group(&op->dev, mpc85xx_mc_err_probe); 986 devres_release_group(&op->dev, mpc85xx_mc_err_probe);
986 return -ENOMEM; 987 return -ENOMEM;
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 4adaf4b7da99..36ad17e79d61 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -555,7 +555,7 @@ static int get_dimm_config(struct mem_ctl_info *mci)
555 pvt->is_close_pg = false; 555 pvt->is_close_pg = false;
556 } 556 }
557 557
558 pci_read_config_dword(pvt->pci_ta, RANK_CFG_A, &reg); 558 pci_read_config_dword(pvt->pci_ddrio, RANK_CFG_A, &reg);
559 if (IS_RDIMM_ENABLED(reg)) { 559 if (IS_RDIMM_ENABLED(reg)) {
560 /* FIXME: Can also be LRDIMM */ 560 /* FIXME: Can also be LRDIMM */
561 debugf0("Memory is registered\n"); 561 debugf0("Memory is registered\n");
@@ -1604,8 +1604,6 @@ static void sbridge_unregister_mci(struct sbridge_dev *sbridge_dev)
1604 debugf0("MC: " __FILE__ ": %s(): mci = %p, dev = %p\n", 1604 debugf0("MC: " __FILE__ ": %s(): mci = %p, dev = %p\n",
1605 __func__, mci, &sbridge_dev->pdev[0]->dev); 1605 __func__, mci, &sbridge_dev->pdev[0]->dev);
1606 1606
1607 mce_unregister_decode_chain(&sbridge_mce_dec);
1608
1609 /* Remove MC sysfs nodes */ 1607 /* Remove MC sysfs nodes */
1610 edac_mc_del_mc(mci->dev); 1608 edac_mc_del_mc(mci->dev);
1611 1609
@@ -1682,7 +1680,6 @@ static int sbridge_register_mci(struct sbridge_dev *sbridge_dev)
1682 goto fail0; 1680 goto fail0;
1683 } 1681 }
1684 1682
1685 mce_register_decode_chain(&sbridge_mce_dec);
1686 return 0; 1683 return 0;
1687 1684
1688fail0: 1685fail0:
@@ -1811,8 +1808,10 @@ static int __init sbridge_init(void)
1811 1808
1812 pci_rc = pci_register_driver(&sbridge_driver); 1809 pci_rc = pci_register_driver(&sbridge_driver);
1813 1810
1814 if (pci_rc >= 0) 1811 if (pci_rc >= 0) {
1812 mce_register_decode_chain(&sbridge_mce_dec);
1815 return 0; 1813 return 0;
1814 }
1816 1815
1817 sbridge_printk(KERN_ERR, "Failed to register device with error %d.\n", 1816 sbridge_printk(KERN_ERR, "Failed to register device with error %d.\n",
1818 pci_rc); 1817 pci_rc);
@@ -1828,6 +1827,7 @@ static void __exit sbridge_exit(void)
1828{ 1827{
1829 debugf2("MC: " __FILE__ ": %s()\n", __func__); 1828 debugf2("MC: " __FILE__ ": %s()\n", __func__);
1830 pci_unregister_driver(&sbridge_driver); 1829 pci_unregister_driver(&sbridge_driver);
1830 mce_unregister_decode_chain(&sbridge_mce_dec);
1831} 1831}
1832 1832
1833module_init(sbridge_init); 1833module_init(sbridge_init);
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 23416e443765..a4ed30bd9a41 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -116,8 +116,8 @@ const char *max8997_extcon_cable[] = {
116 [5] = "Charge-downstream", 116 [5] = "Charge-downstream",
117 [6] = "MHL", 117 [6] = "MHL",
118 [7] = "Dock-desk", 118 [7] = "Dock-desk",
119 [7] = "Dock-card", 119 [8] = "Dock-card",
120 [8] = "JIG", 120 [9] = "JIG",
121 121
122 NULL, 122 NULL,
123}; 123};
@@ -514,6 +514,7 @@ static int __devexit max8997_muic_remove(struct platform_device *pdev)
514 514
515 extcon_dev_unregister(info->edev); 515 extcon_dev_unregister(info->edev);
516 516
517 kfree(info->edev);
517 kfree(info); 518 kfree(info);
518 519
519 return 0; 520 return 0;
diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c
index f598a700ec15..159aeb07b3ba 100644
--- a/drivers/extcon/extcon_class.c
+++ b/drivers/extcon/extcon_class.c
@@ -762,7 +762,7 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
762#if defined(CONFIG_ANDROID) 762#if defined(CONFIG_ANDROID)
763 if (switch_class) 763 if (switch_class)
764 ret = class_compat_create_link(switch_class, edev->dev, 764 ret = class_compat_create_link(switch_class, edev->dev,
765 dev); 765 NULL);
766#endif /* CONFIG_ANDROID */ 766#endif /* CONFIG_ANDROID */
767 767
768 spin_lock_init(&edev->lock); 768 spin_lock_init(&edev->lock);
diff --git a/drivers/extcon/extcon_gpio.c b/drivers/extcon/extcon_gpio.c
index fe7a07b47336..8a0dcc11c7c7 100644
--- a/drivers/extcon/extcon_gpio.c
+++ b/drivers/extcon/extcon_gpio.c
@@ -125,6 +125,7 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev)
125 if (ret < 0) 125 if (ret < 0)
126 goto err_request_irq; 126 goto err_request_irq;
127 127
128 platform_set_drvdata(pdev, extcon_data);
128 /* Perform initial detection */ 129 /* Perform initial detection */
129 gpio_extcon_work(&extcon_data->work.work); 130 gpio_extcon_work(&extcon_data->work.work);
130 131
@@ -146,6 +147,7 @@ static int __devexit gpio_extcon_remove(struct platform_device *pdev)
146 struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev); 147 struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev);
147 148
148 cancel_delayed_work_sync(&extcon_data->work); 149 cancel_delayed_work_sync(&extcon_data->work);
150 free_irq(extcon_data->irq, extcon_data);
149 gpio_free(extcon_data->gpio); 151 gpio_free(extcon_data->gpio);
150 extcon_dev_unregister(&extcon_data->edev); 152 extcon_dev_unregister(&extcon_data->edev);
151 devm_kfree(&pdev->dev, extcon_data); 153 devm_kfree(&pdev->dev, extcon_data);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index eb92fe257a39..a8743c399e83 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -610,7 +610,7 @@ static bool
610drm_monitor_supports_rb(struct edid *edid) 610drm_monitor_supports_rb(struct edid *edid)
611{ 611{
612 if (edid->revision >= 4) { 612 if (edid->revision >= 4) {
613 bool ret; 613 bool ret = false;
614 drm_for_each_detailed_block((u8 *)edid, is_rb, &ret); 614 drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
615 return ret; 615 return ret;
616 } 616 }
@@ -1039,6 +1039,24 @@ mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
1039 return true; 1039 return true;
1040} 1040}
1041 1041
1042static bool valid_inferred_mode(const struct drm_connector *connector,
1043 const struct drm_display_mode *mode)
1044{
1045 struct drm_display_mode *m;
1046 bool ok = false;
1047
1048 list_for_each_entry(m, &connector->probed_modes, head) {
1049 if (mode->hdisplay == m->hdisplay &&
1050 mode->vdisplay == m->vdisplay &&
1051 drm_mode_vrefresh(mode) == drm_mode_vrefresh(m))
1052 return false; /* duplicated */
1053 if (mode->hdisplay <= m->hdisplay &&
1054 mode->vdisplay <= m->vdisplay)
1055 ok = true;
1056 }
1057 return ok;
1058}
1059
1042static int 1060static int
1043drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, 1061drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
1044 struct detailed_timing *timing) 1062 struct detailed_timing *timing)
@@ -1048,7 +1066,8 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
1048 struct drm_device *dev = connector->dev; 1066 struct drm_device *dev = connector->dev;
1049 1067
1050 for (i = 0; i < drm_num_dmt_modes; i++) { 1068 for (i = 0; i < drm_num_dmt_modes; i++) {
1051 if (mode_in_range(drm_dmt_modes + i, edid, timing)) { 1069 if (mode_in_range(drm_dmt_modes + i, edid, timing) &&
1070 valid_inferred_mode(connector, drm_dmt_modes + i)) {
1052 newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); 1071 newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]);
1053 if (newmode) { 1072 if (newmode) {
1054 drm_mode_probed_add(connector, newmode); 1073 drm_mode_probed_add(connector, newmode);
@@ -1088,7 +1107,8 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
1088 return modes; 1107 return modes;
1089 1108
1090 fixup_mode_1366x768(newmode); 1109 fixup_mode_1366x768(newmode);
1091 if (!mode_in_range(newmode, edid, timing)) { 1110 if (!mode_in_range(newmode, edid, timing) ||
1111 !valid_inferred_mode(connector, newmode)) {
1092 drm_mode_destroy(dev, newmode); 1112 drm_mode_destroy(dev, newmode);
1093 continue; 1113 continue;
1094 } 1114 }
@@ -1116,7 +1136,8 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
1116 return modes; 1136 return modes;
1117 1137
1118 fixup_mode_1366x768(newmode); 1138 fixup_mode_1366x768(newmode);
1119 if (!mode_in_range(newmode, edid, timing)) { 1139 if (!mode_in_range(newmode, edid, timing) ||
1140 !valid_inferred_mode(connector, newmode)) {
1120 drm_mode_destroy(dev, newmode); 1141 drm_mode_destroy(dev, newmode);
1121 continue; 1142 continue;
1122 } 1143 }
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index f94792626b94..36822b924eb1 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1401,6 +1401,27 @@ i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base,
1401 } 1401 }
1402} 1402}
1403 1403
1404static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
1405{
1406 struct apertures_struct *ap;
1407 struct pci_dev *pdev = dev_priv->dev->pdev;
1408 bool primary;
1409
1410 ap = alloc_apertures(1);
1411 if (!ap)
1412 return;
1413
1414 ap->ranges[0].base = dev_priv->dev->agp->base;
1415 ap->ranges[0].size =
1416 dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
1417 primary =
1418 pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
1419
1420 remove_conflicting_framebuffers(ap, "inteldrmfb", primary);
1421
1422 kfree(ap);
1423}
1424
1404/** 1425/**
1405 * i915_driver_load - setup chip and create an initial config 1426 * i915_driver_load - setup chip and create an initial config
1406 * @dev: DRM device 1427 * @dev: DRM device
@@ -1446,6 +1467,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1446 goto free_priv; 1467 goto free_priv;
1447 } 1468 }
1448 1469
1470 dev_priv->mm.gtt = intel_gtt_get();
1471 if (!dev_priv->mm.gtt) {
1472 DRM_ERROR("Failed to initialize GTT\n");
1473 ret = -ENODEV;
1474 goto put_bridge;
1475 }
1476
1477 i915_kick_out_firmware_fb(dev_priv);
1478
1449 pci_set_master(dev->pdev); 1479 pci_set_master(dev->pdev);
1450 1480
1451 /* overlay on gen2 is broken and can't address above 1G */ 1481 /* overlay on gen2 is broken and can't address above 1G */
@@ -1471,13 +1501,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1471 goto put_bridge; 1501 goto put_bridge;
1472 } 1502 }
1473 1503
1474 dev_priv->mm.gtt = intel_gtt_get();
1475 if (!dev_priv->mm.gtt) {
1476 DRM_ERROR("Failed to initialize GTT\n");
1477 ret = -ENODEV;
1478 goto out_rmmap;
1479 }
1480
1481 aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; 1504 aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
1482 1505
1483 dev_priv->mm.gtt_mapping = 1506 dev_priv->mm.gtt_mapping =
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index b1fe0edda955..ed3224c37423 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -412,7 +412,6 @@ static void gen6_queue_rps_work(struct drm_i915_private *dev_priv,
412 */ 412 */
413 413
414 spin_lock_irqsave(&dev_priv->rps_lock, flags); 414 spin_lock_irqsave(&dev_priv->rps_lock, flags);
415 WARN(dev_priv->pm_iir & pm_iir, "Missed a PM interrupt\n");
416 dev_priv->pm_iir |= pm_iir; 415 dev_priv->pm_iir |= pm_iir;
417 I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir); 416 I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir);
418 POSTING_READ(GEN6_PMIMR); 417 POSTING_READ(GEN6_PMIMR);
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 0ede02a99d91..a748e5cabe14 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -740,8 +740,11 @@ static void i915_restore_display(struct drm_device *dev)
740 if (HAS_PCH_SPLIT(dev)) { 740 if (HAS_PCH_SPLIT(dev)) {
741 I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); 741 I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL);
742 I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); 742 I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2);
743 I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); 743 /* NOTE: BLC_PWM_CPU_CTL must be written after BLC_PWM_CPU_CTL2;
744 * otherwise we get blank eDP screen after S3 on some machines
745 */
744 I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); 746 I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2);
747 I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL);
745 I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); 748 I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS);
746 I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); 749 I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS);
747 I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); 750 I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e0aa064def31..a8538ac0299d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6558,7 +6558,7 @@ static void intel_setup_outputs(struct drm_device *dev)
6558 if (I915_READ(HDMIC) & PORT_DETECTED) 6558 if (I915_READ(HDMIC) & PORT_DETECTED)
6559 intel_hdmi_init(dev, HDMIC); 6559 intel_hdmi_init(dev, HDMIC);
6560 6560
6561 if (I915_READ(HDMID) & PORT_DETECTED) 6561 if (!dpd_is_edp && I915_READ(HDMID) & PORT_DETECTED)
6562 intel_hdmi_init(dev, HDMID); 6562 intel_hdmi_init(dev, HDMID);
6563 6563
6564 if (I915_READ(PCH_DP_C) & DP_DETECTED) 6564 if (I915_READ(PCH_DP_C) & DP_DETECTED)
@@ -6921,19 +6921,6 @@ static void i915_disable_vga(struct drm_device *dev)
6921 POSTING_READ(vga_reg); 6921 POSTING_READ(vga_reg);
6922} 6922}
6923 6923
6924static void ivb_pch_pwm_override(struct drm_device *dev)
6925{
6926 struct drm_i915_private *dev_priv = dev->dev_private;
6927
6928 /*
6929 * IVB has CPU eDP backlight regs too, set things up to let the
6930 * PCH regs control the backlight
6931 */
6932 I915_WRITE(BLC_PWM_CPU_CTL2, PWM_ENABLE);
6933 I915_WRITE(BLC_PWM_CPU_CTL, 0);
6934 I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE | (1<<30));
6935}
6936
6937void intel_modeset_init_hw(struct drm_device *dev) 6924void intel_modeset_init_hw(struct drm_device *dev)
6938{ 6925{
6939 struct drm_i915_private *dev_priv = dev->dev_private; 6926 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -6950,9 +6937,6 @@ void intel_modeset_init_hw(struct drm_device *dev)
6950 gen6_enable_rps(dev_priv); 6937 gen6_enable_rps(dev_priv);
6951 gen6_update_ring_freq(dev_priv); 6938 gen6_update_ring_freq(dev_priv);
6952 } 6939 }
6953
6954 if (IS_IVYBRIDGE(dev))
6955 ivb_pch_pwm_override(dev);
6956} 6940}
6957 6941
6958void intel_modeset_init(struct drm_device *dev) 6942void intel_modeset_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 296cfc201a81..c0449324143c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -32,6 +32,7 @@
32#include "drm.h" 32#include "drm.h"
33#include "drm_crtc.h" 33#include "drm_crtc.h"
34#include "drm_crtc_helper.h" 34#include "drm_crtc_helper.h"
35#include "drm_edid.h"
35#include "intel_drv.h" 36#include "intel_drv.h"
36#include "i915_drm.h" 37#include "i915_drm.h"
37#include "i915_drv.h" 38#include "i915_drv.h"
@@ -67,6 +68,8 @@ struct intel_dp {
67 struct drm_display_mode *panel_fixed_mode; /* for eDP */ 68 struct drm_display_mode *panel_fixed_mode; /* for eDP */
68 struct delayed_work panel_vdd_work; 69 struct delayed_work panel_vdd_work;
69 bool want_panel_vdd; 70 bool want_panel_vdd;
71 struct edid *edid; /* cached EDID for eDP */
72 int edid_mode_count;
70}; 73};
71 74
72/** 75/**
@@ -371,7 +374,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
371 int recv_bytes; 374 int recv_bytes;
372 uint32_t status; 375 uint32_t status;
373 uint32_t aux_clock_divider; 376 uint32_t aux_clock_divider;
374 int try, precharge = 5; 377 int try, precharge;
375 378
376 intel_dp_check_edp(intel_dp); 379 intel_dp_check_edp(intel_dp);
377 /* The clock divider is based off the hrawclk, 380 /* The clock divider is based off the hrawclk,
@@ -391,6 +394,11 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
391 else 394 else
392 aux_clock_divider = intel_hrawclk(dev) / 2; 395 aux_clock_divider = intel_hrawclk(dev) / 2;
393 396
397 if (IS_GEN6(dev))
398 precharge = 3;
399 else
400 precharge = 5;
401
394 /* Try to wait for any previous AUX channel activity */ 402 /* Try to wait for any previous AUX channel activity */
395 for (try = 0; try < 3; try++) { 403 for (try = 0; try < 3; try++) {
396 status = I915_READ(ch_ctl); 404 status = I915_READ(ch_ctl);
@@ -1973,6 +1981,8 @@ intel_dp_probe_oui(struct intel_dp *intel_dp)
1973 if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) 1981 if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT))
1974 return; 1982 return;
1975 1983
1984 ironlake_edp_panel_vdd_on(intel_dp);
1985
1976 if (intel_dp_aux_native_read_retry(intel_dp, DP_SINK_OUI, buf, 3)) 1986 if (intel_dp_aux_native_read_retry(intel_dp, DP_SINK_OUI, buf, 3))
1977 DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", 1987 DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n",
1978 buf[0], buf[1], buf[2]); 1988 buf[0], buf[1], buf[2]);
@@ -1980,6 +1990,8 @@ intel_dp_probe_oui(struct intel_dp *intel_dp)
1980 if (intel_dp_aux_native_read_retry(intel_dp, DP_BRANCH_OUI, buf, 3)) 1990 if (intel_dp_aux_native_read_retry(intel_dp, DP_BRANCH_OUI, buf, 3))
1981 DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", 1991 DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n",
1982 buf[0], buf[1], buf[2]); 1992 buf[0], buf[1], buf[2]);
1993
1994 ironlake_edp_panel_vdd_off(intel_dp, false);
1983} 1995}
1984 1996
1985static bool 1997static bool
@@ -2116,10 +2128,22 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
2116{ 2128{
2117 struct intel_dp *intel_dp = intel_attached_dp(connector); 2129 struct intel_dp *intel_dp = intel_attached_dp(connector);
2118 struct edid *edid; 2130 struct edid *edid;
2131 int size;
2132
2133 if (is_edp(intel_dp)) {
2134 if (!intel_dp->edid)
2135 return NULL;
2136
2137 size = (intel_dp->edid->extensions + 1) * EDID_LENGTH;
2138 edid = kmalloc(size, GFP_KERNEL);
2139 if (!edid)
2140 return NULL;
2141
2142 memcpy(edid, intel_dp->edid, size);
2143 return edid;
2144 }
2119 2145
2120 ironlake_edp_panel_vdd_on(intel_dp);
2121 edid = drm_get_edid(connector, adapter); 2146 edid = drm_get_edid(connector, adapter);
2122 ironlake_edp_panel_vdd_off(intel_dp, false);
2123 return edid; 2147 return edid;
2124} 2148}
2125 2149
@@ -2129,9 +2153,17 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada
2129 struct intel_dp *intel_dp = intel_attached_dp(connector); 2153 struct intel_dp *intel_dp = intel_attached_dp(connector);
2130 int ret; 2154 int ret;
2131 2155
2132 ironlake_edp_panel_vdd_on(intel_dp); 2156 if (is_edp(intel_dp)) {
2157 drm_mode_connector_update_edid_property(connector,
2158 intel_dp->edid);
2159 ret = drm_add_edid_modes(connector, intel_dp->edid);
2160 drm_edid_to_eld(connector,
2161 intel_dp->edid);
2162 connector->display_info.raw_edid = NULL;
2163 return intel_dp->edid_mode_count;
2164 }
2165
2133 ret = intel_ddc_get_modes(connector, adapter); 2166 ret = intel_ddc_get_modes(connector, adapter);
2134 ironlake_edp_panel_vdd_off(intel_dp, false);
2135 return ret; 2167 return ret;
2136} 2168}
2137 2169
@@ -2321,6 +2353,7 @@ static void intel_dp_encoder_destroy(struct drm_encoder *encoder)
2321 i2c_del_adapter(&intel_dp->adapter); 2353 i2c_del_adapter(&intel_dp->adapter);
2322 drm_encoder_cleanup(encoder); 2354 drm_encoder_cleanup(encoder);
2323 if (is_edp(intel_dp)) { 2355 if (is_edp(intel_dp)) {
2356 kfree(intel_dp->edid);
2324 cancel_delayed_work_sync(&intel_dp->panel_vdd_work); 2357 cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
2325 ironlake_panel_vdd_off_sync(intel_dp); 2358 ironlake_panel_vdd_off_sync(intel_dp);
2326 } 2359 }
@@ -2504,11 +2537,14 @@ intel_dp_init(struct drm_device *dev, int output_reg)
2504 break; 2537 break;
2505 } 2538 }
2506 2539
2540 intel_dp_i2c_init(intel_dp, intel_connector, name);
2541
2507 /* Cache some DPCD data in the eDP case */ 2542 /* Cache some DPCD data in the eDP case */
2508 if (is_edp(intel_dp)) { 2543 if (is_edp(intel_dp)) {
2509 bool ret; 2544 bool ret;
2510 struct edp_power_seq cur, vbt; 2545 struct edp_power_seq cur, vbt;
2511 u32 pp_on, pp_off, pp_div; 2546 u32 pp_on, pp_off, pp_div;
2547 struct edid *edid;
2512 2548
2513 pp_on = I915_READ(PCH_PP_ON_DELAYS); 2549 pp_on = I915_READ(PCH_PP_ON_DELAYS);
2514 pp_off = I915_READ(PCH_PP_OFF_DELAYS); 2550 pp_off = I915_READ(PCH_PP_OFF_DELAYS);
@@ -2576,9 +2612,19 @@ intel_dp_init(struct drm_device *dev, int output_reg)
2576 intel_dp_destroy(&intel_connector->base); 2612 intel_dp_destroy(&intel_connector->base);
2577 return; 2613 return;
2578 } 2614 }
2579 }
2580 2615
2581 intel_dp_i2c_init(intel_dp, intel_connector, name); 2616 ironlake_edp_panel_vdd_on(intel_dp);
2617 edid = drm_get_edid(connector, &intel_dp->adapter);
2618 if (edid) {
2619 drm_mode_connector_update_edid_property(connector,
2620 edid);
2621 intel_dp->edid_mode_count =
2622 drm_add_edid_modes(connector, edid);
2623 drm_edid_to_eld(connector, edid);
2624 intel_dp->edid = edid;
2625 }
2626 ironlake_edp_panel_vdd_off(intel_dp, false);
2627 }
2582 2628
2583 intel_encoder->hot_plug = intel_dp_hot_plug; 2629 intel_encoder->hot_plug = intel_dp_hot_plug;
2584 2630
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 153b9a15469b..1074bc5dd418 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -467,7 +467,7 @@ int nouveau_fbcon_init(struct drm_device *dev)
467 nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; 467 nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs;
468 468
469 ret = drm_fb_helper_init(dev, &nfbdev->helper, 469 ret = drm_fb_helper_init(dev, &nfbdev->helper,
470 nv_two_heads(dev) ? 2 : 1, 4); 470 dev->mode_config.num_crtc, 4);
471 if (ret) { 471 if (ret) {
472 kfree(nfbdev); 472 kfree(nfbdev);
473 return ret; 473 return ret;
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index a89240e5fb29..a25cf2cb931f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -1,3 +1,26 @@
1/*
2 * Copyright 2011 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Dave Airlie
23 */
1 24
2#include "drmP.h" 25#include "drmP.h"
3#include "drm.h" 26#include "drm.h"
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 01d77d1554f4..3904d7964a4b 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1149,7 +1149,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1149 } 1149 }
1150 1150
1151 if (tiling_flags & RADEON_TILING_MACRO) { 1151 if (tiling_flags & RADEON_TILING_MACRO) {
1152 if (rdev->family >= CHIP_CAYMAN) 1152 if (rdev->family >= CHIP_TAHITI)
1153 tmp = rdev->config.si.tile_config;
1154 else if (rdev->family >= CHIP_CAYMAN)
1153 tmp = rdev->config.cayman.tile_config; 1155 tmp = rdev->config.cayman.tile_config;
1154 else 1156 else
1155 tmp = rdev->config.evergreen.tile_config; 1157 tmp = rdev->config.evergreen.tile_config;
@@ -1177,6 +1179,12 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1177 } else if (tiling_flags & RADEON_TILING_MICRO) 1179 } else if (tiling_flags & RADEON_TILING_MICRO)
1178 fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); 1180 fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1);
1179 1181
1182 if ((rdev->family == CHIP_TAHITI) ||
1183 (rdev->family == CHIP_PITCAIRN))
1184 fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P8_32x32_8x16);
1185 else if (rdev->family == CHIP_VERDE)
1186 fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P4_8x16);
1187
1180 switch (radeon_crtc->crtc_id) { 1188 switch (radeon_crtc->crtc_id) {
1181 case 0: 1189 case 0:
1182 WREG32(AVIVO_D1VGA_CONTROL, 0); 1190 WREG32(AVIVO_D1VGA_CONTROL, 0);
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index e7b1ec5ae8c6..486ccdf4aacd 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1926,7 +1926,9 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1926 1926
1927 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { 1927 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
1928 r600_hdmi_enable(encoder); 1928 r600_hdmi_enable(encoder);
1929 if (ASIC_IS_DCE4(rdev)) 1929 if (ASIC_IS_DCE6(rdev))
1930 ; /* TODO (use pointers instead of if-s?) */
1931 else if (ASIC_IS_DCE4(rdev))
1930 evergreen_hdmi_setmode(encoder, adjusted_mode); 1932 evergreen_hdmi_setmode(encoder, adjusted_mode);
1931 else 1933 else
1932 r600_hdmi_setmode(encoder, adjusted_mode); 1934 r600_hdmi_setmode(encoder, adjusted_mode);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 01550d05e273..7fb3d2e0434c 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1932,6 +1932,9 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1932 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets); 1932 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets);
1933 WREG32(SMX_DC_CTL0, smx_dc_ctl0); 1933 WREG32(SMX_DC_CTL0, smx_dc_ctl0);
1934 1934
1935 if (rdev->family <= CHIP_SUMO2)
1936 WREG32(SMX_SAR_CTL0, 0x00010000);
1937
1935 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) | 1938 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) |
1936 POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) | 1939 POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) |
1937 SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1))); 1940 SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1)));
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index a51f880985f8..65c54160028b 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -156,9 +156,6 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
156 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 156 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
157 uint32_t offset; 157 uint32_t offset;
158 158
159 if (ASIC_IS_DCE5(rdev))
160 return;
161
162 /* Silent, r600_hdmi_enable will raise WARN for us */ 159 /* Silent, r600_hdmi_enable will raise WARN for us */
163 if (!dig->afmt->enabled) 160 if (!dig->afmt->enabled)
164 return; 161 return;
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 2773039b4902..b50b15c70498 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -503,6 +503,7 @@
503#define SCRATCH_UMSK 0x8540 503#define SCRATCH_UMSK 0x8540
504#define SCRATCH_ADDR 0x8544 504#define SCRATCH_ADDR 0x8544
505 505
506#define SMX_SAR_CTL0 0xA008
506#define SMX_DC_CTL0 0xA020 507#define SMX_DC_CTL0 0xA020
507#define USE_HASH_FUNCTION (1 << 0) 508#define USE_HASH_FUNCTION (1 << 0)
508#define NUMBER_OF_SETS(x) ((x) << 1) 509#define NUMBER_OF_SETS(x) ((x) << 1)
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 3186522a4458..b7bf18e40215 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1303,6 +1303,10 @@ static int cayman_startup(struct radeon_device *rdev)
1303 if (r) 1303 if (r)
1304 return r; 1304 return r;
1305 1305
1306 r = r600_audio_init(rdev);
1307 if (r)
1308 return r;
1309
1306 return 0; 1310 return 0;
1307} 1311}
1308 1312
@@ -1329,6 +1333,7 @@ int cayman_resume(struct radeon_device *rdev)
1329 1333
1330int cayman_suspend(struct radeon_device *rdev) 1334int cayman_suspend(struct radeon_device *rdev)
1331{ 1335{
1336 r600_audio_fini(rdev);
1332 /* FIXME: we should wait for ring to be empty */ 1337 /* FIXME: we should wait for ring to be empty */
1333 radeon_ib_pool_suspend(rdev); 1338 radeon_ib_pool_suspend(rdev);
1334 radeon_vm_manager_suspend(rdev); 1339 radeon_vm_manager_suspend(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index f30dc95f83b1..bff627293812 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1839,6 +1839,7 @@ void r600_gpu_init(struct radeon_device *rdev)
1839 WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA | 1839 WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
1840 NUM_CLIP_SEQ(3))); 1840 NUM_CLIP_SEQ(3)));
1841 WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095)); 1841 WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095));
1842 WREG32(VC_ENHANCE, 0);
1842} 1843}
1843 1844
1844 1845
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c
index 7479a5c503e4..79b55916cf90 100644
--- a/drivers/gpu/drm/radeon/r600_audio.c
+++ b/drivers/gpu/drm/radeon/r600_audio.c
@@ -57,7 +57,7 @@ static bool radeon_dig_encoder(struct drm_encoder *encoder)
57 */ 57 */
58static int r600_audio_chipset_supported(struct radeon_device *rdev) 58static int r600_audio_chipset_supported(struct radeon_device *rdev)
59{ 59{
60 return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE5(rdev)) 60 return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE6(rdev))
61 || rdev->family == CHIP_RS600 61 || rdev->family == CHIP_RS600
62 || rdev->family == CHIP_RS690 62 || rdev->family == CHIP_RS690
63 || rdev->family == CHIP_RS740; 63 || rdev->family == CHIP_RS740;
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0133f5f09bd6..ca87f7afaf23 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2079,6 +2079,48 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
2079 return -EINVAL; 2079 return -EINVAL;
2080 } 2080 }
2081 break; 2081 break;
2082 case PACKET3_STRMOUT_BASE_UPDATE:
2083 if (p->family < CHIP_RV770) {
2084 DRM_ERROR("STRMOUT_BASE_UPDATE only supported on 7xx\n");
2085 return -EINVAL;
2086 }
2087 if (pkt->count != 1) {
2088 DRM_ERROR("bad STRMOUT_BASE_UPDATE packet count\n");
2089 return -EINVAL;
2090 }
2091 if (idx_value > 3) {
2092 DRM_ERROR("bad STRMOUT_BASE_UPDATE index\n");
2093 return -EINVAL;
2094 }
2095 {
2096 u64 offset;
2097
2098 r = r600_cs_packet_next_reloc(p, &reloc);
2099 if (r) {
2100 DRM_ERROR("bad STRMOUT_BASE_UPDATE reloc\n");
2101 return -EINVAL;
2102 }
2103
2104 if (reloc->robj != track->vgt_strmout_bo[idx_value]) {
2105 DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo does not match\n");
2106 return -EINVAL;
2107 }
2108
2109 offset = radeon_get_ib_value(p, idx+1) << 8;
2110 if (offset != track->vgt_strmout_bo_offset[idx_value]) {
2111 DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n",
2112 offset, track->vgt_strmout_bo_offset[idx_value]);
2113 return -EINVAL;
2114 }
2115
2116 if ((offset + 4) > radeon_bo_size(reloc->robj)) {
2117 DRM_ERROR("bad STRMOUT_BASE_UPDATE bo too small: 0x%llx, 0x%lx\n",
2118 offset + 4, radeon_bo_size(reloc->robj));
2119 return -EINVAL;
2120 }
2121 ib[idx+1] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
2122 }
2123 break;
2082 case PACKET3_SURFACE_BASE_UPDATE: 2124 case PACKET3_SURFACE_BASE_UPDATE:
2083 if (p->family >= CHIP_RV770 || p->family == CHIP_R600) { 2125 if (p->family >= CHIP_RV770 || p->family == CHIP_R600) {
2084 DRM_ERROR("bad SURFACE_BASE_UPDATE\n"); 2126 DRM_ERROR("bad SURFACE_BASE_UPDATE\n");
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index 969c27529dfe..82a0a4c919c0 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -322,9 +322,6 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
322 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 322 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
323 uint32_t offset; 323 uint32_t offset;
324 324
325 if (ASIC_IS_DCE5(rdev))
326 return;
327
328 /* Silent, r600_hdmi_enable will raise WARN for us */ 325 /* Silent, r600_hdmi_enable will raise WARN for us */
329 if (!dig->afmt->enabled) 326 if (!dig->afmt->enabled)
330 return; 327 return;
@@ -483,7 +480,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder)
483 uint32_t offset; 480 uint32_t offset;
484 u32 hdmi; 481 u32 hdmi;
485 482
486 if (ASIC_IS_DCE5(rdev)) 483 if (ASIC_IS_DCE6(rdev))
487 return; 484 return;
488 485
489 /* Silent, r600_hdmi_enable will raise WARN for us */ 486 /* Silent, r600_hdmi_enable will raise WARN for us */
@@ -543,7 +540,7 @@ void r600_hdmi_disable(struct drm_encoder *encoder)
543 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 540 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
544 uint32_t offset; 541 uint32_t offset;
545 542
546 if (ASIC_IS_DCE5(rdev)) 543 if (ASIC_IS_DCE6(rdev))
547 return; 544 return;
548 545
549 /* Called for ATOM_ENCODER_MODE_HDMI only */ 546 /* Called for ATOM_ENCODER_MODE_HDMI only */
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index a0dbf1fe6a40..025fd5b6c08c 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -485,6 +485,7 @@
485#define TC_L2_SIZE(x) ((x)<<5) 485#define TC_L2_SIZE(x) ((x)<<5)
486#define L2_DISABLE_LATE_HIT (1<<9) 486#define L2_DISABLE_LATE_HIT (1<<9)
487 487
488#define VC_ENHANCE 0x9714
488 489
489#define VGT_CACHE_INVALIDATION 0x88C4 490#define VGT_CACHE_INVALIDATION 0x88C4
490#define CACHE_INVALIDATION(x) ((x)<<0) 491#define CACHE_INVALIDATION(x) ((x)<<0)
@@ -1163,6 +1164,7 @@
1163#define PACKET3_SET_CTL_CONST 0x6F 1164#define PACKET3_SET_CTL_CONST 0x6F
1164#define PACKET3_SET_CTL_CONST_OFFSET 0x0003cff0 1165#define PACKET3_SET_CTL_CONST_OFFSET 0x0003cff0
1165#define PACKET3_SET_CTL_CONST_END 0x0003e200 1166#define PACKET3_SET_CTL_CONST_END 0x0003e200
1167#define PACKET3_STRMOUT_BASE_UPDATE 0x72 /* r7xx */
1166#define PACKET3_SURFACE_BASE_UPDATE 0x73 1168#define PACKET3_SURFACE_BASE_UPDATE 0x73
1167 1169
1168 1170
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 03e5f5df40f1..2c4d53fd20c5 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -58,9 +58,10 @@
58 * 2.14.0 - add evergreen tiling informations 58 * 2.14.0 - add evergreen tiling informations
59 * 2.15.0 - add max_pipes query 59 * 2.15.0 - add max_pipes query
60 * 2.16.0 - fix evergreen 2D tiled surface calculation 60 * 2.16.0 - fix evergreen 2D tiled surface calculation
61 * 2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
61 */ 62 */
62#define KMS_DRIVER_MAJOR 2 63#define KMS_DRIVER_MAJOR 2
63#define KMS_DRIVER_MINOR 16 64#define KMS_DRIVER_MINOR 17
64#define KMS_DRIVER_PATCHLEVEL 0 65#define KMS_DRIVER_PATCHLEVEL 0
65int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 66int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
66int radeon_driver_unload_kms(struct drm_device *dev); 67int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 59d44937dd9f..84b648a7ddd8 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -289,8 +289,9 @@ int radeon_vm_manager_init(struct radeon_device *rdev)
289 rdev->vm_manager.enabled = false; 289 rdev->vm_manager.enabled = false;
290 290
291 /* mark first vm as always in use, it's the system one */ 291 /* mark first vm as always in use, it's the system one */
292 /* allocate enough for 2 full VM pts */
292 r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, 293 r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager,
293 rdev->vm_manager.max_pfn * 8, 294 rdev->vm_manager.max_pfn * 8 * 2,
294 RADEON_GEM_DOMAIN_VRAM); 295 RADEON_GEM_DOMAIN_VRAM);
295 if (r) { 296 if (r) {
296 dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", 297 dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
@@ -633,7 +634,15 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
633 mutex_init(&vm->mutex); 634 mutex_init(&vm->mutex);
634 INIT_LIST_HEAD(&vm->list); 635 INIT_LIST_HEAD(&vm->list);
635 INIT_LIST_HEAD(&vm->va); 636 INIT_LIST_HEAD(&vm->va);
636 vm->last_pfn = 0; 637 /* SI requires equal sized PTs for all VMs, so always set
638 * last_pfn to max_pfn. cayman allows variable sized
639 * pts so we can grow then as needed. Once we switch
640 * to two level pts we can unify this again.
641 */
642 if (rdev->family >= CHIP_TAHITI)
643 vm->last_pfn = rdev->vm_manager.max_pfn;
644 else
645 vm->last_pfn = 0;
637 /* map the ib pool buffer at 0 in virtual address space, set 646 /* map the ib pool buffer at 0 in virtual address space, set
638 * read only 647 * read only
639 */ 648 */
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index f28bd4b7ef98..21ec9f5653ce 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -292,6 +292,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data,
292int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, 292int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
293 struct drm_file *filp) 293 struct drm_file *filp)
294{ 294{
295 struct radeon_device *rdev = dev->dev_private;
295 struct drm_radeon_gem_busy *args = data; 296 struct drm_radeon_gem_busy *args = data;
296 struct drm_gem_object *gobj; 297 struct drm_gem_object *gobj;
297 struct radeon_bo *robj; 298 struct radeon_bo *robj;
@@ -317,13 +318,14 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
317 break; 318 break;
318 } 319 }
319 drm_gem_object_unreference_unlocked(gobj); 320 drm_gem_object_unreference_unlocked(gobj);
320 r = radeon_gem_handle_lockup(robj->rdev, r); 321 r = radeon_gem_handle_lockup(rdev, r);
321 return r; 322 return r;
322} 323}
323 324
324int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, 325int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
325 struct drm_file *filp) 326 struct drm_file *filp)
326{ 327{
328 struct radeon_device *rdev = dev->dev_private;
327 struct drm_radeon_gem_wait_idle *args = data; 329 struct drm_radeon_gem_wait_idle *args = data;
328 struct drm_gem_object *gobj; 330 struct drm_gem_object *gobj;
329 struct radeon_bo *robj; 331 struct radeon_bo *robj;
@@ -336,10 +338,10 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
336 robj = gem_to_radeon_bo(gobj); 338 robj = gem_to_radeon_bo(gobj);
337 r = radeon_bo_wait(robj, NULL, false); 339 r = radeon_bo_wait(robj, NULL, false);
338 /* callback hw specific functions if any */ 340 /* callback hw specific functions if any */
339 if (robj->rdev->asic->ioctl_wait_idle) 341 if (rdev->asic->ioctl_wait_idle)
340 robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); 342 robj->rdev->asic->ioctl_wait_idle(rdev, robj);
341 drm_gem_object_unreference_unlocked(gobj); 343 drm_gem_object_unreference_unlocked(gobj);
342 r = radeon_gem_handle_lockup(robj->rdev, r); 344 r = radeon_gem_handle_lockup(rdev, r);
343 return r; 345 return r;
344} 346}
345 347
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 08825548ee69..5b37e283ec38 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -801,9 +801,13 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
801 int i; 801 int i;
802 802
803 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 803 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
804 not_processed += radeon_fence_count_emitted(rdev, i); 804 struct radeon_ring *ring = &rdev->ring[i];
805 if (not_processed >= 3) 805
806 break; 806 if (ring->ready) {
807 not_processed += radeon_fence_count_emitted(rdev, i);
808 if (not_processed >= 3)
809 break;
810 }
807 } 811 }
808 812
809 if (not_processed >= 3) { /* should upclock */ 813 if (not_processed >= 3) { /* should upclock */
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
index 8ddab4c76710..6bef46ace831 100644
--- a/drivers/gpu/drm/radeon/radeon_prime.c
+++ b/drivers/gpu/drm/radeon/radeon_prime.c
@@ -169,11 +169,17 @@ struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
169 struct radeon_bo *bo = gem_to_radeon_bo(obj); 169 struct radeon_bo *bo = gem_to_radeon_bo(obj);
170 int ret = 0; 170 int ret = 0;
171 171
172 ret = radeon_bo_reserve(bo, false);
173 if (unlikely(ret != 0))
174 return ERR_PTR(ret);
175
172 /* pin buffer into GTT */ 176 /* pin buffer into GTT */
173 ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL); 177 ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
174 if (ret) 178 if (ret) {
179 radeon_bo_unreserve(bo);
175 return ERR_PTR(ret); 180 return ERR_PTR(ret);
176 181 }
182 radeon_bo_unreserve(bo);
177 return dma_buf_export(bo, &radeon_dmabuf_ops, obj->size, flags); 183 return dma_buf_export(bo, &radeon_dmabuf_ops, obj->size, flags);
178} 184}
179 185
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 4ad0281fdc37..b4f51c569c36 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -616,6 +616,9 @@ static void rv770_gpu_init(struct radeon_device *rdev)
616 ACK_FLUSH_CTL(3) | 616 ACK_FLUSH_CTL(3) |
617 SYNC_FLUSH_CTL)); 617 SYNC_FLUSH_CTL));
618 618
619 if (rdev->family != CHIP_RV770)
620 WREG32(SMX_SAR_CTL0, 0x00003f3f);
621
619 db_debug3 = RREG32(DB_DEBUG3); 622 db_debug3 = RREG32(DB_DEBUG3);
620 db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f); 623 db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f);
621 switch (rdev->family) { 624 switch (rdev->family) {
@@ -792,7 +795,7 @@ static void rv770_gpu_init(struct radeon_device *rdev)
792 795
793 WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA | 796 WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
794 NUM_CLIP_SEQ(3))); 797 NUM_CLIP_SEQ(3)));
795 798 WREG32(VC_ENHANCE, 0);
796} 799}
797 800
798void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) 801void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h
index fdc089896011..b0adfc595d75 100644
--- a/drivers/gpu/drm/radeon/rv770d.h
+++ b/drivers/gpu/drm/radeon/rv770d.h
@@ -211,6 +211,7 @@
211#define SCRATCH_UMSK 0x8540 211#define SCRATCH_UMSK 0x8540
212#define SCRATCH_ADDR 0x8544 212#define SCRATCH_ADDR 0x8544
213 213
214#define SMX_SAR_CTL0 0xA008
214#define SMX_DC_CTL0 0xA020 215#define SMX_DC_CTL0 0xA020
215#define USE_HASH_FUNCTION (1 << 0) 216#define USE_HASH_FUNCTION (1 << 0)
216#define CACHE_DEPTH(x) ((x) << 1) 217#define CACHE_DEPTH(x) ((x) << 1)
@@ -310,6 +311,8 @@
310#define TCP_CNTL 0x9610 311#define TCP_CNTL 0x9610
311#define TCP_CHAN_STEER 0x9614 312#define TCP_CHAN_STEER 0x9614
312 313
314#define VC_ENHANCE 0x9714
315
313#define VGT_CACHE_INVALIDATION 0x88C4 316#define VGT_CACHE_INVALIDATION 0x88C4
314#define CACHE_INVALIDATION(x) ((x)<<0) 317#define CACHE_INVALIDATION(x) ((x)<<0)
315#define VC_ONLY 0 318#define VC_ONLY 0
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index c7b61f16ecfd..0b0279291a73 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2365,12 +2365,12 @@ int si_pcie_gart_enable(struct radeon_device *rdev)
2365 WREG32(0x15DC, 0); 2365 WREG32(0x15DC, 0);
2366 2366
2367 /* empty context1-15 */ 2367 /* empty context1-15 */
2368 /* FIXME start with 1G, once using 2 level pt switch to full 2368 /* FIXME start with 4G, once using 2 level pt switch to full
2369 * vm size space 2369 * vm size space
2370 */ 2370 */
2371 /* set vm size, must be a multiple of 4 */ 2371 /* set vm size, must be a multiple of 4 */
2372 WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); 2372 WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0);
2373 WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, (1 << 30) / RADEON_GPU_PAGE_SIZE); 2373 WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn);
2374 for (i = 1; i < 16; i++) { 2374 for (i = 1; i < 16; i++) {
2375 if (i < 8) 2375 if (i < 8)
2376 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), 2376 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
diff --git a/drivers/gpu/drm/radeon/si_reg.h b/drivers/gpu/drm/radeon/si_reg.h
index eda938a7cb6e..501f9d431d57 100644
--- a/drivers/gpu/drm/radeon/si_reg.h
+++ b/drivers/gpu/drm/radeon/si_reg.h
@@ -30,4 +30,76 @@
30#define SI_DC_GPIO_HPD_EN 0x65b8 30#define SI_DC_GPIO_HPD_EN 0x65b8
31#define SI_DC_GPIO_HPD_Y 0x65bc 31#define SI_DC_GPIO_HPD_Y 0x65bc
32 32
33#define SI_GRPH_CONTROL 0x6804
34# define SI_GRPH_DEPTH(x) (((x) & 0x3) << 0)
35# define SI_GRPH_DEPTH_8BPP 0
36# define SI_GRPH_DEPTH_16BPP 1
37# define SI_GRPH_DEPTH_32BPP 2
38# define SI_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2)
39# define SI_ADDR_SURF_2_BANK 0
40# define SI_ADDR_SURF_4_BANK 1
41# define SI_ADDR_SURF_8_BANK 2
42# define SI_ADDR_SURF_16_BANK 3
43# define SI_GRPH_Z(x) (((x) & 0x3) << 4)
44# define SI_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6)
45# define SI_ADDR_SURF_BANK_WIDTH_1 0
46# define SI_ADDR_SURF_BANK_WIDTH_2 1
47# define SI_ADDR_SURF_BANK_WIDTH_4 2
48# define SI_ADDR_SURF_BANK_WIDTH_8 3
49# define SI_GRPH_FORMAT(x) (((x) & 0x7) << 8)
50/* 8 BPP */
51# define SI_GRPH_FORMAT_INDEXED 0
52/* 16 BPP */
53# define SI_GRPH_FORMAT_ARGB1555 0
54# define SI_GRPH_FORMAT_ARGB565 1
55# define SI_GRPH_FORMAT_ARGB4444 2
56# define SI_GRPH_FORMAT_AI88 3
57# define SI_GRPH_FORMAT_MONO16 4
58# define SI_GRPH_FORMAT_BGRA5551 5
59/* 32 BPP */
60# define SI_GRPH_FORMAT_ARGB8888 0
61# define SI_GRPH_FORMAT_ARGB2101010 1
62# define SI_GRPH_FORMAT_32BPP_DIG 2
63# define SI_GRPH_FORMAT_8B_ARGB2101010 3
64# define SI_GRPH_FORMAT_BGRA1010102 4
65# define SI_GRPH_FORMAT_8B_BGRA1010102 5
66# define SI_GRPH_FORMAT_RGB111110 6
67# define SI_GRPH_FORMAT_BGR101111 7
68# define SI_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11)
69# define SI_ADDR_SURF_BANK_HEIGHT_1 0
70# define SI_ADDR_SURF_BANK_HEIGHT_2 1
71# define SI_ADDR_SURF_BANK_HEIGHT_4 2
72# define SI_ADDR_SURF_BANK_HEIGHT_8 3
73# define SI_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13)
74# define SI_ADDR_SURF_TILE_SPLIT_64B 0
75# define SI_ADDR_SURF_TILE_SPLIT_128B 1
76# define SI_ADDR_SURF_TILE_SPLIT_256B 2
77# define SI_ADDR_SURF_TILE_SPLIT_512B 3
78# define SI_ADDR_SURF_TILE_SPLIT_1KB 4
79# define SI_ADDR_SURF_TILE_SPLIT_2KB 5
80# define SI_ADDR_SURF_TILE_SPLIT_4KB 6
81# define SI_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18)
82# define SI_ADDR_SURF_MACRO_TILE_ASPECT_1 0
83# define SI_ADDR_SURF_MACRO_TILE_ASPECT_2 1
84# define SI_ADDR_SURF_MACRO_TILE_ASPECT_4 2
85# define SI_ADDR_SURF_MACRO_TILE_ASPECT_8 3
86# define SI_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20)
87# define SI_GRPH_ARRAY_LINEAR_GENERAL 0
88# define SI_GRPH_ARRAY_LINEAR_ALIGNED 1
89# define SI_GRPH_ARRAY_1D_TILED_THIN1 2
90# define SI_GRPH_ARRAY_2D_TILED_THIN1 4
91# define SI_GRPH_PIPE_CONFIG(x) (((x) & 0x1f) << 24)
92# define SI_ADDR_SURF_P2 0
93# define SI_ADDR_SURF_P4_8x16 4
94# define SI_ADDR_SURF_P4_16x16 5
95# define SI_ADDR_SURF_P4_16x32 6
96# define SI_ADDR_SURF_P4_32x32 7
97# define SI_ADDR_SURF_P8_16x16_8x16 8
98# define SI_ADDR_SURF_P8_16x32_8x16 9
99# define SI_ADDR_SURF_P8_32x32_8x16 10
100# define SI_ADDR_SURF_P8_16x32_16x16 11
101# define SI_ADDR_SURF_P8_32x32_16x16 12
102# define SI_ADDR_SURF_P8_32x32_16x32 13
103# define SI_ADDR_SURF_P8_32x64_32x32 14
104
33#endif 105#endif
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 30d98d14b5c5..dd14cd1a0033 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -47,9 +47,9 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
47 if (dev_priv == NULL) 47 if (dev_priv == NULL)
48 return -ENOMEM; 48 return -ENOMEM;
49 49
50 idr_init(&dev_priv->object_idr);
50 dev->dev_private = (void *)dev_priv; 51 dev->dev_private = (void *)dev_priv;
51 dev_priv->chipset = chipset; 52 dev_priv->chipset = chipset;
52 idr_init(&dev->object_name_idr);
53 53
54 return 0; 54 return 0;
55} 55}
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 4d02c46a9420..6e52069894b3 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -13,8 +13,21 @@
13 13
14static struct drm_driver driver; 14static struct drm_driver driver;
15 15
16/*
17 * There are many DisplayLink-based graphics products, all with unique PIDs.
18 * So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff)
19 * We also require a match on SubClass (0x00) and Protocol (0x00),
20 * which is compatible with all known USB 2.0 era graphics chips and firmware,
21 * but allows DisplayLink to increment those for any future incompatible chips
22 */
16static struct usb_device_id id_table[] = { 23static struct usb_device_id id_table[] = {
17 {.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,}, 24 {.idVendor = 0x17e9, .bInterfaceClass = 0xff,
25 .bInterfaceSubClass = 0x00,
26 .bInterfaceProtocol = 0x00,
27 .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
28 USB_DEVICE_ID_MATCH_INT_CLASS |
29 USB_DEVICE_ID_MATCH_INT_SUBCLASS |
30 USB_DEVICE_ID_MATCH_INT_PROTOCOL,},
18 {}, 31 {},
19}; 32};
20MODULE_DEVICE_TABLE(usb, id_table); 33MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
index a8d5f09428c7..4c2d836a0893 100644
--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -61,7 +61,7 @@ static int udl_parse_vendor_descriptor(struct drm_device *dev,
61 u8 length; 61 u8 length;
62 u16 key; 62 u16 key;
63 63
64 key = *((u16 *) desc); 64 key = le16_to_cpu(*((u16 *) desc));
65 desc += sizeof(u16); 65 desc += sizeof(u16);
66 length = *desc; 66 length = *desc;
67 desc++; 67 desc++;
diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c
index 1f182254e81e..c126182ac07e 100644
--- a/drivers/gpu/drm/via/via_map.c
+++ b/drivers/gpu/drm/via/via_map.c
@@ -100,12 +100,11 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset)
100 if (dev_priv == NULL) 100 if (dev_priv == NULL)
101 return -ENOMEM; 101 return -ENOMEM;
102 102
103 idr_init(&dev_priv->object_idr);
103 dev->dev_private = (void *)dev_priv; 104 dev->dev_private = (void *)dev_priv;
104 105
105 dev_priv->chipset = chipset; 106 dev_priv->chipset = chipset;
106 107
107 idr_init(&dev->object_name_idr);
108
109 pci_set_master(dev->pdev); 108 pci_set_master(dev->pdev);
110 109
111 ret = drm_vblank_init(dev, 1); 110 ret = drm_vblank_init(dev, 1);
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 034c80a10f1f..bef04c192768 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -1,20 +1,11 @@
1# 1#
2# HID driver configuration 2# HID driver configuration
3# 3#
4menuconfig HID_SUPPORT 4menu "HID support"
5 bool "HID Devices" 5 depends on INPUT
6 depends on INPUT
7 default y
8 ---help---
9 Say Y here to get to see options for various computer-human interface
10 device drivers. This option alone does not add any kernel code.
11
12 If you say N, all options in this submenu will be skipped and disabled.
13
14if HID_SUPPORT
15 6
16config HID 7config HID
17 tristate "Generic HID support" 8 tristate "HID bus support"
18 depends on INPUT 9 depends on INPUT
19 default y 10 default y
20 ---help--- 11 ---help---
@@ -23,14 +14,17 @@ config HID
23 most commonly used to refer to the USB-HID specification, but other 14 most commonly used to refer to the USB-HID specification, but other
24 devices (such as, but not strictly limited to, Bluetooth) are 15 devices (such as, but not strictly limited to, Bluetooth) are
25 designed using HID specification (this involves certain keyboards, 16 designed using HID specification (this involves certain keyboards,
26 mice, tablets, etc). This option compiles into kernel the generic 17 mice, tablets, etc). This option adds the HID bus to the kernel,
27 HID layer code (parser, usages, etc.), which can then be used by 18 together with generic HID layer code. The HID devices are added and
28 transport-specific HID implementation (like USB or Bluetooth). 19 removed from the HID bus by the transport-layer drivers, such as
20 usbhid (USB_HID) and hidp (BT_HIDP).
29 21
30 For docs and specs, see http://www.usb.org/developers/hidpage/ 22 For docs and specs, see http://www.usb.org/developers/hidpage/
31 23
32 If unsure, say Y. 24 If unsure, say Y.
33 25
26if HID
27
34config HID_BATTERY_STRENGTH 28config HID_BATTERY_STRENGTH
35 bool "Battery level reporting for HID devices" 29 bool "Battery level reporting for HID devices"
36 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY 30 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY
@@ -59,23 +53,22 @@ config HIDRAW
59 53
60 If unsure, say Y. 54 If unsure, say Y.
61 55
62source "drivers/hid/usbhid/Kconfig"
63
64menu "Special HID drivers"
65 depends on HID
66
67config HID_GENERIC 56config HID_GENERIC
68 tristate "Generic HID driver" 57 tristate "Generic HID driver"
69 depends on HID 58 depends on HID
70 default y 59 default HID
71 ---help--- 60 ---help---
72 Support for generic HID devices. 61 Support for generic devices on the HID bus. This includes most
62 keyboards and mice, joysticks, tablets and digitizers.
73 63
74 To compile this driver as a module, choose M here: the module 64 To compile this driver as a module, choose M here: the module
75 will be called hid-generic. 65 will be called hid-generic.
76 66
77 If unsure, say Y. 67 If unsure, say Y.
78 68
69menu "Special HID drivers"
70 depends on HID
71
79config HID_A4TECH 72config HID_A4TECH
80 tristate "A4 tech mice" if EXPERT 73 tristate "A4 tech mice" if EXPERT
81 depends on USB_HID 74 depends on USB_HID
@@ -662,4 +655,8 @@ config HID_ZYDACRON
662 655
663endmenu 656endmenu
664 657
665endif # HID_SUPPORT 658endif # HID
659
660source "drivers/hid/usbhid/Kconfig"
661
662endmenu
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8e3a6b261477..6ac0286b5375 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1880,6 +1880,7 @@ static const struct hid_device_id hid_ignore_list[] = {
1880 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, 1880 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)},
1881 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, 1881 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)},
1882 { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, 1882 { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) },
1883 { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) },
1883 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, 1884 { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
1884 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, 1885 { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
1885 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, 1886 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 9373f535dfe9..d1cdd2d28409 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -160,6 +160,9 @@
160#define USB_VENDOR_ID_AVERMEDIA 0x07ca 160#define USB_VENDOR_ID_AVERMEDIA 0x07ca
161#define USB_DEVICE_ID_AVER_FM_MR800 0xb800 161#define USB_DEVICE_ID_AVER_FM_MR800 0xb800
162 162
163#define USB_VENDOR_ID_AXENTIA 0x12cf
164#define USB_DEVICE_ID_AXENTIA_FM_RADIO 0x7111
165
163#define USB_VENDOR_ID_BAANTO 0x2453 166#define USB_VENDOR_ID_BAANTO 0x2453
164#define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 167#define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100
165 168
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 5e8a7ed42344..0f9c146fc00d 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -436,27 +436,37 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
436 436
437static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) 437static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
438{ 438{
439 struct dj_report dj_report; 439 struct dj_report *dj_report;
440 int retval;
440 441
441 memset(&dj_report, 0, sizeof(dj_report)); 442 dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
442 dj_report.report_id = REPORT_ID_DJ_SHORT; 443 if (!dj_report)
443 dj_report.device_index = 0xFF; 444 return -ENOMEM;
444 dj_report.report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES; 445 dj_report->report_id = REPORT_ID_DJ_SHORT;
445 return logi_dj_recv_send_report(djrcv_dev, &dj_report); 446 dj_report->device_index = 0xFF;
447 dj_report->report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES;
448 retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
449 kfree(dj_report);
450 return retval;
446} 451}
447 452
448static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, 453static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
449 unsigned timeout) 454 unsigned timeout)
450{ 455{
451 struct dj_report dj_report; 456 struct dj_report *dj_report;
457 int retval;
452 458
453 memset(&dj_report, 0, sizeof(dj_report)); 459 dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
454 dj_report.report_id = REPORT_ID_DJ_SHORT; 460 if (!dj_report)
455 dj_report.device_index = 0xFF; 461 return -ENOMEM;
456 dj_report.report_type = REPORT_TYPE_CMD_SWITCH; 462 dj_report->report_id = REPORT_ID_DJ_SHORT;
457 dj_report.report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; 463 dj_report->device_index = 0xFF;
458 dj_report.report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; 464 dj_report->report_type = REPORT_TYPE_CMD_SWITCH;
459 return logi_dj_recv_send_report(djrcv_dev, &dj_report); 465 dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
466 dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout;
467 retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
468 kfree(dj_report);
469 return retval;
460} 470}
461 471
462 472
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 7cf3ffe4b7bc..40ac6654f1d1 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -426,8 +426,10 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
426 __set_bit(EV_ABS, input->evbit); 426 __set_bit(EV_ABS, input->evbit);
427 427
428 input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); 428 input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0);
429 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 4, 0); 429 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
430 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255, 4, 0); 430 4, 0);
431 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2,
432 4, 0);
431 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); 433 input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
432 434
433 /* Note: Touch Y position from the device is inverted relative 435 /* Note: Touch Y position from the device is inverted relative
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 0f20fd17cf06..0108c5991a04 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -1,13 +1,13 @@
1comment "USB Input Devices" 1menu "USB HID support"
2 depends on USB 2 depends on USB
3 3
4config USB_HID 4config USB_HID
5 tristate "USB Human Interface Device (full HID) support" 5 tristate "USB HID transport layer"
6 default y 6 default y
7 depends on USB && INPUT 7 depends on USB && INPUT
8 select HID 8 select HID
9 ---help--- 9 ---help---
10 Say Y here if you want full HID support to connect USB keyboards, 10 Say Y here if you want to connect USB keyboards,
11 mice, joysticks, graphic tablets, or any other HID based devices 11 mice, joysticks, graphic tablets, or any other HID based devices
12 to your computer via USB, as well as Uninterruptible Power Supply 12 to your computer via USB, as well as Uninterruptible Power Supply
13 (UPS) and monitor control devices. 13 (UPS) and monitor control devices.
@@ -81,4 +81,4 @@ config USB_MOUSE
81 81
82endmenu 82endmenu
83 83
84 84endmenu
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index f082e48ab113..2cde9ecf7731 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * Based on hdaps.c driver: 9 * Based on hdaps.c driver:
10 * Copyright (C) 2005 Robert Love <rml@novell.com> 10 * Copyright (C) 2005 Robert Love <rml@novell.com>
11 * Copyright (C) 2005 Jesper Juhl <jesper.juhl@gmail.com> 11 * Copyright (C) 2005 Jesper Juhl <jj@chaosbits.net>
12 * 12 *
13 * Fan control based on smcFanControl: 13 * Fan control based on smcFanControl:
14 * Copyright (C) 2006 Hendrik Holtmann <holtmann@mac.com> 14 * Copyright (C) 2006 Hendrik Holtmann <holtmann@mac.com>
@@ -215,7 +215,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
215 int i; 215 int i;
216 216
217 if (send_command(cmd) || send_argument(key)) { 217 if (send_command(cmd) || send_argument(key)) {
218 pr_warn("%s: read arg fail\n", key); 218 pr_warn("%.4s: read arg fail\n", key);
219 return -EIO; 219 return -EIO;
220 } 220 }
221 221
@@ -223,7 +223,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
223 223
224 for (i = 0; i < len; i++) { 224 for (i = 0; i < len; i++) {
225 if (__wait_status(0x05)) { 225 if (__wait_status(0x05)) {
226 pr_warn("%s: read data fail\n", key); 226 pr_warn("%.4s: read data fail\n", key);
227 return -EIO; 227 return -EIO;
228 } 228 }
229 buffer[i] = inb(APPLESMC_DATA_PORT); 229 buffer[i] = inb(APPLESMC_DATA_PORT);
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index b9d512331ed4..637c51c11b44 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -191,6 +191,24 @@ static ssize_t show_temp(struct device *dev,
191 return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN; 191 return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN;
192} 192}
193 193
194struct tjmax {
195 char const *id;
196 int tjmax;
197};
198
199static struct tjmax __cpuinitconst tjmax_table[] = {
200 { "CPU D410", 100000 },
201 { "CPU D425", 100000 },
202 { "CPU D510", 100000 },
203 { "CPU D525", 100000 },
204 { "CPU N450", 100000 },
205 { "CPU N455", 100000 },
206 { "CPU N470", 100000 },
207 { "CPU N475", 100000 },
208 { "CPU 230", 100000 },
209 { "CPU 330", 125000 },
210};
211
194static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, 212static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
195 struct device *dev) 213 struct device *dev)
196{ 214{
@@ -202,6 +220,13 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
202 int err; 220 int err;
203 u32 eax, edx; 221 u32 eax, edx;
204 struct pci_dev *host_bridge; 222 struct pci_dev *host_bridge;
223 int i;
224
225 /* explicit tjmax table entries override heuristics */
226 for (i = 0; i < ARRAY_SIZE(tjmax_table); i++) {
227 if (strstr(c->x86_model_id, tjmax_table[i].id))
228 return tjmax_table[i].tjmax;
229 }
205 230
206 /* Early chips have no MSR for TjMax */ 231 /* Early chips have no MSR for TjMax */
207 232
@@ -210,7 +235,8 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
210 235
211 /* Atom CPUs */ 236 /* Atom CPUs */
212 237
213 if (c->x86_model == 0x1c) { 238 if (c->x86_model == 0x1c || c->x86_model == 0x26
239 || c->x86_model == 0x27) {
214 usemsr_ee = 0; 240 usemsr_ee = 0;
215 241
216 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); 242 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
@@ -223,6 +249,9 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
223 tjmax = 90000; 249 tjmax = 90000;
224 250
225 pci_dev_put(host_bridge); 251 pci_dev_put(host_bridge);
252 } else if (c->x86_model == 0x36) {
253 usemsr_ee = 0;
254 tjmax = 100000;
226 } 255 }
227 256
228 if (c->x86_model > 0xe && usemsr_ee) { 257 if (c->x86_model > 0xe && usemsr_ee) {
@@ -664,7 +693,7 @@ static void __cpuinit get_core_online(unsigned int cpu)
664 * sensors. We check this bit only, all the early CPUs 693 * sensors. We check this bit only, all the early CPUs
665 * without thermal sensors will be filtered out. 694 * without thermal sensors will be filtered out.
666 */ 695 */
667 if (!cpu_has(c, X86_FEATURE_DTS)) 696 if (!cpu_has(c, X86_FEATURE_DTHERM))
668 return; 697 return;
669 698
670 if (!pdev) { 699 if (!pdev) {
@@ -765,14 +794,14 @@ static struct notifier_block coretemp_cpu_notifier __refdata = {
765}; 794};
766 795
767static const struct x86_cpu_id coretemp_ids[] = { 796static const struct x86_cpu_id coretemp_ids[] = {
768 { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTS }, 797 { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTHERM },
769 {} 798 {}
770}; 799};
771MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); 800MODULE_DEVICE_TABLE(x86cpu, coretemp_ids);
772 801
773static int __init coretemp_init(void) 802static int __init coretemp_init(void)
774{ 803{
775 int i, err = -ENODEV; 804 int i, err;
776 805
777 /* 806 /*
778 * CPUID.06H.EAX[0] indicates whether the CPU has thermal 807 * CPUID.06H.EAX[0] indicates whether the CPU has thermal
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
index 9691f664c76e..e7d234b59312 100644
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -451,11 +451,15 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
451 data->fan_rpm_control = true; 451 data->fan_rpm_control = true;
452 break; 452 break;
453 default: 453 default:
454 mutex_unlock(&data->update_lock); 454 count = -EINVAL;
455 return -EINVAL; 455 goto err;
456 } 456 }
457 457
458 read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg); 458 result = read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg);
459 if (result) {
460 count = result;
461 goto err;
462 }
459 463
460 if (data->fan_rpm_control) 464 if (data->fan_rpm_control)
461 conf_reg |= 0x80; 465 conf_reg |= 0x80;
@@ -463,7 +467,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
463 conf_reg &= ~0x80; 467 conf_reg &= ~0x80;
464 468
465 i2c_smbus_write_byte_data(client, REG_FAN_CONF1, conf_reg); 469 i2c_smbus_write_byte_data(client, REG_FAN_CONF1, conf_reg);
466 470err:
467 mutex_unlock(&data->update_lock); 471 mutex_unlock(&data->update_lock);
468 return count; 472 return count;
469} 473}
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index a9bfd6736d9a..e72ba5d2a824 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -590,6 +590,6 @@ abort:
590 590
591module_i2c_driver(jc42_driver); 591module_i2c_driver(jc42_driver);
592 592
593MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); 593MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>");
594MODULE_DESCRIPTION("JC42 driver"); 594MODULE_DESCRIPTION("JC42 driver");
595MODULE_LICENSE("GPL"); 595MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c
index d264937c7f5e..bd75d2415432 100644
--- a/drivers/hwmon/lineage-pem.c
+++ b/drivers/hwmon/lineage-pem.c
@@ -567,6 +567,6 @@ static struct i2c_driver pem_driver = {
567 567
568module_i2c_driver(pem_driver); 568module_i2c_driver(pem_driver);
569 569
570MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); 570MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>");
571MODULE_DESCRIPTION("Lineage CPL PEM hardware monitoring driver"); 571MODULE_DESCRIPTION("Lineage CPL PEM hardware monitoring driver");
572MODULE_LICENSE("GPL"); 572MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/ltc4261.c b/drivers/hwmon/ltc4261.c
index 069b7d34d8f9..77476a575c4e 100644
--- a/drivers/hwmon/ltc4261.c
+++ b/drivers/hwmon/ltc4261.c
@@ -292,6 +292,6 @@ static struct i2c_driver ltc4261_driver = {
292 292
293module_i2c_driver(ltc4261_driver); 293module_i2c_driver(ltc4261_driver);
294 294
295MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); 295MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>");
296MODULE_DESCRIPTION("LTC4261 driver"); 296MODULE_DESCRIPTION("LTC4261 driver");
297MODULE_LICENSE("GPL"); 297MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c
index 822261be84dd..019427d7a5fd 100644
--- a/drivers/hwmon/max16065.c
+++ b/drivers/hwmon/max16065.c
@@ -692,6 +692,6 @@ static struct i2c_driver max16065_driver = {
692 692
693module_i2c_driver(max16065_driver); 693module_i2c_driver(max16065_driver);
694 694
695MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); 695MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>");
696MODULE_DESCRIPTION("MAX16065 driver"); 696MODULE_DESCRIPTION("MAX16065 driver");
697MODULE_LICENSE("GPL"); 697MODULE_LICENSE("GPL");
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index 56eecefcec75..2ec93da41e2c 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -8,8 +8,7 @@ menuconfig IIO
8 help 8 help
9 The industrial I/O subsystem provides a unified framework for 9 The industrial I/O subsystem provides a unified framework for
10 drivers for many different types of embedded sensors using a 10 drivers for many different types of embedded sensors using a
11 number of different physical interfaces (i2c, spi, etc). See 11 number of different physical interfaces (i2c, spi, etc).
12 Documentation/iio for more information.
13 12
14if IIO 13if IIO
15 14
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 1ddd8861c71b..4f947e4377ef 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -661,7 +661,6 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)
661 * New channel registration method - relies on the fact a group does 661 * New channel registration method - relies on the fact a group does
662 * not need to be initialized if it is name is NULL. 662 * not need to be initialized if it is name is NULL.
663 */ 663 */
664 INIT_LIST_HEAD(&indio_dev->channel_attr_list);
665 if (indio_dev->channels) 664 if (indio_dev->channels)
666 for (i = 0; i < indio_dev->num_channels; i++) { 665 for (i = 0; i < indio_dev->num_channels; i++) {
667 ret = iio_device_add_channel_sysfs(indio_dev, 666 ret = iio_device_add_channel_sysfs(indio_dev,
@@ -725,12 +724,16 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
725static void iio_dev_release(struct device *device) 724static void iio_dev_release(struct device *device)
726{ 725{
727 struct iio_dev *indio_dev = dev_to_iio_dev(device); 726 struct iio_dev *indio_dev = dev_to_iio_dev(device);
728 cdev_del(&indio_dev->chrdev); 727 if (indio_dev->chrdev.dev)
728 cdev_del(&indio_dev->chrdev);
729 if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) 729 if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
730 iio_device_unregister_trigger_consumer(indio_dev); 730 iio_device_unregister_trigger_consumer(indio_dev);
731 iio_device_unregister_eventset(indio_dev); 731 iio_device_unregister_eventset(indio_dev);
732 iio_device_unregister_sysfs(indio_dev); 732 iio_device_unregister_sysfs(indio_dev);
733 iio_device_unregister_debugfs(indio_dev); 733 iio_device_unregister_debugfs(indio_dev);
734
735 ida_simple_remove(&iio_ida, indio_dev->id);
736 kfree(indio_dev);
734} 737}
735 738
736static struct device_type iio_dev_type = { 739static struct device_type iio_dev_type = {
@@ -761,6 +764,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
761 dev_set_drvdata(&dev->dev, (void *)dev); 764 dev_set_drvdata(&dev->dev, (void *)dev);
762 mutex_init(&dev->mlock); 765 mutex_init(&dev->mlock);
763 mutex_init(&dev->info_exist_lock); 766 mutex_init(&dev->info_exist_lock);
767 INIT_LIST_HEAD(&dev->channel_attr_list);
764 768
765 dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); 769 dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
766 if (dev->id < 0) { 770 if (dev->id < 0) {
@@ -778,10 +782,8 @@ EXPORT_SYMBOL(iio_device_alloc);
778 782
779void iio_device_free(struct iio_dev *dev) 783void iio_device_free(struct iio_dev *dev)
780{ 784{
781 if (dev) { 785 if (dev)
782 ida_simple_remove(&iio_ida, dev->id); 786 put_device(&dev->dev);
783 kfree(dev);
784 }
785} 787}
786EXPORT_SYMBOL(iio_device_free); 788EXPORT_SYMBOL(iio_device_free);
787 789
@@ -902,7 +904,7 @@ void iio_device_unregister(struct iio_dev *indio_dev)
902 mutex_lock(&indio_dev->info_exist_lock); 904 mutex_lock(&indio_dev->info_exist_lock);
903 indio_dev->info = NULL; 905 indio_dev->info = NULL;
904 mutex_unlock(&indio_dev->info_exist_lock); 906 mutex_unlock(&indio_dev->info_exist_lock);
905 device_unregister(&indio_dev->dev); 907 device_del(&indio_dev->dev);
906} 908}
907EXPORT_SYMBOL(iio_device_unregister); 909EXPORT_SYMBOL(iio_device_unregister);
908subsys_initcall(iio_init); 910subsys_initcall(iio_init);
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 55d5642eb10a..2e826f9702c6 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1184,7 +1184,7 @@ static void cma_set_req_event_data(struct rdma_cm_event *event,
1184 1184
1185static int cma_check_req_qp_type(struct rdma_cm_id *id, struct ib_cm_event *ib_event) 1185static int cma_check_req_qp_type(struct rdma_cm_id *id, struct ib_cm_event *ib_event)
1186{ 1186{
1187 return (((ib_event->event == IB_CM_REQ_RECEIVED) || 1187 return (((ib_event->event == IB_CM_REQ_RECEIVED) &&
1188 (ib_event->param.req_rcvd.qp_type == id->qp_type)) || 1188 (ib_event->param.req_rcvd.qp_type == id->qp_type)) ||
1189 ((ib_event->event == IB_CM_SIDR_REQ_RECEIVED) && 1189 ((ib_event->event == IB_CM_SIDR_REQ_RECEIVED) &&
1190 (id->qp_type == IB_QPT_UD)) || 1190 (id->qp_type == IB_QPT_UD)) ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h
index 037f5cea85bd..48970af23679 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma.h
@@ -61,6 +61,7 @@ struct ocrdma_dev_attr {
61 u32 max_inline_data; 61 u32 max_inline_data;
62 int max_send_sge; 62 int max_send_sge;
63 int max_recv_sge; 63 int max_recv_sge;
64 int max_srq_sge;
64 int max_mr; 65 int max_mr;
65 u64 max_mr_size; 66 u64 max_mr_size;
66 u32 max_num_mr_pbl; 67 u32 max_num_mr_pbl;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 9343a1522977..71942af4fce9 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -990,8 +990,6 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev,
990 struct ocrdma_dev_attr *attr, 990 struct ocrdma_dev_attr *attr,
991 struct ocrdma_mbx_query_config *rsp) 991 struct ocrdma_mbx_query_config *rsp)
992{ 992{
993 int max_q_mem;
994
995 attr->max_pd = 993 attr->max_pd =
996 (rsp->max_pd_ca_ack_delay & OCRDMA_MBX_QUERY_CFG_MAX_PD_MASK) >> 994 (rsp->max_pd_ca_ack_delay & OCRDMA_MBX_QUERY_CFG_MAX_PD_MASK) >>
997 OCRDMA_MBX_QUERY_CFG_MAX_PD_SHIFT; 995 OCRDMA_MBX_QUERY_CFG_MAX_PD_SHIFT;
@@ -1004,6 +1002,9 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev,
1004 attr->max_recv_sge = (rsp->max_write_send_sge & 1002 attr->max_recv_sge = (rsp->max_write_send_sge &
1005 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >> 1003 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >>
1006 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT; 1004 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT;
1005 attr->max_srq_sge = (rsp->max_srq_rqe_sge &
1006 OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK) >>
1007 OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET;
1007 attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp & 1008 attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp &
1008 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >> 1009 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >>
1009 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT; 1010 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT;
@@ -1037,18 +1038,15 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev,
1037 attr->max_inline_data = 1038 attr->max_inline_data =
1038 attr->wqe_size - (sizeof(struct ocrdma_hdr_wqe) + 1039 attr->wqe_size - (sizeof(struct ocrdma_hdr_wqe) +
1039 sizeof(struct ocrdma_sge)); 1040 sizeof(struct ocrdma_sge));
1040 max_q_mem = OCRDMA_Q_PAGE_BASE_SIZE << (OCRDMA_MAX_Q_PAGE_SIZE_CNT - 1);
1041 /* hw can queue one less then the configured size,
1042 * so publish less by one to stack.
1043 */
1044 if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { 1041 if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
1045 dev->attr.max_wqe = max_q_mem / dev->attr.wqe_size;
1046 attr->ird = 1; 1042 attr->ird = 1;
1047 attr->ird_page_size = OCRDMA_MIN_Q_PAGE_SIZE; 1043 attr->ird_page_size = OCRDMA_MIN_Q_PAGE_SIZE;
1048 attr->num_ird_pages = MAX_OCRDMA_IRD_PAGES; 1044 attr->num_ird_pages = MAX_OCRDMA_IRD_PAGES;
1049 } else 1045 }
1050 dev->attr.max_wqe = (max_q_mem / dev->attr.wqe_size) - 1; 1046 dev->attr.max_wqe = rsp->max_wqes_rqes_per_q >>
1051 dev->attr.max_rqe = (max_q_mem / dev->attr.rqe_size) - 1; 1047 OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET;
1048 dev->attr.max_rqe = rsp->max_wqes_rqes_per_q &
1049 OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK;
1052} 1050}
1053 1051
1054static int ocrdma_check_fw_config(struct ocrdma_dev *dev, 1052static int ocrdma_check_fw_config(struct ocrdma_dev *dev,
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 04fef3de6d75..b050e629e9c3 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -97,13 +97,11 @@ static void ocrdma_build_sgid_mac(union ib_gid *sgid, unsigned char *mac_addr,
97 sgid->raw[15] = mac_addr[5]; 97 sgid->raw[15] = mac_addr[5];
98} 98}
99 99
100static void ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, 100static bool ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr,
101 bool is_vlan, u16 vlan_id) 101 bool is_vlan, u16 vlan_id)
102{ 102{
103 int i; 103 int i;
104 bool found = false;
105 union ib_gid new_sgid; 104 union ib_gid new_sgid;
106 int free_idx = OCRDMA_MAX_SGID;
107 unsigned long flags; 105 unsigned long flags;
108 106
109 memset(&ocrdma_zero_sgid, 0, sizeof(union ib_gid)); 107 memset(&ocrdma_zero_sgid, 0, sizeof(union ib_gid));
@@ -115,23 +113,19 @@ static void ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr,
115 if (!memcmp(&dev->sgid_tbl[i], &ocrdma_zero_sgid, 113 if (!memcmp(&dev->sgid_tbl[i], &ocrdma_zero_sgid,
116 sizeof(union ib_gid))) { 114 sizeof(union ib_gid))) {
117 /* found free entry */ 115 /* found free entry */
118 if (!found) { 116 memcpy(&dev->sgid_tbl[i], &new_sgid,
119 free_idx = i; 117 sizeof(union ib_gid));
120 found = true; 118 spin_unlock_irqrestore(&dev->sgid_lock, flags);
121 break; 119 return true;
122 }
123 } else if (!memcmp(&dev->sgid_tbl[i], &new_sgid, 120 } else if (!memcmp(&dev->sgid_tbl[i], &new_sgid,
124 sizeof(union ib_gid))) { 121 sizeof(union ib_gid))) {
125 /* entry already present, no addition is required. */ 122 /* entry already present, no addition is required. */
126 spin_unlock_irqrestore(&dev->sgid_lock, flags); 123 spin_unlock_irqrestore(&dev->sgid_lock, flags);
127 return; 124 return false;
128 } 125 }
129 } 126 }
130 /* if entry doesn't exist and if table has some space, add entry */
131 if (found)
132 memcpy(&dev->sgid_tbl[free_idx], &new_sgid,
133 sizeof(union ib_gid));
134 spin_unlock_irqrestore(&dev->sgid_lock, flags); 127 spin_unlock_irqrestore(&dev->sgid_lock, flags);
128 return false;
135} 129}
136 130
137static bool ocrdma_del_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, 131static bool ocrdma_del_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr,
@@ -167,7 +161,8 @@ static void ocrdma_add_default_sgid(struct ocrdma_dev *dev)
167 ocrdma_get_guid(dev, &sgid->raw[8]); 161 ocrdma_get_guid(dev, &sgid->raw[8]);
168} 162}
169 163
170static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) 164#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
165static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev)
171{ 166{
172 struct net_device *netdev, *tmp; 167 struct net_device *netdev, *tmp;
173 u16 vlan_id; 168 u16 vlan_id;
@@ -175,8 +170,6 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev)
175 170
176 netdev = dev->nic_info.netdev; 171 netdev = dev->nic_info.netdev;
177 172
178 ocrdma_add_default_sgid(dev);
179
180 rcu_read_lock(); 173 rcu_read_lock();
181 for_each_netdev_rcu(&init_net, tmp) { 174 for_each_netdev_rcu(&init_net, tmp) {
182 if (netdev == tmp || vlan_dev_real_dev(tmp) == netdev) { 175 if (netdev == tmp || vlan_dev_real_dev(tmp) == netdev) {
@@ -194,10 +187,23 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev)
194 } 187 }
195 } 188 }
196 rcu_read_unlock(); 189 rcu_read_unlock();
190}
191#else
192static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev)
193{
194
195}
196#endif /* VLAN */
197
198static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev)
199{
200 ocrdma_add_default_sgid(dev);
201 ocrdma_add_vlan_sgids(dev);
197 return 0; 202 return 0;
198} 203}
199 204
200#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 205#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) || \
206defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
201 207
202static int ocrdma_inet6addr_event(struct notifier_block *notifier, 208static int ocrdma_inet6addr_event(struct notifier_block *notifier,
203 unsigned long event, void *ptr) 209 unsigned long event, void *ptr)
@@ -208,6 +214,7 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier,
208 struct ib_event gid_event; 214 struct ib_event gid_event;
209 struct ocrdma_dev *dev; 215 struct ocrdma_dev *dev;
210 bool found = false; 216 bool found = false;
217 bool updated = false;
211 bool is_vlan = false; 218 bool is_vlan = false;
212 u16 vid = 0; 219 u16 vid = 0;
213 220
@@ -233,23 +240,21 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier,
233 mutex_lock(&dev->dev_lock); 240 mutex_lock(&dev->dev_lock);
234 switch (event) { 241 switch (event) {
235 case NETDEV_UP: 242 case NETDEV_UP:
236 ocrdma_add_sgid(dev, netdev->dev_addr, is_vlan, vid); 243 updated = ocrdma_add_sgid(dev, netdev->dev_addr, is_vlan, vid);
237 break; 244 break;
238 case NETDEV_DOWN: 245 case NETDEV_DOWN:
239 found = ocrdma_del_sgid(dev, netdev->dev_addr, is_vlan, vid); 246 updated = ocrdma_del_sgid(dev, netdev->dev_addr, is_vlan, vid);
240 if (found) {
241 /* found the matching entry, notify
242 * the consumers about it
243 */
244 gid_event.device = &dev->ibdev;
245 gid_event.element.port_num = 1;
246 gid_event.event = IB_EVENT_GID_CHANGE;
247 ib_dispatch_event(&gid_event);
248 }
249 break; 247 break;
250 default: 248 default:
251 break; 249 break;
252 } 250 }
251 if (updated) {
252 /* GID table updated, notify the consumers about it */
253 gid_event.device = &dev->ibdev;
254 gid_event.element.port_num = 1;
255 gid_event.event = IB_EVENT_GID_CHANGE;
256 ib_dispatch_event(&gid_event);
257 }
253 mutex_unlock(&dev->dev_lock); 258 mutex_unlock(&dev->dev_lock);
254 return NOTIFY_OK; 259 return NOTIFY_OK;
255} 260}
@@ -258,7 +263,7 @@ static struct notifier_block ocrdma_inet6addr_notifier = {
258 .notifier_call = ocrdma_inet6addr_event 263 .notifier_call = ocrdma_inet6addr_event
259}; 264};
260 265
261#endif /* IPV6 */ 266#endif /* IPV6 and VLAN */
262 267
263static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device, 268static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device,
264 u8 port_num) 269 u8 port_num)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h
index 7fd80cc0f037..c75cbdfa87e7 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h
@@ -418,6 +418,9 @@ enum {
418 418
419 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0, 419 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0,
420 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF, 420 OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF,
421 OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT = 16,
422 OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_MASK = 0xFFFF <<
423 OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT,
421 424
422 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0, 425 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0,
423 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF, 426 OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF,
@@ -458,7 +461,7 @@ enum {
458 OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET, 461 OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET,
459 OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET = 0, 462 OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET = 0,
460 OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK = 0xFFFF << 463 OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK = 0xFFFF <<
461 OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET, 464 OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET,
462 465
463 OCRDMA_MBX_QUERY_CFG_MAX_CQ_OFFSET = 16, 466 OCRDMA_MBX_QUERY_CFG_MAX_CQ_OFFSET = 16,
464 OCRDMA_MBX_QUERY_CFG_MAX_CQ_MASK = 0xFFFF << 467 OCRDMA_MBX_QUERY_CFG_MAX_CQ_MASK = 0xFFFF <<
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index d16d172b6b6b..2e2e7aecc990 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -53,7 +53,7 @@ int ocrdma_query_gid(struct ib_device *ibdev, u8 port,
53 53
54 dev = get_ocrdma_dev(ibdev); 54 dev = get_ocrdma_dev(ibdev);
55 memset(sgid, 0, sizeof(*sgid)); 55 memset(sgid, 0, sizeof(*sgid));
56 if (index > OCRDMA_MAX_SGID) 56 if (index >= OCRDMA_MAX_SGID)
57 return -EINVAL; 57 return -EINVAL;
58 58
59 memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid)); 59 memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid));
@@ -83,8 +83,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr)
83 IB_DEVICE_SHUTDOWN_PORT | 83 IB_DEVICE_SHUTDOWN_PORT |
84 IB_DEVICE_SYS_IMAGE_GUID | 84 IB_DEVICE_SYS_IMAGE_GUID |
85 IB_DEVICE_LOCAL_DMA_LKEY; 85 IB_DEVICE_LOCAL_DMA_LKEY;
86 attr->max_sge = dev->attr.max_send_sge; 86 attr->max_sge = min(dev->attr.max_send_sge, dev->attr.max_srq_sge);
87 attr->max_sge_rd = dev->attr.max_send_sge; 87 attr->max_sge_rd = 0;
88 attr->max_cq = dev->attr.max_cq; 88 attr->max_cq = dev->attr.max_cq;
89 attr->max_cqe = dev->attr.max_cqe; 89 attr->max_cqe = dev->attr.max_cqe;
90 attr->max_mr = dev->attr.max_mr; 90 attr->max_mr = dev->attr.max_mr;
@@ -97,7 +97,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr)
97 min(dev->attr.max_ord_per_qp, dev->attr.max_ird_per_qp); 97 min(dev->attr.max_ord_per_qp, dev->attr.max_ird_per_qp);
98 attr->max_qp_init_rd_atom = dev->attr.max_ord_per_qp; 98 attr->max_qp_init_rd_atom = dev->attr.max_ord_per_qp;
99 attr->max_srq = (dev->attr.max_qp - 1); 99 attr->max_srq = (dev->attr.max_qp - 1);
100 attr->max_srq_sge = attr->max_sge; 100 attr->max_srq_sge = attr->max_srq_sge;
101 attr->max_srq_wr = dev->attr.max_rqe; 101 attr->max_srq_wr = dev->attr.max_rqe;
102 attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; 102 attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay;
103 attr->max_fast_reg_page_list_len = 0; 103 attr->max_fast_reg_page_list_len = 0;
@@ -2301,8 +2301,10 @@ static bool ocrdma_poll_err_rcqe(struct ocrdma_qp *qp, struct ocrdma_cqe *cqe,
2301 *stop = true; 2301 *stop = true;
2302 expand = false; 2302 expand = false;
2303 } 2303 }
2304 } else 2304 } else {
2305 *polled = true;
2305 expand = ocrdma_update_err_rcqe(ibwc, cqe, qp, status); 2306 expand = ocrdma_update_err_rcqe(ibwc, cqe, qp, status);
2307 }
2306 return expand; 2308 return expand;
2307} 2309}
2308 2310
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c
index 57d19d4e0a2d..c96653b58867 100644
--- a/drivers/input/joystick/as5011.c
+++ b/drivers/input/joystick/as5011.c
@@ -282,7 +282,8 @@ static int __devinit as5011_probe(struct i2c_client *client,
282 282
283 error = request_threaded_irq(as5011->button_irq, 283 error = request_threaded_irq(as5011->button_irq,
284 NULL, as5011_button_interrupt, 284 NULL, as5011_button_interrupt,
285 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 285 IRQF_TRIGGER_RISING |
286 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
286 "as5011_button", as5011); 287 "as5011_button", as5011);
287 if (error < 0) { 288 if (error < 0) {
288 dev_err(&client->dev, 289 dev_err(&client->dev,
@@ -296,7 +297,7 @@ static int __devinit as5011_probe(struct i2c_client *client,
296 297
297 error = request_threaded_irq(as5011->axis_irq, NULL, 298 error = request_threaded_irq(as5011->axis_irq, NULL,
298 as5011_axis_interrupt, 299 as5011_axis_interrupt,
299 plat_data->axis_irqflags, 300 plat_data->axis_irqflags | IRQF_ONESHOT,
300 "as5011_joystick", as5011); 301 "as5011_joystick", as5011);
301 if (error) { 302 if (error) {
302 dev_err(&client->dev, 303 dev_err(&client->dev,
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c
index 64a0ca4c92f3..0d77f6c84950 100644
--- a/drivers/input/keyboard/mcs_touchkey.c
+++ b/drivers/input/keyboard/mcs_touchkey.c
@@ -178,7 +178,8 @@ static int __devinit mcs_touchkey_probe(struct i2c_client *client,
178 } 178 }
179 179
180 error = request_threaded_irq(client->irq, NULL, mcs_touchkey_interrupt, 180 error = request_threaded_irq(client->irq, NULL, mcs_touchkey_interrupt,
181 IRQF_TRIGGER_FALLING, client->dev.driver->name, data); 181 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
182 client->dev.driver->name, data);
182 if (error) { 183 if (error) {
183 dev_err(&client->dev, "Failed to register interrupt\n"); 184 dev_err(&client->dev, "Failed to register interrupt\n");
184 goto err_free_mem; 185 goto err_free_mem;
diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index caa218a51b5a..7613f1cac951 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -248,7 +248,7 @@ static int __devinit mpr_touchkey_probe(struct i2c_client *client,
248 248
249 error = request_threaded_irq(client->irq, NULL, 249 error = request_threaded_irq(client->irq, NULL,
250 mpr_touchkey_interrupt, 250 mpr_touchkey_interrupt,
251 IRQF_TRIGGER_FALLING, 251 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
252 client->dev.driver->name, mpr121); 252 client->dev.driver->name, mpr121);
253 if (error) { 253 if (error) {
254 dev_err(&client->dev, "Failed to register interrupt\n"); 254 dev_err(&client->dev, "Failed to register interrupt\n");
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c
index 0b7b2f891752..ca68f2992d72 100644
--- a/drivers/input/keyboard/qt1070.c
+++ b/drivers/input/keyboard/qt1070.c
@@ -201,7 +201,8 @@ static int __devinit qt1070_probe(struct i2c_client *client,
201 msleep(QT1070_RESET_TIME); 201 msleep(QT1070_RESET_TIME);
202 202
203 err = request_threaded_irq(client->irq, NULL, qt1070_interrupt, 203 err = request_threaded_irq(client->irq, NULL, qt1070_interrupt,
204 IRQF_TRIGGER_NONE, client->dev.driver->name, data); 204 IRQF_TRIGGER_NONE | IRQF_ONESHOT,
205 client->dev.driver->name, data);
205 if (err) { 206 if (err) {
206 dev_err(&client->dev, "fail to request irq\n"); 207 dev_err(&client->dev, "fail to request irq\n");
207 goto err_free_mem; 208 goto err_free_mem;
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c
index 3afea3f89718..c355cdde8d22 100644
--- a/drivers/input/keyboard/tca6416-keypad.c
+++ b/drivers/input/keyboard/tca6416-keypad.c
@@ -278,7 +278,8 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client,
278 278
279 error = request_threaded_irq(chip->irqnum, NULL, 279 error = request_threaded_irq(chip->irqnum, NULL,
280 tca6416_keys_isr, 280 tca6416_keys_isr,
281 IRQF_TRIGGER_FALLING, 281 IRQF_TRIGGER_FALLING |
282 IRQF_ONESHOT,
282 "tca6416-keypad", chip); 283 "tca6416-keypad", chip);
283 if (error) { 284 if (error) {
284 dev_dbg(&client->dev, 285 dev_dbg(&client->dev,
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c
index 5f87b28b3192..893869b29ed9 100644
--- a/drivers/input/keyboard/tca8418_keypad.c
+++ b/drivers/input/keyboard/tca8418_keypad.c
@@ -360,7 +360,7 @@ static int __devinit tca8418_keypad_probe(struct i2c_client *client,
360 client->irq = gpio_to_irq(client->irq); 360 client->irq = gpio_to_irq(client->irq);
361 361
362 error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, 362 error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler,
363 IRQF_TRIGGER_FALLING, 363 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
364 client->name, keypad_data); 364 client->name, keypad_data);
365 if (error) { 365 if (error) {
366 dev_dbg(&client->dev, 366 dev_dbg(&client->dev,
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c
index a4a445fb7020..4c34f21fbe2d 100644
--- a/drivers/input/keyboard/tnetv107x-keypad.c
+++ b/drivers/input/keyboard/tnetv107x-keypad.c
@@ -227,15 +227,15 @@ static int __devinit keypad_probe(struct platform_device *pdev)
227 goto error_clk; 227 goto error_clk;
228 } 228 }
229 229
230 error = request_threaded_irq(kp->irq_press, NULL, keypad_irq, 0, 230 error = request_threaded_irq(kp->irq_press, NULL, keypad_irq,
231 dev_name(dev), kp); 231 IRQF_ONESHOT, dev_name(dev), kp);
232 if (error < 0) { 232 if (error < 0) {
233 dev_err(kp->dev, "Could not allocate keypad press key irq\n"); 233 dev_err(kp->dev, "Could not allocate keypad press key irq\n");
234 goto error_irq_press; 234 goto error_irq_press;
235 } 235 }
236 236
237 error = request_threaded_irq(kp->irq_release, NULL, keypad_irq, 0, 237 error = request_threaded_irq(kp->irq_release, NULL, keypad_irq,
238 dev_name(dev), kp); 238 IRQF_ONESHOT, dev_name(dev), kp);
239 if (error < 0) { 239 if (error < 0) {
240 dev_err(kp->dev, "Could not allocate keypad release key irq\n"); 240 dev_err(kp->dev, "Could not allocate keypad release key irq\n");
241 goto error_irq_release; 241 goto error_irq_release;
diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c
index 0ac75bbad4d6..2e5d5e1de647 100644
--- a/drivers/input/misc/ad714x.c
+++ b/drivers/input/misc/ad714x.c
@@ -972,6 +972,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
972 struct ad714x_platform_data *plat_data = dev->platform_data; 972 struct ad714x_platform_data *plat_data = dev->platform_data;
973 struct ad714x_chip *ad714x; 973 struct ad714x_chip *ad714x;
974 void *drv_mem; 974 void *drv_mem;
975 unsigned long irqflags;
975 976
976 struct ad714x_button_drv *bt_drv; 977 struct ad714x_button_drv *bt_drv;
977 struct ad714x_slider_drv *sd_drv; 978 struct ad714x_slider_drv *sd_drv;
@@ -1162,10 +1163,11 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
1162 alloc_idx++; 1163 alloc_idx++;
1163 } 1164 }
1164 1165
1166 irqflags = plat_data->irqflags ?: IRQF_TRIGGER_FALLING;
1167 irqflags |= IRQF_ONESHOT;
1168
1165 error = request_threaded_irq(ad714x->irq, NULL, ad714x_interrupt_thread, 1169 error = request_threaded_irq(ad714x->irq, NULL, ad714x_interrupt_thread,
1166 plat_data->irqflags ? 1170 irqflags, "ad714x_captouch", ad714x);
1167 plat_data->irqflags : IRQF_TRIGGER_FALLING,
1168 "ad714x_captouch", ad714x);
1169 if (error) { 1171 if (error) {
1170 dev_err(dev, "can't allocate irq %d\n", ad714x->irq); 1172 dev_err(dev, "can't allocate irq %d\n", ad714x->irq);
1171 goto err_unreg_dev; 1173 goto err_unreg_dev;
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c
index 35083c6836c3..c1313d8535c3 100644
--- a/drivers/input/misc/dm355evm_keys.c
+++ b/drivers/input/misc/dm355evm_keys.c
@@ -213,7 +213,8 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev)
213 /* REVISIT: flush the event queue? */ 213 /* REVISIT: flush the event queue? */
214 214
215 status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq, 215 status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq,
216 IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), keys); 216 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
217 dev_name(&pdev->dev), keys);
217 if (status < 0) 218 if (status < 0)
218 goto fail2; 219 goto fail2;
219 220
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index cad5602d3ce4..8b31473a81fe 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -216,7 +216,7 @@ static void wacom_retrieve_report_data(struct usb_interface *intf,
216 216
217 rep_data[0] = 12; 217 rep_data[0] = 12;
218 result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, 218 result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
219 rep_data[0], &rep_data, 2, 219 rep_data[0], rep_data, 2,
220 WAC_MSG_RETRIES); 220 WAC_MSG_RETRIES);
221 221
222 if (result >= 0 && rep_data[1] > 2) 222 if (result >= 0 && rep_data[1] > 2)
@@ -401,7 +401,9 @@ static int wacom_parse_hid(struct usb_interface *intf,
401 break; 401 break;
402 402
403 case HID_USAGE_CONTACTMAX: 403 case HID_USAGE_CONTACTMAX:
404 wacom_retrieve_report_data(intf, features); 404 /* leave touch_max as is if predefined */
405 if (!features->touch_max)
406 wacom_retrieve_report_data(intf, features);
405 i++; 407 i++;
406 break; 408 break;
407 } 409 }
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index e2482b40da51..bd4eb4277697 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -597,7 +597,7 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
597 AD7879_TMR(ts->pen_down_acc_interval); 597 AD7879_TMR(ts->pen_down_acc_interval);
598 598
599 err = request_threaded_irq(ts->irq, NULL, ad7879_irq, 599 err = request_threaded_irq(ts->irq, NULL, ad7879_irq,
600 IRQF_TRIGGER_FALLING, 600 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
601 dev_name(dev), ts); 601 dev_name(dev), ts);
602 if (err) { 602 if (err) {
603 dev_err(dev, "irq %d busy?\n", ts->irq); 603 dev_err(dev, "irq %d busy?\n", ts->irq);
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 42e645062c20..25fd0561a17d 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1149,7 +1149,8 @@ static int __devinit mxt_probe(struct i2c_client *client,
1149 goto err_free_object; 1149 goto err_free_object;
1150 1150
1151 error = request_threaded_irq(client->irq, NULL, mxt_interrupt, 1151 error = request_threaded_irq(client->irq, NULL, mxt_interrupt,
1152 pdata->irqflags, client->dev.driver->name, data); 1152 pdata->irqflags | IRQF_ONESHOT,
1153 client->dev.driver->name, data);
1153 if (error) { 1154 if (error) {
1154 dev_err(&client->dev, "Failed to register interrupt\n"); 1155 dev_err(&client->dev, "Failed to register interrupt\n");
1155 goto err_free_object; 1156 goto err_free_object;
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index f2d03c06c2da..5c487d23f11c 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -509,7 +509,8 @@ static int __devinit bu21013_probe(struct i2c_client *client,
509 input_set_drvdata(in_dev, bu21013_data); 509 input_set_drvdata(in_dev, bu21013_data);
510 510
511 error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, 511 error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq,
512 IRQF_TRIGGER_FALLING | IRQF_SHARED, 512 IRQF_TRIGGER_FALLING | IRQF_SHARED |
513 IRQF_ONESHOT,
513 DRIVER_TP, bu21013_data); 514 DRIVER_TP, bu21013_data);
514 if (error) { 515 if (error) {
515 dev_err(&client->dev, "request irq %d failed\n", pdata->irq); 516 dev_err(&client->dev, "request irq %d failed\n", pdata->irq);
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 237753ad1031..464f1bf4b61d 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -251,7 +251,8 @@ static int __devinit cy8ctmg110_probe(struct i2c_client *client,
251 } 251 }
252 252
253 err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread, 253 err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread,
254 IRQF_TRIGGER_RISING, "touch_reset_key", ts); 254 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
255 "touch_reset_key", ts);
255 if (err < 0) { 256 if (err < 0) {
256 dev_err(&client->dev, 257 dev_err(&client->dev,
257 "irq %d busy? error %d\n", client->irq, err); 258 "irq %d busy? error %d\n", client->irq, err);
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c
index 3cd7a837f82b..cf299377fc49 100644
--- a/drivers/input/touchscreen/intel-mid-touch.c
+++ b/drivers/input/touchscreen/intel-mid-touch.c
@@ -620,7 +620,7 @@ static int __devinit mrstouch_probe(struct platform_device *pdev)
620 MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); 620 MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0);
621 621
622 err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq, 622 err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq,
623 0, "mrstouch", tsdev); 623 IRQF_ONESHOT, "mrstouch", tsdev);
624 if (err) { 624 if (err) {
625 dev_err(tsdev->dev, "unable to allocate irq\n"); 625 dev_err(tsdev->dev, "unable to allocate irq\n");
626 goto err_free_mem; 626 goto err_free_mem;
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 72f6ba3a4709..953b4c105cad 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -165,7 +165,7 @@ static int __devinit pixcir_i2c_ts_probe(struct i2c_client *client,
165 input_set_drvdata(input, tsdata); 165 input_set_drvdata(input, tsdata);
166 166
167 error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, 167 error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr,
168 IRQF_TRIGGER_FALLING, 168 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
169 client->name, tsdata); 169 client->name, tsdata);
170 if (error) { 170 if (error) {
171 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); 171 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c
index 7e7488097359..368d2c6cf780 100644
--- a/drivers/input/touchscreen/tnetv107x-ts.c
+++ b/drivers/input/touchscreen/tnetv107x-ts.c
@@ -297,7 +297,7 @@ static int __devinit tsc_probe(struct platform_device *pdev)
297 goto error_clk; 297 goto error_clk;
298 } 298 }
299 299
300 error = request_threaded_irq(ts->tsc_irq, NULL, tsc_irq, 0, 300 error = request_threaded_irq(ts->tsc_irq, NULL, tsc_irq, IRQF_ONESHOT,
301 dev_name(dev), ts); 301 dev_name(dev), ts);
302 if (error < 0) { 302 if (error < 0) {
303 dev_err(ts->dev, "Could not allocate ts irq\n"); 303 dev_err(ts->dev, "Could not allocate ts irq\n");
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index b6adeaee9cc5..5ce3fa8ce646 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -650,7 +650,8 @@ static int __devinit tsc2005_probe(struct spi_device *spi)
650 tsc2005_stop_scan(ts); 650 tsc2005_stop_scan(ts);
651 651
652 error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread, 652 error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread,
653 IRQF_TRIGGER_RISING, "tsc2005", ts); 653 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
654 "tsc2005", ts);
654 if (error) { 655 if (error) {
655 dev_err(&spi->dev, "Failed to request irq, err: %d\n", error); 656 dev_err(&spi->dev, "Failed to request irq, err: %d\n", error);
656 goto err_free_mem; 657 goto err_free_mem;
diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c
index 41dc76db4311..a019fbb70880 100644
--- a/drivers/leds/ledtrig-heartbeat.c
+++ b/drivers/leds/ledtrig-heartbeat.c
@@ -21,6 +21,8 @@
21#include <linux/reboot.h> 21#include <linux/reboot.h>
22#include "leds.h" 22#include "leds.h"
23 23
24static int panic_heartbeats;
25
24struct heartbeat_trig_data { 26struct heartbeat_trig_data {
25 unsigned int phase; 27 unsigned int phase;
26 unsigned int period; 28 unsigned int period;
@@ -34,6 +36,11 @@ static void led_heartbeat_function(unsigned long data)
34 unsigned long brightness = LED_OFF; 36 unsigned long brightness = LED_OFF;
35 unsigned long delay = 0; 37 unsigned long delay = 0;
36 38
39 if (unlikely(panic_heartbeats)) {
40 led_set_brightness(led_cdev, LED_OFF);
41 return;
42 }
43
37 /* acts like an actual heart beat -- ie thump-thump-pause... */ 44 /* acts like an actual heart beat -- ie thump-thump-pause... */
38 switch (heartbeat_data->phase) { 45 switch (heartbeat_data->phase) {
39 case 0: 46 case 0:
@@ -111,12 +118,19 @@ static int heartbeat_reboot_notifier(struct notifier_block *nb,
111 return NOTIFY_DONE; 118 return NOTIFY_DONE;
112} 119}
113 120
121static int heartbeat_panic_notifier(struct notifier_block *nb,
122 unsigned long code, void *unused)
123{
124 panic_heartbeats = 1;
125 return NOTIFY_DONE;
126}
127
114static struct notifier_block heartbeat_reboot_nb = { 128static struct notifier_block heartbeat_reboot_nb = {
115 .notifier_call = heartbeat_reboot_notifier, 129 .notifier_call = heartbeat_reboot_notifier,
116}; 130};
117 131
118static struct notifier_block heartbeat_panic_nb = { 132static struct notifier_block heartbeat_panic_nb = {
119 .notifier_call = heartbeat_reboot_notifier, 133 .notifier_call = heartbeat_panic_notifier,
120}; 134};
121 135
122static int __init heartbeat_trig_init(void) 136static int __init heartbeat_trig_init(void)
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 37fdaf81bd1f..ce59824fb414 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2292,6 +2292,13 @@ static int process_reserve_metadata_snap_mesg(unsigned argc, char **argv, struct
2292 if (r) 2292 if (r)
2293 return r; 2293 return r;
2294 2294
2295 r = dm_pool_commit_metadata(pool->pmd);
2296 if (r) {
2297 DMERR("%s: dm_pool_commit_metadata() failed, error = %d",
2298 __func__, r);
2299 return r;
2300 }
2301
2295 r = dm_pool_reserve_metadata_snap(pool->pmd); 2302 r = dm_pool_reserve_metadata_snap(pool->pmd);
2296 if (r) 2303 if (r)
2297 DMWARN("reserve_metadata_snap message failed."); 2304 DMWARN("reserve_metadata_snap message failed.");
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1c2f9048e1ae..a4c219e3c859 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5784,8 +5784,7 @@ static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info)
5784 super_types[mddev->major_version]. 5784 super_types[mddev->major_version].
5785 validate_super(mddev, rdev); 5785 validate_super(mddev, rdev);
5786 if ((info->state & (1<<MD_DISK_SYNC)) && 5786 if ((info->state & (1<<MD_DISK_SYNC)) &&
5787 (!test_bit(In_sync, &rdev->flags) || 5787 rdev->raid_disk != info->raid_disk) {
5788 rdev->raid_disk != info->raid_disk)) {
5789 /* This was a hot-add request, but events doesn't 5788 /* This was a hot-add request, but events doesn't
5790 * match, so reject it. 5789 * match, so reject it.
5791 */ 5790 */
@@ -6751,7 +6750,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev
6751 thread->tsk = kthread_run(md_thread, thread, 6750 thread->tsk = kthread_run(md_thread, thread,
6752 "%s_%s", 6751 "%s_%s",
6753 mdname(thread->mddev), 6752 mdname(thread->mddev),
6754 name ?: mddev->pers->name); 6753 name);
6755 if (IS_ERR(thread->tsk)) { 6754 if (IS_ERR(thread->tsk)) {
6756 kfree(thread); 6755 kfree(thread);
6757 return NULL; 6756 return NULL;
@@ -7298,6 +7297,7 @@ void md_do_sync(struct mddev *mddev)
7298 int skipped = 0; 7297 int skipped = 0;
7299 struct md_rdev *rdev; 7298 struct md_rdev *rdev;
7300 char *desc; 7299 char *desc;
7300 struct blk_plug plug;
7301 7301
7302 /* just incase thread restarts... */ 7302 /* just incase thread restarts... */
7303 if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) 7303 if (test_bit(MD_RECOVERY_DONE, &mddev->recovery))
@@ -7447,6 +7447,7 @@ void md_do_sync(struct mddev *mddev)
7447 } 7447 }
7448 mddev->curr_resync_completed = j; 7448 mddev->curr_resync_completed = j;
7449 7449
7450 blk_start_plug(&plug);
7450 while (j < max_sectors) { 7451 while (j < max_sectors) {
7451 sector_t sectors; 7452 sector_t sectors;
7452 7453
@@ -7552,6 +7553,7 @@ void md_do_sync(struct mddev *mddev)
7552 * this also signals 'finished resyncing' to md_stop 7553 * this also signals 'finished resyncing' to md_stop
7553 */ 7554 */
7554 out: 7555 out:
7556 blk_finish_plug(&plug);
7555 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); 7557 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
7556 7558
7557 /* tell personality that we are finished */ 7559 /* tell personality that we are finished */
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 9339e67fcc79..61a1833ebaf3 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev)
474 } 474 }
475 475
476 { 476 {
477 mddev->thread = md_register_thread(multipathd, mddev, NULL); 477 mddev->thread = md_register_thread(multipathd, mddev,
478 "multipath");
478 if (!mddev->thread) { 479 if (!mddev->thread) {
479 printk(KERN_ERR "multipath: couldn't allocate thread" 480 printk(KERN_ERR "multipath: couldn't allocate thread"
480 " for %s\n", mdname(mddev)); 481 " for %s\n", mdname(mddev));
diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c
index 50ed53bf4aa2..fc90c11620ad 100644
--- a/drivers/md/persistent-data/dm-space-map-checker.c
+++ b/drivers/md/persistent-data/dm-space-map-checker.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/device-mapper.h> 9#include <linux/device-mapper.h>
10#include <linux/export.h> 10#include <linux/export.h>
11#include <linux/vmalloc.h>
11 12
12#ifdef CONFIG_DM_DEBUG_SPACE_MAPS 13#ifdef CONFIG_DM_DEBUG_SPACE_MAPS
13 14
@@ -89,13 +90,23 @@ static int ca_create(struct count_array *ca, struct dm_space_map *sm)
89 90
90 ca->nr = nr_blocks; 91 ca->nr = nr_blocks;
91 ca->nr_free = nr_blocks; 92 ca->nr_free = nr_blocks;
92 ca->counts = kzalloc(sizeof(*ca->counts) * nr_blocks, GFP_KERNEL); 93
93 if (!ca->counts) 94 if (!nr_blocks)
94 return -ENOMEM; 95 ca->counts = NULL;
96 else {
97 ca->counts = vzalloc(sizeof(*ca->counts) * nr_blocks);
98 if (!ca->counts)
99 return -ENOMEM;
100 }
95 101
96 return 0; 102 return 0;
97} 103}
98 104
105static void ca_destroy(struct count_array *ca)
106{
107 vfree(ca->counts);
108}
109
99static int ca_load(struct count_array *ca, struct dm_space_map *sm) 110static int ca_load(struct count_array *ca, struct dm_space_map *sm)
100{ 111{
101 int r; 112 int r;
@@ -126,12 +137,14 @@ static int ca_load(struct count_array *ca, struct dm_space_map *sm)
126static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) 137static int ca_extend(struct count_array *ca, dm_block_t extra_blocks)
127{ 138{
128 dm_block_t nr_blocks = ca->nr + extra_blocks; 139 dm_block_t nr_blocks = ca->nr + extra_blocks;
129 uint32_t *counts = kzalloc(sizeof(*counts) * nr_blocks, GFP_KERNEL); 140 uint32_t *counts = vzalloc(sizeof(*counts) * nr_blocks);
130 if (!counts) 141 if (!counts)
131 return -ENOMEM; 142 return -ENOMEM;
132 143
133 memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); 144 if (ca->counts) {
134 kfree(ca->counts); 145 memcpy(counts, ca->counts, sizeof(*counts) * ca->nr);
146 ca_destroy(ca);
147 }
135 ca->nr = nr_blocks; 148 ca->nr = nr_blocks;
136 ca->nr_free += extra_blocks; 149 ca->nr_free += extra_blocks;
137 ca->counts = counts; 150 ca->counts = counts;
@@ -151,11 +164,6 @@ static int ca_commit(struct count_array *old, struct count_array *new)
151 return 0; 164 return 0;
152} 165}
153 166
154static void ca_destroy(struct count_array *ca)
155{
156 kfree(ca->counts);
157}
158
159/*----------------------------------------------------------------*/ 167/*----------------------------------------------------------------*/
160 168
161struct sm_checker { 169struct sm_checker {
@@ -343,25 +351,25 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)
343 int r; 351 int r;
344 struct sm_checker *smc; 352 struct sm_checker *smc;
345 353
346 if (!sm) 354 if (IS_ERR_OR_NULL(sm))
347 return NULL; 355 return ERR_PTR(-EINVAL);
348 356
349 smc = kmalloc(sizeof(*smc), GFP_KERNEL); 357 smc = kmalloc(sizeof(*smc), GFP_KERNEL);
350 if (!smc) 358 if (!smc)
351 return NULL; 359 return ERR_PTR(-ENOMEM);
352 360
353 memcpy(&smc->sm, &ops_, sizeof(smc->sm)); 361 memcpy(&smc->sm, &ops_, sizeof(smc->sm));
354 r = ca_create(&smc->old_counts, sm); 362 r = ca_create(&smc->old_counts, sm);
355 if (r) { 363 if (r) {
356 kfree(smc); 364 kfree(smc);
357 return NULL; 365 return ERR_PTR(r);
358 } 366 }
359 367
360 r = ca_create(&smc->counts, sm); 368 r = ca_create(&smc->counts, sm);
361 if (r) { 369 if (r) {
362 ca_destroy(&smc->old_counts); 370 ca_destroy(&smc->old_counts);
363 kfree(smc); 371 kfree(smc);
364 return NULL; 372 return ERR_PTR(r);
365 } 373 }
366 374
367 smc->real_sm = sm; 375 smc->real_sm = sm;
@@ -371,7 +379,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)
371 ca_destroy(&smc->counts); 379 ca_destroy(&smc->counts);
372 ca_destroy(&smc->old_counts); 380 ca_destroy(&smc->old_counts);
373 kfree(smc); 381 kfree(smc);
374 return NULL; 382 return ERR_PTR(r);
375 } 383 }
376 384
377 r = ca_commit(&smc->old_counts, &smc->counts); 385 r = ca_commit(&smc->old_counts, &smc->counts);
@@ -379,7 +387,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)
379 ca_destroy(&smc->counts); 387 ca_destroy(&smc->counts);
380 ca_destroy(&smc->old_counts); 388 ca_destroy(&smc->old_counts);
381 kfree(smc); 389 kfree(smc);
382 return NULL; 390 return ERR_PTR(r);
383 } 391 }
384 392
385 return &smc->sm; 393 return &smc->sm;
@@ -391,25 +399,25 @@ struct dm_space_map *dm_sm_checker_create_fresh(struct dm_space_map *sm)
391 int r; 399 int r;
392 struct sm_checker *smc; 400 struct sm_checker *smc;
393 401
394 if (!sm) 402 if (IS_ERR_OR_NULL(sm))
395 return NULL; 403 return ERR_PTR(-EINVAL);
396 404
397 smc = kmalloc(sizeof(*smc), GFP_KERNEL); 405 smc = kmalloc(sizeof(*smc), GFP_KERNEL);
398 if (!smc) 406 if (!smc)
399 return NULL; 407 return ERR_PTR(-ENOMEM);
400 408
401 memcpy(&smc->sm, &ops_, sizeof(smc->sm)); 409 memcpy(&smc->sm, &ops_, sizeof(smc->sm));
402 r = ca_create(&smc->old_counts, sm); 410 r = ca_create(&smc->old_counts, sm);
403 if (r) { 411 if (r) {
404 kfree(smc); 412 kfree(smc);
405 return NULL; 413 return ERR_PTR(r);
406 } 414 }
407 415
408 r = ca_create(&smc->counts, sm); 416 r = ca_create(&smc->counts, sm);
409 if (r) { 417 if (r) {
410 ca_destroy(&smc->old_counts); 418 ca_destroy(&smc->old_counts);
411 kfree(smc); 419 kfree(smc);
412 return NULL; 420 return ERR_PTR(r);
413 } 421 }
414 422
415 smc->real_sm = sm; 423 smc->real_sm = sm;
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c
index fc469ba9f627..3d0ed5332883 100644
--- a/drivers/md/persistent-data/dm-space-map-disk.c
+++ b/drivers/md/persistent-data/dm-space-map-disk.c
@@ -290,7 +290,16 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm,
290 dm_block_t nr_blocks) 290 dm_block_t nr_blocks)
291{ 291{
292 struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); 292 struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks);
293 return dm_sm_checker_create_fresh(sm); 293 struct dm_space_map *smc;
294
295 if (IS_ERR_OR_NULL(sm))
296 return sm;
297
298 smc = dm_sm_checker_create_fresh(sm);
299 if (IS_ERR(smc))
300 dm_sm_destroy(sm);
301
302 return smc;
294} 303}
295EXPORT_SYMBOL_GPL(dm_sm_disk_create); 304EXPORT_SYMBOL_GPL(dm_sm_disk_create);
296 305
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c
index 400fe144c0cd..e5604b32d91f 100644
--- a/drivers/md/persistent-data/dm-transaction-manager.c
+++ b/drivers/md/persistent-data/dm-transaction-manager.c
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone);
138 138
139void dm_tm_destroy(struct dm_transaction_manager *tm) 139void dm_tm_destroy(struct dm_transaction_manager *tm)
140{ 140{
141 if (!tm->is_clone)
142 wipe_shadow_table(tm);
143
141 kfree(tm); 144 kfree(tm);
142} 145}
143EXPORT_SYMBOL_GPL(dm_tm_destroy); 146EXPORT_SYMBOL_GPL(dm_tm_destroy);
@@ -344,8 +347,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm,
344 } 347 }
345 348
346 *sm = dm_sm_checker_create(inner); 349 *sm = dm_sm_checker_create(inner);
347 if (!*sm) 350 if (IS_ERR(*sm)) {
351 r = PTR_ERR(*sm);
348 goto bad2; 352 goto bad2;
353 }
349 354
350 } else { 355 } else {
351 r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, 356 r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location,
@@ -364,8 +369,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm,
364 } 369 }
365 370
366 *sm = dm_sm_checker_create(inner); 371 *sm = dm_sm_checker_create(inner);
367 if (!*sm) 372 if (IS_ERR(*sm)) {
373 r = PTR_ERR(*sm);
368 goto bad2; 374 goto bad2;
375 }
369 } 376 }
370 377
371 return 0; 378 return 0;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index a9c7981ddd24..8c2754f835ef 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -517,8 +517,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
517 int bad_sectors; 517 int bad_sectors;
518 518
519 int disk = start_disk + i; 519 int disk = start_disk + i;
520 if (disk >= conf->raid_disks) 520 if (disk >= conf->raid_disks * 2)
521 disk -= conf->raid_disks; 521 disk -= conf->raid_disks * 2;
522 522
523 rdev = rcu_dereference(conf->mirrors[disk].rdev); 523 rdev = rcu_dereference(conf->mirrors[disk].rdev);
524 if (r1_bio->bios[disk] == IO_BLOCKED 524 if (r1_bio->bios[disk] == IO_BLOCKED
@@ -883,7 +883,6 @@ static void make_request(struct mddev *mddev, struct bio * bio)
883 const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); 883 const unsigned long do_sync = (bio->bi_rw & REQ_SYNC);
884 const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); 884 const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA));
885 struct md_rdev *blocked_rdev; 885 struct md_rdev *blocked_rdev;
886 int plugged;
887 int first_clone; 886 int first_clone;
888 int sectors_handled; 887 int sectors_handled;
889 int max_sectors; 888 int max_sectors;
@@ -1034,7 +1033,6 @@ read_again:
1034 * the bad blocks. Each set of writes gets it's own r1bio 1033 * the bad blocks. Each set of writes gets it's own r1bio
1035 * with a set of bios attached. 1034 * with a set of bios attached.
1036 */ 1035 */
1037 plugged = mddev_check_plugged(mddev);
1038 1036
1039 disks = conf->raid_disks * 2; 1037 disks = conf->raid_disks * 2;
1040 retry_write: 1038 retry_write:
@@ -1191,6 +1189,8 @@ read_again:
1191 bio_list_add(&conf->pending_bio_list, mbio); 1189 bio_list_add(&conf->pending_bio_list, mbio);
1192 conf->pending_count++; 1190 conf->pending_count++;
1193 spin_unlock_irqrestore(&conf->device_lock, flags); 1191 spin_unlock_irqrestore(&conf->device_lock, flags);
1192 if (!mddev_check_plugged(mddev))
1193 md_wakeup_thread(mddev->thread);
1194 } 1194 }
1195 /* Mustn't call r1_bio_write_done before this next test, 1195 /* Mustn't call r1_bio_write_done before this next test,
1196 * as it could result in the bio being freed. 1196 * as it could result in the bio being freed.
@@ -1213,9 +1213,6 @@ read_again:
1213 1213
1214 /* In case raid1d snuck in to freeze_array */ 1214 /* In case raid1d snuck in to freeze_array */
1215 wake_up(&conf->wait_barrier); 1215 wake_up(&conf->wait_barrier);
1216
1217 if (do_sync || !bitmap || !plugged)
1218 md_wakeup_thread(mddev->thread);
1219} 1216}
1220 1217
1221static void status(struct seq_file *seq, struct mddev *mddev) 1218static void status(struct seq_file *seq, struct mddev *mddev)
@@ -2621,7 +2618,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
2621 goto abort; 2618 goto abort;
2622 } 2619 }
2623 err = -ENOMEM; 2620 err = -ENOMEM;
2624 conf->thread = md_register_thread(raid1d, mddev, NULL); 2621 conf->thread = md_register_thread(raid1d, mddev, "raid1");
2625 if (!conf->thread) { 2622 if (!conf->thread) {
2626 printk(KERN_ERR 2623 printk(KERN_ERR
2627 "md/raid1:%s: couldn't allocate thread\n", 2624 "md/raid1:%s: couldn't allocate thread\n",
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 99ae6068e456..8da6282254c3 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1039,7 +1039,6 @@ static void make_request(struct mddev *mddev, struct bio * bio)
1039 const unsigned long do_fua = (bio->bi_rw & REQ_FUA); 1039 const unsigned long do_fua = (bio->bi_rw & REQ_FUA);
1040 unsigned long flags; 1040 unsigned long flags;
1041 struct md_rdev *blocked_rdev; 1041 struct md_rdev *blocked_rdev;
1042 int plugged;
1043 int sectors_handled; 1042 int sectors_handled;
1044 int max_sectors; 1043 int max_sectors;
1045 int sectors; 1044 int sectors;
@@ -1239,7 +1238,6 @@ read_again:
1239 * of r10_bios is recored in bio->bi_phys_segments just as with 1238 * of r10_bios is recored in bio->bi_phys_segments just as with
1240 * the read case. 1239 * the read case.
1241 */ 1240 */
1242 plugged = mddev_check_plugged(mddev);
1243 1241
1244 r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ 1242 r10_bio->read_slot = -1; /* make sure repl_bio gets freed */
1245 raid10_find_phys(conf, r10_bio); 1243 raid10_find_phys(conf, r10_bio);
@@ -1396,6 +1394,8 @@ retry_write:
1396 bio_list_add(&conf->pending_bio_list, mbio); 1394 bio_list_add(&conf->pending_bio_list, mbio);
1397 conf->pending_count++; 1395 conf->pending_count++;
1398 spin_unlock_irqrestore(&conf->device_lock, flags); 1396 spin_unlock_irqrestore(&conf->device_lock, flags);
1397 if (!mddev_check_plugged(mddev))
1398 md_wakeup_thread(mddev->thread);
1399 1399
1400 if (!r10_bio->devs[i].repl_bio) 1400 if (!r10_bio->devs[i].repl_bio)
1401 continue; 1401 continue;
@@ -1423,6 +1423,8 @@ retry_write:
1423 bio_list_add(&conf->pending_bio_list, mbio); 1423 bio_list_add(&conf->pending_bio_list, mbio);
1424 conf->pending_count++; 1424 conf->pending_count++;
1425 spin_unlock_irqrestore(&conf->device_lock, flags); 1425 spin_unlock_irqrestore(&conf->device_lock, flags);
1426 if (!mddev_check_plugged(mddev))
1427 md_wakeup_thread(mddev->thread);
1426 } 1428 }
1427 1429
1428 /* Don't remove the bias on 'remaining' (one_write_done) until 1430 /* Don't remove the bias on 'remaining' (one_write_done) until
@@ -1448,9 +1450,6 @@ retry_write:
1448 1450
1449 /* In case raid10d snuck in to freeze_array */ 1451 /* In case raid10d snuck in to freeze_array */
1450 wake_up(&conf->wait_barrier); 1452 wake_up(&conf->wait_barrier);
1451
1452 if (do_sync || !mddev->bitmap || !plugged)
1453 md_wakeup_thread(mddev->thread);
1454} 1453}
1455 1454
1456static void status(struct seq_file *seq, struct mddev *mddev) 1455static void status(struct seq_file *seq, struct mddev *mddev)
@@ -2310,7 +2309,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
2310 if (r10_sync_page_io(rdev, 2309 if (r10_sync_page_io(rdev,
2311 r10_bio->devs[sl].addr + 2310 r10_bio->devs[sl].addr +
2312 sect, 2311 sect,
2313 s<<9, conf->tmppage, WRITE) 2312 s, conf->tmppage, WRITE)
2314 == 0) { 2313 == 0) {
2315 /* Well, this device is dead */ 2314 /* Well, this device is dead */
2316 printk(KERN_NOTICE 2315 printk(KERN_NOTICE
@@ -2349,7 +2348,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
2349 switch (r10_sync_page_io(rdev, 2348 switch (r10_sync_page_io(rdev,
2350 r10_bio->devs[sl].addr + 2349 r10_bio->devs[sl].addr +
2351 sect, 2350 sect,
2352 s<<9, conf->tmppage, 2351 s, conf->tmppage,
2353 READ)) { 2352 READ)) {
2354 case 0: 2353 case 0:
2355 /* Well, this device is dead */ 2354 /* Well, this device is dead */
@@ -2512,7 +2511,7 @@ read_more:
2512 slot = r10_bio->read_slot; 2511 slot = r10_bio->read_slot;
2513 printk_ratelimited( 2512 printk_ratelimited(
2514 KERN_ERR 2513 KERN_ERR
2515 "md/raid10:%s: %s: redirecting" 2514 "md/raid10:%s: %s: redirecting "
2516 "sector %llu to another mirror\n", 2515 "sector %llu to another mirror\n",
2517 mdname(mddev), 2516 mdname(mddev),
2518 bdevname(rdev->bdev, b), 2517 bdevname(rdev->bdev, b),
@@ -2661,7 +2660,8 @@ static void raid10d(struct mddev *mddev)
2661 blk_start_plug(&plug); 2660 blk_start_plug(&plug);
2662 for (;;) { 2661 for (;;) {
2663 2662
2664 flush_pending_writes(conf); 2663 if (atomic_read(&mddev->plug_cnt) == 0)
2664 flush_pending_writes(conf);
2665 2665
2666 spin_lock_irqsave(&conf->device_lock, flags); 2666 spin_lock_irqsave(&conf->device_lock, flags);
2667 if (list_empty(head)) { 2667 if (list_empty(head)) {
@@ -2890,6 +2890,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
2890 /* want to reconstruct this device */ 2890 /* want to reconstruct this device */
2891 rb2 = r10_bio; 2891 rb2 = r10_bio;
2892 sect = raid10_find_virt(conf, sector_nr, i); 2892 sect = raid10_find_virt(conf, sector_nr, i);
2893 if (sect >= mddev->resync_max_sectors) {
2894 /* last stripe is not complete - don't
2895 * try to recover this sector.
2896 */
2897 continue;
2898 }
2893 /* Unless we are doing a full sync, or a replacement 2899 /* Unless we are doing a full sync, or a replacement
2894 * we only need to recover the block if it is set in 2900 * we only need to recover the block if it is set in
2895 * the bitmap 2901 * the bitmap
@@ -3421,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
3421 spin_lock_init(&conf->resync_lock); 3427 spin_lock_init(&conf->resync_lock);
3422 init_waitqueue_head(&conf->wait_barrier); 3428 init_waitqueue_head(&conf->wait_barrier);
3423 3429
3424 conf->thread = md_register_thread(raid10d, mddev, NULL); 3430 conf->thread = md_register_thread(raid10d, mddev, "raid10");
3425 if (!conf->thread) 3431 if (!conf->thread)
3426 goto out; 3432 goto out;
3427 3433
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index d26767246d26..04348d76bb30 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -196,12 +196,14 @@ static void __release_stripe(struct r5conf *conf, struct stripe_head *sh)
196 BUG_ON(!list_empty(&sh->lru)); 196 BUG_ON(!list_empty(&sh->lru));
197 BUG_ON(atomic_read(&conf->active_stripes)==0); 197 BUG_ON(atomic_read(&conf->active_stripes)==0);
198 if (test_bit(STRIPE_HANDLE, &sh->state)) { 198 if (test_bit(STRIPE_HANDLE, &sh->state)) {
199 if (test_bit(STRIPE_DELAYED, &sh->state)) 199 if (test_bit(STRIPE_DELAYED, &sh->state) &&
200 !test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
200 list_add_tail(&sh->lru, &conf->delayed_list); 201 list_add_tail(&sh->lru, &conf->delayed_list);
201 else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && 202 else if (test_bit(STRIPE_BIT_DELAY, &sh->state) &&
202 sh->bm_seq - conf->seq_write > 0) 203 sh->bm_seq - conf->seq_write > 0)
203 list_add_tail(&sh->lru, &conf->bitmap_list); 204 list_add_tail(&sh->lru, &conf->bitmap_list);
204 else { 205 else {
206 clear_bit(STRIPE_DELAYED, &sh->state);
205 clear_bit(STRIPE_BIT_DELAY, &sh->state); 207 clear_bit(STRIPE_BIT_DELAY, &sh->state);
206 list_add_tail(&sh->lru, &conf->handle_list); 208 list_add_tail(&sh->lru, &conf->handle_list);
207 } 209 }
@@ -606,6 +608,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
606 * a chance*/ 608 * a chance*/
607 md_check_recovery(conf->mddev); 609 md_check_recovery(conf->mddev);
608 } 610 }
611 /*
612 * Because md_wait_for_blocked_rdev
613 * will dec nr_pending, we must
614 * increment it first.
615 */
616 atomic_inc(&rdev->nr_pending);
609 md_wait_for_blocked_rdev(rdev, conf->mddev); 617 md_wait_for_blocked_rdev(rdev, conf->mddev);
610 } else { 618 } else {
611 /* Acknowledged bad block - skip the write */ 619 /* Acknowledged bad block - skip the write */
@@ -1737,6 +1745,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
1737 } else { 1745 } else {
1738 const char *bdn = bdevname(rdev->bdev, b); 1746 const char *bdn = bdevname(rdev->bdev, b);
1739 int retry = 0; 1747 int retry = 0;
1748 int set_bad = 0;
1740 1749
1741 clear_bit(R5_UPTODATE, &sh->dev[i].flags); 1750 clear_bit(R5_UPTODATE, &sh->dev[i].flags);
1742 atomic_inc(&rdev->read_errors); 1751 atomic_inc(&rdev->read_errors);
@@ -1748,7 +1757,8 @@ static void raid5_end_read_request(struct bio * bi, int error)
1748 mdname(conf->mddev), 1757 mdname(conf->mddev),
1749 (unsigned long long)s, 1758 (unsigned long long)s,
1750 bdn); 1759 bdn);
1751 else if (conf->mddev->degraded >= conf->max_degraded) 1760 else if (conf->mddev->degraded >= conf->max_degraded) {
1761 set_bad = 1;
1752 printk_ratelimited( 1762 printk_ratelimited(
1753 KERN_WARNING 1763 KERN_WARNING
1754 "md/raid:%s: read error not correctable " 1764 "md/raid:%s: read error not correctable "
@@ -1756,8 +1766,9 @@ static void raid5_end_read_request(struct bio * bi, int error)
1756 mdname(conf->mddev), 1766 mdname(conf->mddev),
1757 (unsigned long long)s, 1767 (unsigned long long)s,
1758 bdn); 1768 bdn);
1759 else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) 1769 } else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) {
1760 /* Oh, no!!! */ 1770 /* Oh, no!!! */
1771 set_bad = 1;
1761 printk_ratelimited( 1772 printk_ratelimited(
1762 KERN_WARNING 1773 KERN_WARNING
1763 "md/raid:%s: read error NOT corrected!! " 1774 "md/raid:%s: read error NOT corrected!! "
@@ -1765,7 +1776,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
1765 mdname(conf->mddev), 1776 mdname(conf->mddev),
1766 (unsigned long long)s, 1777 (unsigned long long)s,
1767 bdn); 1778 bdn);
1768 else if (atomic_read(&rdev->read_errors) 1779 } else if (atomic_read(&rdev->read_errors)
1769 > conf->max_nr_stripes) 1780 > conf->max_nr_stripes)
1770 printk(KERN_WARNING 1781 printk(KERN_WARNING
1771 "md/raid:%s: Too many read errors, failing device %s.\n", 1782 "md/raid:%s: Too many read errors, failing device %s.\n",
@@ -1777,7 +1788,11 @@ static void raid5_end_read_request(struct bio * bi, int error)
1777 else { 1788 else {
1778 clear_bit(R5_ReadError, &sh->dev[i].flags); 1789 clear_bit(R5_ReadError, &sh->dev[i].flags);
1779 clear_bit(R5_ReWrite, &sh->dev[i].flags); 1790 clear_bit(R5_ReWrite, &sh->dev[i].flags);
1780 md_error(conf->mddev, rdev); 1791 if (!(set_bad
1792 && test_bit(In_sync, &rdev->flags)
1793 && rdev_set_badblocks(
1794 rdev, sh->sector, STRIPE_SECTORS, 0)))
1795 md_error(conf->mddev, rdev);
1781 } 1796 }
1782 } 1797 }
1783 rdev_dec_pending(rdev, conf->mddev); 1798 rdev_dec_pending(rdev, conf->mddev);
@@ -3582,8 +3597,18 @@ static void handle_stripe(struct stripe_head *sh)
3582 3597
3583finish: 3598finish:
3584 /* wait for this device to become unblocked */ 3599 /* wait for this device to become unblocked */
3585 if (conf->mddev->external && unlikely(s.blocked_rdev)) 3600 if (unlikely(s.blocked_rdev)) {
3586 md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev); 3601 if (conf->mddev->external)
3602 md_wait_for_blocked_rdev(s.blocked_rdev,
3603 conf->mddev);
3604 else
3605 /* Internal metadata will immediately
3606 * be written by raid5d, so we don't
3607 * need to wait here.
3608 */
3609 rdev_dec_pending(s.blocked_rdev,
3610 conf->mddev);
3611 }
3587 3612
3588 if (s.handle_bad_blocks) 3613 if (s.handle_bad_blocks)
3589 for (i = disks; i--; ) { 3614 for (i = disks; i--; ) {
@@ -3881,8 +3906,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
3881 raid_bio->bi_next = (void*)rdev; 3906 raid_bio->bi_next = (void*)rdev;
3882 align_bi->bi_bdev = rdev->bdev; 3907 align_bi->bi_bdev = rdev->bdev;
3883 align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); 3908 align_bi->bi_flags &= ~(1 << BIO_SEG_VALID);
3884 /* No reshape active, so we can trust rdev->data_offset */
3885 align_bi->bi_sector += rdev->data_offset;
3886 3909
3887 if (!bio_fits_rdev(align_bi) || 3910 if (!bio_fits_rdev(align_bi) ||
3888 is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, 3911 is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,
@@ -3893,6 +3916,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
3893 return 0; 3916 return 0;
3894 } 3917 }
3895 3918
3919 /* No reshape active, so we can trust rdev->data_offset */
3920 align_bi->bi_sector += rdev->data_offset;
3921
3896 spin_lock_irq(&conf->device_lock); 3922 spin_lock_irq(&conf->device_lock);
3897 wait_event_lock_irq(conf->wait_for_stripe, 3923 wait_event_lock_irq(conf->wait_for_stripe,
3898 conf->quiesce == 0, 3924 conf->quiesce == 0,
@@ -3971,7 +3997,6 @@ static void make_request(struct mddev *mddev, struct bio * bi)
3971 struct stripe_head *sh; 3997 struct stripe_head *sh;
3972 const int rw = bio_data_dir(bi); 3998 const int rw = bio_data_dir(bi);
3973 int remaining; 3999 int remaining;
3974 int plugged;
3975 4000
3976 if (unlikely(bi->bi_rw & REQ_FLUSH)) { 4001 if (unlikely(bi->bi_rw & REQ_FLUSH)) {
3977 md_flush_request(mddev, bi); 4002 md_flush_request(mddev, bi);
@@ -3990,7 +4015,6 @@ static void make_request(struct mddev *mddev, struct bio * bi)
3990 bi->bi_next = NULL; 4015 bi->bi_next = NULL;
3991 bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ 4016 bi->bi_phys_segments = 1; /* over-loaded to count active stripes */
3992 4017
3993 plugged = mddev_check_plugged(mddev);
3994 for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { 4018 for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) {
3995 DEFINE_WAIT(w); 4019 DEFINE_WAIT(w);
3996 int previous; 4020 int previous;
@@ -4092,6 +4116,7 @@ static void make_request(struct mddev *mddev, struct bio * bi)
4092 if ((bi->bi_rw & REQ_SYNC) && 4116 if ((bi->bi_rw & REQ_SYNC) &&
4093 !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) 4117 !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
4094 atomic_inc(&conf->preread_active_stripes); 4118 atomic_inc(&conf->preread_active_stripes);
4119 mddev_check_plugged(mddev);
4095 release_stripe(sh); 4120 release_stripe(sh);
4096 } else { 4121 } else {
4097 /* cannot get stripe for read-ahead, just give-up */ 4122 /* cannot get stripe for read-ahead, just give-up */
@@ -4099,10 +4124,7 @@ static void make_request(struct mddev *mddev, struct bio * bi)
4099 finish_wait(&conf->wait_for_overlap, &w); 4124 finish_wait(&conf->wait_for_overlap, &w);
4100 break; 4125 break;
4101 } 4126 }
4102
4103 } 4127 }
4104 if (!plugged)
4105 md_wakeup_thread(mddev->thread);
4106 4128
4107 spin_lock_irq(&conf->device_lock); 4129 spin_lock_irq(&conf->device_lock);
4108 remaining = raid5_dec_bi_phys_segments(bi); 4130 remaining = raid5_dec_bi_phys_segments(bi);
@@ -4823,6 +4845,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
4823 int raid_disk, memory, max_disks; 4845 int raid_disk, memory, max_disks;
4824 struct md_rdev *rdev; 4846 struct md_rdev *rdev;
4825 struct disk_info *disk; 4847 struct disk_info *disk;
4848 char pers_name[6];
4826 4849
4827 if (mddev->new_level != 5 4850 if (mddev->new_level != 5
4828 && mddev->new_level != 4 4851 && mddev->new_level != 4
@@ -4946,7 +4969,8 @@ static struct r5conf *setup_conf(struct mddev *mddev)
4946 printk(KERN_INFO "md/raid:%s: allocated %dkB\n", 4969 printk(KERN_INFO "md/raid:%s: allocated %dkB\n",
4947 mdname(mddev), memory); 4970 mdname(mddev), memory);
4948 4971
4949 conf->thread = md_register_thread(raid5d, mddev, NULL); 4972 sprintf(pers_name, "raid%d", mddev->new_level);
4973 conf->thread = md_register_thread(raid5d, mddev, pers_name);
4950 if (!conf->thread) { 4974 if (!conf->thread) {
4951 printk(KERN_ERR 4975 printk(KERN_ERR
4952 "md/raid:%s: couldn't allocate thread.\n", 4976 "md/raid:%s: couldn't allocate thread.\n",
@@ -5465,10 +5489,9 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
5465 if (rdev->saved_raid_disk >= 0 && 5489 if (rdev->saved_raid_disk >= 0 &&
5466 rdev->saved_raid_disk >= first && 5490 rdev->saved_raid_disk >= first &&
5467 conf->disks[rdev->saved_raid_disk].rdev == NULL) 5491 conf->disks[rdev->saved_raid_disk].rdev == NULL)
5468 disk = rdev->saved_raid_disk; 5492 first = rdev->saved_raid_disk;
5469 else 5493
5470 disk = first; 5494 for (disk = first; disk <= last; disk++) {
5471 for ( ; disk <= last ; disk++) {
5472 p = conf->disks + disk; 5495 p = conf->disks + disk;
5473 if (p->rdev == NULL) { 5496 if (p->rdev == NULL) {
5474 clear_bit(In_sync, &rdev->flags); 5497 clear_bit(In_sync, &rdev->flags);
@@ -5477,8 +5500,11 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
5477 if (rdev->saved_raid_disk != disk) 5500 if (rdev->saved_raid_disk != disk)
5478 conf->fullsync = 1; 5501 conf->fullsync = 1;
5479 rcu_assign_pointer(p->rdev, rdev); 5502 rcu_assign_pointer(p->rdev, rdev);
5480 break; 5503 goto out;
5481 } 5504 }
5505 }
5506 for (disk = first; disk <= last; disk++) {
5507 p = conf->disks + disk;
5482 if (test_bit(WantReplacement, &p->rdev->flags) && 5508 if (test_bit(WantReplacement, &p->rdev->flags) &&
5483 p->replacement == NULL) { 5509 p->replacement == NULL) {
5484 clear_bit(In_sync, &rdev->flags); 5510 clear_bit(In_sync, &rdev->flags);
@@ -5490,6 +5516,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
5490 break; 5516 break;
5491 } 5517 }
5492 } 5518 }
5519out:
5493 print_raid5_conf(conf); 5520 print_raid5_conf(conf);
5494 return err; 5521 return err;
5495} 5522}
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index 7d42c11c8684..0cdbd742974a 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -198,7 +198,6 @@ static int fops_open(struct file *file)
198 struct saa7146_dev *dev = video_drvdata(file); 198 struct saa7146_dev *dev = video_drvdata(file);
199 struct saa7146_fh *fh = NULL; 199 struct saa7146_fh *fh = NULL;
200 int result = 0; 200 int result = 0;
201 enum v4l2_buf_type type;
202 201
203 DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev)); 202 DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev));
204 203
@@ -207,10 +206,6 @@ static int fops_open(struct file *file)
207 206
208 DEB_D("using: %p\n", dev); 207 DEB_D("using: %p\n", dev);
209 208
210 type = vdev->vfl_type == VFL_TYPE_GRABBER
211 ? V4L2_BUF_TYPE_VIDEO_CAPTURE
212 : V4L2_BUF_TYPE_VBI_CAPTURE;
213
214 /* check if an extension is registered */ 209 /* check if an extension is registered */
215 if( NULL == dev->ext ) { 210 if( NULL == dev->ext ) {
216 DEB_S("no extension registered for this device\n"); 211 DEB_S("no extension registered for this device\n");
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
index 98ecaf0900d6..3180f5b2a6a6 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -516,9 +516,9 @@ static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
516 if(cx24110_readreg(state,0x10)&0x40) { 516 if(cx24110_readreg(state,0x10)&0x40) {
517 /* the RS error counter has finished one counting window */ 517 /* the RS error counter has finished one counting window */
518 cx24110_writereg(state,0x10,0x60); /* select the byer reg */ 518 cx24110_writereg(state,0x10,0x60); /* select the byer reg */
519 cx24110_readreg(state, 0x12) | 519 (void)(cx24110_readreg(state, 0x12) |
520 (cx24110_readreg(state, 0x13) << 8) | 520 (cx24110_readreg(state, 0x13) << 8) |
521 (cx24110_readreg(state, 0x14) << 16); 521 (cx24110_readreg(state, 0x14) << 16));
522 cx24110_writereg(state,0x10,0x70); /* select the bler reg */ 522 cx24110_writereg(state,0x10,0x70); /* select the bler reg */
523 state->lastbler=cx24110_readreg(state,0x12)| 523 state->lastbler=cx24110_readreg(state,0x12)|
524 (cx24110_readreg(state,0x13)<<8)| 524 (cx24110_readreg(state,0x13)<<8)|
diff --git a/drivers/media/dvb/frontends/cxd2820r_c.c b/drivers/media/dvb/frontends/cxd2820r_c.c
index 945404991529..ed3b0ba624de 100644
--- a/drivers/media/dvb/frontends/cxd2820r_c.c
+++ b/drivers/media/dvb/frontends/cxd2820r_c.c
@@ -121,7 +121,7 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe)
121 if (ret) 121 if (ret)
122 goto error; 122 goto error;
123 123
124 switch ((buf[0] >> 0) & 0x03) { 124 switch ((buf[0] >> 0) & 0x07) {
125 case 0: 125 case 0:
126 c->modulation = QAM_16; 126 c->modulation = QAM_16;
127 break; 127 break;
diff --git a/drivers/media/dvb/frontends/lg2160.c b/drivers/media/dvb/frontends/lg2160.c
index a3ab1a5b6597..cc11260e99df 100644
--- a/drivers/media/dvb/frontends/lg2160.c
+++ b/drivers/media/dvb/frontends/lg2160.c
@@ -126,7 +126,7 @@ static int lg216x_write_regs(struct lg216x_state *state,
126 126
127 lg_reg("writing %d registers...\n", len); 127 lg_reg("writing %d registers...\n", len);
128 128
129 for (i = 0; i < len - 1; i++) { 129 for (i = 0; i < len; i++) {
130 ret = lg216x_write_reg(state, regs[i].reg, regs[i].val); 130 ret = lg216x_write_reg(state, regs[i].reg, regs[i].val);
131 if (lg_fail(ret)) 131 if (lg_fail(ret))
132 return ret; 132 return ret;
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index 63c004a25e0b..664e460f247b 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -544,6 +544,8 @@ static const struct usb_device_id smsusb_id_table[] __devinitconst = {
544 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, 544 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
545 { USB_DEVICE(0x2040, 0xc0a0), 545 { USB_DEVICE(0x2040, 0xc0a0),
546 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, 546 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
547 { USB_DEVICE(0x2040, 0xf5a0),
548 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
547 { } /* Terminating entry */ 549 { } /* Terminating entry */
548 }; 550 };
549 551
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 740a3d5520c7..b415211d0c4b 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -157,7 +157,7 @@ static int __devinit maxiradio_probe(struct pci_dev *pdev, const struct pci_devi
157 goto err_out_free_region; 157 goto err_out_free_region;
158 158
159 dev->io = pci_resource_start(pdev, 0); 159 dev->io = pci_resource_start(pdev, 0);
160 if (snd_tea575x_init(&dev->tea)) { 160 if (snd_tea575x_init(&dev->tea, THIS_MODULE)) {
161 printk(KERN_ERR "radio-maxiradio: Unable to detect TEA575x tuner\n"); 161 printk(KERN_ERR "radio-maxiradio: Unable to detect TEA575x tuner\n");
162 goto err_out_free_region; 162 goto err_out_free_region;
163 } 163 }
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index 52b8011f1b23..4efcbec74c52 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -238,7 +238,7 @@ static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io)
238 snprintf(fmr2->tea.bus_info, sizeof(fmr2->tea.bus_info), "%s:%s", 238 snprintf(fmr2->tea.bus_info, sizeof(fmr2->tea.bus_info), "%s:%s",
239 fmr2->is_fmd2 ? "PnP" : "ISA", dev_name(pdev)); 239 fmr2->is_fmd2 ? "PnP" : "ISA", dev_name(pdev));
240 240
241 if (snd_tea575x_init(&fmr2->tea)) { 241 if (snd_tea575x_init(&fmr2->tea, THIS_MODULE)) {
242 printk(KERN_ERR "radio-sf16fmr2: Unable to detect TEA575x tuner\n"); 242 printk(KERN_ERR "radio-sf16fmr2: Unable to detect TEA575x tuner\n");
243 release_region(fmr2->io, 2); 243 release_region(fmr2->io, 2);
244 return -ENODEV; 244 return -ENODEV;
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index e9f638761296..f412f7ab270b 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -51,6 +51,8 @@ static struct usb_device_id si470x_usb_driver_id_table[] = {
51 { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) }, 51 { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) },
52 /* Sanei Electric, Inc. FM USB Radio (sold as DealExtreme.com PCear) */ 52 /* Sanei Electric, Inc. FM USB Radio (sold as DealExtreme.com PCear) */
53 { USB_DEVICE_AND_INTERFACE_INFO(0x10c5, 0x819a, USB_CLASS_HID, 0, 0) }, 53 { USB_DEVICE_AND_INTERFACE_INFO(0x10c5, 0x819a, USB_CLASS_HID, 0, 0) },
54 /* Axentia ALERT FM USB Receiver */
55 { USB_DEVICE_AND_INTERFACE_INFO(0x12cf, 0x7111, USB_CLASS_HID, 0, 0) },
54 /* Terminating entry */ 56 /* Terminating entry */
55 { } 57 { }
56}; 58};
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index ff2933ab705f..856ab962cd63 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -371,7 +371,6 @@ struct tvcard bttv_tvcards[] = {
371 .muxsel = MUXSEL(2, 3, 1, 1), 371 .muxsel = MUXSEL(2, 3, 1, 1),
372 .gpiomux = { 2, 0, 0, 0 }, 372 .gpiomux = { 2, 0, 0, 0 },
373 .gpiomute = 10, 373 .gpiomute = 10,
374 .needs_tvaudio = 1,
375 .tuner_type = UNSET, 374 .tuner_type = UNSET,
376 .tuner_addr = ADDR_UNSET, 375 .tuner_addr = ADDR_UNSET,
377 }, 376 },
@@ -384,7 +383,6 @@ struct tvcard bttv_tvcards[] = {
384 .muxsel = MUXSEL(2, 3, 1, 1), 383 .muxsel = MUXSEL(2, 3, 1, 1),
385 .gpiomux = { 0, 1, 2, 3 }, 384 .gpiomux = { 0, 1, 2, 3 },
386 .gpiomute = 4, 385 .gpiomute = 4,
387 .needs_tvaudio = 1,
388 .tuner_type = UNSET, 386 .tuner_type = UNSET,
389 .tuner_addr = ADDR_UNSET, 387 .tuner_addr = ADDR_UNSET,
390 }, 388 },
@@ -398,7 +396,6 @@ struct tvcard bttv_tvcards[] = {
398 .gpiomux = { 4, 0, 2, 3 }, 396 .gpiomux = { 4, 0, 2, 3 },
399 .gpiomute = 1, 397 .gpiomute = 1,
400 .no_msp34xx = 1, 398 .no_msp34xx = 1,
401 .needs_tvaudio = 1,
402 .tuner_type = TUNER_PHILIPS_NTSC, 399 .tuner_type = TUNER_PHILIPS_NTSC,
403 .tuner_addr = ADDR_UNSET, 400 .tuner_addr = ADDR_UNSET,
404 .pll = PLL_28, 401 .pll = PLL_28,
@@ -414,7 +411,6 @@ struct tvcard bttv_tvcards[] = {
414 .gpiomask = 0, 411 .gpiomask = 0,
415 .muxsel = MUXSEL(2, 3, 1, 1), 412 .muxsel = MUXSEL(2, 3, 1, 1),
416 .gpiomux = { 0 }, 413 .gpiomux = { 0 },
417 .needs_tvaudio = 0,
418 .tuner_type = TUNER_ABSENT, 414 .tuner_type = TUNER_ABSENT,
419 .tuner_addr = ADDR_UNSET, 415 .tuner_addr = ADDR_UNSET,
420 }, 416 },
@@ -427,7 +423,6 @@ struct tvcard bttv_tvcards[] = {
427 .muxsel = MUXSEL(2, 3, 1, 0), 423 .muxsel = MUXSEL(2, 3, 1, 0),
428 .gpiomux = { 0, 1, 0, 1 }, 424 .gpiomux = { 0, 1, 0, 1 },
429 .gpiomute = 3, 425 .gpiomute = 3,
430 .needs_tvaudio = 1,
431 .tuner_type = UNSET, 426 .tuner_type = UNSET,
432 .tuner_addr = ADDR_UNSET, 427 .tuner_addr = ADDR_UNSET,
433 }, 428 },
@@ -440,7 +435,6 @@ struct tvcard bttv_tvcards[] = {
440 .gpiomask = 0x0f, 435 .gpiomask = 0x0f,
441 .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, 436 .gpiomux = { 0x0c, 0x04, 0x08, 0x04 },
442 /* 0x04 for some cards ?? */ 437 /* 0x04 for some cards ?? */
443 .needs_tvaudio = 1,
444 .tuner_type = UNSET, 438 .tuner_type = UNSET,
445 .tuner_addr = ADDR_UNSET, 439 .tuner_addr = ADDR_UNSET,
446 .audio_mode_gpio= avermedia_tvphone_audio, 440 .audio_mode_gpio= avermedia_tvphone_audio,
@@ -454,7 +448,6 @@ struct tvcard bttv_tvcards[] = {
454 .gpiomask = 0, 448 .gpiomask = 0,
455 .muxsel = MUXSEL(2, 3, 1, 0, 0), 449 .muxsel = MUXSEL(2, 3, 1, 0, 0),
456 .gpiomux = { 0 }, 450 .gpiomux = { 0 },
457 .needs_tvaudio = 1,
458 .tuner_type = TUNER_ABSENT, 451 .tuner_type = TUNER_ABSENT,
459 .tuner_addr = ADDR_UNSET, 452 .tuner_addr = ADDR_UNSET,
460 }, 453 },
@@ -469,7 +462,6 @@ struct tvcard bttv_tvcards[] = {
469 .muxsel = MUXSEL(2, 3, 1, 1), 462 .muxsel = MUXSEL(2, 3, 1, 1),
470 .gpiomux = { 0, 0xc00, 0x800, 0x400 }, 463 .gpiomux = { 0, 0xc00, 0x800, 0x400 },
471 .gpiomute = 0xc00, 464 .gpiomute = 0xc00,
472 .needs_tvaudio = 1,
473 .pll = PLL_28, 465 .pll = PLL_28,
474 .tuner_type = UNSET, 466 .tuner_type = UNSET,
475 .tuner_addr = ADDR_UNSET, 467 .tuner_addr = ADDR_UNSET,
@@ -482,7 +474,6 @@ struct tvcard bttv_tvcards[] = {
482 .gpiomask = 3, 474 .gpiomask = 3,
483 .muxsel = MUXSEL(2, 3, 1, 1), 475 .muxsel = MUXSEL(2, 3, 1, 1),
484 .gpiomux = { 1, 1, 2, 3 }, 476 .gpiomux = { 1, 1, 2, 3 },
485 .needs_tvaudio = 0,
486 .pll = PLL_28, 477 .pll = PLL_28,
487 .tuner_type = TUNER_TEMIC_PAL, 478 .tuner_type = TUNER_TEMIC_PAL,
488 .tuner_addr = ADDR_UNSET, 479 .tuner_addr = ADDR_UNSET,
@@ -496,7 +487,6 @@ struct tvcard bttv_tvcards[] = {
496 .muxsel = MUXSEL(2, 0, 1, 1), 487 .muxsel = MUXSEL(2, 0, 1, 1),
497 .gpiomux = { 0, 1, 2, 3 }, 488 .gpiomux = { 0, 1, 2, 3 },
498 .gpiomute = 4, 489 .gpiomute = 4,
499 .needs_tvaudio = 1,
500 .pll = PLL_28, 490 .pll = PLL_28,
501 .tuner_type = UNSET, 491 .tuner_type = UNSET,
502 .tuner_addr = ADDR_UNSET, 492 .tuner_addr = ADDR_UNSET,
@@ -510,7 +500,6 @@ struct tvcard bttv_tvcards[] = {
510 .muxsel = MUXSEL(2, 3, 1, 1), 500 .muxsel = MUXSEL(2, 3, 1, 1),
511 .gpiomux = { 0x20001,0x10001, 0, 0 }, 501 .gpiomux = { 0x20001,0x10001, 0, 0 },
512 .gpiomute = 10, 502 .gpiomute = 10,
513 .needs_tvaudio = 1,
514 .tuner_type = UNSET, 503 .tuner_type = UNSET,
515 .tuner_addr = ADDR_UNSET, 504 .tuner_addr = ADDR_UNSET,
516 }, 505 },
@@ -524,7 +513,6 @@ struct tvcard bttv_tvcards[] = {
524 .gpiomask = 15, 513 .gpiomask = 15,
525 .muxsel = MUXSEL(2, 3, 1, 1), 514 .muxsel = MUXSEL(2, 3, 1, 1),
526 .gpiomux = { 13, 14, 11, 7 }, 515 .gpiomux = { 13, 14, 11, 7 },
527 .needs_tvaudio = 1,
528 .tuner_type = UNSET, 516 .tuner_type = UNSET,
529 .tuner_addr = ADDR_UNSET, 517 .tuner_addr = ADDR_UNSET,
530 }, 518 },
@@ -536,7 +524,6 @@ struct tvcard bttv_tvcards[] = {
536 .gpiomask = 15, 524 .gpiomask = 15,
537 .muxsel = MUXSEL(2, 3, 1, 1), 525 .muxsel = MUXSEL(2, 3, 1, 1),
538 .gpiomux = { 13, 14, 11, 7 }, 526 .gpiomux = { 13, 14, 11, 7 },
539 .needs_tvaudio = 1,
540 .msp34xx_alt = 1, 527 .msp34xx_alt = 1,
541 .pll = PLL_28, 528 .pll = PLL_28,
542 .tuner_type = TUNER_PHILIPS_PAL, 529 .tuner_type = TUNER_PHILIPS_PAL,
@@ -553,7 +540,6 @@ struct tvcard bttv_tvcards[] = {
553 .muxsel = MUXSEL(2, 3, 1, 1), 540 .muxsel = MUXSEL(2, 3, 1, 1),
554 .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ 541 .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */
555 .gpiomute = 4, 542 .gpiomute = 4,
556 .needs_tvaudio = 1,
557 .pll = PLL_28, 543 .pll = PLL_28,
558 .tuner_type = UNSET, 544 .tuner_type = UNSET,
559 .tuner_addr = ADDR_UNSET, 545 .tuner_addr = ADDR_UNSET,
@@ -567,7 +553,6 @@ struct tvcard bttv_tvcards[] = {
567 .muxsel = MUXSEL(2, 3, 1, 1), 553 .muxsel = MUXSEL(2, 3, 1, 1),
568 .gpiomux = { 0, 0, 1, 0 }, 554 .gpiomux = { 0, 0, 1, 0 },
569 .gpiomute = 10, 555 .gpiomute = 10,
570 .needs_tvaudio = 1,
571 .tuner_type = UNSET, 556 .tuner_type = UNSET,
572 .tuner_addr = ADDR_UNSET, 557 .tuner_addr = ADDR_UNSET,
573 }, 558 },
@@ -583,7 +568,6 @@ struct tvcard bttv_tvcards[] = {
583 /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ 568 /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */
584 .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, 569 .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 },
585 .gpiomute = 0x002000, 570 .gpiomute = 0x002000,
586 .needs_tvaudio = 1,
587 .pll = PLL_28, 571 .pll = PLL_28,
588 .tuner_type = UNSET, 572 .tuner_type = UNSET,
589 .tuner_addr = ADDR_UNSET, 573 .tuner_addr = ADDR_UNSET,
@@ -597,7 +581,6 @@ struct tvcard bttv_tvcards[] = {
597 .muxsel = MUXSEL(2, 3, 1, 1, 0), 581 .muxsel = MUXSEL(2, 3, 1, 1, 0),
598 .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, 582 .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 },
599 .gpiomute = 0xcfa007, 583 .gpiomute = 0xcfa007,
600 .needs_tvaudio = 1,
601 .tuner_type = UNSET, 584 .tuner_type = UNSET,
602 .tuner_addr = ADDR_UNSET, 585 .tuner_addr = ADDR_UNSET,
603 .volume_gpio = winview_volume, 586 .volume_gpio = winview_volume,
@@ -611,7 +594,6 @@ struct tvcard bttv_tvcards[] = {
611 .gpiomask = 0, 594 .gpiomask = 0,
612 .muxsel = MUXSEL(2, 3, 1, 1), 595 .muxsel = MUXSEL(2, 3, 1, 1),
613 .gpiomux = { 1, 0, 0, 0 }, 596 .gpiomux = { 1, 0, 0, 0 },
614 .needs_tvaudio = 1,
615 .tuner_type = UNSET, 597 .tuner_type = UNSET,
616 .tuner_addr = ADDR_UNSET, 598 .tuner_addr = ADDR_UNSET,
617 }, 599 },
@@ -660,7 +642,6 @@ struct tvcard bttv_tvcards[] = {
660 .muxsel = MUXSEL(2, 3, 1, 1), 642 .muxsel = MUXSEL(2, 3, 1, 1),
661 .gpiomux = { 0, 1, 0x800, 0x400 }, 643 .gpiomux = { 0, 1, 0x800, 0x400 },
662 .gpiomute = 0xc00, 644 .gpiomute = 0xc00,
663 .needs_tvaudio = 1,
664 .pll = PLL_28, 645 .pll = PLL_28,
665 .tuner_type = UNSET, 646 .tuner_type = UNSET,
666 .tuner_addr = ADDR_UNSET, 647 .tuner_addr = ADDR_UNSET,
@@ -691,7 +672,6 @@ struct tvcard bttv_tvcards[] = {
691 .muxsel = MUXSEL(2, 3, 1, 1), 672 .muxsel = MUXSEL(2, 3, 1, 1),
692 .gpiomux = {0x400, 0x400, 0x400, 0x400 }, 673 .gpiomux = {0x400, 0x400, 0x400, 0x400 },
693 .gpiomute = 0xc00, 674 .gpiomute = 0xc00,
694 .needs_tvaudio = 1,
695 .pll = PLL_28, 675 .pll = PLL_28,
696 .tuner_type = UNSET, 676 .tuner_type = UNSET,
697 .tuner_addr = ADDR_UNSET, 677 .tuner_addr = ADDR_UNSET,
@@ -706,7 +686,6 @@ struct tvcard bttv_tvcards[] = {
706 .muxsel = MUXSEL(2, 3, 1, 1), 686 .muxsel = MUXSEL(2, 3, 1, 1),
707 .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, 687 .gpiomux = { 0x20000, 0x30000, 0x10000, 0 },
708 .gpiomute = 0x40000, 688 .gpiomute = 0x40000,
709 .needs_tvaudio = 0,
710 .tuner_type = TUNER_PHILIPS_PAL, 689 .tuner_type = TUNER_PHILIPS_PAL,
711 .tuner_addr = ADDR_UNSET, 690 .tuner_addr = ADDR_UNSET,
712 .audio_mode_gpio= terratv_audio, 691 .audio_mode_gpio= terratv_audio,
@@ -720,7 +699,6 @@ struct tvcard bttv_tvcards[] = {
720 .muxsel = MUXSEL(2, 0, 1, 1), 699 .muxsel = MUXSEL(2, 0, 1, 1),
721 .gpiomux = { 0, 1, 2, 3 }, 700 .gpiomux = { 0, 1, 2, 3 },
722 .gpiomute = 4, 701 .gpiomute = 4,
723 .needs_tvaudio = 1,
724 .tuner_type = UNSET, 702 .tuner_type = UNSET,
725 .tuner_addr = ADDR_UNSET, 703 .tuner_addr = ADDR_UNSET,
726 }, 704 },
@@ -748,7 +726,6 @@ struct tvcard bttv_tvcards[] = {
748 .muxsel = MUXSEL(2, 3, 1, 1), 726 .muxsel = MUXSEL(2, 3, 1, 1),
749 .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, 727 .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 },
750 .gpiomute = 0x40000, 728 .gpiomute = 0x40000,
751 .needs_tvaudio = 0,
752 .tuner_type = TUNER_PHILIPS_PAL, 729 .tuner_type = TUNER_PHILIPS_PAL,
753 .tuner_addr = ADDR_UNSET, 730 .tuner_addr = ADDR_UNSET,
754 .audio_mode_gpio= terratv_audio, 731 .audio_mode_gpio= terratv_audio,
@@ -793,7 +770,6 @@ struct tvcard bttv_tvcards[] = {
793 .gpiomask = 0, 770 .gpiomask = 0,
794 .muxsel = MUXSEL(2, 3, 1, 0, 0), 771 .muxsel = MUXSEL(2, 3, 1, 0, 0),
795 .gpiomux = { 0 }, 772 .gpiomux = { 0 },
796 .needs_tvaudio = 1,
797 .tuner_type = TUNER_ABSENT, 773 .tuner_type = TUNER_ABSENT,
798 .tuner_addr = ADDR_UNSET, 774 .tuner_addr = ADDR_UNSET,
799 .muxsel_hook = PXC200_muxsel, 775 .muxsel_hook = PXC200_muxsel,
@@ -834,7 +810,6 @@ struct tvcard bttv_tvcards[] = {
834 .gpiomask = 0, 810 .gpiomask = 0,
835 .muxsel = MUXSEL(2, 3, 1, 1), 811 .muxsel = MUXSEL(2, 3, 1, 1),
836 .gpiomux = { 0 }, 812 .gpiomux = { 0 },
837 .needs_tvaudio = 0,
838 .tuner_type = TUNER_ABSENT, 813 .tuner_type = TUNER_ABSENT,
839 .tuner_addr = ADDR_UNSET, 814 .tuner_addr = ADDR_UNSET,
840 }, 815 },
@@ -847,7 +822,6 @@ struct tvcard bttv_tvcards[] = {
847 .muxsel = MUXSEL(2, 3, 1, 1), 822 .muxsel = MUXSEL(2, 3, 1, 1),
848 .gpiomux = { 0x500, 0, 0x300, 0x900 }, 823 .gpiomux = { 0x500, 0, 0x300, 0x900 },
849 .gpiomute = 0x900, 824 .gpiomute = 0x900,
850 .needs_tvaudio = 1,
851 .pll = PLL_28, 825 .pll = PLL_28,
852 .tuner_type = TUNER_PHILIPS_PAL, 826 .tuner_type = TUNER_PHILIPS_PAL,
853 .tuner_addr = ADDR_UNSET, 827 .tuner_addr = ADDR_UNSET,
@@ -874,7 +848,6 @@ struct tvcard bttv_tvcards[] = {
874 Note: There exists another variant "Winfast 2000" with tv stereo !? 848 Note: There exists another variant "Winfast 2000" with tv stereo !?
875 Note: eeprom only contains FF and pci subsystem id 107d:6606 849 Note: eeprom only contains FF and pci subsystem id 107d:6606
876 */ 850 */
877 .needs_tvaudio = 0,
878 .pll = PLL_28, 851 .pll = PLL_28,
879 .has_radio = 1, 852 .has_radio = 1,
880 .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ 853 .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
@@ -934,7 +907,6 @@ struct tvcard bttv_tvcards[] = {
934 .muxsel = MUXSEL(2, 3, 1, 0), 907 .muxsel = MUXSEL(2, 3, 1, 0),
935 .gpiomux = { 0x551400, 0x551200, 0, 0 }, 908 .gpiomux = { 0x551400, 0x551200, 0, 0 },
936 .gpiomute = 0x551c00, 909 .gpiomute = 0x551c00,
937 .needs_tvaudio = 1,
938 .pll = PLL_28, 910 .pll = PLL_28,
939 .tuner_type = TUNER_PHILIPS_PAL_I, 911 .tuner_type = TUNER_PHILIPS_PAL_I,
940 .tuner_addr = ADDR_UNSET, 912 .tuner_addr = ADDR_UNSET,
@@ -949,7 +921,6 @@ struct tvcard bttv_tvcards[] = {
949 .muxsel = MUXSEL(2, 3, 1, 1), 921 .muxsel = MUXSEL(2, 3, 1, 1),
950 .gpiomux = { 2, 0xd0001, 0, 0 }, 922 .gpiomux = { 2, 0xd0001, 0, 0 },
951 .gpiomute = 1, 923 .gpiomute = 1,
952 .needs_tvaudio = 0,
953 .pll = PLL_28, 924 .pll = PLL_28,
954 .tuner_type = UNSET, 925 .tuner_type = UNSET,
955 .tuner_addr = ADDR_UNSET, 926 .tuner_addr = ADDR_UNSET,
@@ -966,7 +937,6 @@ struct tvcard bttv_tvcards[] = {
966 .gpiomux = { 4, 0, 2, 3 }, 937 .gpiomux = { 4, 0, 2, 3 },
967 .gpiomute = 1, 938 .gpiomute = 1,
968 .no_msp34xx = 1, 939 .no_msp34xx = 1,
969 .needs_tvaudio = 1,
970 .tuner_type = TUNER_PHILIPS_NTSC, 940 .tuner_type = TUNER_PHILIPS_NTSC,
971 .tuner_addr = ADDR_UNSET, 941 .tuner_addr = ADDR_UNSET,
972 .pll = PLL_28, 942 .pll = PLL_28,
@@ -980,7 +950,6 @@ struct tvcard bttv_tvcards[] = {
980 .gpiomask = 15, 950 .gpiomask = 15,
981 .muxsel = MUXSEL(2, 3, 1, 1), 951 .muxsel = MUXSEL(2, 3, 1, 1),
982 .gpiomux = { 13, 4, 11, 7 }, 952 .gpiomux = { 13, 4, 11, 7 },
983 .needs_tvaudio = 1,
984 .pll = PLL_28, 953 .pll = PLL_28,
985 .tuner_type = UNSET, 954 .tuner_type = UNSET,
986 .tuner_addr = ADDR_UNSET, 955 .tuner_addr = ADDR_UNSET,
@@ -995,7 +964,6 @@ struct tvcard bttv_tvcards[] = {
995 .gpiomask = 0, 964 .gpiomask = 0,
996 .muxsel = MUXSEL(2, 3, 1, 1), 965 .muxsel = MUXSEL(2, 3, 1, 1),
997 .gpiomux = { 0, 0, 0, 0}, 966 .gpiomux = { 0, 0, 0, 0},
998 .needs_tvaudio = 1,
999 .no_msp34xx = 1, 967 .no_msp34xx = 1,
1000 .pll = PLL_28, 968 .pll = PLL_28,
1001 .tuner_type = TUNER_PHILIPS_PAL_I, 969 .tuner_type = TUNER_PHILIPS_PAL_I,
@@ -1066,7 +1034,6 @@ struct tvcard bttv_tvcards[] = {
1066 .muxsel = MUXSEL(2, 3, 1, 1), 1034 .muxsel = MUXSEL(2, 3, 1, 1),
1067 .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, 1035 .gpiomux = { 0x20000, 0x30000, 0x10000, 0 },
1068 .gpiomute = 0x40000, 1036 .gpiomute = 0x40000,
1069 .needs_tvaudio = 1,
1070 .no_msp34xx = 1, 1037 .no_msp34xx = 1,
1071 .pll = PLL_35, 1038 .pll = PLL_35,
1072 .tuner_type = TUNER_PHILIPS_PAL_I, 1039 .tuner_type = TUNER_PHILIPS_PAL_I,
@@ -1084,7 +1051,6 @@ struct tvcard bttv_tvcards[] = {
1084 .muxsel = MUXSEL(2, 3, 1, 1), 1051 .muxsel = MUXSEL(2, 3, 1, 1),
1085 .gpiomux = {2,0,0,0 }, 1052 .gpiomux = {2,0,0,0 },
1086 .gpiomute = 1, 1053 .gpiomute = 1,
1087 .needs_tvaudio = 1,
1088 .pll = PLL_28, 1054 .pll = PLL_28,
1089 .tuner_type = UNSET, 1055 .tuner_type = UNSET,
1090 .tuner_addr = ADDR_UNSET, 1056 .tuner_addr = ADDR_UNSET,
@@ -1163,7 +1129,6 @@ struct tvcard bttv_tvcards[] = {
1163 MUX2 (mask 0x30000): 1129 MUX2 (mask 0x30000):
1164 0,2,3= from MSP34xx 1130 0,2,3= from MSP34xx
1165 1= FM stereo Radio from Tuner */ 1131 1= FM stereo Radio from Tuner */
1166 .needs_tvaudio = 0,
1167 .pll = PLL_28, 1132 .pll = PLL_28,
1168 .tuner_type = UNSET, 1133 .tuner_type = UNSET,
1169 .tuner_addr = ADDR_UNSET, 1134 .tuner_addr = ADDR_UNSET,
@@ -1179,7 +1144,6 @@ struct tvcard bttv_tvcards[] = {
1179 .muxsel = MUXSEL(2, 3, 1, 1), 1144 .muxsel = MUXSEL(2, 3, 1, 1),
1180 .gpiomux = { 0, 0, 0x10, 8 }, 1145 .gpiomux = { 0, 0, 0x10, 8 },
1181 .gpiomute = 4, 1146 .gpiomute = 4,
1182 .needs_tvaudio = 1,
1183 .pll = PLL_28, 1147 .pll = PLL_28,
1184 .tuner_type = TUNER_PHILIPS_PAL, 1148 .tuner_type = TUNER_PHILIPS_PAL,
1185 .tuner_addr = ADDR_UNSET, 1149 .tuner_addr = ADDR_UNSET,
@@ -1218,7 +1182,6 @@ struct tvcard bttv_tvcards[] = {
1218 .muxsel = MUXSEL(2, 3, 1, 0), 1182 .muxsel = MUXSEL(2, 3, 1, 0),
1219 .gpiomux = { 2, 0, 0, 0 }, 1183 .gpiomux = { 2, 0, 0, 0 },
1220 .gpiomute = 10, 1184 .gpiomute = 10,
1221 .needs_tvaudio = 0,
1222 .pll = PLL_28, 1185 .pll = PLL_28,
1223 .tuner_type = TUNER_TEMIC_PAL, 1186 .tuner_type = TUNER_TEMIC_PAL,
1224 .tuner_addr = ADDR_UNSET, 1187 .tuner_addr = ADDR_UNSET,
@@ -1250,7 +1213,6 @@ struct tvcard bttv_tvcards[] = {
1250 .gpiomask = 0, 1213 .gpiomask = 0,
1251 .muxsel = MUXSEL(3, 1), 1214 .muxsel = MUXSEL(3, 1),
1252 .gpiomux = { 0 }, 1215 .gpiomux = { 0 },
1253 .needs_tvaudio = 0,
1254 .no_msp34xx = 1, 1216 .no_msp34xx = 1,
1255 .pll = PLL_35, 1217 .pll = PLL_35,
1256 .tuner_type = TUNER_ABSENT, 1218 .tuner_type = TUNER_ABSENT,
@@ -1266,7 +1228,6 @@ struct tvcard bttv_tvcards[] = {
1266 .muxsel = MUXSEL(2, 3, 1, 1), 1228 .muxsel = MUXSEL(2, 3, 1, 1),
1267 .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, 1229 .gpiomux = { 0x400, 0x400, 0x400, 0x400 },
1268 .gpiomute = 0x800, 1230 .gpiomute = 0x800,
1269 .needs_tvaudio = 1,
1270 .pll = PLL_28, 1231 .pll = PLL_28,
1271 .tuner_type = TUNER_TEMIC_4036FY5_NTSC, 1232 .tuner_type = TUNER_TEMIC_4036FY5_NTSC,
1272 .tuner_addr = ADDR_UNSET, 1233 .tuner_addr = ADDR_UNSET,
@@ -1312,7 +1273,6 @@ struct tvcard bttv_tvcards[] = {
1312 .muxsel = MUXSEL(2, 2), 1273 .muxsel = MUXSEL(2, 2),
1313 .gpiomux = { }, 1274 .gpiomux = { },
1314 .no_msp34xx = 1, 1275 .no_msp34xx = 1,
1315 .needs_tvaudio = 0,
1316 .pll = PLL_28, 1276 .pll = PLL_28,
1317 .tuner_type = TUNER_ABSENT, 1277 .tuner_type = TUNER_ABSENT,
1318 .tuner_addr = ADDR_UNSET, 1278 .tuner_addr = ADDR_UNSET,
@@ -1329,7 +1289,6 @@ struct tvcard bttv_tvcards[] = {
1329 .muxsel = MUXSEL(2, 3, 1, 0), 1289 .muxsel = MUXSEL(2, 3, 1, 0),
1330 .gpiomux = { 1, 0, 4, 4 }, 1290 .gpiomux = { 1, 0, 4, 4 },
1331 .gpiomute = 9, 1291 .gpiomute = 9,
1332 .needs_tvaudio = 0,
1333 .pll = PLL_28, 1292 .pll = PLL_28,
1334 .tuner_type = TUNER_PHILIPS_PAL, 1293 .tuner_type = TUNER_PHILIPS_PAL,
1335 .tuner_addr = ADDR_UNSET, 1294 .tuner_addr = ADDR_UNSET,
@@ -1379,7 +1338,6 @@ struct tvcard bttv_tvcards[] = {
1379 .gpiomute = 0x1800, 1338 .gpiomute = 0x1800,
1380 .audio_mode_gpio= fv2000s_audio, 1339 .audio_mode_gpio= fv2000s_audio,
1381 .no_msp34xx = 1, 1340 .no_msp34xx = 1,
1382 .needs_tvaudio = 1,
1383 .pll = PLL_28, 1341 .pll = PLL_28,
1384 .tuner_type = TUNER_PHILIPS_PAL, 1342 .tuner_type = TUNER_PHILIPS_PAL,
1385 .tuner_addr = ADDR_UNSET, 1343 .tuner_addr = ADDR_UNSET,
@@ -1393,7 +1351,6 @@ struct tvcard bttv_tvcards[] = {
1393 .muxsel = MUXSEL(2, 3, 1, 1), 1351 .muxsel = MUXSEL(2, 3, 1, 1),
1394 .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, 1352 .gpiomux = { 0x500, 0x500, 0x300, 0x900 },
1395 .gpiomute = 0x900, 1353 .gpiomute = 0x900,
1396 .needs_tvaudio = 1,
1397 .pll = PLL_28, 1354 .pll = PLL_28,
1398 .tuner_type = TUNER_PHILIPS_PAL, 1355 .tuner_type = TUNER_PHILIPS_PAL,
1399 .tuner_addr = ADDR_UNSET, 1356 .tuner_addr = ADDR_UNSET,
@@ -1477,7 +1434,6 @@ struct tvcard bttv_tvcards[] = {
1477 .muxsel = MUXSEL(2, 3, 1, 1), 1434 .muxsel = MUXSEL(2, 3, 1, 1),
1478 .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ 1435 .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */
1479 .gpiomute = 13, 1436 .gpiomute = 13,
1480 .needs_tvaudio = 1,
1481 .pll = PLL_28, 1437 .pll = PLL_28,
1482 .tuner_type = TUNER_LG_PAL_I_FM, 1438 .tuner_type = TUNER_LG_PAL_I_FM,
1483 .tuner_addr = ADDR_UNSET, 1439 .tuner_addr = ADDR_UNSET,
@@ -1514,7 +1470,6 @@ struct tvcard bttv_tvcards[] = {
1514 .muxsel = MUXSEL(2, 3, 1, 1), 1470 .muxsel = MUXSEL(2, 3, 1, 1),
1515 .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, 1471 .gpiomux = { 0x01, 0x00, 0x03, 0x03 },
1516 .gpiomute = 0x09, 1472 .gpiomute = 0x09,
1517 .needs_tvaudio = 1,
1518 .no_msp34xx = 1, 1473 .no_msp34xx = 1,
1519 .pll = PLL_28, 1474 .pll = PLL_28,
1520 .tuner_type = TUNER_PHILIPS_PAL, 1475 .tuner_type = TUNER_PHILIPS_PAL,
@@ -1540,7 +1495,6 @@ struct tvcard bttv_tvcards[] = {
1540 .gpiomask = 0, 1495 .gpiomask = 0,
1541 .muxsel = MUXSEL(2, 3, 1, 0, 0), 1496 .muxsel = MUXSEL(2, 3, 1, 0, 0),
1542 .gpiomux = { 0 }, 1497 .gpiomux = { 0 },
1543 .needs_tvaudio = 0,
1544 .tuner_type = TUNER_ABSENT, 1498 .tuner_type = TUNER_ABSENT,
1545 .tuner_addr = ADDR_UNSET, 1499 .tuner_addr = ADDR_UNSET,
1546 }, 1500 },
@@ -1567,7 +1521,6 @@ struct tvcard bttv_tvcards[] = {
1567 .muxsel = MUXSEL(2, 1, 1), 1521 .muxsel = MUXSEL(2, 1, 1),
1568 .gpiomux = { 0, 1, 2, 2 }, 1522 .gpiomux = { 0, 1, 2, 2 },
1569 .gpiomute = 4, 1523 .gpiomute = 4,
1570 .needs_tvaudio = 0,
1571 .tuner_type = TUNER_PHILIPS_PAL, 1524 .tuner_type = TUNER_PHILIPS_PAL,
1572 .tuner_addr = ADDR_UNSET, 1525 .tuner_addr = ADDR_UNSET,
1573 .pll = PLL_28, 1526 .pll = PLL_28,
@@ -1597,7 +1550,6 @@ struct tvcard bttv_tvcards[] = {
1597 .gpiomask = 0, 1550 .gpiomask = 0,
1598 .muxsel = MUXSEL(2, 3, 1, 0), 1551 .muxsel = MUXSEL(2, 3, 1, 0),
1599 .gpiomux = { 0 }, 1552 .gpiomux = { 0 },
1600 .needs_tvaudio = 0,
1601 .no_msp34xx = 1, 1553 .no_msp34xx = 1,
1602 .pll = PLL_28, 1554 .pll = PLL_28,
1603 .tuner_type = TUNER_ABSENT, 1555 .tuner_type = TUNER_ABSENT,
@@ -1619,7 +1571,6 @@ struct tvcard bttv_tvcards[] = {
1619 * btwincap uses 0x80000/0x80003 1571 * btwincap uses 0x80000/0x80003
1620 */ 1572 */
1621 .gpiomute = 4, 1573 .gpiomute = 4,
1622 .needs_tvaudio = 0,
1623 .no_msp34xx = 1, 1574 .no_msp34xx = 1,
1624 .pll = PLL_28, 1575 .pll = PLL_28,
1625 .tuner_type = TUNER_PHILIPS_PAL, 1576 .tuner_type = TUNER_PHILIPS_PAL,
@@ -1655,7 +1606,6 @@ struct tvcard bttv_tvcards[] = {
1655 /* .audio_inputs= 1, */ 1606 /* .audio_inputs= 1, */
1656 .svhs = 2, 1607 .svhs = 2,
1657 .muxsel = MUXSEL(2, 0, 1, 1), 1608 .muxsel = MUXSEL(2, 0, 1, 1),
1658 .needs_tvaudio = 1,
1659 .pll = PLL_28, 1609 .pll = PLL_28,
1660 .tuner_type = UNSET, 1610 .tuner_type = UNSET,
1661 .tuner_addr = ADDR_UNSET, 1611 .tuner_addr = ADDR_UNSET,
@@ -1875,7 +1825,6 @@ struct tvcard bttv_tvcards[] = {
1875 .muxsel = MUXSEL(2, 3, 1, 1), 1825 .muxsel = MUXSEL(2, 3, 1, 1),
1876 .gpiomux = { 0, 1, 2, 3}, 1826 .gpiomux = { 0, 1, 2, 3},
1877 .gpiomute = 4, 1827 .gpiomute = 4,
1878 .needs_tvaudio = 1,
1879 .tuner_type = TUNER_PHILIPS_PAL, 1828 .tuner_type = TUNER_PHILIPS_PAL,
1880 .tuner_addr = ADDR_UNSET, 1829 .tuner_addr = ADDR_UNSET,
1881 .pll = PLL_28, 1830 .pll = PLL_28,
@@ -1902,7 +1851,6 @@ struct tvcard bttv_tvcards[] = {
1902 .gpiomask = 0, 1851 .gpiomask = 0,
1903 .muxsel = MUXSEL(2, 3), 1852 .muxsel = MUXSEL(2, 3),
1904 .gpiomux = { 0 }, 1853 .gpiomux = { 0 },
1905 .needs_tvaudio = 0,
1906 .no_msp34xx = 1, 1854 .no_msp34xx = 1,
1907 .pll = PLL_28, 1855 .pll = PLL_28,
1908 .tuner_type = TUNER_ABSENT, 1856 .tuner_type = TUNER_ABSENT,
@@ -1920,7 +1868,6 @@ struct tvcard bttv_tvcards[] = {
1920 /* Tuner, Radio, external, internal, off, on */ 1868 /* Tuner, Radio, external, internal, off, on */
1921 .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, 1869 .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 },
1922 .gpiomute = 0x0f, 1870 .gpiomute = 0x0f,
1923 .needs_tvaudio = 0,
1924 .no_msp34xx = 1, 1871 .no_msp34xx = 1,
1925 .pll = PLL_28, 1872 .pll = PLL_28,
1926 .tuner_type = TUNER_PHILIPS_NTSC, 1873 .tuner_type = TUNER_PHILIPS_NTSC,
@@ -1936,7 +1883,6 @@ struct tvcard bttv_tvcards[] = {
1936 .svhs = 2, 1883 .svhs = 2,
1937 .gpiomask = 0x00, 1884 .gpiomask = 0x00,
1938 .muxsel = MUXSEL(2, 3, 1, 1), 1885 .muxsel = MUXSEL(2, 3, 1, 1),
1939 .needs_tvaudio = 1,
1940 .no_msp34xx = 1, 1886 .no_msp34xx = 1,
1941 .pll = PLL_28, 1887 .pll = PLL_28,
1942 .tuner_type = TUNER_PHILIPS_PAL, 1888 .tuner_type = TUNER_PHILIPS_PAL,
@@ -2034,7 +1980,6 @@ struct tvcard bttv_tvcards[] = {
2034 .gpiomask = 0, 1980 .gpiomask = 0,
2035 .muxsel = MUXSEL(2, 3, 1, 0), 1981 .muxsel = MUXSEL(2, 3, 1, 0),
2036 .gpiomux = { 0 }, 1982 .gpiomux = { 0 },
2037 .needs_tvaudio = 0,
2038 .no_msp34xx = 1, 1983 .no_msp34xx = 1,
2039 .pll = PLL_28, 1984 .pll = PLL_28,
2040 .tuner_type = TUNER_ABSENT, 1985 .tuner_type = TUNER_ABSENT,
@@ -2049,7 +1994,6 @@ struct tvcard bttv_tvcards[] = {
2049 .gpiomask = 0x00, 1994 .gpiomask = 0x00,
2050 .muxsel = MUXSEL(2, 3, 1, 0), 1995 .muxsel = MUXSEL(2, 3, 1, 0),
2051 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 1996 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2052 .needs_tvaudio = 0,
2053 .pll = PLL_28, 1997 .pll = PLL_28,
2054 .tuner_type = TUNER_ABSENT, 1998 .tuner_type = TUNER_ABSENT,
2055 .tuner_addr = ADDR_UNSET, 1999 .tuner_addr = ADDR_UNSET,
@@ -2062,7 +2006,6 @@ struct tvcard bttv_tvcards[] = {
2062 .gpiomask = 0x00, 2006 .gpiomask = 0x00,
2063 .muxsel = MUXSEL(2, 3, 1, 1), 2007 .muxsel = MUXSEL(2, 3, 1, 1),
2064 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2008 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2065 .needs_tvaudio = 0,
2066 .pll = PLL_28, 2009 .pll = PLL_28,
2067 .tuner_type = TUNER_ABSENT, 2010 .tuner_type = TUNER_ABSENT,
2068 .tuner_addr = ADDR_UNSET, 2011 .tuner_addr = ADDR_UNSET,
@@ -2079,7 +2022,6 @@ struct tvcard bttv_tvcards[] = {
2079 .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0), 2022 .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0),
2080 .muxsel_hook = phytec_muxsel, 2023 .muxsel_hook = phytec_muxsel,
2081 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2024 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2082 .needs_tvaudio = 1,
2083 .pll = PLL_28, 2025 .pll = PLL_28,
2084 .tuner_type = TUNER_ABSENT, 2026 .tuner_type = TUNER_ABSENT,
2085 .tuner_addr = ADDR_UNSET, 2027 .tuner_addr = ADDR_UNSET,
@@ -2094,7 +2036,6 @@ struct tvcard bttv_tvcards[] = {
2094 .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1), 2036 .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1),
2095 .muxsel_hook = phytec_muxsel, 2037 .muxsel_hook = phytec_muxsel,
2096 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2038 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2097 .needs_tvaudio = 1,
2098 .pll = PLL_28, 2039 .pll = PLL_28,
2099 .tuner_type = TUNER_ABSENT, 2040 .tuner_type = TUNER_ABSENT,
2100 .tuner_addr = ADDR_UNSET, 2041 .tuner_addr = ADDR_UNSET,
@@ -2118,7 +2059,6 @@ struct tvcard bttv_tvcards[] = {
2118 .tuner_type = TUNER_ABSENT, 2059 .tuner_type = TUNER_ABSENT,
2119 .tuner_addr = ADDR_UNSET, 2060 .tuner_addr = ADDR_UNSET,
2120 .svhs = NO_SVHS, /* card has no svhs */ 2061 .svhs = NO_SVHS, /* card has no svhs */
2121 .needs_tvaudio = 0,
2122 .no_msp34xx = 1, 2062 .no_msp34xx = 1,
2123 .no_tda7432 = 1, 2063 .no_tda7432 = 1,
2124 .gpiomask = 0x00, 2064 .gpiomask = 0x00,
@@ -2168,7 +2108,6 @@ struct tvcard bttv_tvcards[] = {
2168 .gpiomask = 3, 2108 .gpiomask = 3,
2169 .muxsel = MUXSEL(2, 3, 1, 1), 2109 .muxsel = MUXSEL(2, 3, 1, 1),
2170 .gpiomux = { 1, 1, 1, 1 }, 2110 .gpiomux = { 1, 1, 1, 1 },
2171 .needs_tvaudio = 1,
2172 .tuner_type = TUNER_PHILIPS_PAL, 2111 .tuner_type = TUNER_PHILIPS_PAL,
2173 .tuner_addr = ADDR_UNSET, 2112 .tuner_addr = ADDR_UNSET,
2174 .pll = PLL_35, 2113 .pll = PLL_35,
@@ -2210,7 +2149,6 @@ struct tvcard bttv_tvcards[] = {
2210 .muxsel = MUXSEL(2, 3, 1, 0), 2149 .muxsel = MUXSEL(2, 3, 1, 0),
2211 .no_msp34xx = 1, 2150 .no_msp34xx = 1,
2212 .no_tda7432 = 1, 2151 .no_tda7432 = 1,
2213 .needs_tvaudio = 0,
2214 .tuner_type = TUNER_ABSENT, 2152 .tuner_type = TUNER_ABSENT,
2215 .tuner_addr = ADDR_UNSET, 2153 .tuner_addr = ADDR_UNSET,
2216 }, 2154 },
@@ -2222,7 +2160,6 @@ struct tvcard bttv_tvcards[] = {
2222 .tuner_type = TUNER_PHILIPS_PAL, 2160 .tuner_type = TUNER_PHILIPS_PAL,
2223 .tuner_addr = ADDR_UNSET, 2161 .tuner_addr = ADDR_UNSET,
2224 .svhs = 2, 2162 .svhs = 2,
2225 .needs_tvaudio = 0,
2226 .gpiomask = 0x68, 2163 .gpiomask = 0x68,
2227 .muxsel = MUXSEL(2, 3, 1), 2164 .muxsel = MUXSEL(2, 3, 1),
2228 .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, 2165 .gpiomux = { 0x68, 0x68, 0x61, 0x61 },
@@ -2241,7 +2178,6 @@ struct tvcard bttv_tvcards[] = {
2241 .muxsel = MUXSEL(2, 3, 1, 1), 2178 .muxsel = MUXSEL(2, 3, 1, 1),
2242 .gpiomux = { 0, 1, 2, 2 }, 2179 .gpiomux = { 0, 1, 2, 2 },
2243 .gpiomute = 3, 2180 .gpiomute = 3,
2244 .needs_tvaudio = 0,
2245 .pll = PLL_28, 2181 .pll = PLL_28,
2246 .tuner_type = TUNER_PHILIPS_PAL, 2182 .tuner_type = TUNER_PHILIPS_PAL,
2247 .tuner_addr = ADDR_UNSET, 2183 .tuner_addr = ADDR_UNSET,
@@ -2265,7 +2201,6 @@ struct tvcard bttv_tvcards[] = {
2265 .muxsel = MUXSEL(2, 2, 2, 2), 2201 .muxsel = MUXSEL(2, 2, 2, 2),
2266 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2202 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2267 .pll = PLL_28, 2203 .pll = PLL_28,
2268 .needs_tvaudio = 0,
2269 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ 2204 .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2270 .tuner_type = TUNER_ABSENT, 2205 .tuner_type = TUNER_ABSENT,
2271 .tuner_addr = ADDR_UNSET, 2206 .tuner_addr = ADDR_UNSET,
@@ -2358,7 +2293,6 @@ struct tvcard bttv_tvcards[] = {
2358 .muxsel = MUXSEL(2, 3, 1, 1), 2293 .muxsel = MUXSEL(2, 3, 1, 1),
2359 .gpiomux = { 2, 0, 0, 0 }, 2294 .gpiomux = { 2, 0, 0, 0 },
2360 .gpiomute = 10, 2295 .gpiomute = 10,
2361 .needs_tvaudio = 0,
2362 .pll = PLL_28, 2296 .pll = PLL_28,
2363 .tuner_type = TUNER_PHILIPS_PAL, 2297 .tuner_type = TUNER_PHILIPS_PAL,
2364 .tuner_addr = ADDR_UNSET, 2298 .tuner_addr = ADDR_UNSET,
@@ -2405,7 +2339,6 @@ struct tvcard bttv_tvcards[] = {
2405 .tuner_addr = ADDR_UNSET, 2339 .tuner_addr = ADDR_UNSET,
2406 .gpiomask = 0x008007, 2340 .gpiomask = 0x008007,
2407 .gpiomux = { 0, 0x000001,0,0 }, 2341 .gpiomux = { 0, 0x000001,0,0 },
2408 .needs_tvaudio = 1,
2409 .has_radio = 1, 2342 .has_radio = 1,
2410 }, 2343 },
2411 [BTTV_BOARD_TIBET_CS16] = { 2344 [BTTV_BOARD_TIBET_CS16] = {
@@ -2518,7 +2451,6 @@ struct tvcard bttv_tvcards[] = {
2518 .muxsel = MUXSEL(2, 3, 1, 1), 2451 .muxsel = MUXSEL(2, 3, 1, 1),
2519 .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, 2452 .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 },
2520 .gpiomute = 0x002000, 2453 .gpiomute = 0x002000,
2521 .needs_tvaudio = 1,
2522 .pll = PLL_28, 2454 .pll = PLL_28,
2523 .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, 2455 .tuner_type = TUNER_YMEC_TVF66T5_B_DFF,
2524 .tuner_addr = 0xc1 >>1, 2456 .tuner_addr = 0xc1 >>1,
@@ -2534,7 +2466,6 @@ struct tvcard bttv_tvcards[] = {
2534 .muxsel = MUXSEL(2, 3, 1, 1), 2466 .muxsel = MUXSEL(2, 3, 1, 1),
2535 .gpiomux = { 0, 1, 2, 2 }, 2467 .gpiomux = { 0, 1, 2, 2 },
2536 .gpiomute = 3, 2468 .gpiomute = 3,
2537 .needs_tvaudio = 0,
2538 .pll = PLL_28, 2469 .pll = PLL_28,
2539 .tuner_type = TUNER_TENA_9533_DI, 2470 .tuner_type = TUNER_TENA_9533_DI,
2540 .tuner_addr = ADDR_UNSET, 2471 .tuner_addr = ADDR_UNSET,
@@ -2615,7 +2546,6 @@ struct tvcard bttv_tvcards[] = {
2615 .muxsel = MUXSEL(2, 3, 1, 1), 2546 .muxsel = MUXSEL(2, 3, 1, 1),
2616 .gpiomux = { 2, 0, 0, 0 }, 2547 .gpiomux = { 2, 0, 0, 0 },
2617 .gpiomute = 1, 2548 .gpiomute = 1,
2618 .needs_tvaudio = 1,
2619 .pll = PLL_28, 2549 .pll = PLL_28,
2620 .tuner_type = TUNER_PHILIPS_NTSC, 2550 .tuner_type = TUNER_PHILIPS_NTSC,
2621 .tuner_addr = ADDR_UNSET, 2551 .tuner_addr = ADDR_UNSET,
@@ -2714,7 +2644,6 @@ struct tvcard bttv_tvcards[] = {
2714 .muxsel = MUXSEL(2, 3, 1, 1), 2644 .muxsel = MUXSEL(2, 3, 1, 1),
2715 .gpiomux = { 0x20001,0x10001, 0, 0 }, 2645 .gpiomux = { 0x20001,0x10001, 0, 0 },
2716 .gpiomute = 10, 2646 .gpiomute = 10,
2717 .needs_tvaudio = 1,
2718 .pll = PLL_28, 2647 .pll = PLL_28,
2719 .tuner_type = TUNER_PHILIPS_PAL_I, 2648 .tuner_type = TUNER_PHILIPS_PAL_I,
2720 .tuner_addr = ADDR_UNSET, 2649 .tuner_addr = ADDR_UNSET,
@@ -2746,7 +2675,6 @@ struct tvcard bttv_tvcards[] = {
2746 .muxsel = MUXSEL(2, 3, 1, 1), 2675 .muxsel = MUXSEL(2, 3, 1, 1),
2747 .gpiomux = { 0, 1, 2, 2 }, /* CONTVFMi */ 2676 .gpiomux = { 0, 1, 2, 2 }, /* CONTVFMi */
2748 .gpiomute = 3, /* CONTVFMi */ 2677 .gpiomute = 3, /* CONTVFMi */
2749 .needs_tvaudio = 0,
2750 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */ 2678 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */
2751 .tuner_addr = ADDR_UNSET, 2679 .tuner_addr = ADDR_UNSET,
2752 .pll = PLL_28, 2680 .pll = PLL_28,
@@ -2785,7 +2713,6 @@ struct tvcard bttv_tvcards[] = {
2785 .gpiomask = 0x00, 2713 .gpiomask = 0x00,
2786 .muxsel = MUXSEL(0, 2, 3, 1), 2714 .muxsel = MUXSEL(0, 2, 3, 1),
2787 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2715 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2788 .needs_tvaudio = 0,
2789 .pll = PLL_28, 2716 .pll = PLL_28,
2790 .tuner_type = TUNER_ABSENT, 2717 .tuner_type = TUNER_ABSENT,
2791 .tuner_addr = ADDR_UNSET, 2718 .tuner_addr = ADDR_UNSET,
@@ -2799,7 +2726,6 @@ struct tvcard bttv_tvcards[] = {
2799 .gpiomask = 0x00, 2726 .gpiomask = 0x00,
2800 .muxsel = MUXSEL(2, 3, 1), 2727 .muxsel = MUXSEL(2, 3, 1),
2801 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2728 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2802 .needs_tvaudio = 0,
2803 .pll = PLL_28, 2729 .pll = PLL_28,
2804 .tuner_type = TUNER_ABSENT, 2730 .tuner_type = TUNER_ABSENT,
2805 .tuner_addr = ADDR_UNSET, 2731 .tuner_addr = ADDR_UNSET,
@@ -2813,7 +2739,6 @@ struct tvcard bttv_tvcards[] = {
2813 .gpiomask = 0x00, 2739 .gpiomask = 0x00,
2814 .muxsel = MUXSEL(3, 2, 1), 2740 .muxsel = MUXSEL(3, 2, 1),
2815 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ 2741 .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */
2816 .needs_tvaudio = 0,
2817 .pll = PLL_28, 2742 .pll = PLL_28,
2818 .tuner_type = TUNER_ABSENT, 2743 .tuner_type = TUNER_ABSENT,
2819 .tuner_addr = ADDR_UNSET, 2744 .tuner_addr = ADDR_UNSET,
@@ -2877,7 +2802,6 @@ struct tvcard bttv_tvcards[] = {
2877 .gpiomask = 0, 2802 .gpiomask = 0,
2878 .muxsel = MUXSEL(2, 3), 2803 .muxsel = MUXSEL(2, 3),
2879 .gpiomux = { 0 }, 2804 .gpiomux = { 0 },
2880 .needs_tvaudio = 0,
2881 .no_msp34xx = 1, 2805 .no_msp34xx = 1,
2882 .pll = PLL_28, 2806 .pll = PLL_28,
2883 .tuner_type = TUNER_ABSENT, 2807 .tuner_type = TUNER_ABSENT,
@@ -3649,7 +3573,7 @@ void __devinit bttv_init_tuner(struct bttv *btv)
3649 struct tuner_setup tun_setup; 3573 struct tuner_setup tun_setup;
3650 3574
3651 /* Load tuner module before issuing tuner config call! */ 3575 /* Load tuner module before issuing tuner config call! */
3652 if (bttv_tvcards[btv->c.type].has_radio) 3576 if (btv->has_radio)
3653 v4l2_i2c_new_subdev(&btv->c.v4l2_dev, 3577 v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3654 &btv->c.i2c_adap, "tuner", 3578 &btv->c.i2c_adap, "tuner",
3655 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); 3579 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
@@ -3664,7 +3588,7 @@ void __devinit bttv_init_tuner(struct bttv *btv)
3664 tun_setup.type = btv->tuner_type; 3588 tun_setup.type = btv->tuner_type;
3665 tun_setup.addr = addr; 3589 tun_setup.addr = addr;
3666 3590
3667 if (bttv_tvcards[btv->c.type].has_radio) 3591 if (btv->has_radio)
3668 tun_setup.mode_mask |= T_RADIO; 3592 tun_setup.mode_mask |= T_RADIO;
3669 3593
3670 bttv_call_all(btv, tuner, s_type_addr, &tun_setup); 3594 bttv_call_all(btv, tuner, s_type_addr, &tun_setup);
@@ -3724,6 +3648,10 @@ static void __devinit hauppauge_eeprom(struct bttv *btv)
3724 bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name); 3648 bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name);
3725 btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB; 3649 btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB;
3726 } 3650 }
3651
3652 /* The 61334 needs the msp3410 to do the radio demod to get sound */
3653 if (tv.model == 61334)
3654 btv->radio_uses_msp_demodulator = 1;
3727} 3655}
3728 3656
3729static int terratec_active_radio_upgrade(struct bttv *btv) 3657static int terratec_active_radio_upgrade(struct bttv *btv)
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a9cfb0f4be48..ff7a589d8e0f 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1218,6 +1218,11 @@ audio_mux(struct bttv *btv, int input, int mute)
1218 For now this is sufficient. */ 1218 For now this is sufficient. */
1219 switch (input) { 1219 switch (input) {
1220 case TVAUDIO_INPUT_RADIO: 1220 case TVAUDIO_INPUT_RADIO:
1221 /* Some boards need the msp do to the radio demod */
1222 if (btv->radio_uses_msp_demodulator) {
1223 in = MSP_INPUT_DEFAULT;
1224 break;
1225 }
1221 in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, 1226 in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
1222 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART); 1227 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
1223 break; 1228 break;
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index c5171619ac79..acfe2f3b92d9 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -236,7 +236,6 @@ struct tvcard {
236 /* i2c audio flags */ 236 /* i2c audio flags */
237 unsigned int no_msp34xx:1; 237 unsigned int no_msp34xx:1;
238 unsigned int no_tda7432:1; 238 unsigned int no_tda7432:1;
239 unsigned int needs_tvaudio:1;
240 unsigned int msp34xx_alt:1; 239 unsigned int msp34xx_alt:1;
241 /* Note: currently no card definition needs to mark the presence 240 /* Note: currently no card definition needs to mark the presence
242 of a RDS saa6588 chip. If this is ever needed, then add a new 241 of a RDS saa6588 chip. If this is ever needed, then add a new
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index db943a8d580d..70fd4f23f605 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -440,6 +440,7 @@ struct bttv {
440 /* radio data/state */ 440 /* radio data/state */
441 int has_radio; 441 int has_radio;
442 int radio_user; 442 int radio_user;
443 int radio_uses_msp_demodulator;
443 444
444 /* miro/pinnacle + Aimslab VHX 445 /* miro/pinnacle + Aimslab VHX
445 philips matchbox (tea5757 radio tuner) support */ 446 philips matchbox (tea5757 radio tuner) support */
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 2520219f01ba..5b75a64b199b 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -607,8 +607,9 @@ static long qc_capture(struct qcam *q, char __user *buf, unsigned long len)
607 } 607 }
608 o = i * pixels_per_line + pixels_read + k; 608 o = i * pixels_per_line + pixels_read + k;
609 if (o < len) { 609 if (o < len) {
610 u8 ch = invert - buffer[k];
610 got++; 611 got++;
611 put_user((invert - buffer[k]) << shift, buf + o); 612 put_user(ch << shift, buf + o);
612 } 613 }
613 } 614 }
614 pixels_read += bytes; 615 pixels_read += bytes;
@@ -648,8 +649,8 @@ static int qcam_querycap(struct file *file, void *priv,
648 struct qcam *qcam = video_drvdata(file); 649 struct qcam *qcam = video_drvdata(file);
649 650
650 strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); 651 strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver));
651 strlcpy(vcap->card, "B&W Quickcam", sizeof(vcap->card)); 652 strlcpy(vcap->card, "Connectix B&W Quickcam", sizeof(vcap->card));
652 strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); 653 strlcpy(vcap->bus_info, qcam->pport->name, sizeof(vcap->bus_info));
653 vcap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; 654 vcap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE;
654 vcap->capabilities = vcap->device_caps | V4L2_CAP_DEVICE_CAPS; 655 vcap->capabilities = vcap->device_caps | V4L2_CAP_DEVICE_CAPS;
655 return 0; 656 return 0;
@@ -688,8 +689,8 @@ static int qcam_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
688 pix->height = qcam->height / qcam->transfer_scale; 689 pix->height = qcam->height / qcam->transfer_scale;
689 pix->pixelformat = (qcam->bpp == 4) ? V4L2_PIX_FMT_Y4 : V4L2_PIX_FMT_Y6; 690 pix->pixelformat = (qcam->bpp == 4) ? V4L2_PIX_FMT_Y4 : V4L2_PIX_FMT_Y6;
690 pix->field = V4L2_FIELD_NONE; 691 pix->field = V4L2_FIELD_NONE;
691 pix->bytesperline = qcam->width; 692 pix->bytesperline = pix->width;
692 pix->sizeimage = qcam->width * qcam->height; 693 pix->sizeimage = pix->width * pix->height;
693 /* Just a guess */ 694 /* Just a guess */
694 pix->colorspace = V4L2_COLORSPACE_SRGB; 695 pix->colorspace = V4L2_COLORSPACE_SRGB;
695 return 0; 696 return 0;
@@ -757,7 +758,7 @@ static int qcam_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdes
757 "4-Bit Monochrome", V4L2_PIX_FMT_Y4, 758 "4-Bit Monochrome", V4L2_PIX_FMT_Y4,
758 { 0, 0, 0, 0 } 759 { 0, 0, 0, 0 }
759 }, 760 },
760 { 0, 0, 0, 761 { 1, 0, 0,
761 "6-Bit Monochrome", V4L2_PIX_FMT_Y6, 762 "6-Bit Monochrome", V4L2_PIX_FMT_Y6,
762 { 0, 0, 0, 0 } 763 { 0, 0, 0, 0 }
763 }, 764 },
@@ -772,6 +773,25 @@ static int qcam_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdes
772 return 0; 773 return 0;
773} 774}
774 775
776static int qcam_enum_framesizes(struct file *file, void *fh,
777 struct v4l2_frmsizeenum *fsize)
778{
779 static const struct v4l2_frmsize_discrete sizes[] = {
780 { 80, 60 },
781 { 160, 120 },
782 { 320, 240 },
783 };
784
785 if (fsize->index > 2)
786 return -EINVAL;
787 if (fsize->pixel_format != V4L2_PIX_FMT_Y4 &&
788 fsize->pixel_format != V4L2_PIX_FMT_Y6)
789 return -EINVAL;
790 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
791 fsize->discrete = sizes[fsize->index];
792 return 0;
793}
794
775static ssize_t qcam_read(struct file *file, char __user *buf, 795static ssize_t qcam_read(struct file *file, char __user *buf,
776 size_t count, loff_t *ppos) 796 size_t count, loff_t *ppos)
777{ 797{
@@ -795,6 +815,11 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
795 return len; 815 return len;
796} 816}
797 817
818static unsigned int qcam_poll(struct file *filp, poll_table *wait)
819{
820 return v4l2_ctrl_poll(filp, wait) | POLLIN | POLLRDNORM;
821}
822
798static int qcam_s_ctrl(struct v4l2_ctrl *ctrl) 823static int qcam_s_ctrl(struct v4l2_ctrl *ctrl)
799{ 824{
800 struct qcam *qcam = 825 struct qcam *qcam =
@@ -828,7 +853,7 @@ static const struct v4l2_file_operations qcam_fops = {
828 .owner = THIS_MODULE, 853 .owner = THIS_MODULE,
829 .open = v4l2_fh_open, 854 .open = v4l2_fh_open,
830 .release = v4l2_fh_release, 855 .release = v4l2_fh_release,
831 .poll = v4l2_ctrl_poll, 856 .poll = qcam_poll,
832 .unlocked_ioctl = video_ioctl2, 857 .unlocked_ioctl = video_ioctl2,
833 .read = qcam_read, 858 .read = qcam_read,
834}; 859};
@@ -839,6 +864,7 @@ static const struct v4l2_ioctl_ops qcam_ioctl_ops = {
839 .vidioc_s_input = qcam_s_input, 864 .vidioc_s_input = qcam_s_input,
840 .vidioc_enum_input = qcam_enum_input, 865 .vidioc_enum_input = qcam_enum_input,
841 .vidioc_enum_fmt_vid_cap = qcam_enum_fmt_vid_cap, 866 .vidioc_enum_fmt_vid_cap = qcam_enum_fmt_vid_cap,
867 .vidioc_enum_framesizes = qcam_enum_framesizes,
842 .vidioc_g_fmt_vid_cap = qcam_g_fmt_vid_cap, 868 .vidioc_g_fmt_vid_cap = qcam_g_fmt_vid_cap,
843 .vidioc_s_fmt_vid_cap = qcam_s_fmt_vid_cap, 869 .vidioc_s_fmt_vid_cap = qcam_s_fmt_vid_cap,
844 .vidioc_try_fmt_vid_cap = qcam_try_fmt_vid_cap, 870 .vidioc_try_fmt_vid_cap = qcam_try_fmt_vid_cap,
@@ -864,9 +890,9 @@ static struct qcam *qcam_init(struct parport *port)
864 return NULL; 890 return NULL;
865 891
866 v4l2_dev = &qcam->v4l2_dev; 892 v4l2_dev = &qcam->v4l2_dev;
867 strlcpy(v4l2_dev->name, "bw-qcam", sizeof(v4l2_dev->name)); 893 snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "bw-qcam%d", num_cams);
868 894
869 if (v4l2_device_register(NULL, v4l2_dev) < 0) { 895 if (v4l2_device_register(port->dev, v4l2_dev) < 0) {
870 v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); 896 v4l2_err(v4l2_dev, "Could not register v4l2_device\n");
871 kfree(qcam); 897 kfree(qcam);
872 return NULL; 898 return NULL;
@@ -886,7 +912,7 @@ static struct qcam *qcam_init(struct parport *port)
886 return NULL; 912 return NULL;
887 } 913 }
888 qcam->pport = port; 914 qcam->pport = port;
889 qcam->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, 915 qcam->pdev = parport_register_device(port, v4l2_dev->name, NULL, NULL,
890 NULL, 0, NULL); 916 NULL, 0, NULL);
891 if (qcam->pdev == NULL) { 917 if (qcam->pdev == NULL) {
892 v4l2_err(v4l2_dev, "couldn't register for %s.\n", port->name); 918 v4l2_err(v4l2_dev, "couldn't register for %s.\n", port->name);
@@ -975,6 +1001,7 @@ static int init_bwqcam(struct parport *port)
975 return -ENODEV; 1001 return -ENODEV;
976 } 1002 }
977 qc_calibrate(qcam); 1003 qc_calibrate(qcam);
1004 v4l2_ctrl_handler_setup(&qcam->hdl);
978 1005
979 parport_release(qcam->pdev); 1006 parport_release(qcam->pdev);
980 1007
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index b55d57cc1a1c..7e5ffd6f5178 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -838,10 +838,10 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev,
838 } 838 }
839 839
840 CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, " 840 CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, "
841 "irq: %d, latency: %d, memory: 0x%lx\n", 841 "irq: %d, latency: %d, memory: 0x%llx\n",
842 cx->pci_dev->device, cx->card_rev, pci_dev->bus->number, 842 cx->pci_dev->device, cx->card_rev, pci_dev->bus->number,
843 PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn), 843 PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn),
844 cx->pci_dev->irq, pci_latency, (unsigned long)cx->base_addr); 844 cx->pci_dev->irq, pci_latency, (u64)cx->base_addr);
845 845
846 return 0; 846 return 0;
847} 847}
@@ -938,7 +938,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
938 if (retval) 938 if (retval)
939 goto err; 939 goto err;
940 940
941 CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr); 941 CX18_DEBUG_INFO("base addr: 0x%llx\n", (u64)cx->base_addr);
942 942
943 /* PCI Device Setup */ 943 /* PCI Device Setup */
944 retval = cx18_setup_pci(cx, pci_dev, pci_id); 944 retval = cx18_setup_pci(cx, pci_dev, pci_id);
@@ -946,8 +946,8 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
946 goto free_workqueues; 946 goto free_workqueues;
947 947
948 /* map io memory */ 948 /* map io memory */
949 CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", 949 CX18_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n",
950 cx->base_addr + CX18_MEM_OFFSET, CX18_MEM_SIZE); 950 (u64)cx->base_addr + CX18_MEM_OFFSET, CX18_MEM_SIZE);
951 cx->enc_mem = ioremap_nocache(cx->base_addr + CX18_MEM_OFFSET, 951 cx->enc_mem = ioremap_nocache(cx->base_addr + CX18_MEM_OFFSET,
952 CX18_MEM_SIZE); 952 CX18_MEM_SIZE);
953 if (!cx->enc_mem) { 953 if (!cx->enc_mem) {
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 7a37e0ee136f..2767c64df0c8 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -622,7 +622,7 @@ struct cx18 {
622 unique ID. Starts at 1, so 0 can be used as 622 unique ID. Starts at 1, so 0 can be used as
623 uninitialized value in the stream->id. */ 623 uninitialized value in the stream->id. */
624 624
625 u32 base_addr; 625 resource_size_t base_addr;
626 626
627 u8 card_rev; 627 u8 card_rev;
628 void __iomem *enc_mem, *reg_mem; 628 void __iomem *enc_mem, *reg_mem;
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c
index 1b3fb502e6be..b85c292a849a 100644
--- a/drivers/media/video/cx18/cx18-firmware.c
+++ b/drivers/media/video/cx18/cx18-firmware.c
@@ -164,8 +164,13 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx,
164 164
165 apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32]; 165 apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32];
166 while (offset + sizeof(seghdr) < fw->size) { 166 while (offset + sizeof(seghdr) < fw->size) {
167 /* TODO: byteswapping */ 167 const u32 *shptr = src + offset / 4;
168 memcpy(&seghdr, src + offset / 4, sizeof(seghdr)); 168
169 seghdr.sync1 = le32_to_cpu(shptr[0]);
170 seghdr.sync2 = le32_to_cpu(shptr[1]);
171 seghdr.addr = le32_to_cpu(shptr[2]);
172 seghdr.size = le32_to_cpu(shptr[3]);
173
169 offset += sizeof(seghdr); 174 offset += sizeof(seghdr);
170 if (seghdr.sync1 != APU_ROM_SYNC1 || 175 if (seghdr.sync1 != APU_ROM_SYNC1 ||
171 seghdr.sync2 != APU_ROM_SYNC2) { 176 seghdr.sync2 != APU_ROM_SYNC2) {
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c
index ed8118390b02..eabf00c6351b 100644
--- a/drivers/media/video/cx18/cx18-mailbox.c
+++ b/drivers/media/video/cx18/cx18-mailbox.c
@@ -434,6 +434,7 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_in_work_order *order)
434{ 434{
435 u32 handle, mdl_ack_offset, mdl_ack_count; 435 u32 handle, mdl_ack_offset, mdl_ack_count;
436 struct cx18_mailbox *mb; 436 struct cx18_mailbox *mb;
437 int i;
437 438
438 mb = &order->mb; 439 mb = &order->mb;
439 handle = mb->args[0]; 440 handle = mb->args[0];
@@ -447,8 +448,9 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_in_work_order *order)
447 return -1; 448 return -1;
448 } 449 }
449 450
450 cx18_memcpy_fromio(cx, order->mdl_ack, cx->enc_mem + mdl_ack_offset, 451 for (i = 0; i < sizeof(struct cx18_mdl_ack) * mdl_ack_count; i += sizeof(u32))
451 sizeof(struct cx18_mdl_ack) * mdl_ack_count); 452 ((u32 *)order->mdl_ack)[i / sizeof(u32)] =
453 cx18_readl(cx, cx->enc_mem + mdl_ack_offset + i);
452 454
453 if ((order->flags & CX18_F_EWO_MB_STALE) == 0) 455 if ((order->flags & CX18_F_EWO_MB_STALE) == 0)
454 mb_ack_irq(cx, order); 456 mb_ack_irq(cx, order);
@@ -538,6 +540,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
538 struct cx18_mailbox *order_mb; 540 struct cx18_mailbox *order_mb;
539 struct cx18_in_work_order *order; 541 struct cx18_in_work_order *order;
540 int submit; 542 int submit;
543 int i;
541 544
542 switch (rpu) { 545 switch (rpu) {
543 case CPU: 546 case CPU:
@@ -562,10 +565,12 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
562 order_mb = &order->mb; 565 order_mb = &order->mb;
563 566
564 /* mb->cmd and mb->args[0] through mb->args[2] */ 567 /* mb->cmd and mb->args[0] through mb->args[2] */
565 cx18_memcpy_fromio(cx, &order_mb->cmd, &mb->cmd, 4 * sizeof(u32)); 568 for (i = 0; i < 4; i++)
569 (&order_mb->cmd)[i] = cx18_readl(cx, &mb->cmd + i);
570
566 /* mb->request and mb->ack. N.B. we want to read mb->ack last */ 571 /* mb->request and mb->ack. N.B. we want to read mb->ack last */
567 cx18_memcpy_fromio(cx, &order_mb->request, &mb->request, 572 for (i = 0; i < 2; i++)
568 2 * sizeof(u32)); 573 (&order_mb->request)[i] = cx18_readl(cx, &mb->request + i);
569 574
570 if (order_mb->request == order_mb->ack) { 575 if (order_mb->request == order_mb->ack) {
571 CX18_DEBUG_WARN("Possibly falling behind: %s self-ack'ed our " 576 CX18_DEBUG_WARN("Possibly falling behind: %s self-ack'ed our "
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index e46446a449c0..ed7b2aa1ed83 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -471,7 +471,7 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
471 dprintk(1,"Loading firmware ...\n"); 471 dprintk(1,"Loading firmware ...\n");
472 dataptr = (u32*)firmware->data; 472 dataptr = (u32*)firmware->data;
473 for (i = 0; i < (firmware->size >> 2); i++) { 473 for (i = 0; i < (firmware->size >> 2); i++) {
474 value = *dataptr; 474 value = le32_to_cpu(*dataptr);
475 checksum += ~value; 475 checksum += ~value;
476 memory_write(dev->core, i, value); 476 memory_write(dev->core, i, value);
477 dataptr++; 477 dataptr++;
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 20a7e24de6fb..92da7c28b6f0 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -974,6 +974,7 @@ struct em28xx_board em28xx_boards[] = {
974 [EM2884_BOARD_CINERGY_HTC_STICK] = { 974 [EM2884_BOARD_CINERGY_HTC_STICK] = {
975 .name = "Terratec Cinergy HTC Stick", 975 .name = "Terratec Cinergy HTC Stick",
976 .has_dvb = 1, 976 .has_dvb = 1,
977 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
977#if 0 978#if 0
978 .tuner_type = TUNER_PHILIPS_TDA8290, 979 .tuner_type = TUNER_PHILIPS_TDA8290,
979 .tuner_addr = 0x41, 980 .tuner_addr = 0x41,
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index fce5f7680c99..5e30c4f3f248 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -527,6 +527,8 @@ static int em28xx_ir_init(struct em28xx *dev)
527 527
528 if (dev->board.ir_codes == NULL) { 528 if (dev->board.ir_codes == NULL) {
529 /* No remote control support */ 529 /* No remote control support */
530 em28xx_warn("Remote control support is not available for "
531 "this card.\n");
530 return 0; 532 return 0;
531 } 533 }
532 534
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 137166d73945..31721eadc597 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -1653,7 +1653,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
1653 enum v4l2_buf_type buf_type) 1653 enum v4l2_buf_type buf_type)
1654{ 1654{
1655 struct gspca_dev *gspca_dev = video_drvdata(file); 1655 struct gspca_dev *gspca_dev = video_drvdata(file);
1656 int ret; 1656 int i, ret;
1657 1657
1658 if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1658 if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1659 return -EINVAL; 1659 return -EINVAL;
@@ -1678,6 +1678,8 @@ static int vidioc_streamoff(struct file *file, void *priv,
1678 wake_up_interruptible(&gspca_dev->wq); 1678 wake_up_interruptible(&gspca_dev->wq);
1679 1679
1680 /* empty the transfer queues */ 1680 /* empty the transfer queues */
1681 for (i = 0; i < gspca_dev->nframes; i++)
1682 gspca_dev->frame[i].v4l2_buf.flags &= ~BUF_ALL_FLAGS;
1681 atomic_set(&gspca_dev->fr_q, 0); 1683 atomic_set(&gspca_dev->fr_q, 0);
1682 atomic_set(&gspca_dev->fr_i, 0); 1684 atomic_set(&gspca_dev->fr_i, 0);
1683 gspca_dev->fr_o = 0; 1685 gspca_dev->fr_o = 0;
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index b5acb1e4b4e7..80c81dd6d68b 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -96,7 +96,7 @@ static void setbrightness(struct gspca_dev *gspca_dev);
96static void setcontrast(struct gspca_dev *gspca_dev); 96static void setcontrast(struct gspca_dev *gspca_dev);
97static void setgain(struct gspca_dev *gspca_dev); 97static void setgain(struct gspca_dev *gspca_dev);
98static void setexposure(struct gspca_dev *gspca_dev); 98static void setexposure(struct gspca_dev *gspca_dev);
99static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); 99static void setagc(struct gspca_dev *gspca_dev);
100static void setawb(struct gspca_dev *gspca_dev); 100static void setawb(struct gspca_dev *gspca_dev);
101static void setaec(struct gspca_dev *gspca_dev); 101static void setaec(struct gspca_dev *gspca_dev);
102static void setsharpness(struct gspca_dev *gspca_dev); 102static void setsharpness(struct gspca_dev *gspca_dev);
@@ -189,7 +189,7 @@ static const struct ctrl sd_ctrls[] = {
189 .step = 1, 189 .step = 1,
190 .default_value = 1, 190 .default_value = 1,
191 }, 191 },
192 .set = sd_setagc 192 .set_control = setagc
193 }, 193 },
194[AWB] = { 194[AWB] = {
195 { 195 {
@@ -851,6 +851,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev)
851 int i; 851 int i;
852 852
853 for (i = 0; i < 5; i++) { 853 for (i = 0; i < 5; i++) {
854 msleep(10);
854 data = ov534_reg_read(gspca_dev, OV534_REG_STATUS); 855 data = ov534_reg_read(gspca_dev, OV534_REG_STATUS);
855 856
856 switch (data) { 857 switch (data) {
@@ -1242,10 +1243,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
1242 1243
1243 cam->ctrls = sd->ctrls; 1244 cam->ctrls = sd->ctrls;
1244 1245
1245 /* the auto white balance control works only when auto gain is set */
1246 if (sd_ctrls[AGC].qctrl.default_value == 0)
1247 gspca_dev->ctrl_inac |= (1 << AWB);
1248
1249 cam->cam_mode = ov772x_mode; 1246 cam->cam_mode = ov772x_mode;
1250 cam->nmodes = ARRAY_SIZE(ov772x_mode); 1247 cam->nmodes = ARRAY_SIZE(ov772x_mode);
1251 1248
@@ -1486,29 +1483,6 @@ scan_next:
1486 } while (remaining_len > 0); 1483 } while (remaining_len > 0);
1487} 1484}
1488 1485
1489static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val)
1490{
1491 struct sd *sd = (struct sd *) gspca_dev;
1492
1493 sd->ctrls[AGC].val = val;
1494
1495 /* the auto white balance control works only
1496 * when auto gain is set */
1497 if (val) {
1498 gspca_dev->ctrl_inac &= ~(1 << AWB);
1499 } else {
1500 gspca_dev->ctrl_inac |= (1 << AWB);
1501 if (sd->ctrls[AWB].val) {
1502 sd->ctrls[AWB].val = 0;
1503 if (gspca_dev->streaming)
1504 setawb(gspca_dev);
1505 }
1506 }
1507 if (gspca_dev->streaming)
1508 setagc(gspca_dev);
1509 return gspca_dev->usb_err;
1510}
1511
1512static int sd_querymenu(struct gspca_dev *gspca_dev, 1486static int sd_querymenu(struct gspca_dev *gspca_dev,
1513 struct v4l2_querymenu *menu) 1487 struct v4l2_querymenu *menu)
1514{ 1488{
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c
index b5797308a39b..1fd41f0d2e95 100644
--- a/drivers/media/video/gspca/ov534_9.c
+++ b/drivers/media/video/gspca/ov534_9.c
@@ -1008,6 +1008,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev)
1008 int i; 1008 int i;
1009 1009
1010 for (i = 0; i < 5; i++) { 1010 for (i = 0; i < 5; i++) {
1011 msleep(10);
1011 data = reg_r(gspca_dev, OV534_REG_STATUS); 1012 data = reg_r(gspca_dev, OV534_REG_STATUS);
1012 1013
1013 switch (data) { 1014 switch (data) {
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 2cb7d95f7be7..115da169f32a 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -418,7 +418,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
418 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; 418 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
419 419
420 gspca_dev->vdev.ctrl_handler = hdl; 420 gspca_dev->vdev.ctrl_handler = hdl;
421 v4l2_ctrl_handler_init(hdl, 4); 421 v4l2_ctrl_handler_init(hdl, 5);
422 422
423 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 423 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
424 V4L2_CID_CONTRAST, 0, 15, 1, 7); 424 V4L2_CID_CONTRAST, 0, 15, 1, 7);
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index ad098202d7f0..6c31e46a1fd2 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -1761,7 +1761,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
1761 V4L2_CID_SATURATION, 0, 255, 1, 127); 1761 V4L2_CID_SATURATION, 0, 255, 1, 127);
1762 sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 1762 sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1763 V4L2_CID_HUE, -180, 180, 1, 0); 1763 V4L2_CID_HUE, -180, 180, 1, 0);
1764 v4l2_ctrl_cluster(4, &sd->brightness);
1765 1764
1766 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 1765 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1767 V4L2_CID_GAMMA, 0, 255, 1, 0x10); 1766 V4L2_CID_GAMMA, 0, 255, 1, 0x10);
@@ -1770,7 +1769,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
1770 V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0x28); 1769 V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0x28);
1771 sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 1770 sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1772 V4L2_CID_RED_BALANCE, 0, 127, 1, 0x28); 1771 V4L2_CID_RED_BALANCE, 0, 127, 1, 0x28);
1773 v4l2_ctrl_cluster(2, &sd->blue);
1774 1772
1775 if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 && 1773 if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 &&
1776 sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 && 1774 sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 &&
@@ -1779,7 +1777,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
1779 V4L2_CID_HFLIP, 0, 1, 1, 0); 1777 V4L2_CID_HFLIP, 0, 1, 1, 0);
1780 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 1778 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1781 V4L2_CID_VFLIP, 0, 1, 1, 0); 1779 V4L2_CID_VFLIP, 0, 1, 1, 0);
1782 v4l2_ctrl_cluster(2, &sd->hflip);
1783 } 1780 }
1784 1781
1785 if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB && 1782 if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB &&
@@ -1794,6 +1791,20 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
1794 V4L2_CID_GAIN, 0, 28, 1, 0); 1791 V4L2_CID_GAIN, 0, 28, 1, 0);
1795 sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 1792 sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1796 V4L2_CID_AUTOGAIN, 0, 1, 1, 1); 1793 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
1794 }
1795
1796 sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1797 V4L2_CID_JPEG_COMPRESSION_QUALITY, 50, 90, 1, 80);
1798 if (hdl->error) {
1799 pr_err("Could not initialize controls\n");
1800 return hdl->error;
1801 }
1802
1803 v4l2_ctrl_cluster(4, &sd->brightness);
1804 v4l2_ctrl_cluster(2, &sd->blue);
1805 if (sd->hflip)
1806 v4l2_ctrl_cluster(2, &sd->hflip);
1807 if (sd->autogain) {
1797 if (sd->sensor == SENSOR_SOI968) 1808 if (sd->sensor == SENSOR_SOI968)
1798 /* this sensor doesn't have the exposure control and 1809 /* this sensor doesn't have the exposure control and
1799 autogain is clustered with gain instead. This works 1810 autogain is clustered with gain instead. This works
@@ -1803,13 +1814,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
1803 /* Otherwise autogain is clustered with exposure. */ 1814 /* Otherwise autogain is clustered with exposure. */
1804 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); 1815 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false);
1805 } 1816 }
1806
1807 sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1808 V4L2_CID_JPEG_COMPRESSION_QUALITY, 50, 90, 1, 80);
1809 if (hdl->error) {
1810 pr_err("Could not initialize controls\n");
1811 return hdl->error;
1812 }
1813 return 0; 1817 return 0;
1814} 1818}
1815 1819
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 4d1696d1a7f4..f38faa9b37c3 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -3120,7 +3120,7 @@ static const struct sd_desc sd_desc = {
3120 | (SENSOR_ ## sensor << 8) \ 3120 | (SENSOR_ ## sensor << 8) \
3121 | (flags) 3121 | (flags)
3122static const struct usb_device_id device_table[] = { 3122static const struct usb_device_id device_table[] = {
3123 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, 3123 {USB_DEVICE(0x0458, 0x7025), BSF(SN9C120, MI0360B, F_PDN_INV)},
3124 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, 3124 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)},
3125 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)}, 3125 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)},
3126 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)}, 3126 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)},
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 057929e165ab..5462ce2f60ea 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -866,10 +866,10 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev,
866 pci_write_config_dword(pdev, 0x40, 0xffff); 866 pci_write_config_dword(pdev, 0x40, 0xffff);
867 867
868 IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, " 868 IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, "
869 "irq: %d, latency: %d, memory: 0x%lx\n", 869 "irq: %d, latency: %d, memory: 0x%llx\n",
870 pdev->device, pdev->revision, pdev->bus->number, 870 pdev->device, pdev->revision, pdev->bus->number,
871 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), 871 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
872 pdev->irq, pci_latency, (unsigned long)itv->base_addr); 872 pdev->irq, pci_latency, (u64)itv->base_addr);
873 873
874 return 0; 874 return 0;
875} 875}
@@ -1007,7 +1007,7 @@ static int __devinit ivtv_probe(struct pci_dev *pdev,
1007 itv->cxhdl.priv = itv; 1007 itv->cxhdl.priv = itv;
1008 itv->cxhdl.func = ivtv_api_func; 1008 itv->cxhdl.func = ivtv_api_func;
1009 1009
1010 IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); 1010 IVTV_DEBUG_INFO("base addr: 0x%llx\n", (u64)itv->base_addr);
1011 1011
1012 /* PCI Device Setup */ 1012 /* PCI Device Setup */
1013 retval = ivtv_setup_pci(itv, pdev, pci_id); 1013 retval = ivtv_setup_pci(itv, pdev, pci_id);
@@ -1017,8 +1017,8 @@ static int __devinit ivtv_probe(struct pci_dev *pdev,
1017 goto free_mem; 1017 goto free_mem;
1018 1018
1019 /* map io memory */ 1019 /* map io memory */
1020 IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", 1020 IVTV_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n",
1021 itv->base_addr + IVTV_ENCODER_OFFSET, IVTV_ENCODER_SIZE); 1021 (u64)itv->base_addr + IVTV_ENCODER_OFFSET, IVTV_ENCODER_SIZE);
1022 itv->enc_mem = ioremap_nocache(itv->base_addr + IVTV_ENCODER_OFFSET, 1022 itv->enc_mem = ioremap_nocache(itv->base_addr + IVTV_ENCODER_OFFSET,
1023 IVTV_ENCODER_SIZE); 1023 IVTV_ENCODER_SIZE);
1024 if (!itv->enc_mem) { 1024 if (!itv->enc_mem) {
@@ -1034,8 +1034,8 @@ static int __devinit ivtv_probe(struct pci_dev *pdev,
1034 } 1034 }
1035 1035
1036 if (itv->has_cx23415) { 1036 if (itv->has_cx23415) {
1037 IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", 1037 IVTV_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n",
1038 itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); 1038 (u64)itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
1039 itv->dec_mem = ioremap_nocache(itv->base_addr + IVTV_DECODER_OFFSET, 1039 itv->dec_mem = ioremap_nocache(itv->base_addr + IVTV_DECODER_OFFSET,
1040 IVTV_DECODER_SIZE); 1040 IVTV_DECODER_SIZE);
1041 if (!itv->dec_mem) { 1041 if (!itv->dec_mem) {
@@ -1056,8 +1056,8 @@ static int __devinit ivtv_probe(struct pci_dev *pdev,
1056 } 1056 }
1057 1057
1058 /* map registers memory */ 1058 /* map registers memory */
1059 IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", 1059 IVTV_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n",
1060 itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); 1060 (u64)itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1061 itv->reg_mem = 1061 itv->reg_mem =
1062 ioremap_nocache(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); 1062 ioremap_nocache(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1063 if (!itv->reg_mem) { 1063 if (!itv->reg_mem) {
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index 2e220028aad2..a7e00f8938f8 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -622,7 +622,7 @@ struct ivtv {
622 struct v4l2_subdev *sd_video; /* controlling video decoder subdev */ 622 struct v4l2_subdev *sd_video; /* controlling video decoder subdev */
623 struct v4l2_subdev *sd_audio; /* controlling audio subdev */ 623 struct v4l2_subdev *sd_audio; /* controlling audio subdev */
624 struct v4l2_subdev *sd_muxer; /* controlling audio muxer subdev */ 624 struct v4l2_subdev *sd_muxer; /* controlling audio muxer subdev */
625 u32 base_addr; /* PCI resource base address */ 625 resource_size_t base_addr; /* PCI resource base address */
626 volatile void __iomem *enc_mem; /* pointer to mapped encoder memory */ 626 volatile void __iomem *enc_mem; /* pointer to mapped encoder memory */
627 volatile void __iomem *dec_mem; /* pointer to mapped decoder memory */ 627 volatile void __iomem *dec_mem; /* pointer to mapped decoder memory */
628 volatile void __iomem *reg_mem; /* pointer to mapped registers */ 628 volatile void __iomem *reg_mem; /* pointer to mapped registers */
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c
index d2dec585e61b..3945556f5733 100644
--- a/drivers/media/video/mem2mem_testdev.c
+++ b/drivers/media/video/mem2mem_testdev.c
@@ -110,22 +110,6 @@ enum {
110 V4L2_M2M_DST = 1, 110 V4L2_M2M_DST = 1,
111}; 111};
112 112
113/* Source and destination queue data */
114static struct m2mtest_q_data q_data[2];
115
116static struct m2mtest_q_data *get_q_data(enum v4l2_buf_type type)
117{
118 switch (type) {
119 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
120 return &q_data[V4L2_M2M_SRC];
121 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
122 return &q_data[V4L2_M2M_DST];
123 default:
124 BUG();
125 }
126 return NULL;
127}
128
129#define V4L2_CID_TRANS_TIME_MSEC V4L2_CID_PRIVATE_BASE 113#define V4L2_CID_TRANS_TIME_MSEC V4L2_CID_PRIVATE_BASE
130#define V4L2_CID_TRANS_NUM_BUFS (V4L2_CID_PRIVATE_BASE + 1) 114#define V4L2_CID_TRANS_NUM_BUFS (V4L2_CID_PRIVATE_BASE + 1)
131 115
@@ -198,8 +182,26 @@ struct m2mtest_ctx {
198 int aborting; 182 int aborting;
199 183
200 struct v4l2_m2m_ctx *m2m_ctx; 184 struct v4l2_m2m_ctx *m2m_ctx;
185
186 /* Source and destination queue data */
187 struct m2mtest_q_data q_data[2];
201}; 188};
202 189
190static struct m2mtest_q_data *get_q_data(struct m2mtest_ctx *ctx,
191 enum v4l2_buf_type type)
192{
193 switch (type) {
194 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
195 return &ctx->q_data[V4L2_M2M_SRC];
196 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
197 return &ctx->q_data[V4L2_M2M_DST];
198 default:
199 BUG();
200 }
201 return NULL;
202}
203
204
203static struct v4l2_queryctrl *get_ctrl(int id) 205static struct v4l2_queryctrl *get_ctrl(int id)
204{ 206{
205 int i; 207 int i;
@@ -223,7 +225,7 @@ static int device_process(struct m2mtest_ctx *ctx,
223 int tile_w, bytes_left; 225 int tile_w, bytes_left;
224 int width, height, bytesperline; 226 int width, height, bytesperline;
225 227
226 q_data = get_q_data(V4L2_BUF_TYPE_VIDEO_OUTPUT); 228 q_data = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
227 229
228 width = q_data->width; 230 width = q_data->width;
229 height = q_data->height; 231 height = q_data->height;
@@ -436,7 +438,7 @@ static int vidioc_g_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
436 if (!vq) 438 if (!vq)
437 return -EINVAL; 439 return -EINVAL;
438 440
439 q_data = get_q_data(f->type); 441 q_data = get_q_data(ctx, f->type);
440 442
441 f->fmt.pix.width = q_data->width; 443 f->fmt.pix.width = q_data->width;
442 f->fmt.pix.height = q_data->height; 444 f->fmt.pix.height = q_data->height;
@@ -535,7 +537,7 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
535 if (!vq) 537 if (!vq)
536 return -EINVAL; 538 return -EINVAL;
537 539
538 q_data = get_q_data(f->type); 540 q_data = get_q_data(ctx, f->type);
539 if (!q_data) 541 if (!q_data)
540 return -EINVAL; 542 return -EINVAL;
541 543
@@ -747,7 +749,7 @@ static int m2mtest_queue_setup(struct vb2_queue *vq,
747 struct m2mtest_q_data *q_data; 749 struct m2mtest_q_data *q_data;
748 unsigned int size, count = *nbuffers; 750 unsigned int size, count = *nbuffers;
749 751
750 q_data = get_q_data(vq->type); 752 q_data = get_q_data(ctx, vq->type);
751 753
752 size = q_data->width * q_data->height * q_data->fmt->depth >> 3; 754 size = q_data->width * q_data->height * q_data->fmt->depth >> 3;
753 755
@@ -775,7 +777,7 @@ static int m2mtest_buf_prepare(struct vb2_buffer *vb)
775 777
776 dprintk(ctx->dev, "type: %d\n", vb->vb2_queue->type); 778 dprintk(ctx->dev, "type: %d\n", vb->vb2_queue->type);
777 779
778 q_data = get_q_data(vb->vb2_queue->type); 780 q_data = get_q_data(ctx, vb->vb2_queue->type);
779 781
780 if (vb2_plane_size(vb, 0) < q_data->sizeimage) { 782 if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
781 dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n", 783 dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n",
@@ -860,6 +862,9 @@ static int m2mtest_open(struct file *file)
860 ctx->transtime = MEM2MEM_DEF_TRANSTIME; 862 ctx->transtime = MEM2MEM_DEF_TRANSTIME;
861 ctx->num_processed = 0; 863 ctx->num_processed = 0;
862 864
865 ctx->q_data[V4L2_M2M_SRC].fmt = &formats[0];
866 ctx->q_data[V4L2_M2M_DST].fmt = &formats[0];
867
863 ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init); 868 ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);
864 869
865 if (IS_ERR(ctx->m2m_ctx)) { 870 if (IS_ERR(ctx->m2m_ctx)) {
@@ -986,9 +991,6 @@ static int m2mtest_probe(struct platform_device *pdev)
986 goto err_m2m; 991 goto err_m2m;
987 } 992 }
988 993
989 q_data[V4L2_M2M_SRC].fmt = &formats[0];
990 q_data[V4L2_M2M_DST].fmt = &formats[0];
991
992 return 0; 994 return 0;
993 995
994 v4l2_m2m_release(dev->m2m_dev); 996 v4l2_m2m_release(dev->m2m_dev);
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index ded26b7286fa..41f9a254b245 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -345,19 +345,6 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
345 PRP_INTR_CH2OVF, 345 PRP_INTR_CH2OVF,
346 } 346 }
347 }, 347 },
348 {
349 .in_fmt = V4L2_MBUS_FMT_UYVY8_2X8,
350 .out_fmt = V4L2_PIX_FMT_YUV420,
351 .cfg = {
352 .channel = 2,
353 .in_fmt = PRP_CNTL_DATA_IN_YUV422,
354 .out_fmt = PRP_CNTL_CH2_OUT_YUV420,
355 .src_pixel = 0x22000888, /* YUV422 (YUYV) */
356 .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR |
357 PRP_INTR_CH2FC | PRP_INTR_LBOVF |
358 PRP_INTR_CH2OVF,
359 }
360 },
361}; 348};
362 349
363static struct mx2_fmt_cfg *mx27_emma_prp_get_format( 350static struct mx2_fmt_cfg *mx27_emma_prp_get_format(
@@ -984,7 +971,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
984 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 971 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
985 struct mx2_camera_dev *pcdev = ici->priv; 972 struct mx2_camera_dev *pcdev = ici->priv;
986 struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; 973 struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,};
987 const struct soc_camera_format_xlate *xlate;
988 unsigned long common_flags; 974 unsigned long common_flags;
989 int ret; 975 int ret;
990 int bytesperline; 976 int bytesperline;
@@ -1029,31 +1015,14 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1029 return ret; 1015 return ret;
1030 } 1016 }
1031 1017
1032 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
1033 if (!xlate) {
1034 dev_warn(icd->parent, "Format %x not found\n", pixfmt);
1035 return -EINVAL;
1036 }
1037
1038 if (xlate->code == V4L2_MBUS_FMT_YUYV8_2X8) {
1039 csicr1 |= CSICR1_PACK_DIR;
1040 csicr1 &= ~CSICR1_SWAP16_EN;
1041 dev_dbg(icd->parent, "already yuyv format, don't convert\n");
1042 } else if (xlate->code == V4L2_MBUS_FMT_UYVY8_2X8) {
1043 csicr1 &= ~CSICR1_PACK_DIR;
1044 csicr1 |= CSICR1_SWAP16_EN;
1045 dev_dbg(icd->parent, "convert uyvy mbus format into yuyv\n");
1046 } else {
1047 dev_warn(icd->parent, "mbus format not supported\n");
1048 return -EINVAL;
1049 }
1050
1051 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) 1018 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
1052 csicr1 |= CSICR1_REDGE; 1019 csicr1 |= CSICR1_REDGE;
1053 if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) 1020 if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
1054 csicr1 |= CSICR1_SOF_POL; 1021 csicr1 |= CSICR1_SOF_POL;
1055 if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) 1022 if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
1056 csicr1 |= CSICR1_HSYNC_POL; 1023 csicr1 |= CSICR1_HSYNC_POL;
1024 if (pcdev->platform_flags & MX2_CAMERA_SWAP16)
1025 csicr1 |= CSICR1_SWAP16_EN;
1057 if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) 1026 if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC)
1058 csicr1 |= CSICR1_EXT_VSYNC; 1027 csicr1 |= CSICR1_EXT_VSYNC;
1059 if (pcdev->platform_flags & MX2_CAMERA_CCIR) 1028 if (pcdev->platform_flags & MX2_CAMERA_CCIR)
@@ -1064,6 +1033,8 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1064 csicr1 |= CSICR1_GCLK_MODE; 1033 csicr1 |= CSICR1_GCLK_MODE;
1065 if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) 1034 if (pcdev->platform_flags & MX2_CAMERA_INV_DATA)
1066 csicr1 |= CSICR1_INV_DATA; 1035 csicr1 |= CSICR1_INV_DATA;
1036 if (pcdev->platform_flags & MX2_CAMERA_PACK_DIR_MSB)
1037 csicr1 |= CSICR1_PACK_DIR;
1067 1038
1068 pcdev->csicr1 = csicr1; 1039 pcdev->csicr1 = csicr1;
1069 1040
@@ -1138,8 +1109,7 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
1138 return 0; 1109 return 0;
1139 } 1110 }
1140 1111
1141 if (code == V4L2_MBUS_FMT_YUYV8_2X8 || 1112 if (code == V4L2_MBUS_FMT_YUYV8_2X8) {
1142 code == V4L2_MBUS_FMT_UYVY8_2X8) {
1143 formats++; 1113 formats++;
1144 if (xlate) { 1114 if (xlate) {
1145 /* 1115 /*
@@ -1155,18 +1125,6 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
1155 } 1125 }
1156 } 1126 }
1157 1127
1158 if (code == V4L2_MBUS_FMT_UYVY8_2X8) {
1159 formats++;
1160 if (xlate) {
1161 xlate->host_fmt =
1162 soc_mbus_get_fmtdesc(V4L2_MBUS_FMT_YUYV8_2X8);
1163 xlate->code = code;
1164 dev_dbg(dev, "Providing host format %s for sensor code %d\n",
1165 xlate->host_fmt->name, code);
1166 xlate++;
1167 }
1168 }
1169
1170 /* Generic pass-trough */ 1128 /* Generic pass-trough */
1171 formats++; 1129 formats++;
1172 if (xlate) { 1130 if (xlate) {
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index af2d9086d7e8..c370c2d87c17 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -29,6 +29,7 @@
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/slab.h>
32#include <linux/uaccess.h> 33#include <linux/uaccess.h>
33#include <linux/isa.h> 34#include <linux/isa.h>
34#include <asm/io.h> 35#include <asm/io.h>
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index fedcd561ba27..92fc5a20fb76 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -615,7 +615,7 @@ int fimc_ctrls_create(struct fimc_ctx *ctx)
615 ctx->effect.type = FIMC_REG_CIIMGEFF_FIN_BYPASS; 615 ctx->effect.type = FIMC_REG_CIIMGEFF_FIN_BYPASS;
616 616
617 if (!handler->error) { 617 if (!handler->error) {
618 v4l2_ctrl_cluster(3, &ctrls->colorfx); 618 v4l2_ctrl_cluster(2, &ctrls->colorfx);
619 ctrls->ready = true; 619 ctrls->ready = true;
620 } 620 }
621 621
diff --git a/drivers/media/video/s5p-mfc/regs-mfc.h b/drivers/media/video/s5p-mfc/regs-mfc.h
index 053a8a872fd7..a19bece41ba9 100644
--- a/drivers/media/video/s5p-mfc/regs-mfc.h
+++ b/drivers/media/video/s5p-mfc/regs-mfc.h
@@ -164,10 +164,15 @@
164 decoded pic */ 164 decoded pic */
165#define S5P_FIMV_SI_DISPLAY_Y_ADR 0x2010 /* luma addr of displayed pic */ 165#define S5P_FIMV_SI_DISPLAY_Y_ADR 0x2010 /* luma addr of displayed pic */
166#define S5P_FIMV_SI_DISPLAY_C_ADR 0x2014 /* chroma addrof displayed pic */ 166#define S5P_FIMV_SI_DISPLAY_C_ADR 0x2014 /* chroma addrof displayed pic */
167
167#define S5P_FIMV_SI_CONSUMED_BYTES 0x2018 /* Consumed number of bytes to 168#define S5P_FIMV_SI_CONSUMED_BYTES 0x2018 /* Consumed number of bytes to
168 decode a frame */ 169 decode a frame */
169#define S5P_FIMV_SI_DISPLAY_STATUS 0x201c /* status of decoded picture */ 170#define S5P_FIMV_SI_DISPLAY_STATUS 0x201c /* status of decoded picture */
170 171
172#define S5P_FIMV_SI_DECODE_Y_ADR 0x2024 /* luma addr of decoded pic */
173#define S5P_FIMV_SI_DECODE_C_ADR 0x2028 /* chroma addrof decoded pic */
174#define S5P_FIMV_SI_DECODE_STATUS 0x202c /* status of decoded picture */
175
171#define S5P_FIMV_SI_CH0_SB_ST_ADR 0x2044 /* start addr of stream buf */ 176#define S5P_FIMV_SI_CH0_SB_ST_ADR 0x2044 /* start addr of stream buf */
172#define S5P_FIMV_SI_CH0_SB_FRM_SIZE 0x2048 /* size of stream buf */ 177#define S5P_FIMV_SI_CH0_SB_FRM_SIZE 0x2048 /* size of stream buf */
173#define S5P_FIMV_SI_CH0_DESC_ADR 0x204c /* addr of descriptor buf */ 178#define S5P_FIMV_SI_CH0_DESC_ADR 0x204c /* addr of descriptor buf */
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
index c25ec022d267..4dd32fc8fd82 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
@@ -627,13 +627,13 @@ static int s5p_mfc_dec_s_ctrl(struct v4l2_ctrl *ctrl)
627 627
628 switch (ctrl->id) { 628 switch (ctrl->id) {
629 case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY: 629 case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY:
630 ctx->loop_filter_mpeg4 = ctrl->val; 630 ctx->display_delay = ctrl->val;
631 break; 631 break;
632 case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE: 632 case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE:
633 ctx->display_delay_enable = ctrl->val; 633 ctx->display_delay_enable = ctrl->val;
634 break; 634 break;
635 case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: 635 case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
636 ctx->display_delay = ctrl->val; 636 ctx->loop_filter_mpeg4 = ctrl->val;
637 break; 637 break;
638 case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: 638 case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE:
639 ctx->slice_interface = ctrl->val; 639 ctx->slice_interface = ctrl->val;
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
index acedb2004be3..03d83340e7fb 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
@@ -243,12 +243,6 @@ static struct mfc_control controls[] = {
243 .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, 243 .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0,
244 .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, 244 .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_4_0,
245 .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, 245 .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0,
246 .menu_skip_mask = ~(
247 (1 << V4L2_MPEG_VIDEO_H264_LEVEL_4_1) |
248 (1 << V4L2_MPEG_VIDEO_H264_LEVEL_4_2) |
249 (1 << V4L2_MPEG_VIDEO_H264_LEVEL_5_0) |
250 (1 << V4L2_MPEG_VIDEO_H264_LEVEL_5_1)
251 ),
252 }, 246 },
253 { 247 {
254 .id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, 248 .id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL,
@@ -494,7 +488,7 @@ static struct mfc_control controls[] = {
494 .type = V4L2_CTRL_TYPE_MENU, 488 .type = V4L2_CTRL_TYPE_MENU,
495 .minimum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, 489 .minimum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED,
496 .maximum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED, 490 .maximum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED,
497 .default_value = 0, 491 .default_value = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED,
498 .menu_skip_mask = 0, 492 .menu_skip_mask = 0,
499 }, 493 },
500 { 494 {
@@ -534,7 +528,7 @@ static struct mfc_control controls[] = {
534 .type = V4L2_CTRL_TYPE_MENU, 528 .type = V4L2_CTRL_TYPE_MENU,
535 .minimum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, 529 .minimum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE,
536 .maximum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE, 530 .maximum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE,
537 .default_value = 0, 531 .default_value = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE,
538 .menu_skip_mask = 0, 532 .menu_skip_mask = 0,
539 }, 533 },
540 { 534 {
@@ -907,6 +901,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
907 mfc_err("failed to try output format\n"); 901 mfc_err("failed to try output format\n");
908 return -EINVAL; 902 return -EINVAL;
909 } 903 }
904 v4l_bound_align_image(&pix_fmt_mp->width, 8, 1920, 1,
905 &pix_fmt_mp->height, 4, 1080, 1, 0);
910 } else { 906 } else {
911 mfc_err("invalid buf type\n"); 907 mfc_err("invalid buf type\n");
912 return -EINVAL; 908 return -EINVAL;
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_opr.h b/drivers/media/video/s5p-mfc/s5p_mfc_opr.h
index db83836e6a9f..5932d1c782c5 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_opr.h
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_opr.h
@@ -57,10 +57,12 @@ void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq);
57 S5P_FIMV_SI_DISPLAY_Y_ADR) << \ 57 S5P_FIMV_SI_DISPLAY_Y_ADR) << \
58 MFC_OFFSET_SHIFT) 58 MFC_OFFSET_SHIFT)
59#define s5p_mfc_get_dec_y_adr() (readl(dev->regs_base + \ 59#define s5p_mfc_get_dec_y_adr() (readl(dev->regs_base + \
60 S5P_FIMV_SI_DISPLAY_Y_ADR) << \ 60 S5P_FIMV_SI_DECODE_Y_ADR) << \
61 MFC_OFFSET_SHIFT) 61 MFC_OFFSET_SHIFT)
62#define s5p_mfc_get_dspl_status() readl(dev->regs_base + \ 62#define s5p_mfc_get_dspl_status() readl(dev->regs_base + \
63 S5P_FIMV_SI_DISPLAY_STATUS) 63 S5P_FIMV_SI_DISPLAY_STATUS)
64#define s5p_mfc_get_dec_status() readl(dev->regs_base + \
65 S5P_FIMV_SI_DECODE_STATUS)
64#define s5p_mfc_get_frame_type() (readl(dev->regs_base + \ 66#define s5p_mfc_get_frame_type() (readl(dev->regs_base + \
65 S5P_FIMV_DECODE_FRAME_TYPE) \ 67 S5P_FIMV_DECODE_FRAME_TYPE) \
66 & S5P_FIMV_DECODE_FRAME_MASK) 68 & S5P_FIMV_DECODE_FRAME_MASK)
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_shm.h b/drivers/media/video/s5p-mfc/s5p_mfc_shm.h
index 764eac6bcc4c..cf962a466276 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_shm.h
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_shm.h
@@ -13,8 +13,7 @@
13#ifndef S5P_MFC_SHM_H_ 13#ifndef S5P_MFC_SHM_H_
14#define S5P_MFC_SHM_H_ 14#define S5P_MFC_SHM_H_
15 15
16enum MFC_SHM_OFS 16enum MFC_SHM_OFS {
17{
18 EXTENEDED_DECODE_STATUS = 0x00, /* D */ 17 EXTENEDED_DECODE_STATUS = 0x00, /* D */
19 SET_FRAME_TAG = 0x04, /* D */ 18 SET_FRAME_TAG = 0x04, /* D */
20 GET_FRAME_TAG_TOP = 0x08, /* D */ 19 GET_FRAME_TAG_TOP = 0x08, /* D */
diff --git a/drivers/media/video/smiapp/Kconfig b/drivers/media/video/smiapp/Kconfig
index f7b35ff443bf..fb99ff18be07 100644
--- a/drivers/media/video/smiapp/Kconfig
+++ b/drivers/media/video/smiapp/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_SMIAPP 1config VIDEO_SMIAPP
2 tristate "SMIA++/SMIA sensor support" 2 tristate "SMIA++/SMIA sensor support"
3 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API 3 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAVE_CLK
4 select VIDEO_SMIAPP_PLL 4 select VIDEO_SMIAPP_PLL
5 ---help--- 5 ---help---
6 This is a generic driver for SMIA++/SMIA camera modules. 6 This is a generic driver for SMIA++/SMIA camera modules.
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c
index f518026cb67b..e8c93c89265a 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -32,6 +32,7 @@
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/regulator/consumer.h> 34#include <linux/regulator/consumer.h>
35#include <linux/slab.h>
35#include <linux/v4l2-mediabus.h> 36#include <linux/v4l2-mediabus.h>
36#include <media/v4l2-device.h> 37#include <media/v4l2-device.h>
37 38
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 3e050e12153b..1ad5ab6ce5cf 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1178,7 +1178,7 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1178 return 0; 1178 return 0;
1179 if (vt->type == t->mode && analog_ops->get_afc) 1179 if (vt->type == t->mode && analog_ops->get_afc)
1180 vt->afc = analog_ops->get_afc(&t->fe); 1180 vt->afc = analog_ops->get_afc(&t->fe);
1181 if (t->mode != V4L2_TUNER_RADIO) { 1181 if (vt->type != V4L2_TUNER_RADIO) {
1182 vt->capability |= V4L2_TUNER_CAP_NORM; 1182 vt->capability |= V4L2_TUNER_CAP_NORM;
1183 vt->rangelow = tv_range[0] * 16; 1183 vt->rangelow = tv_range[0] * 16;
1184 vt->rangehigh = tv_range[1] * 16; 1184 vt->rangehigh = tv_range[1] * 16;
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 5ccbd4629f9c..83dbb2ddff10 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -656,7 +656,7 @@ static void determine_valid_ioctls(struct video_device *vdev)
656 SET_VALID_IOCTL(ops, VIDIOC_TRY_ENCODER_CMD, vidioc_try_encoder_cmd); 656 SET_VALID_IOCTL(ops, VIDIOC_TRY_ENCODER_CMD, vidioc_try_encoder_cmd);
657 SET_VALID_IOCTL(ops, VIDIOC_DECODER_CMD, vidioc_decoder_cmd); 657 SET_VALID_IOCTL(ops, VIDIOC_DECODER_CMD, vidioc_decoder_cmd);
658 SET_VALID_IOCTL(ops, VIDIOC_TRY_DECODER_CMD, vidioc_try_decoder_cmd); 658 SET_VALID_IOCTL(ops, VIDIOC_TRY_DECODER_CMD, vidioc_try_decoder_cmd);
659 if (ops->vidioc_g_parm || vdev->current_norm) 659 if (ops->vidioc_g_parm || vdev->vfl_type == VFL_TYPE_GRABBER)
660 set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls); 660 set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls);
661 SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm); 661 SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm);
662 SET_VALID_IOCTL(ops, VIDIOC_G_TUNER, vidioc_g_tuner); 662 SET_VALID_IOCTL(ops, VIDIOC_G_TUNER, vidioc_g_tuner);
@@ -679,6 +679,8 @@ static void determine_valid_ioctls(struct video_device *vdev)
679 SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset); 679 SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset);
680 SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings); 680 SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings);
681 SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings); 681 SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings);
682 SET_VALID_IOCTL(ops, VIDIOC_ENUM_DV_TIMINGS, vidioc_enum_dv_timings);
683 SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_TIMINGS, vidioc_query_dv_timings);
682 /* yes, really vidioc_subscribe_event */ 684 /* yes, really vidioc_subscribe_event */
683 SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event); 685 SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event);
684 SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event); 686 SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event);
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 91be4e871f43..d7fa8962d8b3 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1680,6 +1680,7 @@ static long __video_do_ioctl(struct file *file,
1680 break; 1680 break;
1681 1681
1682 ret = 0; 1682 ret = 0;
1683 p->parm.capture.readbuffers = 2;
1683 if (ops->vidioc_g_std) 1684 if (ops->vidioc_g_std)
1684 ret = ops->vidioc_g_std(file, fh, &std); 1685 ret = ops->vidioc_g_std(file, fh, &std);
1685 if (ret == 0) 1686 if (ret == 0)
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index 4d7391ec8001..aae1720b2f2d 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -2561,7 +2561,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs)
2561 } else if (vino_drvdata->decoder 2561 } else if (vino_drvdata->decoder
2562 && (vino_drvdata->decoder_owner == VINO_NO_CHANNEL)) { 2562 && (vino_drvdata->decoder_owner == VINO_NO_CHANNEL)) {
2563 int input; 2563 int input;
2564 int data_norm; 2564 int data_norm = 0;
2565 v4l2_std_id norm; 2565 v4l2_std_id norm;
2566 2566
2567 input = VINO_INPUT_COMPOSITE; 2567 input = VINO_INPUT_COMPOSITE;
@@ -2651,7 +2651,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input)
2651 } 2651 }
2652 2652
2653 if (vino_drvdata->decoder_owner == vcs->channel) { 2653 if (vino_drvdata->decoder_owner == vcs->channel) {
2654 int data_norm; 2654 int data_norm = 0;
2655 v4l2_std_id norm; 2655 v4l2_std_id norm;
2656 2656
2657 ret = decoder_call(video, s_routing, 2657 ret = decoder_call(video, s_routing,
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 0960d7f0d394..08c10240e70f 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1149,10 +1149,14 @@ static ssize_t
1149vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) 1149vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
1150{ 1150{
1151 struct vivi_dev *dev = video_drvdata(file); 1151 struct vivi_dev *dev = video_drvdata(file);
1152 int err;
1152 1153
1153 dprintk(dev, 1, "read called\n"); 1154 dprintk(dev, 1, "read called\n");
1154 return vb2_read(&dev->vb_vidq, data, count, ppos, 1155 mutex_lock(&dev->mutex);
1156 err = vb2_read(&dev->vb_vidq, data, count, ppos,
1155 file->f_flags & O_NONBLOCK); 1157 file->f_flags & O_NONBLOCK);
1158 mutex_unlock(&dev->mutex);
1159 return err;
1156} 1160}
1157 1161
1158static unsigned int 1162static unsigned int
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index 373f423b1181..947a06a1845f 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * License Terms: GNU General Public License, version 2 7 * License Terms: GNU General Public License, version 2
8 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 8 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
9 * Author: Viresh Kumar <viresh.kumar@st.com> for ST Microelectronics 9 * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics
10 */ 10 */
11 11
12#include <linux/i2c.h> 12#include <linux/i2c.h>
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c
index afd459013ecb..9edfe864cc05 100644
--- a/drivers/mfd/stmpe-spi.c
+++ b/drivers/mfd/stmpe-spi.c
@@ -4,7 +4,7 @@
4 * Copyright (C) ST Microelectronics SA 2011 4 * Copyright (C) ST Microelectronics SA 2011
5 * 5 *
6 * License Terms: GNU General Public License, version 2 6 * License Terms: GNU General Public License, version 2
7 * Author: Viresh Kumar <viresh.kumar@st.com> for ST Microelectronics 7 * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics
8 */ 8 */
9 9
10#include <linux/spi/spi.h> 10#include <linux/spi/spi.h>
@@ -146,4 +146,4 @@ module_exit(stmpe_exit);
146 146
147MODULE_LICENSE("GPL v2"); 147MODULE_LICENSE("GPL v2");
148MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver"); 148MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver");
149MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 149MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 93936f1b75eb..23f5463d4cae 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -835,7 +835,7 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots,
835 struct mei_cl *cl, 835 struct mei_cl *cl,
836 struct mei_io_list *cmpl_list) 836 struct mei_io_list *cmpl_list)
837{ 837{
838 if ((*slots * sizeof(u32)) >= (sizeof(struct mei_msg_hdr) + 838 if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) +
839 sizeof(struct hbm_flow_control))) { 839 sizeof(struct hbm_flow_control))) {
840 /* return the cancel routine */ 840 /* return the cancel routine */
841 list_del(&cb_pos->cb_list); 841 list_del(&cb_pos->cb_list);
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index c70333228337..7de13891e49e 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -982,7 +982,7 @@ static int __devinit mei_probe(struct pci_dev *pdev,
982 err = request_threaded_irq(pdev->irq, 982 err = request_threaded_irq(pdev->irq,
983 NULL, 983 NULL,
984 mei_interrupt_thread_handler, 984 mei_interrupt_thread_handler,
985 0, mei_driver_name, dev); 985 IRQF_ONESHOT, mei_driver_name, dev);
986 else 986 else
987 err = request_threaded_irq(pdev->irq, 987 err = request_threaded_irq(pdev->irq,
988 mei_interrupt_quick_handler, 988 mei_interrupt_quick_handler,
@@ -992,7 +992,7 @@ static int __devinit mei_probe(struct pci_dev *pdev,
992 if (err) { 992 if (err) {
993 dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n", 993 dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n",
994 pdev->irq); 994 pdev->irq);
995 goto unmap_memory; 995 goto disable_msi;
996 } 996 }
997 INIT_DELAYED_WORK(&dev->timer_work, mei_timer); 997 INIT_DELAYED_WORK(&dev->timer_work, mei_timer);
998 if (mei_hw_init(dev)) { 998 if (mei_hw_init(dev)) {
@@ -1023,8 +1023,8 @@ release_irq:
1023 mei_disable_interrupts(dev); 1023 mei_disable_interrupts(dev);
1024 flush_scheduled_work(); 1024 flush_scheduled_work();
1025 free_irq(pdev->irq, dev); 1025 free_irq(pdev->irq, dev);
1026disable_msi:
1026 pci_disable_msi(pdev); 1027 pci_disable_msi(pdev);
1027unmap_memory:
1028 pci_iounmap(pdev, dev->mem_addr); 1028 pci_iounmap(pdev, dev->mem_addr);
1029free_device: 1029free_device:
1030 kfree(dev); 1030 kfree(dev);
@@ -1101,6 +1101,8 @@ static void __devexit mei_remove(struct pci_dev *pdev)
1101 1101
1102 pci_release_regions(pdev); 1102 pci_release_regions(pdev);
1103 pci_disable_device(pdev); 1103 pci_disable_device(pdev);
1104
1105 misc_deregister(&mei_misc_device);
1104} 1106}
1105#ifdef CONFIG_PM 1107#ifdef CONFIG_PM
1106static int mei_pci_suspend(struct device *device) 1108static int mei_pci_suspend(struct device *device)
@@ -1216,7 +1218,6 @@ module_init(mei_init_module);
1216 */ 1218 */
1217static void __exit mei_exit_module(void) 1219static void __exit mei_exit_module(void)
1218{ 1220{
1219 misc_deregister(&mei_misc_device);
1220 pci_unregister_driver(&mei_driver); 1221 pci_unregister_driver(&mei_driver);
1221 1222
1222 pr_debug("unloaded successfully.\n"); 1223 pr_debug("unloaded successfully.\n");
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c
index 6be5605707b4..e2ec0505eb5c 100644
--- a/drivers/misc/mei/wd.c
+++ b/drivers/misc/mei/wd.c
@@ -341,7 +341,7 @@ static const struct watchdog_ops wd_ops = {
341}; 341};
342static const struct watchdog_info wd_info = { 342static const struct watchdog_info wd_info = {
343 .identity = INTEL_AMT_WATCHDOG_ID, 343 .identity = INTEL_AMT_WATCHDOG_ID,
344 .options = WDIOF_KEEPALIVEPING, 344 .options = WDIOF_KEEPALIVEPING | WDIOF_ALARMONLY,
345}; 345};
346 346
347static struct watchdog_device amt_wd_dev = { 347static struct watchdog_device amt_wd_dev = {
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index dd2d374dcc7a..276d21ce6bc1 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -554,7 +554,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
554 struct mmc_request mrq = {NULL}; 554 struct mmc_request mrq = {NULL};
555 struct mmc_command cmd = {0}; 555 struct mmc_command cmd = {0};
556 struct mmc_data data = {0}; 556 struct mmc_data data = {0};
557 unsigned int timeout_us;
558 557
559 struct scatterlist sg; 558 struct scatterlist sg;
560 559
@@ -574,23 +573,12 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
574 cmd.arg = 0; 573 cmd.arg = 0;
575 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; 574 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
576 575
577 data.timeout_ns = card->csd.tacc_ns * 100;
578 data.timeout_clks = card->csd.tacc_clks * 100;
579
580 timeout_us = data.timeout_ns / 1000;
581 timeout_us += data.timeout_clks * 1000 /
582 (card->host->ios.clock / 1000);
583
584 if (timeout_us > 100000) {
585 data.timeout_ns = 100000000;
586 data.timeout_clks = 0;
587 }
588
589 data.blksz = 4; 576 data.blksz = 4;
590 data.blocks = 1; 577 data.blocks = 1;
591 data.flags = MMC_DATA_READ; 578 data.flags = MMC_DATA_READ;
592 data.sg = &sg; 579 data.sg = &sg;
593 data.sg_len = 1; 580 data.sg_len = 1;
581 mmc_set_data_timeout(&data, card);
594 582
595 mrq.cmd = &cmd; 583 mrq.cmd = &cmd;
596 mrq.data = &data; 584 mrq.data = &data;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 2d4a4b746750..258b203397aa 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1326,7 +1326,7 @@ static int mmc_suspend(struct mmc_host *host)
1326 if (!err) 1326 if (!err)
1327 mmc_card_set_sleep(host->card); 1327 mmc_card_set_sleep(host->card);
1328 } else if (!mmc_host_is_spi(host)) 1328 } else if (!mmc_host_is_spi(host))
1329 mmc_deselect_cards(host); 1329 err = mmc_deselect_cards(host);
1330 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); 1330 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1331 mmc_release_host(host); 1331 mmc_release_host(host);
1332 1332
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index c272c6868ecf..b2b43f624b9e 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1075,16 +1075,18 @@ static void mmc_sd_detect(struct mmc_host *host)
1075 */ 1075 */
1076static int mmc_sd_suspend(struct mmc_host *host) 1076static int mmc_sd_suspend(struct mmc_host *host)
1077{ 1077{
1078 int err = 0;
1079
1078 BUG_ON(!host); 1080 BUG_ON(!host);
1079 BUG_ON(!host->card); 1081 BUG_ON(!host->card);
1080 1082
1081 mmc_claim_host(host); 1083 mmc_claim_host(host);
1082 if (!mmc_host_is_spi(host)) 1084 if (!mmc_host_is_spi(host))
1083 mmc_deselect_cards(host); 1085 err = mmc_deselect_cards(host);
1084 host->card->state &= ~MMC_STATE_HIGHSPEED; 1086 host->card->state &= ~MMC_STATE_HIGHSPEED;
1085 mmc_release_host(host); 1087 mmc_release_host(host);
1086 1088
1087 return 0; 1089 return err;
1088} 1090}
1089 1091
1090/* 1092/*
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 13d0e95380ab..41c5fd8848f4 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -218,6 +218,12 @@ static int sdio_enable_wide(struct mmc_card *card)
218 if (ret) 218 if (ret)
219 return ret; 219 return ret;
220 220
221 if ((ctrl & SDIO_BUS_WIDTH_MASK) == SDIO_BUS_WIDTH_RESERVED)
222 pr_warning("%s: SDIO_CCCR_IF is invalid: 0x%02x\n",
223 mmc_hostname(card->host), ctrl);
224
225 /* set as 4-bit bus width */
226 ctrl &= ~SDIO_BUS_WIDTH_MASK;
221 ctrl |= SDIO_BUS_WIDTH_4BIT; 227 ctrl |= SDIO_BUS_WIDTH_4BIT;
222 228
223 ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL); 229 ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h
index 787aba1682bb..ab56f7db5315 100644
--- a/drivers/mmc/host/atmel-mci-regs.h
+++ b/drivers/mmc/host/atmel-mci-regs.h
@@ -140,4 +140,18 @@
140#define atmci_writel(port,reg,value) \ 140#define atmci_writel(port,reg,value) \
141 __raw_writel((value), (port)->regs + reg) 141 __raw_writel((value), (port)->regs + reg)
142 142
143/*
144 * Fix sconfig's burst size according to atmel MCI. We need to convert them as:
145 * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
146 *
147 * This can be done by finding most significant bit set.
148 */
149static inline unsigned int atmci_convert_chksize(unsigned int maxburst)
150{
151 if (maxburst > 1)
152 return fls(maxburst) - 2;
153 else
154 return 0;
155}
156
143#endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */ 157#endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 420aca642b14..f2c115e06438 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -910,6 +910,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
910 enum dma_data_direction direction; 910 enum dma_data_direction direction;
911 enum dma_transfer_direction slave_dirn; 911 enum dma_transfer_direction slave_dirn;
912 unsigned int sglen; 912 unsigned int sglen;
913 u32 maxburst;
913 u32 iflags; 914 u32 iflags;
914 915
915 data->error = -EINPROGRESS; 916 data->error = -EINPROGRESS;
@@ -943,17 +944,18 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
943 if (!chan) 944 if (!chan)
944 return -ENODEV; 945 return -ENODEV;
945 946
946 if (host->caps.has_dma)
947 atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN);
948
949 if (data->flags & MMC_DATA_READ) { 947 if (data->flags & MMC_DATA_READ) {
950 direction = DMA_FROM_DEVICE; 948 direction = DMA_FROM_DEVICE;
951 host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM; 949 host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
950 maxburst = atmci_convert_chksize(host->dma_conf.src_maxburst);
952 } else { 951 } else {
953 direction = DMA_TO_DEVICE; 952 direction = DMA_TO_DEVICE;
954 host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV; 953 host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV;
954 maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst);
955 } 955 }
956 956
957 atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(maxburst) | ATMCI_DMAEN);
958
957 sglen = dma_map_sg(chan->device->dev, data->sg, 959 sglen = dma_map_sg(chan->device->dev, data->sg,
958 data->sg_len, direction); 960 data->sg_len, direction);
959 961
@@ -2314,6 +2316,8 @@ static int __init atmci_probe(struct platform_device *pdev)
2314 2316
2315 platform_set_drvdata(pdev, host); 2317 platform_set_drvdata(pdev, host);
2316 2318
2319 setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host);
2320
2317 /* We need at least one slot to succeed */ 2321 /* We need at least one slot to succeed */
2318 nr_slots = 0; 2322 nr_slots = 0;
2319 ret = -ENODEV; 2323 ret = -ENODEV;
@@ -2352,8 +2356,6 @@ static int __init atmci_probe(struct platform_device *pdev)
2352 } 2356 }
2353 } 2357 }
2354 2358
2355 setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host);
2356
2357 dev_info(&pdev->dev, 2359 dev_info(&pdev->dev,
2358 "Atmel MCI controller at 0x%08lx irq %d, %u slots\n", 2360 "Atmel MCI controller at 0x%08lx irq %d, %u slots\n",
2359 host->mapbase, irq, nr_slots); 2361 host->mapbase, irq, nr_slots);
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 9bbf45f8c538..1ca5e72ceb65 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host)
418 p->des3 = host->sg_dma; 418 p->des3 = host->sg_dma;
419 p->des0 = IDMAC_DES0_ER; 419 p->des0 = IDMAC_DES0_ER;
420 420
421 mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET);
422
421 /* Mask out interrupts - get Tx & Rx complete only */ 423 /* Mask out interrupts - get Tx & Rx complete only */
422 mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI | 424 mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI |
423 SDMMC_IDMAC_INT_TI); 425 SDMMC_IDMAC_INT_TI);
@@ -615,14 +617,15 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
615 u32 div; 617 u32 div;
616 618
617 if (slot->clock != host->current_speed) { 619 if (slot->clock != host->current_speed) {
618 if (host->bus_hz % slot->clock) 620 div = host->bus_hz / slot->clock;
621 if (host->bus_hz % slot->clock && host->bus_hz > slot->clock)
619 /* 622 /*
620 * move the + 1 after the divide to prevent 623 * move the + 1 after the divide to prevent
621 * over-clocking the card. 624 * over-clocking the card.
622 */ 625 */
623 div = ((host->bus_hz / slot->clock) >> 1) + 1; 626 div += 1;
624 else 627
625 div = (host->bus_hz / slot->clock) >> 1; 628 div = (host->bus_hz != slot->clock) ? DIV_ROUND_UP(div, 2) : 0;
626 629
627 dev_info(&slot->mmc->class_dev, 630 dev_info(&slot->mmc->class_dev,
628 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" 631 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
@@ -939,8 +942,8 @@ static void dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd
939 mdelay(20); 942 mdelay(20);
940 943
941 if (cmd->data) { 944 if (cmd->data) {
942 host->data = NULL;
943 dw_mci_stop_dma(host); 945 dw_mci_stop_dma(host);
946 host->data = NULL;
944 } 947 }
945 } 948 }
946} 949}
@@ -1623,7 +1626,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
1623 if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) { 1626 if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) {
1624 mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI); 1627 mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI);
1625 mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI); 1628 mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI);
1626 set_bit(EVENT_DATA_COMPLETE, &host->pending_events);
1627 host->dma_ops->complete(host); 1629 host->dma_ops->complete(host);
1628 } 1630 }
1629#endif 1631#endif
@@ -1725,7 +1727,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
1725 1727
1726#ifdef CONFIG_MMC_DW_IDMAC 1728#ifdef CONFIG_MMC_DW_IDMAC
1727 ctrl = mci_readl(host, BMOD); 1729 ctrl = mci_readl(host, BMOD);
1728 ctrl |= 0x01; /* Software reset of DMA */ 1730 /* Software reset of DMA */
1731 ctrl |= SDMMC_IDMAC_SWRESET;
1729 mci_writel(host, BMOD, ctrl); 1732 mci_writel(host, BMOD, ctrl);
1730#endif 1733#endif
1731 1734
@@ -1950,10 +1953,6 @@ int dw_mci_probe(struct dw_mci *host)
1950 spin_lock_init(&host->lock); 1953 spin_lock_init(&host->lock);
1951 INIT_LIST_HEAD(&host->queue); 1954 INIT_LIST_HEAD(&host->queue);
1952 1955
1953
1954 host->dma_ops = host->pdata->dma_ops;
1955 dw_mci_init_dma(host);
1956
1957 /* 1956 /*
1958 * Get the host data width - this assumes that HCON has been set with 1957 * Get the host data width - this assumes that HCON has been set with
1959 * the correct values. 1958 * the correct values.
@@ -1981,10 +1980,11 @@ int dw_mci_probe(struct dw_mci *host)
1981 } 1980 }
1982 1981
1983 /* Reset all blocks */ 1982 /* Reset all blocks */
1984 if (!mci_wait_reset(&host->dev, host)) { 1983 if (!mci_wait_reset(&host->dev, host))
1985 ret = -ENODEV; 1984 return -ENODEV;
1986 goto err_dmaunmap; 1985
1987 } 1986 host->dma_ops = host->pdata->dma_ops;
1987 dw_mci_init_dma(host);
1988 1988
1989 /* Clear the interrupts for the host controller */ 1989 /* Clear the interrupts for the host controller */
1990 mci_writel(host, RINTSTS, 0xFFFFFFFF); 1990 mci_writel(host, RINTSTS, 0xFFFFFFFF);
@@ -2170,14 +2170,14 @@ int dw_mci_resume(struct dw_mci *host)
2170 if (host->vmmc) 2170 if (host->vmmc)
2171 regulator_enable(host->vmmc); 2171 regulator_enable(host->vmmc);
2172 2172
2173 if (host->dma_ops->init)
2174 host->dma_ops->init(host);
2175
2176 if (!mci_wait_reset(&host->dev, host)) { 2173 if (!mci_wait_reset(&host->dev, host)) {
2177 ret = -ENODEV; 2174 ret = -ENODEV;
2178 return ret; 2175 return ret;
2179 } 2176 }
2180 2177
2178 if (host->dma_ops->init)
2179 host->dma_ops->init(host);
2180
2181 /* Restore the old value at FIFOTH register */ 2181 /* Restore the old value at FIFOTH register */
2182 mci_writel(host, FIFOTH, host->fifoth_val); 2182 mci_writel(host, FIFOTH, host->fifoth_val);
2183 2183
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index f0fcce40cd8d..50ff19a62368 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1216,12 +1216,7 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np,
1216 int bus_width = 0; 1216 int bus_width = 0;
1217 1217
1218 pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); 1218 pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0);
1219 if (!pdata->gpio_wp)
1220 pdata->gpio_wp = -1;
1221
1222 pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); 1219 pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0);
1223 if (!pdata->gpio_cd)
1224 pdata->gpio_cd = -1;
1225 1220
1226 if (of_get_property(np, "cd-inverted", NULL)) 1221 if (of_get_property(np, "cd-inverted", NULL))
1227 pdata->cd_invert = true; 1222 pdata->cd_invert = true;
@@ -1276,6 +1271,12 @@ static int __devinit mmci_probe(struct amba_device *dev,
1276 return -EINVAL; 1271 return -EINVAL;
1277 } 1272 }
1278 1273
1274 if (!plat) {
1275 plat = devm_kzalloc(&dev->dev, sizeof(*plat), GFP_KERNEL);
1276 if (!plat)
1277 return -ENOMEM;
1278 }
1279
1279 if (np) 1280 if (np)
1280 mmci_dt_populate_generic_pdata(np, plat); 1281 mmci_dt_populate_generic_pdata(np, plat);
1281 1282
@@ -1424,6 +1425,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
1424 writel(0, host->base + MMCIMASK1); 1425 writel(0, host->base + MMCIMASK1);
1425 writel(0xfff, host->base + MMCICLEAR); 1426 writel(0xfff, host->base + MMCICLEAR);
1426 1427
1428 if (plat->gpio_cd == -EPROBE_DEFER) {
1429 ret = -EPROBE_DEFER;
1430 goto err_gpio_cd;
1431 }
1427 if (gpio_is_valid(plat->gpio_cd)) { 1432 if (gpio_is_valid(plat->gpio_cd)) {
1428 ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); 1433 ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)");
1429 if (ret == 0) 1434 if (ret == 0)
@@ -1447,6 +1452,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
1447 if (ret >= 0) 1452 if (ret >= 0)
1448 host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); 1453 host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd);
1449 } 1454 }
1455 if (plat->gpio_wp == -EPROBE_DEFER) {
1456 ret = -EPROBE_DEFER;
1457 goto err_gpio_wp;
1458 }
1450 if (gpio_is_valid(plat->gpio_wp)) { 1459 if (gpio_is_valid(plat->gpio_wp)) {
1451 ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); 1460 ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)");
1452 if (ret == 0) 1461 if (ret == 0)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 34a90266ab11..277161d279b8 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -894,8 +894,8 @@ static struct platform_driver mxs_mmc_driver = {
894 .owner = THIS_MODULE, 894 .owner = THIS_MODULE,
895#ifdef CONFIG_PM 895#ifdef CONFIG_PM
896 .pm = &mxs_mmc_pm_ops, 896 .pm = &mxs_mmc_pm_ops,
897 .of_match_table = mxs_mmc_dt_ids,
898#endif 897#endif
898 .of_match_table = mxs_mmc_dt_ids,
899 }, 899 },
900}; 900};
901 901
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 552196c764d4..3e8dcf8d2e05 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1300,7 +1300,7 @@ static const struct mmc_host_ops mmc_omap_ops = {
1300 .set_ios = mmc_omap_set_ios, 1300 .set_ios = mmc_omap_set_ios,
1301}; 1301};
1302 1302
1303static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id) 1303static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id)
1304{ 1304{
1305 struct mmc_omap_slot *slot = NULL; 1305 struct mmc_omap_slot *slot = NULL;
1306 struct mmc_host *mmc; 1306 struct mmc_host *mmc;
@@ -1485,24 +1485,26 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
1485 } 1485 }
1486 1486
1487 host->nr_slots = pdata->nr_slots; 1487 host->nr_slots = pdata->nr_slots;
1488 host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
1489
1490 host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
1491 if (!host->mmc_omap_wq)
1492 goto err_plat_cleanup;
1493
1488 for (i = 0; i < pdata->nr_slots; i++) { 1494 for (i = 0; i < pdata->nr_slots; i++) {
1489 ret = mmc_omap_new_slot(host, i); 1495 ret = mmc_omap_new_slot(host, i);
1490 if (ret < 0) { 1496 if (ret < 0) {
1491 while (--i >= 0) 1497 while (--i >= 0)
1492 mmc_omap_remove_slot(host->slots[i]); 1498 mmc_omap_remove_slot(host->slots[i]);
1493 1499
1494 goto err_plat_cleanup; 1500 goto err_destroy_wq;
1495 } 1501 }
1496 } 1502 }
1497 1503
1498 host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
1499
1500 host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
1501 if (!host->mmc_omap_wq)
1502 goto err_plat_cleanup;
1503
1504 return 0; 1504 return 0;
1505 1505
1506err_destroy_wq:
1507 destroy_workqueue(host->mmc_omap_wq);
1506err_plat_cleanup: 1508err_plat_cleanup:
1507 if (pdata->cleanup) 1509 if (pdata->cleanup)
1508 pdata->cleanup(&pdev->dev); 1510 pdata->cleanup(&pdev->dev);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 9a7a60aeb19e..389a3eedfc24 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -85,7 +85,6 @@
85#define BRR_ENABLE (1 << 5) 85#define BRR_ENABLE (1 << 5)
86#define DTO_ENABLE (1 << 20) 86#define DTO_ENABLE (1 << 20)
87#define INIT_STREAM (1 << 1) 87#define INIT_STREAM (1 << 1)
88#define ACEN_ACMD12 (1 << 2)
89#define DP_SELECT (1 << 21) 88#define DP_SELECT (1 << 21)
90#define DDIR (1 << 4) 89#define DDIR (1 << 4)
91#define DMA_EN 0x1 90#define DMA_EN 0x1
@@ -117,7 +116,6 @@
117#define OMAP_MMC_MAX_CLOCK 52000000 116#define OMAP_MMC_MAX_CLOCK 52000000
118#define DRIVER_NAME "omap_hsmmc" 117#define DRIVER_NAME "omap_hsmmc"
119 118
120#define AUTO_CMD12 (1 << 0) /* Auto CMD12 support */
121/* 119/*
122 * One controller can have multiple slots, like on some omap boards using 120 * One controller can have multiple slots, like on some omap boards using
123 * omap.c controller driver. Luckily this is not currently done on any known 121 * omap.c controller driver. Luckily this is not currently done on any known
@@ -177,7 +175,6 @@ struct omap_hsmmc_host {
177 int reqs_blocked; 175 int reqs_blocked;
178 int use_reg; 176 int use_reg;
179 int req_in_progress; 177 int req_in_progress;
180 unsigned int flags;
181 struct omap_hsmmc_next next_data; 178 struct omap_hsmmc_next next_data;
182 179
183 struct omap_mmc_platform_data *pdata; 180 struct omap_mmc_platform_data *pdata;
@@ -773,8 +770,6 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd,
773 cmdtype = 0x3; 770 cmdtype = 0x3;
774 771
775 cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); 772 cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22);
776 if ((host->flags & AUTO_CMD12) && mmc_op_multi(cmd->opcode))
777 cmdreg |= ACEN_ACMD12;
778 773
779 if (data) { 774 if (data) {
780 cmdreg |= DP_SELECT | MSBS | BCE; 775 cmdreg |= DP_SELECT | MSBS | BCE;
@@ -847,14 +842,11 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data)
847 else 842 else
848 data->bytes_xfered = 0; 843 data->bytes_xfered = 0;
849 844
850 if (data->stop && ((!(host->flags & AUTO_CMD12)) || data->error)) { 845 if (!data->stop) {
851 omap_hsmmc_start_command(host, data->stop, NULL);
852 } else {
853 if (data->stop)
854 data->stop->resp[0] = OMAP_HSMMC_READ(host->base,
855 RSP76);
856 omap_hsmmc_request_done(host, data->mrq); 846 omap_hsmmc_request_done(host, data->mrq);
847 return;
857 } 848 }
849 omap_hsmmc_start_command(host, data->stop, NULL);
858} 850}
859 851
860/* 852/*
@@ -1859,7 +1851,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev)
1859 host->mapbase = res->start + pdata->reg_offset; 1851 host->mapbase = res->start + pdata->reg_offset;
1860 host->base = ioremap(host->mapbase, SZ_4K); 1852 host->base = ioremap(host->mapbase, SZ_4K);
1861 host->power_mode = MMC_POWER_OFF; 1853 host->power_mode = MMC_POWER_OFF;
1862 host->flags = AUTO_CMD12;
1863 host->next_data.cookie = 1; 1854 host->next_data.cookie = 1;
1864 1855
1865 platform_set_drvdata(pdev, host); 1856 platform_set_drvdata(pdev, host);
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 55a164fcaa15..a50c205ea208 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -404,7 +404,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc)
404 if (sc->ext_cd_irq && 404 if (sc->ext_cd_irq &&
405 request_threaded_irq(sc->ext_cd_irq, NULL, 405 request_threaded_irq(sc->ext_cd_irq, NULL,
406 sdhci_s3c_gpio_card_detect_thread, 406 sdhci_s3c_gpio_card_detect_thread,
407 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 407 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
408 dev_name(dev), sc) == 0) { 408 dev_name(dev), sc) == 0) {
409 int status = gpio_get_value(sc->ext_cd_gpio); 409 int status = gpio_get_value(sc->ext_cd_gpio);
410 if (pdata->ext_cd_gpio_invert) 410 if (pdata->ext_cd_gpio_invert)
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 1fe32dfa7cd4..423da8194cd8 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -4,7 +4,7 @@
4 * Support of SDHCI platform devices for spear soc family 4 * Support of SDHCI platform devices for spear soc family
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * Inspired by sdhci-pltfm.c 9 * Inspired by sdhci-pltfm.c
10 * 10 *
@@ -289,5 +289,5 @@ static struct platform_driver sdhci_driver = {
289module_platform_driver(sdhci_driver); 289module_platform_driver(sdhci_driver);
290 290
291MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); 291MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver");
292MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 292MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
293MODULE_LICENSE("GPL v2"); 293MODULE_LICENSE("GPL v2");
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index e626732aff77..f4b8b4db3a9a 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -680,8 +680,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
680 } 680 }
681 681
682 if (count >= 0xF) { 682 if (count >= 0xF) {
683 pr_warning("%s: Too large timeout 0x%x requested for CMD%d!\n", 683 DBG("%s: Too large timeout 0x%x requested for CMD%d!\n",
684 mmc_hostname(host->mmc), count, cmd->opcode); 684 mmc_hostname(host->mmc), count, cmd->opcode);
685 count = 0xE; 685 count = 0xE;
686 } 686 }
687 687
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index ae36d7e1e913..551e316e4454 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -304,32 +304,17 @@ static void find_next_position(struct mtdoops_context *cxt)
304} 304}
305 305
306static void mtdoops_do_dump(struct kmsg_dumper *dumper, 306static void mtdoops_do_dump(struct kmsg_dumper *dumper,
307 enum kmsg_dump_reason reason, const char *s1, unsigned long l1, 307 enum kmsg_dump_reason reason)
308 const char *s2, unsigned long l2)
309{ 308{
310 struct mtdoops_context *cxt = container_of(dumper, 309 struct mtdoops_context *cxt = container_of(dumper,
311 struct mtdoops_context, dump); 310 struct mtdoops_context, dump);
312 unsigned long s1_start, s2_start;
313 unsigned long l1_cpy, l2_cpy;
314 char *dst;
315
316 if (reason != KMSG_DUMP_OOPS &&
317 reason != KMSG_DUMP_PANIC)
318 return;
319 311
320 /* Only dump oopses if dump_oops is set */ 312 /* Only dump oopses if dump_oops is set */
321 if (reason == KMSG_DUMP_OOPS && !dump_oops) 313 if (reason == KMSG_DUMP_OOPS && !dump_oops)
322 return; 314 return;
323 315
324 dst = cxt->oops_buf + MTDOOPS_HEADER_SIZE; /* Skip the header */ 316 kmsg_dump_get_buffer(dumper, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE,
325 l2_cpy = min(l2, record_size - MTDOOPS_HEADER_SIZE); 317 record_size - MTDOOPS_HEADER_SIZE, NULL);
326 l1_cpy = min(l1, record_size - MTDOOPS_HEADER_SIZE - l2_cpy);
327
328 s2_start = l2 - l2_cpy;
329 s1_start = l1 - l1_cpy;
330
331 memcpy(dst, s1 + s1_start, l1_cpy);
332 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);
333 318
334 /* Panics must be written immediately */ 319 /* Panics must be written immediately */
335 if (reason != KMSG_DUMP_OOPS) 320 if (reason != KMSG_DUMP_OOPS)
@@ -375,6 +360,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd)
375 return; 360 return;
376 } 361 }
377 362
363 cxt->dump.max_reason = KMSG_DUMP_OOPS;
378 cxt->dump.dump = mtdoops_do_dump; 364 cxt->dump.dump = mtdoops_do_dump;
379 err = kmsg_dump_register(&cxt->dump); 365 err = kmsg_dump_register(&cxt->dump);
380 if (err) { 366 if (err) {
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 41371ba1a811..f3f6cfedd69e 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -102,7 +102,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
102static int cafe_device_ready(struct mtd_info *mtd) 102static int cafe_device_ready(struct mtd_info *mtd)
103{ 103{
104 struct cafe_priv *cafe = mtd->priv; 104 struct cafe_priv *cafe = mtd->priv;
105 int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000); 105 int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000);
106 uint32_t irqs = cafe_readl(cafe, NAND_IRQ); 106 uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
107 107
108 cafe_writel(cafe, irqs, NAND_IRQ); 108 cafe_writel(cafe, irqs, NAND_IRQ);
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d47586cf64ce..a11253a0fcab 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3501,6 +3501,13 @@ int nand_scan_tail(struct mtd_info *mtd)
3501 /* propagate ecc info to mtd_info */ 3501 /* propagate ecc info to mtd_info */
3502 mtd->ecclayout = chip->ecc.layout; 3502 mtd->ecclayout = chip->ecc.layout;
3503 mtd->ecc_strength = chip->ecc.strength; 3503 mtd->ecc_strength = chip->ecc.strength;
3504 /*
3505 * Initialize bitflip_threshold to its default prior scan_bbt() call.
3506 * scan_bbt() might invoke mtd_read(), thus bitflip_threshold must be
3507 * properly set.
3508 */
3509 if (!mtd->bitflip_threshold)
3510 mtd->bitflip_threshold = mtd->ecc_strength;
3504 3511
3505 /* Check, if we should skip the bad block table scan */ 3512 /* Check, if we should skip the bad block table scan */
3506 if (chip->options & NAND_SKIP_BBTSCAN) 3513 if (chip->options & NAND_SKIP_BBTSCAN)
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index 09d4f8d9d592..7c1380305219 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -264,7 +264,7 @@ static struct dentry *dfs_rootdir;
264 */ 264 */
265int ubi_debugfs_init(void) 265int ubi_debugfs_init(void)
266{ 266{
267 if (!IS_ENABLED(DEBUG_FS)) 267 if (!IS_ENABLED(CONFIG_DEBUG_FS))
268 return 0; 268 return 0;
269 269
270 dfs_rootdir = debugfs_create_dir("ubi", NULL); 270 dfs_rootdir = debugfs_create_dir("ubi", NULL);
@@ -284,7 +284,7 @@ int ubi_debugfs_init(void)
284 */ 284 */
285void ubi_debugfs_exit(void) 285void ubi_debugfs_exit(void)
286{ 286{
287 if (IS_ENABLED(DEBUG_FS)) 287 if (IS_ENABLED(CONFIG_DEBUG_FS))
288 debugfs_remove(dfs_rootdir); 288 debugfs_remove(dfs_rootdir);
289} 289}
290 290
@@ -407,7 +407,7 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi)
407 struct dentry *dent; 407 struct dentry *dent;
408 struct ubi_debug_info *d = ubi->dbg; 408 struct ubi_debug_info *d = ubi->dbg;
409 409
410 if (!IS_ENABLED(DEBUG_FS)) 410 if (!IS_ENABLED(CONFIG_DEBUG_FS))
411 return 0; 411 return 0;
412 412
413 n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME, 413 n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME,
@@ -477,6 +477,6 @@ out:
477 */ 477 */
478void ubi_debugfs_exit_dev(struct ubi_device *ubi) 478void ubi_debugfs_exit_dev(struct ubi_device *ubi)
479{ 479{
480 if (IS_ENABLED(DEBUG_FS)) 480 if (IS_ENABLED(CONFIG_DEBUG_FS))
481 debugfs_remove_recursive(ubi->dbg->dfs_dir); 481 debugfs_remove_recursive(ubi->dbg->dfs_dir);
482} 482}
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index ad284baafe87..3cea38d37344 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -150,14 +150,25 @@ static void bond_info_show_master(struct seq_file *seq)
150 } 150 }
151} 151}
152 152
153static const char *bond_slave_link_status(s8 link)
154{
155 static const char * const status[] = {
156 [BOND_LINK_UP] = "up",
157 [BOND_LINK_FAIL] = "going down",
158 [BOND_LINK_DOWN] = "down",
159 [BOND_LINK_BACK] = "going back",
160 };
161
162 return status[link];
163}
164
153static void bond_info_show_slave(struct seq_file *seq, 165static void bond_info_show_slave(struct seq_file *seq,
154 const struct slave *slave) 166 const struct slave *slave)
155{ 167{
156 struct bonding *bond = seq->private; 168 struct bonding *bond = seq->private;
157 169
158 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); 170 seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
159 seq_printf(seq, "MII Status: %s\n", 171 seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link));
160 (slave->link == BOND_LINK_UP) ? "up" : "down");
161 if (slave->speed == SPEED_UNKNOWN) 172 if (slave->speed == SPEED_UNKNOWN)
162 seq_printf(seq, "Speed: %s\n", "Unknown"); 173 seq_printf(seq, "Speed: %s\n", "Unknown");
163 else 174 else
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index 1520814c77c7..4a27adb7ae67 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -693,8 +693,6 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi)
693 */ 693 */
694 memcpy(rx_buf, (u8 *)piggy_desc, 694 memcpy(rx_buf, (u8 *)piggy_desc,
695 CFHSI_DESC_SHORT_SZ); 695 CFHSI_DESC_SHORT_SZ);
696 /* Mark no embedded frame here */
697 piggy_desc->offset = 0;
698 if (desc_pld_len == -EPROTO) 696 if (desc_pld_len == -EPROTO)
699 goto out_of_sync; 697 goto out_of_sync;
700 } 698 }
@@ -737,6 +735,8 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi)
737 /* Extract any payload in piggyback descriptor. */ 735 /* Extract any payload in piggyback descriptor. */
738 if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0) 736 if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0)
739 goto out_of_sync; 737 goto out_of_sync;
738 /* Mark no embedded frame after extracting it */
739 piggy_desc->offset = 0;
740 } 740 }
741 } 741 }
742 742
@@ -1178,6 +1178,7 @@ int cfhsi_probe(struct platform_device *pdev)
1178 dev_err(&ndev->dev, "%s: Registration error: %d.\n", 1178 dev_err(&ndev->dev, "%s: Registration error: %d.\n",
1179 __func__, res); 1179 __func__, res);
1180 free_netdev(ndev); 1180 free_netdev(ndev);
1181 return -ENODEV;
1181 } 1182 }
1182 /* Add CAIF HSI device to list. */ 1183 /* Add CAIF HSI device to list. */
1183 spin_lock(&cfhsi_list_lock); 1184 spin_lock(&cfhsi_list_lock);
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 8dc84d66eea1..86cd532c78f9 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -590,8 +590,8 @@ static void c_can_chip_config(struct net_device *dev)
590 priv->write_reg(priv, &priv->regs->control, 590 priv->write_reg(priv, &priv->regs->control,
591 CONTROL_ENABLE_AR); 591 CONTROL_ENABLE_AR);
592 592
593 if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY & 593 if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) &&
594 CAN_CTRLMODE_LOOPBACK)) { 594 (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) {
595 /* loopback + silent mode : useful for hot self-test */ 595 /* loopback + silent mode : useful for hot self-test */
596 priv->write_reg(priv, &priv->regs->control, CONTROL_EIE | 596 priv->write_reg(priv, &priv->regs->control, CONTROL_EIE |
597 CONTROL_SIE | CONTROL_IE | CONTROL_TEST); 597 CONTROL_SIE | CONTROL_IE | CONTROL_TEST);
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 38c0690df5c8..81d474102378 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -939,12 +939,12 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
939 return PTR_ERR(pinctrl); 939 return PTR_ERR(pinctrl);
940 940
941 if (pdev->dev.of_node) { 941 if (pdev->dev.of_node) {
942 const u32 *clock_freq_p; 942 const __be32 *clock_freq_p;
943 943
944 clock_freq_p = of_get_property(pdev->dev.of_node, 944 clock_freq_p = of_get_property(pdev->dev.of_node,
945 "clock-frequency", NULL); 945 "clock-frequency", NULL);
946 if (clock_freq_p) 946 if (clock_freq_p)
947 clock_freq = *clock_freq_p; 947 clock_freq = be32_to_cpup(clock_freq_p);
948 } 948 }
949 949
950 if (!clock_freq) { 950 if (!clock_freq) {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index cbc56f274e0c..8098eea9704d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -190,7 +190,7 @@ int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata)
190 190
191 if ((netif_tx_queue_stopped(txq)) && 191 if ((netif_tx_queue_stopped(txq)) &&
192 (bp->state == BNX2X_STATE_OPEN) && 192 (bp->state == BNX2X_STATE_OPEN) &&
193 (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3)) 193 (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4))
194 netif_tx_wake_queue(txq); 194 netif_tx_wake_queue(txq);
195 195
196 __netif_tx_unlock(txq); 196 __netif_tx_unlock(txq);
@@ -2516,8 +2516,6 @@ int bnx2x_poll(struct napi_struct *napi, int budget)
2516/* we split the first BD into headers and data BDs 2516/* we split the first BD into headers and data BDs
2517 * to ease the pain of our fellow microcode engineers 2517 * to ease the pain of our fellow microcode engineers
2518 * we use one mapping for both BDs 2518 * we use one mapping for both BDs
2519 * So far this has only been observed to happen
2520 * in Other Operating Systems(TM)
2521 */ 2519 */
2522static noinline u16 bnx2x_tx_split(struct bnx2x *bp, 2520static noinline u16 bnx2x_tx_split(struct bnx2x *bp,
2523 struct bnx2x_fp_txdata *txdata, 2521 struct bnx2x_fp_txdata *txdata,
@@ -3171,7 +3169,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
3171 3169
3172 txdata->tx_bd_prod += nbd; 3170 txdata->tx_bd_prod += nbd;
3173 3171
3174 if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 3)) { 3172 if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 4)) {
3175 netif_tx_stop_queue(txq); 3173 netif_tx_stop_queue(txq);
3176 3174
3177 /* paired memory barrier is in bnx2x_tx_int(), we have to keep 3175 /* paired memory barrier is in bnx2x_tx_int(), we have to keep
@@ -3180,7 +3178,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
3180 smp_mb(); 3178 smp_mb();
3181 3179
3182 fp->eth_q_stats.driver_xoff++; 3180 fp->eth_q_stats.driver_xoff++;
3183 if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3) 3181 if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4)
3184 netif_tx_wake_queue(txq); 3182 netif_tx_wake_queue(txq);
3185 } 3183 }
3186 txdata->tx_pkt++; 3184 txdata->tx_pkt++;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index a3fb7215cd89..6e7d5c0843b4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -40,6 +40,7 @@
40#define I2C_BSC0 0 40#define I2C_BSC0 0
41#define I2C_BSC1 1 41#define I2C_BSC1 1
42#define I2C_WA_RETRY_CNT 3 42#define I2C_WA_RETRY_CNT 3
43#define I2C_WA_PWR_ITER (I2C_WA_RETRY_CNT - 1)
43#define MCPR_IMC_COMMAND_READ_OP 1 44#define MCPR_IMC_COMMAND_READ_OP 1
44#define MCPR_IMC_COMMAND_WRITE_OP 2 45#define MCPR_IMC_COMMAND_WRITE_OP 2
45 46
@@ -7659,6 +7660,28 @@ static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7659 return -EINVAL; 7660 return -EINVAL;
7660} 7661}
7661 7662
7663static void bnx2x_warpcore_power_module(struct link_params *params,
7664 struct bnx2x_phy *phy,
7665 u8 power)
7666{
7667 u32 pin_cfg;
7668 struct bnx2x *bp = params->bp;
7669
7670 pin_cfg = (REG_RD(bp, params->shmem_base +
7671 offsetof(struct shmem_region,
7672 dev_info.port_hw_config[params->port].e3_sfp_ctrl)) &
7673 PORT_HW_CFG_E3_PWR_DIS_MASK) >>
7674 PORT_HW_CFG_E3_PWR_DIS_SHIFT;
7675
7676 if (pin_cfg == PIN_CFG_NA)
7677 return;
7678 DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n",
7679 power, pin_cfg);
7680 /* Low ==> corresponding SFP+ module is powered
7681 * high ==> the SFP+ module is powered down
7682 */
7683 bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1);
7684}
7662static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, 7685static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7663 struct link_params *params, 7686 struct link_params *params,
7664 u16 addr, u8 byte_cnt, 7687 u16 addr, u8 byte_cnt,
@@ -7678,6 +7701,12 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7678 /* 4 byte aligned address */ 7701 /* 4 byte aligned address */
7679 addr32 = addr & (~0x3); 7702 addr32 = addr & (~0x3);
7680 do { 7703 do {
7704 if (cnt == I2C_WA_PWR_ITER) {
7705 bnx2x_warpcore_power_module(params, phy, 0);
7706 /* Note that 100us are not enough here */
7707 usleep_range(1000,1000);
7708 bnx2x_warpcore_power_module(params, phy, 1);
7709 }
7681 rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, 7710 rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt,
7682 data_array); 7711 data_array);
7683 } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); 7712 } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT));
@@ -8200,29 +8229,6 @@ static void bnx2x_set_sfp_module_fault_led(struct link_params *params,
8200 bnx2x_set_e1e2_module_fault_led(params, gpio_mode); 8229 bnx2x_set_e1e2_module_fault_led(params, gpio_mode);
8201} 8230}
8202 8231
8203static void bnx2x_warpcore_power_module(struct link_params *params,
8204 struct bnx2x_phy *phy,
8205 u8 power)
8206{
8207 u32 pin_cfg;
8208 struct bnx2x *bp = params->bp;
8209
8210 pin_cfg = (REG_RD(bp, params->shmem_base +
8211 offsetof(struct shmem_region,
8212 dev_info.port_hw_config[params->port].e3_sfp_ctrl)) &
8213 PORT_HW_CFG_E3_PWR_DIS_MASK) >>
8214 PORT_HW_CFG_E3_PWR_DIS_SHIFT;
8215
8216 if (pin_cfg == PIN_CFG_NA)
8217 return;
8218 DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n",
8219 power, pin_cfg);
8220 /* Low ==> corresponding SFP+ module is powered
8221 * high ==> the SFP+ module is powered down
8222 */
8223 bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1);
8224}
8225
8226static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, 8232static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy,
8227 struct link_params *params) 8233 struct link_params *params)
8228{ 8234{
@@ -9748,7 +9754,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy,
9748 9754
9749 msleep(1); 9755 msleep(1);
9750 9756
9751 if (!(CHIP_IS_E1(bp))) 9757 if (!(CHIP_IS_E1x(bp)))
9752 port = BP_PATH(bp); 9758 port = BP_PATH(bp);
9753 else 9759 else
9754 port = params->port; 9760 port = params->port;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 8d06ea381741..921c2082af4c 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -122,15 +122,15 @@ static int be_mcc_compl_process(struct be_adapter *adapter,
122 goto done; 122 goto done;
123 123
124 if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) { 124 if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) {
125 dev_warn(&adapter->pdev->dev, "This domain(VM) is not " 125 dev_warn(&adapter->pdev->dev,
126 "permitted to execute this cmd (opcode %d)\n", 126 "opcode %d-%d is not permitted\n",
127 opcode); 127 opcode, subsystem);
128 } else { 128 } else {
129 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & 129 extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
130 CQE_STATUS_EXTD_MASK; 130 CQE_STATUS_EXTD_MASK;
131 dev_err(&adapter->pdev->dev, "Cmd (opcode %d) failed:" 131 dev_err(&adapter->pdev->dev,
132 "status %d, extd-status %d\n", 132 "opcode %d-%d failed:status %d-%d\n",
133 opcode, compl_status, extd_status); 133 opcode, subsystem, compl_status, extd_status);
134 } 134 }
135 } 135 }
136done: 136done:
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 9625bf420c16..b3f3fc3d1323 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1566,7 +1566,7 @@ struct be_hw_stats_v1 {
1566 u32 rsvd0[BE_TXP_SW_SZ]; 1566 u32 rsvd0[BE_TXP_SW_SZ];
1567 struct be_erx_stats_v1 erx; 1567 struct be_erx_stats_v1 erx;
1568 struct be_pmem_stats pmem; 1568 struct be_pmem_stats pmem;
1569 u32 rsvd1[3]; 1569 u32 rsvd1[18];
1570}; 1570};
1571 1571
1572struct be_cmd_req_get_stats_v1 { 1572struct be_cmd_req_get_stats_v1 {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index fdb50cec6b51..501dfa9c88ec 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3237,7 +3237,7 @@ static void be_netdev_init(struct net_device *netdev)
3237 3237
3238 netdev->flags |= IFF_MULTICAST; 3238 netdev->flags |= IFF_MULTICAST;
3239 3239
3240 netif_set_gso_max_size(netdev, 65535); 3240 netif_set_gso_max_size(netdev, 65535 - ETH_HLEN);
3241 3241
3242 netdev->netdev_ops = &be_netdev_ops; 3242 netdev->netdev_ops = &be_netdev_ops;
3243 3243
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 0741aded9eb0..f2db8fca46a1 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1804,18 +1804,16 @@ void gfar_configure_coalescing(struct gfar_private *priv,
1804 if (priv->mode == MQ_MG_MODE) { 1804 if (priv->mode == MQ_MG_MODE) {
1805 baddr = &regs->txic0; 1805 baddr = &regs->txic0;
1806 for_each_set_bit(i, &tx_mask, priv->num_tx_queues) { 1806 for_each_set_bit(i, &tx_mask, priv->num_tx_queues) {
1807 if (likely(priv->tx_queue[i]->txcoalescing)) { 1807 gfar_write(baddr + i, 0);
1808 gfar_write(baddr + i, 0); 1808 if (likely(priv->tx_queue[i]->txcoalescing))
1809 gfar_write(baddr + i, priv->tx_queue[i]->txic); 1809 gfar_write(baddr + i, priv->tx_queue[i]->txic);
1810 }
1811 } 1810 }
1812 1811
1813 baddr = &regs->rxic0; 1812 baddr = &regs->rxic0;
1814 for_each_set_bit(i, &rx_mask, priv->num_rx_queues) { 1813 for_each_set_bit(i, &rx_mask, priv->num_rx_queues) {
1815 if (likely(priv->rx_queue[i]->rxcoalescing)) { 1814 gfar_write(baddr + i, 0);
1816 gfar_write(baddr + i, 0); 1815 if (likely(priv->rx_queue[i]->rxcoalescing))
1817 gfar_write(baddr + i, priv->rx_queue[i]->rxic); 1816 gfar_write(baddr + i, priv->rx_queue[i]->rxic);
1818 }
1819 } 1817 }
1820 } 1818 }
1821} 1819}
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index 79b07ec6726f..0cafe4fe9406 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -122,8 +122,10 @@ config IGB_DCA
122 122
123config IGB_PTP 123config IGB_PTP
124 bool "PTP Hardware Clock (PHC)" 124 bool "PTP Hardware Clock (PHC)"
125 default y 125 default n
126 depends on IGB && PTP_1588_CLOCK 126 depends on IGB && EXPERIMENTAL
127 select PPS
128 select PTP_1588_CLOCK
127 ---help--- 129 ---help---
128 Say Y here if you want to use PTP Hardware Clock (PHC) in the 130 Say Y here if you want to use PTP Hardware Clock (PHC) in the
129 driver. Only the basic clock operations have been implemented. 131 driver. Only the basic clock operations have been implemented.
@@ -223,7 +225,9 @@ config IXGBE_DCB
223config IXGBE_PTP 225config IXGBE_PTP
224 bool "PTP Clock Support" 226 bool "PTP Clock Support"
225 default n 227 default n
226 depends on IXGBE && PTP_1588_CLOCK 228 depends on IXGBE && EXPERIMENTAL
229 select PPS
230 select PTP_1588_CLOCK
227 ---help--- 231 ---help---
228 Say Y here if you want support for 1588 Timestamping with a 232 Say Y here if you want support for 1588 Timestamping with a
229 PHC device, using the PTP 1588 Clock support. This is 233 PHC device, using the PTP 1588 Clock support. This is
diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h
index 351a4097b2ba..76edbc1be33b 100644
--- a/drivers/net/ethernet/intel/e1000e/defines.h
+++ b/drivers/net/ethernet/intel/e1000e/defines.h
@@ -103,6 +103,7 @@
103#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ 103#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */
104#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ 104#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */
105#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ 105#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */
106#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */
106#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ 107#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */
107#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ 108#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */
108 109
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 31d37a2b5ba8..623e30b9964d 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -496,7 +496,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter,
496 * @sk_buff: socket buffer with received data 496 * @sk_buff: socket buffer with received data
497 **/ 497 **/
498static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, 498static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
499 __le16 csum, struct sk_buff *skb) 499 struct sk_buff *skb)
500{ 500{
501 u16 status = (u16)status_err; 501 u16 status = (u16)status_err;
502 u8 errors = (u8)(status_err >> 24); 502 u8 errors = (u8)(status_err >> 24);
@@ -511,8 +511,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
511 if (status & E1000_RXD_STAT_IXSM) 511 if (status & E1000_RXD_STAT_IXSM)
512 return; 512 return;
513 513
514 /* TCP/UDP checksum error bit is set */ 514 /* TCP/UDP checksum error bit or IP checksum error bit is set */
515 if (errors & E1000_RXD_ERR_TCPE) { 515 if (errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE)) {
516 /* let the stack verify checksum errors */ 516 /* let the stack verify checksum errors */
517 adapter->hw_csum_err++; 517 adapter->hw_csum_err++;
518 return; 518 return;
@@ -523,19 +523,7 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
523 return; 523 return;
524 524
525 /* It must be a TCP or UDP packet with a valid checksum */ 525 /* It must be a TCP or UDP packet with a valid checksum */
526 if (status & E1000_RXD_STAT_TCPCS) { 526 skb->ip_summed = CHECKSUM_UNNECESSARY;
527 /* TCP checksum is good */
528 skb->ip_summed = CHECKSUM_UNNECESSARY;
529 } else {
530 /*
531 * IP fragment with UDP payload
532 * Hardware complements the payload checksum, so we undo it
533 * and then put the value in host order for further stack use.
534 */
535 __sum16 sum = (__force __sum16)swab16((__force u16)csum);
536 skb->csum = csum_unfold(~sum);
537 skb->ip_summed = CHECKSUM_COMPLETE;
538 }
539 adapter->hw_csum_good++; 527 adapter->hw_csum_good++;
540} 528}
541 529
@@ -954,8 +942,7 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done,
954 skb_put(skb, length); 942 skb_put(skb, length);
955 943
956 /* Receive Checksum Offload */ 944 /* Receive Checksum Offload */
957 e1000_rx_checksum(adapter, staterr, 945 e1000_rx_checksum(adapter, staterr, skb);
958 rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
959 946
960 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); 947 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb);
961 948
@@ -1341,8 +1328,7 @@ copydone:
1341 total_rx_bytes += skb->len; 1328 total_rx_bytes += skb->len;
1342 total_rx_packets++; 1329 total_rx_packets++;
1343 1330
1344 e1000_rx_checksum(adapter, staterr, 1331 e1000_rx_checksum(adapter, staterr, skb);
1345 rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
1346 1332
1347 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); 1333 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb);
1348 1334
@@ -1512,9 +1498,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done,
1512 } 1498 }
1513 } 1499 }
1514 1500
1515 /* Receive Checksum Offload XXX recompute due to CRC strip? */ 1501 /* Receive Checksum Offload */
1516 e1000_rx_checksum(adapter, staterr, 1502 e1000_rx_checksum(adapter, staterr, skb);
1517 rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
1518 1503
1519 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); 1504 e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb);
1520 1505
@@ -3098,19 +3083,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
3098 3083
3099 /* Enable Receive Checksum Offload for TCP and UDP */ 3084 /* Enable Receive Checksum Offload for TCP and UDP */
3100 rxcsum = er32(RXCSUM); 3085 rxcsum = er32(RXCSUM);
3101 if (adapter->netdev->features & NETIF_F_RXCSUM) { 3086 if (adapter->netdev->features & NETIF_F_RXCSUM)
3102 rxcsum |= E1000_RXCSUM_TUOFL; 3087 rxcsum |= E1000_RXCSUM_TUOFL;
3103 3088 else
3104 /*
3105 * IPv4 payload checksum for UDP fragments must be
3106 * used in conjunction with packet-split.
3107 */
3108 if (adapter->rx_ps_pages)
3109 rxcsum |= E1000_RXCSUM_IPPCSE;
3110 } else {
3111 rxcsum &= ~E1000_RXCSUM_TUOFL; 3089 rxcsum &= ~E1000_RXCSUM_TUOFL;
3112 /* no need to clear IPPCSE as it defaults to 0 */
3113 }
3114 ew32(RXCSUM, rxcsum); 3090 ew32(RXCSUM, rxcsum);
3115 3091
3116 if (adapter->hw.mac.type == e1000_pch2lan) { 3092 if (adapter->hw.mac.type == e1000_pch2lan) {
@@ -5241,22 +5217,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
5241 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 5217 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
5242 5218
5243 /* Jumbo frame support */ 5219 /* Jumbo frame support */
5244 if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { 5220 if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) &&
5245 if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { 5221 !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) {
5246 e_err("Jumbo Frames not supported.\n"); 5222 e_err("Jumbo Frames not supported.\n");
5247 return -EINVAL; 5223 return -EINVAL;
5248 }
5249
5250 /*
5251 * IP payload checksum (enabled with jumbos/packet-split when
5252 * Rx checksum is enabled) and generation of RSS hash is
5253 * mutually exclusive in the hardware.
5254 */
5255 if ((netdev->features & NETIF_F_RXCSUM) &&
5256 (netdev->features & NETIF_F_RXHASH)) {
5257 e_err("Jumbo frames cannot be enabled when both receive checksum offload and receive hashing are enabled. Disable one of the receive offload features before enabling jumbos.\n");
5258 return -EINVAL;
5259 }
5260 } 5224 }
5261 5225
5262 /* Supported frame sizes */ 5226 /* Supported frame sizes */
@@ -6030,17 +5994,6 @@ static int e1000_set_features(struct net_device *netdev,
6030 NETIF_F_RXALL))) 5994 NETIF_F_RXALL)))
6031 return 0; 5995 return 0;
6032 5996
6033 /*
6034 * IP payload checksum (enabled with jumbos/packet-split when Rx
6035 * checksum is enabled) and generation of RSS hash is mutually
6036 * exclusive in the hardware.
6037 */
6038 if (adapter->rx_ps_pages &&
6039 (features & NETIF_F_RXCSUM) && (features & NETIF_F_RXHASH)) {
6040 e_err("Enabling both receive checksum offload and receive hashing is not possible with jumbo frames. Disable jumbos or enable only one of the receive offload features.\n");
6041 return -EINVAL;
6042 }
6043
6044 if (changed & NETIF_F_RXFCS) { 5997 if (changed & NETIF_F_RXFCS) {
6045 if (features & NETIF_F_RXFCS) { 5998 if (features & NETIF_F_RXFCS) {
6046 adapter->flags2 &= ~FLAG2_CRC_STRIPPING; 5999 adapter->flags2 &= ~FLAG2_CRC_STRIPPING;
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index e65083958421..5e84eaac48c1 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -206,8 +206,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
206 mac->rar_entry_count = E1000_RAR_ENTRIES_82580; 206 mac->rar_entry_count = E1000_RAR_ENTRIES_82580;
207 break; 207 break;
208 case e1000_i350: 208 case e1000_i350:
209 case e1000_i210:
210 case e1000_i211:
211 mac->rar_entry_count = E1000_RAR_ENTRIES_I350; 209 mac->rar_entry_count = E1000_RAR_ENTRIES_I350;
212 break; 210 break;
213 default: 211 default:
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c
index 8ce67064b9c5..90eef07943f4 100644
--- a/drivers/net/ethernet/intel/igbvf/ethtool.c
+++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
@@ -357,21 +357,28 @@ static int igbvf_set_coalesce(struct net_device *netdev,
357 struct igbvf_adapter *adapter = netdev_priv(netdev); 357 struct igbvf_adapter *adapter = netdev_priv(netdev);
358 struct e1000_hw *hw = &adapter->hw; 358 struct e1000_hw *hw = &adapter->hw;
359 359
360 if ((ec->rx_coalesce_usecs > IGBVF_MAX_ITR_USECS) || 360 if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) &&
361 ((ec->rx_coalesce_usecs > 3) && 361 (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) {
362 (ec->rx_coalesce_usecs < IGBVF_MIN_ITR_USECS)) || 362 adapter->current_itr = ec->rx_coalesce_usecs << 2;
363 (ec->rx_coalesce_usecs == 2)) 363 adapter->requested_itr = 1000000000 /
364 return -EINVAL; 364 (adapter->current_itr * 256);
365 365 } else if ((ec->rx_coalesce_usecs == 3) ||
366 /* convert to rate of irq's per second */ 366 (ec->rx_coalesce_usecs == 2)) {
367 if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) {
368 adapter->current_itr = IGBVF_START_ITR; 367 adapter->current_itr = IGBVF_START_ITR;
369 adapter->requested_itr = ec->rx_coalesce_usecs; 368 adapter->requested_itr = ec->rx_coalesce_usecs;
370 } else { 369 } else if (ec->rx_coalesce_usecs == 0) {
371 adapter->current_itr = ec->rx_coalesce_usecs << 2; 370 /*
371 * The user's desire is to turn off interrupt throttling
372 * altogether, but due to HW limitations, we can't do that.
373 * Instead we set a very small value in EITR, which would
374 * allow ~967k interrupts per second, but allow the adapter's
375 * internal clocking to still function properly.
376 */
377 adapter->current_itr = 4;
372 adapter->requested_itr = 1000000000 / 378 adapter->requested_itr = 1000000000 /
373 (adapter->current_itr * 256); 379 (adapter->current_itr * 256);
374 } 380 } else
381 return -EINVAL;
375 382
376 writel(adapter->current_itr, 383 writel(adapter->current_itr,
377 hw->hw_addr + adapter->rx_ring->itr_register); 384 hw->hw_addr + adapter->rx_ring->itr_register);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 3ef3c5284e52..7af291e236bf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -196,7 +196,7 @@ enum ixgbe_ring_state_t {
196 __IXGBE_HANG_CHECK_ARMED, 196 __IXGBE_HANG_CHECK_ARMED,
197 __IXGBE_RX_RSC_ENABLED, 197 __IXGBE_RX_RSC_ENABLED,
198 __IXGBE_RX_CSUM_UDP_ZERO_ERR, 198 __IXGBE_RX_CSUM_UDP_ZERO_ERR,
199 __IXGBE_RX_FCOE_BUFSZ, 199 __IXGBE_RX_FCOE,
200}; 200};
201 201
202#define check_for_tx_hang(ring) \ 202#define check_for_tx_hang(ring) \
@@ -290,7 +290,7 @@ struct ixgbe_ring_feature {
290#if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192) 290#if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192)
291static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) 291static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
292{ 292{
293 return test_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state) ? 1 : 0; 293 return test_bit(__IXGBE_RX_FCOE, &ring->state) ? 1 : 0;
294} 294}
295#else 295#else
296#define ixgbe_rx_pg_order(_ring) 0 296#define ixgbe_rx_pg_order(_ring) 0
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index af1a5314b494..c377706e81a8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -634,7 +634,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
634 f = &adapter->ring_feature[RING_F_FCOE]; 634 f = &adapter->ring_feature[RING_F_FCOE];
635 if ((rxr_idx >= f->mask) && 635 if ((rxr_idx >= f->mask) &&
636 (rxr_idx < f->mask + f->indices)) 636 (rxr_idx < f->mask + f->indices))
637 set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state); 637 set_bit(__IXGBE_RX_FCOE, &ring->state);
638 } 638 }
639 639
640#endif /* IXGBE_FCOE */ 640#endif /* IXGBE_FCOE */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 17ad6a3c1be1..18ca3bcadf0c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1058,17 +1058,17 @@ static inline void ixgbe_rx_hash(struct ixgbe_ring *ring,
1058#ifdef IXGBE_FCOE 1058#ifdef IXGBE_FCOE
1059/** 1059/**
1060 * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type 1060 * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type
1061 * @adapter: address of board private structure 1061 * @ring: structure containing ring specific data
1062 * @rx_desc: advanced rx descriptor 1062 * @rx_desc: advanced rx descriptor
1063 * 1063 *
1064 * Returns : true if it is FCoE pkt 1064 * Returns : true if it is FCoE pkt
1065 */ 1065 */
1066static inline bool ixgbe_rx_is_fcoe(struct ixgbe_adapter *adapter, 1066static inline bool ixgbe_rx_is_fcoe(struct ixgbe_ring *ring,
1067 union ixgbe_adv_rx_desc *rx_desc) 1067 union ixgbe_adv_rx_desc *rx_desc)
1068{ 1068{
1069 __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; 1069 __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info;
1070 1070
1071 return (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && 1071 return test_bit(__IXGBE_RX_FCOE, &ring->state) &&
1072 ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) == 1072 ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) ==
1073 (cpu_to_le16(IXGBE_ETQF_FILTER_FCOE << 1073 (cpu_to_le16(IXGBE_ETQF_FILTER_FCOE <<
1074 IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT))); 1074 IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT)));
@@ -1148,7 +1148,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring,
1148 1148
1149 /* alloc new page for storage */ 1149 /* alloc new page for storage */
1150 if (likely(!page)) { 1150 if (likely(!page)) {
1151 page = alloc_pages(GFP_ATOMIC | __GFP_COLD, 1151 page = alloc_pages(GFP_ATOMIC | __GFP_COLD | __GFP_COMP,
1152 ixgbe_rx_pg_order(rx_ring)); 1152 ixgbe_rx_pg_order(rx_ring));
1153 if (unlikely(!page)) { 1153 if (unlikely(!page)) {
1154 rx_ring->rx_stats.alloc_rx_page_failed++; 1154 rx_ring->rx_stats.alloc_rx_page_failed++;
@@ -1549,6 +1549,12 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring,
1549 skb->truesize -= ixgbe_rx_bufsz(rx_ring); 1549 skb->truesize -= ixgbe_rx_bufsz(rx_ring);
1550 } 1550 }
1551 1551
1552#ifdef IXGBE_FCOE
1553 /* do not attempt to pad FCoE Frames as this will disrupt DDP */
1554 if (ixgbe_rx_is_fcoe(rx_ring, rx_desc))
1555 return false;
1556
1557#endif
1552 /* if skb_pad returns an error the skb was freed */ 1558 /* if skb_pad returns an error the skb was freed */
1553 if (unlikely(skb->len < 60)) { 1559 if (unlikely(skb->len < 60)) {
1554 int pad_len = 60 - skb->len; 1560 int pad_len = 60 - skb->len;
@@ -1775,7 +1781,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
1775 1781
1776#ifdef IXGBE_FCOE 1782#ifdef IXGBE_FCOE
1777 /* if ddp, not passing to ULD unless for FCP_RSP or error */ 1783 /* if ddp, not passing to ULD unless for FCP_RSP or error */
1778 if (ixgbe_rx_is_fcoe(adapter, rx_desc)) { 1784 if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) {
1779 ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); 1785 ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb);
1780 if (!ddp_bytes) { 1786 if (!ddp_bytes) {
1781 dev_kfree_skb_any(skb); 1787 dev_kfree_skb_any(skb);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index ddc6a4d19302..dcebd128becf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -708,6 +708,7 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter)
708{ 708{
709 struct ixgbe_hw *hw = &adapter->hw; 709 struct ixgbe_hw *hw = &adapter->hw;
710 u32 incval = 0; 710 u32 incval = 0;
711 u32 timinca = 0;
711 u32 shift = 0; 712 u32 shift = 0;
712 u32 cycle_speed; 713 u32 cycle_speed;
713 unsigned long flags; 714 unsigned long flags;
@@ -730,8 +731,16 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter)
730 break; 731 break;
731 } 732 }
732 733
733 /* Bail if the cycle speed didn't change */ 734 /*
734 if (adapter->cycle_speed == cycle_speed) 735 * grab the current TIMINCA value from the register so that it can be
736 * double checked. If the register value has been cleared, it must be
737 * reset to the correct value for generating a cyclecounter. If
738 * TIMINCA is zero, the SYSTIME registers do not increment at all.
739 */
740 timinca = IXGBE_READ_REG(hw, IXGBE_TIMINCA);
741
742 /* Bail if the cycle speed didn't change and TIMINCA is non-zero */
743 if (adapter->cycle_speed == cycle_speed && timinca)
735 return; 744 return;
736 745
737 /* disable the SDP clock out */ 746 /* disable the SDP clock out */
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 926d8aac941c..073b85b45fc5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -929,15 +929,20 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv)
929 if (priv->rx_cq[i].buf) 929 if (priv->rx_cq[i].buf)
930 mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); 930 mlx4_en_destroy_cq(priv, &priv->rx_cq[i]);
931 } 931 }
932
933 if (priv->base_tx_qpn) {
934 mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num);
935 priv->base_tx_qpn = 0;
936 }
932} 937}
933 938
934int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) 939int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
935{ 940{
936 struct mlx4_en_port_profile *prof = priv->prof; 941 struct mlx4_en_port_profile *prof = priv->prof;
937 int i; 942 int i;
938 int base_tx_qpn, err; 943 int err;
939 944
940 err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &base_tx_qpn); 945 err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &priv->base_tx_qpn);
941 if (err) { 946 if (err) {
942 en_err(priv, "failed reserving range for TX rings\n"); 947 en_err(priv, "failed reserving range for TX rings\n");
943 return err; 948 return err;
@@ -949,7 +954,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
949 prof->tx_ring_size, i, TX)) 954 prof->tx_ring_size, i, TX))
950 goto err; 955 goto err;
951 956
952 if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], base_tx_qpn + i, 957 if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], priv->base_tx_qpn + i,
953 prof->tx_ring_size, TXBB_SIZE)) 958 prof->tx_ring_size, TXBB_SIZE))
954 goto err; 959 goto err;
955 } 960 }
@@ -969,7 +974,6 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
969 974
970err: 975err:
971 en_err(priv, "Failed to allocate NIC resources\n"); 976 en_err(priv, "Failed to allocate NIC resources\n");
972 mlx4_qp_release_range(priv->mdev->dev, base_tx_qpn, priv->tx_ring_num);
973 return -ENOMEM; 977 return -ENOMEM;
974} 978}
975 979
@@ -1204,9 +1208,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
1204 en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); 1208 en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
1205 1209
1206 /* Configure port */ 1210 /* Configure port */
1211 mlx4_en_calc_rx_buf(dev);
1207 err = mlx4_SET_PORT_general(mdev->dev, priv->port, 1212 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
1208 MLX4_EN_MIN_MTU, 1213 priv->rx_skb_size + ETH_FCS_LEN,
1209 0, 0, 0, 0); 1214 prof->tx_pause, prof->tx_ppp,
1215 prof->rx_pause, prof->rx_ppp);
1210 if (err) { 1216 if (err) {
1211 en_err(priv, "Failed setting port general configurations " 1217 en_err(priv, "Failed setting port general configurations "
1212 "for port %d, with error %d\n", priv->port, err); 1218 "for port %d, with error %d\n", priv->port, err);
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index ee6f4fe00837..a0313de122de 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1975,6 +1975,8 @@ slave_start:
1975 if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && 1975 if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
1976 !mlx4_is_mfunc(dev)) { 1976 !mlx4_is_mfunc(dev)) {
1977 dev->flags &= ~MLX4_FLAG_MSI_X; 1977 dev->flags &= ~MLX4_FLAG_MSI_X;
1978 dev->caps.num_comp_vectors = 1;
1979 dev->caps.comp_pool = 0;
1978 pci_disable_msix(pdev); 1980 pci_disable_msix(pdev);
1979 err = mlx4_setup_hca(dev); 1981 err = mlx4_setup_hca(dev);
1980 } 1982 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 6ae350921b1a..225c20d47900 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -495,6 +495,7 @@ struct mlx4_en_priv {
495 int vids[128]; 495 int vids[128];
496 bool wol; 496 bool wol;
497 struct device *ddev; 497 struct device *ddev;
498 int base_tx_qpn;
498 499
499#ifdef CONFIG_MLX4_EN_DCB 500#ifdef CONFIG_MLX4_EN_DCB
500 struct ieee_ets ets; 501 struct ieee_ets ets;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 46e77a2c5121..ad98f4d7919d 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -479,7 +479,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
479 479
480 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { 480 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
481 pfn = pci_info[i].id; 481 pfn = pci_info[i].id;
482 if (pfn > QLCNIC_MAX_PCI_FUNC) { 482 if (pfn >= QLCNIC_MAX_PCI_FUNC) {
483 ret = QL_STATUS_INVALID_PARAM; 483 ret = QL_STATUS_INVALID_PARAM;
484 goto err_eswitch; 484 goto err_eswitch;
485 } 485 }
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 7260aa79466a..d7a04e091101 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3894,6 +3894,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
3894 case RTL_GIGA_MAC_VER_22: 3894 case RTL_GIGA_MAC_VER_22:
3895 case RTL_GIGA_MAC_VER_23: 3895 case RTL_GIGA_MAC_VER_23:
3896 case RTL_GIGA_MAC_VER_24: 3896 case RTL_GIGA_MAC_VER_24:
3897 case RTL_GIGA_MAC_VER_34:
3897 RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); 3898 RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST);
3898 break; 3899 break;
3899 default: 3900 default:
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 667169b82526..79bf09b41971 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1011,7 +1011,7 @@ static int sh_eth_txfree(struct net_device *ndev)
1011} 1011}
1012 1012
1013/* Packet receive function */ 1013/* Packet receive function */
1014static int sh_eth_rx(struct net_device *ndev) 1014static int sh_eth_rx(struct net_device *ndev, u32 intr_status)
1015{ 1015{
1016 struct sh_eth_private *mdp = netdev_priv(ndev); 1016 struct sh_eth_private *mdp = netdev_priv(ndev);
1017 struct sh_eth_rxdesc *rxdesc; 1017 struct sh_eth_rxdesc *rxdesc;
@@ -1102,9 +1102,11 @@ static int sh_eth_rx(struct net_device *ndev)
1102 /* Restart Rx engine if stopped. */ 1102 /* Restart Rx engine if stopped. */
1103 /* If we don't need to check status, don't. -KDU */ 1103 /* If we don't need to check status, don't. -KDU */
1104 if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { 1104 if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) {
1105 /* fix the values for the next receiving */ 1105 /* fix the values for the next receiving if RDE is set */
1106 mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - 1106 if (intr_status & EESR_RDE)
1107 sh_eth_read(ndev, RDLAR)) >> 4; 1107 mdp->cur_rx = mdp->dirty_rx =
1108 (sh_eth_read(ndev, RDFAR) -
1109 sh_eth_read(ndev, RDLAR)) >> 4;
1108 sh_eth_write(ndev, EDRRR_R, EDRRR); 1110 sh_eth_write(ndev, EDRRR_R, EDRRR);
1109 } 1111 }
1110 1112
@@ -1273,7 +1275,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
1273 EESR_RTSF | /* short frame recv */ 1275 EESR_RTSF | /* short frame recv */
1274 EESR_PRE | /* PHY-LSI recv error */ 1276 EESR_PRE | /* PHY-LSI recv error */
1275 EESR_CERF)){ /* recv frame CRC error */ 1277 EESR_CERF)){ /* recv frame CRC error */
1276 sh_eth_rx(ndev); 1278 sh_eth_rx(ndev, intr_status);
1277 } 1279 }
1278 1280
1279 /* Tx Check */ 1281 /* Tx Check */
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index d614c374ed9d..3b5c4571b55e 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/module.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 590f902deb6b..9d6c80c8a0cf 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -161,7 +161,7 @@ static struct phy_driver ks8051_driver = {
161static struct phy_driver ks8001_driver = { 161static struct phy_driver ks8001_driver = {
162 .phy_id = PHY_ID_KS8001, 162 .phy_id = PHY_ID_KS8001,
163 .name = "Micrel KS8001 or KS8721", 163 .name = "Micrel KS8001 or KS8721",
164 .phy_id_mask = 0x00fffff0, 164 .phy_id_mask = 0x00ffffff,
165 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), 165 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
166 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, 166 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
167 .config_init = kszphy_config_init, 167 .config_init = kszphy_config_init,
@@ -174,7 +174,7 @@ static struct phy_driver ks8001_driver = {
174 174
175static struct phy_driver ksz9021_driver = { 175static struct phy_driver ksz9021_driver = {
176 .phy_id = PHY_ID_KSZ9021, 176 .phy_id = PHY_ID_KSZ9021,
177 .phy_id_mask = 0x000fff10, 177 .phy_id_mask = 0x000ffffe,
178 .name = "Micrel KSZ9021 Gigabit PHY", 178 .name = "Micrel KSZ9021 Gigabit PHY",
179 .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause 179 .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause
180 | SUPPORTED_Asym_Pause), 180 | SUPPORTED_Asym_Pause),
@@ -240,8 +240,8 @@ MODULE_AUTHOR("David J. Choi");
240MODULE_LICENSE("GPL"); 240MODULE_LICENSE("GPL");
241 241
242static struct mdio_device_id __maybe_unused micrel_tbl[] = { 242static struct mdio_device_id __maybe_unused micrel_tbl[] = {
243 { PHY_ID_KSZ9021, 0x000fff10 }, 243 { PHY_ID_KSZ9021, 0x000ffffe },
244 { PHY_ID_KS8001, 0x00fffff0 }, 244 { PHY_ID_KS8001, 0x00ffffff },
245 { PHY_ID_KS8737, 0x00fffff0 }, 245 { PHY_ID_KS8737, 0x00fffff0 },
246 { PHY_ID_KS8041, 0x00fffff0 }, 246 { PHY_ID_KS8041, 0x00fffff0 },
247 { PHY_ID_KS8051, 0x00fffff0 }, 247 { PHY_ID_KS8051, 0x00fffff0 },
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 964031e3da87..a28a983d465e 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -59,6 +59,7 @@
59#define USB_PRODUCT_IPHONE_3G 0x1292 59#define USB_PRODUCT_IPHONE_3G 0x1292
60#define USB_PRODUCT_IPHONE_3GS 0x1294 60#define USB_PRODUCT_IPHONE_3GS 0x1294
61#define USB_PRODUCT_IPHONE_4 0x1297 61#define USB_PRODUCT_IPHONE_4 0x1297
62#define USB_PRODUCT_IPAD 0x129a
62#define USB_PRODUCT_IPHONE_4_VZW 0x129c 63#define USB_PRODUCT_IPHONE_4_VZW 0x129c
63#define USB_PRODUCT_IPHONE_4S 0x12a0 64#define USB_PRODUCT_IPHONE_4S 0x12a0
64 65
@@ -101,6 +102,10 @@ static struct usb_device_id ipheth_table[] = {
101 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, 102 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
102 IPHETH_USBINTF_PROTO) }, 103 IPHETH_USBINTF_PROTO) },
103 { USB_DEVICE_AND_INTERFACE_INFO( 104 { USB_DEVICE_AND_INTERFACE_INFO(
105 USB_VENDOR_APPLE, USB_PRODUCT_IPAD,
106 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
107 IPHETH_USBINTF_PROTO) },
108 { USB_DEVICE_AND_INTERFACE_INFO(
104 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, 109 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
105 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, 110 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
106 IPHETH_USBINTF_PROTO) }, 111 IPHETH_USBINTF_PROTO) },
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 3b206786b5e7..b01960fcfbc9 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -197,6 +197,10 @@ err:
197static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) 197static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
198{ 198{
199 struct usbnet *dev = usb_get_intfdata(intf); 199 struct usbnet *dev = usb_get_intfdata(intf);
200
201 /* can be called while disconnecting */
202 if (!dev)
203 return 0;
200 return qmi_wwan_manage_power(dev, on); 204 return qmi_wwan_manage_power(dev, on);
201} 205}
202 206
@@ -257,29 +261,6 @@ err:
257 return rv; 261 return rv;
258} 262}
259 263
260/* Gobi devices uses identical class/protocol codes for all interfaces regardless
261 * of function. Some of these are CDC ACM like and have the exact same endpoints
262 * we are looking for. This leaves two possible strategies for identifying the
263 * correct interface:
264 * a) hardcoding interface number, or
265 * b) use the fact that the wwan interface is the only one lacking additional
266 * (CDC functional) descriptors
267 *
268 * Let's see if we can get away with the generic b) solution.
269 */
270static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
271{
272 int rv = -EINVAL;
273
274 /* ignore any interface with additional descriptors */
275 if (intf->cur_altsetting->extralen)
276 goto err;
277
278 rv = qmi_wwan_bind_shared(dev, intf);
279err:
280 return rv;
281}
282
283static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf) 264static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf)
284{ 265{
285 struct usb_driver *subdriver = (void *)dev->data[0]; 266 struct usb_driver *subdriver = (void *)dev->data[0];
@@ -347,15 +328,15 @@ static const struct driver_info qmi_wwan_shared = {
347 .manage_power = qmi_wwan_manage_power, 328 .manage_power = qmi_wwan_manage_power,
348}; 329};
349 330
350static const struct driver_info qmi_wwan_gobi = { 331static const struct driver_info qmi_wwan_force_int0 = {
351 .description = "Qualcomm Gobi wwan/QMI device", 332 .description = "Qualcomm WWAN/QMI device",
352 .flags = FLAG_WWAN, 333 .flags = FLAG_WWAN,
353 .bind = qmi_wwan_bind_gobi, 334 .bind = qmi_wwan_bind_shared,
354 .unbind = qmi_wwan_unbind_shared, 335 .unbind = qmi_wwan_unbind_shared,
355 .manage_power = qmi_wwan_manage_power, 336 .manage_power = qmi_wwan_manage_power,
337 .data = BIT(0), /* interface whitelist bitmap */
356}; 338};
357 339
358/* ZTE suck at making USB descriptors */
359static const struct driver_info qmi_wwan_force_int1 = { 340static const struct driver_info qmi_wwan_force_int1 = {
360 .description = "Qualcomm WWAN/QMI device", 341 .description = "Qualcomm WWAN/QMI device",
361 .flags = FLAG_WWAN, 342 .flags = FLAG_WWAN,
@@ -365,6 +346,15 @@ static const struct driver_info qmi_wwan_force_int1 = {
365 .data = BIT(1), /* interface whitelist bitmap */ 346 .data = BIT(1), /* interface whitelist bitmap */
366}; 347};
367 348
349static const struct driver_info qmi_wwan_force_int3 = {
350 .description = "Qualcomm WWAN/QMI device",
351 .flags = FLAG_WWAN,
352 .bind = qmi_wwan_bind_shared,
353 .unbind = qmi_wwan_unbind_shared,
354 .manage_power = qmi_wwan_manage_power,
355 .data = BIT(3), /* interface whitelist bitmap */
356};
357
368static const struct driver_info qmi_wwan_force_int4 = { 358static const struct driver_info qmi_wwan_force_int4 = {
369 .description = "Qualcomm WWAN/QMI device", 359 .description = "Qualcomm WWAN/QMI device",
370 .flags = FLAG_WWAN, 360 .flags = FLAG_WWAN,
@@ -390,16 +380,23 @@ static const struct driver_info qmi_wwan_force_int4 = {
390static const struct driver_info qmi_wwan_sierra = { 380static const struct driver_info qmi_wwan_sierra = {
391 .description = "Sierra Wireless wwan/QMI device", 381 .description = "Sierra Wireless wwan/QMI device",
392 .flags = FLAG_WWAN, 382 .flags = FLAG_WWAN,
393 .bind = qmi_wwan_bind_gobi, 383 .bind = qmi_wwan_bind_shared,
394 .unbind = qmi_wwan_unbind_shared, 384 .unbind = qmi_wwan_unbind_shared,
395 .manage_power = qmi_wwan_manage_power, 385 .manage_power = qmi_wwan_manage_power,
396 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ 386 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
397}; 387};
398 388
399#define HUAWEI_VENDOR_ID 0x12D1 389#define HUAWEI_VENDOR_ID 0x12D1
390
391/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
392#define QMI_GOBI1K_DEVICE(vend, prod) \
393 USB_DEVICE(vend, prod), \
394 .driver_info = (unsigned long)&qmi_wwan_force_int3
395
396/* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */
400#define QMI_GOBI_DEVICE(vend, prod) \ 397#define QMI_GOBI_DEVICE(vend, prod) \
401 USB_DEVICE(vend, prod), \ 398 USB_DEVICE(vend, prod), \
402 .driver_info = (unsigned long)&qmi_wwan_gobi 399 .driver_info = (unsigned long)&qmi_wwan_force_int0
403 400
404static const struct usb_device_id products[] = { 401static const struct usb_device_id products[] = {
405 { /* Huawei E392, E398 and possibly others sharing both device id and more... */ 402 { /* Huawei E392, E398 and possibly others sharing both device id and more... */
@@ -510,20 +507,24 @@ static const struct usb_device_id products[] = {
510 .bInterfaceProtocol = 0xff, 507 .bInterfaceProtocol = 0xff,
511 .driver_info = (unsigned long)&qmi_wwan_sierra, 508 .driver_info = (unsigned long)&qmi_wwan_sierra,
512 }, 509 },
513 {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 510
514 {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 511 /* Gobi 1000 devices */
515 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ 512 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
516 {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ 513 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
517 {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ 514 {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
518 {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ 515 {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
519 {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ 516 {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
520 {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ 517 {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
521 {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ 518 {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
522 {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ 519 {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
523 {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ 520 {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
524 {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ 521 {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
525 {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ 522 {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
526 {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ 523 {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
524 {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
525 {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
526
527 /* Gobi 2000 and 3000 devices */
527 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ 528 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
528 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ 529 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
529 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ 530 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 9f58330f1312..aba769d77459 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -796,11 +796,13 @@ int usbnet_open (struct net_device *net)
796 if (info->manage_power) { 796 if (info->manage_power) {
797 retval = info->manage_power(dev, 1); 797 retval = info->manage_power(dev, 1);
798 if (retval < 0) 798 if (retval < 0)
799 goto done; 799 goto done_manage_power_error;
800 usb_autopm_put_interface(dev->intf); 800 usb_autopm_put_interface(dev->intf);
801 } 801 }
802 return retval; 802 return retval;
803 803
804done_manage_power_error:
805 clear_bit(EVENT_DEV_OPEN, &dev->flags);
804done: 806done:
805 usb_autopm_put_interface(dev->intf); 807 usb_autopm_put_interface(dev->intf);
806done_nopm: 808done_nopm:
@@ -876,9 +878,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
876{ 878{
877 struct usbnet *dev = netdev_priv(net); 879 struct usbnet *dev = netdev_priv(net);
878 880
879 strncpy (info->driver, dev->driver_name, sizeof info->driver); 881 strlcpy (info->driver, dev->driver_name, sizeof info->driver);
880 strncpy (info->version, DRIVER_VERSION, sizeof info->version); 882 strlcpy (info->version, DRIVER_VERSION, sizeof info->version);
881 strncpy (info->fw_version, dev->driver_info->description, 883 strlcpy (info->fw_version, dev->driver_info->description,
882 sizeof info->fw_version); 884 sizeof info->fw_version);
883 usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); 885 usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info);
884} 886}
@@ -1202,6 +1204,21 @@ deferred:
1202} 1204}
1203EXPORT_SYMBOL_GPL(usbnet_start_xmit); 1205EXPORT_SYMBOL_GPL(usbnet_start_xmit);
1204 1206
1207static void rx_alloc_submit(struct usbnet *dev, gfp_t flags)
1208{
1209 struct urb *urb;
1210 int i;
1211
1212 /* don't refill the queue all at once */
1213 for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) {
1214 urb = usb_alloc_urb(0, flags);
1215 if (urb != NULL) {
1216 if (rx_submit(dev, urb, flags) == -ENOLINK)
1217 return;
1218 }
1219 }
1220}
1221
1205/*-------------------------------------------------------------------------*/ 1222/*-------------------------------------------------------------------------*/
1206 1223
1207// tasklet (work deferred from completions, in_irq) or timer 1224// tasklet (work deferred from completions, in_irq) or timer
@@ -1241,26 +1258,14 @@ static void usbnet_bh (unsigned long param)
1241 !timer_pending (&dev->delay) && 1258 !timer_pending (&dev->delay) &&
1242 !test_bit (EVENT_RX_HALT, &dev->flags)) { 1259 !test_bit (EVENT_RX_HALT, &dev->flags)) {
1243 int temp = dev->rxq.qlen; 1260 int temp = dev->rxq.qlen;
1244 int qlen = RX_QLEN (dev); 1261
1245 1262 if (temp < RX_QLEN(dev)) {
1246 if (temp < qlen) { 1263 rx_alloc_submit(dev, GFP_ATOMIC);
1247 struct urb *urb;
1248 int i;
1249
1250 // don't refill the queue all at once
1251 for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) {
1252 urb = usb_alloc_urb (0, GFP_ATOMIC);
1253 if (urb != NULL) {
1254 if (rx_submit (dev, urb, GFP_ATOMIC) ==
1255 -ENOLINK)
1256 return;
1257 }
1258 }
1259 if (temp != dev->rxq.qlen) 1264 if (temp != dev->rxq.qlen)
1260 netif_dbg(dev, link, dev->net, 1265 netif_dbg(dev, link, dev->net,
1261 "rxqlen %d --> %d\n", 1266 "rxqlen %d --> %d\n",
1262 temp, dev->rxq.qlen); 1267 temp, dev->rxq.qlen);
1263 if (dev->rxq.qlen < qlen) 1268 if (dev->rxq.qlen < RX_QLEN(dev))
1264 tasklet_schedule (&dev->bh); 1269 tasklet_schedule (&dev->bh);
1265 } 1270 }
1266 if (dev->txq.qlen < TX_QLEN (dev)) 1271 if (dev->txq.qlen < TX_QLEN (dev))
@@ -1513,6 +1518,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
1513 spin_lock_irq(&dev->txq.lock); 1518 spin_lock_irq(&dev->txq.lock);
1514 /* don't autosuspend while transmitting */ 1519 /* don't autosuspend while transmitting */
1515 if (dev->txq.qlen && PMSG_IS_AUTO(message)) { 1520 if (dev->txq.qlen && PMSG_IS_AUTO(message)) {
1521 dev->suspend_count--;
1516 spin_unlock_irq(&dev->txq.lock); 1522 spin_unlock_irq(&dev->txq.lock);
1517 return -EBUSY; 1523 return -EBUSY;
1518 } else { 1524 } else {
@@ -1569,6 +1575,13 @@ int usbnet_resume (struct usb_interface *intf)
1569 spin_unlock_irq(&dev->txq.lock); 1575 spin_unlock_irq(&dev->txq.lock);
1570 1576
1571 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { 1577 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
1578 /* handle remote wakeup ASAP */
1579 if (!dev->wait &&
1580 netif_device_present(dev->net) &&
1581 !timer_pending(&dev->delay) &&
1582 !test_bit(EVENT_RX_HALT, &dev->flags))
1583 rx_alloc_submit(dev, GFP_KERNEL);
1584
1572 if (!(dev->txq.qlen >= TX_QLEN(dev))) 1585 if (!(dev->txq.qlen >= TX_QLEN(dev)))
1573 netif_tx_wake_all_queues(dev->net); 1586 netif_tx_wake_all_queues(dev->net);
1574 tasklet_schedule (&dev->bh); 1587 tasklet_schedule (&dev->bh);
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 520a4b2eb9cc..a747c632597a 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -7233,8 +7233,8 @@ static int airo_get_aplist(struct net_device *dev,
7233 } 7233 }
7234 } else { 7234 } else {
7235 dwrq->flags = 1; /* Should be define'd */ 7235 dwrq->flags = 1; /* Should be define'd */
7236 memcpy(extra + sizeof(struct sockaddr)*i, 7236 memcpy(extra + sizeof(struct sockaddr) * i, qual,
7237 &qual, sizeof(struct iw_quality)*i); 7237 sizeof(struct iw_quality) * i);
7238 } 7238 }
7239 dwrq->length = i; 7239 dwrq->length = i;
7240 7240
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index c54b7d37bff1..420d69b2674c 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -143,6 +143,7 @@ struct ath_common {
143 u32 keymax; 143 u32 keymax;
144 DECLARE_BITMAP(keymap, ATH_KEYMAX); 144 DECLARE_BITMAP(keymap, ATH_KEYMAX);
145 DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); 145 DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
146 DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX);
146 enum ath_crypt_caps crypt_caps; 147 enum ath_crypt_caps crypt_caps;
147 148
148 unsigned int clockrate; 149 unsigned int clockrate;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index fbaa30930076..44ad6fe0278f 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1045,11 +1045,11 @@ ath5k_drain_tx_buffs(struct ath5k_hw *ah)
1045 1045
1046 ath5k_txbuf_free_skb(ah, bf); 1046 ath5k_txbuf_free_skb(ah, bf);
1047 1047
1048 spin_lock_bh(&ah->txbuflock); 1048 spin_lock(&ah->txbuflock);
1049 list_move_tail(&bf->list, &ah->txbuf); 1049 list_move_tail(&bf->list, &ah->txbuf);
1050 ah->txbuf_len++; 1050 ah->txbuf_len++;
1051 txq->txq_len--; 1051 txq->txq_len--;
1052 spin_unlock_bh(&ah->txbuflock); 1052 spin_unlock(&ah->txbuflock);
1053 } 1053 }
1054 txq->link = NULL; 1054 txq->link = NULL;
1055 txq->txq_poll_mark = false; 1055 txq->txq_poll_mark = false;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index a277cf6f339d..4866550ddd96 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -214,6 +214,7 @@ struct ath_frame_info {
214 enum ath9k_key_type keytype; 214 enum ath9k_key_type keytype;
215 u8 keyix; 215 u8 keyix;
216 u8 retries; 216 u8 retries;
217 u8 rtscts_rate;
217}; 218};
218 219
219struct ath_buf_state { 220struct ath_buf_state {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 2b8f61c210e1..abbd6effd60d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1496,6 +1496,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
1496 priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; 1496 priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--;
1497 1497
1498 if (priv->ah->opmode == NL80211_IFTYPE_STATION) { 1498 if (priv->ah->opmode == NL80211_IFTYPE_STATION) {
1499 ath9k_htc_choose_set_bssid(priv);
1499 if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) 1500 if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1))
1500 ath9k_htc_start_ani(priv); 1501 ath9k_htc_start_ani(priv);
1501 else if (priv->num_sta_assoc_vif == 0) 1502 else if (priv->num_sta_assoc_vif == 0)
@@ -1503,13 +1504,11 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
1503 } 1504 }
1504 } 1505 }
1505 1506
1506 if (changed & BSS_CHANGED_BSSID) { 1507 if (changed & BSS_CHANGED_IBSS) {
1507 if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { 1508 if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) {
1508 common->curaid = bss_conf->aid; 1509 common->curaid = bss_conf->aid;
1509 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); 1510 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
1510 ath9k_htc_set_bssid(priv); 1511 ath9k_htc_set_bssid(priv);
1511 } else if (priv->ah->opmode == NL80211_IFTYPE_STATION) {
1512 ath9k_htc_choose_set_bssid(priv);
1513 } 1512 }
1514 } 1513 }
1515 1514
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 7db1890448f2..995ca8e1302e 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -622,7 +622,7 @@ static int __ath9k_hw_init(struct ath_hw *ah)
622 622
623 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { 623 if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
624 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || 624 if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
625 ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && 625 ((AR_SREV_9160(ah) || AR_SREV_9280(ah) || AR_SREV_9287(ah)) &&
626 !ah->is_pciexpress)) { 626 !ah->is_pciexpress)) {
627 ah->config.serialize_regmode = 627 ah->config.serialize_regmode =
628 SER_REG_MODE_ON; 628 SER_REG_MODE_ON;
@@ -784,13 +784,25 @@ static void ath9k_hw_init_qos(struct ath_hw *ah)
784 784
785u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) 785u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah)
786{ 786{
787 struct ath_common *common = ath9k_hw_common(ah);
788 int i = 0;
789
787 REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); 790 REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK);
788 udelay(100); 791 udelay(100);
789 REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); 792 REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK);
790 793
791 while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) 794 while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) {
795
792 udelay(100); 796 udelay(100);
793 797
798 if (WARN_ON_ONCE(i >= 100)) {
799 ath_err(common, "PLL4 meaurement not done\n");
800 break;
801 }
802
803 i++;
804 }
805
794 return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3; 806 return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3;
795} 807}
796EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); 808EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 4de4473776ac..dac1a2709e3c 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -971,6 +971,15 @@ void ath_hw_pll_work(struct work_struct *work)
971 hw_pll_work.work); 971 hw_pll_work.work);
972 u32 pll_sqsum; 972 u32 pll_sqsum;
973 973
974 /*
975 * ensure that the PLL WAR is executed only
976 * after the STA is associated (or) if the
977 * beaconing had started in interfaces that
978 * uses beacons.
979 */
980 if (!(sc->sc_flags & SC_OP_BEACONS))
981 return;
982
974 if (AR_SREV_9485(sc->sc_ah)) { 983 if (AR_SREV_9485(sc->sc_ah)) {
975 984
976 ath9k_ps_wakeup(sc); 985 ath9k_ps_wakeup(sc);
@@ -1443,15 +1452,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1443 } 1452 }
1444 } 1453 }
1445 1454
1446 if ((ah->opmode == NL80211_IFTYPE_ADHOC) ||
1447 ((vif->type == NL80211_IFTYPE_ADHOC) &&
1448 sc->nvifs > 0)) {
1449 ath_err(common, "Cannot create ADHOC interface when other"
1450 " interfaces already exist.\n");
1451 ret = -EINVAL;
1452 goto out;
1453 }
1454
1455 ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); 1455 ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
1456 1456
1457 sc->nvifs++; 1457 sc->nvifs++;
@@ -1476,15 +1476,6 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
1476 mutex_lock(&sc->mutex); 1476 mutex_lock(&sc->mutex);
1477 ath9k_ps_wakeup(sc); 1477 ath9k_ps_wakeup(sc);
1478 1478
1479 /* See if new interface type is valid. */
1480 if ((new_type == NL80211_IFTYPE_ADHOC) &&
1481 (sc->nvifs > 1)) {
1482 ath_err(common, "When using ADHOC, it must be the only"
1483 " interface.\n");
1484 ret = -EINVAL;
1485 goto out;
1486 }
1487
1488 if (ath9k_uses_beacons(new_type) && 1479 if (ath9k_uses_beacons(new_type) &&
1489 !ath9k_uses_beacons(vif->type)) { 1480 !ath9k_uses_beacons(vif->type)) {
1490 if (sc->nbcnvifs >= ATH_BCBUF) { 1481 if (sc->nbcnvifs >= ATH_BCBUF) {
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index e1fcc68124dc..0735aeb3b26c 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -695,9 +695,9 @@ static bool ath_edma_get_buffers(struct ath_softc *sc,
695 __skb_unlink(skb, &rx_edma->rx_fifo); 695 __skb_unlink(skb, &rx_edma->rx_fifo);
696 list_add_tail(&bf->list, &sc->rx.rxbuf); 696 list_add_tail(&bf->list, &sc->rx.rxbuf);
697 ath_rx_edma_buf_link(sc, qtype); 697 ath_rx_edma_buf_link(sc, qtype);
698 } else {
699 bf = NULL;
700 } 698 }
699
700 bf = NULL;
701 } 701 }
702 702
703 *dest = bf; 703 *dest = bf;
@@ -822,7 +822,8 @@ static bool ath9k_rx_accept(struct ath_common *common,
822 * descriptor does contain a valid key index. This has been observed 822 * descriptor does contain a valid key index. This has been observed
823 * mostly with CCMP encryption. 823 * mostly with CCMP encryption.
824 */ 824 */
825 if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID) 825 if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID ||
826 !test_bit(rx_stats->rs_keyix, common->ccmp_keymap))
826 rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; 827 rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS;
827 828
828 if (!rx_stats->rs_datalen) { 829 if (!rx_stats->rs_datalen) {
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index d59dd01d6cde..4d571394c7a8 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -938,6 +938,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
938 struct ieee80211_tx_rate *rates; 938 struct ieee80211_tx_rate *rates;
939 const struct ieee80211_rate *rate; 939 const struct ieee80211_rate *rate;
940 struct ieee80211_hdr *hdr; 940 struct ieee80211_hdr *hdr;
941 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
941 int i; 942 int i;
942 u8 rix = 0; 943 u8 rix = 0;
943 944
@@ -948,18 +949,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
948 949
949 /* set dur_update_en for l-sig computation except for PS-Poll frames */ 950 /* set dur_update_en for l-sig computation except for PS-Poll frames */
950 info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); 951 info->dur_update = !ieee80211_is_pspoll(hdr->frame_control);
951 952 info->rtscts_rate = fi->rtscts_rate;
952 /*
953 * We check if Short Preamble is needed for the CTS rate by
954 * checking the BSS's global flag.
955 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
956 */
957 rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info);
958 info->rtscts_rate = rate->hw_value;
959
960 if (tx_info->control.vif &&
961 tx_info->control.vif->bss_conf.use_short_preamble)
962 info->rtscts_rate |= rate->hw_value_short;
963 953
964 for (i = 0; i < 4; i++) { 954 for (i = 0; i < 4; i++) {
965 bool is_40, is_sgi, is_sp; 955 bool is_40, is_sgi, is_sp;
@@ -1001,13 +991,13 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
1001 } 991 }
1002 992
1003 /* legacy rates */ 993 /* legacy rates */
994 rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx];
1004 if ((tx_info->band == IEEE80211_BAND_2GHZ) && 995 if ((tx_info->band == IEEE80211_BAND_2GHZ) &&
1005 !(rate->flags & IEEE80211_RATE_ERP_G)) 996 !(rate->flags & IEEE80211_RATE_ERP_G))
1006 phy = WLAN_RC_PHY_CCK; 997 phy = WLAN_RC_PHY_CCK;
1007 else 998 else
1008 phy = WLAN_RC_PHY_OFDM; 999 phy = WLAN_RC_PHY_OFDM;
1009 1000
1010 rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx];
1011 info->rates[i].Rate = rate->hw_value; 1001 info->rates[i].Rate = rate->hw_value;
1012 if (rate->hw_value_short) { 1002 if (rate->hw_value_short) {
1013 if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) 1003 if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
@@ -1776,10 +1766,22 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
1776 struct ieee80211_sta *sta = tx_info->control.sta; 1766 struct ieee80211_sta *sta = tx_info->control.sta;
1777 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; 1767 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
1778 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1768 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1769 const struct ieee80211_rate *rate;
1779 struct ath_frame_info *fi = get_frame_info(skb); 1770 struct ath_frame_info *fi = get_frame_info(skb);
1780 struct ath_node *an = NULL; 1771 struct ath_node *an = NULL;
1781 enum ath9k_key_type keytype; 1772 enum ath9k_key_type keytype;
1773 bool short_preamble = false;
1774
1775 /*
1776 * We check if Short Preamble is needed for the CTS rate by
1777 * checking the BSS's global flag.
1778 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
1779 */
1780 if (tx_info->control.vif &&
1781 tx_info->control.vif->bss_conf.use_short_preamble)
1782 short_preamble = true;
1782 1783
1784 rate = ieee80211_get_rts_cts_rate(hw, tx_info);
1783 keytype = ath9k_cmn_get_hw_crypto_keytype(skb); 1785 keytype = ath9k_cmn_get_hw_crypto_keytype(skb);
1784 1786
1785 if (sta) 1787 if (sta)
@@ -1794,6 +1796,9 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
1794 fi->keyix = ATH9K_TXKEYIX_INVALID; 1796 fi->keyix = ATH9K_TXKEYIX_INVALID;
1795 fi->keytype = keytype; 1797 fi->keytype = keytype;
1796 fi->framelen = framelen; 1798 fi->framelen = framelen;
1799 fi->rtscts_rate = rate->hw_value;
1800 if (short_preamble)
1801 fi->rtscts_rate |= rate->hw_value_short;
1797} 1802}
1798 1803
1799u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) 1804u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
index 0e81904956cf..5c54aa43ca2d 100644
--- a/drivers/net/wireless/ath/key.c
+++ b/drivers/net/wireless/ath/key.c
@@ -556,6 +556,9 @@ int ath_key_config(struct ath_common *common,
556 return -EIO; 556 return -EIO;
557 557
558 set_bit(idx, common->keymap); 558 set_bit(idx, common->keymap);
559 if (key->cipher == WLAN_CIPHER_SUITE_CCMP)
560 set_bit(idx, common->ccmp_keymap);
561
559 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { 562 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
560 set_bit(idx + 64, common->keymap); 563 set_bit(idx + 64, common->keymap);
561 set_bit(idx, common->tkip_keymap); 564 set_bit(idx, common->tkip_keymap);
@@ -582,6 +585,7 @@ void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key)
582 return; 585 return;
583 586
584 clear_bit(key->hw_key_idx, common->keymap); 587 clear_bit(key->hw_key_idx, common->keymap);
588 clear_bit(key->hw_key_idx, common->ccmp_keymap);
585 if (key->cipher != WLAN_CIPHER_SUITE_TKIP) 589 if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
586 return; 590 return;
587 591
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index acd03a4f9730..1b988f26bdf1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3767,7 +3767,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan)
3767 if (prev_status >= B43_STAT_STARTED) { 3767 if (prev_status >= B43_STAT_STARTED) {
3768 err = b43_wireless_core_start(up_dev); 3768 err = b43_wireless_core_start(up_dev);
3769 if (err) { 3769 if (err) {
3770 b43err(wl, "Fatal: Coult not start device for " 3770 b43err(wl, "Fatal: Could not start device for "
3771 "selected %s-GHz band\n", 3771 "selected %s-GHz band\n",
3772 band_to_string(chan->band)); 3772 band_to_string(chan->band));
3773 b43_wireless_core_exit(up_dev); 3773 b43_wireless_core_exit(up_dev);
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index cd9c9bc186d9..eae691e2f7dd 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2633,7 +2633,7 @@ static int b43legacy_switch_phymode(struct b43legacy_wl *wl,
2633 if (prev_status >= B43legacy_STAT_STARTED) { 2633 if (prev_status >= B43legacy_STAT_STARTED) {
2634 err = b43legacy_wireless_core_start(up_dev); 2634 err = b43legacy_wireless_core_start(up_dev);
2635 if (err) { 2635 if (err) {
2636 b43legacyerr(wl, "Fatal: Coult not start device for " 2636 b43legacyerr(wl, "Fatal: Could not start device for "
2637 "newly selected %s-PHY mode\n", 2637 "newly selected %s-PHY mode\n",
2638 phymode_to_string(new_mode)); 2638 phymode_to_string(new_mode));
2639 b43legacy_wireless_core_exit(up_dev); 2639 b43legacy_wireless_core_exit(up_dev);
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index e7c157e5ebeb..7f97dec8534d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -2239,6 +2239,7 @@ static ssize_t iwl_dbgfs_echo_test_write(struct file *file,
2239 return count; 2239 return count;
2240} 2240}
2241 2241
2242#ifdef CONFIG_IWLWIFI_DEBUG
2242static ssize_t iwl_dbgfs_log_event_read(struct file *file, 2243static ssize_t iwl_dbgfs_log_event_read(struct file *file,
2243 char __user *user_buf, 2244 char __user *user_buf,
2244 size_t count, loff_t *ppos) 2245 size_t count, loff_t *ppos)
@@ -2276,6 +2277,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
2276 2277
2277 return count; 2278 return count;
2278} 2279}
2280#endif
2279 2281
2280static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, 2282static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file,
2281 char __user *user_buf, 2283 char __user *user_buf,
@@ -2345,7 +2347,9 @@ DEBUGFS_READ_FILE_OPS(bt_traffic);
2345DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); 2347DEBUGFS_READ_WRITE_FILE_OPS(protection_mode);
2346DEBUGFS_READ_FILE_OPS(reply_tx_error); 2348DEBUGFS_READ_FILE_OPS(reply_tx_error);
2347DEBUGFS_WRITE_FILE_OPS(echo_test); 2349DEBUGFS_WRITE_FILE_OPS(echo_test);
2350#ifdef CONFIG_IWLWIFI_DEBUG
2348DEBUGFS_READ_WRITE_FILE_OPS(log_event); 2351DEBUGFS_READ_WRITE_FILE_OPS(log_event);
2352#endif
2349DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); 2353DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled);
2350 2354
2351/* 2355/*
@@ -2405,7 +2409,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2405 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); 2409 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR);
2406 DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); 2410 DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR);
2407 DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); 2411 DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR);
2412#ifdef CONFIG_IWLWIFI_DEBUG
2408 DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR); 2413 DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR);
2414#endif
2409 2415
2410 if (iwl_advanced_bt_coexist(priv)) 2416 if (iwl_advanced_bt_coexist(priv))
2411 DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); 2417 DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR);
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index 3ee23134c02b..013680332f07 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -796,6 +796,18 @@ int iwlagn_mac_sta_state(struct ieee80211_hw *hw,
796 switch (op) { 796 switch (op) {
797 case ADD: 797 case ADD:
798 ret = iwlagn_mac_sta_add(hw, vif, sta); 798 ret = iwlagn_mac_sta_add(hw, vif, sta);
799 if (ret)
800 break;
801 /*
802 * Clear the in-progress flag, the AP station entry was added
803 * but we'll initialize LQ only when we've associated (which
804 * would also clear the in-progress flag). This is necessary
805 * in case we never initialize LQ because association fails.
806 */
807 spin_lock_bh(&priv->sta_lock);
808 priv->stations[iwl_sta_id(sta)].used &=
809 ~IWL_STA_UCODE_INPROGRESS;
810 spin_unlock_bh(&priv->sta_lock);
799 break; 811 break;
800 case REMOVE: 812 case REMOVE:
801 ret = iwlagn_mac_sta_remove(hw, vif, sta); 813 ret = iwlagn_mac_sta_remove(hw, vif, sta);
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 9c44088054dd..900ee129e825 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -256,7 +256,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
256 else 256 else
257 last_seq = priv->rx_seq[tid]; 257 last_seq = priv->rx_seq[tid];
258 258
259 if (last_seq >= new_node->start_win) 259 if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM &&
260 last_seq >= new_node->start_win)
260 new_node->start_win = last_seq + 1; 261 new_node->start_win = last_seq + 1;
261 262
262 new_node->win_size = win_size; 263 new_node->win_size = win_size;
@@ -596,5 +597,5 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv)
596 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); 597 spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
597 598
598 INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); 599 INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr);
599 memset(priv->rx_seq, 0, sizeof(priv->rx_seq)); 600 mwifiex_reset_11n_rx_seq_num(priv);
600} 601}
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h
index f1bffebabc60..6c9815a0f5d8 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.h
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h
@@ -37,6 +37,13 @@
37 37
38#define ADDBA_RSP_STATUS_ACCEPT 0 38#define ADDBA_RSP_STATUS_ACCEPT 0
39 39
40#define MWIFIEX_DEF_11N_RX_SEQ_NUM 0xffff
41
42static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv)
43{
44 memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq));
45}
46
40int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, 47int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *,
41 u16 seqNum, 48 u16 seqNum,
42 u16 tid, u8 *ta, 49 u16 tid, u8 *ta,
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 015fec3371a0..ce61b6fae1c9 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1484,7 +1484,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1484 struct wireless_dev *wdev; 1484 struct wireless_dev *wdev;
1485 1485
1486 if (!adapter) 1486 if (!adapter)
1487 return NULL; 1487 return ERR_PTR(-EFAULT);
1488 1488
1489 switch (type) { 1489 switch (type) {
1490 case NL80211_IFTYPE_UNSPECIFIED: 1490 case NL80211_IFTYPE_UNSPECIFIED:
@@ -1494,12 +1494,12 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1494 if (priv->bss_mode) { 1494 if (priv->bss_mode) {
1495 wiphy_err(wiphy, 1495 wiphy_err(wiphy,
1496 "cannot create multiple sta/adhoc ifaces\n"); 1496 "cannot create multiple sta/adhoc ifaces\n");
1497 return NULL; 1497 return ERR_PTR(-EINVAL);
1498 } 1498 }
1499 1499
1500 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); 1500 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
1501 if (!wdev) 1501 if (!wdev)
1502 return NULL; 1502 return ERR_PTR(-ENOMEM);
1503 1503
1504 wdev->wiphy = wiphy; 1504 wdev->wiphy = wiphy;
1505 priv->wdev = wdev; 1505 priv->wdev = wdev;
@@ -1522,12 +1522,12 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1522 1522
1523 if (priv->bss_mode) { 1523 if (priv->bss_mode) {
1524 wiphy_err(wiphy, "Can't create multiple AP interfaces"); 1524 wiphy_err(wiphy, "Can't create multiple AP interfaces");
1525 return NULL; 1525 return ERR_PTR(-EINVAL);
1526 } 1526 }
1527 1527
1528 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); 1528 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
1529 if (!wdev) 1529 if (!wdev)
1530 return NULL; 1530 return ERR_PTR(-ENOMEM);
1531 1531
1532 priv->wdev = wdev; 1532 priv->wdev = wdev;
1533 wdev->wiphy = wiphy; 1533 wdev->wiphy = wiphy;
@@ -1544,14 +1544,15 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1544 break; 1544 break;
1545 default: 1545 default:
1546 wiphy_err(wiphy, "type not supported\n"); 1546 wiphy_err(wiphy, "type not supported\n");
1547 return NULL; 1547 return ERR_PTR(-EINVAL);
1548 } 1548 }
1549 1549
1550 dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name, 1550 dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name,
1551 ether_setup, 1); 1551 ether_setup, 1);
1552 if (!dev) { 1552 if (!dev) {
1553 wiphy_err(wiphy, "no memory available for netdevice\n"); 1553 wiphy_err(wiphy, "no memory available for netdevice\n");
1554 goto error; 1554 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
1555 return ERR_PTR(-ENOMEM);
1555 } 1556 }
1556 1557
1557 mwifiex_init_priv_params(priv, dev); 1558 mwifiex_init_priv_params(priv, dev);
@@ -1582,7 +1583,9 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1582 /* Register network device */ 1583 /* Register network device */
1583 if (register_netdevice(dev)) { 1584 if (register_netdevice(dev)) {
1584 wiphy_err(wiphy, "cannot register virtual network device\n"); 1585 wiphy_err(wiphy, "cannot register virtual network device\n");
1585 goto error; 1586 free_netdev(dev);
1587 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
1588 return ERR_PTR(-EFAULT);
1586 } 1589 }
1587 1590
1588 sema_init(&priv->async_sem, 1); 1591 sema_init(&priv->async_sem, 1);
@@ -1594,12 +1597,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1594 mwifiex_dev_debugfs_init(priv); 1597 mwifiex_dev_debugfs_init(priv);
1595#endif 1598#endif
1596 return dev; 1599 return dev;
1597error:
1598 if (dev && (dev->reg_state == NETREG_UNREGISTERED))
1599 free_netdev(dev);
1600 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
1601
1602 return NULL;
1603} 1600}
1604EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); 1601EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf);
1605 1602
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c
index ceb82cd749cc..383820a52beb 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -213,6 +213,7 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv,
213 /* save assoc resp ie index after auto-indexing */ 213 /* save assoc resp ie index after auto-indexing */
214 *assoc_idx = *((u16 *)pos); 214 *assoc_idx = *((u16 *)pos);
215 215
216 kfree(ap_custom_ie);
216 return ret; 217 return ret;
217} 218}
218 219
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index e0377473282f..fc8a9bfa1248 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -978,10 +978,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter,
978 dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); 978 dev_dbg(adapter->dev, "info: --- Rx: Event ---\n");
979 adapter->event_cause = *(u32 *) skb->data; 979 adapter->event_cause = *(u32 *) skb->data;
980 980
981 skb_pull(skb, MWIFIEX_EVENT_HEADER_LEN);
982
983 if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) 981 if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE))
984 memcpy(adapter->event_body, skb->data, skb->len); 982 memcpy(adapter->event_body,
983 skb->data + MWIFIEX_EVENT_HEADER_LEN,
984 skb->len);
985 985
986 /* event cause has been saved to adapter->event_cause */ 986 /* event cause has been saved to adapter->event_cause */
987 adapter->event_received = true; 987 adapter->event_received = true;
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index 4ace5a3dcd23..11e731f3581c 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -406,9 +406,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
406 break; 406 break;
407 407
408 case EVENT_UAP_STA_ASSOC: 408 case EVENT_UAP_STA_ASSOC:
409 skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER);
410 memset(&sinfo, 0, sizeof(sinfo)); 409 memset(&sinfo, 0, sizeof(sinfo));
411 event = (struct mwifiex_assoc_event *)adapter->event_skb->data; 410 event = (struct mwifiex_assoc_event *)
411 (adapter->event_body + MWIFIEX_UAP_EVENT_EXTRA_HEADER);
412 if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { 412 if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) {
413 len = -1; 413 len = -1;
414 414
@@ -433,9 +433,8 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
433 GFP_KERNEL); 433 GFP_KERNEL);
434 break; 434 break;
435 case EVENT_UAP_STA_DEAUTH: 435 case EVENT_UAP_STA_DEAUTH:
436 skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); 436 cfg80211_del_sta(priv->netdev, adapter->event_body +
437 cfg80211_del_sta(priv->netdev, adapter->event_skb->data, 437 MWIFIEX_UAP_EVENT_EXTRA_HEADER, GFP_KERNEL);
438 GFP_KERNEL);
439 break; 438 break;
440 case EVENT_UAP_BSS_IDLE: 439 case EVENT_UAP_BSS_IDLE:
441 priv->media_connected = false; 440 priv->media_connected = false;
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c
index e2faec4db108..cecb27283196 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -161,15 +161,11 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
161 goto done; 161 goto done;
162 162
163 for (i = 0; i < adapter->priv_num; i++) { 163 for (i = 0; i < adapter->priv_num; i++) {
164
165 tpriv = adapter->priv[i]; 164 tpriv = adapter->priv[i];
166 165
167 if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA) && 166 if (tpriv->media_connected &&
168 (tpriv->media_connected)) { 167 netif_queue_stopped(tpriv->netdev))
169 if (netif_queue_stopped(tpriv->netdev)) 168 mwifiex_wake_up_net_dev_queue(tpriv->netdev, adapter);
170 mwifiex_wake_up_net_dev_queue(tpriv->netdev,
171 adapter);
172 }
173 } 169 }
174done: 170done:
175 dev_kfree_skb_any(skb); 171 dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c
index 8173ab66066d..89f9a2a45de3 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -27,6 +27,17 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
27 struct cfg80211_ap_settings *params) { 27 struct cfg80211_ap_settings *params) {
28 int i; 28 int i;
29 29
30 if (!params->privacy) {
31 bss_config->protocol = PROTOCOL_NO_SECURITY;
32 bss_config->key_mgmt = KEY_MGMT_NONE;
33 bss_config->wpa_cfg.length = 0;
34 priv->sec_info.wep_enabled = 0;
35 priv->sec_info.wpa_enabled = 0;
36 priv->sec_info.wpa2_enabled = 0;
37
38 return 0;
39 }
40
30 switch (params->auth_type) { 41 switch (params->auth_type) {
31 case NL80211_AUTHTYPE_OPEN_SYSTEM: 42 case NL80211_AUTHTYPE_OPEN_SYSTEM:
32 bss_config->auth_mode = WLAN_AUTH_OPEN; 43 bss_config->auth_mode = WLAN_AUTH_OPEN;
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index 49ebf20c56eb..22a5916564b8 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -49,6 +49,7 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
49 struct device *dev = adapter->dev; 49 struct device *dev = adapter->dev;
50 u32 recv_type; 50 u32 recv_type;
51 __le32 tmp; 51 __le32 tmp;
52 int ret;
52 53
53 if (adapter->hs_activated) 54 if (adapter->hs_activated)
54 mwifiex_process_hs_config(adapter); 55 mwifiex_process_hs_config(adapter);
@@ -69,16 +70,19 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
69 case MWIFIEX_USB_TYPE_CMD: 70 case MWIFIEX_USB_TYPE_CMD:
70 if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { 71 if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) {
71 dev_err(dev, "CMD: skb->len too large\n"); 72 dev_err(dev, "CMD: skb->len too large\n");
72 return -1; 73 ret = -1;
74 goto exit_restore_skb;
73 } else if (!adapter->curr_cmd) { 75 } else if (!adapter->curr_cmd) {
74 dev_dbg(dev, "CMD: no curr_cmd\n"); 76 dev_dbg(dev, "CMD: no curr_cmd\n");
75 if (adapter->ps_state == PS_STATE_SLEEP_CFM) { 77 if (adapter->ps_state == PS_STATE_SLEEP_CFM) {
76 mwifiex_process_sleep_confirm_resp( 78 mwifiex_process_sleep_confirm_resp(
77 adapter, skb->data, 79 adapter, skb->data,
78 skb->len); 80 skb->len);
79 return 0; 81 ret = 0;
82 goto exit_restore_skb;
80 } 83 }
81 return -1; 84 ret = -1;
85 goto exit_restore_skb;
82 } 86 }
83 87
84 adapter->curr_cmd->resp_skb = skb; 88 adapter->curr_cmd->resp_skb = skb;
@@ -87,20 +91,22 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
87 case MWIFIEX_USB_TYPE_EVENT: 91 case MWIFIEX_USB_TYPE_EVENT:
88 if (skb->len < sizeof(u32)) { 92 if (skb->len < sizeof(u32)) {
89 dev_err(dev, "EVENT: skb->len too small\n"); 93 dev_err(dev, "EVENT: skb->len too small\n");
90 return -1; 94 ret = -1;
95 goto exit_restore_skb;
91 } 96 }
92 skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); 97 skb_copy_from_linear_data(skb, &tmp, sizeof(u32));
93 adapter->event_cause = le32_to_cpu(tmp); 98 adapter->event_cause = le32_to_cpu(tmp);
94 skb_pull(skb, sizeof(u32));
95 dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); 99 dev_dbg(dev, "event_cause %#x\n", adapter->event_cause);
96 100
97 if (skb->len > MAX_EVENT_SIZE) { 101 if (skb->len > MAX_EVENT_SIZE) {
98 dev_err(dev, "EVENT: event body too large\n"); 102 dev_err(dev, "EVENT: event body too large\n");
99 return -1; 103 ret = -1;
104 goto exit_restore_skb;
100 } 105 }
101 106
102 skb_copy_from_linear_data(skb, adapter->event_body, 107 memcpy(adapter->event_body, skb->data +
103 skb->len); 108 MWIFIEX_EVENT_HEADER_LEN, skb->len);
109
104 adapter->event_received = true; 110 adapter->event_received = true;
105 adapter->event_skb = skb; 111 adapter->event_skb = skb;
106 break; 112 break;
@@ -124,6 +130,12 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,
124 } 130 }
125 131
126 return -EINPROGRESS; 132 return -EINPROGRESS;
133
134exit_restore_skb:
135 /* The buffer will be reused for further cmds/events */
136 skb_push(skb, INTF_HEADER_LEN);
137
138 return ret;
127} 139}
128 140
129static void mwifiex_usb_rx_complete(struct urb *urb) 141static void mwifiex_usb_rx_complete(struct urb *urb)
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index f3fc65515857..3fa4d4176993 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -404,6 +404,8 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter)
404 priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; 404 priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE;
405 priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; 405 priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE;
406 406
407 mwifiex_reset_11n_rx_seq_num(priv);
408
407 atomic_set(&priv->wmm.tx_pkts_queued, 0); 409 atomic_set(&priv->wmm.tx_pkts_queued, 0);
408 atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); 410 atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID);
409 } 411 }
@@ -1221,6 +1223,7 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter)
1221 1223
1222 if (!ptr->is_11n_enabled || 1224 if (!ptr->is_11n_enabled ||
1223 mwifiex_is_ba_stream_setup(priv, ptr, tid) || 1225 mwifiex_is_ba_stream_setup(priv, ptr, tid) ||
1226 priv->wps.session_enable ||
1224 ((priv->sec_info.wpa_enabled || 1227 ((priv->sec_info.wpa_enabled ||
1225 priv->sec_info.wpa2_enabled) && 1228 priv->sec_info.wpa2_enabled) &&
1226 !priv->wpa_is_gtk_set)) { 1229 !priv->wpa_is_gtk_set)) {
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 2e9e6af21362..dfcd02ab6cae 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2110,7 +2110,7 @@ resize_buf:
2110 while (check_bssid_list_item(bssid, bssid_len, buf, len)) { 2110 while (check_bssid_list_item(bssid, bssid_len, buf, len)) {
2111 if (rndis_bss_info_update(usbdev, bssid) && match_bssid && 2111 if (rndis_bss_info_update(usbdev, bssid) && match_bssid &&
2112 matched) { 2112 matched) {
2113 if (!ether_addr_equal(bssid->mac, match_bssid)) 2113 if (ether_addr_equal(bssid->mac, match_bssid))
2114 *matched = true; 2114 *matched = true;
2115 } 2115 }
2116 2116
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index d228358e6a40..9970c2b1b199 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -301,9 +301,11 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
301 {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ 301 {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
302 {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ 302 {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
303 {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ 303 {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
304 {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
304 {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ 305 {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
305 {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ 306 {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
306 {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ 307 {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/
308 {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/
307 /* HP - Lite-On ,8188CUS Slim Combo */ 309 /* HP - Lite-On ,8188CUS Slim Combo */
308 {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, 310 {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)},
309 {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */ 311 {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */
@@ -346,6 +348,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
346 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ 348 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
347 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ 349 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
348 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ 350 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
351 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
349 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ 352 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/
350 {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ 353 {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/
351 {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ 354 {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c
index ad87a1ac6462..db6430c1a084 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -869,7 +869,7 @@ int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime)
869 } 869 }
870 870
871 *mactime = tsf_info->current_tsf_lsb | 871 *mactime = tsf_info->current_tsf_lsb |
872 (tsf_info->current_tsf_msb << 31); 872 ((u64)tsf_info->current_tsf_msb << 32);
873 873
874out: 874out:
875 kfree(tsf_info); 875 kfree(tsf_info);
diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c
index 9f15ccaf8f05..5ec50a476a69 100644
--- a/drivers/net/wireless/ti/wl1251/event.c
+++ b/drivers/net/wireless/ti/wl1251/event.c
@@ -76,8 +76,7 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox)
76 } 76 }
77 } 77 }
78 78
79 if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID && 79 if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) {
80 wl->station_mode != STATION_ACTIVE_MODE) {
81 wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); 80 wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT");
82 81
83 /* indicate to the stack, that beacons have been lost */ 82 /* indicate to the stack, that beacons have been lost */
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index 87f6305bda2c..567660cd2fcd 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -73,6 +73,8 @@ static void wl1251_spi_reset(struct wl1251 *wl)
73 spi_sync(wl_to_spi(wl), &m); 73 spi_sync(wl_to_spi(wl), &m);
74 74
75 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); 75 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
76
77 kfree(cmd);
76} 78}
77 79
78static void wl1251_spi_wake(struct wl1251 *wl) 80static void wl1251_spi_wake(struct wl1251 *wl)
@@ -127,6 +129,8 @@ static void wl1251_spi_wake(struct wl1251 *wl)
127 spi_sync(wl_to_spi(wl), &m); 129 spi_sync(wl_to_spi(wl), &m);
128 130
129 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); 131 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
132
133 kfree(cmd);
130} 134}
131 135
132static void wl1251_spi_reset_wake(struct wl1251 *wl) 136static void wl1251_spi_reset_wake(struct wl1251 *wl)
diff --git a/drivers/net/wireless/ti/wlcore/Kconfig b/drivers/net/wireless/ti/wlcore/Kconfig
index 54156b0b5c2d..d7b907e67170 100644
--- a/drivers/net/wireless/ti/wlcore/Kconfig
+++ b/drivers/net/wireless/ti/wlcore/Kconfig
@@ -1,7 +1,6 @@
1config WLCORE 1config WLCORE
2 tristate "TI wlcore support" 2 tristate "TI wlcore support"
3 depends on WL_TI && GENERIC_HARDIRQS && MAC80211 3 depends on WL_TI && GENERIC_HARDIRQS && MAC80211
4 depends on INET
5 select FW_LOADER 4 select FW_LOADER
6 ---help--- 5 ---help---
7 This module contains the main code for TI WLAN chips. It abstracts 6 This module contains the main code for TI WLAN chips. It abstracts
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2027afe405fe..30899901aef5 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1935,14 +1935,14 @@ static int __devexit xennet_remove(struct xenbus_device *dev)
1935 1935
1936 dev_dbg(&dev->dev, "%s\n", dev->nodename); 1936 dev_dbg(&dev->dev, "%s\n", dev->nodename);
1937 1937
1938 unregister_netdev(info->netdev);
1939
1940 xennet_disconnect_backend(info); 1938 xennet_disconnect_backend(info);
1941 1939
1942 del_timer_sync(&info->rx_refill_timer);
1943
1944 xennet_sysfs_delif(info->netdev); 1940 xennet_sysfs_delif(info->netdev);
1945 1941
1942 unregister_netdev(info->netdev);
1943
1944 del_timer_sync(&info->rx_refill_timer);
1945
1946 free_percpu(info->stats); 1946 free_percpu(info->stats);
1947 1947
1948 free_netdev(info->netdev); 1948 free_netdev(info->netdev);
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d9bfd49b1935..eada3f4ef801 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -511,6 +511,22 @@ out:
511} 511}
512EXPORT_SYMBOL(of_find_node_with_property); 512EXPORT_SYMBOL(of_find_node_with_property);
513 513
514static const struct of_device_id *of_match_compat(const struct of_device_id *matches,
515 const char *compat)
516{
517 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
518 const char *cp = matches->compatible;
519 int len = strlen(cp);
520
521 if (len > 0 && of_compat_cmp(compat, cp, len) == 0)
522 return matches;
523
524 matches++;
525 }
526
527 return NULL;
528}
529
514/** 530/**
515 * of_match_node - Tell if an device_node has a matching of_match structure 531 * of_match_node - Tell if an device_node has a matching of_match structure
516 * @matches: array of of device match structures to search in 532 * @matches: array of of device match structures to search in
@@ -521,9 +537,18 @@ EXPORT_SYMBOL(of_find_node_with_property);
521const struct of_device_id *of_match_node(const struct of_device_id *matches, 537const struct of_device_id *of_match_node(const struct of_device_id *matches,
522 const struct device_node *node) 538 const struct device_node *node)
523{ 539{
540 struct property *prop;
541 const char *cp;
542
524 if (!matches) 543 if (!matches)
525 return NULL; 544 return NULL;
526 545
546 of_property_for_each_string(node, "compatible", prop, cp) {
547 const struct of_device_id *match = of_match_compat(matches, cp);
548 if (match)
549 return match;
550 }
551
527 while (matches->name[0] || matches->type[0] || matches->compatible[0]) { 552 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
528 int match = 1; 553 int match = 1;
529 if (matches->name[0]) 554 if (matches->name[0])
@@ -532,10 +557,7 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
532 if (matches->type[0]) 557 if (matches->type[0])
533 match &= node->type 558 match &= node->type
534 && !strcmp(matches->type, node->type); 559 && !strcmp(matches->type, node->type);
535 if (matches->compatible[0]) 560 if (match && !matches->compatible[0])
536 match &= of_device_is_compatible(node,
537 matches->compatible);
538 if (match)
539 return matches; 561 return matches;
540 matches++; 562 matches++;
541 } 563 }
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 343ad29e211c..3132ea068d95 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -462,4 +462,5 @@ int of_platform_populate(struct device_node *root,
462 of_node_put(root); 462 of_node_put(root);
463 return rc; 463 return rc;
464} 464}
465EXPORT_SYMBOL_GPL(of_platform_populate);
465#endif /* CONFIG_OF_ADDRESS */ 466#endif /* CONFIG_OF_ADDRESS */
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index da14432806c6..efc4b7f308cf 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -25,7 +25,7 @@ static int oprofile_perf_enabled;
25static DEFINE_MUTEX(oprofile_perf_mutex); 25static DEFINE_MUTEX(oprofile_perf_mutex);
26 26
27static struct op_counter_config *counter_config; 27static struct op_counter_config *counter_config;
28static struct perf_event **perf_events[nr_cpumask_bits]; 28static struct perf_event **perf_events[NR_CPUS];
29static int num_counters; 29static int num_counters;
30 30
31/* 31/*
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index afb50ee64598..4ba4636b6a4a 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -137,7 +137,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
137 137
138free_group: 138free_group:
139 if (!purecfg) 139 if (!purecfg)
140 free(group); 140 kfree(group);
141free: 141free:
142 kfree(new_map); 142 kfree(new_map);
143 return ret; 143 return ret;
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index e8937e7e4999..3e7e47d6b385 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -1438,7 +1438,27 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function,
1438 1438
1439 dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); 1439 dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins);
1440 1440
1441 /* Handle this special glitch on altfunction C */ 1441 /*
1442 * If we're setting altfunc C by setting both AFSLA and AFSLB to 1,
1443 * we may pass through an undesired state. In this case we take
1444 * some extra care.
1445 *
1446 * Safe sequence used to switch IOs between GPIO and Alternate-C mode:
1447 * - Save SLPM registers (since we have a shadow register in the
1448 * nmk_chip we're using that as backup)
1449 * - Set SLPM=0 for the IOs you want to switch and others to 1
1450 * - Configure the GPIO registers for the IOs that are being switched
1451 * - Set IOFORCE=1
1452 * - Modify the AFLSA/B registers for the IOs that are being switched
1453 * - Set IOFORCE=0
1454 * - Restore SLPM registers
1455 * - Any spurious wake up event during switch sequence to be ignored
1456 * and cleared
1457 *
1458 * We REALLY need to save ALL slpm registers, because the external
1459 * IOFORCE will switch *all* ports to their sleepmode setting to as
1460 * to avoid glitches. (Not just one port!)
1461 */
1442 glitch = (g->altsetting == NMK_GPIO_ALT_C); 1462 glitch = (g->altsetting == NMK_GPIO_ALT_C);
1443 1463
1444 if (glitch) { 1464 if (glitch) {
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 5ae50aadf885..b3f6b2873fdd 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr pinmux 2 * Driver for the ST Microelectronics SPEAr pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * Inspired from: 7 * Inspired from:
8 * - U300 Pinctl drivers 8 * - U300 Pinctl drivers
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h
index 9155783bb47f..d950eb78d939 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.h
+++ b/drivers/pinctrl/spear/pinctrl-spear.h
@@ -2,7 +2,7 @@
2 * Driver header file for the ST Microelectronics SPEAr pinmux 2 * Driver header file for the ST Microelectronics SPEAr pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/pinctrl/spear/pinctrl-spear1310.c b/drivers/pinctrl/spear/pinctrl-spear1310.c
index fff168be7f00..d6cca8c81b92 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1310.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr1310 pinmux 2 * Driver for the ST Microelectronics SPEAr1310 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -2192,7 +2192,7 @@ static void __exit spear1310_pinctrl_exit(void)
2192} 2192}
2193module_exit(spear1310_pinctrl_exit); 2193module_exit(spear1310_pinctrl_exit);
2194 2194
2195MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 2195MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
2196MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver"); 2196MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver");
2197MODULE_LICENSE("GPL v2"); 2197MODULE_LICENSE("GPL v2");
2198MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match); 2198MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear1340.c b/drivers/pinctrl/spear/pinctrl-spear1340.c
index a8ab2a6f51bf..a0eb057e55bd 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1340.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1340.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr1340 pinmux 2 * Driver for the ST Microelectronics SPEAr1340 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -1983,7 +1983,7 @@ static void __exit spear1340_pinctrl_exit(void)
1983} 1983}
1984module_exit(spear1340_pinctrl_exit); 1984module_exit(spear1340_pinctrl_exit);
1985 1985
1986MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 1986MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
1987MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver"); 1987MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver");
1988MODULE_LICENSE("GPL v2"); 1988MODULE_LICENSE("GPL v2");
1989MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match); 1989MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear300.c b/drivers/pinctrl/spear/pinctrl-spear300.c
index 9c82a35e4e78..4dfc2849b172 100644
--- a/drivers/pinctrl/spear/pinctrl-spear300.c
+++ b/drivers/pinctrl/spear/pinctrl-spear300.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr300 pinmux 2 * Driver for the ST Microelectronics SPEAr300 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -702,7 +702,7 @@ static void __exit spear300_pinctrl_exit(void)
702} 702}
703module_exit(spear300_pinctrl_exit); 703module_exit(spear300_pinctrl_exit);
704 704
705MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 705MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
706MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver"); 706MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver");
707MODULE_LICENSE("GPL v2"); 707MODULE_LICENSE("GPL v2");
708MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match); 708MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear310.c b/drivers/pinctrl/spear/pinctrl-spear310.c
index 1a9707605125..96883693fb7e 100644
--- a/drivers/pinctrl/spear/pinctrl-spear310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear310.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr310 pinmux 2 * Driver for the ST Microelectronics SPEAr310 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -425,7 +425,7 @@ static void __exit spear310_pinctrl_exit(void)
425} 425}
426module_exit(spear310_pinctrl_exit); 426module_exit(spear310_pinctrl_exit);
427 427
428MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 428MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
429MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver"); 429MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver");
430MODULE_LICENSE("GPL v2"); 430MODULE_LICENSE("GPL v2");
431MODULE_DEVICE_TABLE(of, SPEAr310_pinctrl_of_match); 431MODULE_DEVICE_TABLE(of, SPEAr310_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear320.c b/drivers/pinctrl/spear/pinctrl-spear320.c
index de726e6c283a..020b1e0bdb3e 100644
--- a/drivers/pinctrl/spear/pinctrl-spear320.c
+++ b/drivers/pinctrl/spear/pinctrl-spear320.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr320 pinmux 2 * Driver for the ST Microelectronics SPEAr320 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -3462,7 +3462,7 @@ static void __exit spear320_pinctrl_exit(void)
3462} 3462}
3463module_exit(spear320_pinctrl_exit); 3463module_exit(spear320_pinctrl_exit);
3464 3464
3465MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 3465MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
3466MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver"); 3466MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver");
3467MODULE_LICENSE("GPL v2"); 3467MODULE_LICENSE("GPL v2");
3468MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match); 3468MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.c b/drivers/pinctrl/spear/pinctrl-spear3xx.c
index 91c883bc46a6..0242378f7cb8 100644
--- a/drivers/pinctrl/spear/pinctrl-spear3xx.c
+++ b/drivers/pinctrl/spear/pinctrl-spear3xx.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr3xx pinmux 2 * Driver for the ST Microelectronics SPEAr3xx pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.h b/drivers/pinctrl/spear/pinctrl-spear3xx.h
index 5d5fdd8df7b8..31f44347f17c 100644
--- a/drivers/pinctrl/spear/pinctrl-spear3xx.h
+++ b/drivers/pinctrl/spear/pinctrl-spear3xx.h
@@ -2,7 +2,7 @@
2 * Header file for the ST Microelectronics SPEAr3xx pinmux 2 * Header file for the ST Microelectronics SPEAr3xx pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com> 5 * Viresh Kumar <viresh.linux@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index e1b8c54ace5a..a739f5ca936a 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -794,17 +794,17 @@ static __devinit int ab8500_regulator_register(struct platform_device *pdev,
794} 794}
795 795
796static struct of_regulator_match ab8500_regulator_matches[] = { 796static struct of_regulator_match ab8500_regulator_matches[] = {
797 { .name = "LDO-AUX1", .driver_data = (void *) AB8500_LDO_AUX1, }, 797 { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, },
798 { .name = "LDO-AUX2", .driver_data = (void *) AB8500_LDO_AUX2, }, 798 { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, },
799 { .name = "LDO-AUX3", .driver_data = (void *) AB8500_LDO_AUX3, }, 799 { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, },
800 { .name = "LDO-INTCORE", .driver_data = (void *) AB8500_LDO_INTCORE, }, 800 { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, },
801 { .name = "LDO-TVOUT", .driver_data = (void *) AB8500_LDO_TVOUT, }, 801 { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, },
802 { .name = "LDO-USB", .driver_data = (void *) AB8500_LDO_USB, }, 802 { .name = "ab8500_ldo_usb", .driver_data = (void *) AB8500_LDO_USB, },
803 { .name = "LDO-AUDIO", .driver_data = (void *) AB8500_LDO_AUDIO, }, 803 { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, },
804 { .name = "LDO-ANAMIC1", .driver_data = (void *) AB8500_LDO_ANAMIC1, }, 804 { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, },
805 { .name = "LDO-ANAMIC2", .driver_data = (void *) AB8500_LDO_ANAMIC2, }, 805 { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, },
806 { .name = "LDO-DMIC", .driver_data = (void *) AB8500_LDO_DMIC, }, 806 { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, },
807 { .name = "LDO-ANA", .driver_data = (void *) AB8500_LDO_ANA, }, 807 { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
808}; 808};
809 809
810static __devinit int 810static __devinit int
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index 968f97f3cb3d..9dbb491b6efa 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -452,26 +452,26 @@ static __devinit int db8500_regulator_register(struct platform_device *pdev,
452} 452}
453 453
454static struct of_regulator_match db8500_regulator_matches[] = { 454static struct of_regulator_match db8500_regulator_matches[] = {
455 { .name = "db8500-vape", .driver_data = (void *) DB8500_REGULATOR_VAPE, }, 455 { .name = "db8500_vape", .driver_data = (void *) DB8500_REGULATOR_VAPE, },
456 { .name = "db8500-varm", .driver_data = (void *) DB8500_REGULATOR_VARM, }, 456 { .name = "db8500_varm", .driver_data = (void *) DB8500_REGULATOR_VARM, },
457 { .name = "db8500-vmodem", .driver_data = (void *) DB8500_REGULATOR_VMODEM, }, 457 { .name = "db8500_vmodem", .driver_data = (void *) DB8500_REGULATOR_VMODEM, },
458 { .name = "db8500-vpll", .driver_data = (void *) DB8500_REGULATOR_VPLL, }, 458 { .name = "db8500_vpll", .driver_data = (void *) DB8500_REGULATOR_VPLL, },
459 { .name = "db8500-vsmps1", .driver_data = (void *) DB8500_REGULATOR_VSMPS1, }, 459 { .name = "db8500_vsmps1", .driver_data = (void *) DB8500_REGULATOR_VSMPS1, },
460 { .name = "db8500-vsmps2", .driver_data = (void *) DB8500_REGULATOR_VSMPS2, }, 460 { .name = "db8500_vsmps2", .driver_data = (void *) DB8500_REGULATOR_VSMPS2, },
461 { .name = "db8500-vsmps3", .driver_data = (void *) DB8500_REGULATOR_VSMPS3, }, 461 { .name = "db8500_vsmps3", .driver_data = (void *) DB8500_REGULATOR_VSMPS3, },
462 { .name = "db8500-vrf1", .driver_data = (void *) DB8500_REGULATOR_VRF1, }, 462 { .name = "db8500_vrf1", .driver_data = (void *) DB8500_REGULATOR_VRF1, },
463 { .name = "db8500-sva-mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSP, }, 463 { .name = "db8500_sva_mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSP, },
464 { .name = "db8500-sva-mmdsp-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSPRET, }, 464 { .name = "db8500_sva_mmdsp_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSPRET, },
465 { .name = "db8500-sva-pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAPIPE, }, 465 { .name = "db8500_sva_pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAPIPE, },
466 { .name = "db8500-sia-mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSP, }, 466 { .name = "db8500_sia_mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSP, },
467 { .name = "db8500-sia-mmdsp-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSPRET, }, 467 { .name = "db8500_sia_mmdsp_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSPRET, },
468 { .name = "db8500-sia-pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAPIPE, }, 468 { .name = "db8500_sia_pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAPIPE, },
469 { .name = "db8500-sga", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SGA, }, 469 { .name = "db8500_sga", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SGA, },
470 { .name = "db8500-b2r2-mcde", .driver_data = (void *) DB8500_REGULATOR_SWITCH_B2R2_MCDE, }, 470 { .name = "db8500_b2r2_mcde", .driver_data = (void *) DB8500_REGULATOR_SWITCH_B2R2_MCDE, },
471 { .name = "db8500-esram12", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12, }, 471 { .name = "db8500_esram12", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12, },
472 { .name = "db8500-esram12-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12RET, }, 472 { .name = "db8500_esram12_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12RET, },
473 { .name = "db8500-esram34", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34, }, 473 { .name = "db8500_esram34", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34, },
474 { .name = "db8500-esram34-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, }, 474 { .name = "db8500_esram34_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, },
475}; 475};
476 476
477static __devinit int 477static __devinit int
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 9b7ca90057d5..795f75a6ac33 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -673,7 +673,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
673 pmic->desc[id].ops = &palmas_ops_smps10; 673 pmic->desc[id].ops = &palmas_ops_smps10;
674 pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL; 674 pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL;
675 pmic->desc[id].vsel_mask = SMPS10_VSEL; 675 pmic->desc[id].vsel_mask = SMPS10_VSEL;
676 pmic->desc[id].enable_reg = PALMAS_SMPS10_STATUS; 676 pmic->desc[id].enable_reg =
677 PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
678 PALMAS_SMPS10_STATUS);
677 pmic->desc[id].enable_mask = SMPS10_BOOST_EN; 679 pmic->desc[id].enable_mask = SMPS10_BOOST_EN;
678 } 680 }
679 681
@@ -739,7 +741,8 @@ static __devinit int palmas_probe(struct platform_device *pdev)
739 741
740 pmic->desc[id].type = REGULATOR_VOLTAGE; 742 pmic->desc[id].type = REGULATOR_VOLTAGE;
741 pmic->desc[id].owner = THIS_MODULE; 743 pmic->desc[id].owner = THIS_MODULE;
742 pmic->desc[id].enable_reg = palmas_regs_info[id].ctrl_addr; 744 pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
745 palmas_regs_info[id].ctrl_addr);
743 pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE; 746 pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE;
744 747
745 if (pdata && pdata->reg_data) 748 if (pdata && pdata->reg_data)
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 290d6fc01029..9caadb482178 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -451,7 +451,7 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev,
451 451
452 desc = reg_voltage_map[reg_id]; 452 desc = reg_voltage_map[reg_id];
453 453
454 if (old_sel < new_sel) 454 if ((old_sel < new_sel) && s5m8767->ramp_delay)
455 return DIV_ROUND_UP(desc->step * (new_sel - old_sel), 455 return DIV_ROUND_UP(desc->step * (new_sel - old_sel),
456 s5m8767->ramp_delay * 1000); 456 s5m8767->ramp_delay * 1000);
457 return 0; 457 return 0;
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index f841bd0db6aa..8f1be8586c72 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -71,7 +71,7 @@
71 71
72/* LDO_CTRL bitfields */ 72/* LDO_CTRL bitfields */
73#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4) 73#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4)
74#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0x0F << ((ldo_id)*4)) 74#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0x07 << ((ldo_id)*4))
75 75
76/* Number of step-down converters available */ 76/* Number of step-down converters available */
77#define TPS65023_NUM_DCDC 3 77#define TPS65023_NUM_DCDC 3
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index b88b3df82381..1b299aacf22f 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -482,7 +482,7 @@ static int get_voltage_sel(struct regulator_dev *rdev)
482 info = &supply_info[rdev_get_id(rdev)]; 482 info = &supply_info[rdev_get_id(rdev)];
483 483
484 if (info->flags & FIXED_VOLTAGE) 484 if (info->flags & FIXED_VOLTAGE)
485 return info->fixed_voltage; 485 return 0;
486 486
487 ret = read_field(hw, &info->voltage); 487 ret = read_field(hw, &info->voltage);
488 if (ret < 0) 488 if (ret < 0)
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 69425c4e86f3..de138e30d3e6 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -182,7 +182,7 @@ static int __devinit omap_rproc_probe(struct platform_device *pdev)
182 182
183 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 183 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
184 if (ret) { 184 if (ret) {
185 dev_err(pdev->dev.parent, "dma_set_coherent_mask: %d\n", ret); 185 dev_err(&pdev->dev, "dma_set_coherent_mask: %d\n", ret);
186 return ret; 186 return ret;
187 } 187 }
188 188
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 8ea7bccc7100..66324ee4678f 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -247,7 +247,7 @@ rproc_load_segments(struct rproc *rproc, const u8 *elf_data, size_t len)
247 } 247 }
248 248
249 if (offset + filesz > len) { 249 if (offset + filesz > len) {
250 dev_err(dev, "truncated fw: need 0x%x avail 0x%x\n", 250 dev_err(dev, "truncated fw: need 0x%x avail 0x%zx\n",
251 offset + filesz, len); 251 offset + filesz, len);
252 ret = -EINVAL; 252 ret = -EINVAL;
253 break; 253 break;
@@ -934,7 +934,7 @@ static void rproc_resource_cleanup(struct rproc *rproc)
934 unmapped = iommu_unmap(rproc->domain, entry->da, entry->len); 934 unmapped = iommu_unmap(rproc->domain, entry->da, entry->len);
935 if (unmapped != entry->len) { 935 if (unmapped != entry->len) {
936 /* nothing much to do besides complaining */ 936 /* nothing much to do besides complaining */
937 dev_err(dev, "failed to unmap %u/%u\n", entry->len, 937 dev_err(dev, "failed to unmap %u/%zu\n", entry->len,
938 unmapped); 938 unmapped);
939 } 939 }
940 940
@@ -1020,7 +1020,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
1020 1020
1021 ehdr = (struct elf32_hdr *)fw->data; 1021 ehdr = (struct elf32_hdr *)fw->data;
1022 1022
1023 dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size); 1023 dev_info(dev, "Booting fw image %s, size %zd\n", name, fw->size);
1024 1024
1025 /* 1025 /*
1026 * if enabling an IOMMU isn't relevant for this rproc, this is 1026 * if enabling an IOMMU isn't relevant for this rproc, this is
@@ -1041,8 +1041,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
1041 1041
1042 /* look for the resource table */ 1042 /* look for the resource table */
1043 table = rproc_find_rsc_table(rproc, fw->data, fw->size, &tablesz); 1043 table = rproc_find_rsc_table(rproc, fw->data, fw->size, &tablesz);
1044 if (!table) 1044 if (!table) {
1045 ret = -EINVAL;
1045 goto clean_up; 1046 goto clean_up;
1047 }
1046 1048
1047 /* handle fw resources which are required to boot rproc */ 1049 /* handle fw resources which are required to boot rproc */
1048 ret = rproc_handle_boot_rsc(rproc, table, tablesz); 1050 ret = rproc_handle_boot_rsc(rproc, table, tablesz);
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 6986552b47e6..77759c78cc21 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3960,7 +3960,7 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha,
3960{ 3960{
3961 struct qla_hw_data *ha = vha->hw; 3961 struct qla_hw_data *ha = vha->hw;
3962 struct qla_tgt *tgt = ha->tgt.qla_tgt; 3962 struct qla_tgt *tgt = ha->tgt.qla_tgt;
3963 int reason_code; 3963 int login_code;
3964 3964
3965 ql_dbg(ql_dbg_tgt, vha, 0xe039, 3965 ql_dbg(ql_dbg_tgt, vha, 0xe039,
3966 "scsi(%ld): ha state %d init_done %d oper_mode %d topo %d\n", 3966 "scsi(%ld): ha state %d init_done %d oper_mode %d topo %d\n",
@@ -4003,9 +4003,9 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha,
4003 { 4003 {
4004 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03b, 4004 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03b,
4005 "qla_target(%d): Async LOOP_UP occured " 4005 "qla_target(%d): Async LOOP_UP occured "
4006 "(m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, 4006 "(m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx,
4007 le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), 4007 le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]),
4008 le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); 4008 le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3]));
4009 if (tgt->link_reinit_iocb_pending) { 4009 if (tgt->link_reinit_iocb_pending) {
4010 qlt_send_notify_ack(vha, (void *)&tgt->link_reinit_iocb, 4010 qlt_send_notify_ack(vha, (void *)&tgt->link_reinit_iocb,
4011 0, 0, 0, 0, 0, 0); 4011 0, 0, 0, 0, 0, 0);
@@ -4020,23 +4020,24 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha,
4020 case MBA_RSCN_UPDATE: 4020 case MBA_RSCN_UPDATE:
4021 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03c, 4021 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03c,
4022 "qla_target(%d): Async event %#x occured " 4022 "qla_target(%d): Async event %#x occured "
4023 "(m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, code, 4023 "(m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, code,
4024 le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), 4024 le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]),
4025 le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); 4025 le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3]));
4026 break; 4026 break;
4027 4027
4028 case MBA_PORT_UPDATE: 4028 case MBA_PORT_UPDATE:
4029 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03d, 4029 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03d,
4030 "qla_target(%d): Port update async event %#x " 4030 "qla_target(%d): Port update async event %#x "
4031 "occured: updating the ports database (m[1]=%x, m[2]=%x, " 4031 "occured: updating the ports database (m[0]=%x, m[1]=%x, "
4032 "m[3]=%x, m[4]=%x)", vha->vp_idx, code, 4032 "m[2]=%x, m[3]=%x)", vha->vp_idx, code,
4033 le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), 4033 le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]),
4034 le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); 4034 le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3]));
4035 reason_code = le16_to_cpu(mailbox[2]); 4035
4036 if (reason_code == 0x4) 4036 login_code = le16_to_cpu(mailbox[2]);
4037 if (login_code == 0x4)
4037 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03e, 4038 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03e,
4038 "Async MB 2: Got PLOGI Complete\n"); 4039 "Async MB 2: Got PLOGI Complete\n");
4039 else if (reason_code == 0x7) 4040 else if (login_code == 0x7)
4040 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03f, 4041 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03f,
4041 "Async MB 2: Port Logged Out\n"); 4042 "Async MB 2: Port Logged Out\n");
4042 break; 4043 break;
@@ -4044,9 +4045,9 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha,
4044 default: 4045 default:
4045 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf040, 4046 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf040,
4046 "qla_target(%d): Async event %#x occured: " 4047 "qla_target(%d): Async event %#x occured: "
4047 "ignore (m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, 4048 "ignore (m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx,
4048 code, le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), 4049 code, le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]),
4049 le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); 4050 le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3]));
4050 break; 4051 break;
4051 } 4052 }
4052 4053
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 6f0a4c612b3b..6f72b80121a0 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1899,6 +1899,8 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
1899{ 1899{
1900 if (sdp->host->max_cmd_len < 16) 1900 if (sdp->host->max_cmd_len < 16)
1901 return 0; 1901 return 0;
1902 if (sdp->try_rc_10_first)
1903 return 0;
1902 if (sdp->scsi_level > SCSI_SPC_2) 1904 if (sdp->scsi_level > SCSI_SPC_2)
1903 return 1; 1905 return 1;
1904 if (scsi_device_protection(sdp)) 1906 if (scsi_device_protection(sdp))
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 46ef5fe51db5..0c73dd4f43a0 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -801,7 +801,7 @@ static int omap2_mcspi_setup(struct spi_device *spi)
801 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; 801 mcspi_dma = &mcspi->dma_channels[spi->chip_select];
802 802
803 if (!cs) { 803 if (!cs) {
804 cs = devm_kzalloc(&spi->dev , sizeof *cs, GFP_KERNEL); 804 cs = kzalloc(sizeof *cs, GFP_KERNEL);
805 if (!cs) 805 if (!cs)
806 return -ENOMEM; 806 return -ENOMEM;
807 cs->base = mcspi->base + spi->chip_select * 0x14; 807 cs->base = mcspi->base + spi->chip_select * 0x14;
@@ -842,6 +842,7 @@ static void omap2_mcspi_cleanup(struct spi_device *spi)
842 cs = spi->controller_state; 842 cs = spi->controller_state;
843 list_del(&cs->node); 843 list_del(&cs->node);
844 844
845 kfree(cs);
845 } 846 }
846 847
847 if (spi->chip_select < spi->master->num_chipselect) { 848 if (spi->chip_select < spi->master->num_chipselect) {
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 1c3d6386ea36..aeac1caba3f9 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -30,6 +30,7 @@
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/usb.h> 31#include <linux/usb.h>
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/kconfig.h>
33#include <linux/kernel.h> 34#include <linux/kernel.h>
34#include <linux/sched.h> 35#include <linux/sched.h>
35#include <linux/fcntl.h> 36#include <linux/fcntl.h>
@@ -981,6 +982,8 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
981} 982}
982EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); 983EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister);
983 984
985#if IS_ENABLED(CONFIG_USB)
986
984static int comedi_old_usb_auto_config(struct usb_interface *intf, 987static int comedi_old_usb_auto_config(struct usb_interface *intf,
985 struct comedi_driver *driver) 988 struct comedi_driver *driver)
986{ 989{
@@ -1043,3 +1046,5 @@ void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
1043 comedi_driver_unregister(comedi_driver); 1046 comedi_driver_unregister(comedi_driver);
1044} 1047}
1045EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); 1048EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
1049
1050#endif
diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c
index 292af0f7f451..51665132c61b 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -104,7 +104,7 @@ struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type,
104 104
105void netlink_exit(struct sock *sock) 105void netlink_exit(struct sock *sock)
106{ 106{
107 sock_release(sock->sk_socket); 107 netlink_kernel_release(sock);
108} 108}
109 109
110int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) 110int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt
index 0338c7cd0a8b..f03fbd3bb454 100644
--- a/drivers/staging/iio/Documentation/device.txt
+++ b/drivers/staging/iio/Documentation/device.txt
@@ -29,8 +29,6 @@ Then fill in the following:
29 * info->driver_module: 29 * info->driver_module:
30 Set to THIS_MODULE. Used to ensure correct ownership 30 Set to THIS_MODULE. Used to ensure correct ownership
31 of various resources allocate by the core. 31 of various resources allocate by the core.
32 * info->num_interrupt_lines:
33 Number of event triggering hardware lines the device has.
34 * info->event_attrs: 32 * info->event_attrs:
35 Attributes used to enable / disable hardware events. 33 Attributes used to enable / disable hardware events.
36 * info->attrs: 34 * info->attrs:
diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig
index 2490dd25093b..8f1b3af02f29 100644
--- a/drivers/staging/iio/adc/Kconfig
+++ b/drivers/staging/iio/adc/Kconfig
@@ -13,6 +13,7 @@ config AD7291
13config AD7298 13config AD7298
14 tristate "Analog Devices AD7298 ADC driver" 14 tristate "Analog Devices AD7298 ADC driver"
15 depends on SPI 15 depends on SPI
16 select IIO_KFIFO_BUF if IIO_BUFFER
16 help 17 help
17 Say yes here to build support for Analog Devices AD7298 18 Say yes here to build support for Analog Devices AD7298
18 8 Channel ADC with temperature sensor. 19 8 Channel ADC with temperature sensor.
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
index 10ab6dc823b9..a13afff2dfe6 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -235,7 +235,8 @@ static const struct attribute_group ad7606_attribute_group_range = {
235 .indexed = 1, \ 235 .indexed = 1, \
236 .channel = num, \ 236 .channel = num, \
237 .address = num, \ 237 .address = num, \
238 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, \ 238 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
239 IIO_CHAN_INFO_SCALE_SHARED_BIT, \
239 .scan_index = num, \ 240 .scan_index = num, \
240 .scan_type = IIO_ST('s', 16, 16, 0), \ 241 .scan_type = IIO_ST('s', 16, 16, 0), \
241 } 242 }
diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c
index 3295ea63f3eb..97ef67036e3f 100644
--- a/drivers/staging/media/lirc/lirc_serial.c
+++ b/drivers/staging/media/lirc/lirc_serial.c
@@ -129,6 +129,7 @@ static void send_space_homebrew(long length);
129 129
130static struct lirc_serial hardware[] = { 130static struct lirc_serial hardware[] = {
131 [LIRC_HOMEBREW] = { 131 [LIRC_HOMEBREW] = {
132 .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_HOMEBREW].lock),
132 .signal_pin = UART_MSR_DCD, 133 .signal_pin = UART_MSR_DCD,
133 .signal_pin_change = UART_MSR_DDCD, 134 .signal_pin_change = UART_MSR_DDCD,
134 .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), 135 .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR),
@@ -145,6 +146,7 @@ static struct lirc_serial hardware[] = {
145 }, 146 },
146 147
147 [LIRC_IRDEO] = { 148 [LIRC_IRDEO] = {
149 .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_IRDEO].lock),
148 .signal_pin = UART_MSR_DSR, 150 .signal_pin = UART_MSR_DSR,
149 .signal_pin_change = UART_MSR_DDSR, 151 .signal_pin_change = UART_MSR_DDSR,
150 .on = UART_MCR_OUT2, 152 .on = UART_MCR_OUT2,
@@ -156,6 +158,7 @@ static struct lirc_serial hardware[] = {
156 }, 158 },
157 159
158 [LIRC_IRDEO_REMOTE] = { 160 [LIRC_IRDEO_REMOTE] = {
161 .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_IRDEO_REMOTE].lock),
159 .signal_pin = UART_MSR_DSR, 162 .signal_pin = UART_MSR_DSR,
160 .signal_pin_change = UART_MSR_DDSR, 163 .signal_pin_change = UART_MSR_DDSR,
161 .on = (UART_MCR_RTS | UART_MCR_DTR | UART_MCR_OUT2), 164 .on = (UART_MCR_RTS | UART_MCR_DTR | UART_MCR_OUT2),
@@ -167,6 +170,7 @@ static struct lirc_serial hardware[] = {
167 }, 170 },
168 171
169 [LIRC_ANIMAX] = { 172 [LIRC_ANIMAX] = {
173 .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_ANIMAX].lock),
170 .signal_pin = UART_MSR_DCD, 174 .signal_pin = UART_MSR_DCD,
171 .signal_pin_change = UART_MSR_DDCD, 175 .signal_pin_change = UART_MSR_DDCD,
172 .on = 0, 176 .on = 0,
@@ -177,6 +181,7 @@ static struct lirc_serial hardware[] = {
177 }, 181 },
178 182
179 [LIRC_IGOR] = { 183 [LIRC_IGOR] = {
184 .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_IGOR].lock),
180 .signal_pin = UART_MSR_DSR, 185 .signal_pin = UART_MSR_DSR,
181 .signal_pin_change = UART_MSR_DDSR, 186 .signal_pin_change = UART_MSR_DDSR,
182 .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), 187 .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR),
@@ -201,6 +206,7 @@ static struct lirc_serial hardware[] = {
201 * See also http://www.nslu2-linux.org for this device 206 * See also http://www.nslu2-linux.org for this device
202 */ 207 */
203 [LIRC_NSLU2] = { 208 [LIRC_NSLU2] = {
209 .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_NSLU2].lock),
204 .signal_pin = UART_MSR_CTS, 210 .signal_pin = UART_MSR_CTS,
205 .signal_pin_change = UART_MSR_DCTS, 211 .signal_pin_change = UART_MSR_DCTS,
206 .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), 212 .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR),
diff --git a/drivers/staging/omapdrm/omap_fbdev.c b/drivers/staging/omapdrm/omap_fbdev.c
index 11acd4c35ed2..8c6ed3b0c6f6 100644
--- a/drivers/staging/omapdrm/omap_fbdev.c
+++ b/drivers/staging/omapdrm/omap_fbdev.c
@@ -208,7 +208,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
208 */ 208 */
209 ret = omap_gem_get_paddr(fbdev->bo, &paddr, true); 209 ret = omap_gem_get_paddr(fbdev->bo, &paddr, true);
210 if (ret) { 210 if (ret) {
211 dev_err(dev->dev, "could not map (paddr)!\n"); 211 dev_err(dev->dev,
212 "could not map (paddr)! Skipping framebuffer alloc\n");
212 ret = -ENOMEM; 213 ret = -ENOMEM;
213 goto fail; 214 goto fail;
214 } 215 }
@@ -388,8 +389,11 @@ void omap_fbdev_free(struct drm_device *dev)
388 389
389 fbi = helper->fbdev; 390 fbi = helper->fbdev;
390 391
391 unregister_framebuffer(fbi); 392 /* only cleanup framebuffer if it is present */
392 framebuffer_release(fbi); 393 if (fbi) {
394 unregister_framebuffer(fbi);
395 framebuffer_release(fbi);
396 }
393 397
394 drm_fb_helper_fini(helper); 398 drm_fb_helper_fini(helper);
395 399
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index 9bd18e2d0513..69f616c6964e 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -102,6 +102,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
102 /* - */ 102 /* - */
103 {USB_DEVICE(0x20F4, 0x646B)}, 103 {USB_DEVICE(0x20F4, 0x646B)},
104 {USB_DEVICE(0x083A, 0xC512)}, 104 {USB_DEVICE(0x083A, 0xC512)},
105 {USB_DEVICE(0x25D4, 0x4CA1)},
106 {USB_DEVICE(0x25D4, 0x4CAB)},
105 107
106/* RTL8191SU */ 108/* RTL8191SU */
107 /* Realtek */ 109 /* Realtek */
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index cb99da920068..87901fa74dd7 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -58,7 +58,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
58 struct ft_tport *tport; 58 struct ft_tport *tport;
59 int i; 59 int i;
60 60
61 tport = rcu_dereference(lport->prov[FC_TYPE_FCP]); 61 tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP],
62 lockdep_is_held(&ft_lport_lock));
62 if (tport && tport->tpg) 63 if (tport && tport->tpg)
63 return tport; 64 return tport;
64 65
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 47d061b9ad4d..6e1958a325bd 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -3113,7 +3113,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
3113 3113
3114/** 3114/**
3115 * serial8250_register_8250_port - register a serial port 3115 * serial8250_register_8250_port - register a serial port
3116 * @port: serial port template 3116 * @up: serial port template
3117 * 3117 *
3118 * Configure the serial port specified by the request. If the 3118 * Configure the serial port specified by the request. If the
3119 * port exists and is in use, it is hung up and unregistered 3119 * port exists and is in use, it is hung up and unregistered
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 4ad721fb8405..c17923ec6e95 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -133,6 +133,10 @@ struct pl011_dmatx_data {
133struct uart_amba_port { 133struct uart_amba_port {
134 struct uart_port port; 134 struct uart_port port;
135 struct clk *clk; 135 struct clk *clk;
136 /* Two optional pin states - default & sleep */
137 struct pinctrl *pinctrl;
138 struct pinctrl_state *pins_default;
139 struct pinctrl_state *pins_sleep;
136 const struct vendor_data *vendor; 140 const struct vendor_data *vendor;
137 unsigned int dmacr; /* dma control reg */ 141 unsigned int dmacr; /* dma control reg */
138 unsigned int im; /* interrupt mask */ 142 unsigned int im; /* interrupt mask */
@@ -1312,6 +1316,14 @@ static int pl011_startup(struct uart_port *port)
1312 unsigned int cr; 1316 unsigned int cr;
1313 int retval; 1317 int retval;
1314 1318
1319 /* Optionaly enable pins to be muxed in and configured */
1320 if (!IS_ERR(uap->pins_default)) {
1321 retval = pinctrl_select_state(uap->pinctrl, uap->pins_default);
1322 if (retval)
1323 dev_err(port->dev,
1324 "could not set default pins\n");
1325 }
1326
1315 retval = clk_prepare(uap->clk); 1327 retval = clk_prepare(uap->clk);
1316 if (retval) 1328 if (retval)
1317 goto out; 1329 goto out;
@@ -1420,6 +1432,7 @@ static void pl011_shutdown(struct uart_port *port)
1420{ 1432{
1421 struct uart_amba_port *uap = (struct uart_amba_port *)port; 1433 struct uart_amba_port *uap = (struct uart_amba_port *)port;
1422 unsigned int cr; 1434 unsigned int cr;
1435 int retval;
1423 1436
1424 /* 1437 /*
1425 * disable all interrupts 1438 * disable all interrupts
@@ -1462,6 +1475,14 @@ static void pl011_shutdown(struct uart_port *port)
1462 */ 1475 */
1463 clk_disable(uap->clk); 1476 clk_disable(uap->clk);
1464 clk_unprepare(uap->clk); 1477 clk_unprepare(uap->clk);
1478 /* Optionally let pins go into sleep states */
1479 if (!IS_ERR(uap->pins_sleep)) {
1480 retval = pinctrl_select_state(uap->pinctrl, uap->pins_sleep);
1481 if (retval)
1482 dev_err(port->dev,
1483 "could not set pins to sleep state\n");
1484 }
1485
1465 1486
1466 if (uap->port.dev->platform_data) { 1487 if (uap->port.dev->platform_data) {
1467 struct amba_pl011_data *plat; 1488 struct amba_pl011_data *plat;
@@ -1792,6 +1813,14 @@ static int __init pl011_console_setup(struct console *co, char *options)
1792 if (!uap) 1813 if (!uap)
1793 return -ENODEV; 1814 return -ENODEV;
1794 1815
1816 /* Allow pins to be muxed in and configured */
1817 if (!IS_ERR(uap->pins_default)) {
1818 ret = pinctrl_select_state(uap->pinctrl, uap->pins_default);
1819 if (ret)
1820 dev_err(uap->port.dev,
1821 "could not set default pins\n");
1822 }
1823
1795 ret = clk_prepare(uap->clk); 1824 ret = clk_prepare(uap->clk);
1796 if (ret) 1825 if (ret)
1797 return ret; 1826 return ret;
@@ -1844,7 +1873,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
1844{ 1873{
1845 struct uart_amba_port *uap; 1874 struct uart_amba_port *uap;
1846 struct vendor_data *vendor = id->data; 1875 struct vendor_data *vendor = id->data;
1847 struct pinctrl *pinctrl;
1848 void __iomem *base; 1876 void __iomem *base;
1849 int i, ret; 1877 int i, ret;
1850 1878
@@ -1869,11 +1897,20 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
1869 goto free; 1897 goto free;
1870 } 1898 }
1871 1899
1872 pinctrl = devm_pinctrl_get_select_default(&dev->dev); 1900 uap->pinctrl = devm_pinctrl_get(&dev->dev);
1873 if (IS_ERR(pinctrl)) { 1901 if (IS_ERR(uap->pinctrl)) {
1874 ret = PTR_ERR(pinctrl); 1902 ret = PTR_ERR(uap->pinctrl);
1875 goto unmap; 1903 goto unmap;
1876 } 1904 }
1905 uap->pins_default = pinctrl_lookup_state(uap->pinctrl,
1906 PINCTRL_STATE_DEFAULT);
1907 if (IS_ERR(uap->pins_default))
1908 dev_err(&dev->dev, "could not get default pinstate\n");
1909
1910 uap->pins_sleep = pinctrl_lookup_state(uap->pinctrl,
1911 PINCTRL_STATE_SLEEP);
1912 if (IS_ERR(uap->pins_sleep))
1913 dev_dbg(&dev->dev, "could not get sleep pinstate\n");
1877 1914
1878 uap->clk = clk_get(&dev->dev, NULL); 1915 uap->clk = clk_get(&dev->dev, NULL);
1879 if (IS_ERR(uap->clk)) { 1916 if (IS_ERR(uap->clk)) {
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index 34bd345da775..6ae2a58d62f2 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -466,7 +466,7 @@ static void serial_txx9_break_ctl(struct uart_port *port, int break_state)
466 spin_unlock_irqrestore(&up->port.lock, flags); 466 spin_unlock_irqrestore(&up->port.lock, flags);
467} 467}
468 468
469#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || (CONFIG_CONSOLE_POLL) 469#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
470/* 470/*
471 * Wait for transmitter & holding register to empty 471 * Wait for transmitter & holding register to empty
472 */ 472 */
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index c691eea51537..f5ed3d75fa5a 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -46,7 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/
46obj-$(CONFIG_USB_SERIAL) += serial/ 46obj-$(CONFIG_USB_SERIAL) += serial/
47 47
48obj-$(CONFIG_USB) += misc/ 48obj-$(CONFIG_USB) += misc/
49obj-$(CONFIG_USB) += phy/ 49obj-$(CONFIG_USB_COMMON) += phy/
50obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ 50obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
51 51
52obj-$(CONFIG_USB_ATM) += atm/ 52obj-$(CONFIG_USB_ATM) += atm/
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3df1a1973b05..ec70df7aba17 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1091,7 +1091,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
1091 if (r == req) { 1091 if (r == req) {
1092 /* wait until it is processed */ 1092 /* wait until it is processed */
1093 dwc3_stop_active_transfer(dwc, dep->number); 1093 dwc3_stop_active_transfer(dwc, dep->number);
1094 goto out0; 1094 goto out1;
1095 } 1095 }
1096 dev_err(dwc->dev, "request %p was not queued to %s\n", 1096 dev_err(dwc->dev, "request %p was not queued to %s\n",
1097 request, ep->name); 1097 request, ep->name);
@@ -1099,6 +1099,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
1099 goto out0; 1099 goto out0;
1100 } 1100 }
1101 1101
1102out1:
1102 /* giveback the request */ 1103 /* giveback the request */
1103 dwc3_gadget_giveback(dep, req, -ECONNRESET); 1104 dwc3_gadget_giveback(dep, req, -ECONNRESET);
1104 1105
diff --git a/drivers/usb/gadget/fsl_qe_udc.h b/drivers/usb/gadget/fsl_qe_udc.h
index 4c07ca9cebf3..7026919fc901 100644
--- a/drivers/usb/gadget/fsl_qe_udc.h
+++ b/drivers/usb/gadget/fsl_qe_udc.h
@@ -153,10 +153,10 @@ struct usb_ep_para{
153#define USB_BUSMODE_DTB 0x02 153#define USB_BUSMODE_DTB 0x02
154 154
155/* Endpoint basic handle */ 155/* Endpoint basic handle */
156#define ep_index(EP) ((EP)->desc->bEndpointAddress & 0xF) 156#define ep_index(EP) ((EP)->ep.desc->bEndpointAddress & 0xF)
157#define ep_maxpacket(EP) ((EP)->ep.maxpacket) 157#define ep_maxpacket(EP) ((EP)->ep.maxpacket)
158#define ep_is_in(EP) ((ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ 158#define ep_is_in(EP) ((ep_index(EP) == 0) ? (EP->udc->ep0_dir == \
159 USB_DIR_IN) : ((EP)->desc->bEndpointAddress \ 159 USB_DIR_IN) : ((EP)->ep.desc->bEndpointAddress \
160 & USB_DIR_IN) == USB_DIR_IN) 160 & USB_DIR_IN) == USB_DIR_IN)
161 161
162/* ep0 transfer state */ 162/* ep0 transfer state */
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 262acfd53e32..2ab0388d93eb 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -61,6 +61,7 @@
61#include <mach/irqs.h> 61#include <mach/irqs.h>
62#include <mach/board.h> 62#include <mach/board.h>
63#ifdef CONFIG_USB_GADGET_DEBUG_FILES 63#ifdef CONFIG_USB_GADGET_DEBUG_FILES
64#include <linux/debugfs.h>
64#include <linux/seq_file.h> 65#include <linux/seq_file.h>
65#endif 66#endif
66 67
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index ef8d744800ac..e090c799d87b 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -375,11 +375,21 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb,
375 */ 375 */
376 if (list_empty(&qh->hep->urb_list)) { 376 if (list_empty(&qh->hep->urb_list)) {
377 struct list_head *head; 377 struct list_head *head;
378 struct dma_controller *dma = musb->dma_controller;
378 379
379 if (is_in) 380 if (is_in) {
380 ep->rx_reinit = 1; 381 ep->rx_reinit = 1;
381 else 382 if (ep->rx_channel) {
383 dma->channel_release(ep->rx_channel);
384 ep->rx_channel = NULL;
385 }
386 } else {
382 ep->tx_reinit = 1; 387 ep->tx_reinit = 1;
388 if (ep->tx_channel) {
389 dma->channel_release(ep->tx_channel);
390 ep->tx_channel = NULL;
391 }
392 }
383 393
384 /* Clobber old pointers to this qh */ 394 /* Clobber old pointers to this qh */
385 musb_ep_set_qh(ep, is_in, NULL); 395 musb_ep_set_qh(ep, is_in, NULL);
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index d2a9a8e691b9..0eabb049b6a9 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -305,9 +305,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
305 305
306 regulator_enable(twl->usb3v3); 306 regulator_enable(twl->usb3v3);
307 twl->asleep = 1; 307 twl->asleep = 1;
308 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1); 308 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_CLR);
309 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 309 twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET);
310 0x10);
311 status = USB_EVENT_ID; 310 status = USB_EVENT_ID;
312 otg->default_a = true; 311 otg->default_a = true;
313 twl->phy.state = OTG_STATE_A_IDLE; 312 twl->phy.state = OTG_STATE_A_IDLE;
@@ -316,12 +315,10 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl)
316 atomic_notifier_call_chain(&twl->phy.notifier, status, 315 atomic_notifier_call_chain(&twl->phy.notifier, status,
317 otg->gadget); 316 otg->gadget);
318 } else { 317 } else {
319 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 318 twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR);
320 0x10); 319 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
321 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
322 0x1);
323 } 320 }
324 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_LATCH_CLR, status); 321 twl6030_writeb(twl, TWL_MODULE_USB, status, USB_ID_INT_LATCH_CLR);
325 322
326 return IRQ_HANDLED; 323 return IRQ_HANDLED;
327} 324}
@@ -343,7 +340,7 @@ static int twl6030_enable_irq(struct usb_phy *x)
343{ 340{
344 struct twl6030_usb *twl = phy_to_twl(x); 341 struct twl6030_usb *twl = phy_to_twl(x);
345 342
346 twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 0x1); 343 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
347 twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); 344 twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C);
348 twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); 345 twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C);
349 346
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 3cfabcba7447..e7cf84f0751a 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -2,11 +2,11 @@
2# Physical Layer USB driver configuration 2# Physical Layer USB driver configuration
3# 3#
4comment "USB Physical Layer drivers" 4comment "USB Physical Layer drivers"
5 depends on USB 5 depends on USB || USB_GADGET
6 6
7config USB_ISP1301 7config USB_ISP1301
8 tristate "NXP ISP1301 USB transceiver support" 8 tristate "NXP ISP1301 USB transceiver support"
9 depends on USB 9 depends on USB || USB_GADGET
10 depends on I2C 10 depends on I2C
11 help 11 help
12 Say Y here to add support for the NXP ISP1301 USB transceiver driver. 12 Say Y here to add support for the NXP ISP1301 USB transceiver driver.
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 73d25cd8cba5..1e71079ce33b 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -93,6 +93,7 @@ static const struct usb_device_id id_table[] = {
93 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ 93 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
94 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ 94 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
95 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 95 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
96 { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */
96 { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ 97 { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */
97 { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ 98 { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
98 { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ 99 { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
@@ -134,7 +135,13 @@ static const struct usb_device_id id_table[] = {
134 { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ 135 { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */
135 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ 136 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
136 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ 137 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
138 { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
139 { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */
137 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ 140 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
141 { USB_DEVICE(0x166A, 0x0304) }, /* Clipsal 5000CT2 C-Bus Black and White Touchscreen */
142 { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */
143 { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */
144 { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */
138 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 145 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
139 { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ 146 { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */
140 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ 147 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
@@ -146,7 +153,11 @@ static const struct usb_device_id id_table[] = {
146 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ 153 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
147 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 154 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
148 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ 155 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
156 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
157 { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
149 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ 158 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
159 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
160 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
150 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 161 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
151 { } /* Terminating Entry */ 162 { } /* Terminating Entry */
152}; 163};
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e668a2460bd4..adf8ce72be50 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -236,6 +236,7 @@ static void option_instat_callback(struct urb *urb);
236#define NOVATELWIRELESS_PRODUCT_G1 0xA001 236#define NOVATELWIRELESS_PRODUCT_G1 0xA001
237#define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 237#define NOVATELWIRELESS_PRODUCT_G1_M 0xA002
238#define NOVATELWIRELESS_PRODUCT_G2 0xA010 238#define NOVATELWIRELESS_PRODUCT_G2 0xA010
239#define NOVATELWIRELESS_PRODUCT_MC551 0xB001
239 240
240/* AMOI PRODUCTS */ 241/* AMOI PRODUCTS */
241#define AMOI_VENDOR_ID 0x1614 242#define AMOI_VENDOR_ID 0x1614
@@ -497,6 +498,10 @@ static void option_instat_callback(struct urb *urb);
497/* MediaTek products */ 498/* MediaTek products */
498#define MEDIATEK_VENDOR_ID 0x0e8d 499#define MEDIATEK_VENDOR_ID 0x0e8d
499 500
501/* Cellient products */
502#define CELLIENT_VENDOR_ID 0x2692
503#define CELLIENT_PRODUCT_MEN200 0x9005
504
500/* some devices interfaces need special handling due to a number of reasons */ 505/* some devices interfaces need special handling due to a number of reasons */
501enum option_blacklist_reason { 506enum option_blacklist_reason {
502 OPTION_BLACKLIST_NONE = 0, 507 OPTION_BLACKLIST_NONE = 0,
@@ -734,6 +739,8 @@ static const struct usb_device_id option_ids[] = {
734 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) }, 739 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) },
735 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) }, 740 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) },
736 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, 741 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) },
742 /* Novatel Ovation MC551 a.k.a. Verizon USB551L */
743 { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
737 744
738 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, 745 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
739 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, 746 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
@@ -1233,6 +1240,7 @@ static const struct usb_device_id option_ids[] = {
1233 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, 1240 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) },
1234 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, 1241 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) },
1235 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ 1242 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */
1243 { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
1236 { } /* Terminating entry */ 1244 { } /* Terminating entry */
1237}; 1245};
1238MODULE_DEVICE_TABLE(usb, option_ids); 1246MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index a324a5d21e99..11418da9bc09 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -202,6 +202,12 @@ static int slave_configure(struct scsi_device *sdev)
202 if (us->fflags & US_FL_NO_READ_CAPACITY_16) 202 if (us->fflags & US_FL_NO_READ_CAPACITY_16)
203 sdev->no_read_capacity_16 = 1; 203 sdev->no_read_capacity_16 = 1;
204 204
205 /*
206 * Many devices do not respond properly to READ_CAPACITY_16.
207 * Tell the SCSI layer to try READ_CAPACITY_10 first.
208 */
209 sdev->try_rc_10_first = 1;
210
205 /* assume SPC3 or latter devices support sense size > 18 */ 211 /* assume SPC3 or latter devices support sense size > 18 */
206 if (sdev->scsi_level > SCSI_SPC_2) 212 if (sdev->scsi_level > SCSI_SPC_2)
207 us->fflags |= US_FL_SANE_SENSE; 213 us->fflags |= US_FL_SANE_SENSE;
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index caf22bf5f822..1719886bb9be 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1107,13 +1107,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999,
1107 USB_SC_RBC, USB_PR_BULK, NULL, 1107 USB_SC_RBC, USB_PR_BULK, NULL,
1108 0 ), 1108 0 ),
1109 1109
1110/* Feiya QDI U2 DISK, reported by Hans de Goede <hdegoede@redhat.com> */
1111UNUSUAL_DEV( 0x090c, 0x1000, 0x0000, 0xffff,
1112 "Feiya",
1113 "QDI U2 DISK",
1114 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1115 US_FL_NO_READ_CAPACITY_16 ),
1116
1117/* aeb */ 1110/* aeb */
1118UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, 1111UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
1119 "Feiya", 1112 "Feiya",
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 94dbd25caa30..112156f68afb 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -191,7 +191,9 @@ static int vhost_worker(void *data)
191 struct vhost_dev *dev = data; 191 struct vhost_dev *dev = data;
192 struct vhost_work *work = NULL; 192 struct vhost_work *work = NULL;
193 unsigned uninitialized_var(seq); 193 unsigned uninitialized_var(seq);
194 mm_segment_t oldfs = get_fs();
194 195
196 set_fs(USER_DS);
195 use_mm(dev->mm); 197 use_mm(dev->mm);
196 198
197 for (;;) { 199 for (;;) {
@@ -229,6 +231,7 @@ static int vhost_worker(void *data)
229 231
230 } 232 }
231 unuse_mm(dev->mm); 233 unuse_mm(dev->mm);
234 set_fs(oldfs);
232 return 0; 235 return 0;
233} 236}
234 237
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 2b763815aeec..1eff743ec497 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -146,7 +146,7 @@ struct cmn_registers {
146} __attribute__((packed)); 146} __attribute__((packed));
147 147
148static unsigned int hpwdt_nmi_decoding; 148static unsigned int hpwdt_nmi_decoding;
149static unsigned int allow_kdump; 149static unsigned int allow_kdump = 1;
150static unsigned int is_icru; 150static unsigned int is_icru;
151static DEFINE_SPINLOCK(rom_lock); 151static DEFINE_SPINLOCK(rom_lock);
152static void *cru_rom_addr; 152static void *cru_rom_addr;
@@ -756,6 +756,8 @@ error:
756static void hpwdt_exit_nmi_decoding(void) 756static void hpwdt_exit_nmi_decoding(void)
757{ 757{
758 unregister_nmi_handler(NMI_UNKNOWN, "hpwdt"); 758 unregister_nmi_handler(NMI_UNKNOWN, "hpwdt");
759 unregister_nmi_handler(NMI_SERR, "hpwdt");
760 unregister_nmi_handler(NMI_IO_CHECK, "hpwdt");
759 if (cru_rom_addr) 761 if (cru_rom_addr)
760 iounmap(cru_rom_addr); 762 iounmap(cru_rom_addr);
761} 763}
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index bc47e9012f37..9c2c27c3b424 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -699,3 +699,4 @@ MODULE_DESCRIPTION("Intel TCO WatchDog Timer Driver");
699MODULE_VERSION(DRV_VERSION); 699MODULE_VERSION(DRV_VERSION);
700MODULE_LICENSE("GPL"); 700MODULE_LICENSE("GPL");
701MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 701MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
702MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index afcd13676542..e4841c36798b 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -4,7 +4,7 @@
4 * Watchdog driver for ARM SP805 watchdog module 4 * Watchdog driver for ARM SP805 watchdog module
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2 or later. This program is licensed "as is" without any 10 * License version 2 or later. This program is licensed "as is" without any
@@ -331,6 +331,6 @@ static struct amba_driver sp805_wdt_driver = {
331 331
332module_amba_driver(sp805_wdt_driver); 332module_amba_driver(sp805_wdt_driver);
333 333
334MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); 334MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
335MODULE_DESCRIPTION("ARM SP805 Watchdog Driver"); 335MODULE_DESCRIPTION("ARM SP805 Watchdog Driver");
336MODULE_LICENSE("GPL"); 336MODULE_LICENSE("GPL");
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 672d169bf1da..ef8edecfc526 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -349,7 +349,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
349 sizeof(struct watchdog_info)) ? -EFAULT : 0; 349 sizeof(struct watchdog_info)) ? -EFAULT : 0;
350 case WDIOC_GETSTATUS: 350 case WDIOC_GETSTATUS:
351 err = watchdog_get_status(wdd, &val); 351 err = watchdog_get_status(wdd, &val);
352 if (err) 352 if (err == -ENODEV)
353 return err; 353 return err;
354 return put_user(val, p); 354 return put_user(val, p);
355 case WDIOC_GETBOOTSTATUS: 355 case WDIOC_GETBOOTSTATUS:
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 8f7d1237b7a0..a383c18e74e8 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -179,61 +179,74 @@ static int __add_prelim_ref(struct list_head *head, u64 root_id,
179 179
180static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, 180static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
181 struct ulist *parents, int level, 181 struct ulist *parents, int level,
182 struct btrfs_key *key, u64 time_seq, 182 struct btrfs_key *key_for_search, u64 time_seq,
183 u64 wanted_disk_byte, 183 u64 wanted_disk_byte,
184 const u64 *extent_item_pos) 184 const u64 *extent_item_pos)
185{ 185{
186 int ret; 186 int ret = 0;
187 int slot = path->slots[level]; 187 int slot;
188 struct extent_buffer *eb = path->nodes[level]; 188 struct extent_buffer *eb;
189 struct btrfs_key key;
189 struct btrfs_file_extent_item *fi; 190 struct btrfs_file_extent_item *fi;
190 struct extent_inode_elem *eie = NULL; 191 struct extent_inode_elem *eie = NULL;
191 u64 disk_byte; 192 u64 disk_byte;
192 u64 wanted_objectid = key->objectid;
193 193
194add_parent: 194 if (level != 0) {
195 if (level == 0 && extent_item_pos) { 195 eb = path->nodes[level];
196 fi = btrfs_item_ptr(eb, slot, struct btrfs_file_extent_item); 196 ret = ulist_add(parents, eb->start, 0, GFP_NOFS);
197 ret = check_extent_in_eb(key, eb, fi, *extent_item_pos, &eie);
198 if (ret < 0) 197 if (ret < 0)
199 return ret; 198 return ret;
200 }
201 ret = ulist_add(parents, eb->start, (unsigned long)eie, GFP_NOFS);
202 if (ret < 0)
203 return ret;
204
205 if (level != 0)
206 return 0; 199 return 0;
200 }
207 201
208 /* 202 /*
209 * if the current leaf is full with EXTENT_DATA items, we must 203 * We normally enter this function with the path already pointing to
210 * check the next one if that holds a reference as well. 204 * the first item to check. But sometimes, we may enter it with
211 * ref->count cannot be used to skip this check. 205 * slot==nritems. In that case, go to the next leaf before we continue.
212 * repeat this until we don't find any additional EXTENT_DATA items.
213 */ 206 */
214 while (1) { 207 if (path->slots[0] >= btrfs_header_nritems(path->nodes[0]))
215 eie = NULL;
216 ret = btrfs_next_old_leaf(root, path, time_seq); 208 ret = btrfs_next_old_leaf(root, path, time_seq);
217 if (ret < 0)
218 return ret;
219 if (ret)
220 return 0;
221 209
210 while (!ret) {
222 eb = path->nodes[0]; 211 eb = path->nodes[0];
223 for (slot = 0; slot < btrfs_header_nritems(eb); ++slot) { 212 slot = path->slots[0];
224 btrfs_item_key_to_cpu(eb, key, slot); 213
225 if (key->objectid != wanted_objectid || 214 btrfs_item_key_to_cpu(eb, &key, slot);
226 key->type != BTRFS_EXTENT_DATA_KEY) 215
227 return 0; 216 if (key.objectid != key_for_search->objectid ||
228 fi = btrfs_item_ptr(eb, slot, 217 key.type != BTRFS_EXTENT_DATA_KEY)
229 struct btrfs_file_extent_item); 218 break;
230 disk_byte = btrfs_file_extent_disk_bytenr(eb, fi); 219
231 if (disk_byte == wanted_disk_byte) 220 fi = btrfs_item_ptr(eb, slot, struct btrfs_file_extent_item);
232 goto add_parent; 221 disk_byte = btrfs_file_extent_disk_bytenr(eb, fi);
222
223 if (disk_byte == wanted_disk_byte) {
224 eie = NULL;
225 if (extent_item_pos) {
226 ret = check_extent_in_eb(&key, eb, fi,
227 *extent_item_pos,
228 &eie);
229 if (ret < 0)
230 break;
231 }
232 if (!ret) {
233 ret = ulist_add(parents, eb->start,
234 (unsigned long)eie, GFP_NOFS);
235 if (ret < 0)
236 break;
237 if (!extent_item_pos) {
238 ret = btrfs_next_old_leaf(root, path,
239 time_seq);
240 continue;
241 }
242 }
233 } 243 }
244 ret = btrfs_next_old_item(root, path, time_seq);
234 } 245 }
235 246
236 return 0; 247 if (ret > 0)
248 ret = 0;
249 return ret;
237} 250}
238 251
239/* 252/*
@@ -250,7 +263,6 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
250 struct btrfs_path *path; 263 struct btrfs_path *path;
251 struct btrfs_root *root; 264 struct btrfs_root *root;
252 struct btrfs_key root_key; 265 struct btrfs_key root_key;
253 struct btrfs_key key = {0};
254 struct extent_buffer *eb; 266 struct extent_buffer *eb;
255 int ret = 0; 267 int ret = 0;
256 int root_level; 268 int root_level;
@@ -289,17 +301,19 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
289 goto out; 301 goto out;
290 302
291 eb = path->nodes[level]; 303 eb = path->nodes[level];
292 if (!eb) { 304 while (!eb) {
293 WARN_ON(1); 305 if (!level) {
294 ret = 1; 306 WARN_ON(1);
295 goto out; 307 ret = 1;
308 goto out;
309 }
310 level--;
311 eb = path->nodes[level];
296 } 312 }
297 313
298 if (level == 0) 314 ret = add_all_parents(root, path, parents, level, &ref->key_for_search,
299 btrfs_item_key_to_cpu(eb, &key, path->slots[0]); 315 time_seq, ref->wanted_disk_byte,
300 316 extent_item_pos);
301 ret = add_all_parents(root, path, parents, level, &key, time_seq,
302 ref->wanted_disk_byte, extent_item_pos);
303out: 317out:
304 btrfs_free_path(path); 318 btrfs_free_path(path);
305 return ret; 319 return ret;
@@ -825,6 +839,7 @@ again:
825 } 839 }
826 ret = __add_delayed_refs(head, delayed_ref_seq, 840 ret = __add_delayed_refs(head, delayed_ref_seq,
827 &prefs_delayed); 841 &prefs_delayed);
842 mutex_unlock(&head->mutex);
828 if (ret) { 843 if (ret) {
829 spin_unlock(&delayed_refs->lock); 844 spin_unlock(&delayed_refs->lock);
830 goto out; 845 goto out;
@@ -918,8 +933,6 @@ again:
918 } 933 }
919 934
920out: 935out:
921 if (head)
922 mutex_unlock(&head->mutex);
923 btrfs_free_path(path); 936 btrfs_free_path(path);
924 while (!list_empty(&prefs)) { 937 while (!list_empty(&prefs)) {
925 ref = list_first_entry(&prefs, struct __prelim_ref, list); 938 ref = list_first_entry(&prefs, struct __prelim_ref, list);
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 15cbc2bf4ff0..8206b3900587 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1024,11 +1024,18 @@ __tree_mod_log_oldest_root(struct btrfs_fs_info *fs_info,
1024 if (!looped && !tm) 1024 if (!looped && !tm)
1025 return 0; 1025 return 0;
1026 /* 1026 /*
1027 * we must have key remove operations in the log before the 1027 * if there are no tree operation for the oldest root, we simply
1028 * replace operation. 1028 * return it. this should only happen if that (old) root is at
1029 * level 0.
1029 */ 1030 */
1030 BUG_ON(!tm); 1031 if (!tm)
1032 break;
1031 1033
1034 /*
1035 * if there's an operation that's not a root replacement, we
1036 * found the oldest version of our root. normally, we'll find a
1037 * MOD_LOG_KEY_REMOVE_WHILE_FREEING operation here.
1038 */
1032 if (tm->op != MOD_LOG_ROOT_REPLACE) 1039 if (tm->op != MOD_LOG_ROOT_REPLACE)
1033 break; 1040 break;
1034 1041
@@ -1087,11 +1094,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
1087 tm->generation); 1094 tm->generation);
1088 break; 1095 break;
1089 case MOD_LOG_KEY_ADD: 1096 case MOD_LOG_KEY_ADD:
1090 if (tm->slot != n - 1) { 1097 /* if a move operation is needed it's in the log */
1091 o_dst = btrfs_node_key_ptr_offset(tm->slot);
1092 o_src = btrfs_node_key_ptr_offset(tm->slot + 1);
1093 memmove_extent_buffer(eb, o_dst, o_src, p_size);
1094 }
1095 n--; 1098 n--;
1096 break; 1099 break;
1097 case MOD_LOG_MOVE_KEYS: 1100 case MOD_LOG_MOVE_KEYS:
@@ -1192,16 +1195,8 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
1192 } 1195 }
1193 1196
1194 tm = tree_mod_log_search(root->fs_info, logical, time_seq); 1197 tm = tree_mod_log_search(root->fs_info, logical, time_seq);
1195 /*
1196 * there was an item in the log when __tree_mod_log_oldest_root
1197 * returned. this one must not go away, because the time_seq passed to
1198 * us must be blocking its removal.
1199 */
1200 BUG_ON(!tm);
1201
1202 if (old_root) 1198 if (old_root)
1203 eb = alloc_dummy_extent_buffer(tm->index << PAGE_CACHE_SHIFT, 1199 eb = alloc_dummy_extent_buffer(logical, root->nodesize);
1204 root->nodesize);
1205 else 1200 else
1206 eb = btrfs_clone_extent_buffer(root->node); 1201 eb = btrfs_clone_extent_buffer(root->node);
1207 btrfs_tree_read_unlock(root->node); 1202 btrfs_tree_read_unlock(root->node);
@@ -1216,7 +1211,10 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
1216 btrfs_set_header_level(eb, old_root->level); 1211 btrfs_set_header_level(eb, old_root->level);
1217 btrfs_set_header_generation(eb, old_generation); 1212 btrfs_set_header_generation(eb, old_generation);
1218 } 1213 }
1219 __tree_mod_log_rewind(eb, time_seq, tm); 1214 if (tm)
1215 __tree_mod_log_rewind(eb, time_seq, tm);
1216 else
1217 WARN_ON(btrfs_header_level(eb) != 0);
1220 extent_buffer_get(eb); 1218 extent_buffer_get(eb);
1221 1219
1222 return eb; 1220 return eb;
@@ -2995,7 +2993,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
2995static void insert_ptr(struct btrfs_trans_handle *trans, 2993static void insert_ptr(struct btrfs_trans_handle *trans,
2996 struct btrfs_root *root, struct btrfs_path *path, 2994 struct btrfs_root *root, struct btrfs_path *path,
2997 struct btrfs_disk_key *key, u64 bytenr, 2995 struct btrfs_disk_key *key, u64 bytenr,
2998 int slot, int level, int tree_mod_log) 2996 int slot, int level)
2999{ 2997{
3000 struct extent_buffer *lower; 2998 struct extent_buffer *lower;
3001 int nritems; 2999 int nritems;
@@ -3008,7 +3006,7 @@ static void insert_ptr(struct btrfs_trans_handle *trans,
3008 BUG_ON(slot > nritems); 3006 BUG_ON(slot > nritems);
3009 BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(root)); 3007 BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(root));
3010 if (slot != nritems) { 3008 if (slot != nritems) {
3011 if (tree_mod_log && level) 3009 if (level)
3012 tree_mod_log_eb_move(root->fs_info, lower, slot + 1, 3010 tree_mod_log_eb_move(root->fs_info, lower, slot + 1,
3013 slot, nritems - slot); 3011 slot, nritems - slot);
3014 memmove_extent_buffer(lower, 3012 memmove_extent_buffer(lower,
@@ -3016,7 +3014,7 @@ static void insert_ptr(struct btrfs_trans_handle *trans,
3016 btrfs_node_key_ptr_offset(slot), 3014 btrfs_node_key_ptr_offset(slot),
3017 (nritems - slot) * sizeof(struct btrfs_key_ptr)); 3015 (nritems - slot) * sizeof(struct btrfs_key_ptr));
3018 } 3016 }
3019 if (tree_mod_log && level) { 3017 if (level) {
3020 ret = tree_mod_log_insert_key(root->fs_info, lower, slot, 3018 ret = tree_mod_log_insert_key(root->fs_info, lower, slot,
3021 MOD_LOG_KEY_ADD); 3019 MOD_LOG_KEY_ADD);
3022 BUG_ON(ret < 0); 3020 BUG_ON(ret < 0);
@@ -3104,7 +3102,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
3104 btrfs_mark_buffer_dirty(split); 3102 btrfs_mark_buffer_dirty(split);
3105 3103
3106 insert_ptr(trans, root, path, &disk_key, split->start, 3104 insert_ptr(trans, root, path, &disk_key, split->start,
3107 path->slots[level + 1] + 1, level + 1, 1); 3105 path->slots[level + 1] + 1, level + 1);
3108 3106
3109 if (path->slots[level] >= mid) { 3107 if (path->slots[level] >= mid) {
3110 path->slots[level] -= mid; 3108 path->slots[level] -= mid;
@@ -3641,7 +3639,7 @@ static noinline void copy_for_split(struct btrfs_trans_handle *trans,
3641 btrfs_set_header_nritems(l, mid); 3639 btrfs_set_header_nritems(l, mid);
3642 btrfs_item_key(right, &disk_key, 0); 3640 btrfs_item_key(right, &disk_key, 0);
3643 insert_ptr(trans, root, path, &disk_key, right->start, 3641 insert_ptr(trans, root, path, &disk_key, right->start,
3644 path->slots[1] + 1, 1, 0); 3642 path->slots[1] + 1, 1);
3645 3643
3646 btrfs_mark_buffer_dirty(right); 3644 btrfs_mark_buffer_dirty(right);
3647 btrfs_mark_buffer_dirty(l); 3645 btrfs_mark_buffer_dirty(l);
@@ -3848,7 +3846,7 @@ again:
3848 if (mid <= slot) { 3846 if (mid <= slot) {
3849 btrfs_set_header_nritems(right, 0); 3847 btrfs_set_header_nritems(right, 0);
3850 insert_ptr(trans, root, path, &disk_key, right->start, 3848 insert_ptr(trans, root, path, &disk_key, right->start,
3851 path->slots[1] + 1, 1, 0); 3849 path->slots[1] + 1, 1);
3852 btrfs_tree_unlock(path->nodes[0]); 3850 btrfs_tree_unlock(path->nodes[0]);
3853 free_extent_buffer(path->nodes[0]); 3851 free_extent_buffer(path->nodes[0]);
3854 path->nodes[0] = right; 3852 path->nodes[0] = right;
@@ -3857,7 +3855,7 @@ again:
3857 } else { 3855 } else {
3858 btrfs_set_header_nritems(right, 0); 3856 btrfs_set_header_nritems(right, 0);
3859 insert_ptr(trans, root, path, &disk_key, right->start, 3857 insert_ptr(trans, root, path, &disk_key, right->start,
3860 path->slots[1], 1, 0); 3858 path->slots[1], 1);
3861 btrfs_tree_unlock(path->nodes[0]); 3859 btrfs_tree_unlock(path->nodes[0]);
3862 free_extent_buffer(path->nodes[0]); 3860 free_extent_buffer(path->nodes[0]);
3863 path->nodes[0] = right; 3861 path->nodes[0] = right;
@@ -5121,6 +5119,18 @@ again:
5121 5119
5122 if (!path->skip_locking) { 5120 if (!path->skip_locking) {
5123 ret = btrfs_try_tree_read_lock(next); 5121 ret = btrfs_try_tree_read_lock(next);
5122 if (!ret && time_seq) {
5123 /*
5124 * If we don't get the lock, we may be racing
5125 * with push_leaf_left, holding that lock while
5126 * itself waiting for the leaf we've currently
5127 * locked. To solve this situation, we give up
5128 * on our lock and cycle.
5129 */
5130 btrfs_release_path(path);
5131 cond_resched();
5132 goto again;
5133 }
5124 if (!ret) { 5134 if (!ret) {
5125 btrfs_set_path_blocking(path); 5135 btrfs_set_path_blocking(path);
5126 btrfs_tree_read_lock(next); 5136 btrfs_tree_read_lock(next);
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 8b73b2d4deb7..fa5c45b39075 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2755,13 +2755,18 @@ static inline int btrfs_insert_empty_item(struct btrfs_trans_handle *trans,
2755int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path); 2755int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
2756int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path, 2756int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
2757 u64 time_seq); 2757 u64 time_seq);
2758static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p) 2758static inline int btrfs_next_old_item(struct btrfs_root *root,
2759 struct btrfs_path *p, u64 time_seq)
2759{ 2760{
2760 ++p->slots[0]; 2761 ++p->slots[0];
2761 if (p->slots[0] >= btrfs_header_nritems(p->nodes[0])) 2762 if (p->slots[0] >= btrfs_header_nritems(p->nodes[0]))
2762 return btrfs_next_leaf(root, p); 2763 return btrfs_next_old_leaf(root, p, time_seq);
2763 return 0; 2764 return 0;
2764} 2765}
2766static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p)
2767{
2768 return btrfs_next_old_item(root, p, 0);
2769}
2765int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); 2770int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
2766int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); 2771int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf);
2767int __must_check btrfs_drop_snapshot(struct btrfs_root *root, 2772int __must_check btrfs_drop_snapshot(struct btrfs_root *root,
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e1890b1d3075..2936ca49b3b4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2354,12 +2354,17 @@ retry_root_backup:
2354 BTRFS_CSUM_TREE_OBJECTID, csum_root); 2354 BTRFS_CSUM_TREE_OBJECTID, csum_root);
2355 if (ret) 2355 if (ret)
2356 goto recovery_tree_root; 2356 goto recovery_tree_root;
2357
2358 csum_root->track_dirty = 1; 2357 csum_root->track_dirty = 1;
2359 2358
2360 fs_info->generation = generation; 2359 fs_info->generation = generation;
2361 fs_info->last_trans_committed = generation; 2360 fs_info->last_trans_committed = generation;
2362 2361
2362 ret = btrfs_recover_balance(fs_info);
2363 if (ret) {
2364 printk(KERN_WARNING "btrfs: failed to recover balance\n");
2365 goto fail_block_groups;
2366 }
2367
2363 ret = btrfs_init_dev_stats(fs_info); 2368 ret = btrfs_init_dev_stats(fs_info);
2364 if (ret) { 2369 if (ret) {
2365 printk(KERN_ERR "btrfs: failed to init dev_stats: %d\n", 2370 printk(KERN_ERR "btrfs: failed to init dev_stats: %d\n",
@@ -2485,20 +2490,23 @@ retry_root_backup:
2485 goto fail_trans_kthread; 2490 goto fail_trans_kthread;
2486 } 2491 }
2487 2492
2488 if (!(sb->s_flags & MS_RDONLY)) { 2493 if (sb->s_flags & MS_RDONLY)
2489 down_read(&fs_info->cleanup_work_sem); 2494 return 0;
2490 err = btrfs_orphan_cleanup(fs_info->fs_root);
2491 if (!err)
2492 err = btrfs_orphan_cleanup(fs_info->tree_root);
2493 up_read(&fs_info->cleanup_work_sem);
2494 2495
2495 if (!err) 2496 down_read(&fs_info->cleanup_work_sem);
2496 err = btrfs_recover_balance(fs_info->tree_root); 2497 if ((ret = btrfs_orphan_cleanup(fs_info->fs_root)) ||
2498 (ret = btrfs_orphan_cleanup(fs_info->tree_root))) {
2499 up_read(&fs_info->cleanup_work_sem);
2500 close_ctree(tree_root);
2501 return ret;
2502 }
2503 up_read(&fs_info->cleanup_work_sem);
2497 2504
2498 if (err) { 2505 ret = btrfs_resume_balance_async(fs_info);
2499 close_ctree(tree_root); 2506 if (ret) {
2500 return err; 2507 printk(KERN_WARNING "btrfs: failed to resume balance\n");
2501 } 2508 close_ctree(tree_root);
2509 return ret;
2502 } 2510 }
2503 2511
2504 return 0; 2512 return 0;
@@ -3426,6 +3434,7 @@ int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
3426 mutex_unlock(&head->mutex); 3434 mutex_unlock(&head->mutex);
3427 btrfs_put_delayed_ref(ref); 3435 btrfs_put_delayed_ref(ref);
3428 3436
3437 spin_lock(&delayed_refs->lock);
3429 continue; 3438 continue;
3430 } 3439 }
3431 3440
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 4b5a1e1bdefb..6e1d36702ff7 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2347,12 +2347,10 @@ next:
2347 return count; 2347 return count;
2348} 2348}
2349 2349
2350
2351static void wait_for_more_refs(struct btrfs_delayed_ref_root *delayed_refs, 2350static void wait_for_more_refs(struct btrfs_delayed_ref_root *delayed_refs,
2352 unsigned long num_refs) 2351 unsigned long num_refs,
2352 struct list_head *first_seq)
2353{ 2353{
2354 struct list_head *first_seq = delayed_refs->seq_head.next;
2355
2356 spin_unlock(&delayed_refs->lock); 2354 spin_unlock(&delayed_refs->lock);
2357 pr_debug("waiting for more refs (num %ld, first %p)\n", 2355 pr_debug("waiting for more refs (num %ld, first %p)\n",
2358 num_refs, first_seq); 2356 num_refs, first_seq);
@@ -2381,6 +2379,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
2381 struct btrfs_delayed_ref_root *delayed_refs; 2379 struct btrfs_delayed_ref_root *delayed_refs;
2382 struct btrfs_delayed_ref_node *ref; 2380 struct btrfs_delayed_ref_node *ref;
2383 struct list_head cluster; 2381 struct list_head cluster;
2382 struct list_head *first_seq = NULL;
2384 int ret; 2383 int ret;
2385 u64 delayed_start; 2384 u64 delayed_start;
2386 int run_all = count == (unsigned long)-1; 2385 int run_all = count == (unsigned long)-1;
@@ -2436,8 +2435,10 @@ again:
2436 */ 2435 */
2437 consider_waiting = 1; 2436 consider_waiting = 1;
2438 num_refs = delayed_refs->num_entries; 2437 num_refs = delayed_refs->num_entries;
2438 first_seq = root->fs_info->tree_mod_seq_list.next;
2439 } else { 2439 } else {
2440 wait_for_more_refs(delayed_refs, num_refs); 2440 wait_for_more_refs(delayed_refs,
2441 num_refs, first_seq);
2441 /* 2442 /*
2442 * after waiting, things have changed. we 2443 * after waiting, things have changed. we
2443 * dropped the lock and someone else might have 2444 * dropped the lock and someone else might have
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index aaa12c1eb348..01c21b6c6d43 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3324,6 +3324,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
3324 writepage_t writepage, void *data, 3324 writepage_t writepage, void *data,
3325 void (*flush_fn)(void *)) 3325 void (*flush_fn)(void *))
3326{ 3326{
3327 struct inode *inode = mapping->host;
3327 int ret = 0; 3328 int ret = 0;
3328 int done = 0; 3329 int done = 0;
3329 int nr_to_write_done = 0; 3330 int nr_to_write_done = 0;
@@ -3334,6 +3335,18 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
3334 int scanned = 0; 3335 int scanned = 0;
3335 int tag; 3336 int tag;
3336 3337
3338 /*
3339 * We have to hold onto the inode so that ordered extents can do their
3340 * work when the IO finishes. The alternative to this is failing to add
3341 * an ordered extent if the igrab() fails there and that is a huge pain
3342 * to deal with, so instead just hold onto the inode throughout the
3343 * writepages operation. If it fails here we are freeing up the inode
3344 * anyway and we'd rather not waste our time writing out stuff that is
3345 * going to be truncated anyway.
3346 */
3347 if (!igrab(inode))
3348 return 0;
3349
3337 pagevec_init(&pvec, 0); 3350 pagevec_init(&pvec, 0);
3338 if (wbc->range_cyclic) { 3351 if (wbc->range_cyclic) {
3339 index = mapping->writeback_index; /* Start from prev offset */ 3352 index = mapping->writeback_index; /* Start from prev offset */
@@ -3428,6 +3441,7 @@ retry:
3428 index = 0; 3441 index = 0;
3429 goto retry; 3442 goto retry;
3430 } 3443 }
3444 btrfs_add_delayed_iput(inode);
3431 return ret; 3445 return ret;
3432} 3446}
3433 3447
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 70dc8ca73e25..9aa01ec2138d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1334,7 +1334,6 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
1334 loff_t *ppos, size_t count, size_t ocount) 1334 loff_t *ppos, size_t count, size_t ocount)
1335{ 1335{
1336 struct file *file = iocb->ki_filp; 1336 struct file *file = iocb->ki_filp;
1337 struct inode *inode = fdentry(file)->d_inode;
1338 struct iov_iter i; 1337 struct iov_iter i;
1339 ssize_t written; 1338 ssize_t written;
1340 ssize_t written_buffered; 1339 ssize_t written_buffered;
@@ -1344,18 +1343,6 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
1344 written = generic_file_direct_write(iocb, iov, &nr_segs, pos, ppos, 1343 written = generic_file_direct_write(iocb, iov, &nr_segs, pos, ppos,
1345 count, ocount); 1344 count, ocount);
1346 1345
1347 /*
1348 * the generic O_DIRECT will update in-memory i_size after the
1349 * DIOs are done. But our endio handlers that update the on
1350 * disk i_size never update past the in memory i_size. So we
1351 * need one more update here to catch any additions to the
1352 * file
1353 */
1354 if (inode->i_size != BTRFS_I(inode)->disk_i_size) {
1355 btrfs_ordered_update_i_size(inode, inode->i_size, NULL);
1356 mark_inode_dirty(inode);
1357 }
1358
1359 if (written < 0 || written == count) 1346 if (written < 0 || written == count)
1360 return written; 1347 return written;
1361 1348
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 81296c57405a..6c4e2baa9290 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1543,29 +1543,26 @@ again:
1543 end = bitmap_info->offset + (u64)(BITS_PER_BITMAP * ctl->unit) - 1; 1543 end = bitmap_info->offset + (u64)(BITS_PER_BITMAP * ctl->unit) - 1;
1544 1544
1545 /* 1545 /*
1546 * XXX - this can go away after a few releases. 1546 * We need to search for bits in this bitmap. We could only cover some
1547 * 1547 * of the extent in this bitmap thanks to how we add space, so we need
1548 * since the only user of btrfs_remove_free_space is the tree logging 1548 * to search for as much as it as we can and clear that amount, and then
1549 * stuff, and the only way to test that is under crash conditions, we 1549 * go searching for the next bit.
1550 * want to have this debug stuff here just in case somethings not
1551 * working. Search the bitmap for the space we are trying to use to
1552 * make sure its actually there. If its not there then we need to stop
1553 * because something has gone wrong.
1554 */ 1550 */
1555 search_start = *offset; 1551 search_start = *offset;
1556 search_bytes = *bytes; 1552 search_bytes = ctl->unit;
1557 search_bytes = min(search_bytes, end - search_start + 1); 1553 search_bytes = min(search_bytes, end - search_start + 1);
1558 ret = search_bitmap(ctl, bitmap_info, &search_start, &search_bytes); 1554 ret = search_bitmap(ctl, bitmap_info, &search_start, &search_bytes);
1559 BUG_ON(ret < 0 || search_start != *offset); 1555 BUG_ON(ret < 0 || search_start != *offset);
1560 1556
1561 if (*offset > bitmap_info->offset && *offset + *bytes > end) { 1557 /* We may have found more bits than what we need */
1562 bitmap_clear_bits(ctl, bitmap_info, *offset, end - *offset + 1); 1558 search_bytes = min(search_bytes, *bytes);
1563 *bytes -= end - *offset + 1; 1559
1564 *offset = end + 1; 1560 /* Cannot clear past the end of the bitmap */
1565 } else if (*offset >= bitmap_info->offset && *offset + *bytes <= end) { 1561 search_bytes = min(search_bytes, end - search_start + 1);
1566 bitmap_clear_bits(ctl, bitmap_info, *offset, *bytes); 1562
1567 *bytes = 0; 1563 bitmap_clear_bits(ctl, bitmap_info, search_start, search_bytes);
1568 } 1564 *offset += search_bytes;
1565 *bytes -= search_bytes;
1569 1566
1570 if (*bytes) { 1567 if (*bytes) {
1571 struct rb_node *next = rb_next(&bitmap_info->offset_index); 1568 struct rb_node *next = rb_next(&bitmap_info->offset_index);
@@ -1596,7 +1593,7 @@ again:
1596 * everything over again. 1593 * everything over again.
1597 */ 1594 */
1598 search_start = *offset; 1595 search_start = *offset;
1599 search_bytes = *bytes; 1596 search_bytes = ctl->unit;
1600 ret = search_bitmap(ctl, bitmap_info, &search_start, 1597 ret = search_bitmap(ctl, bitmap_info, &search_start,
1601 &search_bytes); 1598 &search_bytes);
1602 if (ret < 0 || search_start != *offset) 1599 if (ret < 0 || search_start != *offset)
@@ -1879,12 +1876,14 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group,
1879{ 1876{
1880 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; 1877 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
1881 struct btrfs_free_space *info; 1878 struct btrfs_free_space *info;
1882 struct btrfs_free_space *next_info = NULL;
1883 int ret = 0; 1879 int ret = 0;
1884 1880
1885 spin_lock(&ctl->tree_lock); 1881 spin_lock(&ctl->tree_lock);
1886 1882
1887again: 1883again:
1884 if (!bytes)
1885 goto out_lock;
1886
1888 info = tree_search_offset(ctl, offset, 0, 0); 1887 info = tree_search_offset(ctl, offset, 0, 0);
1889 if (!info) { 1888 if (!info) {
1890 /* 1889 /*
@@ -1905,88 +1904,48 @@ again:
1905 } 1904 }
1906 } 1905 }
1907 1906
1908 if (info->bytes < bytes && rb_next(&info->offset_index)) { 1907 if (!info->bitmap) {
1909 u64 end;
1910 next_info = rb_entry(rb_next(&info->offset_index),
1911 struct btrfs_free_space,
1912 offset_index);
1913
1914 if (next_info->bitmap)
1915 end = next_info->offset +
1916 BITS_PER_BITMAP * ctl->unit - 1;
1917 else
1918 end = next_info->offset + next_info->bytes;
1919
1920 if (next_info->bytes < bytes ||
1921 next_info->offset > offset || offset > end) {
1922 printk(KERN_CRIT "Found free space at %llu, size %llu,"
1923 " trying to use %llu\n",
1924 (unsigned long long)info->offset,
1925 (unsigned long long)info->bytes,
1926 (unsigned long long)bytes);
1927 WARN_ON(1);
1928 ret = -EINVAL;
1929 goto out_lock;
1930 }
1931
1932 info = next_info;
1933 }
1934
1935 if (info->bytes == bytes) {
1936 unlink_free_space(ctl, info); 1908 unlink_free_space(ctl, info);
1937 if (info->bitmap) { 1909 if (offset == info->offset) {
1938 kfree(info->bitmap); 1910 u64 to_free = min(bytes, info->bytes);
1939 ctl->total_bitmaps--; 1911
1940 } 1912 info->bytes -= to_free;
1941 kmem_cache_free(btrfs_free_space_cachep, info); 1913 info->offset += to_free;
1942 ret = 0; 1914 if (info->bytes) {
1943 goto out_lock; 1915 ret = link_free_space(ctl, info);
1944 } 1916 WARN_ON(ret);
1945 1917 } else {
1946 if (!info->bitmap && info->offset == offset) { 1918 kmem_cache_free(btrfs_free_space_cachep, info);
1947 unlink_free_space(ctl, info); 1919 }
1948 info->offset += bytes;
1949 info->bytes -= bytes;
1950 ret = link_free_space(ctl, info);
1951 WARN_ON(ret);
1952 goto out_lock;
1953 }
1954 1920
1955 if (!info->bitmap && info->offset <= offset && 1921 offset += to_free;
1956 info->offset + info->bytes >= offset + bytes) { 1922 bytes -= to_free;
1957 u64 old_start = info->offset; 1923 goto again;
1958 /* 1924 } else {
1959 * we're freeing space in the middle of the info, 1925 u64 old_end = info->bytes + info->offset;
1960 * this can happen during tree log replay
1961 *
1962 * first unlink the old info and then
1963 * insert it again after the hole we're creating
1964 */
1965 unlink_free_space(ctl, info);
1966 if (offset + bytes < info->offset + info->bytes) {
1967 u64 old_end = info->offset + info->bytes;
1968 1926
1969 info->offset = offset + bytes; 1927 info->bytes = offset - info->offset;
1970 info->bytes = old_end - info->offset;
1971 ret = link_free_space(ctl, info); 1928 ret = link_free_space(ctl, info);
1972 WARN_ON(ret); 1929 WARN_ON(ret);
1973 if (ret) 1930 if (ret)
1974 goto out_lock; 1931 goto out_lock;
1975 } else {
1976 /* the hole we're creating ends at the end
1977 * of the info struct, just free the info
1978 */
1979 kmem_cache_free(btrfs_free_space_cachep, info);
1980 }
1981 spin_unlock(&ctl->tree_lock);
1982 1932
1983 /* step two, insert a new info struct to cover 1933 /* Not enough bytes in this entry to satisfy us */
1984 * anything before the hole 1934 if (old_end < offset + bytes) {
1985 */ 1935 bytes -= old_end - offset;
1986 ret = btrfs_add_free_space(block_group, old_start, 1936 offset = old_end;
1987 offset - old_start); 1937 goto again;
1988 WARN_ON(ret); /* -ENOMEM */ 1938 } else if (old_end == offset + bytes) {
1989 goto out; 1939 /* all done */
1940 goto out_lock;
1941 }
1942 spin_unlock(&ctl->tree_lock);
1943
1944 ret = btrfs_add_free_space(block_group, offset + bytes,
1945 old_end - (offset + bytes));
1946 WARN_ON(ret);
1947 goto out;
1948 }
1990 } 1949 }
1991 1950
1992 ret = remove_from_bitmap(ctl, info, &offset, &bytes); 1951 ret = remove_from_bitmap(ctl, info, &offset, &bytes);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a4f02501da40..a7d1921ac76b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -987,7 +987,7 @@ static noinline void async_cow_start(struct btrfs_work *work)
987 async_cow->start, async_cow->end, async_cow, 987 async_cow->start, async_cow->end, async_cow,
988 &num_added); 988 &num_added);
989 if (num_added == 0) { 989 if (num_added == 0) {
990 iput(async_cow->inode); 990 btrfs_add_delayed_iput(async_cow->inode);
991 async_cow->inode = NULL; 991 async_cow->inode = NULL;
992 } 992 }
993} 993}
@@ -1023,7 +1023,7 @@ static noinline void async_cow_free(struct btrfs_work *work)
1023 struct async_cow *async_cow; 1023 struct async_cow *async_cow;
1024 async_cow = container_of(work, struct async_cow, work); 1024 async_cow = container_of(work, struct async_cow, work);
1025 if (async_cow->inode) 1025 if (async_cow->inode)
1026 iput(async_cow->inode); 1026 btrfs_add_delayed_iput(async_cow->inode);
1027 kfree(async_cow); 1027 kfree(async_cow);
1028} 1028}
1029 1029
@@ -3754,7 +3754,7 @@ void btrfs_evict_inode(struct inode *inode)
3754 btrfs_wait_ordered_range(inode, 0, (u64)-1); 3754 btrfs_wait_ordered_range(inode, 0, (u64)-1);
3755 3755
3756 if (root->fs_info->log_root_recovering) { 3756 if (root->fs_info->log_root_recovering) {
3757 BUG_ON(!test_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, 3757 BUG_ON(test_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
3758 &BTRFS_I(inode)->runtime_flags)); 3758 &BTRFS_I(inode)->runtime_flags));
3759 goto no_delete; 3759 goto no_delete;
3760 } 3760 }
@@ -5876,8 +5876,17 @@ map:
5876 bh_result->b_size = len; 5876 bh_result->b_size = len;
5877 bh_result->b_bdev = em->bdev; 5877 bh_result->b_bdev = em->bdev;
5878 set_buffer_mapped(bh_result); 5878 set_buffer_mapped(bh_result);
5879 if (create && !test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) 5879 if (create) {
5880 set_buffer_new(bh_result); 5880 if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
5881 set_buffer_new(bh_result);
5882
5883 /*
5884 * Need to update the i_size under the extent lock so buffered
5885 * readers will get the updated i_size when we unlock.
5886 */
5887 if (start + len > i_size_read(inode))
5888 i_size_write(inode, start + len);
5889 }
5881 5890
5882 free_extent_map(em); 5891 free_extent_map(em);
5883 5892
@@ -6360,12 +6369,48 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
6360 */ 6369 */
6361 ordered = btrfs_lookup_ordered_range(inode, lockstart, 6370 ordered = btrfs_lookup_ordered_range(inode, lockstart,
6362 lockend - lockstart + 1); 6371 lockend - lockstart + 1);
6363 if (!ordered) 6372
6373 /*
6374 * We need to make sure there are no buffered pages in this
6375 * range either, we could have raced between the invalidate in
6376 * generic_file_direct_write and locking the extent. The
6377 * invalidate needs to happen so that reads after a write do not
6378 * get stale data.
6379 */
6380 if (!ordered && (!writing ||
6381 !test_range_bit(&BTRFS_I(inode)->io_tree,
6382 lockstart, lockend, EXTENT_UPTODATE, 0,
6383 cached_state)))
6364 break; 6384 break;
6385
6365 unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, 6386 unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend,
6366 &cached_state, GFP_NOFS); 6387 &cached_state, GFP_NOFS);
6367 btrfs_start_ordered_extent(inode, ordered, 1); 6388
6368 btrfs_put_ordered_extent(ordered); 6389 if (ordered) {
6390 btrfs_start_ordered_extent(inode, ordered, 1);
6391 btrfs_put_ordered_extent(ordered);
6392 } else {
6393 /* Screw you mmap */
6394 ret = filemap_write_and_wait_range(file->f_mapping,
6395 lockstart,
6396 lockend);
6397 if (ret)
6398 goto out;
6399
6400 /*
6401 * If we found a page that couldn't be invalidated just
6402 * fall back to buffered.
6403 */
6404 ret = invalidate_inode_pages2_range(file->f_mapping,
6405 lockstart >> PAGE_CACHE_SHIFT,
6406 lockend >> PAGE_CACHE_SHIFT);
6407 if (ret) {
6408 if (ret == -EBUSY)
6409 ret = 0;
6410 goto out;
6411 }
6412 }
6413
6369 cond_resched(); 6414 cond_resched();
6370 } 6415 }
6371 6416
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index 497c530724cf..e440aa653c30 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -339,7 +339,7 @@ struct btrfs_ioctl_get_dev_stats {
339#define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) 339#define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
340#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ 340#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
341 struct btrfs_ioctl_vol_args_v2) 341 struct btrfs_ioctl_vol_args_v2)
342#define BTRFS_IOC_SUBVOL_GETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 25, __u64) 342#define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
343#define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64) 343#define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
344#define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \ 344#define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \
345 struct btrfs_ioctl_scrub_args) 345 struct btrfs_ioctl_scrub_args)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0eb9a4da069e..e23991574fdf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1187,6 +1187,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
1187 if (ret) 1187 if (ret)
1188 goto restore; 1188 goto restore;
1189 1189
1190 ret = btrfs_resume_balance_async(fs_info);
1191 if (ret)
1192 goto restore;
1193
1190 sb->s_flags &= ~MS_RDONLY; 1194 sb->s_flags &= ~MS_RDONLY;
1191 } 1195 }
1192 1196
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 2017d0ff511c..8abeae4224f9 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -690,6 +690,8 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
690 kfree(name); 690 kfree(name);
691 691
692 iput(inode); 692 iput(inode);
693
694 btrfs_run_delayed_items(trans, root);
693 return ret; 695 return ret;
694} 696}
695 697
@@ -895,6 +897,7 @@ again:
895 ret = btrfs_unlink_inode(trans, root, dir, 897 ret = btrfs_unlink_inode(trans, root, dir,
896 inode, victim_name, 898 inode, victim_name,
897 victim_name_len); 899 victim_name_len);
900 btrfs_run_delayed_items(trans, root);
898 } 901 }
899 kfree(victim_name); 902 kfree(victim_name);
900 ptr = (unsigned long)(victim_ref + 1) + victim_name_len; 903 ptr = (unsigned long)(victim_ref + 1) + victim_name_len;
@@ -1475,6 +1478,9 @@ again:
1475 ret = btrfs_unlink_inode(trans, root, dir, inode, 1478 ret = btrfs_unlink_inode(trans, root, dir, inode,
1476 name, name_len); 1479 name, name_len);
1477 BUG_ON(ret); 1480 BUG_ON(ret);
1481
1482 btrfs_run_delayed_items(trans, root);
1483
1478 kfree(name); 1484 kfree(name);
1479 iput(inode); 1485 iput(inode);
1480 1486
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8a3d2594b807..ecaad40e7ef4 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2845,31 +2845,48 @@ out:
2845 2845
2846static int balance_kthread(void *data) 2846static int balance_kthread(void *data)
2847{ 2847{
2848 struct btrfs_balance_control *bctl = 2848 struct btrfs_fs_info *fs_info = data;
2849 (struct btrfs_balance_control *)data;
2850 struct btrfs_fs_info *fs_info = bctl->fs_info;
2851 int ret = 0; 2849 int ret = 0;
2852 2850
2853 mutex_lock(&fs_info->volume_mutex); 2851 mutex_lock(&fs_info->volume_mutex);
2854 mutex_lock(&fs_info->balance_mutex); 2852 mutex_lock(&fs_info->balance_mutex);
2855 2853
2856 set_balance_control(bctl); 2854 if (fs_info->balance_ctl) {
2857
2858 if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) {
2859 printk(KERN_INFO "btrfs: force skipping balance\n");
2860 } else {
2861 printk(KERN_INFO "btrfs: continuing balance\n"); 2855 printk(KERN_INFO "btrfs: continuing balance\n");
2862 ret = btrfs_balance(bctl, NULL); 2856 ret = btrfs_balance(fs_info->balance_ctl, NULL);
2863 } 2857 }
2864 2858
2865 mutex_unlock(&fs_info->balance_mutex); 2859 mutex_unlock(&fs_info->balance_mutex);
2866 mutex_unlock(&fs_info->volume_mutex); 2860 mutex_unlock(&fs_info->volume_mutex);
2861
2867 return ret; 2862 return ret;
2868} 2863}
2869 2864
2870int btrfs_recover_balance(struct btrfs_root *tree_root) 2865int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info)
2871{ 2866{
2872 struct task_struct *tsk; 2867 struct task_struct *tsk;
2868
2869 spin_lock(&fs_info->balance_lock);
2870 if (!fs_info->balance_ctl) {
2871 spin_unlock(&fs_info->balance_lock);
2872 return 0;
2873 }
2874 spin_unlock(&fs_info->balance_lock);
2875
2876 if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) {
2877 printk(KERN_INFO "btrfs: force skipping balance\n");
2878 return 0;
2879 }
2880
2881 tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance");
2882 if (IS_ERR(tsk))
2883 return PTR_ERR(tsk);
2884
2885 return 0;
2886}
2887
2888int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
2889{
2873 struct btrfs_balance_control *bctl; 2890 struct btrfs_balance_control *bctl;
2874 struct btrfs_balance_item *item; 2891 struct btrfs_balance_item *item;
2875 struct btrfs_disk_balance_args disk_bargs; 2892 struct btrfs_disk_balance_args disk_bargs;
@@ -2882,29 +2899,30 @@ int btrfs_recover_balance(struct btrfs_root *tree_root)
2882 if (!path) 2899 if (!path)
2883 return -ENOMEM; 2900 return -ENOMEM;
2884 2901
2885 bctl = kzalloc(sizeof(*bctl), GFP_NOFS);
2886 if (!bctl) {
2887 ret = -ENOMEM;
2888 goto out;
2889 }
2890
2891 key.objectid = BTRFS_BALANCE_OBJECTID; 2902 key.objectid = BTRFS_BALANCE_OBJECTID;
2892 key.type = BTRFS_BALANCE_ITEM_KEY; 2903 key.type = BTRFS_BALANCE_ITEM_KEY;
2893 key.offset = 0; 2904 key.offset = 0;
2894 2905
2895 ret = btrfs_search_slot(NULL, tree_root, &key, path, 0, 0); 2906 ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0);
2896 if (ret < 0) 2907 if (ret < 0)
2897 goto out_bctl; 2908 goto out;
2898 if (ret > 0) { /* ret = -ENOENT; */ 2909 if (ret > 0) { /* ret = -ENOENT; */
2899 ret = 0; 2910 ret = 0;
2900 goto out_bctl; 2911 goto out;
2912 }
2913
2914 bctl = kzalloc(sizeof(*bctl), GFP_NOFS);
2915 if (!bctl) {
2916 ret = -ENOMEM;
2917 goto out;
2901 } 2918 }
2902 2919
2903 leaf = path->nodes[0]; 2920 leaf = path->nodes[0];
2904 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item); 2921 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item);
2905 2922
2906 bctl->fs_info = tree_root->fs_info; 2923 bctl->fs_info = fs_info;
2907 bctl->flags = btrfs_balance_flags(leaf, item) | BTRFS_BALANCE_RESUME; 2924 bctl->flags = btrfs_balance_flags(leaf, item);
2925 bctl->flags |= BTRFS_BALANCE_RESUME;
2908 2926
2909 btrfs_balance_data(leaf, item, &disk_bargs); 2927 btrfs_balance_data(leaf, item, &disk_bargs);
2910 btrfs_disk_balance_args_to_cpu(&bctl->data, &disk_bargs); 2928 btrfs_disk_balance_args_to_cpu(&bctl->data, &disk_bargs);
@@ -2913,14 +2931,13 @@ int btrfs_recover_balance(struct btrfs_root *tree_root)
2913 btrfs_balance_sys(leaf, item, &disk_bargs); 2931 btrfs_balance_sys(leaf, item, &disk_bargs);
2914 btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs); 2932 btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs);
2915 2933
2916 tsk = kthread_run(balance_kthread, bctl, "btrfs-balance"); 2934 mutex_lock(&fs_info->volume_mutex);
2917 if (IS_ERR(tsk)) 2935 mutex_lock(&fs_info->balance_mutex);
2918 ret = PTR_ERR(tsk);
2919 else
2920 goto out;
2921 2936
2922out_bctl: 2937 set_balance_control(bctl);
2923 kfree(bctl); 2938
2939 mutex_unlock(&fs_info->balance_mutex);
2940 mutex_unlock(&fs_info->volume_mutex);
2924out: 2941out:
2925 btrfs_free_path(path); 2942 btrfs_free_path(path);
2926 return ret; 2943 return ret;
@@ -4061,16 +4078,18 @@ static void btrfs_end_bio(struct bio *bio, int err)
4061 4078
4062 BUG_ON(stripe_index >= bbio->num_stripes); 4079 BUG_ON(stripe_index >= bbio->num_stripes);
4063 dev = bbio->stripes[stripe_index].dev; 4080 dev = bbio->stripes[stripe_index].dev;
4064 if (bio->bi_rw & WRITE) 4081 if (dev->bdev) {
4065 btrfs_dev_stat_inc(dev, 4082 if (bio->bi_rw & WRITE)
4066 BTRFS_DEV_STAT_WRITE_ERRS); 4083 btrfs_dev_stat_inc(dev,
4067 else 4084 BTRFS_DEV_STAT_WRITE_ERRS);
4068 btrfs_dev_stat_inc(dev, 4085 else
4069 BTRFS_DEV_STAT_READ_ERRS); 4086 btrfs_dev_stat_inc(dev,
4070 if ((bio->bi_rw & WRITE_FLUSH) == WRITE_FLUSH) 4087 BTRFS_DEV_STAT_READ_ERRS);
4071 btrfs_dev_stat_inc(dev, 4088 if ((bio->bi_rw & WRITE_FLUSH) == WRITE_FLUSH)
4072 BTRFS_DEV_STAT_FLUSH_ERRS); 4089 btrfs_dev_stat_inc(dev,
4073 btrfs_dev_stat_print_on_error(dev); 4090 BTRFS_DEV_STAT_FLUSH_ERRS);
4091 btrfs_dev_stat_print_on_error(dev);
4092 }
4074 } 4093 }
4075 } 4094 }
4076 4095
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 74366f27a76b..95f6637614db 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -281,7 +281,8 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
281int btrfs_init_new_device(struct btrfs_root *root, char *path); 281int btrfs_init_new_device(struct btrfs_root *root, char *path);
282int btrfs_balance(struct btrfs_balance_control *bctl, 282int btrfs_balance(struct btrfs_balance_control *bctl,
283 struct btrfs_ioctl_balance_args *bargs); 283 struct btrfs_ioctl_balance_args *bargs);
284int btrfs_recover_balance(struct btrfs_root *tree_root); 284int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info);
285int btrfs_recover_balance(struct btrfs_fs_info *fs_info);
285int btrfs_pause_balance(struct btrfs_fs_info *fs_info); 286int btrfs_pause_balance(struct btrfs_fs_info *fs_info);
286int btrfs_cancel_balance(struct btrfs_fs_info *fs_info); 287int btrfs_cancel_balance(struct btrfs_fs_info *fs_info);
287int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); 288int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 173b1d22e59b..8b67304e4b80 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -54,7 +54,12 @@
54 (CONGESTION_ON_THRESH(congestion_kb) - \ 54 (CONGESTION_ON_THRESH(congestion_kb) - \
55 (CONGESTION_ON_THRESH(congestion_kb) >> 2)) 55 (CONGESTION_ON_THRESH(congestion_kb) >> 2))
56 56
57 57static inline struct ceph_snap_context *page_snap_context(struct page *page)
58{
59 if (PagePrivate(page))
60 return (void *)page->private;
61 return NULL;
62}
58 63
59/* 64/*
60 * Dirty a page. Optimistically adjust accounting, on the assumption 65 * Dirty a page. Optimistically adjust accounting, on the assumption
@@ -142,10 +147,9 @@ static void ceph_invalidatepage(struct page *page, unsigned long offset)
142{ 147{
143 struct inode *inode; 148 struct inode *inode;
144 struct ceph_inode_info *ci; 149 struct ceph_inode_info *ci;
145 struct ceph_snap_context *snapc = (void *)page->private; 150 struct ceph_snap_context *snapc = page_snap_context(page);
146 151
147 BUG_ON(!PageLocked(page)); 152 BUG_ON(!PageLocked(page));
148 BUG_ON(!page->private);
149 BUG_ON(!PagePrivate(page)); 153 BUG_ON(!PagePrivate(page));
150 BUG_ON(!page->mapping); 154 BUG_ON(!page->mapping);
151 155
@@ -182,7 +186,6 @@ static int ceph_releasepage(struct page *page, gfp_t g)
182 struct inode *inode = page->mapping ? page->mapping->host : NULL; 186 struct inode *inode = page->mapping ? page->mapping->host : NULL;
183 dout("%p releasepage %p idx %lu\n", inode, page, page->index); 187 dout("%p releasepage %p idx %lu\n", inode, page, page->index);
184 WARN_ON(PageDirty(page)); 188 WARN_ON(PageDirty(page));
185 WARN_ON(page->private);
186 WARN_ON(PagePrivate(page)); 189 WARN_ON(PagePrivate(page));
187 return 0; 190 return 0;
188} 191}
@@ -443,7 +446,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
443 osdc = &fsc->client->osdc; 446 osdc = &fsc->client->osdc;
444 447
445 /* verify this is a writeable snap context */ 448 /* verify this is a writeable snap context */
446 snapc = (void *)page->private; 449 snapc = page_snap_context(page);
447 if (snapc == NULL) { 450 if (snapc == NULL) {
448 dout("writepage %p page %p not dirty?\n", inode, page); 451 dout("writepage %p page %p not dirty?\n", inode, page);
449 goto out; 452 goto out;
@@ -451,7 +454,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
451 oldest = get_oldest_context(inode, &snap_size); 454 oldest = get_oldest_context(inode, &snap_size);
452 if (snapc->seq > oldest->seq) { 455 if (snapc->seq > oldest->seq) {
453 dout("writepage %p page %p snapc %p not writeable - noop\n", 456 dout("writepage %p page %p snapc %p not writeable - noop\n",
454 inode, page, (void *)page->private); 457 inode, page, snapc);
455 /* we should only noop if called by kswapd */ 458 /* we should only noop if called by kswapd */
456 WARN_ON((current->flags & PF_MEMALLOC) == 0); 459 WARN_ON((current->flags & PF_MEMALLOC) == 0);
457 ceph_put_snap_context(oldest); 460 ceph_put_snap_context(oldest);
@@ -591,7 +594,7 @@ static void writepages_finish(struct ceph_osd_request *req,
591 clear_bdi_congested(&fsc->backing_dev_info, 594 clear_bdi_congested(&fsc->backing_dev_info,
592 BLK_RW_ASYNC); 595 BLK_RW_ASYNC);
593 596
594 ceph_put_snap_context((void *)page->private); 597 ceph_put_snap_context(page_snap_context(page));
595 page->private = 0; 598 page->private = 0;
596 ClearPagePrivate(page); 599 ClearPagePrivate(page);
597 dout("unlocking %d %p\n", i, page); 600 dout("unlocking %d %p\n", i, page);
@@ -795,7 +798,7 @@ get_more_pages:
795 } 798 }
796 799
797 /* only if matching snap context */ 800 /* only if matching snap context */
798 pgsnapc = (void *)page->private; 801 pgsnapc = page_snap_context(page);
799 if (pgsnapc->seq > snapc->seq) { 802 if (pgsnapc->seq > snapc->seq) {
800 dout("page snapc %p %lld > oldest %p %lld\n", 803 dout("page snapc %p %lld > oldest %p %lld\n",
801 pgsnapc, pgsnapc->seq, snapc, snapc->seq); 804 pgsnapc, pgsnapc->seq, snapc, snapc->seq);
@@ -984,7 +987,7 @@ retry_locked:
984 BUG_ON(!ci->i_snap_realm); 987 BUG_ON(!ci->i_snap_realm);
985 down_read(&mdsc->snap_rwsem); 988 down_read(&mdsc->snap_rwsem);
986 BUG_ON(!ci->i_snap_realm->cached_context); 989 BUG_ON(!ci->i_snap_realm->cached_context);
987 snapc = (void *)page->private; 990 snapc = page_snap_context(page);
988 if (snapc && snapc != ci->i_head_snapc) { 991 if (snapc && snapc != ci->i_head_snapc) {
989 /* 992 /*
990 * this page is already dirty in another (older) snap 993 * this page is already dirty in another (older) snap
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 78db68a5cf44..0ae86ddf2213 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1653,24 +1653,26 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1653 * If yes, we have encountered a double deliminator 1653 * If yes, we have encountered a double deliminator
1654 * reset the NULL character to the deliminator 1654 * reset the NULL character to the deliminator
1655 */ 1655 */
1656 if (tmp_end < end && tmp_end[1] == delim) 1656 if (tmp_end < end && tmp_end[1] == delim) {
1657 tmp_end[0] = delim; 1657 tmp_end[0] = delim;
1658 1658
1659 /* Keep iterating until we get to a single deliminator 1659 /* Keep iterating until we get to a single
1660 * OR the end 1660 * deliminator OR the end
1661 */ 1661 */
1662 while ((tmp_end = strchr(tmp_end, delim)) != NULL && 1662 while ((tmp_end = strchr(tmp_end, delim))
1663 (tmp_end[1] == delim)) { 1663 != NULL && (tmp_end[1] == delim)) {
1664 tmp_end = (char *) &tmp_end[2]; 1664 tmp_end = (char *) &tmp_end[2];
1665 } 1665 }
1666 1666
1667 /* Reset var options to point to next element */ 1667 /* Reset var options to point to next element */
1668 if (tmp_end) { 1668 if (tmp_end) {
1669 tmp_end[0] = '\0'; 1669 tmp_end[0] = '\0';
1670 options = (char *) &tmp_end[1]; 1670 options = (char *) &tmp_end[1];
1671 } else 1671 } else
1672 /* Reached the end of the mount option string */ 1672 /* Reached the end of the mount option
1673 options = end; 1673 * string */
1674 options = end;
1675 }
1674 1676
1675 /* Now build new password string */ 1677 /* Now build new password string */
1676 temp_len = strlen(value); 1678 temp_len = strlen(value);
@@ -3493,18 +3495,15 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
3493 * MS-CIFS indicates that servers are only limited by the client's 3495 * MS-CIFS indicates that servers are only limited by the client's
3494 * bufsize for reads, testing against win98se shows that it throws 3496 * bufsize for reads, testing against win98se shows that it throws
3495 * INVALID_PARAMETER errors if you try to request too large a read. 3497 * INVALID_PARAMETER errors if you try to request too large a read.
3498 * OS/2 just sends back short reads.
3496 * 3499 *
3497 * If the server advertises a MaxBufferSize of less than one page, 3500 * If the server doesn't advertise CAP_LARGE_READ_X, then assume that
3498 * assume that it also can't satisfy reads larger than that either. 3501 * it can't handle a read request larger than its MaxBufferSize either.
3499 *
3500 * FIXME: Is there a better heuristic for this?
3501 */ 3502 */
3502 if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_READ_CAP)) 3503 if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_READ_CAP))
3503 defsize = CIFS_DEFAULT_IOSIZE; 3504 defsize = CIFS_DEFAULT_IOSIZE;
3504 else if (server->capabilities & CAP_LARGE_READ_X) 3505 else if (server->capabilities & CAP_LARGE_READ_X)
3505 defsize = CIFS_DEFAULT_NON_POSIX_RSIZE; 3506 defsize = CIFS_DEFAULT_NON_POSIX_RSIZE;
3506 else if (server->maxBuf >= PAGE_CACHE_SIZE)
3507 defsize = CIFSMaxBufSize;
3508 else 3507 else
3509 defsize = server->maxBuf - sizeof(READ_RSP); 3508 defsize = server->maxBuf - sizeof(READ_RSP);
3510 3509
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index 69f994a7d524..0dbe58a8b172 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -149,7 +149,7 @@ int ecryptfs_privileged_open(struct file **lower_file,
149 (*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred); 149 (*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred);
150 if (!IS_ERR(*lower_file)) 150 if (!IS_ERR(*lower_file))
151 goto out; 151 goto out;
152 if (flags & O_RDONLY) { 152 if ((flags & O_ACCMODE) == O_RDONLY) {
153 rc = PTR_ERR((*lower_file)); 153 rc = PTR_ERR((*lower_file));
154 goto out; 154 goto out;
155 } 155 }
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 3a06f4043df4..c0038f6566d4 100644
--- a/fs/ecryptfs/miscdev.c
+++ b/fs/ecryptfs/miscdev.c
@@ -49,7 +49,10 @@ ecryptfs_miscdev_poll(struct file *file, poll_table *pt)
49 mutex_lock(&ecryptfs_daemon_hash_mux); 49 mutex_lock(&ecryptfs_daemon_hash_mux);
50 /* TODO: Just use file->private_data? */ 50 /* TODO: Just use file->private_data? */
51 rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns()); 51 rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns());
52 BUG_ON(rc || !daemon); 52 if (rc || !daemon) {
53 mutex_unlock(&ecryptfs_daemon_hash_mux);
54 return -EINVAL;
55 }
53 mutex_lock(&daemon->mux); 56 mutex_lock(&daemon->mux);
54 mutex_unlock(&ecryptfs_daemon_hash_mux); 57 mutex_unlock(&ecryptfs_daemon_hash_mux);
55 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) { 58 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
@@ -122,6 +125,7 @@ ecryptfs_miscdev_open(struct inode *inode, struct file *file)
122 goto out_unlock_daemon; 125 goto out_unlock_daemon;
123 } 126 }
124 daemon->flags |= ECRYPTFS_DAEMON_MISCDEV_OPEN; 127 daemon->flags |= ECRYPTFS_DAEMON_MISCDEV_OPEN;
128 file->private_data = daemon;
125 atomic_inc(&ecryptfs_num_miscdev_opens); 129 atomic_inc(&ecryptfs_num_miscdev_opens);
126out_unlock_daemon: 130out_unlock_daemon:
127 mutex_unlock(&daemon->mux); 131 mutex_unlock(&daemon->mux);
@@ -152,9 +156,9 @@ ecryptfs_miscdev_release(struct inode *inode, struct file *file)
152 156
153 mutex_lock(&ecryptfs_daemon_hash_mux); 157 mutex_lock(&ecryptfs_daemon_hash_mux);
154 rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns()); 158 rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns());
155 BUG_ON(rc || !daemon); 159 if (rc || !daemon)
160 daemon = file->private_data;
156 mutex_lock(&daemon->mux); 161 mutex_lock(&daemon->mux);
157 BUG_ON(daemon->pid != task_pid(current));
158 BUG_ON(!(daemon->flags & ECRYPTFS_DAEMON_MISCDEV_OPEN)); 162 BUG_ON(!(daemon->flags & ECRYPTFS_DAEMON_MISCDEV_OPEN));
159 daemon->flags &= ~ECRYPTFS_DAEMON_MISCDEV_OPEN; 163 daemon->flags &= ~ECRYPTFS_DAEMON_MISCDEV_OPEN;
160 atomic_dec(&ecryptfs_num_miscdev_opens); 164 atomic_dec(&ecryptfs_num_miscdev_opens);
@@ -191,31 +195,32 @@ int ecryptfs_send_miscdev(char *data, size_t data_size,
191 struct ecryptfs_msg_ctx *msg_ctx, u8 msg_type, 195 struct ecryptfs_msg_ctx *msg_ctx, u8 msg_type,
192 u16 msg_flags, struct ecryptfs_daemon *daemon) 196 u16 msg_flags, struct ecryptfs_daemon *daemon)
193{ 197{
194 int rc = 0; 198 struct ecryptfs_message *msg;
195 199
196 mutex_lock(&msg_ctx->mux); 200 msg = kmalloc((sizeof(*msg) + data_size), GFP_KERNEL);
197 msg_ctx->msg = kmalloc((sizeof(*msg_ctx->msg) + data_size), 201 if (!msg) {
198 GFP_KERNEL);
199 if (!msg_ctx->msg) {
200 rc = -ENOMEM;
201 printk(KERN_ERR "%s: Out of memory whilst attempting " 202 printk(KERN_ERR "%s: Out of memory whilst attempting "
202 "to kmalloc(%zd, GFP_KERNEL)\n", __func__, 203 "to kmalloc(%zd, GFP_KERNEL)\n", __func__,
203 (sizeof(*msg_ctx->msg) + data_size)); 204 (sizeof(*msg) + data_size));
204 goto out_unlock; 205 return -ENOMEM;
205 } 206 }
207
208 mutex_lock(&msg_ctx->mux);
209 msg_ctx->msg = msg;
206 msg_ctx->msg->index = msg_ctx->index; 210 msg_ctx->msg->index = msg_ctx->index;
207 msg_ctx->msg->data_len = data_size; 211 msg_ctx->msg->data_len = data_size;
208 msg_ctx->type = msg_type; 212 msg_ctx->type = msg_type;
209 memcpy(msg_ctx->msg->data, data, data_size); 213 memcpy(msg_ctx->msg->data, data, data_size);
210 msg_ctx->msg_size = (sizeof(*msg_ctx->msg) + data_size); 214 msg_ctx->msg_size = (sizeof(*msg_ctx->msg) + data_size);
211 mutex_lock(&daemon->mux);
212 list_add_tail(&msg_ctx->daemon_out_list, &daemon->msg_ctx_out_queue); 215 list_add_tail(&msg_ctx->daemon_out_list, &daemon->msg_ctx_out_queue);
216 mutex_unlock(&msg_ctx->mux);
217
218 mutex_lock(&daemon->mux);
213 daemon->num_queued_msg_ctx++; 219 daemon->num_queued_msg_ctx++;
214 wake_up_interruptible(&daemon->wait); 220 wake_up_interruptible(&daemon->wait);
215 mutex_unlock(&daemon->mux); 221 mutex_unlock(&daemon->mux);
216out_unlock: 222
217 mutex_unlock(&msg_ctx->mux); 223 return 0;
218 return rc;
219} 224}
220 225
221/* 226/*
@@ -269,8 +274,16 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,
269 mutex_lock(&ecryptfs_daemon_hash_mux); 274 mutex_lock(&ecryptfs_daemon_hash_mux);
270 /* TODO: Just use file->private_data? */ 275 /* TODO: Just use file->private_data? */
271 rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns()); 276 rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns());
272 BUG_ON(rc || !daemon); 277 if (rc || !daemon) {
278 mutex_unlock(&ecryptfs_daemon_hash_mux);
279 return -EINVAL;
280 }
273 mutex_lock(&daemon->mux); 281 mutex_lock(&daemon->mux);
282 if (task_pid(current) != daemon->pid) {
283 mutex_unlock(&daemon->mux);
284 mutex_unlock(&ecryptfs_daemon_hash_mux);
285 return -EPERM;
286 }
274 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) { 287 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
275 rc = 0; 288 rc = 0;
276 mutex_unlock(&ecryptfs_daemon_hash_mux); 289 mutex_unlock(&ecryptfs_daemon_hash_mux);
@@ -307,9 +320,6 @@ check_list:
307 * message from the queue; try again */ 320 * message from the queue; try again */
308 goto check_list; 321 goto check_list;
309 } 322 }
310 BUG_ON(euid != daemon->euid);
311 BUG_ON(current_user_ns() != daemon->user_ns);
312 BUG_ON(task_pid(current) != daemon->pid);
313 msg_ctx = list_first_entry(&daemon->msg_ctx_out_queue, 323 msg_ctx = list_first_entry(&daemon->msg_ctx_out_queue,
314 struct ecryptfs_msg_ctx, daemon_out_list); 324 struct ecryptfs_msg_ctx, daemon_out_list);
315 BUG_ON(!msg_ctx); 325 BUG_ON(!msg_ctx);
diff --git a/fs/exec.c b/fs/exec.c
index a79786a8d2c8..da27b91ff1e8 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -819,10 +819,10 @@ static int exec_mmap(struct mm_struct *mm)
819 /* Notify parent that we're no longer interested in the old VM */ 819 /* Notify parent that we're no longer interested in the old VM */
820 tsk = current; 820 tsk = current;
821 old_mm = current->mm; 821 old_mm = current->mm;
822 sync_mm_rss(old_mm);
823 mm_release(tsk, old_mm); 822 mm_release(tsk, old_mm);
824 823
825 if (old_mm) { 824 if (old_mm) {
825 sync_mm_rss(old_mm);
826 /* 826 /*
827 * Make sure that if there is a core dump in progress 827 * Make sure that if there is a core dump in progress
828 * for the old mm, we get out and die instead of going 828 * for the old mm, we get out and die instead of going
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index c640ba57074b..09addc8615fa 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -31,6 +31,7 @@ static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags)
31 struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); 31 struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
32 struct hfsplus_vh *vh = sbi->s_vhdr; 32 struct hfsplus_vh *vh = sbi->s_vhdr;
33 struct hfsplus_vh *bvh = sbi->s_backup_vhdr; 33 struct hfsplus_vh *bvh = sbi->s_backup_vhdr;
34 u32 cnid = (unsigned long)dentry->d_fsdata;
34 35
35 if (!capable(CAP_SYS_ADMIN)) 36 if (!capable(CAP_SYS_ADMIN))
36 return -EPERM; 37 return -EPERM;
@@ -41,8 +42,12 @@ static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags)
41 vh->finder_info[0] = bvh->finder_info[0] = 42 vh->finder_info[0] = bvh->finder_info[0] =
42 cpu_to_be32(parent_ino(dentry)); 43 cpu_to_be32(parent_ino(dentry));
43 44
44 /* Bootloader */ 45 /*
45 vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(inode->i_ino); 46 * Bootloader. Just using the inode here breaks in the case of
47 * hard links - the firmware wants the ID of the hard link file,
48 * but the inode points at the indirect inode
49 */
50 vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(cnid);
46 51
47 /* Per spec, the OS X system folder - same as finder_info[0] here */ 52 /* Per spec, the OS X system folder - same as finder_info[0] here */
48 vh->finder_info[5] = bvh->finder_info[5] = 53 vh->finder_info[5] = bvh->finder_info[5] =
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 7daf4b852d1c..90effcccca9a 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -56,7 +56,7 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
56 DECLARE_COMPLETION_ONSTACK(wait); 56 DECLARE_COMPLETION_ONSTACK(wait);
57 struct bio *bio; 57 struct bio *bio;
58 int ret = 0; 58 int ret = 0;
59 unsigned int io_size; 59 u64 io_size;
60 loff_t start; 60 loff_t start;
61 int offset; 61 int offset;
62 62
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 17ba6b995659..f005b5bebdc7 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -207,7 +207,6 @@ error_0:
207static void nfs4_shutdown_session(struct nfs_client *clp) 207static void nfs4_shutdown_session(struct nfs_client *clp)
208{ 208{
209 if (nfs4_has_session(clp)) { 209 if (nfs4_has_session(clp)) {
210 nfs4_deviceid_purge_client(clp);
211 nfs4_destroy_session(clp->cl_session); 210 nfs4_destroy_session(clp->cl_session);
212 nfs4_destroy_clientid(clp); 211 nfs4_destroy_clientid(clp);
213 } 212 }
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 3168f6e3d4d4..9a4cbfc85d81 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -490,6 +490,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
490 dreq->error = -EIO; 490 dreq->error = -EIO;
491 spin_unlock(cinfo.lock); 491 spin_unlock(cinfo.lock);
492 } 492 }
493 nfs_release_request(req);
493 } 494 }
494 nfs_pageio_complete(&desc); 495 nfs_pageio_complete(&desc);
495 496
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index b5b86a05059c..864c51e4b400 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -57,6 +57,11 @@ unsigned int nfs_idmap_cache_timeout = 600;
57static const struct cred *id_resolver_cache; 57static const struct cred *id_resolver_cache;
58static struct key_type key_type_id_resolver_legacy; 58static struct key_type key_type_id_resolver_legacy;
59 59
60struct idmap {
61 struct rpc_pipe *idmap_pipe;
62 struct key_construction *idmap_key_cons;
63 struct mutex idmap_mutex;
64};
60 65
61/** 66/**
62 * nfs_fattr_init_names - initialise the nfs_fattr owner_name/group_name fields 67 * nfs_fattr_init_names - initialise the nfs_fattr owner_name/group_name fields
@@ -310,9 +315,11 @@ static ssize_t nfs_idmap_get_key(const char *name, size_t namelen,
310 name, namelen, type, data, 315 name, namelen, type, data,
311 data_size, NULL); 316 data_size, NULL);
312 if (ret < 0) { 317 if (ret < 0) {
318 mutex_lock(&idmap->idmap_mutex);
313 ret = nfs_idmap_request_key(&key_type_id_resolver_legacy, 319 ret = nfs_idmap_request_key(&key_type_id_resolver_legacy,
314 name, namelen, type, data, 320 name, namelen, type, data,
315 data_size, idmap); 321 data_size, idmap);
322 mutex_unlock(&idmap->idmap_mutex);
316 } 323 }
317 return ret; 324 return ret;
318} 325}
@@ -354,11 +361,6 @@ static int nfs_idmap_lookup_id(const char *name, size_t namelen, const char *typ
354/* idmap classic begins here */ 361/* idmap classic begins here */
355module_param(nfs_idmap_cache_timeout, int, 0644); 362module_param(nfs_idmap_cache_timeout, int, 0644);
356 363
357struct idmap {
358 struct rpc_pipe *idmap_pipe;
359 struct key_construction *idmap_key_cons;
360};
361
362enum { 364enum {
363 Opt_find_uid, Opt_find_gid, Opt_find_user, Opt_find_group, Opt_find_err 365 Opt_find_uid, Opt_find_gid, Opt_find_user, Opt_find_group, Opt_find_err
364}; 366};
@@ -469,6 +471,7 @@ nfs_idmap_new(struct nfs_client *clp)
469 return error; 471 return error;
470 } 472 }
471 idmap->idmap_pipe = pipe; 473 idmap->idmap_pipe = pipe;
474 mutex_init(&idmap->idmap_mutex);
472 475
473 clp->cl_idmap = idmap; 476 clp->cl_idmap = idmap;
474 return 0; 477 return 0;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index e605d695dbcb..f7296983eba6 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1530,7 +1530,6 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
1530 nfsi->delegation_state = 0; 1530 nfsi->delegation_state = 0;
1531 init_rwsem(&nfsi->rwsem); 1531 init_rwsem(&nfsi->rwsem);
1532 nfsi->layout = NULL; 1532 nfsi->layout = NULL;
1533 atomic_set(&nfsi->commit_info.rpcs_out, 0);
1534#endif 1533#endif
1535} 1534}
1536 1535
@@ -1545,6 +1544,7 @@ static void init_once(void *foo)
1545 INIT_LIST_HEAD(&nfsi->commit_info.list); 1544 INIT_LIST_HEAD(&nfsi->commit_info.list);
1546 nfsi->npages = 0; 1545 nfsi->npages = 0;
1547 nfsi->commit_info.ncommit = 0; 1546 nfsi->commit_info.ncommit = 0;
1547 atomic_set(&nfsi->commit_info.rpcs_out, 0);
1548 atomic_set(&nfsi->silly_count, 1); 1548 atomic_set(&nfsi->silly_count, 1);
1549 INIT_HLIST_HEAD(&nfsi->silly_list); 1549 INIT_HLIST_HEAD(&nfsi->silly_list);
1550 init_waitqueue_head(&nfsi->waitqueue); 1550 init_waitqueue_head(&nfsi->waitqueue);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index b8323aa7b543..bbc49caa7a82 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -70,6 +70,10 @@ find_pnfs_driver(u32 id)
70 70
71 spin_lock(&pnfs_spinlock); 71 spin_lock(&pnfs_spinlock);
72 local = find_pnfs_driver_locked(id); 72 local = find_pnfs_driver_locked(id);
73 if (local != NULL && !try_module_get(local->owner)) {
74 dprintk("%s: Could not grab reference on module\n", __func__);
75 local = NULL;
76 }
73 spin_unlock(&pnfs_spinlock); 77 spin_unlock(&pnfs_spinlock);
74 return local; 78 return local;
75} 79}
@@ -80,6 +84,9 @@ unset_pnfs_layoutdriver(struct nfs_server *nfss)
80 if (nfss->pnfs_curr_ld) { 84 if (nfss->pnfs_curr_ld) {
81 if (nfss->pnfs_curr_ld->clear_layoutdriver) 85 if (nfss->pnfs_curr_ld->clear_layoutdriver)
82 nfss->pnfs_curr_ld->clear_layoutdriver(nfss); 86 nfss->pnfs_curr_ld->clear_layoutdriver(nfss);
87 /* Decrement the MDS count. Purge the deviceid cache if zero */
88 if (atomic_dec_and_test(&nfss->nfs_client->cl_mds_count))
89 nfs4_deviceid_purge_client(nfss->nfs_client);
83 module_put(nfss->pnfs_curr_ld->owner); 90 module_put(nfss->pnfs_curr_ld->owner);
84 } 91 }
85 nfss->pnfs_curr_ld = NULL; 92 nfss->pnfs_curr_ld = NULL;
@@ -115,10 +122,6 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh,
115 goto out_no_driver; 122 goto out_no_driver;
116 } 123 }
117 } 124 }
118 if (!try_module_get(ld_type->owner)) {
119 dprintk("%s: Could not grab reference on module\n", __func__);
120 goto out_no_driver;
121 }
122 server->pnfs_curr_ld = ld_type; 125 server->pnfs_curr_ld = ld_type;
123 if (ld_type->set_layoutdriver 126 if (ld_type->set_layoutdriver
124 && ld_type->set_layoutdriver(server, mntfh)) { 127 && ld_type->set_layoutdriver(server, mntfh)) {
@@ -127,6 +130,8 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh,
127 module_put(ld_type->owner); 130 module_put(ld_type->owner);
128 goto out_no_driver; 131 goto out_no_driver;
129 } 132 }
133 /* Bump the MDS count */
134 atomic_inc(&server->nfs_client->cl_mds_count);
130 135
131 dprintk("%s: pNFS module for %u set\n", __func__, id); 136 dprintk("%s: pNFS module for %u set\n", __func__, id);
132 return; 137 return;
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 08a07a218d26..57ceaf33d177 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -191,6 +191,8 @@ void nilfs_remove_all_gcinodes(struct the_nilfs *nilfs)
191 while (!list_empty(head)) { 191 while (!list_empty(head)) {
192 ii = list_first_entry(head, struct nilfs_inode_info, i_dirty); 192 ii = list_first_entry(head, struct nilfs_inode_info, i_dirty);
193 list_del_init(&ii->i_dirty); 193 list_del_init(&ii->i_dirty);
194 truncate_inode_pages(&ii->vfs_inode.i_data, 0);
195 nilfs_btnode_cache_clear(&ii->i_btnode_cache);
194 iput(&ii->vfs_inode); 196 iput(&ii->vfs_inode);
195 } 197 }
196} 198}
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 0e72ad6f22aa..88e11fb346b6 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2309,6 +2309,8 @@ nilfs_remove_written_gcinodes(struct the_nilfs *nilfs, struct list_head *head)
2309 if (!test_bit(NILFS_I_UPDATED, &ii->i_state)) 2309 if (!test_bit(NILFS_I_UPDATED, &ii->i_state))
2310 continue; 2310 continue;
2311 list_del_init(&ii->i_dirty); 2311 list_del_init(&ii->i_dirty);
2312 truncate_inode_pages(&ii->vfs_inode.i_data, 0);
2313 nilfs_btnode_cache_clear(&ii->i_btnode_cache);
2312 iput(&ii->vfs_inode); 2314 iput(&ii->vfs_inode);
2313 } 2315 }
2314} 2316}
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 81a4cd22f80b..4f7795fb5fc0 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -456,7 +456,7 @@ static void ocfs2_update_lock_stats(struct ocfs2_lock_res *res, int level,
456 stats->ls_gets++; 456 stats->ls_gets++;
457 stats->ls_total += ktime_to_ns(kt); 457 stats->ls_total += ktime_to_ns(kt);
458 /* overflow */ 458 /* overflow */
459 if (unlikely(stats->ls_gets) == 0) { 459 if (unlikely(stats->ls_gets == 0)) {
460 stats->ls_gets++; 460 stats->ls_gets++;
461 stats->ls_total = ktime_to_ns(kt); 461 stats->ls_total = ktime_to_ns(kt);
462 } 462 }
@@ -3932,6 +3932,8 @@ unqueue:
3932static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, 3932static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
3933 struct ocfs2_lock_res *lockres) 3933 struct ocfs2_lock_res *lockres)
3934{ 3934{
3935 unsigned long flags;
3936
3935 assert_spin_locked(&lockres->l_lock); 3937 assert_spin_locked(&lockres->l_lock);
3936 3938
3937 if (lockres->l_flags & OCFS2_LOCK_FREEING) { 3939 if (lockres->l_flags & OCFS2_LOCK_FREEING) {
@@ -3945,21 +3947,22 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
3945 3947
3946 lockres_or_flags(lockres, OCFS2_LOCK_QUEUED); 3948 lockres_or_flags(lockres, OCFS2_LOCK_QUEUED);
3947 3949
3948 spin_lock(&osb->dc_task_lock); 3950 spin_lock_irqsave(&osb->dc_task_lock, flags);
3949 if (list_empty(&lockres->l_blocked_list)) { 3951 if (list_empty(&lockres->l_blocked_list)) {
3950 list_add_tail(&lockres->l_blocked_list, 3952 list_add_tail(&lockres->l_blocked_list,
3951 &osb->blocked_lock_list); 3953 &osb->blocked_lock_list);
3952 osb->blocked_lock_count++; 3954 osb->blocked_lock_count++;
3953 } 3955 }
3954 spin_unlock(&osb->dc_task_lock); 3956 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
3955} 3957}
3956 3958
3957static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) 3959static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
3958{ 3960{
3959 unsigned long processed; 3961 unsigned long processed;
3962 unsigned long flags;
3960 struct ocfs2_lock_res *lockres; 3963 struct ocfs2_lock_res *lockres;
3961 3964
3962 spin_lock(&osb->dc_task_lock); 3965 spin_lock_irqsave(&osb->dc_task_lock, flags);
3963 /* grab this early so we know to try again if a state change and 3966 /* grab this early so we know to try again if a state change and
3964 * wake happens part-way through our work */ 3967 * wake happens part-way through our work */
3965 osb->dc_work_sequence = osb->dc_wake_sequence; 3968 osb->dc_work_sequence = osb->dc_wake_sequence;
@@ -3972,38 +3975,40 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
3972 struct ocfs2_lock_res, l_blocked_list); 3975 struct ocfs2_lock_res, l_blocked_list);
3973 list_del_init(&lockres->l_blocked_list); 3976 list_del_init(&lockres->l_blocked_list);
3974 osb->blocked_lock_count--; 3977 osb->blocked_lock_count--;
3975 spin_unlock(&osb->dc_task_lock); 3978 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
3976 3979
3977 BUG_ON(!processed); 3980 BUG_ON(!processed);
3978 processed--; 3981 processed--;
3979 3982
3980 ocfs2_process_blocked_lock(osb, lockres); 3983 ocfs2_process_blocked_lock(osb, lockres);
3981 3984
3982 spin_lock(&osb->dc_task_lock); 3985 spin_lock_irqsave(&osb->dc_task_lock, flags);
3983 } 3986 }
3984 spin_unlock(&osb->dc_task_lock); 3987 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
3985} 3988}
3986 3989
3987static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb) 3990static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb)
3988{ 3991{
3989 int empty = 0; 3992 int empty = 0;
3993 unsigned long flags;
3990 3994
3991 spin_lock(&osb->dc_task_lock); 3995 spin_lock_irqsave(&osb->dc_task_lock, flags);
3992 if (list_empty(&osb->blocked_lock_list)) 3996 if (list_empty(&osb->blocked_lock_list))
3993 empty = 1; 3997 empty = 1;
3994 3998
3995 spin_unlock(&osb->dc_task_lock); 3999 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
3996 return empty; 4000 return empty;
3997} 4001}
3998 4002
3999static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb) 4003static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb)
4000{ 4004{
4001 int should_wake = 0; 4005 int should_wake = 0;
4006 unsigned long flags;
4002 4007
4003 spin_lock(&osb->dc_task_lock); 4008 spin_lock_irqsave(&osb->dc_task_lock, flags);
4004 if (osb->dc_work_sequence != osb->dc_wake_sequence) 4009 if (osb->dc_work_sequence != osb->dc_wake_sequence)
4005 should_wake = 1; 4010 should_wake = 1;
4006 spin_unlock(&osb->dc_task_lock); 4011 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
4007 4012
4008 return should_wake; 4013 return should_wake;
4009} 4014}
@@ -4033,10 +4038,12 @@ static int ocfs2_downconvert_thread(void *arg)
4033 4038
4034void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb) 4039void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb)
4035{ 4040{
4036 spin_lock(&osb->dc_task_lock); 4041 unsigned long flags;
4042
4043 spin_lock_irqsave(&osb->dc_task_lock, flags);
4037 /* make sure the voting thread gets a swipe at whatever changes 4044 /* make sure the voting thread gets a swipe at whatever changes
4038 * the caller may have made to the voting state */ 4045 * the caller may have made to the voting state */
4039 osb->dc_wake_sequence++; 4046 osb->dc_wake_sequence++;
4040 spin_unlock(&osb->dc_task_lock); 4047 spin_unlock_irqrestore(&osb->dc_task_lock, flags);
4041 wake_up(&osb->dc_event); 4048 wake_up(&osb->dc_event);
4042} 4049}
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 2f5b92ef0e53..70b5863a2d64 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -923,8 +923,6 @@ out_unlock:
923 923
924 ocfs2_inode_unlock(inode, 0); 924 ocfs2_inode_unlock(inode, 0);
925out: 925out:
926 if (ret && ret != -ENXIO)
927 ret = -ENXIO;
928 return ret; 926 return ret;
929} 927}
930 928
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 061591a3ab08..98513c8ed589 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2422,8 +2422,10 @@ out_dio:
2422 unaligned_dio = 0; 2422 unaligned_dio = 0;
2423 } 2423 }
2424 2424
2425 if (unaligned_dio) 2425 if (unaligned_dio) {
2426 ocfs2_iocb_clear_unaligned_aio(iocb);
2426 atomic_dec(&OCFS2_I(inode)->ip_unaligned_aio); 2427 atomic_dec(&OCFS2_I(inode)->ip_unaligned_aio);
2428 }
2427 2429
2428out: 2430out:
2429 if (rw_level != -1) 2431 if (rw_level != -1)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 92fcd575775a..0a86e302655f 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -399,8 +399,6 @@ int ocfs2_global_read_info(struct super_block *sb, int type)
399 msecs_to_jiffies(oinfo->dqi_syncms)); 399 msecs_to_jiffies(oinfo->dqi_syncms));
400 400
401out_err: 401out_err:
402 if (status)
403 mlog_errno(status);
404 return status; 402 return status;
405out_unlock: 403out_unlock:
406 ocfs2_unlock_global_qf(oinfo, 0); 404 ocfs2_unlock_global_qf(oinfo, 0);
diff --git a/fs/open.c b/fs/open.c
index d6c79a0dffc7..1540632d8387 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -397,10 +397,10 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)
397{ 397{
398 struct file *file; 398 struct file *file;
399 struct inode *inode; 399 struct inode *inode;
400 int error; 400 int error, fput_needed;
401 401
402 error = -EBADF; 402 error = -EBADF;
403 file = fget(fd); 403 file = fget_raw_light(fd, &fput_needed);
404 if (!file) 404 if (!file)
405 goto out; 405 goto out;
406 406
@@ -414,7 +414,7 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)
414 if (!error) 414 if (!error)
415 set_fs_pwd(current->fs, &file->f_path); 415 set_fs_pwd(current->fs, &file->f_path);
416out_putf: 416out_putf:
417 fput(file); 417 fput_light(file, fput_needed);
418out: 418out:
419 return error; 419 return error;
420} 420}
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index aeb19e68e086..11a2aa2a56c4 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -258,7 +258,7 @@ fail:
258 return rc; 258 return rc;
259} 259}
260 260
261int pstore_fill_super(struct super_block *sb, void *data, int silent) 261static int pstore_fill_super(struct super_block *sb, void *data, int silent)
262{ 262{
263 struct inode *inode; 263 struct inode *inode;
264 264
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 82c585f715e3..03ce7a9b81cc 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -94,20 +94,15 @@ static const char *get_reason_str(enum kmsg_dump_reason reason)
94 * as we can from the end of the buffer. 94 * as we can from the end of the buffer.
95 */ 95 */
96static void pstore_dump(struct kmsg_dumper *dumper, 96static void pstore_dump(struct kmsg_dumper *dumper,
97 enum kmsg_dump_reason reason, 97 enum kmsg_dump_reason reason)
98 const char *s1, unsigned long l1,
99 const char *s2, unsigned long l2)
100{ 98{
101 unsigned long s1_start, s2_start; 99 unsigned long total = 0;
102 unsigned long l1_cpy, l2_cpy;
103 unsigned long size, total = 0;
104 char *dst;
105 const char *why; 100 const char *why;
106 u64 id; 101 u64 id;
107 int hsize, ret;
108 unsigned int part = 1; 102 unsigned int part = 1;
109 unsigned long flags = 0; 103 unsigned long flags = 0;
110 int is_locked = 0; 104 int is_locked = 0;
105 int ret;
111 106
112 why = get_reason_str(reason); 107 why = get_reason_str(reason);
113 108
@@ -119,30 +114,25 @@ static void pstore_dump(struct kmsg_dumper *dumper,
119 spin_lock_irqsave(&psinfo->buf_lock, flags); 114 spin_lock_irqsave(&psinfo->buf_lock, flags);
120 oopscount++; 115 oopscount++;
121 while (total < kmsg_bytes) { 116 while (total < kmsg_bytes) {
117 char *dst;
118 unsigned long size;
119 int hsize;
120 size_t len;
121
122 dst = psinfo->buf; 122 dst = psinfo->buf;
123 hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part); 123 hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
124 size = psinfo->bufsize - hsize; 124 size = psinfo->bufsize - hsize;
125 dst += hsize; 125 dst += hsize;
126 126
127 l2_cpy = min(l2, size); 127 if (!kmsg_dump_get_buffer(dumper, true, dst, size, &len))
128 l1_cpy = min(l1, size - l2_cpy);
129
130 if (l1_cpy + l2_cpy == 0)
131 break; 128 break;
132 129
133 s2_start = l2 - l2_cpy;
134 s1_start = l1 - l1_cpy;
135
136 memcpy(dst, s1 + s1_start, l1_cpy);
137 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);
138
139 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, 130 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
140 hsize + l1_cpy + l2_cpy, psinfo); 131 hsize + len, psinfo);
141 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) 132 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
142 pstore_new_entry = 1; 133 pstore_new_entry = 1;
143 l1 -= l1_cpy; 134
144 l2 -= l2_cpy; 135 total += hsize + len;
145 total += l1_cpy + l2_cpy;
146 part++; 136 part++;
147 } 137 }
148 if (in_nmi()) { 138 if (in_nmi()) {
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 9123cce28c1e..453030f9c5bc 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -106,6 +106,8 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
106 time->tv_sec = 0; 106 time->tv_sec = 0;
107 time->tv_nsec = 0; 107 time->tv_nsec = 0;
108 108
109 /* Update old/shadowed buffer. */
110 persistent_ram_save_old(prz);
109 size = persistent_ram_old_size(prz); 111 size = persistent_ram_old_size(prz);
110 *buf = kmalloc(size, GFP_KERNEL); 112 *buf = kmalloc(size, GFP_KERNEL);
111 if (*buf == NULL) 113 if (*buf == NULL)
@@ -184,6 +186,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id,
184 return -EINVAL; 186 return -EINVAL;
185 187
186 persistent_ram_free_old(cxt->przs[id]); 188 persistent_ram_free_old(cxt->przs[id]);
189 persistent_ram_zap(cxt->przs[id]);
187 190
188 return 0; 191 return 0;
189} 192}
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 31f8d184f3a0..c5fbdbbf81ac 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -250,23 +250,24 @@ static void notrace persistent_ram_update(struct persistent_ram_zone *prz,
250 persistent_ram_update_ecc(prz, start, count); 250 persistent_ram_update_ecc(prz, start, count);
251} 251}
252 252
253static void __init 253void persistent_ram_save_old(struct persistent_ram_zone *prz)
254persistent_ram_save_old(struct persistent_ram_zone *prz)
255{ 254{
256 struct persistent_ram_buffer *buffer = prz->buffer; 255 struct persistent_ram_buffer *buffer = prz->buffer;
257 size_t size = buffer_size(prz); 256 size_t size = buffer_size(prz);
258 size_t start = buffer_start(prz); 257 size_t start = buffer_start(prz);
259 char *dest;
260 258
261 persistent_ram_ecc_old(prz); 259 if (!size)
260 return;
262 261
263 dest = kmalloc(size, GFP_KERNEL); 262 if (!prz->old_log) {
264 if (dest == NULL) { 263 persistent_ram_ecc_old(prz);
264 prz->old_log = kmalloc(size, GFP_KERNEL);
265 }
266 if (!prz->old_log) {
265 pr_err("persistent_ram: failed to allocate buffer\n"); 267 pr_err("persistent_ram: failed to allocate buffer\n");
266 return; 268 return;
267 } 269 }
268 270
269 prz->old_log = dest;
270 prz->old_log_size = size; 271 prz->old_log_size = size;
271 memcpy(prz->old_log, &buffer->data[start], size - start); 272 memcpy(prz->old_log, &buffer->data[start], size - start);
272 memcpy(prz->old_log + size - start, &buffer->data[0], start); 273 memcpy(prz->old_log + size - start, &buffer->data[0], start);
@@ -319,6 +320,13 @@ void persistent_ram_free_old(struct persistent_ram_zone *prz)
319 prz->old_log_size = 0; 320 prz->old_log_size = 0;
320} 321}
321 322
323void persistent_ram_zap(struct persistent_ram_zone *prz)
324{
325 atomic_set(&prz->buffer->start, 0);
326 atomic_set(&prz->buffer->size, 0);
327 persistent_ram_update_header_ecc(prz);
328}
329
322static void *persistent_ram_vmap(phys_addr_t start, size_t size) 330static void *persistent_ram_vmap(phys_addr_t start, size_t size)
323{ 331{
324 struct page **pages; 332 struct page **pages;
@@ -405,6 +413,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
405 " size %zu, start %zu\n", 413 " size %zu, start %zu\n",
406 buffer_size(prz), buffer_start(prz)); 414 buffer_size(prz), buffer_start(prz));
407 persistent_ram_save_old(prz); 415 persistent_ram_save_old(prz);
416 return 0;
408 } 417 }
409 } else { 418 } else {
410 pr_info("persistent_ram: no valid data in buffer" 419 pr_info("persistent_ram: no valid data in buffer"
@@ -412,8 +421,7 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool
412 } 421 }
413 422
414 prz->buffer->sig = PERSISTENT_RAM_SIG; 423 prz->buffer->sig = PERSISTENT_RAM_SIG;
415 atomic_set(&prz->buffer->start, 0); 424 persistent_ram_zap(prz);
416 atomic_set(&prz->buffer->size, 0);
417 425
418 return 0; 426 return 0;
419} 427}
@@ -448,7 +456,6 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
448 goto err; 456 goto err;
449 457
450 persistent_ram_post_init(prz, ecc); 458 persistent_ram_post_init(prz, ecc);
451 persistent_ram_update_header_ecc(prz);
452 459
453 return prz; 460 return prz;
454err: 461err:
diff --git a/fs/splice.c b/fs/splice.c
index c9f1318a3b82..7bf08fa22ec9 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -273,13 +273,16 @@ void spd_release_page(struct splice_pipe_desc *spd, unsigned int i)
273 * Check if we need to grow the arrays holding pages and partial page 273 * Check if we need to grow the arrays holding pages and partial page
274 * descriptions. 274 * descriptions.
275 */ 275 */
276int splice_grow_spd(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd) 276int splice_grow_spd(const struct pipe_inode_info *pipe, struct splice_pipe_desc *spd)
277{ 277{
278 if (pipe->buffers <= PIPE_DEF_BUFFERS) 278 unsigned int buffers = ACCESS_ONCE(pipe->buffers);
279
280 spd->nr_pages_max = buffers;
281 if (buffers <= PIPE_DEF_BUFFERS)
279 return 0; 282 return 0;
280 283
281 spd->pages = kmalloc(pipe->buffers * sizeof(struct page *), GFP_KERNEL); 284 spd->pages = kmalloc(buffers * sizeof(struct page *), GFP_KERNEL);
282 spd->partial = kmalloc(pipe->buffers * sizeof(struct partial_page), GFP_KERNEL); 285 spd->partial = kmalloc(buffers * sizeof(struct partial_page), GFP_KERNEL);
283 286
284 if (spd->pages && spd->partial) 287 if (spd->pages && spd->partial)
285 return 0; 288 return 0;
@@ -289,10 +292,9 @@ int splice_grow_spd(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd)
289 return -ENOMEM; 292 return -ENOMEM;
290} 293}
291 294
292void splice_shrink_spd(struct pipe_inode_info *pipe, 295void splice_shrink_spd(struct splice_pipe_desc *spd)
293 struct splice_pipe_desc *spd)
294{ 296{
295 if (pipe->buffers <= PIPE_DEF_BUFFERS) 297 if (spd->nr_pages_max <= PIPE_DEF_BUFFERS)
296 return; 298 return;
297 299
298 kfree(spd->pages); 300 kfree(spd->pages);
@@ -315,6 +317,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
315 struct splice_pipe_desc spd = { 317 struct splice_pipe_desc spd = {
316 .pages = pages, 318 .pages = pages,
317 .partial = partial, 319 .partial = partial,
320 .nr_pages_max = PIPE_DEF_BUFFERS,
318 .flags = flags, 321 .flags = flags,
319 .ops = &page_cache_pipe_buf_ops, 322 .ops = &page_cache_pipe_buf_ops,
320 .spd_release = spd_release_page, 323 .spd_release = spd_release_page,
@@ -326,7 +329,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
326 index = *ppos >> PAGE_CACHE_SHIFT; 329 index = *ppos >> PAGE_CACHE_SHIFT;
327 loff = *ppos & ~PAGE_CACHE_MASK; 330 loff = *ppos & ~PAGE_CACHE_MASK;
328 req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 331 req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
329 nr_pages = min(req_pages, pipe->buffers); 332 nr_pages = min(req_pages, spd.nr_pages_max);
330 333
331 /* 334 /*
332 * Lookup the (hopefully) full range of pages we need. 335 * Lookup the (hopefully) full range of pages we need.
@@ -497,7 +500,7 @@ fill_it:
497 if (spd.nr_pages) 500 if (spd.nr_pages)
498 error = splice_to_pipe(pipe, &spd); 501 error = splice_to_pipe(pipe, &spd);
499 502
500 splice_shrink_spd(pipe, &spd); 503 splice_shrink_spd(&spd);
501 return error; 504 return error;
502} 505}
503 506
@@ -598,6 +601,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
598 struct splice_pipe_desc spd = { 601 struct splice_pipe_desc spd = {
599 .pages = pages, 602 .pages = pages,
600 .partial = partial, 603 .partial = partial,
604 .nr_pages_max = PIPE_DEF_BUFFERS,
601 .flags = flags, 605 .flags = flags,
602 .ops = &default_pipe_buf_ops, 606 .ops = &default_pipe_buf_ops,
603 .spd_release = spd_release_page, 607 .spd_release = spd_release_page,
@@ -608,8 +612,8 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
608 612
609 res = -ENOMEM; 613 res = -ENOMEM;
610 vec = __vec; 614 vec = __vec;
611 if (pipe->buffers > PIPE_DEF_BUFFERS) { 615 if (spd.nr_pages_max > PIPE_DEF_BUFFERS) {
612 vec = kmalloc(pipe->buffers * sizeof(struct iovec), GFP_KERNEL); 616 vec = kmalloc(spd.nr_pages_max * sizeof(struct iovec), GFP_KERNEL);
613 if (!vec) 617 if (!vec)
614 goto shrink_ret; 618 goto shrink_ret;
615 } 619 }
@@ -617,7 +621,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
617 offset = *ppos & ~PAGE_CACHE_MASK; 621 offset = *ppos & ~PAGE_CACHE_MASK;
618 nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 622 nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
619 623
620 for (i = 0; i < nr_pages && i < pipe->buffers && len; i++) { 624 for (i = 0; i < nr_pages && i < spd.nr_pages_max && len; i++) {
621 struct page *page; 625 struct page *page;
622 626
623 page = alloc_page(GFP_USER); 627 page = alloc_page(GFP_USER);
@@ -665,7 +669,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
665shrink_ret: 669shrink_ret:
666 if (vec != __vec) 670 if (vec != __vec)
667 kfree(vec); 671 kfree(vec);
668 splice_shrink_spd(pipe, &spd); 672 splice_shrink_spd(&spd);
669 return res; 673 return res;
670 674
671err: 675err:
@@ -1614,6 +1618,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
1614 struct splice_pipe_desc spd = { 1618 struct splice_pipe_desc spd = {
1615 .pages = pages, 1619 .pages = pages,
1616 .partial = partial, 1620 .partial = partial,
1621 .nr_pages_max = PIPE_DEF_BUFFERS,
1617 .flags = flags, 1622 .flags = flags,
1618 .ops = &user_page_pipe_buf_ops, 1623 .ops = &user_page_pipe_buf_ops,
1619 .spd_release = spd_release_page, 1624 .spd_release = spd_release_page,
@@ -1629,13 +1634,13 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
1629 1634
1630 spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages, 1635 spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages,
1631 spd.partial, false, 1636 spd.partial, false,
1632 pipe->buffers); 1637 spd.nr_pages_max);
1633 if (spd.nr_pages <= 0) 1638 if (spd.nr_pages <= 0)
1634 ret = spd.nr_pages; 1639 ret = spd.nr_pages;
1635 else 1640 else
1636 ret = splice_to_pipe(pipe, &spd); 1641 ret = splice_to_pipe(pipe, &spd);
1637 1642
1638 splice_shrink_spd(pipe, &spd); 1643 splice_shrink_spd(&spd);
1639 return ret; 1644 return ret;
1640} 1645}
1641 1646
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 84a7e6f3c046..92df3b081539 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -2918,7 +2918,7 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
2918 struct dentry *dent; 2918 struct dentry *dent;
2919 struct ubifs_debug_info *d = c->dbg; 2919 struct ubifs_debug_info *d = c->dbg;
2920 2920
2921 if (!IS_ENABLED(DEBUG_FS)) 2921 if (!IS_ENABLED(CONFIG_DEBUG_FS))
2922 return 0; 2922 return 0;
2923 2923
2924 n = snprintf(d->dfs_dir_name, UBIFS_DFS_DIR_LEN + 1, UBIFS_DFS_DIR_NAME, 2924 n = snprintf(d->dfs_dir_name, UBIFS_DFS_DIR_LEN + 1, UBIFS_DFS_DIR_NAME,
@@ -3013,7 +3013,7 @@ out:
3013 */ 3013 */
3014void dbg_debugfs_exit_fs(struct ubifs_info *c) 3014void dbg_debugfs_exit_fs(struct ubifs_info *c)
3015{ 3015{
3016 if (IS_ENABLED(DEBUG_FS)) 3016 if (IS_ENABLED(CONFIG_DEBUG_FS))
3017 debugfs_remove_recursive(c->dbg->dfs_dir); 3017 debugfs_remove_recursive(c->dbg->dfs_dir);
3018} 3018}
3019 3019
@@ -3099,7 +3099,7 @@ int dbg_debugfs_init(void)
3099 const char *fname; 3099 const char *fname;
3100 struct dentry *dent; 3100 struct dentry *dent;
3101 3101
3102 if (!IS_ENABLED(DEBUG_FS)) 3102 if (!IS_ENABLED(CONFIG_DEBUG_FS))
3103 return 0; 3103 return 0;
3104 3104
3105 fname = "ubifs"; 3105 fname = "ubifs";
@@ -3166,7 +3166,7 @@ out:
3166 */ 3166 */
3167void dbg_debugfs_exit(void) 3167void dbg_debugfs_exit(void)
3168{ 3168{
3169 if (IS_ENABLED(DEBUG_FS)) 3169 if (IS_ENABLED(CONFIG_DEBUG_FS))
3170 debugfs_remove_recursive(dfs_rootdir); 3170 debugfs_remove_recursive(dfs_rootdir);
3171} 3171}
3172 3172
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 2559d174e004..28ec13af28d9 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -939,8 +939,8 @@ static int find_dirtiest_idx_leb(struct ubifs_info *c)
939 } 939 }
940 dbg_find("LEB %d, dirty %d and free %d flags %#x", lp->lnum, lp->dirty, 940 dbg_find("LEB %d, dirty %d and free %d flags %#x", lp->lnum, lp->dirty,
941 lp->free, lp->flags); 941 lp->free, lp->flags);
942 ubifs_assert(lp->flags | LPROPS_TAKEN); 942 ubifs_assert(lp->flags & LPROPS_TAKEN);
943 ubifs_assert(lp->flags | LPROPS_INDEX); 943 ubifs_assert(lp->flags & LPROPS_INDEX);
944 return lnum; 944 return lnum;
945} 945}
946 946
diff --git a/fs/udf/super.c b/fs/udf/super.c
index ac8a348dcb69..8d86a8706c0e 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -56,6 +56,7 @@
56#include <linux/seq_file.h> 56#include <linux/seq_file.h>
57#include <linux/bitmap.h> 57#include <linux/bitmap.h>
58#include <linux/crc-itu-t.h> 58#include <linux/crc-itu-t.h>
59#include <linux/log2.h>
59#include <asm/byteorder.h> 60#include <asm/byteorder.h>
60 61
61#include "udf_sb.h" 62#include "udf_sb.h"
@@ -1215,16 +1216,65 @@ out_bh:
1215 return ret; 1216 return ret;
1216} 1217}
1217 1218
1219static int udf_load_sparable_map(struct super_block *sb,
1220 struct udf_part_map *map,
1221 struct sparablePartitionMap *spm)
1222{
1223 uint32_t loc;
1224 uint16_t ident;
1225 struct sparingTable *st;
1226 struct udf_sparing_data *sdata = &map->s_type_specific.s_sparing;
1227 int i;
1228 struct buffer_head *bh;
1229
1230 map->s_partition_type = UDF_SPARABLE_MAP15;
1231 sdata->s_packet_len = le16_to_cpu(spm->packetLength);
1232 if (!is_power_of_2(sdata->s_packet_len)) {
1233 udf_err(sb, "error loading logical volume descriptor: "
1234 "Invalid packet length %u\n",
1235 (unsigned)sdata->s_packet_len);
1236 return -EIO;
1237 }
1238 if (spm->numSparingTables > 4) {
1239 udf_err(sb, "error loading logical volume descriptor: "
1240 "Too many sparing tables (%d)\n",
1241 (int)spm->numSparingTables);
1242 return -EIO;
1243 }
1244
1245 for (i = 0; i < spm->numSparingTables; i++) {
1246 loc = le32_to_cpu(spm->locSparingTable[i]);
1247 bh = udf_read_tagged(sb, loc, loc, &ident);
1248 if (!bh)
1249 continue;
1250
1251 st = (struct sparingTable *)bh->b_data;
1252 if (ident != 0 ||
1253 strncmp(st->sparingIdent.ident, UDF_ID_SPARING,
1254 strlen(UDF_ID_SPARING)) ||
1255 sizeof(*st) + le16_to_cpu(st->reallocationTableLen) >
1256 sb->s_blocksize) {
1257 brelse(bh);
1258 continue;
1259 }
1260
1261 sdata->s_spar_map[i] = bh;
1262 }
1263 map->s_partition_func = udf_get_pblock_spar15;
1264 return 0;
1265}
1266
1218static int udf_load_logicalvol(struct super_block *sb, sector_t block, 1267static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1219 struct kernel_lb_addr *fileset) 1268 struct kernel_lb_addr *fileset)
1220{ 1269{
1221 struct logicalVolDesc *lvd; 1270 struct logicalVolDesc *lvd;
1222 int i, j, offset; 1271 int i, offset;
1223 uint8_t type; 1272 uint8_t type;
1224 struct udf_sb_info *sbi = UDF_SB(sb); 1273 struct udf_sb_info *sbi = UDF_SB(sb);
1225 struct genericPartitionMap *gpm; 1274 struct genericPartitionMap *gpm;
1226 uint16_t ident; 1275 uint16_t ident;
1227 struct buffer_head *bh; 1276 struct buffer_head *bh;
1277 unsigned int table_len;
1228 int ret = 0; 1278 int ret = 0;
1229 1279
1230 bh = udf_read_tagged(sb, block, block, &ident); 1280 bh = udf_read_tagged(sb, block, block, &ident);
@@ -1232,15 +1282,20 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1232 return 1; 1282 return 1;
1233 BUG_ON(ident != TAG_IDENT_LVD); 1283 BUG_ON(ident != TAG_IDENT_LVD);
1234 lvd = (struct logicalVolDesc *)bh->b_data; 1284 lvd = (struct logicalVolDesc *)bh->b_data;
1235 1285 table_len = le32_to_cpu(lvd->mapTableLength);
1236 i = udf_sb_alloc_partition_maps(sb, le32_to_cpu(lvd->numPartitionMaps)); 1286 if (sizeof(*lvd) + table_len > sb->s_blocksize) {
1237 if (i != 0) { 1287 udf_err(sb, "error loading logical volume descriptor: "
1238 ret = i; 1288 "Partition table too long (%u > %lu)\n", table_len,
1289 sb->s_blocksize - sizeof(*lvd));
1239 goto out_bh; 1290 goto out_bh;
1240 } 1291 }
1241 1292
1293 ret = udf_sb_alloc_partition_maps(sb, le32_to_cpu(lvd->numPartitionMaps));
1294 if (ret)
1295 goto out_bh;
1296
1242 for (i = 0, offset = 0; 1297 for (i = 0, offset = 0;
1243 i < sbi->s_partitions && offset < le32_to_cpu(lvd->mapTableLength); 1298 i < sbi->s_partitions && offset < table_len;
1244 i++, offset += gpm->partitionMapLength) { 1299 i++, offset += gpm->partitionMapLength) {
1245 struct udf_part_map *map = &sbi->s_partmaps[i]; 1300 struct udf_part_map *map = &sbi->s_partmaps[i];
1246 gpm = (struct genericPartitionMap *) 1301 gpm = (struct genericPartitionMap *)
@@ -1275,38 +1330,9 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1275 } else if (!strncmp(upm2->partIdent.ident, 1330 } else if (!strncmp(upm2->partIdent.ident,
1276 UDF_ID_SPARABLE, 1331 UDF_ID_SPARABLE,
1277 strlen(UDF_ID_SPARABLE))) { 1332 strlen(UDF_ID_SPARABLE))) {
1278 uint32_t loc; 1333 if (udf_load_sparable_map(sb, map,
1279 struct sparingTable *st; 1334 (struct sparablePartitionMap *)gpm) < 0)
1280 struct sparablePartitionMap *spm = 1335 goto out_bh;
1281 (struct sparablePartitionMap *)gpm;
1282
1283 map->s_partition_type = UDF_SPARABLE_MAP15;
1284 map->s_type_specific.s_sparing.s_packet_len =
1285 le16_to_cpu(spm->packetLength);
1286 for (j = 0; j < spm->numSparingTables; j++) {
1287 struct buffer_head *bh2;
1288
1289 loc = le32_to_cpu(
1290 spm->locSparingTable[j]);
1291 bh2 = udf_read_tagged(sb, loc, loc,
1292 &ident);
1293 map->s_type_specific.s_sparing.
1294 s_spar_map[j] = bh2;
1295
1296 if (bh2 == NULL)
1297 continue;
1298
1299 st = (struct sparingTable *)bh2->b_data;
1300 if (ident != 0 || strncmp(
1301 st->sparingIdent.ident,
1302 UDF_ID_SPARING,
1303 strlen(UDF_ID_SPARING))) {
1304 brelse(bh2);
1305 map->s_type_specific.s_sparing.
1306 s_spar_map[j] = NULL;
1307 }
1308 }
1309 map->s_partition_func = udf_get_pblock_spar15;
1310 } else if (!strncmp(upm2->partIdent.ident, 1336 } else if (!strncmp(upm2->partIdent.ident,
1311 UDF_ID_METADATA, 1337 UDF_ID_METADATA,
1312 strlen(UDF_ID_METADATA))) { 1338 strlen(UDF_ID_METADATA))) {
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 229641fb8e67..9d1aeb7e2734 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -1080,6 +1080,7 @@ restart:
1080 goto restart; 1080 goto restart;
1081 } 1081 }
1082 1082
1083 xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
1083 trace_xfs_alloc_size_neither(args); 1084 trace_xfs_alloc_size_neither(args);
1084 args->agbno = NULLAGBLOCK; 1085 args->agbno = NULLAGBLOCK;
1085 return 0; 1086 return 0;
@@ -2441,7 +2442,7 @@ xfs_alloc_vextent(
2441 DECLARE_COMPLETION_ONSTACK(done); 2442 DECLARE_COMPLETION_ONSTACK(done);
2442 2443
2443 args->done = &done; 2444 args->done = &done;
2444 INIT_WORK(&args->work, xfs_alloc_vextent_worker); 2445 INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);
2445 queue_work(xfs_alloc_wq, &args->work); 2446 queue_work(xfs_alloc_wq, &args->work);
2446 wait_for_completion(&done); 2447 wait_for_completion(&done);
2447 return args->result; 2448 return args->result;
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index ae31c313a79e..8dad722c0041 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -981,10 +981,15 @@ xfs_vm_writepage(
981 imap_valid = 0; 981 imap_valid = 0;
982 } 982 }
983 } else { 983 } else {
984 if (PageUptodate(page)) { 984 if (PageUptodate(page))
985 ASSERT(buffer_mapped(bh)); 985 ASSERT(buffer_mapped(bh));
986 imap_valid = 0; 986 /*
987 } 987 * This buffer is not uptodate and will not be
988 * written to disk. Ensure that we will put any
989 * subsequent writeable buffers into a new
990 * ioend.
991 */
992 imap_valid = 0;
988 continue; 993 continue;
989 } 994 }
990 995
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 172d3cc8f8cb..a4beb421018a 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -201,14 +201,7 @@ xfs_buf_alloc(
201 bp->b_length = numblks; 201 bp->b_length = numblks;
202 bp->b_io_length = numblks; 202 bp->b_io_length = numblks;
203 bp->b_flags = flags; 203 bp->b_flags = flags;
204 204 bp->b_bn = blkno;
205 /*
206 * We do not set the block number here in the buffer because we have not
207 * finished initialising the buffer. We insert the buffer into the cache
208 * in this state, so this ensures that we are unable to do IO on a
209 * buffer that hasn't been fully initialised.
210 */
211 bp->b_bn = XFS_BUF_DADDR_NULL;
212 atomic_set(&bp->b_pin_count, 0); 205 atomic_set(&bp->b_pin_count, 0);
213 init_waitqueue_head(&bp->b_waiters); 206 init_waitqueue_head(&bp->b_waiters);
214 207
@@ -567,11 +560,6 @@ xfs_buf_get(
567 if (bp != new_bp) 560 if (bp != new_bp)
568 xfs_buf_free(new_bp); 561 xfs_buf_free(new_bp);
569 562
570 /*
571 * Now we have a workable buffer, fill in the block number so
572 * that we can do IO on it.
573 */
574 bp->b_bn = blkno;
575 bp->b_io_length = bp->b_length; 563 bp->b_io_length = bp->b_length;
576 564
577found: 565found:
@@ -772,7 +760,7 @@ xfs_buf_get_uncached(
772 int error, i; 760 int error, i;
773 xfs_buf_t *bp; 761 xfs_buf_t *bp;
774 762
775 bp = xfs_buf_alloc(target, 0, numblks, 0); 763 bp = xfs_buf_alloc(target, XFS_BUF_DADDR_NULL, numblks, 0);
776 if (unlikely(bp == NULL)) 764 if (unlikely(bp == NULL))
777 goto fail; 765 goto fail;
778 766
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 6cdbf90c6f7b..d041d47d9d86 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -505,6 +505,14 @@ xfs_inode_item_push(
505 } 505 }
506 506
507 /* 507 /*
508 * Stale inode items should force out the iclog.
509 */
510 if (ip->i_flags & XFS_ISTALE) {
511 rval = XFS_ITEM_PINNED;
512 goto out_unlock;
513 }
514
515 /*
508 * Someone else is already flushing the inode. Nothing we can do 516 * Someone else is already flushing the inode. Nothing we can do
509 * here but wait for the flush to finish and remove the item from 517 * here but wait for the flush to finish and remove the item from
510 * the AIL. 518 * the AIL.
@@ -514,15 +522,6 @@ xfs_inode_item_push(
514 goto out_unlock; 522 goto out_unlock;
515 } 523 }
516 524
517 /*
518 * Stale inode items should force out the iclog.
519 */
520 if (ip->i_flags & XFS_ISTALE) {
521 xfs_ifunlock(ip);
522 xfs_iunlock(ip, XFS_ILOCK_SHARED);
523 return XFS_ITEM_PINNED;
524 }
525
526 ASSERT(iip->ili_fields != 0 || XFS_FORCED_SHUTDOWN(ip->i_mount)); 525 ASSERT(iip->ili_fields != 0 || XFS_FORCED_SHUTDOWN(ip->i_mount));
527 ASSERT(iip->ili_logged == 0 || XFS_FORCED_SHUTDOWN(ip->i_mount)); 526 ASSERT(iip->ili_logged == 0 || XFS_FORCED_SHUTDOWN(ip->i_mount));
528 527
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index f30d9807dc48..d90d4a388609 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -38,13 +38,21 @@
38kmem_zone_t *xfs_log_ticket_zone; 38kmem_zone_t *xfs_log_ticket_zone;
39 39
40/* Local miscellaneous function prototypes */ 40/* Local miscellaneous function prototypes */
41STATIC int xlog_commit_record(struct log *log, struct xlog_ticket *ticket, 41STATIC int
42 xlog_in_core_t **, xfs_lsn_t *); 42xlog_commit_record(
43 struct xlog *log,
44 struct xlog_ticket *ticket,
45 struct xlog_in_core **iclog,
46 xfs_lsn_t *commitlsnp);
47
43STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, 48STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp,
44 xfs_buftarg_t *log_target, 49 xfs_buftarg_t *log_target,
45 xfs_daddr_t blk_offset, 50 xfs_daddr_t blk_offset,
46 int num_bblks); 51 int num_bblks);
47STATIC int xlog_space_left(struct log *log, atomic64_t *head); 52STATIC int
53xlog_space_left(
54 struct xlog *log,
55 atomic64_t *head);
48STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); 56STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
49STATIC void xlog_dealloc_log(xlog_t *log); 57STATIC void xlog_dealloc_log(xlog_t *log);
50 58
@@ -64,8 +72,10 @@ STATIC void xlog_state_switch_iclogs(xlog_t *log,
64 int eventual_size); 72 int eventual_size);
65STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog); 73STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog);
66 74
67STATIC void xlog_grant_push_ail(struct log *log, 75STATIC void
68 int need_bytes); 76xlog_grant_push_ail(
77 struct xlog *log,
78 int need_bytes);
69STATIC void xlog_regrant_reserve_log_space(xlog_t *log, 79STATIC void xlog_regrant_reserve_log_space(xlog_t *log,
70 xlog_ticket_t *ticket); 80 xlog_ticket_t *ticket);
71STATIC void xlog_ungrant_log_space(xlog_t *log, 81STATIC void xlog_ungrant_log_space(xlog_t *log,
@@ -73,7 +83,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log,
73 83
74#if defined(DEBUG) 84#if defined(DEBUG)
75STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); 85STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr);
76STATIC void xlog_verify_grant_tail(struct log *log); 86STATIC void
87xlog_verify_grant_tail(
88 struct xlog *log);
77STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog, 89STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
78 int count, boolean_t syncing); 90 int count, boolean_t syncing);
79STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog, 91STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
@@ -89,9 +101,9 @@ STATIC int xlog_iclogs_empty(xlog_t *log);
89 101
90static void 102static void
91xlog_grant_sub_space( 103xlog_grant_sub_space(
92 struct log *log, 104 struct xlog *log,
93 atomic64_t *head, 105 atomic64_t *head,
94 int bytes) 106 int bytes)
95{ 107{
96 int64_t head_val = atomic64_read(head); 108 int64_t head_val = atomic64_read(head);
97 int64_t new, old; 109 int64_t new, old;
@@ -115,9 +127,9 @@ xlog_grant_sub_space(
115 127
116static void 128static void
117xlog_grant_add_space( 129xlog_grant_add_space(
118 struct log *log, 130 struct xlog *log,
119 atomic64_t *head, 131 atomic64_t *head,
120 int bytes) 132 int bytes)
121{ 133{
122 int64_t head_val = atomic64_read(head); 134 int64_t head_val = atomic64_read(head);
123 int64_t new, old; 135 int64_t new, old;
@@ -165,7 +177,7 @@ xlog_grant_head_wake_all(
165 177
166static inline int 178static inline int
167xlog_ticket_reservation( 179xlog_ticket_reservation(
168 struct log *log, 180 struct xlog *log,
169 struct xlog_grant_head *head, 181 struct xlog_grant_head *head,
170 struct xlog_ticket *tic) 182 struct xlog_ticket *tic)
171{ 183{
@@ -182,7 +194,7 @@ xlog_ticket_reservation(
182 194
183STATIC bool 195STATIC bool
184xlog_grant_head_wake( 196xlog_grant_head_wake(
185 struct log *log, 197 struct xlog *log,
186 struct xlog_grant_head *head, 198 struct xlog_grant_head *head,
187 int *free_bytes) 199 int *free_bytes)
188{ 200{
@@ -204,7 +216,7 @@ xlog_grant_head_wake(
204 216
205STATIC int 217STATIC int
206xlog_grant_head_wait( 218xlog_grant_head_wait(
207 struct log *log, 219 struct xlog *log,
208 struct xlog_grant_head *head, 220 struct xlog_grant_head *head,
209 struct xlog_ticket *tic, 221 struct xlog_ticket *tic,
210 int need_bytes) 222 int need_bytes)
@@ -256,7 +268,7 @@ shutdown:
256 */ 268 */
257STATIC int 269STATIC int
258xlog_grant_head_check( 270xlog_grant_head_check(
259 struct log *log, 271 struct xlog *log,
260 struct xlog_grant_head *head, 272 struct xlog_grant_head *head,
261 struct xlog_ticket *tic, 273 struct xlog_ticket *tic,
262 int *need_bytes) 274 int *need_bytes)
@@ -323,7 +335,7 @@ xfs_log_regrant(
323 struct xfs_mount *mp, 335 struct xfs_mount *mp,
324 struct xlog_ticket *tic) 336 struct xlog_ticket *tic)
325{ 337{
326 struct log *log = mp->m_log; 338 struct xlog *log = mp->m_log;
327 int need_bytes; 339 int need_bytes;
328 int error = 0; 340 int error = 0;
329 341
@@ -389,7 +401,7 @@ xfs_log_reserve(
389 bool permanent, 401 bool permanent,
390 uint t_type) 402 uint t_type)
391{ 403{
392 struct log *log = mp->m_log; 404 struct xlog *log = mp->m_log;
393 struct xlog_ticket *tic; 405 struct xlog_ticket *tic;
394 int need_bytes; 406 int need_bytes;
395 int error = 0; 407 int error = 0;
@@ -465,7 +477,7 @@ xfs_log_done(
465 struct xlog_in_core **iclog, 477 struct xlog_in_core **iclog,
466 uint flags) 478 uint flags)
467{ 479{
468 struct log *log = mp->m_log; 480 struct xlog *log = mp->m_log;
469 xfs_lsn_t lsn = 0; 481 xfs_lsn_t lsn = 0;
470 482
471 if (XLOG_FORCED_SHUTDOWN(log) || 483 if (XLOG_FORCED_SHUTDOWN(log) ||
@@ -810,6 +822,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
810void 822void
811xfs_log_unmount(xfs_mount_t *mp) 823xfs_log_unmount(xfs_mount_t *mp)
812{ 824{
825 cancel_delayed_work_sync(&mp->m_sync_work);
813 xfs_trans_ail_destroy(mp); 826 xfs_trans_ail_destroy(mp);
814 xlog_dealloc_log(mp->m_log); 827 xlog_dealloc_log(mp->m_log);
815} 828}
@@ -838,7 +851,7 @@ void
838xfs_log_space_wake( 851xfs_log_space_wake(
839 struct xfs_mount *mp) 852 struct xfs_mount *mp)
840{ 853{
841 struct log *log = mp->m_log; 854 struct xlog *log = mp->m_log;
842 int free_bytes; 855 int free_bytes;
843 856
844 if (XLOG_FORCED_SHUTDOWN(log)) 857 if (XLOG_FORCED_SHUTDOWN(log))
@@ -916,7 +929,7 @@ xfs_lsn_t
916xlog_assign_tail_lsn_locked( 929xlog_assign_tail_lsn_locked(
917 struct xfs_mount *mp) 930 struct xfs_mount *mp)
918{ 931{
919 struct log *log = mp->m_log; 932 struct xlog *log = mp->m_log;
920 struct xfs_log_item *lip; 933 struct xfs_log_item *lip;
921 xfs_lsn_t tail_lsn; 934 xfs_lsn_t tail_lsn;
922 935
@@ -965,7 +978,7 @@ xlog_assign_tail_lsn(
965 */ 978 */
966STATIC int 979STATIC int
967xlog_space_left( 980xlog_space_left(
968 struct log *log, 981 struct xlog *log,
969 atomic64_t *head) 982 atomic64_t *head)
970{ 983{
971 int free_bytes; 984 int free_bytes;
@@ -1277,7 +1290,7 @@ out:
1277 */ 1290 */
1278STATIC int 1291STATIC int
1279xlog_commit_record( 1292xlog_commit_record(
1280 struct log *log, 1293 struct xlog *log,
1281 struct xlog_ticket *ticket, 1294 struct xlog_ticket *ticket,
1282 struct xlog_in_core **iclog, 1295 struct xlog_in_core **iclog,
1283 xfs_lsn_t *commitlsnp) 1296 xfs_lsn_t *commitlsnp)
@@ -1311,7 +1324,7 @@ xlog_commit_record(
1311 */ 1324 */
1312STATIC void 1325STATIC void
1313xlog_grant_push_ail( 1326xlog_grant_push_ail(
1314 struct log *log, 1327 struct xlog *log,
1315 int need_bytes) 1328 int need_bytes)
1316{ 1329{
1317 xfs_lsn_t threshold_lsn = 0; 1330 xfs_lsn_t threshold_lsn = 0;
@@ -1790,7 +1803,7 @@ xlog_write_start_rec(
1790 1803
1791static xlog_op_header_t * 1804static xlog_op_header_t *
1792xlog_write_setup_ophdr( 1805xlog_write_setup_ophdr(
1793 struct log *log, 1806 struct xlog *log,
1794 struct xlog_op_header *ophdr, 1807 struct xlog_op_header *ophdr,
1795 struct xlog_ticket *ticket, 1808 struct xlog_ticket *ticket,
1796 uint flags) 1809 uint flags)
@@ -1873,7 +1886,7 @@ xlog_write_setup_copy(
1873 1886
1874static int 1887static int
1875xlog_write_copy_finish( 1888xlog_write_copy_finish(
1876 struct log *log, 1889 struct xlog *log,
1877 struct xlog_in_core *iclog, 1890 struct xlog_in_core *iclog,
1878 uint flags, 1891 uint flags,
1879 int *record_cnt, 1892 int *record_cnt,
@@ -1958,7 +1971,7 @@ xlog_write_copy_finish(
1958 */ 1971 */
1959int 1972int
1960xlog_write( 1973xlog_write(
1961 struct log *log, 1974 struct xlog *log,
1962 struct xfs_log_vec *log_vector, 1975 struct xfs_log_vec *log_vector,
1963 struct xlog_ticket *ticket, 1976 struct xlog_ticket *ticket,
1964 xfs_lsn_t *start_lsn, 1977 xfs_lsn_t *start_lsn,
@@ -2821,7 +2834,7 @@ _xfs_log_force(
2821 uint flags, 2834 uint flags,
2822 int *log_flushed) 2835 int *log_flushed)
2823{ 2836{
2824 struct log *log = mp->m_log; 2837 struct xlog *log = mp->m_log;
2825 struct xlog_in_core *iclog; 2838 struct xlog_in_core *iclog;
2826 xfs_lsn_t lsn; 2839 xfs_lsn_t lsn;
2827 2840
@@ -2969,7 +2982,7 @@ _xfs_log_force_lsn(
2969 uint flags, 2982 uint flags,
2970 int *log_flushed) 2983 int *log_flushed)
2971{ 2984{
2972 struct log *log = mp->m_log; 2985 struct xlog *log = mp->m_log;
2973 struct xlog_in_core *iclog; 2986 struct xlog_in_core *iclog;
2974 int already_slept = 0; 2987 int already_slept = 0;
2975 2988
@@ -3147,7 +3160,7 @@ xfs_log_ticket_get(
3147 */ 3160 */
3148xlog_ticket_t * 3161xlog_ticket_t *
3149xlog_ticket_alloc( 3162xlog_ticket_alloc(
3150 struct log *log, 3163 struct xlog *log,
3151 int unit_bytes, 3164 int unit_bytes,
3152 int cnt, 3165 int cnt,
3153 char client, 3166 char client,
@@ -3278,7 +3291,7 @@ xlog_ticket_alloc(
3278 */ 3291 */
3279void 3292void
3280xlog_verify_dest_ptr( 3293xlog_verify_dest_ptr(
3281 struct log *log, 3294 struct xlog *log,
3282 char *ptr) 3295 char *ptr)
3283{ 3296{
3284 int i; 3297 int i;
@@ -3307,7 +3320,7 @@ xlog_verify_dest_ptr(
3307 */ 3320 */
3308STATIC void 3321STATIC void
3309xlog_verify_grant_tail( 3322xlog_verify_grant_tail(
3310 struct log *log) 3323 struct xlog *log)
3311{ 3324{
3312 int tail_cycle, tail_blocks; 3325 int tail_cycle, tail_blocks;
3313 int cycle, space; 3326 int cycle, space;
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 7d6197c58493..ddc4529d07d3 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -44,7 +44,7 @@
44 */ 44 */
45static struct xlog_ticket * 45static struct xlog_ticket *
46xlog_cil_ticket_alloc( 46xlog_cil_ticket_alloc(
47 struct log *log) 47 struct xlog *log)
48{ 48{
49 struct xlog_ticket *tic; 49 struct xlog_ticket *tic;
50 50
@@ -72,7 +72,7 @@ xlog_cil_ticket_alloc(
72 */ 72 */
73void 73void
74xlog_cil_init_post_recovery( 74xlog_cil_init_post_recovery(
75 struct log *log) 75 struct xlog *log)
76{ 76{
77 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log); 77 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log);
78 log->l_cilp->xc_ctx->sequence = 1; 78 log->l_cilp->xc_ctx->sequence = 1;
@@ -182,7 +182,7 @@ xlog_cil_prepare_log_vecs(
182 */ 182 */
183STATIC void 183STATIC void
184xfs_cil_prepare_item( 184xfs_cil_prepare_item(
185 struct log *log, 185 struct xlog *log,
186 struct xfs_log_vec *lv, 186 struct xfs_log_vec *lv,
187 int *len, 187 int *len,
188 int *diff_iovecs) 188 int *diff_iovecs)
@@ -231,7 +231,7 @@ xfs_cil_prepare_item(
231 */ 231 */
232static void 232static void
233xlog_cil_insert_items( 233xlog_cil_insert_items(
234 struct log *log, 234 struct xlog *log,
235 struct xfs_log_vec *log_vector, 235 struct xfs_log_vec *log_vector,
236 struct xlog_ticket *ticket) 236 struct xlog_ticket *ticket)
237{ 237{
@@ -373,7 +373,7 @@ xlog_cil_committed(
373 */ 373 */
374STATIC int 374STATIC int
375xlog_cil_push( 375xlog_cil_push(
376 struct log *log) 376 struct xlog *log)
377{ 377{
378 struct xfs_cil *cil = log->l_cilp; 378 struct xfs_cil *cil = log->l_cilp;
379 struct xfs_log_vec *lv; 379 struct xfs_log_vec *lv;
@@ -601,7 +601,7 @@ xlog_cil_push_work(
601 */ 601 */
602static void 602static void
603xlog_cil_push_background( 603xlog_cil_push_background(
604 struct log *log) 604 struct xlog *log)
605{ 605{
606 struct xfs_cil *cil = log->l_cilp; 606 struct xfs_cil *cil = log->l_cilp;
607 607
@@ -629,7 +629,7 @@ xlog_cil_push_background(
629 629
630static void 630static void
631xlog_cil_push_foreground( 631xlog_cil_push_foreground(
632 struct log *log, 632 struct xlog *log,
633 xfs_lsn_t push_seq) 633 xfs_lsn_t push_seq)
634{ 634{
635 struct xfs_cil *cil = log->l_cilp; 635 struct xfs_cil *cil = log->l_cilp;
@@ -683,7 +683,7 @@ xfs_log_commit_cil(
683 xfs_lsn_t *commit_lsn, 683 xfs_lsn_t *commit_lsn,
684 int flags) 684 int flags)
685{ 685{
686 struct log *log = mp->m_log; 686 struct xlog *log = mp->m_log;
687 int log_flags = 0; 687 int log_flags = 0;
688 struct xfs_log_vec *log_vector; 688 struct xfs_log_vec *log_vector;
689 689
@@ -754,7 +754,7 @@ xfs_log_commit_cil(
754 */ 754 */
755xfs_lsn_t 755xfs_lsn_t
756xlog_cil_force_lsn( 756xlog_cil_force_lsn(
757 struct log *log, 757 struct xlog *log,
758 xfs_lsn_t sequence) 758 xfs_lsn_t sequence)
759{ 759{
760 struct xfs_cil *cil = log->l_cilp; 760 struct xfs_cil *cil = log->l_cilp;
@@ -833,7 +833,7 @@ xfs_log_item_in_current_chkpt(
833 */ 833 */
834int 834int
835xlog_cil_init( 835xlog_cil_init(
836 struct log *log) 836 struct xlog *log)
837{ 837{
838 struct xfs_cil *cil; 838 struct xfs_cil *cil;
839 struct xfs_cil_ctx *ctx; 839 struct xfs_cil_ctx *ctx;
@@ -869,7 +869,7 @@ xlog_cil_init(
869 869
870void 870void
871xlog_cil_destroy( 871xlog_cil_destroy(
872 struct log *log) 872 struct xlog *log)
873{ 873{
874 if (log->l_cilp->xc_ctx) { 874 if (log->l_cilp->xc_ctx) {
875 if (log->l_cilp->xc_ctx->ticket) 875 if (log->l_cilp->xc_ctx->ticket)
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 5bc33261f5be..72eba2201b14 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -19,7 +19,7 @@
19#define __XFS_LOG_PRIV_H__ 19#define __XFS_LOG_PRIV_H__
20 20
21struct xfs_buf; 21struct xfs_buf;
22struct log; 22struct xlog;
23struct xlog_ticket; 23struct xlog_ticket;
24struct xfs_mount; 24struct xfs_mount;
25 25
@@ -352,7 +352,7 @@ typedef struct xlog_in_core {
352 struct xlog_in_core *ic_next; 352 struct xlog_in_core *ic_next;
353 struct xlog_in_core *ic_prev; 353 struct xlog_in_core *ic_prev;
354 struct xfs_buf *ic_bp; 354 struct xfs_buf *ic_bp;
355 struct log *ic_log; 355 struct xlog *ic_log;
356 int ic_size; 356 int ic_size;
357 int ic_offset; 357 int ic_offset;
358 int ic_bwritecnt; 358 int ic_bwritecnt;
@@ -409,7 +409,7 @@ struct xfs_cil_ctx {
409 * operations almost as efficient as the old logging methods. 409 * operations almost as efficient as the old logging methods.
410 */ 410 */
411struct xfs_cil { 411struct xfs_cil {
412 struct log *xc_log; 412 struct xlog *xc_log;
413 struct list_head xc_cil; 413 struct list_head xc_cil;
414 spinlock_t xc_cil_lock; 414 spinlock_t xc_cil_lock;
415 struct xfs_cil_ctx *xc_ctx; 415 struct xfs_cil_ctx *xc_ctx;
@@ -487,7 +487,7 @@ struct xlog_grant_head {
487 * overflow 31 bits worth of byte offset, so using a byte number will mean 487 * overflow 31 bits worth of byte offset, so using a byte number will mean
488 * that round off problems won't occur when releasing partial reservations. 488 * that round off problems won't occur when releasing partial reservations.
489 */ 489 */
490typedef struct log { 490typedef struct xlog {
491 /* The following fields don't need locking */ 491 /* The following fields don't need locking */
492 struct xfs_mount *l_mp; /* mount point */ 492 struct xfs_mount *l_mp; /* mount point */
493 struct xfs_ail *l_ailp; /* AIL log is working with */ 493 struct xfs_ail *l_ailp; /* AIL log is working with */
@@ -553,9 +553,14 @@ extern int xlog_recover_finish(xlog_t *log);
553extern void xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int); 553extern void xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int);
554 554
555extern kmem_zone_t *xfs_log_ticket_zone; 555extern kmem_zone_t *xfs_log_ticket_zone;
556struct xlog_ticket *xlog_ticket_alloc(struct log *log, int unit_bytes, 556struct xlog_ticket *
557 int count, char client, bool permanent, 557xlog_ticket_alloc(
558 xfs_km_flags_t alloc_flags); 558 struct xlog *log,
559 int unit_bytes,
560 int count,
561 char client,
562 bool permanent,
563 xfs_km_flags_t alloc_flags);
559 564
560 565
561static inline void 566static inline void
@@ -567,9 +572,14 @@ xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)
567} 572}
568 573
569void xlog_print_tic_res(struct xfs_mount *mp, struct xlog_ticket *ticket); 574void xlog_print_tic_res(struct xfs_mount *mp, struct xlog_ticket *ticket);
570int xlog_write(struct log *log, struct xfs_log_vec *log_vector, 575int
571 struct xlog_ticket *tic, xfs_lsn_t *start_lsn, 576xlog_write(
572 xlog_in_core_t **commit_iclog, uint flags); 577 struct xlog *log,
578 struct xfs_log_vec *log_vector,
579 struct xlog_ticket *tic,
580 xfs_lsn_t *start_lsn,
581 struct xlog_in_core **commit_iclog,
582 uint flags);
573 583
574/* 584/*
575 * When we crack an atomic LSN, we sample it first so that the value will not 585 * When we crack an atomic LSN, we sample it first so that the value will not
@@ -629,17 +639,23 @@ xlog_assign_grant_head(atomic64_t *head, int cycle, int space)
629/* 639/*
630 * Committed Item List interfaces 640 * Committed Item List interfaces
631 */ 641 */
632int xlog_cil_init(struct log *log); 642int
633void xlog_cil_init_post_recovery(struct log *log); 643xlog_cil_init(struct xlog *log);
634void xlog_cil_destroy(struct log *log); 644void
645xlog_cil_init_post_recovery(struct xlog *log);
646void
647xlog_cil_destroy(struct xlog *log);
635 648
636/* 649/*
637 * CIL force routines 650 * CIL force routines
638 */ 651 */
639xfs_lsn_t xlog_cil_force_lsn(struct log *log, xfs_lsn_t sequence); 652xfs_lsn_t
653xlog_cil_force_lsn(
654 struct xlog *log,
655 xfs_lsn_t sequence);
640 656
641static inline void 657static inline void
642xlog_cil_force(struct log *log) 658xlog_cil_force(struct xlog *log)
643{ 659{
644 xlog_cil_force_lsn(log, log->l_cilp->xc_current_sequence); 660 xlog_cil_force_lsn(log, log->l_cilp->xc_current_sequence);
645} 661}
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index ca386909131a..a7be98abd6a9 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1471,8 +1471,8 @@ xlog_recover_add_item(
1471 1471
1472STATIC int 1472STATIC int
1473xlog_recover_add_to_cont_trans( 1473xlog_recover_add_to_cont_trans(
1474 struct log *log, 1474 struct xlog *log,
1475 xlog_recover_t *trans, 1475 struct xlog_recover *trans,
1476 xfs_caddr_t dp, 1476 xfs_caddr_t dp,
1477 int len) 1477 int len)
1478{ 1478{
@@ -1517,8 +1517,8 @@ xlog_recover_add_to_cont_trans(
1517 */ 1517 */
1518STATIC int 1518STATIC int
1519xlog_recover_add_to_trans( 1519xlog_recover_add_to_trans(
1520 struct log *log, 1520 struct xlog *log,
1521 xlog_recover_t *trans, 1521 struct xlog_recover *trans,
1522 xfs_caddr_t dp, 1522 xfs_caddr_t dp,
1523 int len) 1523 int len)
1524{ 1524{
@@ -1588,8 +1588,8 @@ xlog_recover_add_to_trans(
1588 */ 1588 */
1589STATIC int 1589STATIC int
1590xlog_recover_reorder_trans( 1590xlog_recover_reorder_trans(
1591 struct log *log, 1591 struct xlog *log,
1592 xlog_recover_t *trans, 1592 struct xlog_recover *trans,
1593 int pass) 1593 int pass)
1594{ 1594{
1595 xlog_recover_item_t *item, *n; 1595 xlog_recover_item_t *item, *n;
@@ -1642,8 +1642,8 @@ xlog_recover_reorder_trans(
1642 */ 1642 */
1643STATIC int 1643STATIC int
1644xlog_recover_buffer_pass1( 1644xlog_recover_buffer_pass1(
1645 struct log *log, 1645 struct xlog *log,
1646 xlog_recover_item_t *item) 1646 struct xlog_recover_item *item)
1647{ 1647{
1648 xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr; 1648 xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr;
1649 struct list_head *bucket; 1649 struct list_head *bucket;
@@ -1696,7 +1696,7 @@ xlog_recover_buffer_pass1(
1696 */ 1696 */
1697STATIC int 1697STATIC int
1698xlog_check_buffer_cancelled( 1698xlog_check_buffer_cancelled(
1699 struct log *log, 1699 struct xlog *log,
1700 xfs_daddr_t blkno, 1700 xfs_daddr_t blkno,
1701 uint len, 1701 uint len,
1702 ushort flags) 1702 ushort flags)
@@ -2689,9 +2689,9 @@ xlog_recover_free_trans(
2689 2689
2690STATIC int 2690STATIC int
2691xlog_recover_commit_pass1( 2691xlog_recover_commit_pass1(
2692 struct log *log, 2692 struct xlog *log,
2693 struct xlog_recover *trans, 2693 struct xlog_recover *trans,
2694 xlog_recover_item_t *item) 2694 struct xlog_recover_item *item)
2695{ 2695{
2696 trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS1); 2696 trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS1);
2697 2697
@@ -2716,10 +2716,10 @@ xlog_recover_commit_pass1(
2716 2716
2717STATIC int 2717STATIC int
2718xlog_recover_commit_pass2( 2718xlog_recover_commit_pass2(
2719 struct log *log, 2719 struct xlog *log,
2720 struct xlog_recover *trans, 2720 struct xlog_recover *trans,
2721 struct list_head *buffer_list, 2721 struct list_head *buffer_list,
2722 xlog_recover_item_t *item) 2722 struct xlog_recover_item *item)
2723{ 2723{
2724 trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2); 2724 trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2);
2725 2725
@@ -2753,7 +2753,7 @@ xlog_recover_commit_pass2(
2753 */ 2753 */
2754STATIC int 2754STATIC int
2755xlog_recover_commit_trans( 2755xlog_recover_commit_trans(
2756 struct log *log, 2756 struct xlog *log,
2757 struct xlog_recover *trans, 2757 struct xlog_recover *trans,
2758 int pass) 2758 int pass)
2759{ 2759{
@@ -2793,8 +2793,8 @@ out:
2793 2793
2794STATIC int 2794STATIC int
2795xlog_recover_unmount_trans( 2795xlog_recover_unmount_trans(
2796 struct log *log, 2796 struct xlog *log,
2797 xlog_recover_t *trans) 2797 struct xlog_recover *trans)
2798{ 2798{
2799 /* Do nothing now */ 2799 /* Do nothing now */
2800 xfs_warn(log->l_mp, "%s: Unmount LR", __func__); 2800 xfs_warn(log->l_mp, "%s: Unmount LR", __func__);
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 8b89c5ac72d9..90c1fc9eaea4 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -53,7 +53,7 @@ typedef struct xfs_trans_reservations {
53 53
54#include "xfs_sync.h" 54#include "xfs_sync.h"
55 55
56struct log; 56struct xlog;
57struct xfs_mount_args; 57struct xfs_mount_args;
58struct xfs_inode; 58struct xfs_inode;
59struct xfs_bmbt_irec; 59struct xfs_bmbt_irec;
@@ -133,7 +133,7 @@ typedef struct xfs_mount {
133 uint m_readio_blocks; /* min read size blocks */ 133 uint m_readio_blocks; /* min read size blocks */
134 uint m_writeio_log; /* min write size log bytes */ 134 uint m_writeio_log; /* min write size log bytes */
135 uint m_writeio_blocks; /* min write size blocks */ 135 uint m_writeio_blocks; /* min write size blocks */
136 struct log *m_log; /* log specific stuff */ 136 struct xlog *m_log; /* log specific stuff */
137 int m_logbufs; /* number of log buffers */ 137 int m_logbufs; /* number of log buffers */
138 int m_logbsize; /* size of each log buffer */ 138 int m_logbsize; /* size of each log buffer */
139 uint m_rsumlevels; /* rt summary levels */ 139 uint m_rsumlevels; /* rt summary levels */
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c
index c9d3409c5ca3..1e9ee064dbb2 100644
--- a/fs/xfs/xfs_sync.c
+++ b/fs/xfs/xfs_sync.c
@@ -386,23 +386,23 @@ xfs_sync_worker(
386 * We shouldn't write/force the log if we are in the mount/unmount 386 * We shouldn't write/force the log if we are in the mount/unmount
387 * process or on a read only filesystem. The workqueue still needs to be 387 * process or on a read only filesystem. The workqueue still needs to be
388 * active in both cases, however, because it is used for inode reclaim 388 * active in both cases, however, because it is used for inode reclaim
389 * during these times. Use the s_umount semaphore to provide exclusion 389 * during these times. Use the MS_ACTIVE flag to avoid doing anything
390 * with unmount. 390 * during mount. Doing work during unmount is avoided by calling
391 * cancel_delayed_work_sync on this work queue before tearing down
392 * the ail and the log in xfs_log_unmount.
391 */ 393 */
392 if (down_read_trylock(&mp->m_super->s_umount)) { 394 if (!(mp->m_super->s_flags & MS_ACTIVE) &&
393 if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { 395 !(mp->m_flags & XFS_MOUNT_RDONLY)) {
394 /* dgc: errors ignored here */ 396 /* dgc: errors ignored here */
395 if (mp->m_super->s_frozen == SB_UNFROZEN && 397 if (mp->m_super->s_frozen == SB_UNFROZEN &&
396 xfs_log_need_covered(mp)) 398 xfs_log_need_covered(mp))
397 error = xfs_fs_log_dummy(mp); 399 error = xfs_fs_log_dummy(mp);
398 else 400 else
399 xfs_log_force(mp, 0); 401 xfs_log_force(mp, 0);
400 402
401 /* start pushing all the metadata that is currently 403 /* start pushing all the metadata that is currently
402 * dirty */ 404 * dirty */
403 xfs_ail_push_all(mp->m_ail); 405 xfs_ail_push_all(mp->m_ail);
404 }
405 up_read(&mp->m_super->s_umount);
406 } 406 }
407 407
408 /* queue us up again */ 408 /* queue us up again */
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 7cf9d3529e51..caf5dabfd553 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -32,7 +32,7 @@ struct xfs_da_node_entry;
32struct xfs_dquot; 32struct xfs_dquot;
33struct xfs_log_item; 33struct xfs_log_item;
34struct xlog_ticket; 34struct xlog_ticket;
35struct log; 35struct xlog;
36struct xlog_recover; 36struct xlog_recover;
37struct xlog_recover_item; 37struct xlog_recover_item;
38struct xfs_buf_log_format; 38struct xfs_buf_log_format;
@@ -762,7 +762,7 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_force);
762DEFINE_DQUOT_EVENT(xfs_dqflush_done); 762DEFINE_DQUOT_EVENT(xfs_dqflush_done);
763 763
764DECLARE_EVENT_CLASS(xfs_loggrant_class, 764DECLARE_EVENT_CLASS(xfs_loggrant_class,
765 TP_PROTO(struct log *log, struct xlog_ticket *tic), 765 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
766 TP_ARGS(log, tic), 766 TP_ARGS(log, tic),
767 TP_STRUCT__entry( 767 TP_STRUCT__entry(
768 __field(dev_t, dev) 768 __field(dev_t, dev)
@@ -830,7 +830,7 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class,
830 830
831#define DEFINE_LOGGRANT_EVENT(name) \ 831#define DEFINE_LOGGRANT_EVENT(name) \
832DEFINE_EVENT(xfs_loggrant_class, name, \ 832DEFINE_EVENT(xfs_loggrant_class, name, \
833 TP_PROTO(struct log *log, struct xlog_ticket *tic), \ 833 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
834 TP_ARGS(log, tic)) 834 TP_ARGS(log, tic))
835DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); 835DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
836DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); 836DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
@@ -1664,7 +1664,7 @@ DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1664DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after); 1664DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1665 1665
1666DECLARE_EVENT_CLASS(xfs_log_recover_item_class, 1666DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1667 TP_PROTO(struct log *log, struct xlog_recover *trans, 1667 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
1668 struct xlog_recover_item *item, int pass), 1668 struct xlog_recover_item *item, int pass),
1669 TP_ARGS(log, trans, item, pass), 1669 TP_ARGS(log, trans, item, pass),
1670 TP_STRUCT__entry( 1670 TP_STRUCT__entry(
@@ -1698,7 +1698,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1698 1698
1699#define DEFINE_LOG_RECOVER_ITEM(name) \ 1699#define DEFINE_LOG_RECOVER_ITEM(name) \
1700DEFINE_EVENT(xfs_log_recover_item_class, name, \ 1700DEFINE_EVENT(xfs_log_recover_item_class, name, \
1701 TP_PROTO(struct log *log, struct xlog_recover *trans, \ 1701 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
1702 struct xlog_recover_item *item, int pass), \ 1702 struct xlog_recover_item *item, int pass), \
1703 TP_ARGS(log, trans, item, pass)) 1703 TP_ARGS(log, trans, item, pass))
1704 1704
@@ -1709,7 +1709,7 @@ DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1709DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover); 1709DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1710 1710
1711DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class, 1711DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1712 TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), 1712 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
1713 TP_ARGS(log, buf_f), 1713 TP_ARGS(log, buf_f),
1714 TP_STRUCT__entry( 1714 TP_STRUCT__entry(
1715 __field(dev_t, dev) 1715 __field(dev_t, dev)
@@ -1739,7 +1739,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1739 1739
1740#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \ 1740#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1741DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \ 1741DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1742 TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \ 1742 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
1743 TP_ARGS(log, buf_f)) 1743 TP_ARGS(log, buf_f))
1744 1744
1745DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel); 1745DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
@@ -1752,7 +1752,7 @@ DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1752DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf); 1752DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1753 1753
1754DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class, 1754DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1755 TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), 1755 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
1756 TP_ARGS(log, in_f), 1756 TP_ARGS(log, in_f),
1757 TP_STRUCT__entry( 1757 TP_STRUCT__entry(
1758 __field(dev_t, dev) 1758 __field(dev_t, dev)
@@ -1790,7 +1790,7 @@ DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1790) 1790)
1791#define DEFINE_LOG_RECOVER_INO_ITEM(name) \ 1791#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1792DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \ 1792DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
1793 TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \ 1793 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
1794 TP_ARGS(log, in_f)) 1794 TP_ARGS(log, in_f))
1795 1795
1796DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover); 1796DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 9f02005f217a..7d10f962aa13 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -2,12 +2,19 @@
2#define _ASM_GENERIC_BUG_H 2#define _ASM_GENERIC_BUG_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5
6#ifdef CONFIG_GENERIC_BUG
7#define BUGFLAG_WARNING (1 << 0)
8#define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8))
9#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
10#endif
11
12#ifndef __ASSEMBLY__
5#include <linux/kernel.h> 13#include <linux/kernel.h>
6 14
7#ifdef CONFIG_BUG 15#ifdef CONFIG_BUG
8 16
9#ifdef CONFIG_GENERIC_BUG 17#ifdef CONFIG_GENERIC_BUG
10#ifndef __ASSEMBLY__
11struct bug_entry { 18struct bug_entry {
12#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 19#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
13 unsigned long bug_addr; 20 unsigned long bug_addr;
@@ -24,12 +31,6 @@ struct bug_entry {
24#endif 31#endif
25 unsigned short flags; 32 unsigned short flags;
26}; 33};
27#endif /* __ASSEMBLY__ */
28
29#define BUGFLAG_WARNING (1 << 0)
30#define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8))
31#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
32
33#endif /* CONFIG_GENERIC_BUG */ 34#endif /* CONFIG_GENERIC_BUG */
34 35
35/* 36/*
@@ -61,7 +62,6 @@ struct bug_entry {
61 * to provide better diagnostics. 62 * to provide better diagnostics.
62 */ 63 */
63#ifndef __WARN_TAINT 64#ifndef __WARN_TAINT
64#ifndef __ASSEMBLY__
65extern __printf(3, 4) 65extern __printf(3, 4)
66void warn_slowpath_fmt(const char *file, const int line, 66void warn_slowpath_fmt(const char *file, const int line,
67 const char *fmt, ...); 67 const char *fmt, ...);
@@ -70,7 +70,6 @@ void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint,
70 const char *fmt, ...); 70 const char *fmt, ...);
71extern void warn_slowpath_null(const char *file, const int line); 71extern void warn_slowpath_null(const char *file, const int line);
72#define WANT_WARN_ON_SLOWPATH 72#define WANT_WARN_ON_SLOWPATH
73#endif
74#define __WARN() warn_slowpath_null(__FILE__, __LINE__) 73#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
75#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) 74#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
76#define __WARN_printf_taint(taint, arg...) \ 75#define __WARN_printf_taint(taint, arg...) \
@@ -203,4 +202,6 @@ extern void warn_slowpath_null(const char *file, const int line);
203# define WARN_ON_SMP(x) ({0;}) 202# define WARN_ON_SMP(x) ({0;})
204#endif 203#endif
205 204
205#endif /* __ASSEMBLY__ */
206
206#endif 207#endif
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 6f2b45a9b6bc..ff4947b7a976 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -484,6 +484,16 @@ static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd)
484 /* 484 /*
485 * The barrier will stabilize the pmdval in a register or on 485 * The barrier will stabilize the pmdval in a register or on
486 * the stack so that it will stop changing under the code. 486 * the stack so that it will stop changing under the code.
487 *
488 * When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE,
489 * pmd_read_atomic is allowed to return a not atomic pmdval
490 * (for example pointing to an hugepage that has never been
491 * mapped in the pmd). The below checks will only care about
492 * the low part of the pmd with 32bit PAE x86 anyway, with the
493 * exception of pmd_none(). So the important thing is that if
494 * the low part of the pmd is found null, the high part will
495 * be also null or the pmd_none() check below would be
496 * confused.
487 */ 497 */
488#ifdef CONFIG_TRANSPARENT_HUGEPAGE 498#ifdef CONFIG_TRANSPARENT_HUGEPAGE
489 barrier(); 499 barrier();
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 81368ab6c611..a7aec391b7b7 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -1,7 +1,3 @@
1/*
2 This file is auto-generated from the drm_pciids.txt in the DRM CVS
3 Please contact dri-devel@lists.sf.net to add new cards to this list
4*/
5#define radeon_PCI_IDS \ 1#define radeon_PCI_IDS \
6 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 2 {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
7 {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 3 {0x1002, 0x3151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 2314ad8b3c9c..b1a520ec8b59 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -140,6 +140,7 @@ struct kiocb {
140 (x)->ki_dtor = NULL; \ 140 (x)->ki_dtor = NULL; \
141 (x)->ki_obj.tsk = tsk; \ 141 (x)->ki_obj.tsk = tsk; \
142 (x)->ki_user_data = 0; \ 142 (x)->ki_user_data = 0; \
143 (x)->private = NULL; \
143 } while (0) 144 } while (0)
144 145
145#define AIO_RING_MAGIC 0xa10a10a1 146#define AIO_RING_MAGIC 0xa10a10a1
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ba43f408baa3..07954b05b86c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -827,7 +827,6 @@ extern bool __blk_end_request_err(struct request *rq, int error);
827extern void blk_complete_request(struct request *); 827extern void blk_complete_request(struct request *);
828extern void __blk_complete_request(struct request *); 828extern void __blk_complete_request(struct request *);
829extern void blk_abort_request(struct request *); 829extern void blk_abort_request(struct request *);
830extern void blk_abort_queue(struct request_queue *);
831extern void blk_unprep_request(struct request *); 830extern void blk_unprep_request(struct request *);
832 831
833/* 832/*
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index e5834aa24b9e..6a6d7aefe12d 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -47,9 +47,9 @@
47 */ 47 */
48#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ 48#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
49 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) 49 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
50# define inline inline __attribute__((always_inline)) 50# define inline inline __attribute__((always_inline)) notrace
51# define __inline__ __inline__ __attribute__((always_inline)) 51# define __inline__ __inline__ __attribute__((always_inline)) notrace
52# define __inline __inline __attribute__((always_inline)) 52# define __inline __inline __attribute__((always_inline)) notrace
53#else 53#else
54/* A lot of inline functions can cause havoc with function tracing */ 54/* A lot of inline functions can cause havoc with function tracing */
55# define inline inline notrace 55# define inline inline notrace
diff --git a/include/linux/input.h b/include/linux/input.h
index a81671453575..2740d080ec6b 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -116,6 +116,7 @@ struct input_keymap_entry {
116 116
117/** 117/**
118 * EVIOCGMTSLOTS(len) - get MT slot values 118 * EVIOCGMTSLOTS(len) - get MT slot values
119 * @len: size of the data buffer in bytes
119 * 120 *
120 * The ioctl buffer argument should be binary equivalent to 121 * The ioctl buffer argument should be binary equivalent to
121 * 122 *
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 61f5cec031e0..a5261e3d2e3c 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -301,8 +301,6 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
301 * @irq_pm_shutdown: function called from core code on shutdown once per chip 301 * @irq_pm_shutdown: function called from core code on shutdown once per chip
302 * @irq_print_chip: optional to print special chip info in show_interrupts 302 * @irq_print_chip: optional to print special chip info in show_interrupts
303 * @flags: chip specific flags 303 * @flags: chip specific flags
304 *
305 * @release: release function solely used by UML
306 */ 304 */
307struct irq_chip { 305struct irq_chip {
308 const char *name; 306 const char *name;
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 35f7237ec972..d6bd50110ec2 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -21,6 +21,7 @@
21 * is passed to the kernel. 21 * is passed to the kernel.
22 */ 22 */
23enum kmsg_dump_reason { 23enum kmsg_dump_reason {
24 KMSG_DUMP_UNDEF,
24 KMSG_DUMP_PANIC, 25 KMSG_DUMP_PANIC,
25 KMSG_DUMP_OOPS, 26 KMSG_DUMP_OOPS,
26 KMSG_DUMP_EMERG, 27 KMSG_DUMP_EMERG,
@@ -31,23 +32,37 @@ enum kmsg_dump_reason {
31 32
32/** 33/**
33 * struct kmsg_dumper - kernel crash message dumper structure 34 * struct kmsg_dumper - kernel crash message dumper structure
34 * @dump: The callback which gets called on crashes. The buffer is passed
35 * as two sections, where s1 (length l1) contains the older
36 * messages and s2 (length l2) contains the newer.
37 * @list: Entry in the dumper list (private) 35 * @list: Entry in the dumper list (private)
36 * @dump: Call into dumping code which will retrieve the data with
37 * through the record iterator
38 * @max_reason: filter for highest reason number that should be dumped
38 * @registered: Flag that specifies if this is already registered 39 * @registered: Flag that specifies if this is already registered
39 */ 40 */
40struct kmsg_dumper { 41struct kmsg_dumper {
41 void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason,
42 const char *s1, unsigned long l1,
43 const char *s2, unsigned long l2);
44 struct list_head list; 42 struct list_head list;
45 int registered; 43 void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
44 enum kmsg_dump_reason max_reason;
45 bool active;
46 bool registered;
47
48 /* private state of the kmsg iterator */
49 u32 cur_idx;
50 u32 next_idx;
51 u64 cur_seq;
52 u64 next_seq;
46}; 53};
47 54
48#ifdef CONFIG_PRINTK 55#ifdef CONFIG_PRINTK
49void kmsg_dump(enum kmsg_dump_reason reason); 56void kmsg_dump(enum kmsg_dump_reason reason);
50 57
58bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
59 char *line, size_t size, size_t *len);
60
61bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
62 char *buf, size_t size, size_t *len);
63
64void kmsg_dump_rewind(struct kmsg_dumper *dumper);
65
51int kmsg_dump_register(struct kmsg_dumper *dumper); 66int kmsg_dump_register(struct kmsg_dumper *dumper);
52 67
53int kmsg_dump_unregister(struct kmsg_dumper *dumper); 68int kmsg_dump_unregister(struct kmsg_dumper *dumper);
@@ -56,6 +71,22 @@ static inline void kmsg_dump(enum kmsg_dump_reason reason)
56{ 71{
57} 72}
58 73
74static inline bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
75 const char *line, size_t size, size_t *len)
76{
77 return false;
78}
79
80static inline bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
81 char *buf, size_t size, size_t *len)
82{
83 return false;
84}
85
86static inline void kmsg_dump_rewind(struct kmsg_dumper *dumper)
87{
88}
89
59static inline int kmsg_dump_register(struct kmsg_dumper *dumper) 90static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
60{ 91{
61 return -EINVAL; 92 return -EINVAL;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c4464356b35b..96c158a37d3e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -815,7 +815,7 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
815#ifdef CONFIG_HAVE_KVM_EVENTFD 815#ifdef CONFIG_HAVE_KVM_EVENTFD
816 816
817void kvm_eventfd_init(struct kvm *kvm); 817void kvm_eventfd_init(struct kvm *kvm);
818int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags); 818int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
819void kvm_irqfd_release(struct kvm *kvm); 819void kvm_irqfd_release(struct kvm *kvm);
820void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 820void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
821int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 821int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
@@ -824,7 +824,7 @@ int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
824 824
825static inline void kvm_eventfd_init(struct kvm *kvm) {} 825static inline void kvm_eventfd_init(struct kvm *kvm) {}
826 826
827static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags) 827static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
828{ 828{
829 return -EINVAL; 829 return -EINVAL;
830} 830}
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index dad95bdd06d7..704a626d94a0 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -57,8 +57,18 @@ struct page {
57 }; 57 };
58 58
59 union { 59 union {
60#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE) && \
61 defined(CONFIG_HAVE_ALIGNED_STRUCT_PAGE)
60 /* Used for cmpxchg_double in slub */ 62 /* Used for cmpxchg_double in slub */
61 unsigned long counters; 63 unsigned long counters;
64#else
65 /*
66 * Keep _count separate from slub cmpxchg_double data.
67 * As the rest of the double word is protected by
68 * slab_lock but _count is not.
69 */
70 unsigned counters;
71#endif
62 72
63 struct { 73 struct {
64 74
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
index 5cdc96da9dd5..e78c0e236e9d 100644
--- a/include/linux/mmc/sdhci-spear.h
+++ b/include/linux/mmc/sdhci-spear.h
@@ -4,7 +4,7 @@
4 * SDHCI declarations specific to ST SPEAr platform 4 * SDHCI declarations specific to ST SPEAr platform
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index c9fe66c58f8f..17446d3c3602 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -98,7 +98,9 @@
98 98
99#define SDIO_CCCR_IF 0x07 /* bus interface controls */ 99#define SDIO_CCCR_IF 0x07 /* bus interface controls */
100 100
101#define SDIO_BUS_WIDTH_MASK 0x03 /* data bus width setting */
101#define SDIO_BUS_WIDTH_1BIT 0x00 102#define SDIO_BUS_WIDTH_1BIT 0x00
103#define SDIO_BUS_WIDTH_RESERVED 0x01
102#define SDIO_BUS_WIDTH_4BIT 0x02 104#define SDIO_BUS_WIDTH_4BIT 0x02
103#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */ 105#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
104#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */ 106#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index fbb78fb09bd2..f58325a1d8fb 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -25,6 +25,7 @@ struct nfs41_impl_id;
25 */ 25 */
26struct nfs_client { 26struct nfs_client {
27 atomic_t cl_count; 27 atomic_t cl_count;
28 atomic_t cl_mds_count;
28 int cl_cons_state; /* current construction state (-ve: init error) */ 29 int cl_cons_state; /* current construction state (-ve: init error) */
29#define NFS_CS_READY 0 /* ready to be used */ 30#define NFS_CS_READY 0 /* ready to be used */
30#define NFS_CS_INITING 1 /* busy initialising */ 31#define NFS_CS_INITING 1 /* busy initialising */
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h
index a6ee9aa898bb..a7b4fc386e63 100644
--- a/include/linux/pata_arasan_cf_data.h
+++ b/include/linux/pata_arasan_cf_data.h
@@ -4,7 +4,7 @@
4 * Arasan Compact Flash host controller platform data header file 4 * Arasan Compact Flash host controller platform data header file
5 * 5 *
6 * Copyright (C) 2011 ST Microelectronics 6 * Copyright (C) 2011 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com> 7 * Viresh Kumar <viresh.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 3988012255dc..289760f424aa 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -141,6 +141,8 @@
141 * Changing LSM security domain is considered a new privilege. So, for example, 141 * Changing LSM security domain is considered a new privilege. So, for example,
142 * asking selinux for a specific new context (e.g. with runcon) will result 142 * asking selinux for a specific new context (e.g. with runcon) will result
143 * in execve returning -EPERM. 143 * in execve returning -EPERM.
144 *
145 * See Documentation/prctl/no_new_privs.txt for more details.
144 */ 146 */
145#define PR_SET_NO_NEW_PRIVS 38 147#define PR_SET_NO_NEW_PRIVS 38
146#define PR_GET_NO_NEW_PRIVS 39 148#define PR_GET_NO_NEW_PRIVS 39
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index 7ed7fd4dba49..3b823d49a85a 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -69,12 +69,14 @@ struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
69 size_t size, 69 size_t size,
70 bool ecc); 70 bool ecc);
71void persistent_ram_free(struct persistent_ram_zone *prz); 71void persistent_ram_free(struct persistent_ram_zone *prz);
72void persistent_ram_zap(struct persistent_ram_zone *prz);
72struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, 73struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
73 bool ecc); 74 bool ecc);
74 75
75int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, 76int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
76 unsigned int count); 77 unsigned int count);
77 78
79void persistent_ram_save_old(struct persistent_ram_zone *prz);
78size_t persistent_ram_old_size(struct persistent_ram_zone *prz); 80size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
79void *persistent_ram_old(struct persistent_ram_zone *prz); 81void *persistent_ram_old(struct persistent_ram_zone *prz);
80void persistent_ram_free_old(struct persistent_ram_zone *prz); 82void persistent_ram_free_old(struct persistent_ram_zone *prz);
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 44835fb39793..f36632061c66 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -160,7 +160,9 @@ enum pxa_ssp_type {
160 PXA25x_SSP, /* pxa 210, 250, 255, 26x */ 160 PXA25x_SSP, /* pxa 210, 250, 255, 26x */
161 PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */ 161 PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */
162 PXA27x_SSP, 162 PXA27x_SSP,
163 PXA3xx_SSP,
163 PXA168_SSP, 164 PXA168_SSP,
165 PXA910_SSP,
164 CE4100_SSP, 166 CE4100_SSP,
165}; 167};
166 168
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b534a1be540a..642cb7355df3 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -225,14 +225,11 @@ enum {
225 /* device driver is going to provide hardware time stamp */ 225 /* device driver is going to provide hardware time stamp */
226 SKBTX_IN_PROGRESS = 1 << 2, 226 SKBTX_IN_PROGRESS = 1 << 2,
227 227
228 /* ensure the originating sk reference is available on driver level */
229 SKBTX_DRV_NEEDS_SK_REF = 1 << 3,
230
231 /* device driver supports TX zero-copy buffers */ 228 /* device driver supports TX zero-copy buffers */
232 SKBTX_DEV_ZEROCOPY = 1 << 4, 229 SKBTX_DEV_ZEROCOPY = 1 << 3,
233 230
234 /* generate wifi status information (where possible) */ 231 /* generate wifi status information (where possible) */
235 SKBTX_WIFI_STATUS = 1 << 5, 232 SKBTX_WIFI_STATUS = 1 << 4,
236}; 233};
237 234
238/* 235/*
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index d3e1075f7b60..c73d1445c77e 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -43,7 +43,7 @@ struct pxa2xx_spi_chip {
43 void (*cs_control)(u32 command); 43 void (*cs_control)(u32 command);
44}; 44};
45 45
46#ifdef CONFIG_ARCH_PXA 46#if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP)
47 47
48#include <linux/clk.h> 48#include <linux/clk.h>
49#include <mach/dma.h> 49#include <mach/dma.h>
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 26e5b613deda..09a545a7dfa3 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -51,7 +51,8 @@ struct partial_page {
51struct splice_pipe_desc { 51struct splice_pipe_desc {
52 struct page **pages; /* page map */ 52 struct page **pages; /* page map */
53 struct partial_page *partial; /* pages[] may not be contig */ 53 struct partial_page *partial; /* pages[] may not be contig */
54 int nr_pages; /* number of pages in map */ 54 int nr_pages; /* number of populated pages in map */
55 unsigned int nr_pages_max; /* pages[] & partial[] arrays size */
55 unsigned int flags; /* splice flags */ 56 unsigned int flags; /* splice flags */
56 const struct pipe_buf_operations *ops;/* ops associated with output pipe */ 57 const struct pipe_buf_operations *ops;/* ops associated with output pipe */
57 void (*spd_release)(struct splice_pipe_desc *, unsigned int); 58 void (*spd_release)(struct splice_pipe_desc *, unsigned int);
@@ -85,9 +86,8 @@ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
85/* 86/*
86 * for dynamic pipe sizing 87 * for dynamic pipe sizing
87 */ 88 */
88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *); 89extern int splice_grow_spd(const struct pipe_inode_info *, struct splice_pipe_desc *);
89extern void splice_shrink_spd(struct pipe_inode_info *, 90extern void splice_shrink_spd(struct splice_pipe_desc *);
90 struct splice_pipe_desc *);
91extern void spd_release_page(struct splice_pipe_desc *, unsigned int); 91extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
92 92
93extern const struct pipe_buf_operations page_cache_pipe_buf_ops; 93extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 60da41fe9dc2..ddb419cf4530 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -7,8 +7,13 @@
7 * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs 7 * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs
8 */ 8 */
9 9
10#ifndef _LINUX_VGA_SWITCHEROO_H_
11#define _LINUX_VGA_SWITCHEROO_H_
12
10#include <linux/fb.h> 13#include <linux/fb.h>
11 14
15struct pci_dev;
16
12enum vga_switcheroo_state { 17enum vga_switcheroo_state {
13 VGA_SWITCHEROO_OFF, 18 VGA_SWITCHEROO_OFF,
14 VGA_SWITCHEROO_ON, 19 VGA_SWITCHEROO_ON,
@@ -71,3 +76,4 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return
71 76
72 77
73#endif 78#endif
79#endif /* _LINUX_VGA_SWITCHEROO_H_ */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 370d11106c11..2039c5d3292e 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2640,9 +2640,9 @@ struct v4l2_create_buffers {
2640 2640
2641/* Experimental, these three ioctls may change over the next couple of kernel 2641/* Experimental, these three ioctls may change over the next couple of kernel
2642 versions. */ 2642 versions. */
2643#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings) 2643#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
2644#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings) 2644#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
2645#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap) 2645#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
2646 2646
2647/* Reminder: when adding new ioctls please add support for them to 2647/* Reminder: when adding new ioctls please add support for them to
2648 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2648 drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 66a7b579e31c..3def64ba77fa 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1144,6 +1144,12 @@ struct extended_inquiry_info {
1144 __u8 data[240]; 1144 __u8 data[240];
1145} __packed; 1145} __packed;
1146 1146
1147#define HCI_EV_KEY_REFRESH_COMPLETE 0x30
1148struct hci_ev_key_refresh_complete {
1149 __u8 status;
1150 __le16 handle;
1151} __packed;
1152
1147#define HCI_EV_IO_CAPA_REQUEST 0x31 1153#define HCI_EV_IO_CAPA_REQUEST 0x31
1148struct hci_ev_io_capa_request { 1154struct hci_ev_io_capa_request {
1149 bdaddr_t bdaddr; 1155 bdaddr_t bdaddr;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1937c7d98304..95e39b6a02ec 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1940,6 +1940,11 @@ enum ieee80211_rate_control_changed {
1940 * to also unregister the device. If it returns 1, then mac80211 1940 * to also unregister the device. If it returns 1, then mac80211
1941 * will also go through the regular complete restart on resume. 1941 * will also go through the regular complete restart on resume.
1942 * 1942 *
1943 * @set_wakeup: Enable or disable wakeup when WoWLAN configuration is
1944 * modified. The reason is that device_set_wakeup_enable() is
1945 * supposed to be called when the configuration changes, not only
1946 * in suspend().
1947 *
1943 * @add_interface: Called when a netdevice attached to the hardware is 1948 * @add_interface: Called when a netdevice attached to the hardware is
1944 * enabled. Because it is not called for monitor mode devices, @start 1949 * enabled. Because it is not called for monitor mode devices, @start
1945 * and @stop must be implemented. 1950 * and @stop must be implemented.
@@ -2966,6 +2971,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
2966 * ieee80211_generic_frame_duration - Calculate the duration field for a frame 2971 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
2967 * @hw: pointer obtained from ieee80211_alloc_hw(). 2972 * @hw: pointer obtained from ieee80211_alloc_hw().
2968 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2973 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2974 * @band: the band to calculate the frame duration on
2969 * @frame_len: the length of the frame. 2975 * @frame_len: the length of the frame.
2970 * @rate: the rate at which the frame is going to be transmitted. 2976 * @rate: the rate at which the frame is going to be transmitted.
2971 * 2977 *
diff --git a/include/net/phonet/gprs.h b/include/net/phonet/gprs.h
index 928daf595beb..bcd525e39a0b 100644
--- a/include/net/phonet/gprs.h
+++ b/include/net/phonet/gprs.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Author: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Author: Rémi Denis-Courmont
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index e4652fe58958..fecdf31816f2 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -912,6 +912,9 @@ struct sctp_transport {
912 /* Is this structure kfree()able? */ 912 /* Is this structure kfree()able? */
913 malloced:1; 913 malloced:1;
914 914
915 /* Has this transport moved the ctsn since we last sacked */
916 __u32 sack_generation;
917
915 struct flowi fl; 918 struct flowi fl;
916 919
917 /* This is the peer's IP address and port. */ 920 /* This is the peer's IP address and port. */
@@ -1584,6 +1587,7 @@ struct sctp_association {
1584 */ 1587 */
1585 __u8 sack_needed; /* Do we need to sack the peer? */ 1588 __u8 sack_needed; /* Do we need to sack the peer? */
1586 __u32 sack_cnt; 1589 __u32 sack_cnt;
1590 __u32 sack_generation;
1587 1591
1588 /* These are capabilities which our peer advertised. */ 1592 /* These are capabilities which our peer advertised. */
1589 __u8 ecn_capable:1, /* Can peer do ECN? */ 1593 __u8 ecn_capable:1, /* Can peer do ECN? */
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h
index e7728bc14ccf..2c5d2b4d5d1e 100644
--- a/include/net/sctp/tsnmap.h
+++ b/include/net/sctp/tsnmap.h
@@ -117,7 +117,8 @@ void sctp_tsnmap_free(struct sctp_tsnmap *map);
117int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); 117int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn);
118 118
119/* Mark this TSN as seen. */ 119/* Mark this TSN as seen. */
120int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn); 120int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn,
121 struct sctp_transport *trans);
121 122
122/* Mark this TSN and all lower as seen. */ 123/* Mark this TSN and all lower as seen. */
123void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); 124void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 6efb2e1416e0..ba9698852321 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -151,6 +151,7 @@ struct scsi_device {
151 SD_LAST_BUGGY_SECTORS */ 151 SD_LAST_BUGGY_SECTORS */
152 unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */ 152 unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
153 unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */ 153 unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
154 unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */
154 unsigned is_visible:1; /* is the device visible in sysfs */ 155 unsigned is_visible:1; /* is the device visible in sysfs */
155 156
156 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ 157 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index ec3f910aa40b..0c3c2fb0f939 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -44,6 +44,7 @@ struct snd_tea575x_ops {
44 44
45struct snd_tea575x { 45struct snd_tea575x {
46 struct v4l2_device *v4l2_dev; 46 struct v4l2_device *v4l2_dev;
47 struct v4l2_file_operations fops;
47 struct video_device vd; /* video device */ 48 struct video_device vd; /* video device */
48 int radio_nr; /* radio_nr */ 49 int radio_nr; /* radio_nr */
49 bool tea5759; /* 5759 chip is present */ 50 bool tea5759; /* 5759 chip is present */
@@ -62,7 +63,7 @@ struct snd_tea575x {
62 int (*ext_init)(struct snd_tea575x *tea); 63 int (*ext_init)(struct snd_tea575x *tea);
63}; 64};
64 65
65int snd_tea575x_init(struct snd_tea575x *tea); 66int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
66void snd_tea575x_exit(struct snd_tea575x *tea); 67void snd_tea575x_exit(struct snd_tea575x *tea);
67 68
68#endif /* __SOUND_TEA575X_TUNER_H */ 69#endif /* __SOUND_TEA575X_TUNER_H */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 72fcd3069a90..2097684cf194 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -255,12 +255,17 @@ int cgroup_lock_is_held(void)
255 255
256EXPORT_SYMBOL_GPL(cgroup_lock_is_held); 256EXPORT_SYMBOL_GPL(cgroup_lock_is_held);
257 257
258static int css_unbias_refcnt(int refcnt)
259{
260 return refcnt >= 0 ? refcnt : refcnt - CSS_DEACT_BIAS;
261}
262
258/* the current nr of refs, always >= 0 whether @css is deactivated or not */ 263/* the current nr of refs, always >= 0 whether @css is deactivated or not */
259static int css_refcnt(struct cgroup_subsys_state *css) 264static int css_refcnt(struct cgroup_subsys_state *css)
260{ 265{
261 int v = atomic_read(&css->refcnt); 266 int v = atomic_read(&css->refcnt);
262 267
263 return v >= 0 ? v : v - CSS_DEACT_BIAS; 268 return css_unbias_refcnt(v);
264} 269}
265 270
266/* convenient tests for these bits */ 271/* convenient tests for these bits */
@@ -4982,10 +4987,12 @@ EXPORT_SYMBOL_GPL(__css_tryget);
4982void __css_put(struct cgroup_subsys_state *css) 4987void __css_put(struct cgroup_subsys_state *css)
4983{ 4988{
4984 struct cgroup *cgrp = css->cgroup; 4989 struct cgroup *cgrp = css->cgroup;
4990 int v;
4985 4991
4986 rcu_read_lock(); 4992 rcu_read_lock();
4987 atomic_dec(&css->refcnt); 4993 v = css_unbias_refcnt(atomic_dec_return(&css->refcnt));
4988 switch (css_refcnt(css)) { 4994
4995 switch (v) {
4989 case 1: 4996 case 1:
4990 if (notify_on_release(cgrp)) { 4997 if (notify_on_release(cgrp)) {
4991 set_bit(CGRP_RELEASABLE, &cgrp->flags); 4998 set_bit(CGRP_RELEASABLE, &cgrp->flags);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f85c0154b333..d7d71d6ec972 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -253,9 +253,9 @@ perf_cgroup_match(struct perf_event *event)
253 return !event->cgrp || event->cgrp == cpuctx->cgrp; 253 return !event->cgrp || event->cgrp == cpuctx->cgrp;
254} 254}
255 255
256static inline void perf_get_cgroup(struct perf_event *event) 256static inline bool perf_tryget_cgroup(struct perf_event *event)
257{ 257{
258 css_get(&event->cgrp->css); 258 return css_tryget(&event->cgrp->css);
259} 259}
260 260
261static inline void perf_put_cgroup(struct perf_event *event) 261static inline void perf_put_cgroup(struct perf_event *event)
@@ -484,7 +484,11 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event,
484 event->cgrp = cgrp; 484 event->cgrp = cgrp;
485 485
486 /* must be done before we fput() the file */ 486 /* must be done before we fput() the file */
487 perf_get_cgroup(event); 487 if (!perf_tryget_cgroup(event)) {
488 event->cgrp = NULL;
489 ret = -ENOENT;
490 goto out;
491 }
488 492
489 /* 493 /*
490 * all events in a group must monitor 494 * all events in a group must monitor
diff --git a/kernel/exit.c b/kernel/exit.c
index 34867cc5b42a..2f59cc334516 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -72,6 +72,18 @@ static void __unhash_process(struct task_struct *p, bool group_dead)
72 list_del_rcu(&p->tasks); 72 list_del_rcu(&p->tasks);
73 list_del_init(&p->sibling); 73 list_del_init(&p->sibling);
74 __this_cpu_dec(process_counts); 74 __this_cpu_dec(process_counts);
75 /*
76 * If we are the last child process in a pid namespace to be
77 * reaped, notify the reaper sleeping zap_pid_ns_processes().
78 */
79 if (IS_ENABLED(CONFIG_PID_NS)) {
80 struct task_struct *parent = p->real_parent;
81
82 if ((task_active_pid_ns(parent)->child_reaper == parent) &&
83 list_empty(&parent->children) &&
84 (parent->flags & PF_EXITING))
85 wake_up_process(parent);
86 }
75 } 87 }
76 list_del_rcu(&p->thread_group); 88 list_del_rcu(&p->thread_group);
77} 89}
@@ -643,6 +655,7 @@ static void exit_mm(struct task_struct * tsk)
643 mm_release(tsk, mm); 655 mm_release(tsk, mm);
644 if (!mm) 656 if (!mm)
645 return; 657 return;
658 sync_mm_rss(mm);
646 /* 659 /*
647 * Serialize with any possible pending coredump. 660 * Serialize with any possible pending coredump.
648 * We must hold mmap_sem around checking core_state 661 * We must hold mmap_sem around checking core_state
@@ -719,12 +732,6 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
719 732
720 zap_pid_ns_processes(pid_ns); 733 zap_pid_ns_processes(pid_ns);
721 write_lock_irq(&tasklist_lock); 734 write_lock_irq(&tasklist_lock);
722 /*
723 * We can not clear ->child_reaper or leave it alone.
724 * There may by stealth EXIT_DEAD tasks on ->children,
725 * forget_original_parent() must move them somewhere.
726 */
727 pid_ns->child_reaper = init_pid_ns.child_reaper;
728 } else if (father->signal->has_child_subreaper) { 735 } else if (father->signal->has_child_subreaper) {
729 struct task_struct *reaper; 736 struct task_struct *reaper;
730 737
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 16b20e38c4a1..b3c7fd554250 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -184,11 +184,31 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
184 } 184 }
185 read_unlock(&tasklist_lock); 185 read_unlock(&tasklist_lock);
186 186
187 /* Firstly reap the EXIT_ZOMBIE children we may have. */
187 do { 188 do {
188 clear_thread_flag(TIF_SIGPENDING); 189 clear_thread_flag(TIF_SIGPENDING);
189 rc = sys_wait4(-1, NULL, __WALL, NULL); 190 rc = sys_wait4(-1, NULL, __WALL, NULL);
190 } while (rc != -ECHILD); 191 } while (rc != -ECHILD);
191 192
193 /*
194 * sys_wait4() above can't reap the TASK_DEAD children.
195 * Make sure they all go away, see __unhash_process().
196 */
197 for (;;) {
198 bool need_wait = false;
199
200 read_lock(&tasklist_lock);
201 if (!list_empty(&current->children)) {
202 __set_current_state(TASK_UNINTERRUPTIBLE);
203 need_wait = true;
204 }
205 read_unlock(&tasklist_lock);
206
207 if (!need_wait)
208 break;
209 schedule();
210 }
211
192 if (pid_ns->reboot) 212 if (pid_ns->reboot)
193 current->signal->group_exit_code = pid_ns->reboot; 213 current->signal->group_exit_code = pid_ns->reboot;
194 214
diff --git a/kernel/printk.c b/kernel/printk.c
index 32462d2b364a..dba18211685e 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -193,12 +193,19 @@ static int console_may_schedule;
193 * separated by ',', and find the message after the ';' character. 193 * separated by ',', and find the message after the ';' character.
194 */ 194 */
195 195
196enum log_flags {
197 LOG_DEFAULT = 0,
198 LOG_NOCONS = 1, /* already flushed, do not print to console */
199};
200
196struct log { 201struct log {
197 u64 ts_nsec; /* timestamp in nanoseconds */ 202 u64 ts_nsec; /* timestamp in nanoseconds */
198 u16 len; /* length of entire record */ 203 u16 len; /* length of entire record */
199 u16 text_len; /* length of text buffer */ 204 u16 text_len; /* length of text buffer */
200 u16 dict_len; /* length of dictionary buffer */ 205 u16 dict_len; /* length of dictionary buffer */
201 u16 level; /* syslog level + facility */ 206 u8 facility; /* syslog facility */
207 u8 flags:5; /* internal record flags */
208 u8 level:3; /* syslog level */
202}; 209};
203 210
204/* 211/*
@@ -227,10 +234,10 @@ static u32 clear_idx;
227#define LOG_LINE_MAX 1024 234#define LOG_LINE_MAX 1024
228 235
229/* record buffer */ 236/* record buffer */
230#if !defined(CONFIG_64BIT) || defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) 237#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
231#define LOG_ALIGN 4 238#define LOG_ALIGN 4
232#else 239#else
233#define LOG_ALIGN 8 240#define LOG_ALIGN __alignof__(struct log)
234#endif 241#endif
235#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) 242#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
236static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); 243static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
@@ -286,6 +293,7 @@ static u32 log_next(u32 idx)
286 293
287/* insert record into the buffer, discard old ones, update heads */ 294/* insert record into the buffer, discard old ones, update heads */
288static void log_store(int facility, int level, 295static void log_store(int facility, int level,
296 enum log_flags flags, u64 ts_nsec,
289 const char *dict, u16 dict_len, 297 const char *dict, u16 dict_len,
290 const char *text, u16 text_len) 298 const char *text, u16 text_len)
291{ 299{
@@ -329,8 +337,13 @@ static void log_store(int facility, int level,
329 msg->text_len = text_len; 337 msg->text_len = text_len;
330 memcpy(log_dict(msg), dict, dict_len); 338 memcpy(log_dict(msg), dict, dict_len);
331 msg->dict_len = dict_len; 339 msg->dict_len = dict_len;
332 msg->level = (facility << 3) | (level & 7); 340 msg->facility = facility;
333 msg->ts_nsec = local_clock(); 341 msg->level = level & 7;
342 msg->flags = flags & 0x1f;
343 if (ts_nsec > 0)
344 msg->ts_nsec = ts_nsec;
345 else
346 msg->ts_nsec = local_clock();
334 memset(log_dict(msg) + dict_len, 0, pad_len); 347 memset(log_dict(msg) + dict_len, 0, pad_len);
335 msg->len = sizeof(struct log) + text_len + dict_len + pad_len; 348 msg->len = sizeof(struct log) + text_len + dict_len + pad_len;
336 349
@@ -414,7 +427,9 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
414 if (!user) 427 if (!user)
415 return -EBADF; 428 return -EBADF;
416 429
417 mutex_lock(&user->lock); 430 ret = mutex_lock_interruptible(&user->lock);
431 if (ret)
432 return ret;
418 raw_spin_lock(&logbuf_lock); 433 raw_spin_lock(&logbuf_lock);
419 while (user->seq == log_next_seq) { 434 while (user->seq == log_next_seq) {
420 if (file->f_flags & O_NONBLOCK) { 435 if (file->f_flags & O_NONBLOCK) {
@@ -444,7 +459,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
444 ts_usec = msg->ts_nsec; 459 ts_usec = msg->ts_nsec;
445 do_div(ts_usec, 1000); 460 do_div(ts_usec, 1000);
446 len = sprintf(user->buf, "%u,%llu,%llu;", 461 len = sprintf(user->buf, "%u,%llu,%llu;",
447 msg->level, user->seq, ts_usec); 462 (msg->facility << 3) | msg->level, user->seq, ts_usec);
448 463
449 /* escape non-printable characters */ 464 /* escape non-printable characters */
450 for (i = 0; i < msg->text_len; i++) { 465 for (i = 0; i < msg->text_len; i++) {
@@ -785,6 +800,21 @@ static bool printk_time;
785#endif 800#endif
786module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); 801module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
787 802
803static size_t print_time(u64 ts, char *buf)
804{
805 unsigned long rem_nsec;
806
807 if (!printk_time)
808 return 0;
809
810 if (!buf)
811 return 15;
812
813 rem_nsec = do_div(ts, 1000000000);
814 return sprintf(buf, "[%5lu.%06lu] ",
815 (unsigned long)ts, rem_nsec / 1000);
816}
817
788static size_t print_prefix(const struct log *msg, bool syslog, char *buf) 818static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
789{ 819{
790 size_t len = 0; 820 size_t len = 0;
@@ -801,18 +831,7 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
801 } 831 }
802 } 832 }
803 833
804 if (printk_time) { 834 len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
805 if (buf) {
806 unsigned long long ts = msg->ts_nsec;
807 unsigned long rem_nsec = do_div(ts, 1000000000);
808
809 len += sprintf(buf + len, "[%5lu.%06lu] ",
810 (unsigned long) ts, rem_nsec / 1000);
811 } else {
812 len += 15;
813 }
814 }
815
816 return len; 835 return len;
817} 836}
818 837
@@ -860,26 +879,49 @@ static int syslog_print(char __user *buf, int size)
860{ 879{
861 char *text; 880 char *text;
862 struct log *msg; 881 struct log *msg;
863 int len; 882 int len = 0;
864 883
865 text = kmalloc(LOG_LINE_MAX, GFP_KERNEL); 884 text = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
866 if (!text) 885 if (!text)
867 return -ENOMEM; 886 return -ENOMEM;
868 887
869 raw_spin_lock_irq(&logbuf_lock); 888 while (size > 0) {
870 if (syslog_seq < log_first_seq) { 889 size_t n;
871 /* messages are gone, move to first one */ 890
872 syslog_seq = log_first_seq; 891 raw_spin_lock_irq(&logbuf_lock);
873 syslog_idx = log_first_idx; 892 if (syslog_seq < log_first_seq) {
874 } 893 /* messages are gone, move to first one */
875 msg = log_from_idx(syslog_idx); 894 syslog_seq = log_first_seq;
876 len = msg_print_text(msg, true, text, LOG_LINE_MAX); 895 syslog_idx = log_first_idx;
877 syslog_idx = log_next(syslog_idx); 896 }
878 syslog_seq++; 897 if (syslog_seq == log_next_seq) {
879 raw_spin_unlock_irq(&logbuf_lock); 898 raw_spin_unlock_irq(&logbuf_lock);
899 break;
900 }
901 msg = log_from_idx(syslog_idx);
902 n = msg_print_text(msg, true, text, LOG_LINE_MAX);
903 if (n <= size) {
904 syslog_idx = log_next(syslog_idx);
905 syslog_seq++;
906 } else
907 n = 0;
908 raw_spin_unlock_irq(&logbuf_lock);
909
910 if (!n)
911 break;
912
913 len += n;
914 size -= n;
915 buf += n;
916 n = copy_to_user(buf - n, text, n);
880 917
881 if (len > 0 && copy_to_user(buf, text, len)) 918 if (n) {
882 len = -EFAULT; 919 len -= n;
920 if (!len)
921 len = -EFAULT;
922 break;
923 }
924 }
883 925
884 kfree(text); 926 kfree(text);
885 return len; 927 return len;
@@ -909,7 +951,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
909 /* 951 /*
910 * Find first record that fits, including all following records, 952 * Find first record that fits, including all following records,
911 * into the user-provided buffer for this dump. 953 * into the user-provided buffer for this dump.
912 */ 954 */
913 seq = clear_seq; 955 seq = clear_seq;
914 idx = clear_idx; 956 idx = clear_idx;
915 while (seq < log_next_seq) { 957 while (seq < log_next_seq) {
@@ -919,6 +961,8 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
919 idx = log_next(idx); 961 idx = log_next(idx);
920 seq++; 962 seq++;
921 } 963 }
964
965 /* move first record forward until length fits into the buffer */
922 seq = clear_seq; 966 seq = clear_seq;
923 idx = clear_idx; 967 idx = clear_idx;
924 while (len > size && seq < log_next_seq) { 968 while (len > size && seq < log_next_seq) {
@@ -929,7 +973,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
929 seq++; 973 seq++;
930 } 974 }
931 975
932 /* last message in this dump */ 976 /* last message fitting into this dump */
933 next_seq = log_next_seq; 977 next_seq = log_next_seq;
934 978
935 len = 0; 979 len = 0;
@@ -974,6 +1018,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
974{ 1018{
975 bool clear = false; 1019 bool clear = false;
976 static int saved_console_loglevel = -1; 1020 static int saved_console_loglevel = -1;
1021 static DEFINE_MUTEX(syslog_mutex);
977 int error; 1022 int error;
978 1023
979 error = check_syslog_permissions(type, from_file); 1024 error = check_syslog_permissions(type, from_file);
@@ -1000,11 +1045,17 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1000 error = -EFAULT; 1045 error = -EFAULT;
1001 goto out; 1046 goto out;
1002 } 1047 }
1048 error = mutex_lock_interruptible(&syslog_mutex);
1049 if (error)
1050 goto out;
1003 error = wait_event_interruptible(log_wait, 1051 error = wait_event_interruptible(log_wait,
1004 syslog_seq != log_next_seq); 1052 syslog_seq != log_next_seq);
1005 if (error) 1053 if (error) {
1054 mutex_unlock(&syslog_mutex);
1006 goto out; 1055 goto out;
1056 }
1007 error = syslog_print(buf, len); 1057 error = syslog_print(buf, len);
1058 mutex_unlock(&syslog_mutex);
1008 break; 1059 break;
1009 /* Read/clear last kernel messages */ 1060 /* Read/clear last kernel messages */
1010 case SYSLOG_ACTION_READ_CLEAR: 1061 case SYSLOG_ACTION_READ_CLEAR:
@@ -1027,6 +1078,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1027 /* Clear ring buffer */ 1078 /* Clear ring buffer */
1028 case SYSLOG_ACTION_CLEAR: 1079 case SYSLOG_ACTION_CLEAR:
1029 syslog_print_all(NULL, 0, true); 1080 syslog_print_all(NULL, 0, true);
1081 break;
1030 /* Disable logging to console */ 1082 /* Disable logging to console */
1031 case SYSLOG_ACTION_CONSOLE_OFF: 1083 case SYSLOG_ACTION_CONSOLE_OFF:
1032 if (saved_console_loglevel == -1) 1084 if (saved_console_loglevel == -1)
@@ -1259,15 +1311,92 @@ static inline void printk_delay(void)
1259 } 1311 }
1260} 1312}
1261 1313
1314/*
1315 * Continuation lines are buffered, and not committed to the record buffer
1316 * until the line is complete, or a race forces it. The line fragments
1317 * though, are printed immediately to the consoles to ensure everything has
1318 * reached the console in case of a kernel crash.
1319 */
1320static struct cont {
1321 char buf[LOG_LINE_MAX];
1322 size_t len; /* length == 0 means unused buffer */
1323 size_t cons; /* bytes written to console */
1324 struct task_struct *owner; /* task of first print*/
1325 u64 ts_nsec; /* time of first print */
1326 u8 level; /* log level of first message */
1327 u8 facility; /* log level of first message */
1328 bool flushed:1; /* buffer sealed and committed */
1329} cont;
1330
1331static void cont_flush(void)
1332{
1333 if (cont.flushed)
1334 return;
1335 if (cont.len == 0)
1336 return;
1337
1338 log_store(cont.facility, cont.level, LOG_NOCONS, cont.ts_nsec,
1339 NULL, 0, cont.buf, cont.len);
1340
1341 cont.flushed = true;
1342}
1343
1344static bool cont_add(int facility, int level, const char *text, size_t len)
1345{
1346 if (cont.len && cont.flushed)
1347 return false;
1348
1349 if (cont.len + len > sizeof(cont.buf)) {
1350 cont_flush();
1351 return false;
1352 }
1353
1354 if (!cont.len) {
1355 cont.facility = facility;
1356 cont.level = level;
1357 cont.owner = current;
1358 cont.ts_nsec = local_clock();
1359 cont.cons = 0;
1360 cont.flushed = false;
1361 }
1362
1363 memcpy(cont.buf + cont.len, text, len);
1364 cont.len += len;
1365 return true;
1366}
1367
1368static size_t cont_print_text(char *text, size_t size)
1369{
1370 size_t textlen = 0;
1371 size_t len;
1372
1373 if (cont.cons == 0) {
1374 textlen += print_time(cont.ts_nsec, text);
1375 size -= textlen;
1376 }
1377
1378 len = cont.len - cont.cons;
1379 if (len > 0) {
1380 if (len+1 > size)
1381 len = size-1;
1382 memcpy(text + textlen, cont.buf + cont.cons, len);
1383 textlen += len;
1384 cont.cons = cont.len;
1385 }
1386
1387 if (cont.flushed) {
1388 text[textlen++] = '\n';
1389 /* got everything, release buffer */
1390 cont.len = 0;
1391 }
1392 return textlen;
1393}
1394
1262asmlinkage int vprintk_emit(int facility, int level, 1395asmlinkage int vprintk_emit(int facility, int level,
1263 const char *dict, size_t dictlen, 1396 const char *dict, size_t dictlen,
1264 const char *fmt, va_list args) 1397 const char *fmt, va_list args)
1265{ 1398{
1266 static int recursion_bug; 1399 static int recursion_bug;
1267 static char cont_buf[LOG_LINE_MAX];
1268 static size_t cont_len;
1269 static int cont_level;
1270 static struct task_struct *cont_task;
1271 static char textbuf[LOG_LINE_MAX]; 1400 static char textbuf[LOG_LINE_MAX];
1272 char *text = textbuf; 1401 char *text = textbuf;
1273 size_t text_len; 1402 size_t text_len;
@@ -1313,7 +1442,8 @@ asmlinkage int vprintk_emit(int facility, int level,
1313 recursion_bug = 0; 1442 recursion_bug = 0;
1314 printed_len += strlen(recursion_msg); 1443 printed_len += strlen(recursion_msg);
1315 /* emit KERN_CRIT message */ 1444 /* emit KERN_CRIT message */
1316 log_store(0, 2, NULL, 0, recursion_msg, printed_len); 1445 log_store(0, 2, LOG_DEFAULT, 0,
1446 NULL, 0, recursion_msg, printed_len);
1317 } 1447 }
1318 1448
1319 /* 1449 /*
@@ -1351,55 +1481,37 @@ asmlinkage int vprintk_emit(int facility, int level,
1351 } 1481 }
1352 1482
1353 if (!newline) { 1483 if (!newline) {
1354 if (cont_len && (prefix || cont_task != current)) { 1484 /*
1355 /* 1485 * Flush the conflicting buffer. An earlier newline was missing,
1356 * Flush earlier buffer, which is either from a 1486 * or another task also prints continuation lines.
1357 * different thread, or when we got a new prefix. 1487 */
1358 */ 1488 if (cont.len && (prefix || cont.owner != current))
1359 log_store(facility, cont_level, NULL, 0, cont_buf, cont_len); 1489 cont_flush();
1360 cont_len = 0;
1361 }
1362
1363 if (!cont_len) {
1364 cont_level = level;
1365 cont_task = current;
1366 }
1367 1490
1368 /* buffer or append to earlier buffer from the same thread */ 1491 /* buffer line if possible, otherwise store it right away */
1369 if (cont_len + text_len > sizeof(cont_buf)) 1492 if (!cont_add(facility, level, text, text_len))
1370 text_len = sizeof(cont_buf) - cont_len; 1493 log_store(facility, level, LOG_DEFAULT, 0,
1371 memcpy(cont_buf + cont_len, text, text_len); 1494 dict, dictlen, text, text_len);
1372 cont_len += text_len;
1373 } else { 1495 } else {
1374 if (cont_len && cont_task == current) { 1496 bool stored = false;
1375 if (prefix) {
1376 /*
1377 * New prefix from the same thread; flush. We
1378 * either got no earlier newline, or we race
1379 * with an interrupt.
1380 */
1381 log_store(facility, cont_level,
1382 NULL, 0, cont_buf, cont_len);
1383 cont_len = 0;
1384 }
1385 1497
1386 /* append to the earlier buffer and flush */ 1498 /*
1387 if (cont_len + text_len > sizeof(cont_buf)) 1499 * If an earlier newline was missing and it was the same task,
1388 text_len = sizeof(cont_buf) - cont_len; 1500 * either merge it with the current buffer and flush, or if
1389 memcpy(cont_buf + cont_len, text, text_len); 1501 * there was a race with interrupts (prefix == true) then just
1390 cont_len += text_len; 1502 * flush it out and store this line separately.
1391 log_store(facility, cont_level, 1503 */
1392 NULL, 0, cont_buf, cont_len); 1504 if (cont.len && cont.owner == current) {
1393 cont_len = 0; 1505 if (!prefix)
1394 cont_task = NULL; 1506 stored = cont_add(facility, level, text, text_len);
1395 printed_len = cont_len; 1507 cont_flush();
1396 } else {
1397 /* ordinary single and terminated line */
1398 log_store(facility, level,
1399 dict, dictlen, text, text_len);
1400 printed_len = text_len;
1401 } 1508 }
1509
1510 if (!stored)
1511 log_store(facility, level, LOG_DEFAULT, 0,
1512 dict, dictlen, text, text_len);
1402 } 1513 }
1514 printed_len += text_len;
1403 1515
1404 /* 1516 /*
1405 * Try to acquire and then immediately release the console semaphore. 1517 * Try to acquire and then immediately release the console semaphore.
@@ -1486,11 +1598,18 @@ EXPORT_SYMBOL(printk);
1486#else 1598#else
1487 1599
1488#define LOG_LINE_MAX 0 1600#define LOG_LINE_MAX 0
1601static struct cont {
1602 size_t len;
1603 size_t cons;
1604 u8 level;
1605 bool flushed:1;
1606} cont;
1489static struct log *log_from_idx(u32 idx) { return NULL; } 1607static struct log *log_from_idx(u32 idx) { return NULL; }
1490static u32 log_next(u32 idx) { return 0; } 1608static u32 log_next(u32 idx) { return 0; }
1491static void call_console_drivers(int level, const char *text, size_t len) {} 1609static void call_console_drivers(int level, const char *text, size_t len) {}
1492static size_t msg_print_text(const struct log *msg, bool syslog, 1610static size_t msg_print_text(const struct log *msg, bool syslog,
1493 char *buf, size_t size) { return 0; } 1611 char *buf, size_t size) { return 0; }
1612static size_t cont_print_text(char *text, size_t size) { return 0; }
1494 1613
1495#endif /* CONFIG_PRINTK */ 1614#endif /* CONFIG_PRINTK */
1496 1615
@@ -1782,6 +1901,7 @@ static u32 console_idx;
1782 */ 1901 */
1783void console_unlock(void) 1902void console_unlock(void)
1784{ 1903{
1904 static char text[LOG_LINE_MAX];
1785 static u64 seen_seq; 1905 static u64 seen_seq;
1786 unsigned long flags; 1906 unsigned long flags;
1787 bool wake_klogd = false; 1907 bool wake_klogd = false;
@@ -1794,10 +1914,23 @@ void console_unlock(void)
1794 1914
1795 console_may_schedule = 0; 1915 console_may_schedule = 0;
1796 1916
1917 /* flush buffered message fragment immediately to console */
1918 raw_spin_lock_irqsave(&logbuf_lock, flags);
1919 if (cont.len && (cont.cons < cont.len || cont.flushed)) {
1920 size_t len;
1921
1922 len = cont_print_text(text, sizeof(text));
1923 raw_spin_unlock(&logbuf_lock);
1924 stop_critical_timings();
1925 call_console_drivers(cont.level, text, len);
1926 start_critical_timings();
1927 local_irq_restore(flags);
1928 } else
1929 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
1930
1797again: 1931again:
1798 for (;;) { 1932 for (;;) {
1799 struct log *msg; 1933 struct log *msg;
1800 static char text[LOG_LINE_MAX];
1801 size_t len; 1934 size_t len;
1802 int level; 1935 int level;
1803 1936
@@ -1812,13 +1945,22 @@ again:
1812 console_seq = log_first_seq; 1945 console_seq = log_first_seq;
1813 console_idx = log_first_idx; 1946 console_idx = log_first_idx;
1814 } 1947 }
1815 1948skip:
1816 if (console_seq == log_next_seq) 1949 if (console_seq == log_next_seq)
1817 break; 1950 break;
1818 1951
1819 msg = log_from_idx(console_idx); 1952 msg = log_from_idx(console_idx);
1820 level = msg->level & 7; 1953 if (msg->flags & LOG_NOCONS) {
1954 /*
1955 * Skip record we have buffered and already printed
1956 * directly to the console when we received it.
1957 */
1958 console_idx = log_next(console_idx);
1959 console_seq++;
1960 goto skip;
1961 }
1821 1962
1963 level = msg->level;
1822 len = msg_print_text(msg, false, text, sizeof(text)); 1964 len = msg_print_text(msg, false, text, sizeof(text));
1823 1965
1824 console_idx = log_next(console_idx); 1966 console_idx = log_next(console_idx);
@@ -2300,48 +2442,210 @@ module_param_named(always_kmsg_dump, always_kmsg_dump, bool, S_IRUGO | S_IWUSR);
2300 * kmsg_dump - dump kernel log to kernel message dumpers. 2442 * kmsg_dump - dump kernel log to kernel message dumpers.
2301 * @reason: the reason (oops, panic etc) for dumping 2443 * @reason: the reason (oops, panic etc) for dumping
2302 * 2444 *
2303 * Iterate through each of the dump devices and call the oops/panic 2445 * Call each of the registered dumper's dump() callback, which can
2304 * callbacks with the log buffer. 2446 * retrieve the kmsg records with kmsg_dump_get_line() or
2447 * kmsg_dump_get_buffer().
2305 */ 2448 */
2306void kmsg_dump(enum kmsg_dump_reason reason) 2449void kmsg_dump(enum kmsg_dump_reason reason)
2307{ 2450{
2308 u64 idx;
2309 struct kmsg_dumper *dumper; 2451 struct kmsg_dumper *dumper;
2310 const char *s1, *s2;
2311 unsigned long l1, l2;
2312 unsigned long flags; 2452 unsigned long flags;
2313 2453
2314 if ((reason > KMSG_DUMP_OOPS) && !always_kmsg_dump) 2454 if ((reason > KMSG_DUMP_OOPS) && !always_kmsg_dump)
2315 return; 2455 return;
2316 2456
2317 /* Theoretically, the log could move on after we do this, but 2457 rcu_read_lock();
2318 there's not a lot we can do about that. The new messages 2458 list_for_each_entry_rcu(dumper, &dump_list, list) {
2319 will overwrite the start of what we dump. */ 2459 if (dumper->max_reason && reason > dumper->max_reason)
2460 continue;
2461
2462 /* initialize iterator with data about the stored records */
2463 dumper->active = true;
2464
2465 raw_spin_lock_irqsave(&logbuf_lock, flags);
2466 dumper->cur_seq = clear_seq;
2467 dumper->cur_idx = clear_idx;
2468 dumper->next_seq = log_next_seq;
2469 dumper->next_idx = log_next_idx;
2470 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2471
2472 /* invoke dumper which will iterate over records */
2473 dumper->dump(dumper, reason);
2474
2475 /* reset iterator */
2476 dumper->active = false;
2477 }
2478 rcu_read_unlock();
2479}
2480
2481/**
2482 * kmsg_dump_get_line - retrieve one kmsg log line
2483 * @dumper: registered kmsg dumper
2484 * @syslog: include the "<4>" prefixes
2485 * @line: buffer to copy the line to
2486 * @size: maximum size of the buffer
2487 * @len: length of line placed into buffer
2488 *
2489 * Start at the beginning of the kmsg buffer, with the oldest kmsg
2490 * record, and copy one record into the provided buffer.
2491 *
2492 * Consecutive calls will return the next available record moving
2493 * towards the end of the buffer with the youngest messages.
2494 *
2495 * A return value of FALSE indicates that there are no more records to
2496 * read.
2497 */
2498bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
2499 char *line, size_t size, size_t *len)
2500{
2501 unsigned long flags;
2502 struct log *msg;
2503 size_t l = 0;
2504 bool ret = false;
2505
2506 if (!dumper->active)
2507 goto out;
2320 2508
2321 raw_spin_lock_irqsave(&logbuf_lock, flags); 2509 raw_spin_lock_irqsave(&logbuf_lock, flags);
2322 if (syslog_seq < log_first_seq) 2510 if (dumper->cur_seq < log_first_seq) {
2323 idx = syslog_idx; 2511 /* messages are gone, move to first available one */
2324 else 2512 dumper->cur_seq = log_first_seq;
2325 idx = log_first_idx; 2513 dumper->cur_idx = log_first_idx;
2514 }
2326 2515
2327 if (idx > log_next_idx) { 2516 /* last entry */
2328 s1 = log_buf; 2517 if (dumper->cur_seq >= log_next_seq) {
2329 l1 = log_next_idx; 2518 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2519 goto out;
2520 }
2330 2521
2331 s2 = log_buf + idx; 2522 msg = log_from_idx(dumper->cur_idx);
2332 l2 = log_buf_len - idx; 2523 l = msg_print_text(msg, syslog,
2333 } else { 2524 line, size);
2334 s1 = "";
2335 l1 = 0;
2336 2525
2337 s2 = log_buf + idx; 2526 dumper->cur_idx = log_next(dumper->cur_idx);
2338 l2 = log_next_idx - idx; 2527 dumper->cur_seq++;
2528 ret = true;
2529 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2530out:
2531 if (len)
2532 *len = l;
2533 return ret;
2534}
2535EXPORT_SYMBOL_GPL(kmsg_dump_get_line);
2536
2537/**
2538 * kmsg_dump_get_buffer - copy kmsg log lines
2539 * @dumper: registered kmsg dumper
2540 * @syslog: include the "<4>" prefixes
2541 * @buf: buffer to copy the line to
2542 * @size: maximum size of the buffer
2543 * @len: length of line placed into buffer
2544 *
2545 * Start at the end of the kmsg buffer and fill the provided buffer
2546 * with as many of the the *youngest* kmsg records that fit into it.
2547 * If the buffer is large enough, all available kmsg records will be
2548 * copied with a single call.
2549 *
2550 * Consecutive calls will fill the buffer with the next block of
2551 * available older records, not including the earlier retrieved ones.
2552 *
2553 * A return value of FALSE indicates that there are no more records to
2554 * read.
2555 */
2556bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
2557 char *buf, size_t size, size_t *len)
2558{
2559 unsigned long flags;
2560 u64 seq;
2561 u32 idx;
2562 u64 next_seq;
2563 u32 next_idx;
2564 size_t l = 0;
2565 bool ret = false;
2566
2567 if (!dumper->active)
2568 goto out;
2569
2570 raw_spin_lock_irqsave(&logbuf_lock, flags);
2571 if (dumper->cur_seq < log_first_seq) {
2572 /* messages are gone, move to first available one */
2573 dumper->cur_seq = log_first_seq;
2574 dumper->cur_idx = log_first_idx;
2339 } 2575 }
2576
2577 /* last entry */
2578 if (dumper->cur_seq >= dumper->next_seq) {
2579 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2580 goto out;
2581 }
2582
2583 /* calculate length of entire buffer */
2584 seq = dumper->cur_seq;
2585 idx = dumper->cur_idx;
2586 while (seq < dumper->next_seq) {
2587 struct log *msg = log_from_idx(idx);
2588
2589 l += msg_print_text(msg, true, NULL, 0);
2590 idx = log_next(idx);
2591 seq++;
2592 }
2593
2594 /* move first record forward until length fits into the buffer */
2595 seq = dumper->cur_seq;
2596 idx = dumper->cur_idx;
2597 while (l > size && seq < dumper->next_seq) {
2598 struct log *msg = log_from_idx(idx);
2599
2600 l -= msg_print_text(msg, true, NULL, 0);
2601 idx = log_next(idx);
2602 seq++;
2603 }
2604
2605 /* last message in next interation */
2606 next_seq = seq;
2607 next_idx = idx;
2608
2609 l = 0;
2610 while (seq < dumper->next_seq) {
2611 struct log *msg = log_from_idx(idx);
2612
2613 l += msg_print_text(msg, syslog,
2614 buf + l, size - l);
2615
2616 idx = log_next(idx);
2617 seq++;
2618 }
2619
2620 dumper->next_seq = next_seq;
2621 dumper->next_idx = next_idx;
2622 ret = true;
2340 raw_spin_unlock_irqrestore(&logbuf_lock, flags); 2623 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2624out:
2625 if (len)
2626 *len = l;
2627 return ret;
2628}
2629EXPORT_SYMBOL_GPL(kmsg_dump_get_buffer);
2341 2630
2342 rcu_read_lock(); 2631/**
2343 list_for_each_entry_rcu(dumper, &dump_list, list) 2632 * kmsg_dump_rewind - reset the interator
2344 dumper->dump(dumper, reason, s1, l1, s2, l2); 2633 * @dumper: registered kmsg dumper
2345 rcu_read_unlock(); 2634 *
2635 * Reset the dumper's iterator so that kmsg_dump_get_line() and
2636 * kmsg_dump_get_buffer() can be called again and used multiple
2637 * times within the same dumper.dump() callback.
2638 */
2639void kmsg_dump_rewind(struct kmsg_dumper *dumper)
2640{
2641 unsigned long flags;
2642
2643 raw_spin_lock_irqsave(&logbuf_lock, flags);
2644 dumper->cur_seq = clear_seq;
2645 dumper->cur_idx = clear_idx;
2646 dumper->next_seq = log_next_seq;
2647 dumper->next_idx = log_next_idx;
2648 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2346} 2649}
2650EXPORT_SYMBOL_GPL(kmsg_dump_rewind);
2347#endif 2651#endif
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 3b0f1337f75b..38ecdda3f55f 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1530,7 +1530,7 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
1530{ 1530{
1531 unsigned long flags; 1531 unsigned long flags;
1532 struct rcu_head *next, *list, **tail; 1532 struct rcu_head *next, *list, **tail;
1533 int bl, count, count_lazy; 1533 int bl, count, count_lazy, i;
1534 1534
1535 /* If no callbacks are ready, just return.*/ 1535 /* If no callbacks are ready, just return.*/
1536 if (!cpu_has_callbacks_ready_to_invoke(rdp)) { 1536 if (!cpu_has_callbacks_ready_to_invoke(rdp)) {
@@ -1553,9 +1553,9 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
1553 rdp->nxtlist = *rdp->nxttail[RCU_DONE_TAIL]; 1553 rdp->nxtlist = *rdp->nxttail[RCU_DONE_TAIL];
1554 *rdp->nxttail[RCU_DONE_TAIL] = NULL; 1554 *rdp->nxttail[RCU_DONE_TAIL] = NULL;
1555 tail = rdp->nxttail[RCU_DONE_TAIL]; 1555 tail = rdp->nxttail[RCU_DONE_TAIL];
1556 for (count = RCU_NEXT_SIZE - 1; count >= 0; count--) 1556 for (i = RCU_NEXT_SIZE - 1; i >= 0; i--)
1557 if (rdp->nxttail[count] == rdp->nxttail[RCU_DONE_TAIL]) 1557 if (rdp->nxttail[i] == rdp->nxttail[RCU_DONE_TAIL])
1558 rdp->nxttail[count] = &rdp->nxtlist; 1558 rdp->nxttail[i] = &rdp->nxtlist;
1559 local_irq_restore(flags); 1559 local_irq_restore(flags);
1560 1560
1561 /* Invoke callbacks. */ 1561 /* Invoke callbacks. */
@@ -1583,9 +1583,9 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp)
1583 if (list != NULL) { 1583 if (list != NULL) {
1584 *tail = rdp->nxtlist; 1584 *tail = rdp->nxtlist;
1585 rdp->nxtlist = list; 1585 rdp->nxtlist = list;
1586 for (count = 0; count < RCU_NEXT_SIZE; count++) 1586 for (i = 0; i < RCU_NEXT_SIZE; i++)
1587 if (&rdp->nxtlist == rdp->nxttail[count]) 1587 if (&rdp->nxtlist == rdp->nxttail[i])
1588 rdp->nxttail[count] = tail; 1588 rdp->nxttail[i] = tail;
1589 else 1589 else
1590 break; 1590 break;
1591 } 1591 }
diff --git a/kernel/relay.c b/kernel/relay.c
index ab56a1764d4d..e8cd2027abbd 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -1235,6 +1235,7 @@ static ssize_t subbuf_splice_actor(struct file *in,
1235 struct splice_pipe_desc spd = { 1235 struct splice_pipe_desc spd = {
1236 .pages = pages, 1236 .pages = pages,
1237 .nr_pages = 0, 1237 .nr_pages = 0,
1238 .nr_pages_max = PIPE_DEF_BUFFERS,
1238 .partial = partial, 1239 .partial = partial,
1239 .flags = flags, 1240 .flags = flags,
1240 .ops = &relay_pipe_buf_ops, 1241 .ops = &relay_pipe_buf_ops,
@@ -1302,8 +1303,8 @@ static ssize_t subbuf_splice_actor(struct file *in,
1302 ret += padding; 1303 ret += padding;
1303 1304
1304out: 1305out:
1305 splice_shrink_spd(pipe, &spd); 1306 splice_shrink_spd(&spd);
1306 return ret; 1307 return ret;
1307} 1308}
1308 1309
1309static ssize_t relay_file_splice_read(struct file *in, 1310static ssize_t relay_file_splice_read(struct file *in,
diff --git a/kernel/sys.c b/kernel/sys.c
index f0ec44dcd415..e0c8ffc50d7f 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2127,9 +2127,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
2127 else 2127 else
2128 return -EINVAL; 2128 return -EINVAL;
2129 break; 2129 break;
2130 case PR_GET_TID_ADDRESS:
2131 error = prctl_get_tid_address(me, (int __user **)arg2);
2132 break;
2133 default: 2130 default:
2134 return -EINVAL; 2131 return -EINVAL;
2135 } 2132 }
@@ -2147,6 +2144,9 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
2147 case PR_SET_MM: 2144 case PR_SET_MM:
2148 error = prctl_set_mm(arg2, arg3, arg4, arg5); 2145 error = prctl_set_mm(arg2, arg3, arg4, arg5);
2149 break; 2146 break;
2147 case PR_GET_TID_ADDRESS:
2148 error = prctl_get_tid_address(me, (int __user **)arg2);
2149 break;
2150 case PR_SET_CHILD_SUBREAPER: 2150 case PR_SET_CHILD_SUBREAPER:
2151 me->signal->is_child_subreaper = !!arg2; 2151 me->signal->is_child_subreaper = !!arg2;
2152 error = 0; 2152 error = 0;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 49249c28690d..a7fa0702be1c 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3609,6 +3609,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
3609 .pages = pages_def, 3609 .pages = pages_def,
3610 .partial = partial_def, 3610 .partial = partial_def,
3611 .nr_pages = 0, /* This gets updated below. */ 3611 .nr_pages = 0, /* This gets updated below. */
3612 .nr_pages_max = PIPE_DEF_BUFFERS,
3612 .flags = flags, 3613 .flags = flags,
3613 .ops = &tracing_pipe_buf_ops, 3614 .ops = &tracing_pipe_buf_ops,
3614 .spd_release = tracing_spd_release_pipe, 3615 .spd_release = tracing_spd_release_pipe,
@@ -3680,7 +3681,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
3680 3681
3681 ret = splice_to_pipe(pipe, &spd); 3682 ret = splice_to_pipe(pipe, &spd);
3682out: 3683out:
3683 splice_shrink_spd(pipe, &spd); 3684 splice_shrink_spd(&spd);
3684 return ret; 3685 return ret;
3685 3686
3686out_err: 3687out_err:
@@ -4231,6 +4232,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
4231 struct splice_pipe_desc spd = { 4232 struct splice_pipe_desc spd = {
4232 .pages = pages_def, 4233 .pages = pages_def,
4233 .partial = partial_def, 4234 .partial = partial_def,
4235 .nr_pages_max = PIPE_DEF_BUFFERS,
4234 .flags = flags, 4236 .flags = flags,
4235 .ops = &buffer_pipe_buf_ops, 4237 .ops = &buffer_pipe_buf_ops,
4236 .spd_release = buffer_spd_release, 4238 .spd_release = buffer_spd_release,
@@ -4318,7 +4320,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
4318 } 4320 }
4319 4321
4320 ret = splice_to_pipe(pipe, &spd); 4322 ret = splice_to_pipe(pipe, &spd);
4321 splice_shrink_spd(pipe, &spd); 4323 splice_shrink_spd(&spd);
4322out: 4324out:
4323 return ret; 4325 return ret;
4324} 4326}
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index 6805453c18e7..f7210ad6cffd 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -101,6 +101,10 @@ static inline bool fail_stacktrace(struct fault_attr *attr)
101 101
102bool should_fail(struct fault_attr *attr, ssize_t size) 102bool should_fail(struct fault_attr *attr, ssize_t size)
103{ 103{
104 /* No need to check any other properties if the probability is 0 */
105 if (attr->probability == 0)
106 return false;
107
104 if (attr->task_filter && !fail_task(attr, current)) 108 if (attr->task_filter && !fail_task(attr, current))
105 return false; 109 return false;
106 110
diff --git a/mm/madvise.c b/mm/madvise.c
index deff1b64a08c..14d260fa0d17 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/ksm.h> 16#include <linux/ksm.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/file.h>
18 19
19/* 20/*
20 * Any behaviour which results in changes to the vma->vm_flags needs to 21 * Any behaviour which results in changes to the vma->vm_flags needs to
@@ -204,14 +205,16 @@ static long madvise_remove(struct vm_area_struct *vma,
204{ 205{
205 loff_t offset; 206 loff_t offset;
206 int error; 207 int error;
208 struct file *f;
207 209
208 *prev = NULL; /* tell sys_madvise we drop mmap_sem */ 210 *prev = NULL; /* tell sys_madvise we drop mmap_sem */
209 211
210 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) 212 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
211 return -EINVAL; 213 return -EINVAL;
212 214
213 if (!vma->vm_file || !vma->vm_file->f_mapping 215 f = vma->vm_file;
214 || !vma->vm_file->f_mapping->host) { 216
217 if (!f || !f->f_mapping || !f->f_mapping->host) {
215 return -EINVAL; 218 return -EINVAL;
216 } 219 }
217 220
@@ -221,11 +224,18 @@ static long madvise_remove(struct vm_area_struct *vma,
221 offset = (loff_t)(start - vma->vm_start) 224 offset = (loff_t)(start - vma->vm_start)
222 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 225 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
223 226
224 /* filesystem's fallocate may need to take i_mutex */ 227 /*
228 * Filesystem's fallocate may need to take i_mutex. We need to
229 * explicitly grab a reference because the vma (and hence the
230 * vma's reference to the file) can go away as soon as we drop
231 * mmap_sem.
232 */
233 get_file(f);
225 up_read(&current->mm->mmap_sem); 234 up_read(&current->mm->mmap_sem);
226 error = do_fallocate(vma->vm_file, 235 error = do_fallocate(f,
227 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 236 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
228 offset, end - start); 237 offset, end - start);
238 fput(f);
229 down_read(&current->mm->mmap_sem); 239 down_read(&current->mm->mmap_sem);
230 return error; 240 return error;
231} 241}
diff --git a/mm/memblock.c b/mm/memblock.c
index 32a0a5e4d79d..d4382095f8bd 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -184,7 +184,24 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u
184 } 184 }
185} 185}
186 186
187static int __init_memblock memblock_double_array(struct memblock_type *type) 187/**
188 * memblock_double_array - double the size of the memblock regions array
189 * @type: memblock type of the regions array being doubled
190 * @new_area_start: starting address of memory range to avoid overlap with
191 * @new_area_size: size of memory range to avoid overlap with
192 *
193 * Double the size of the @type regions array. If memblock is being used to
194 * allocate memory for a new reserved regions array and there is a previously
195 * allocated memory range [@new_area_start,@new_area_start+@new_area_size]
196 * waiting to be reserved, ensure the memory used by the new array does
197 * not overlap.
198 *
199 * RETURNS:
200 * 0 on success, -1 on failure.
201 */
202static int __init_memblock memblock_double_array(struct memblock_type *type,
203 phys_addr_t new_area_start,
204 phys_addr_t new_area_size)
188{ 205{
189 struct memblock_region *new_array, *old_array; 206 struct memblock_region *new_array, *old_array;
190 phys_addr_t old_size, new_size, addr; 207 phys_addr_t old_size, new_size, addr;
@@ -222,7 +239,18 @@ static int __init_memblock memblock_double_array(struct memblock_type *type)
222 new_array = kmalloc(new_size, GFP_KERNEL); 239 new_array = kmalloc(new_size, GFP_KERNEL);
223 addr = new_array ? __pa(new_array) : 0; 240 addr = new_array ? __pa(new_array) : 0;
224 } else { 241 } else {
225 addr = memblock_find_in_range(0, MEMBLOCK_ALLOC_ACCESSIBLE, new_size, sizeof(phys_addr_t)); 242 /* only exclude range when trying to double reserved.regions */
243 if (type != &memblock.reserved)
244 new_area_start = new_area_size = 0;
245
246 addr = memblock_find_in_range(new_area_start + new_area_size,
247 memblock.current_limit,
248 new_size, sizeof(phys_addr_t));
249 if (!addr && new_area_size)
250 addr = memblock_find_in_range(0,
251 min(new_area_start, memblock.current_limit),
252 new_size, sizeof(phys_addr_t));
253
226 new_array = addr ? __va(addr) : 0; 254 new_array = addr ? __va(addr) : 0;
227 } 255 }
228 if (!addr) { 256 if (!addr) {
@@ -399,7 +427,7 @@ repeat:
399 */ 427 */
400 if (!insert) { 428 if (!insert) {
401 while (type->cnt + nr_new > type->max) 429 while (type->cnt + nr_new > type->max)
402 if (memblock_double_array(type) < 0) 430 if (memblock_double_array(type, obase, size) < 0)
403 return -ENOMEM; 431 return -ENOMEM;
404 insert = true; 432 insert = true;
405 goto repeat; 433 goto repeat;
@@ -450,7 +478,7 @@ static int __init_memblock memblock_isolate_range(struct memblock_type *type,
450 478
451 /* we'll create at most two more regions */ 479 /* we'll create at most two more regions */
452 while (type->cnt + 2 > type->max) 480 while (type->cnt + 2 > type->max)
453 if (memblock_double_array(type) < 0) 481 if (memblock_double_array(type, base, size) < 0)
454 return -ENOMEM; 482 return -ENOMEM;
455 483
456 for (i = 0; i < type->cnt; i++) { 484 for (i = 0; i < type->cnt; i++) {
@@ -540,9 +568,9 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
540 * __next_free_mem_range - next function for for_each_free_mem_range() 568 * __next_free_mem_range - next function for for_each_free_mem_range()
541 * @idx: pointer to u64 loop variable 569 * @idx: pointer to u64 loop variable
542 * @nid: nid: node selector, %MAX_NUMNODES for all nodes 570 * @nid: nid: node selector, %MAX_NUMNODES for all nodes
543 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 571 * @out_start: ptr to phys_addr_t for start address of the range, can be %NULL
544 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 572 * @out_end: ptr to phys_addr_t for end address of the range, can be %NULL
545 * @p_nid: ptr to int for nid of the range, can be %NULL 573 * @out_nid: ptr to int for nid of the range, can be %NULL
546 * 574 *
547 * Find the first free area from *@idx which matches @nid, fill the out 575 * Find the first free area from *@idx which matches @nid, fill the out
548 * parameters, and update *@idx for the next iteration. The lower 32bit of 576 * parameters, and update *@idx for the next iteration. The lower 32bit of
@@ -616,9 +644,9 @@ void __init_memblock __next_free_mem_range(u64 *idx, int nid,
616 * __next_free_mem_range_rev - next function for for_each_free_mem_range_reverse() 644 * __next_free_mem_range_rev - next function for for_each_free_mem_range_reverse()
617 * @idx: pointer to u64 loop variable 645 * @idx: pointer to u64 loop variable
618 * @nid: nid: node selector, %MAX_NUMNODES for all nodes 646 * @nid: nid: node selector, %MAX_NUMNODES for all nodes
619 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 647 * @out_start: ptr to phys_addr_t for start address of the range, can be %NULL
620 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 648 * @out_end: ptr to phys_addr_t for end address of the range, can be %NULL
621 * @p_nid: ptr to int for nid of the range, can be %NULL 649 * @out_nid: ptr to int for nid of the range, can be %NULL
622 * 650 *
623 * Reverse of __next_free_mem_range(). 651 * Reverse of __next_free_mem_range().
624 */ 652 */
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ac35bccadb7b..f72b5e52451a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1148,7 +1148,7 @@ bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
1148{ 1148{
1149 if (root_memcg == memcg) 1149 if (root_memcg == memcg)
1150 return true; 1150 return true;
1151 if (!root_memcg->use_hierarchy) 1151 if (!root_memcg->use_hierarchy || !memcg)
1152 return false; 1152 return false;
1153 return css_is_ancestor(&memcg->css, &root_memcg->css); 1153 return css_is_ancestor(&memcg->css, &root_memcg->css);
1154} 1154}
@@ -1234,7 +1234,7 @@ int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec)
1234 1234
1235/** 1235/**
1236 * mem_cgroup_margin - calculate chargeable space of a memory cgroup 1236 * mem_cgroup_margin - calculate chargeable space of a memory cgroup
1237 * @mem: the memory cgroup 1237 * @memcg: the memory cgroup
1238 * 1238 *
1239 * Returns the maximum amount of memory @mem can be charged with, in 1239 * Returns the maximum amount of memory @mem can be charged with, in
1240 * pages. 1240 * pages.
@@ -1508,7 +1508,7 @@ static unsigned long mem_cgroup_reclaim(struct mem_cgroup *memcg,
1508 1508
1509/** 1509/**
1510 * test_mem_cgroup_node_reclaimable 1510 * test_mem_cgroup_node_reclaimable
1511 * @mem: the target memcg 1511 * @memcg: the target memcg
1512 * @nid: the node ID to be checked. 1512 * @nid: the node ID to be checked.
1513 * @noswap : specify true here if the user wants flle only information. 1513 * @noswap : specify true here if the user wants flle only information.
1514 * 1514 *
diff --git a/mm/memory.c b/mm/memory.c
index 1b7dc662bf9f..2466d1250231 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1225,7 +1225,15 @@ static inline unsigned long zap_pmd_range(struct mmu_gather *tlb,
1225 next = pmd_addr_end(addr, end); 1225 next = pmd_addr_end(addr, end);
1226 if (pmd_trans_huge(*pmd)) { 1226 if (pmd_trans_huge(*pmd)) {
1227 if (next - addr != HPAGE_PMD_SIZE) { 1227 if (next - addr != HPAGE_PMD_SIZE) {
1228 VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); 1228#ifdef CONFIG_DEBUG_VM
1229 if (!rwsem_is_locked(&tlb->mm->mmap_sem)) {
1230 pr_err("%s: mmap_sem is unlocked! addr=0x%lx end=0x%lx vma->vm_start=0x%lx vma->vm_end=0x%lx\n",
1231 __func__, addr, end,
1232 vma->vm_start,
1233 vma->vm_end);
1234 BUG();
1235 }
1236#endif
1229 split_huge_page_pmd(vma->vm_mm, pmd); 1237 split_huge_page_pmd(vma->vm_mm, pmd);
1230 } else if (zap_huge_pmd(tlb, vma, pmd, addr)) 1238 } else if (zap_huge_pmd(tlb, vma, pmd, addr))
1231 goto next; 1239 goto next;
@@ -1366,7 +1374,7 @@ void unmap_vmas(struct mmu_gather *tlb,
1366/** 1374/**
1367 * zap_page_range - remove user pages in a given range 1375 * zap_page_range - remove user pages in a given range
1368 * @vma: vm_area_struct holding the applicable pages 1376 * @vma: vm_area_struct holding the applicable pages
1369 * @address: starting address of pages to zap 1377 * @start: starting address of pages to zap
1370 * @size: number of bytes to zap 1378 * @size: number of bytes to zap
1371 * @details: details of nonlinear truncation or shared cache invalidation 1379 * @details: details of nonlinear truncation or shared cache invalidation
1372 * 1380 *
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index f15c1b24ca18..1d771e4200d2 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1177,7 +1177,7 @@ static long do_mbind(unsigned long start, unsigned long len,
1177 if (!list_empty(&pagelist)) { 1177 if (!list_empty(&pagelist)) {
1178 nr_failed = migrate_pages(&pagelist, new_vma_page, 1178 nr_failed = migrate_pages(&pagelist, new_vma_page,
1179 (unsigned long)vma, 1179 (unsigned long)vma,
1180 false, true); 1180 false, MIGRATE_SYNC);
1181 if (nr_failed) 1181 if (nr_failed)
1182 putback_lru_pages(&pagelist); 1182 putback_lru_pages(&pagelist);
1183 } 1183 }
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 416637f0e924..ac300c99baf6 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -184,6 +184,7 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
184 const nodemask_t *nodemask, unsigned long totalpages) 184 const nodemask_t *nodemask, unsigned long totalpages)
185{ 185{
186 long points; 186 long points;
187 long adj;
187 188
188 if (oom_unkillable_task(p, memcg, nodemask)) 189 if (oom_unkillable_task(p, memcg, nodemask))
189 return 0; 190 return 0;
@@ -192,7 +193,8 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
192 if (!p) 193 if (!p)
193 return 0; 194 return 0;
194 195
195 if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { 196 adj = p->signal->oom_score_adj;
197 if (adj == OOM_SCORE_ADJ_MIN) {
196 task_unlock(p); 198 task_unlock(p);
197 return 0; 199 return 0;
198 } 200 }
@@ -210,14 +212,11 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
210 * implementation used by LSMs. 212 * implementation used by LSMs.
211 */ 213 */
212 if (has_capability_noaudit(p, CAP_SYS_ADMIN)) 214 if (has_capability_noaudit(p, CAP_SYS_ADMIN))
213 points -= 30 * totalpages / 1000; 215 adj -= 30;
214 216
215 /* 217 /* Normalize to oom_score_adj units */
216 * /proc/pid/oom_score_adj ranges from -1000 to +1000 such that it may 218 adj *= totalpages / 1000;
217 * either completely disable oom killing or always prefer a certain 219 points += adj;
218 * task.
219 */
220 points += p->signal->oom_score_adj * totalpages / 1000;
221 220
222 /* 221 /*
223 * Never return 0 for an eligible task regardless of the root bonus and 222 * Never return 0 for an eligible task regardless of the root bonus and
@@ -366,7 +365,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
366 365
367/** 366/**
368 * dump_tasks - dump current memory state of all system tasks 367 * dump_tasks - dump current memory state of all system tasks
369 * @mem: current's memory controller, if constrained 368 * @memcg: current's memory controller, if constrained
370 * @nodemask: nodemask passed to page allocator for mempolicy ooms 369 * @nodemask: nodemask passed to page allocator for mempolicy ooms
371 * 370 *
372 * Dumps the current memory state of all eligible tasks. Tasks not in the same 371 * Dumps the current memory state of all eligible tasks. Tasks not in the same
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 1ccbd714059c..eb750f851395 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -392,7 +392,7 @@ static struct swap_cgroup *lookup_swap_cgroup(swp_entry_t ent,
392 392
393/** 393/**
394 * swap_cgroup_cmpxchg - cmpxchg mem_cgroup's id for this swp_entry. 394 * swap_cgroup_cmpxchg - cmpxchg mem_cgroup's id for this swp_entry.
395 * @end: swap entry to be cmpxchged 395 * @ent: swap entry to be cmpxchged
396 * @old: old id 396 * @old: old id
397 * @new: new id 397 * @new: new id
398 * 398 *
@@ -422,7 +422,7 @@ unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
422/** 422/**
423 * swap_cgroup_record - record mem_cgroup for this swp_entry. 423 * swap_cgroup_record - record mem_cgroup for this swp_entry.
424 * @ent: swap entry to be recorded into 424 * @ent: swap entry to be recorded into
425 * @mem: mem_cgroup to be recorded 425 * @id: mem_cgroup to be recorded
426 * 426 *
427 * Returns old value at success, 0 at failure. 427 * Returns old value at success, 0 at failure.
428 * (Of course, old value can be 0.) 428 * (Of course, old value can be 0.)
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index aa9701e12714..6c118d012bb5 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -162,7 +162,6 @@ static int walk_hugetlb_range(struct vm_area_struct *vma,
162 162
163/** 163/**
164 * walk_page_range - walk a memory map's page tables with a callback 164 * walk_page_range - walk a memory map's page tables with a callback
165 * @mm: memory map to walk
166 * @addr: starting address 165 * @addr: starting address
167 * @end: ending address 166 * @end: ending address
168 * @walk: set of callbacks to invoke for each level of the tree 167 * @walk: set of callbacks to invoke for each level of the tree
diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c
index 405d331804c3..3707c71ae4cd 100644
--- a/mm/percpu-vm.c
+++ b/mm/percpu-vm.c
@@ -360,7 +360,6 @@ err_free:
360 * @chunk: chunk to depopulate 360 * @chunk: chunk to depopulate
361 * @off: offset to the area to depopulate 361 * @off: offset to the area to depopulate
362 * @size: size of the area to depopulate in bytes 362 * @size: size of the area to depopulate in bytes
363 * @flush: whether to flush cache and tlb or not
364 * 363 *
365 * For each cpu, depopulate and unmap pages [@page_start,@page_end) 364 * For each cpu, depopulate and unmap pages [@page_start,@page_end)
366 * from @chunk. If @flush is true, vcache is flushed before unmapping 365 * from @chunk. If @flush is true, vcache is flushed before unmapping
diff --git a/mm/shmem.c b/mm/shmem.c
index a15a466d0d1d..4ce02e0673db 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1594,6 +1594,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,
1594 struct splice_pipe_desc spd = { 1594 struct splice_pipe_desc spd = {
1595 .pages = pages, 1595 .pages = pages,
1596 .partial = partial, 1596 .partial = partial,
1597 .nr_pages_max = PIPE_DEF_BUFFERS,
1597 .flags = flags, 1598 .flags = flags,
1598 .ops = &page_cache_pipe_buf_ops, 1599 .ops = &page_cache_pipe_buf_ops,
1599 .spd_release = spd_release_page, 1600 .spd_release = spd_release_page,
@@ -1682,7 +1683,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,
1682 if (spd.nr_pages) 1683 if (spd.nr_pages)
1683 error = splice_to_pipe(pipe, &spd); 1684 error = splice_to_pipe(pipe, &spd);
1684 1685
1685 splice_shrink_spd(pipe, &spd); 1686 splice_shrink_spd(&spd);
1686 1687
1687 if (error > 0) { 1688 if (error > 0) {
1688 *ppos += error; 1689 *ppos += error;
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 9ee48cb30179..3d33ecf13327 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -368,7 +368,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
368 const char *sptr = va_arg(ap, const char *); 368 const char *sptr = va_arg(ap, const char *);
369 uint16_t len = 0; 369 uint16_t len = 0;
370 if (sptr) 370 if (sptr)
371 len = min_t(uint16_t, strlen(sptr), 371 len = min_t(size_t, strlen(sptr),
372 USHRT_MAX); 372 USHRT_MAX);
373 373
374 errcode = p9pdu_writef(pdu, proto_version, 374 errcode = p9pdu_writef(pdu, proto_version,
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 5af18d11b518..2a167658bb95 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -192,10 +192,10 @@ static int pack_sg_list(struct scatterlist *sg, int start,
192 s = rest_of_page(data); 192 s = rest_of_page(data);
193 if (s > count) 193 if (s > count)
194 s = count; 194 s = count;
195 BUG_ON(index > limit);
195 sg_set_buf(&sg[index++], data, s); 196 sg_set_buf(&sg[index++], data, s);
196 count -= s; 197 count -= s;
197 data += s; 198 data += s;
198 BUG_ON(index > limit);
199 } 199 }
200 200
201 return index-start; 201 return index-start;
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 840e2c64a301..015471d801b4 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -617,6 +617,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
617 * changes */ 617 * changes */
618 if (skb_linearize(skb) < 0) 618 if (skb_linearize(skb) < 0)
619 goto out; 619 goto out;
620 /* skb_linearize() possibly changed skb->data */
621 tt_query = (struct tt_query_packet *)skb->data;
620 622
621 tt_len = tt_query->tt_data * sizeof(struct tt_change); 623 tt_len = tt_query->tt_data * sizeof(struct tt_change);
622 624
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index a66c2dcd1088..2ab83d7fb1f8 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -141,13 +141,14 @@ static void tt_orig_list_entry_free_rcu(struct rcu_head *rcu)
141 struct tt_orig_list_entry *orig_entry; 141 struct tt_orig_list_entry *orig_entry;
142 142
143 orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu); 143 orig_entry = container_of(rcu, struct tt_orig_list_entry, rcu);
144 atomic_dec(&orig_entry->orig_node->tt_size);
145 orig_node_free_ref(orig_entry->orig_node); 144 orig_node_free_ref(orig_entry->orig_node);
146 kfree(orig_entry); 145 kfree(orig_entry);
147} 146}
148 147
149static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry) 148static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry)
150{ 149{
150 /* to avoid race conditions, immediately decrease the tt counter */
151 atomic_dec(&orig_entry->orig_node->tt_size);
151 call_rcu(&orig_entry->rcu, tt_orig_list_entry_free_rcu); 152 call_rcu(&orig_entry->rcu, tt_orig_list_entry_free_rcu);
152} 153}
153 154
@@ -910,7 +911,6 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
910 } 911 }
911 spin_unlock_bh(list_lock); 912 spin_unlock_bh(list_lock);
912 } 913 }
913 atomic_set(&orig_node->tt_size, 0);
914 orig_node->tt_initialised = false; 914 orig_node->tt_initialised = false;
915} 915}
916 916
@@ -2031,10 +2031,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
2031{ 2031{
2032 struct tt_local_entry *tt_local_entry = NULL; 2032 struct tt_local_entry *tt_local_entry = NULL;
2033 struct tt_global_entry *tt_global_entry = NULL; 2033 struct tt_global_entry *tt_global_entry = NULL;
2034 bool ret = true; 2034 bool ret = false;
2035 2035
2036 if (!atomic_read(&bat_priv->ap_isolation)) 2036 if (!atomic_read(&bat_priv->ap_isolation))
2037 return false; 2037 goto out;
2038 2038
2039 tt_local_entry = tt_local_hash_find(bat_priv, dst); 2039 tt_local_entry = tt_local_hash_find(bat_priv, dst);
2040 if (!tt_local_entry) 2040 if (!tt_local_entry)
@@ -2044,10 +2044,10 @@ bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst)
2044 if (!tt_global_entry) 2044 if (!tt_global_entry)
2045 goto out; 2045 goto out;
2046 2046
2047 if (_is_ap_isolated(tt_local_entry, tt_global_entry)) 2047 if (!_is_ap_isolated(tt_local_entry, tt_global_entry))
2048 goto out; 2048 goto out;
2049 2049
2050 ret = false; 2050 ret = true;
2051 2051
2052out: 2052out:
2053 if (tt_global_entry) 2053 if (tt_global_entry)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4eefb7f65cf6..94ad124a4ea3 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3043,6 +3043,50 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
3043 hci_dev_unlock(hdev); 3043 hci_dev_unlock(hdev);
3044} 3044}
3045 3045
3046static void hci_key_refresh_complete_evt(struct hci_dev *hdev,
3047 struct sk_buff *skb)
3048{
3049 struct hci_ev_key_refresh_complete *ev = (void *) skb->data;
3050 struct hci_conn *conn;
3051
3052 BT_DBG("%s status %u handle %u", hdev->name, ev->status,
3053 __le16_to_cpu(ev->handle));
3054
3055 hci_dev_lock(hdev);
3056
3057 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
3058 if (!conn)
3059 goto unlock;
3060
3061 if (!ev->status)
3062 conn->sec_level = conn->pending_sec_level;
3063
3064 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
3065
3066 if (ev->status && conn->state == BT_CONNECTED) {
3067 hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE);
3068 hci_conn_put(conn);
3069 goto unlock;
3070 }
3071
3072 if (conn->state == BT_CONFIG) {
3073 if (!ev->status)
3074 conn->state = BT_CONNECTED;
3075
3076 hci_proto_connect_cfm(conn, ev->status);
3077 hci_conn_put(conn);
3078 } else {
3079 hci_auth_cfm(conn, ev->status);
3080
3081 hci_conn_hold(conn);
3082 conn->disc_timeout = HCI_DISCONN_TIMEOUT;
3083 hci_conn_put(conn);
3084 }
3085
3086unlock:
3087 hci_dev_unlock(hdev);
3088}
3089
3046static inline u8 hci_get_auth_req(struct hci_conn *conn) 3090static inline u8 hci_get_auth_req(struct hci_conn *conn)
3047{ 3091{
3048 /* If remote requests dedicated bonding follow that lead */ 3092 /* If remote requests dedicated bonding follow that lead */
@@ -3559,6 +3603,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
3559 hci_extended_inquiry_result_evt(hdev, skb); 3603 hci_extended_inquiry_result_evt(hdev, skb);
3560 break; 3604 break;
3561 3605
3606 case HCI_EV_KEY_REFRESH_COMPLETE:
3607 hci_key_refresh_complete_evt(hdev, skb);
3608 break;
3609
3562 case HCI_EV_IO_CAPA_REQUEST: 3610 case HCI_EV_IO_CAPA_REQUEST:
3563 hci_io_capa_request_evt(hdev, skb); 3611 hci_io_capa_request_evt(hdev, skb);
3564 break; 3612 break;
diff --git a/net/bluetooth/hidp/Kconfig b/net/bluetooth/hidp/Kconfig
index 4deaca78e91e..9332bc7aa851 100644
--- a/net/bluetooth/hidp/Kconfig
+++ b/net/bluetooth/hidp/Kconfig
@@ -1,6 +1,6 @@
1config BT_HIDP 1config BT_HIDP
2 tristate "HIDP protocol support" 2 tristate "HIDP protocol support"
3 depends on BT && INPUT && HID_SUPPORT 3 depends on BT && INPUT
4 select HID 4 select HID
5 help 5 help
6 HIDP (Human Interface Device Protocol) is a transport layer 6 HIDP (Human Interface Device Protocol) is a transport layer
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 24f144b72a96..4554e80d16a3 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1295,7 +1295,12 @@ static void security_timeout(struct work_struct *work)
1295 struct l2cap_conn *conn = container_of(work, struct l2cap_conn, 1295 struct l2cap_conn *conn = container_of(work, struct l2cap_conn,
1296 security_timer.work); 1296 security_timer.work);
1297 1297
1298 l2cap_conn_del(conn->hcon, ETIMEDOUT); 1298 BT_DBG("conn %p", conn);
1299
1300 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) {
1301 smp_chan_destroy(conn);
1302 l2cap_conn_del(conn->hcon, ETIMEDOUT);
1303 }
1299} 1304}
1300 1305
1301static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) 1306static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
@@ -2910,12 +2915,14 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len)
2910 while (len >= L2CAP_CONF_OPT_SIZE) { 2915 while (len >= L2CAP_CONF_OPT_SIZE) {
2911 len -= l2cap_get_conf_opt(&rsp, &type, &olen, &val); 2916 len -= l2cap_get_conf_opt(&rsp, &type, &olen, &val);
2912 2917
2913 switch (type) { 2918 if (type != L2CAP_CONF_RFC)
2914 case L2CAP_CONF_RFC: 2919 continue;
2915 if (olen == sizeof(rfc)) 2920
2916 memcpy(&rfc, (void *)val, olen); 2921 if (olen != sizeof(rfc))
2917 goto done; 2922 break;
2918 } 2923
2924 memcpy(&rfc, (void *)val, olen);
2925 goto done;
2919 } 2926 }
2920 2927
2921 /* Use sane default values in case a misbehaving remote device 2928 /* Use sane default values in case a misbehaving remote device
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 25d220776079..3e5e3362ea00 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1598,7 +1598,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
1598 else 1598 else
1599 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); 1599 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr);
1600 1600
1601 if (!conn) { 1601 if (!conn || conn->state == BT_OPEN || conn->state == BT_CLOSED) {
1602 err = cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT, 1602 err = cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
1603 MGMT_STATUS_NOT_CONNECTED); 1603 MGMT_STATUS_NOT_CONNECTED);
1604 goto failed; 1604 goto failed;
@@ -1873,6 +1873,22 @@ static void pairing_complete_cb(struct hci_conn *conn, u8 status)
1873 pairing_complete(cmd, mgmt_status(status)); 1873 pairing_complete(cmd, mgmt_status(status));
1874} 1874}
1875 1875
1876static void le_connect_complete_cb(struct hci_conn *conn, u8 status)
1877{
1878 struct pending_cmd *cmd;
1879
1880 BT_DBG("status %u", status);
1881
1882 if (!status)
1883 return;
1884
1885 cmd = find_pairing(conn);
1886 if (!cmd)
1887 BT_DBG("Unable to find a pending command");
1888 else
1889 pairing_complete(cmd, mgmt_status(status));
1890}
1891
1876static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, 1892static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
1877 u16 len) 1893 u16 len)
1878{ 1894{
@@ -1934,6 +1950,8 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
1934 /* For LE, just connecting isn't a proof that the pairing finished */ 1950 /* For LE, just connecting isn't a proof that the pairing finished */
1935 if (cp->addr.type == BDADDR_BREDR) 1951 if (cp->addr.type == BDADDR_BREDR)
1936 conn->connect_cfm_cb = pairing_complete_cb; 1952 conn->connect_cfm_cb = pairing_complete_cb;
1953 else
1954 conn->connect_cfm_cb = le_connect_complete_cb;
1937 1955
1938 conn->security_cfm_cb = pairing_complete_cb; 1956 conn->security_cfm_cb = pairing_complete_cb;
1939 conn->disconn_cfm_cb = pairing_complete_cb; 1957 conn->disconn_cfm_cb = pairing_complete_cb;
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 6fc7c4708f3e..37df4e9b3896 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -648,7 +648,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
648 648
649 auth |= (req->auth_req | rsp->auth_req) & SMP_AUTH_MITM; 649 auth |= (req->auth_req | rsp->auth_req) & SMP_AUTH_MITM;
650 650
651 ret = tk_request(conn, 0, auth, rsp->io_capability, req->io_capability); 651 ret = tk_request(conn, 0, auth, req->io_capability, rsp->io_capability);
652 if (ret) 652 if (ret)
653 return SMP_UNSPECIFIED; 653 return SMP_UNSPECIFIED;
654 654
@@ -703,7 +703,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
703 return 0; 703 return 0;
704} 704}
705 705
706static u8 smp_ltk_encrypt(struct l2cap_conn *conn) 706static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
707{ 707{
708 struct smp_ltk *key; 708 struct smp_ltk *key;
709 struct hci_conn *hcon = conn->hcon; 709 struct hci_conn *hcon = conn->hcon;
@@ -712,6 +712,9 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn)
712 if (!key) 712 if (!key)
713 return 0; 713 return 0;
714 714
715 if (sec_level > BT_SECURITY_MEDIUM && !key->authenticated)
716 return 0;
717
715 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) 718 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags))
716 return 1; 719 return 1;
717 720
@@ -732,7 +735,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
732 735
733 hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req); 736 hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req);
734 737
735 if (smp_ltk_encrypt(conn)) 738 if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
736 return 0; 739 return 0;
737 740
738 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) 741 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
@@ -771,7 +774,7 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
771 return 1; 774 return 1;
772 775
773 if (hcon->link_mode & HCI_LM_MASTER) 776 if (hcon->link_mode & HCI_LM_MASTER)
774 if (smp_ltk_encrypt(conn)) 777 if (smp_ltk_encrypt(conn, sec_level))
775 goto done; 778 goto done;
776 779
777 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) 780 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 0a942fbccc9a..e1144e1617be 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -240,6 +240,7 @@ int br_add_bridge(struct net *net, const char *name)
240 return -ENOMEM; 240 return -ENOMEM;
241 241
242 dev_net_set(dev, net); 242 dev_net_set(dev, net);
243 dev->rtnl_link_ops = &br_link_ops;
243 244
244 res = register_netdev(dev); 245 res = register_netdev(dev);
245 if (res) 246 if (res)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 2080485515f1..fe41260fbf38 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -208,7 +208,7 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
208 return 0; 208 return 0;
209} 209}
210 210
211static struct rtnl_link_ops br_link_ops __read_mostly = { 211struct rtnl_link_ops br_link_ops __read_mostly = {
212 .kind = "bridge", 212 .kind = "bridge",
213 .priv_size = sizeof(struct net_bridge), 213 .priv_size = sizeof(struct net_bridge),
214 .setup = br_dev_setup, 214 .setup = br_dev_setup,
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 1a8ad4fb9a6b..a768b2408edf 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -549,6 +549,7 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)
549#endif 549#endif
550 550
551/* br_netlink.c */ 551/* br_netlink.c */
552extern struct rtnl_link_ops br_link_ops;
552extern int br_netlink_init(void); 553extern int br_netlink_init(void);
553extern void br_netlink_fini(void); 554extern void br_netlink_fini(void);
554extern void br_ifinfo_notify(int event, struct net_bridge_port *port); 555extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index aa6f716524fd..554b31289607 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -4,8 +4,7 @@
4 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 4 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
5 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
6 * 6 *
7 * Borrowed heavily from file: pn_dev.c. Thanks to 7 * Borrowed heavily from file: pn_dev.c. Thanks to Remi Denis-Courmont
8 * Remi Denis-Courmont <remi.denis-courmont@nokia.com>
9 * and Sakari Ailus <sakari.ailus@nokia.com> 8 * and Sakari Ailus <sakari.ailus@nokia.com>
10 */ 9 */
11 10
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index fb8944355264..78f1cdad5b33 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -220,6 +220,7 @@ static void caif_ctrl_cb(struct cflayer *layr,
220 cfsk_hold, cfsk_put); 220 cfsk_hold, cfsk_put);
221 cf_sk->sk.sk_state = CAIF_CONNECTED; 221 cf_sk->sk.sk_state = CAIF_CONNECTED;
222 set_tx_flow_on(cf_sk); 222 set_tx_flow_on(cf_sk);
223 cf_sk->sk.sk_shutdown = 0;
223 cf_sk->sk.sk_state_change(&cf_sk->sk); 224 cf_sk->sk.sk_state_change(&cf_sk->sk);
224 break; 225 break;
225 226
diff --git a/net/can/raw.c b/net/can/raw.c
index cde1b4a20f75..46cca3a91d19 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -681,9 +681,6 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
681 if (err < 0) 681 if (err < 0)
682 goto free_skb; 682 goto free_skb;
683 683
684 /* to be able to check the received tx sock reference in raw_rcv() */
685 skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF;
686
687 skb->dev = dev; 684 skb->dev = dev;
688 skb->sk = sk; 685 skb->sk = sk;
689 686
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index a776f751edbf..ba4323bce0e9 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -504,13 +504,6 @@ void ceph_destroy_client(struct ceph_client *client)
504 /* unmount */ 504 /* unmount */
505 ceph_osdc_stop(&client->osdc); 505 ceph_osdc_stop(&client->osdc);
506 506
507 /*
508 * make sure osd connections close out before destroying the
509 * auth module, which is needed to free those connections'
510 * ceph_authorizers.
511 */
512 ceph_msgr_flush();
513
514 ceph_monc_stop(&client->monc); 507 ceph_monc_stop(&client->monc);
515 508
516 ceph_debugfs_client_cleanup(client); 509 ceph_debugfs_client_cleanup(client);
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 524f4e4f598b..b332c3d76059 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -563,6 +563,10 @@ static void prepare_write_message(struct ceph_connection *con)
563 m->hdr.seq = cpu_to_le64(++con->out_seq); 563 m->hdr.seq = cpu_to_le64(++con->out_seq);
564 m->needs_out_seq = false; 564 m->needs_out_seq = false;
565 } 565 }
566#ifdef CONFIG_BLOCK
567 else
568 m->bio_iter = NULL;
569#endif
566 570
567 dout("prepare_write_message %p seq %lld type %d len %d+%d+%d %d pgs\n", 571 dout("prepare_write_message %p seq %lld type %d len %d+%d+%d %d pgs\n",
568 m, con->out_seq, le16_to_cpu(m->hdr.type), 572 m, con->out_seq, le16_to_cpu(m->hdr.type),
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 10d6008d31f2..d0649a9655be 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -847,6 +847,14 @@ void ceph_monc_stop(struct ceph_mon_client *monc)
847 847
848 mutex_unlock(&monc->mutex); 848 mutex_unlock(&monc->mutex);
849 849
850 /*
851 * flush msgr queue before we destroy ourselves to ensure that:
852 * - any work that references our embedded con is finished.
853 * - any osd_client or other work that may reference an authorizer
854 * finishes before we shut down the auth subsystem.
855 */
856 ceph_msgr_flush();
857
850 ceph_auth_destroy(monc->auth); 858 ceph_auth_destroy(monc->auth);
851 859
852 ceph_msg_put(monc->m_auth); 860 ceph_msg_put(monc->m_auth);
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 1ffebed5ce0f..ca59e66c9787 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -139,15 +139,15 @@ void ceph_osdc_release_request(struct kref *kref)
139 139
140 if (req->r_request) 140 if (req->r_request)
141 ceph_msg_put(req->r_request); 141 ceph_msg_put(req->r_request);
142 if (req->r_reply)
143 ceph_msg_put(req->r_reply);
144 if (req->r_con_filling_msg) { 142 if (req->r_con_filling_msg) {
145 dout("release_request revoking pages %p from con %p\n", 143 dout("release_request revoking pages %p from con %p\n",
146 req->r_pages, req->r_con_filling_msg); 144 req->r_pages, req->r_con_filling_msg);
147 ceph_con_revoke_message(req->r_con_filling_msg, 145 ceph_con_revoke_message(req->r_con_filling_msg,
148 req->r_reply); 146 req->r_reply);
149 ceph_con_put(req->r_con_filling_msg); 147 req->r_con_filling_msg->ops->put(req->r_con_filling_msg);
150 } 148 }
149 if (req->r_reply)
150 ceph_msg_put(req->r_reply);
151 if (req->r_own_pages) 151 if (req->r_own_pages)
152 ceph_release_page_vector(req->r_pages, 152 ceph_release_page_vector(req->r_pages,
153 req->r_num_pages); 153 req->r_num_pages);
@@ -1216,7 +1216,7 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
1216 if (req->r_con_filling_msg == con && req->r_reply == msg) { 1216 if (req->r_con_filling_msg == con && req->r_reply == msg) {
1217 dout(" dropping con_filling_msg ref %p\n", con); 1217 dout(" dropping con_filling_msg ref %p\n", con);
1218 req->r_con_filling_msg = NULL; 1218 req->r_con_filling_msg = NULL;
1219 ceph_con_put(con); 1219 con->ops->put(con);
1220 } 1220 }
1221 1221
1222 if (!req->r_got_reply) { 1222 if (!req->r_got_reply) {
@@ -2028,7 +2028,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2028 dout("get_reply revoking msg %p from old con %p\n", 2028 dout("get_reply revoking msg %p from old con %p\n",
2029 req->r_reply, req->r_con_filling_msg); 2029 req->r_reply, req->r_con_filling_msg);
2030 ceph_con_revoke_message(req->r_con_filling_msg, req->r_reply); 2030 ceph_con_revoke_message(req->r_con_filling_msg, req->r_reply);
2031 ceph_con_put(req->r_con_filling_msg); 2031 req->r_con_filling_msg->ops->put(req->r_con_filling_msg);
2032 req->r_con_filling_msg = NULL; 2032 req->r_con_filling_msg = NULL;
2033 } 2033 }
2034 2034
@@ -2063,7 +2063,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2063#endif 2063#endif
2064 } 2064 }
2065 *skip = 0; 2065 *skip = 0;
2066 req->r_con_filling_msg = ceph_con_get(con); 2066 req->r_con_filling_msg = con->ops->get(con);
2067 dout("get_reply tid %lld %p\n", tid, m); 2067 dout("get_reply tid %lld %p\n", tid, m);
2068 2068
2069out: 2069out:
diff --git a/net/core/dev.c b/net/core/dev.c
index cd0981977f5c..84f01ba81a34 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1136,8 +1136,8 @@ void dev_load(struct net *net, const char *name)
1136 no_module = request_module("netdev-%s", name); 1136 no_module = request_module("netdev-%s", name);
1137 if (no_module && capable(CAP_SYS_MODULE)) { 1137 if (no_module && capable(CAP_SYS_MODULE)) {
1138 if (!request_module("%s", name)) 1138 if (!request_module("%s", name))
1139 pr_err("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s instead.\n", 1139 pr_warn("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s instead.\n",
1140 name); 1140 name);
1141 } 1141 }
1142} 1142}
1143EXPORT_SYMBOL(dev_load); 1143EXPORT_SYMBOL(dev_load);
@@ -2089,25 +2089,6 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features)
2089 return 0; 2089 return 0;
2090} 2090}
2091 2091
2092/*
2093 * Try to orphan skb early, right before transmission by the device.
2094 * We cannot orphan skb if tx timestamp is requested or the sk-reference
2095 * is needed on driver level for other reasons, e.g. see net/can/raw.c
2096 */
2097static inline void skb_orphan_try(struct sk_buff *skb)
2098{
2099 struct sock *sk = skb->sk;
2100
2101 if (sk && !skb_shinfo(skb)->tx_flags) {
2102 /* skb_tx_hash() wont be able to get sk.
2103 * We copy sk_hash into skb->rxhash
2104 */
2105 if (!skb->rxhash)
2106 skb->rxhash = sk->sk_hash;
2107 skb_orphan(skb);
2108 }
2109}
2110
2111static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) 2092static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
2112{ 2093{
2113 return ((features & NETIF_F_GEN_CSUM) || 2094 return ((features & NETIF_F_GEN_CSUM) ||
@@ -2193,8 +2174,6 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2193 if (!list_empty(&ptype_all)) 2174 if (!list_empty(&ptype_all))
2194 dev_queue_xmit_nit(skb, dev); 2175 dev_queue_xmit_nit(skb, dev);
2195 2176
2196 skb_orphan_try(skb);
2197
2198 features = netif_skb_features(skb); 2177 features = netif_skb_features(skb);
2199 2178
2200 if (vlan_tx_tag_present(skb) && 2179 if (vlan_tx_tag_present(skb) &&
@@ -2304,7 +2283,7 @@ u16 __skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb,
2304 if (skb->sk && skb->sk->sk_hash) 2283 if (skb->sk && skb->sk->sk_hash)
2305 hash = skb->sk->sk_hash; 2284 hash = skb->sk->sk_hash;
2306 else 2285 else
2307 hash = (__force u16) skb->protocol ^ skb->rxhash; 2286 hash = (__force u16) skb->protocol;
2308 hash = jhash_1word(hash, hashrnd); 2287 hash = jhash_1word(hash, hashrnd);
2309 2288
2310 return (u16) (((u64) hash * qcount) >> 32) + qoffset; 2289 return (u16) (((u64) hash * qcount) >> 32) + qoffset;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d78671e9d545..46a3d23d259e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1755,6 +1755,7 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
1755 struct splice_pipe_desc spd = { 1755 struct splice_pipe_desc spd = {
1756 .pages = pages, 1756 .pages = pages,
1757 .partial = partial, 1757 .partial = partial,
1758 .nr_pages_max = MAX_SKB_FRAGS,
1758 .flags = flags, 1759 .flags = flags,
1759 .ops = &sock_pipe_buf_ops, 1760 .ops = &sock_pipe_buf_ops,
1760 .spd_release = sock_spd_release, 1761 .spd_release = sock_spd_release,
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 74c21b924a79..608327661960 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1349,8 +1349,8 @@ static int fib6_walk_continue(struct fib6_walker_t *w)
1349 if (w->leaf && fn->fn_flags & RTN_RTINFO) { 1349 if (w->leaf && fn->fn_flags & RTN_RTINFO) {
1350 int err; 1350 int err;
1351 1351
1352 if (w->count < w->skip) { 1352 if (w->skip) {
1353 w->count++; 1353 w->skip--;
1354 continue; 1354 continue;
1355 } 1355 }
1356 1356
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 999a982ad3fd..becb048d18d4 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2957,10 +2957,6 @@ static int __net_init ip6_route_net_init(struct net *net)
2957 net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ; 2957 net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ;
2958 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40; 2958 net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;
2959 2959
2960#ifdef CONFIG_PROC_FS
2961 proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
2962 proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
2963#endif
2964 net->ipv6.ip6_rt_gc_expire = 30*HZ; 2960 net->ipv6.ip6_rt_gc_expire = 30*HZ;
2965 2961
2966 ret = 0; 2962 ret = 0;
@@ -2981,10 +2977,6 @@ out_ip6_dst_ops:
2981 2977
2982static void __net_exit ip6_route_net_exit(struct net *net) 2978static void __net_exit ip6_route_net_exit(struct net *net)
2983{ 2979{
2984#ifdef CONFIG_PROC_FS
2985 proc_net_remove(net, "ipv6_route");
2986 proc_net_remove(net, "rt6_stats");
2987#endif
2988 kfree(net->ipv6.ip6_null_entry); 2980 kfree(net->ipv6.ip6_null_entry);
2989#ifdef CONFIG_IPV6_MULTIPLE_TABLES 2981#ifdef CONFIG_IPV6_MULTIPLE_TABLES
2990 kfree(net->ipv6.ip6_prohibit_entry); 2982 kfree(net->ipv6.ip6_prohibit_entry);
@@ -2993,11 +2985,33 @@ static void __net_exit ip6_route_net_exit(struct net *net)
2993 dst_entries_destroy(&net->ipv6.ip6_dst_ops); 2985 dst_entries_destroy(&net->ipv6.ip6_dst_ops);
2994} 2986}
2995 2987
2988static int __net_init ip6_route_net_init_late(struct net *net)
2989{
2990#ifdef CONFIG_PROC_FS
2991 proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
2992 proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
2993#endif
2994 return 0;
2995}
2996
2997static void __net_exit ip6_route_net_exit_late(struct net *net)
2998{
2999#ifdef CONFIG_PROC_FS
3000 proc_net_remove(net, "ipv6_route");
3001 proc_net_remove(net, "rt6_stats");
3002#endif
3003}
3004
2996static struct pernet_operations ip6_route_net_ops = { 3005static struct pernet_operations ip6_route_net_ops = {
2997 .init = ip6_route_net_init, 3006 .init = ip6_route_net_init,
2998 .exit = ip6_route_net_exit, 3007 .exit = ip6_route_net_exit,
2999}; 3008};
3000 3009
3010static struct pernet_operations ip6_route_net_late_ops = {
3011 .init = ip6_route_net_init_late,
3012 .exit = ip6_route_net_exit_late,
3013};
3014
3001static struct notifier_block ip6_route_dev_notifier = { 3015static struct notifier_block ip6_route_dev_notifier = {
3002 .notifier_call = ip6_route_dev_notify, 3016 .notifier_call = ip6_route_dev_notify,
3003 .priority = 0, 3017 .priority = 0,
@@ -3047,19 +3061,25 @@ int __init ip6_route_init(void)
3047 if (ret) 3061 if (ret)
3048 goto xfrm6_init; 3062 goto xfrm6_init;
3049 3063
3064 ret = register_pernet_subsys(&ip6_route_net_late_ops);
3065 if (ret)
3066 goto fib6_rules_init;
3067
3050 ret = -ENOBUFS; 3068 ret = -ENOBUFS;
3051 if (__rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL, NULL) || 3069 if (__rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL, NULL) ||
3052 __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL, NULL) || 3070 __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL, NULL) ||
3053 __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL, NULL)) 3071 __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL, NULL))
3054 goto fib6_rules_init; 3072 goto out_register_late_subsys;
3055 3073
3056 ret = register_netdevice_notifier(&ip6_route_dev_notifier); 3074 ret = register_netdevice_notifier(&ip6_route_dev_notifier);
3057 if (ret) 3075 if (ret)
3058 goto fib6_rules_init; 3076 goto out_register_late_subsys;
3059 3077
3060out: 3078out:
3061 return ret; 3079 return ret;
3062 3080
3081out_register_late_subsys:
3082 unregister_pernet_subsys(&ip6_route_net_late_ops);
3063fib6_rules_init: 3083fib6_rules_init:
3064 fib6_rules_cleanup(); 3084 fib6_rules_cleanup();
3065xfrm6_init: 3085xfrm6_init:
@@ -3078,6 +3098,7 @@ out_kmem_cache:
3078void ip6_route_cleanup(void) 3098void ip6_route_cleanup(void)
3079{ 3099{
3080 unregister_netdevice_notifier(&ip6_route_dev_notifier); 3100 unregister_netdevice_notifier(&ip6_route_dev_notifier);
3101 unregister_pernet_subsys(&ip6_route_net_late_ops);
3081 fib6_rules_cleanup(); 3102 fib6_rules_cleanup();
3082 xfrm6_fini(); 3103 xfrm6_fini();
3083 fib6_gc_cleanup(); 3104 fib6_gc_cleanup();
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3a9aec29581a..9df64a50b075 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1212,7 +1212,8 @@ have_isn:
1212 tcp_rsk(req)->snt_isn = isn; 1212 tcp_rsk(req)->snt_isn = isn;
1213 tcp_rsk(req)->snt_synack = tcp_time_stamp; 1213 tcp_rsk(req)->snt_synack = tcp_time_stamp;
1214 1214
1215 security_inet_conn_request(sk, skb, req); 1215 if (security_inet_conn_request(sk, skb, req))
1216 goto drop_and_release;
1216 1217
1217 if (tcp_v6_send_synack(sk, req, 1218 if (tcp_v6_send_synack(sk, req,
1218 (struct request_values *)&tmp_ext, 1219 (struct request_values *)&tmp_ext,
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 07d7d55a1b93..cd6f7a991d80 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -372,7 +372,6 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,
372 skb_trim(skb, skb->dev->mtu); 372 skb_trim(skb, skb->dev->mtu);
373 } 373 }
374 skb->protocol = ETH_P_AF_IUCV; 374 skb->protocol = ETH_P_AF_IUCV;
375 skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF;
376 nskb = skb_clone(skb, GFP_ATOMIC); 375 nskb = skb_clone(skb, GFP_ATOMIC);
377 if (!nskb) 376 if (!nskb)
378 return -ENOMEM; 377 return -ENOMEM;
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 185f12f4a5fa..47b259fccd27 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -42,6 +42,11 @@ struct l2tp_eth {
42 struct sock *tunnel_sock; 42 struct sock *tunnel_sock;
43 struct l2tp_session *session; 43 struct l2tp_session *session;
44 struct list_head list; 44 struct list_head list;
45 atomic_long_t tx_bytes;
46 atomic_long_t tx_packets;
47 atomic_long_t rx_bytes;
48 atomic_long_t rx_packets;
49 atomic_long_t rx_errors;
45}; 50};
46 51
47/* via l2tp_session_priv() */ 52/* via l2tp_session_priv() */
@@ -88,24 +93,40 @@ static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev)
88 struct l2tp_eth *priv = netdev_priv(dev); 93 struct l2tp_eth *priv = netdev_priv(dev);
89 struct l2tp_session *session = priv->session; 94 struct l2tp_session *session = priv->session;
90 95
96 atomic_long_add(skb->len, &priv->tx_bytes);
97 atomic_long_inc(&priv->tx_packets);
98
91 l2tp_xmit_skb(session, skb, session->hdr_len); 99 l2tp_xmit_skb(session, skb, session->hdr_len);
92 100
93 dev->stats.tx_bytes += skb->len; 101 return NETDEV_TX_OK;
94 dev->stats.tx_packets++; 102}
95 103
96 return 0; 104static struct rtnl_link_stats64 *l2tp_eth_get_stats64(struct net_device *dev,
105 struct rtnl_link_stats64 *stats)
106{
107 struct l2tp_eth *priv = netdev_priv(dev);
108
109 stats->tx_bytes = atomic_long_read(&priv->tx_bytes);
110 stats->tx_packets = atomic_long_read(&priv->tx_packets);
111 stats->rx_bytes = atomic_long_read(&priv->rx_bytes);
112 stats->rx_packets = atomic_long_read(&priv->rx_packets);
113 stats->rx_errors = atomic_long_read(&priv->rx_errors);
114 return stats;
97} 115}
98 116
117
99static struct net_device_ops l2tp_eth_netdev_ops = { 118static struct net_device_ops l2tp_eth_netdev_ops = {
100 .ndo_init = l2tp_eth_dev_init, 119 .ndo_init = l2tp_eth_dev_init,
101 .ndo_uninit = l2tp_eth_dev_uninit, 120 .ndo_uninit = l2tp_eth_dev_uninit,
102 .ndo_start_xmit = l2tp_eth_dev_xmit, 121 .ndo_start_xmit = l2tp_eth_dev_xmit,
122 .ndo_get_stats64 = l2tp_eth_get_stats64,
103}; 123};
104 124
105static void l2tp_eth_dev_setup(struct net_device *dev) 125static void l2tp_eth_dev_setup(struct net_device *dev)
106{ 126{
107 ether_setup(dev); 127 ether_setup(dev);
108 dev->priv_flags &= ~IFF_TX_SKB_SHARING; 128 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
129 dev->features |= NETIF_F_LLTX;
109 dev->netdev_ops = &l2tp_eth_netdev_ops; 130 dev->netdev_ops = &l2tp_eth_netdev_ops;
110 dev->destructor = free_netdev; 131 dev->destructor = free_netdev;
111} 132}
@@ -114,17 +135,17 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb,
114{ 135{
115 struct l2tp_eth_sess *spriv = l2tp_session_priv(session); 136 struct l2tp_eth_sess *spriv = l2tp_session_priv(session);
116 struct net_device *dev = spriv->dev; 137 struct net_device *dev = spriv->dev;
138 struct l2tp_eth *priv = netdev_priv(dev);
117 139
118 if (session->debug & L2TP_MSG_DATA) { 140 if (session->debug & L2TP_MSG_DATA) {
119 unsigned int length; 141 unsigned int length;
120 u8 *ptr = skb->data;
121 142
122 length = min(32u, skb->len); 143 length = min(32u, skb->len);
123 if (!pskb_may_pull(skb, length)) 144 if (!pskb_may_pull(skb, length))
124 goto error; 145 goto error;
125 146
126 pr_debug("%s: eth recv\n", session->name); 147 pr_debug("%s: eth recv\n", session->name);
127 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); 148 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, length);
128 } 149 }
129 150
130 if (!pskb_may_pull(skb, sizeof(ETH_HLEN))) 151 if (!pskb_may_pull(skb, sizeof(ETH_HLEN)))
@@ -139,15 +160,15 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb,
139 nf_reset(skb); 160 nf_reset(skb);
140 161
141 if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) { 162 if (dev_forward_skb(dev, skb) == NET_RX_SUCCESS) {
142 dev->stats.rx_packets++; 163 atomic_long_inc(&priv->rx_packets);
143 dev->stats.rx_bytes += data_len; 164 atomic_long_add(data_len, &priv->rx_bytes);
144 } else 165 } else {
145 dev->stats.rx_errors++; 166 atomic_long_inc(&priv->rx_errors);
146 167 }
147 return; 168 return;
148 169
149error: 170error:
150 dev->stats.rx_errors++; 171 atomic_long_inc(&priv->rx_errors);
151 kfree_skb(skb); 172 kfree_skb(skb);
152} 173}
153 174
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e9cecca5c44d..7d5108a867ad 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2093,6 +2093,9 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
2093 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2093 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2094 int i, ret; 2094 int i, ret;
2095 2095
2096 if (!ieee80211_sdata_running(sdata))
2097 return -ENETDOWN;
2098
2096 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) { 2099 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
2097 ret = drv_set_bitrate_mask(local, sdata, mask); 2100 ret = drv_set_bitrate_mask(local, sdata, mask);
2098 if (ret) 2101 if (ret)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 91d84cc77bbf..a4bb856de08f 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1342,7 +1342,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1342 struct ieee80211_local *local = sdata->local; 1342 struct ieee80211_local *local = sdata->local;
1343 struct sta_info *sta; 1343 struct sta_info *sta;
1344 u32 changed = 0; 1344 u32 changed = 0;
1345 u8 bssid[ETH_ALEN];
1346 1345
1347 ASSERT_MGD_MTX(ifmgd); 1346 ASSERT_MGD_MTX(ifmgd);
1348 1347
@@ -1352,10 +1351,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1352 if (WARN_ON(!ifmgd->associated)) 1351 if (WARN_ON(!ifmgd->associated))
1353 return; 1352 return;
1354 1353
1355 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); 1354 ieee80211_stop_poll(sdata);
1356 1355
1357 ifmgd->associated = NULL; 1356 ifmgd->associated = NULL;
1358 memset(ifmgd->bssid, 0, ETH_ALEN);
1359 1357
1360 /* 1358 /*
1361 * we need to commit the associated = NULL change because the 1359 * we need to commit the associated = NULL change because the
@@ -1375,7 +1373,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1375 netif_carrier_off(sdata->dev); 1373 netif_carrier_off(sdata->dev);
1376 1374
1377 mutex_lock(&local->sta_mtx); 1375 mutex_lock(&local->sta_mtx);
1378 sta = sta_info_get(sdata, bssid); 1376 sta = sta_info_get(sdata, ifmgd->bssid);
1379 if (sta) { 1377 if (sta) {
1380 set_sta_flag(sta, WLAN_STA_BLOCK_BA); 1378 set_sta_flag(sta, WLAN_STA_BLOCK_BA);
1381 ieee80211_sta_tear_down_BA_sessions(sta, tx); 1379 ieee80211_sta_tear_down_BA_sessions(sta, tx);
@@ -1384,13 +1382,16 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1384 1382
1385 /* deauthenticate/disassociate now */ 1383 /* deauthenticate/disassociate now */
1386 if (tx || frame_buf) 1384 if (tx || frame_buf)
1387 ieee80211_send_deauth_disassoc(sdata, bssid, stype, reason, 1385 ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype,
1388 tx, frame_buf); 1386 reason, tx, frame_buf);
1389 1387
1390 /* flush out frame */ 1388 /* flush out frame */
1391 if (tx) 1389 if (tx)
1392 drv_flush(local, false); 1390 drv_flush(local, false);
1393 1391
1392 /* clear bssid only after building the needed mgmt frames */
1393 memset(ifmgd->bssid, 0, ETH_ALEN);
1394
1394 /* remove AP and TDLS peers */ 1395 /* remove AP and TDLS peers */
1395 sta_info_flush(local, sdata); 1396 sta_info_flush(local, sdata);
1396 1397
@@ -2612,8 +2613,6 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
2612 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2613 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2613 u8 frame_buf[DEAUTH_DISASSOC_LEN]; 2614 u8 frame_buf[DEAUTH_DISASSOC_LEN];
2614 2615
2615 ieee80211_stop_poll(sdata);
2616
2617 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, 2616 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
2618 false, frame_buf); 2617 false, frame_buf);
2619 mutex_unlock(&ifmgd->mtx); 2618 mutex_unlock(&ifmgd->mtx);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7bcecf73aafb..965e6ec0adb6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2455,7 +2455,7 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)
2455 * frames that we didn't handle, including returning unknown 2455 * frames that we didn't handle, including returning unknown
2456 * ones. For all other modes we will return them to the sender, 2456 * ones. For all other modes we will return them to the sender,
2457 * setting the 0x80 bit in the action category, as required by 2457 * setting the 0x80 bit in the action category, as required by
2458 * 802.11-2007 7.3.1.11. 2458 * 802.11-2012 9.24.4.
2459 * Newer versions of hostapd shall also use the management frame 2459 * Newer versions of hostapd shall also use the management frame
2460 * registration mechanisms, but older ones still use cooked 2460 * registration mechanisms, but older ones still use cooked
2461 * monitor interfaces so push all frames there. 2461 * monitor interfaces so push all frames there.
@@ -2465,6 +2465,9 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)
2465 sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) 2465 sdata->vif.type == NL80211_IFTYPE_AP_VLAN))
2466 return RX_DROP_MONITOR; 2466 return RX_DROP_MONITOR;
2467 2467
2468 if (is_multicast_ether_addr(mgmt->da))
2469 return RX_DROP_MONITOR;
2470
2468 /* do not return rejected action frames */ 2471 /* do not return rejected action frames */
2469 if (mgmt->u.action.category & 0x80) 2472 if (mgmt->u.action.category & 0x80)
2470 return RX_DROP_UNUSABLE; 2473 return RX_DROP_UNUSABLE;
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 3bb24a121c95..a470e1123a55 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -271,6 +271,9 @@ struct sta_ampdu_mlme {
271 * @plink_timer: peer link watch timer 271 * @plink_timer: peer link watch timer
272 * @plink_timer_was_running: used by suspend/resume to restore timers 272 * @plink_timer_was_running: used by suspend/resume to restore timers
273 * @t_offset: timing offset relative to this host 273 * @t_offset: timing offset relative to this host
274 * @t_offset_setpoint: reference timing offset of this sta to be used when
275 * calculating clockdrift
276 * @ch_type: peer's channel type
274 * @debugfs: debug filesystem info 277 * @debugfs: debug filesystem info
275 * @dead: set to true when sta is unlinked 278 * @dead: set to true when sta is unlinked
276 * @uploaded: set to true when sta is uploaded to the driver 279 * @uploaded: set to true when sta is uploaded to the driver
@@ -278,6 +281,8 @@ struct sta_ampdu_mlme {
278 * @sta: station information we share with the driver 281 * @sta: station information we share with the driver
279 * @sta_state: duplicates information about station state (for debug) 282 * @sta_state: duplicates information about station state (for debug)
280 * @beacon_loss_count: number of times beacon loss has triggered 283 * @beacon_loss_count: number of times beacon loss has triggered
284 * @supports_40mhz: tracks whether the station advertised 40 MHz support
285 * as we overwrite its HT parameters with the currently used value
281 */ 286 */
282struct sta_info { 287struct sta_info {
283 /* General information, mostly static */ 288 /* General information, mostly static */
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 8781d8f904d9..434b6873b352 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -83,9 +83,10 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
83{ 83{
84 struct xmit_work *work; 84 struct xmit_work *work;
85 85
86 if (!(priv->phy->channels_supported[page] & (1 << chan))) 86 if (!(priv->phy->channels_supported[page] & (1 << chan))) {
87 WARN_ON(1); 87 WARN_ON(1);
88 return NETDEV_TX_OK; 88 return NETDEV_TX_OK;
89 }
89 90
90 if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { 91 if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
91 u16 crc = crc_ccitt(0, skb->data, skb->len); 92 u16 crc = crc_ccitt(0, skb->data, skb->len);
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 819c342f5b30..9730882697aa 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -640,6 +640,14 @@ find_free_id(const char *name, ip_set_id_t *index, struct ip_set **set)
640} 640}
641 641
642static int 642static int
643ip_set_none(struct sock *ctnl, struct sk_buff *skb,
644 const struct nlmsghdr *nlh,
645 const struct nlattr * const attr[])
646{
647 return -EOPNOTSUPP;
648}
649
650static int
643ip_set_create(struct sock *ctnl, struct sk_buff *skb, 651ip_set_create(struct sock *ctnl, struct sk_buff *skb,
644 const struct nlmsghdr *nlh, 652 const struct nlmsghdr *nlh,
645 const struct nlattr * const attr[]) 653 const struct nlattr * const attr[])
@@ -1539,6 +1547,10 @@ nlmsg_failure:
1539} 1547}
1540 1548
1541static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = { 1549static const struct nfnl_callback ip_set_netlink_subsys_cb[IPSET_MSG_MAX] = {
1550 [IPSET_CMD_NONE] = {
1551 .call = ip_set_none,
1552 .attr_count = IPSET_ATTR_CMD_MAX,
1553 },
1542 [IPSET_CMD_CREATE] = { 1554 [IPSET_CMD_CREATE] = {
1543 .call = ip_set_create, 1555 .call = ip_set_create,
1544 .attr_count = IPSET_ATTR_CMD_MAX, 1556 .attr_count = IPSET_ATTR_CMD_MAX,
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c
index ee863943c826..d5d3607ae7bc 100644
--- a/net/netfilter/ipset/ip_set_hash_netiface.c
+++ b/net/netfilter/ipset/ip_set_hash_netiface.c
@@ -38,30 +38,6 @@ struct iface_node {
38 38
39#define iface_data(n) (rb_entry(n, struct iface_node, node)->iface) 39#define iface_data(n) (rb_entry(n, struct iface_node, node)->iface)
40 40
41static inline long
42ifname_compare(const char *_a, const char *_b)
43{
44 const long *a = (const long *)_a;
45 const long *b = (const long *)_b;
46
47 BUILD_BUG_ON(IFNAMSIZ > 4 * sizeof(unsigned long));
48 if (a[0] != b[0])
49 return a[0] - b[0];
50 if (IFNAMSIZ > sizeof(long)) {
51 if (a[1] != b[1])
52 return a[1] - b[1];
53 }
54 if (IFNAMSIZ > 2 * sizeof(long)) {
55 if (a[2] != b[2])
56 return a[2] - b[2];
57 }
58 if (IFNAMSIZ > 3 * sizeof(long)) {
59 if (a[3] != b[3])
60 return a[3] - b[3];
61 }
62 return 0;
63}
64
65static void 41static void
66rbtree_destroy(struct rb_root *root) 42rbtree_destroy(struct rb_root *root)
67{ 43{
@@ -99,7 +75,7 @@ iface_test(struct rb_root *root, const char **iface)
99 75
100 while (n) { 76 while (n) {
101 const char *d = iface_data(n); 77 const char *d = iface_data(n);
102 long res = ifname_compare(*iface, d); 78 int res = strcmp(*iface, d);
103 79
104 if (res < 0) 80 if (res < 0)
105 n = n->rb_left; 81 n = n->rb_left;
@@ -121,7 +97,7 @@ iface_add(struct rb_root *root, const char **iface)
121 97
122 while (*n) { 98 while (*n) {
123 char *ifname = iface_data(*n); 99 char *ifname = iface_data(*n);
124 long res = ifname_compare(*iface, ifname); 100 int res = strcmp(*iface, ifname);
125 101
126 p = *n; 102 p = *n;
127 if (res < 0) 103 if (res < 0)
@@ -366,7 +342,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[],
366 struct hash_netiface4_elem data = { .cidr = HOST_MASK }; 342 struct hash_netiface4_elem data = { .cidr = HOST_MASK };
367 u32 ip = 0, ip_to, last; 343 u32 ip = 0, ip_to, last;
368 u32 timeout = h->timeout; 344 u32 timeout = h->timeout;
369 char iface[IFNAMSIZ] = {}; 345 char iface[IFNAMSIZ];
370 int ret; 346 int ret;
371 347
372 if (unlikely(!tb[IPSET_ATTR_IP] || 348 if (unlikely(!tb[IPSET_ATTR_IP] ||
@@ -663,7 +639,7 @@ hash_netiface6_uadt(struct ip_set *set, struct nlattr *tb[],
663 ipset_adtfn adtfn = set->variant->adt[adt]; 639 ipset_adtfn adtfn = set->variant->adt[adt];
664 struct hash_netiface6_elem data = { .cidr = HOST_MASK }; 640 struct hash_netiface6_elem data = { .cidr = HOST_MASK };
665 u32 timeout = h->timeout; 641 u32 timeout = h->timeout;
666 char iface[IFNAMSIZ] = {}; 642 char iface[IFNAMSIZ];
667 int ret; 643 int ret;
668 644
669 if (unlikely(!tb[IPSET_ATTR_IP] || 645 if (unlikely(!tb[IPSET_ATTR_IP] ||
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index dd811b8dd97c..d43e3c122f7b 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -76,19 +76,19 @@ static void __ip_vs_del_service(struct ip_vs_service *svc);
76 76
77#ifdef CONFIG_IP_VS_IPV6 77#ifdef CONFIG_IP_VS_IPV6
78/* Taken from rt6_fill_node() in net/ipv6/route.c, is there a better way? */ 78/* Taken from rt6_fill_node() in net/ipv6/route.c, is there a better way? */
79static int __ip_vs_addr_is_local_v6(struct net *net, 79static bool __ip_vs_addr_is_local_v6(struct net *net,
80 const struct in6_addr *addr) 80 const struct in6_addr *addr)
81{ 81{
82 struct rt6_info *rt;
83 struct flowi6 fl6 = { 82 struct flowi6 fl6 = {
84 .daddr = *addr, 83 .daddr = *addr,
85 }; 84 };
85 struct dst_entry *dst = ip6_route_output(net, NULL, &fl6);
86 bool is_local;
86 87
87 rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); 88 is_local = !dst->error && dst->dev && (dst->dev->flags & IFF_LOOPBACK);
88 if (rt && rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK))
89 return 1;
90 89
91 return 0; 90 dst_release(dst);
91 return is_local;
92} 92}
93#endif 93#endif
94 94
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 3e797d1fcb94..791d56bbd74a 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -169,8 +169,10 @@ replay:
169 169
170 err = nla_parse(cda, ss->cb[cb_id].attr_count, 170 err = nla_parse(cda, ss->cb[cb_id].attr_count,
171 attr, attrlen, ss->cb[cb_id].policy); 171 attr, attrlen, ss->cb[cb_id].policy);
172 if (err < 0) 172 if (err < 0) {
173 rcu_read_unlock();
173 return err; 174 return err;
175 }
174 176
175 if (nc->call_rcu) { 177 if (nc->call_rcu) {
176 err = nc->call_rcu(net->nfnl, skb, nlh, 178 err = nc->call_rcu(net->nfnl, skb, nlh,
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index cb2646179e5f..2ab196a9f228 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -106,7 +106,7 @@ static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
106 nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); 106 nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data));
107 data += 2; 107 data += 2;
108 108
109 nfca_poll->nfcid1_len = *data++; 109 nfca_poll->nfcid1_len = min_t(__u8, *data++, NFC_NFCID1_MAXSIZE);
110 110
111 pr_debug("sens_res 0x%x, nfcid1_len %d\n", 111 pr_debug("sens_res 0x%x, nfcid1_len %d\n",
112 nfca_poll->sens_res, nfca_poll->nfcid1_len); 112 nfca_poll->sens_res, nfca_poll->nfcid1_len);
@@ -130,7 +130,7 @@ static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev,
130 struct rf_tech_specific_params_nfcb_poll *nfcb_poll, 130 struct rf_tech_specific_params_nfcb_poll *nfcb_poll,
131 __u8 *data) 131 __u8 *data)
132{ 132{
133 nfcb_poll->sensb_res_len = *data++; 133 nfcb_poll->sensb_res_len = min_t(__u8, *data++, NFC_SENSB_RES_MAXSIZE);
134 134
135 pr_debug("sensb_res_len %d\n", nfcb_poll->sensb_res_len); 135 pr_debug("sensb_res_len %d\n", nfcb_poll->sensb_res_len);
136 136
@@ -145,7 +145,7 @@ static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev,
145 __u8 *data) 145 __u8 *data)
146{ 146{
147 nfcf_poll->bit_rate = *data++; 147 nfcf_poll->bit_rate = *data++;
148 nfcf_poll->sensf_res_len = *data++; 148 nfcf_poll->sensf_res_len = min_t(__u8, *data++, NFC_SENSF_RES_MAXSIZE);
149 149
150 pr_debug("bit_rate %d, sensf_res_len %d\n", 150 pr_debug("bit_rate %d, sensf_res_len %d\n",
151 nfcf_poll->bit_rate, nfcf_poll->sensf_res_len); 151 nfcf_poll->bit_rate, nfcf_poll->sensf_res_len);
@@ -331,7 +331,7 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
331 switch (ntf->activation_rf_tech_and_mode) { 331 switch (ntf->activation_rf_tech_and_mode) {
332 case NCI_NFC_A_PASSIVE_POLL_MODE: 332 case NCI_NFC_A_PASSIVE_POLL_MODE:
333 nfca_poll = &ntf->activation_params.nfca_poll_iso_dep; 333 nfca_poll = &ntf->activation_params.nfca_poll_iso_dep;
334 nfca_poll->rats_res_len = *data++; 334 nfca_poll->rats_res_len = min_t(__u8, *data++, 20);
335 pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len); 335 pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len);
336 if (nfca_poll->rats_res_len > 0) { 336 if (nfca_poll->rats_res_len > 0) {
337 memcpy(nfca_poll->rats_res, 337 memcpy(nfca_poll->rats_res,
@@ -341,7 +341,7 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
341 341
342 case NCI_NFC_B_PASSIVE_POLL_MODE: 342 case NCI_NFC_B_PASSIVE_POLL_MODE:
343 nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep; 343 nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep;
344 nfcb_poll->attrib_res_len = *data++; 344 nfcb_poll->attrib_res_len = min_t(__u8, *data++, 50);
345 pr_debug("attrib_res_len %d\n", nfcb_poll->attrib_res_len); 345 pr_debug("attrib_res_len %d\n", nfcb_poll->attrib_res_len);
346 if (nfcb_poll->attrib_res_len > 0) { 346 if (nfcb_poll->attrib_res_len > 0) {
347 memcpy(nfcb_poll->attrib_res, 347 memcpy(nfcb_poll->attrib_res,
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index ec1134c9e07f..8b8a6a2b2bad 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -54,7 +54,10 @@ static int rawsock_release(struct socket *sock)
54{ 54{
55 struct sock *sk = sock->sk; 55 struct sock *sk = sock->sk;
56 56
57 pr_debug("sock=%p\n", sock); 57 pr_debug("sock=%p sk=%p\n", sock, sk);
58
59 if (!sk)
60 return 0;
58 61
59 sock_orphan(sk); 62 sock_orphan(sk);
60 sock_put(sk); 63 sock_put(sk);
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 779ce4ff92ec..5a940dbd74a3 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Contact: Remi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Authors: Sakari Ailus <sakari.ailus@nokia.com>
9 * Original author: Sakari Ailus <sakari.ailus@nokia.com> 9 * Rémi Denis-Courmont
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c
index bf35b4e1a14c..12c30f3e643e 100644
--- a/net/phonet/datagram.c
+++ b/net/phonet/datagram.c
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Contact: Remi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Authors: Sakari Ailus <sakari.ailus@nokia.com>
9 * Original author: Sakari Ailus <sakari.ailus@nokia.com> 9 * Rémi Denis-Courmont
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index d01208968c83..a2fba7edfd1f 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Author: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Author: Rémi Denis-Courmont
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 9dd4f926f7d1..576f22c9c76e 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Author: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Author: Rémi Denis-Courmont
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 36f75a9e2c3d..5bf6341e2dd4 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Contact: Remi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Authors: Sakari Ailus <sakari.ailus@nokia.com>
9 * Original author: Sakari Ailus <sakari.ailus@nokia.com> 9 * Rémi Denis-Courmont
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c
index cfdf135fcd69..7dd762a464e5 100644
--- a/net/phonet/pn_netlink.c
+++ b/net/phonet/pn_netlink.c
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Contact: Remi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Authors: Sakari Ailus <sakari.ailus@nokia.com>
9 * Original author: Sakari Ailus <sakari.ailus@nokia.com> 9 * Remi Denis-Courmont
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 89cfa9ce4939..0acc943f713a 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -5,8 +5,8 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Contact: Remi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Authors: Sakari Ailus <sakari.ailus@nokia.com>
9 * Original author: Sakari Ailus <sakari.ailus@nokia.com> 9 * Rémi Denis-Courmont
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/net/phonet/sysctl.c b/net/phonet/sysctl.c
index 696348fd31a1..d6bbbbd0af18 100644
--- a/net/phonet/sysctl.c
+++ b/net/phonet/sysctl.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 Nokia Corporation. 6 * Copyright (C) 2008 Nokia Corporation.
7 * 7 *
8 * Contact: Remi Denis-Courmont <remi.denis-courmont@nokia.com> 8 * Author: Rémi Denis-Courmont
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 5bc9ab161b37..b16517ee1aaf 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -271,6 +271,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
271 */ 271 */
272 asoc->peer.sack_needed = 1; 272 asoc->peer.sack_needed = 1;
273 asoc->peer.sack_cnt = 0; 273 asoc->peer.sack_cnt = 0;
274 asoc->peer.sack_generation = 1;
274 275
275 /* Assume that the peer will tell us if he recognizes ASCONF 276 /* Assume that the peer will tell us if he recognizes ASCONF
276 * as part of INIT exchange. 277 * as part of INIT exchange.
diff --git a/net/sctp/output.c b/net/sctp/output.c
index f1b7d4bb591e..6ae47acaaec6 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -248,6 +248,11 @@ static sctp_xmit_t sctp_packet_bundle_sack(struct sctp_packet *pkt,
248 /* If the SACK timer is running, we have a pending SACK */ 248 /* If the SACK timer is running, we have a pending SACK */
249 if (timer_pending(timer)) { 249 if (timer_pending(timer)) {
250 struct sctp_chunk *sack; 250 struct sctp_chunk *sack;
251
252 if (pkt->transport->sack_generation !=
253 pkt->transport->asoc->peer.sack_generation)
254 return retval;
255
251 asoc->a_rwnd = asoc->rwnd; 256 asoc->a_rwnd = asoc->rwnd;
252 sack = sctp_make_sack(asoc); 257 sack = sctp_make_sack(asoc);
253 if (sack) { 258 if (sack) {
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 5942d27b1444..9c90811d1134 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -673,7 +673,9 @@ void sctp_addr_wq_timeout_handler(unsigned long arg)
673 SCTP_DEBUG_PRINTK("sctp_addrwq_timo_handler: sctp_asconf_mgmt failed\n"); 673 SCTP_DEBUG_PRINTK("sctp_addrwq_timo_handler: sctp_asconf_mgmt failed\n");
674 sctp_bh_unlock_sock(sk); 674 sctp_bh_unlock_sock(sk);
675 } 675 }
676#if IS_ENABLED(CONFIG_IPV6)
676free_next: 677free_next:
678#endif
677 list_del(&addrw->list); 679 list_del(&addrw->list);
678 kfree(addrw); 680 kfree(addrw);
679 } 681 }
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index a85eeeb55dd0..b6de71efb140 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -734,8 +734,10 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc)
734 int len; 734 int len;
735 __u32 ctsn; 735 __u32 ctsn;
736 __u16 num_gabs, num_dup_tsns; 736 __u16 num_gabs, num_dup_tsns;
737 struct sctp_association *aptr = (struct sctp_association *)asoc;
737 struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; 738 struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map;
738 struct sctp_gap_ack_block gabs[SCTP_MAX_GABS]; 739 struct sctp_gap_ack_block gabs[SCTP_MAX_GABS];
740 struct sctp_transport *trans;
739 741
740 memset(gabs, 0, sizeof(gabs)); 742 memset(gabs, 0, sizeof(gabs));
741 ctsn = sctp_tsnmap_get_ctsn(map); 743 ctsn = sctp_tsnmap_get_ctsn(map);
@@ -805,6 +807,20 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc)
805 sctp_addto_chunk(retval, sizeof(__u32) * num_dup_tsns, 807 sctp_addto_chunk(retval, sizeof(__u32) * num_dup_tsns,
806 sctp_tsnmap_get_dups(map)); 808 sctp_tsnmap_get_dups(map));
807 809
810 /* Once we have a sack generated, check to see what our sack
811 * generation is, if its 0, reset the transports to 0, and reset
812 * the association generation to 1
813 *
814 * The idea is that zero is never used as a valid generation for the
815 * association so no transport will match after a wrap event like this,
816 * Until the next sack
817 */
818 if (++aptr->peer.sack_generation == 0) {
819 list_for_each_entry(trans, &asoc->peer.transport_addr_list,
820 transports)
821 trans->sack_generation = 0;
822 aptr->peer.sack_generation = 1;
823 }
808nodata: 824nodata:
809 return retval; 825 return retval;
810} 826}
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index c96d1a81cf42..8716da1a8592 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1268,7 +1268,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1268 case SCTP_CMD_REPORT_TSN: 1268 case SCTP_CMD_REPORT_TSN:
1269 /* Record the arrival of a TSN. */ 1269 /* Record the arrival of a TSN. */
1270 error = sctp_tsnmap_mark(&asoc->peer.tsn_map, 1270 error = sctp_tsnmap_mark(&asoc->peer.tsn_map,
1271 cmd->obj.u32); 1271 cmd->obj.u32, NULL);
1272 break; 1272 break;
1273 1273
1274 case SCTP_CMD_REPORT_FWDTSN: 1274 case SCTP_CMD_REPORT_FWDTSN:
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index b026ba0c6992..1dcceb6e0ce6 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -68,6 +68,8 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
68 peer->af_specific = sctp_get_af_specific(addr->sa.sa_family); 68 peer->af_specific = sctp_get_af_specific(addr->sa.sa_family);
69 memset(&peer->saddr, 0, sizeof(union sctp_addr)); 69 memset(&peer->saddr, 0, sizeof(union sctp_addr));
70 70
71 peer->sack_generation = 0;
72
71 /* From 6.3.1 RTO Calculation: 73 /* From 6.3.1 RTO Calculation:
72 * 74 *
73 * C1) Until an RTT measurement has been made for a packet sent to the 75 * C1) Until an RTT measurement has been made for a packet sent to the
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index f1e40cebc981..b5fb7c409023 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -114,7 +114,8 @@ int sctp_tsnmap_check(const struct sctp_tsnmap *map, __u32 tsn)
114 114
115 115
116/* Mark this TSN as seen. */ 116/* Mark this TSN as seen. */
117int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn) 117int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn,
118 struct sctp_transport *trans)
118{ 119{
119 u16 gap; 120 u16 gap;
120 121
@@ -133,6 +134,9 @@ int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn)
133 */ 134 */
134 map->max_tsn_seen++; 135 map->max_tsn_seen++;
135 map->cumulative_tsn_ack_point++; 136 map->cumulative_tsn_ack_point++;
137 if (trans)
138 trans->sack_generation =
139 trans->asoc->peer.sack_generation;
136 map->base_tsn++; 140 map->base_tsn++;
137 } else { 141 } else {
138 /* Either we already have a gap, or about to record a gap, so 142 /* Either we already have a gap, or about to record a gap, so
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 8a84017834c2..33d894776192 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -715,7 +715,8 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
715 * can mark it as received so the tsn_map is updated correctly. 715 * can mark it as received so the tsn_map is updated correctly.
716 */ 716 */
717 if (sctp_tsnmap_mark(&asoc->peer.tsn_map, 717 if (sctp_tsnmap_mark(&asoc->peer.tsn_map,
718 ntohl(chunk->subh.data_hdr->tsn))) 718 ntohl(chunk->subh.data_hdr->tsn),
719 chunk->transport))
719 goto fail_mark; 720 goto fail_mark;
720 721
721 /* First calculate the padding, so we don't inadvertently 722 /* First calculate the padding, so we don't inadvertently
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index f2d1de7f2ffb..f5a6a4f4faf7 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -1051,7 +1051,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
1051 if (chunk && (freed >= needed)) { 1051 if (chunk && (freed >= needed)) {
1052 __u32 tsn; 1052 __u32 tsn;
1053 tsn = ntohl(chunk->subh.data_hdr->tsn); 1053 tsn = ntohl(chunk->subh.data_hdr->tsn);
1054 sctp_tsnmap_mark(&asoc->peer.tsn_map, tsn); 1054 sctp_tsnmap_mark(&asoc->peer.tsn_map, tsn, chunk->transport);
1055 sctp_ulpq_tail_data(ulpq, chunk, gfp); 1055 sctp_ulpq_tail_data(ulpq, chunk, gfp);
1056 1056
1057 sctp_ulpq_partial_delivery(ulpq, chunk, gfp); 1057 sctp_ulpq_partial_delivery(ulpq, chunk, gfp);
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 15f347477a99..baf5704740ee 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1389,7 +1389,7 @@ static void reg_set_request_processed(void)
1389 spin_unlock(&reg_requests_lock); 1389 spin_unlock(&reg_requests_lock);
1390 1390
1391 if (last_request->initiator == NL80211_REGDOM_SET_BY_USER) 1391 if (last_request->initiator == NL80211_REGDOM_SET_BY_USER)
1392 cancel_delayed_work_sync(&reg_timeout); 1392 cancel_delayed_work(&reg_timeout);
1393 1393
1394 if (need_more_processing) 1394 if (need_more_processing)
1395 schedule_work(&reg_work); 1395 schedule_work(&reg_work);
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 8f2d68fc3a44..316cfd00914f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -804,7 +804,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
804 ntype == NL80211_IFTYPE_P2P_CLIENT)) 804 ntype == NL80211_IFTYPE_P2P_CLIENT))
805 return -EBUSY; 805 return -EBUSY;
806 806
807 if (ntype != otype) { 807 if (ntype != otype && netif_running(dev)) {
808 err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr, 808 err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr,
809 ntype); 809 ntype);
810 if (err) 810 if (err)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 0948c6b5a321..8b673dd4627f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -83,6 +83,8 @@ push(@signature_tags, "Signed-off-by:");
83push(@signature_tags, "Reviewed-by:"); 83push(@signature_tags, "Reviewed-by:");
84push(@signature_tags, "Acked-by:"); 84push(@signature_tags, "Acked-by:");
85 85
86my $signature_pattern = "\(" . join("|", @signature_tags) . "\)";
87
86# rfc822 email address - preloaded methods go here. 88# rfc822 email address - preloaded methods go here.
87my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; 89my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])";
88my $rfc822_char = '[\\000-\\377]'; 90my $rfc822_char = '[\\000-\\377]';
@@ -473,7 +475,6 @@ my @subsystem = ();
473my @status = (); 475my @status = ();
474my %deduplicate_name_hash = (); 476my %deduplicate_name_hash = ();
475my %deduplicate_address_hash = (); 477my %deduplicate_address_hash = ();
476my $signature_pattern;
477 478
478my @maintainers = get_maintainers(); 479my @maintainers = get_maintainers();
479 480
diff --git a/scripts/gfp-translate b/scripts/gfp-translate
index c9230e158a8f..c9230e158a8f 100644..100755
--- a/scripts/gfp-translate
+++ b/scripts/gfp-translate
diff --git a/security/security.c b/security/security.c
index 3efc9b12aef4..860aeb349cb3 100644
--- a/security/security.c
+++ b/security/security.c
@@ -23,6 +23,7 @@
23#include <linux/mman.h> 23#include <linux/mman.h>
24#include <linux/mount.h> 24#include <linux/mount.h>
25#include <linux/personality.h> 25#include <linux/personality.h>
26#include <linux/backing-dev.h>
26#include <net/flow.h> 27#include <net/flow.h>
27 28
28#define MAX_LSM_EVM_XATTR 2 29#define MAX_LSM_EVM_XATTR 2
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 582aace20ea3..7eca25fae413 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -37,8 +37,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); 37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40#define FREQ_LO (76U * 16000) 40#define FREQ_LO ((tea->tea5759 ? 760 : 875) * 1600U)
41#define FREQ_HI (108U * 16000) 41#define FREQ_HI ((tea->tea5759 ? 910 : 1080) * 1600U)
42 42
43/* 43/*
44 * definitions 44 * definitions
@@ -120,9 +120,9 @@ static u32 snd_tea575x_read(struct snd_tea575x *tea)
120 return data; 120 return data;
121} 121}
122 122
123static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) 123static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val)
124{ 124{
125 u32 freq = snd_tea575x_read(tea) & TEA575X_BIT_FREQ_MASK; 125 u32 freq = val & TEA575X_BIT_FREQ_MASK;
126 126
127 if (freq == 0) 127 if (freq == 0)
128 return freq; 128 return freq;
@@ -139,6 +139,11 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */ 139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */
140} 140}
141 141
142static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
143{
144 return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea));
145}
146
142static void snd_tea575x_set_freq(struct snd_tea575x *tea) 147static void snd_tea575x_set_freq(struct snd_tea575x *tea)
143{ 148{
144 u32 freq = tea->freq; 149 u32 freq = tea->freq;
@@ -156,6 +161,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
156 tea->val &= ~TEA575X_BIT_FREQ_MASK; 161 tea->val &= ~TEA575X_BIT_FREQ_MASK;
157 tea->val |= freq & TEA575X_BIT_FREQ_MASK; 162 tea->val |= freq & TEA575X_BIT_FREQ_MASK;
158 snd_tea575x_write(tea, tea->val); 163 snd_tea575x_write(tea, tea->val);
164 tea->freq = snd_tea575x_val_to_freq(tea, tea->val);
159} 165}
160 166
161/* 167/*
@@ -317,7 +323,6 @@ static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl)
317} 323}
318 324
319static const struct v4l2_file_operations tea575x_fops = { 325static const struct v4l2_file_operations tea575x_fops = {
320 .owner = THIS_MODULE,
321 .unlocked_ioctl = video_ioctl2, 326 .unlocked_ioctl = video_ioctl2,
322 .open = v4l2_fh_open, 327 .open = v4l2_fh_open,
323 .release = v4l2_fh_release, 328 .release = v4l2_fh_release,
@@ -337,7 +342,6 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
337}; 342};
338 343
339static const struct video_device tea575x_radio = { 344static const struct video_device tea575x_radio = {
340 .fops = &tea575x_fops,
341 .ioctl_ops = &tea575x_ioctl_ops, 345 .ioctl_ops = &tea575x_ioctl_ops,
342 .release = video_device_release_empty, 346 .release = video_device_release_empty,
343}; 347};
@@ -349,7 +353,7 @@ static const struct v4l2_ctrl_ops tea575x_ctrl_ops = {
349/* 353/*
350 * initialize all the tea575x chips 354 * initialize all the tea575x chips
351 */ 355 */
352int snd_tea575x_init(struct snd_tea575x *tea) 356int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner)
353{ 357{
354 int retval; 358 int retval;
355 359
@@ -374,6 +378,9 @@ int snd_tea575x_init(struct snd_tea575x *tea)
374 tea->vd.lock = &tea->mutex; 378 tea->vd.lock = &tea->mutex;
375 tea->vd.v4l2_dev = tea->v4l2_dev; 379 tea->vd.v4l2_dev = tea->v4l2_dev;
376 tea->vd.ctrl_handler = &tea->ctrl_handler; 380 tea->vd.ctrl_handler = &tea->ctrl_handler;
381 tea->fops = tea575x_fops;
382 tea->fops.owner = owner;
383 tea->vd.fops = &tea->fops;
377 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); 384 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
378 /* disable hw_freq_seek if we can't use it */ 385 /* disable hw_freq_seek if we can't use it */
379 if (tea->cannot_read_data) 386 if (tea->cannot_read_data)
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 67f47d891959..52b5c0bf90c1 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2769,7 +2769,7 @@ static int __devinit snd_es1968_create(struct snd_card *card,
2769 chip->tea.ops = &snd_es1968_tea_ops; 2769 chip->tea.ops = &snd_es1968_tea_ops;
2770 strlcpy(chip->tea.card, "SF64-PCE2", sizeof(chip->tea.card)); 2770 strlcpy(chip->tea.card, "SF64-PCE2", sizeof(chip->tea.card));
2771 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); 2771 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
2772 if (!snd_tea575x_init(&chip->tea)) 2772 if (!snd_tea575x_init(&chip->tea, THIS_MODULE))
2773 printk(KERN_INFO "es1968: detected TEA575x radio\n"); 2773 printk(KERN_INFO "es1968: detected TEA575x radio\n");
2774#endif 2774#endif
2775 2775
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index f69662322750..b32e8024ea86 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1254,7 +1254,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1254 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); 1254 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
1255 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 && 1255 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 &&
1256 (tea575x_tuner & TUNER_TYPE_MASK) < 4) { 1256 (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
1257 if (snd_tea575x_init(&chip->tea)) { 1257 if (snd_tea575x_init(&chip->tea, THIS_MODULE)) {
1258 snd_printk(KERN_ERR "TEA575x radio not found\n"); 1258 snd_printk(KERN_ERR "TEA575x radio not found\n");
1259 snd_fm801_free(chip); 1259 snd_fm801_free(chip);
1260 return -ENODEV; 1260 return -ENODEV;
@@ -1263,7 +1263,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1263 /* autodetect tuner connection */ 1263 /* autodetect tuner connection */
1264 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) { 1264 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) {
1265 chip->tea575x_tuner = tea575x_tuner; 1265 chip->tea575x_tuner = tea575x_tuner;
1266 if (!snd_tea575x_init(&chip->tea)) { 1266 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) {
1267 snd_printk(KERN_INFO "detected TEA575x radio type %s\n", 1267 snd_printk(KERN_INFO "detected TEA575x radio type %s\n",
1268 get_tea575x_gpio(chip)->name); 1268 get_tea575x_gpio(chip)->name);
1269 break; 1269 break;
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 163b6b5de3eb..d03079764189 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -97,19 +97,6 @@ config SND_HDA_CODEC_REALTEK
97 snd-hda-codec-realtek. 97 snd-hda-codec-realtek.
98 This module is automatically loaded at probing. 98 This module is automatically loaded at probing.
99 99
100config SND_HDA_ENABLE_REALTEK_QUIRKS
101 bool "Build static quirks for Realtek codecs"
102 depends on SND_HDA_CODEC_REALTEK
103 default y
104 help
105 Say Y here to build the static quirks codes for Realtek codecs.
106 If you need the "model" preset that the default BIOS auto-parser
107 can't handle, turn this option on.
108
109 If your device works with model=auto option, basically you don't
110 need the quirk code. By turning this off, you can reduce the
111 module size quite a lot.
112
113config SND_HDA_CODEC_ANALOG 100config SND_HDA_CODEC_ANALOG
114 bool "Build Analog Device HD-audio codec support" 101 bool "Build Analog Device HD-audio codec support"
115 default y 102 default y
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 6e9ef3e25093..f7520b9f909c 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -618,7 +618,6 @@ int snd_hda_gen_add_verbs(struct hda_gen_spec *spec,
618 const struct hda_verb *list) 618 const struct hda_verb *list)
619{ 619{
620 const struct hda_verb **v; 620 const struct hda_verb **v;
621 snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8);
622 v = snd_array_new(&spec->verbs); 621 v = snd_array_new(&spec->verbs);
623 if (!v) 622 if (!v)
624 return -ENOMEM; 623 return -ENOMEM;
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h
index 2a7889dfbd1b..632ad0ad3007 100644
--- a/sound/pci/hda/hda_auto_parser.h
+++ b/sound/pci/hda/hda_auto_parser.h
@@ -157,4 +157,14 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
157 const struct snd_pci_quirk *quirk, 157 const struct snd_pci_quirk *quirk,
158 const struct hda_fixup *fixlist); 158 const struct hda_fixup *fixlist);
159 159
160static inline void snd_hda_gen_init(struct hda_gen_spec *spec)
161{
162 snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8);
163}
164
165static inline void snd_hda_gen_free(struct hda_gen_spec *spec)
166{
167 snd_array_free(&spec->verbs);
168}
169
160#endif /* __SOUND_HDA_AUTO_PARSER_H */ 170#endif /* __SOUND_HDA_AUTO_PARSER_H */
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 41ca803a1fff..51cb2a2e4fce 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1184,6 +1184,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
1184{ 1184{
1185 if (!codec) 1185 if (!codec)
1186 return; 1186 return;
1187 snd_hda_jack_tbl_clear(codec);
1187 restore_init_pincfgs(codec); 1188 restore_init_pincfgs(codec);
1188#ifdef CONFIG_SND_HDA_POWER_SAVE 1189#ifdef CONFIG_SND_HDA_POWER_SAVE
1189 cancel_delayed_work(&codec->power_work); 1190 cancel_delayed_work(&codec->power_work);
@@ -1192,6 +1193,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
1192 list_del(&codec->list); 1193 list_del(&codec->list);
1193 snd_array_free(&codec->mixers); 1194 snd_array_free(&codec->mixers);
1194 snd_array_free(&codec->nids); 1195 snd_array_free(&codec->nids);
1196 snd_array_free(&codec->cvt_setups);
1195 snd_array_free(&codec->conn_lists); 1197 snd_array_free(&codec->conn_lists);
1196 snd_array_free(&codec->spdif_out); 1198 snd_array_free(&codec->spdif_out);
1197 codec->bus->caddr_tbl[codec->addr] = NULL; 1199 codec->bus->caddr_tbl[codec->addr] = NULL;
@@ -2333,6 +2335,8 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2333 /* free only driver_pins so that init_pins + user_pins are restored */ 2335 /* free only driver_pins so that init_pins + user_pins are restored */
2334 snd_array_free(&codec->driver_pins); 2336 snd_array_free(&codec->driver_pins);
2335 restore_pincfgs(codec); 2337 restore_pincfgs(codec);
2338 snd_array_free(&codec->cvt_setups);
2339 snd_array_free(&codec->spdif_out);
2336 codec->num_pcms = 0; 2340 codec->num_pcms = 0;
2337 codec->pcm_info = NULL; 2341 codec->pcm_info = NULL;
2338 codec->preset = NULL; 2342 codec->preset = NULL;
@@ -4393,20 +4397,19 @@ void snd_hda_update_power_acct(struct hda_codec *codec)
4393 codec->power_jiffies += delta; 4397 codec->power_jiffies += delta;
4394} 4398}
4395 4399
4396/** 4400/* Transition to powered up, if wait_power_down then wait for a pending
4397 * snd_hda_power_up - Power-up the codec 4401 * transition to D3 to complete. A pending D3 transition is indicated
4398 * @codec: HD-audio codec 4402 * with power_transition == -1. */
4399 * 4403static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down)
4400 * Increment the power-up counter and power up the hardware really when
4401 * not turned on yet.
4402 */
4403void snd_hda_power_up(struct hda_codec *codec)
4404{ 4404{
4405 struct hda_bus *bus = codec->bus; 4405 struct hda_bus *bus = codec->bus;
4406 4406
4407 spin_lock(&codec->power_lock); 4407 spin_lock(&codec->power_lock);
4408 codec->power_count++; 4408 codec->power_count++;
4409 if (codec->power_on || codec->power_transition > 0) { 4409 /* Return if power_on or transitioning to power_on, unless currently
4410 * powering down. */
4411 if ((codec->power_on || codec->power_transition > 0) &&
4412 !(wait_power_down && codec->power_transition < 0)) {
4410 spin_unlock(&codec->power_lock); 4413 spin_unlock(&codec->power_lock);
4411 return; 4414 return;
4412 } 4415 }
@@ -4430,8 +4433,37 @@ void snd_hda_power_up(struct hda_codec *codec)
4430 codec->power_transition = 0; 4433 codec->power_transition = 0;
4431 spin_unlock(&codec->power_lock); 4434 spin_unlock(&codec->power_lock);
4432} 4435}
4436
4437/**
4438 * snd_hda_power_up - Power-up the codec
4439 * @codec: HD-audio codec
4440 *
4441 * Increment the power-up counter and power up the hardware really when
4442 * not turned on yet.
4443 */
4444void snd_hda_power_up(struct hda_codec *codec)
4445{
4446 __snd_hda_power_up(codec, false);
4447}
4433EXPORT_SYMBOL_HDA(snd_hda_power_up); 4448EXPORT_SYMBOL_HDA(snd_hda_power_up);
4434 4449
4450/**
4451 * snd_hda_power_up_d3wait - Power-up the codec after waiting for any pending
4452 * D3 transition to complete. This differs from snd_hda_power_up() when
4453 * power_transition == -1. snd_hda_power_up sees this case as a nop,
4454 * snd_hda_power_up_d3wait waits for the D3 transition to complete then powers
4455 * back up.
4456 * @codec: HD-audio codec
4457 *
4458 * Cancel any power down operation hapenning on the work queue, then power up.
4459 */
4460void snd_hda_power_up_d3wait(struct hda_codec *codec)
4461{
4462 /* This will cancel and wait for pending power_work to complete. */
4463 __snd_hda_power_up(codec, true);
4464}
4465EXPORT_SYMBOL_HDA(snd_hda_power_up_d3wait);
4466
4435#define power_save(codec) \ 4467#define power_save(codec) \
4436 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) 4468 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
4437 4469
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 4fc3960c8591..2fdaadbb4326 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -1056,10 +1056,12 @@ const char *snd_hda_get_jack_location(u32 cfg);
1056 */ 1056 */
1057#ifdef CONFIG_SND_HDA_POWER_SAVE 1057#ifdef CONFIG_SND_HDA_POWER_SAVE
1058void snd_hda_power_up(struct hda_codec *codec); 1058void snd_hda_power_up(struct hda_codec *codec);
1059void snd_hda_power_up_d3wait(struct hda_codec *codec);
1059void snd_hda_power_down(struct hda_codec *codec); 1060void snd_hda_power_down(struct hda_codec *codec);
1060void snd_hda_update_power_acct(struct hda_codec *codec); 1061void snd_hda_update_power_acct(struct hda_codec *codec);
1061#else 1062#else
1062static inline void snd_hda_power_up(struct hda_codec *codec) {} 1063static inline void snd_hda_power_up(struct hda_codec *codec) {}
1064static inline void snd_hda_power_up_d3wait(struct hda_codec *codec) {}
1063static inline void snd_hda_power_down(struct hda_codec *codec) {} 1065static inline void snd_hda_power_down(struct hda_codec *codec) {}
1064#endif 1066#endif
1065 1067
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 02763827dde0..7757536b9d5f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1766,7 +1766,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1766 buff_step); 1766 buff_step);
1767 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1767 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1768 buff_step); 1768 buff_step);
1769 snd_hda_power_up(apcm->codec); 1769 snd_hda_power_up_d3wait(apcm->codec);
1770 err = hinfo->ops.open(hinfo, apcm->codec, substream); 1770 err = hinfo->ops.open(hinfo, apcm->codec, substream);
1771 if (err < 0) { 1771 if (err < 0) {
1772 azx_release_device(azx_dev); 1772 azx_release_device(azx_dev);
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 172370b3793b..2bf99fc1cbf2 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -445,8 +445,10 @@ static int conexant_init(struct hda_codec *codec)
445 445
446static void conexant_free(struct hda_codec *codec) 446static void conexant_free(struct hda_codec *codec)
447{ 447{
448 struct conexant_spec *spec = codec->spec;
449 snd_hda_gen_free(&spec->gen);
448 snd_hda_detach_beep_device(codec); 450 snd_hda_detach_beep_device(codec);
449 kfree(codec->spec); 451 kfree(spec);
450} 452}
451 453
452static const struct snd_kcontrol_new cxt_capture_mixers[] = { 454static const struct snd_kcontrol_new cxt_capture_mixers[] = {
@@ -4466,6 +4468,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
4466 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), 4468 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
4467 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 4469 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
4468 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 4470 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
4471 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
4469 {} 4472 {}
4470}; 4473};
4471 4474
@@ -4497,6 +4500,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
4497 if (!spec) 4500 if (!spec)
4498 return -ENOMEM; 4501 return -ENOMEM;
4499 codec->spec = spec; 4502 codec->spec = spec;
4503 snd_hda_gen_init(&spec->gen);
4500 4504
4501 switch (codec->vendor_id) { 4505 switch (codec->vendor_id) {
4502 case 0x14f15045: 4506 case 0x14f15045:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f8f4906e498d..aa4c25e0f327 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2289,6 +2289,7 @@ static void alc_free(struct hda_codec *codec)
2289 alc_shutup(codec); 2289 alc_shutup(codec);
2290 alc_free_kctls(codec); 2290 alc_free_kctls(codec);
2291 alc_free_bind_ctls(codec); 2291 alc_free_bind_ctls(codec);
2292 snd_hda_gen_free(&spec->gen);
2292 kfree(spec); 2293 kfree(spec);
2293 snd_hda_detach_beep_device(codec); 2294 snd_hda_detach_beep_device(codec);
2294} 2295}
@@ -4253,6 +4254,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
4253 return -ENOMEM; 4254 return -ENOMEM;
4254 codec->spec = spec; 4255 codec->spec = spec;
4255 spec->mixer_nid = mixer_nid; 4256 spec->mixer_nid = mixer_nid;
4257 snd_hda_gen_init(&spec->gen);
4256 4258
4257 err = alc_codec_rename_from_preset(codec); 4259 err = alc_codec_rename_from_preset(codec);
4258 if (err < 0) { 4260 if (err < 0) {
@@ -6686,6 +6688,31 @@ static const struct alc_model_fixup alc662_fixup_models[] = {
6686 {} 6688 {}
6687}; 6689};
6688 6690
6691static void alc662_fill_coef(struct hda_codec *codec)
6692{
6693 int val, coef;
6694
6695 coef = alc_get_coef0(codec);
6696
6697 switch (codec->vendor_id) {
6698 case 0x10ec0662:
6699 if ((coef & 0x00f0) == 0x0030) {
6700 val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */
6701 alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
6702 }
6703 break;
6704 case 0x10ec0272:
6705 case 0x10ec0273:
6706 case 0x10ec0663:
6707 case 0x10ec0665:
6708 case 0x10ec0670:
6709 case 0x10ec0671:
6710 case 0x10ec0672:
6711 val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */
6712 alc_write_coef_idx(codec, 0xd, val | (1<<14));
6713 break;
6714 }
6715}
6689 6716
6690/* 6717/*
6691 */ 6718 */
@@ -6705,12 +6732,8 @@ static int patch_alc662(struct hda_codec *codec)
6705 6732
6706 alc_fix_pll_init(codec, 0x20, 0x04, 15); 6733 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6707 6734
6708 if ((alc_get_coef0(codec) & (1 << 14)) && 6735 spec->init_hook = alc662_fill_coef;
6709 codec->bus->pci->subsystem_vendor == 0x1025 && 6736 alc662_fill_coef(codec);
6710 spec->cdefine.platform_type == 1) {
6711 if (alc_codec_rename(codec, "ALC272X") < 0)
6712 goto error;
6713 }
6714 6737
6715 alc_pick_fixup(codec, alc662_fixup_models, 6738 alc_pick_fixup(codec, alc662_fixup_models,
6716 alc662_fixup_tbl, alc662_fixups); 6739 alc662_fixup_tbl, alc662_fixups);
@@ -6718,6 +6741,13 @@ static int patch_alc662(struct hda_codec *codec)
6718 6741
6719 alc_auto_parse_customize_define(codec); 6742 alc_auto_parse_customize_define(codec);
6720 6743
6744 if ((alc_get_coef0(codec) & (1 << 14)) &&
6745 codec->bus->pci->subsystem_vendor == 0x1025 &&
6746 spec->cdefine.platform_type == 1) {
6747 if (alc_codec_rename(codec, "ALC272X") < 0)
6748 goto error;
6749 }
6750
6721 /* automatic parse from the BIOS config */ 6751 /* automatic parse from the BIOS config */
6722 err = alc662_parse_auto_config(codec); 6752 err = alc662_parse_auto_config(codec);
6723 if (err < 0) 6753 if (err < 0)
@@ -6800,6 +6830,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
6800 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 6830 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
6801 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, 6831 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
6802 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, 6832 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
6833 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
6803 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 6834 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
6804 .patch = patch_alc861 }, 6835 .patch = patch_alc861 },
6805 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 6836 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7db8228f1b88..07675282015a 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4367,7 +4367,7 @@ static int stac92xx_init(struct hda_codec *codec)
4367 AC_PINCTL_IN_EN); 4367 AC_PINCTL_IN_EN);
4368 for (i = 0; i < spec->num_pwrs; i++) { 4368 for (i = 0; i < spec->num_pwrs; i++) {
4369 hda_nid_t nid = spec->pwr_nids[i]; 4369 hda_nid_t nid = spec->pwr_nids[i];
4370 int pinctl, def_conf; 4370 unsigned int pinctl, def_conf;
4371 4371
4372 def_conf = snd_hda_codec_get_pincfg(codec, nid); 4372 def_conf = snd_hda_codec_get_pincfg(codec, nid);
4373 def_conf = get_defcfg_connect(def_conf); 4373 def_conf = get_defcfg_connect(def_conf);
@@ -4376,6 +4376,11 @@ static int stac92xx_init(struct hda_codec *codec)
4376 stac_toggle_power_map(codec, nid, 0); 4376 stac_toggle_power_map(codec, nid, 0);
4377 continue; 4377 continue;
4378 } 4378 }
4379 if (def_conf == AC_JACK_PORT_FIXED) {
4380 /* no need for jack detection for fixed pins */
4381 stac_toggle_power_map(codec, nid, 1);
4382 continue;
4383 }
4379 /* power on when no jack detection is available */ 4384 /* power on when no jack detection is available */
4380 /* or when the VREF is used for controlling LED */ 4385 /* or when the VREF is used for controlling LED */
4381 if (!spec->hp_detect || 4386 if (!spec->hp_detect ||
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 64d2a4fa34b2..e9b62b5ea637 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -935,9 +935,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
935 } 935 }
936 936
937found: 937found:
938 data = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 938 snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p);
939 snd_soc_write(codec, AIC3X_PLL_PROGA_REG,
940 data | (pll_p << PLLP_SHIFT));
941 snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG, 939 snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG,
942 pll_r << PLLR_SHIFT); 940 pll_r << PLLR_SHIFT);
943 snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); 941 snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT);
diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h
index 6f097fb60683..08c7f6685ff0 100644
--- a/sound/soc/codecs/tlv320aic3x.h
+++ b/sound/soc/codecs/tlv320aic3x.h
@@ -166,6 +166,7 @@
166 166
167/* PLL registers bitfields */ 167/* PLL registers bitfields */
168#define PLLP_SHIFT 0 168#define PLLP_SHIFT 0
169#define PLLP_MASK 7
169#define PLLQ_SHIFT 3 170#define PLLQ_SHIFT 3
170#define PLLR_SHIFT 0 171#define PLLR_SHIFT 0
171#define PLLJ_SHIFT 2 172#define PLLJ_SHIFT 2
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index acbdc5fde923..32682c1b7cde 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1491,6 +1491,7 @@ static int wm2200_bclk_rates_dat[WM2200_NUM_BCLK_RATES] = {
1491 1491
1492static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = { 1492static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = {
1493 5644800, 1493 5644800,
1494 3763200,
1494 2882400, 1495 2882400,
1495 1881600, 1496 1881600,
1496 1411200, 1497 1411200,
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 65d525d74c54..812acd83fb48 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1863,6 +1863,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
1863 return ret; 1863 return ret;
1864 } 1864 }
1865 1865
1866 regcache_cache_only(wm8904->regmap, false);
1866 regcache_sync(wm8904->regmap); 1867 regcache_sync(wm8904->regmap);
1867 1868
1868 /* Enable bias */ 1869 /* Enable bias */
@@ -1899,14 +1900,8 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
1899 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, 1900 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0,
1900 WM8904_BIAS_ENA, 0); 1901 WM8904_BIAS_ENA, 0);
1901 1902
1902#ifdef CONFIG_REGULATOR 1903 regcache_cache_only(wm8904->regmap, true);
1903 /* Post 2.6.34 we will be able to get a callback when 1904 regcache_mark_dirty(wm8904->regmap);
1904 * the regulators are disabled which we can use but
1905 * for now just assume that the power will be cut if
1906 * the regulator API is in use.
1907 */
1908 codec->cache_sync = 1;
1909#endif
1910 1905
1911 regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), 1906 regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
1912 wm8904->supplies); 1907 wm8904->supplies);
@@ -2084,10 +2079,8 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2084{ 2079{
2085 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 2080 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2086 struct wm8904_pdata *pdata = wm8904->pdata; 2081 struct wm8904_pdata *pdata = wm8904->pdata;
2087 u16 *reg_cache = codec->reg_cache;
2088 int ret, i; 2082 int ret, i;
2089 2083
2090 codec->cache_sync = 1;
2091 codec->control_data = wm8904->regmap; 2084 codec->control_data = wm8904->regmap;
2092 2085
2093 switch (wm8904->devtype) { 2086 switch (wm8904->devtype) {
@@ -2150,6 +2143,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2150 goto err_enable; 2143 goto err_enable;
2151 } 2144 }
2152 2145
2146 regcache_cache_only(wm8904->regmap, true);
2153 /* Change some default settings - latch VU and enable ZC */ 2147 /* Change some default settings - latch VU and enable ZC */
2154 snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT, 2148 snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT,
2155 WM8904_ADC_VU, WM8904_ADC_VU); 2149 WM8904_ADC_VU, WM8904_ADC_VU);
@@ -2180,14 +2174,18 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2180 if (!pdata->gpio_cfg[i]) 2174 if (!pdata->gpio_cfg[i])
2181 continue; 2175 continue;
2182 2176
2183 reg_cache[WM8904_GPIO_CONTROL_1 + i] 2177 regmap_update_bits(wm8904->regmap,
2184 = pdata->gpio_cfg[i] & 0xffff; 2178 WM8904_GPIO_CONTROL_1 + i,
2179 0xffff,
2180 pdata->gpio_cfg[i]);
2185 } 2181 }
2186 2182
2187 /* Zero is the default value for these anyway */ 2183 /* Zero is the default value for these anyway */
2188 for (i = 0; i < WM8904_MIC_REGS; i++) 2184 for (i = 0; i < WM8904_MIC_REGS; i++)
2189 reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] 2185 regmap_update_bits(wm8904->regmap,
2190 = pdata->mic_cfg[i]; 2186 WM8904_MIC_BIAS_CONTROL_0 + i,
2187 0xffff,
2188 pdata->mic_cfg[i]);
2191 } 2189 }
2192 2190
2193 /* Set Class W by default - this will be managed by the Class 2191 /* Set Class W by default - this will be managed by the Class
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index aa8c98b628da..1436b6ce74d1 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -727,9 +727,6 @@ static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode)
727 if (!wm8994->jackdet || !wm8994->jack_cb) 727 if (!wm8994->jackdet || !wm8994->jack_cb)
728 return; 728 return;
729 729
730 if (!wm8994->jackdet || !wm8994->jack_cb)
731 return;
732
733 if (wm8994->active_refcount) 730 if (wm8994->active_refcount)
734 mode = WM1811_JACKDET_MODE_AUDIO; 731 mode = WM1811_JACKDET_MODE_AUDIO;
735 732
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 8af422e38fd0..dc9b42b7fc4d 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2837,8 +2837,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2837 } 2837 }
2838 } 2838 }
2839 2839
2840 regcache_cache_only(codec->control_data, true);
2841
2842 /* Apply platform data settings */ 2840 /* Apply platform data settings */
2843 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, 2841 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL,
2844 WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK, 2842 WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK,
@@ -3051,7 +3049,6 @@ static int wm8996_remove(struct snd_soc_codec *codec)
3051 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) 3049 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
3052 regulator_unregister_notifier(wm8996->supplies[i].consumer, 3050 regulator_unregister_notifier(wm8996->supplies[i].consumer,
3053 &wm8996->disable_nb[i]); 3051 &wm8996->disable_nb[i]);
3054 regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3055 3052
3056 return 0; 3053 return 0;
3057} 3054}
@@ -3206,14 +3203,15 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
3206 dev_info(&i2c->dev, "revision %c\n", 3203 dev_info(&i2c->dev, "revision %c\n",
3207 (reg & WM8996_CHIP_REV_MASK) + 'A'); 3204 (reg & WM8996_CHIP_REV_MASK) + 'A');
3208 3205
3209 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3210
3211 ret = wm8996_reset(wm8996); 3206 ret = wm8996_reset(wm8996);
3212 if (ret < 0) { 3207 if (ret < 0) {
3213 dev_err(&i2c->dev, "Failed to issue reset\n"); 3208 dev_err(&i2c->dev, "Failed to issue reset\n");
3214 goto err_regmap; 3209 goto err_regmap;
3215 } 3210 }
3216 3211
3212 regcache_cache_only(wm8996->regmap, true);
3213 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3214
3217 wm8996_init_gpio(wm8996); 3215 wm8996_init_gpio(wm8996);
3218 3216
3219 ret = snd_soc_register_codec(&i2c->dev, 3217 ret = snd_soc_register_codec(&i2c->dev,
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 1c2aa7fab3fd..4da5fc55c7ee 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -33,7 +33,6 @@
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/dma.h> 35#include <mach/dma.h>
36#include <mach/audio.h>
37 36
38#include "../../arm/pxa2xx-pcm.h" 37#include "../../arm/pxa2xx-pcm.h"
39#include "pxa-ssp.h" 38#include "pxa-ssp.h"
@@ -194,7 +193,7 @@ static void pxa_ssp_set_scr(struct ssp_device *ssp, u32 div)
194{ 193{
195 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0); 194 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
196 195
197 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) { 196 if (ssp->type == PXA25x_SSP) {
198 sscr0 &= ~0x0000ff00; 197 sscr0 &= ~0x0000ff00;
199 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */ 198 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */
200 } else { 199 } else {
@@ -212,7 +211,7 @@ static u32 pxa_ssp_get_scr(struct ssp_device *ssp)
212 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0); 211 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
213 u32 div; 212 u32 div;
214 213
215 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) 214 if (ssp->type == PXA25x_SSP)
216 div = ((sscr0 >> 8) & 0xff) * 2 + 2; 215 div = ((sscr0 >> 8) & 0xff) * 2 + 2;
217 else 216 else
218 div = ((sscr0 >> 8) & 0xfff) + 1; 217 div = ((sscr0 >> 8) & 0xfff) + 1;
@@ -242,7 +241,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
242 break; 241 break;
243 case PXA_SSP_CLK_PLL: 242 case PXA_SSP_CLK_PLL:
244 /* Internal PLL is fixed */ 243 /* Internal PLL is fixed */
245 if (cpu_is_pxa25x()) 244 if (ssp->type == PXA25x_SSP)
246 priv->sysclk = 1843200; 245 priv->sysclk = 1843200;
247 else 246 else
248 priv->sysclk = 13000000; 247 priv->sysclk = 13000000;
@@ -266,11 +265,11 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
266 265
267 /* The SSP clock must be disabled when changing SSP clock mode 266 /* The SSP clock must be disabled when changing SSP clock mode
268 * on PXA2xx. On PXA3xx it must be enabled when doing so. */ 267 * on PXA2xx. On PXA3xx it must be enabled when doing so. */
269 if (!cpu_is_pxa3xx()) 268 if (ssp->type != PXA3xx_SSP)
270 clk_disable(ssp->clk); 269 clk_disable(ssp->clk);
271 val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0; 270 val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0;
272 pxa_ssp_write_reg(ssp, SSCR0, val); 271 pxa_ssp_write_reg(ssp, SSCR0, val);
273 if (!cpu_is_pxa3xx()) 272 if (ssp->type != PXA3xx_SSP)
274 clk_enable(ssp->clk); 273 clk_enable(ssp->clk);
275 274
276 return 0; 275 return 0;
@@ -294,24 +293,20 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
294 case PXA_SSP_AUDIO_DIV_SCDB: 293 case PXA_SSP_AUDIO_DIV_SCDB:
295 val = pxa_ssp_read_reg(ssp, SSACD); 294 val = pxa_ssp_read_reg(ssp, SSACD);
296 val &= ~SSACD_SCDB; 295 val &= ~SSACD_SCDB;
297#if defined(CONFIG_PXA3xx) 296 if (ssp->type == PXA3xx_SSP)
298 if (cpu_is_pxa3xx())
299 val &= ~SSACD_SCDX8; 297 val &= ~SSACD_SCDX8;
300#endif
301 switch (div) { 298 switch (div) {
302 case PXA_SSP_CLK_SCDB_1: 299 case PXA_SSP_CLK_SCDB_1:
303 val |= SSACD_SCDB; 300 val |= SSACD_SCDB;
304 break; 301 break;
305 case PXA_SSP_CLK_SCDB_4: 302 case PXA_SSP_CLK_SCDB_4:
306 break; 303 break;
307#if defined(CONFIG_PXA3xx)
308 case PXA_SSP_CLK_SCDB_8: 304 case PXA_SSP_CLK_SCDB_8:
309 if (cpu_is_pxa3xx()) 305 if (ssp->type == PXA3xx_SSP)
310 val |= SSACD_SCDX8; 306 val |= SSACD_SCDX8;
311 else 307 else
312 return -EINVAL; 308 return -EINVAL;
313 break; 309 break;
314#endif
315 default: 310 default:
316 return -EINVAL; 311 return -EINVAL;
317 } 312 }
@@ -337,10 +332,8 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
337 struct ssp_device *ssp = priv->ssp; 332 struct ssp_device *ssp = priv->ssp;
338 u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70; 333 u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70;
339 334
340#if defined(CONFIG_PXA3xx) 335 if (ssp->type == PXA3xx_SSP)
341 if (cpu_is_pxa3xx())
342 pxa_ssp_write_reg(ssp, SSACDD, 0); 336 pxa_ssp_write_reg(ssp, SSACDD, 0);
343#endif
344 337
345 switch (freq_out) { 338 switch (freq_out) {
346 case 5622000: 339 case 5622000:
@@ -365,11 +358,10 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
365 break; 358 break;
366 359
367 default: 360 default:
368#ifdef CONFIG_PXA3xx
369 /* PXA3xx has a clock ditherer which can be used to generate 361 /* PXA3xx has a clock ditherer which can be used to generate
370 * a wider range of frequencies - calculate a value for it. 362 * a wider range of frequencies - calculate a value for it.
371 */ 363 */
372 if (cpu_is_pxa3xx()) { 364 if (ssp->type == PXA3xx_SSP) {
373 u32 val; 365 u32 val;
374 u64 tmp = 19968; 366 u64 tmp = 19968;
375 tmp *= 1000000; 367 tmp *= 1000000;
@@ -386,7 +378,6 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
386 val, freq_out); 378 val, freq_out);
387 break; 379 break;
388 } 380 }
389#endif
390 381
391 return -EINVAL; 382 return -EINVAL;
392 } 383 }
@@ -590,10 +581,8 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
590 /* bit size */ 581 /* bit size */
591 switch (params_format(params)) { 582 switch (params_format(params)) {
592 case SNDRV_PCM_FORMAT_S16_LE: 583 case SNDRV_PCM_FORMAT_S16_LE:
593#ifdef CONFIG_PXA3xx 584 if (ssp->type == PXA3xx_SSP)
594 if (cpu_is_pxa3xx())
595 sscr0 |= SSCR0_FPCKE; 585 sscr0 |= SSCR0_FPCKE;
596#endif
597 sscr0 |= SSCR0_DataSize(16); 586 sscr0 |= SSCR0_DataSize(16);
598 break; 587 break;
599 case SNDRV_PCM_FORMAT_S24_LE: 588 case SNDRV_PCM_FORMAT_S24_LE:
@@ -618,9 +607,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
618 * trying and failing a lot; some of the registers 607 * trying and failing a lot; some of the registers
619 * needed for that mode are only available on PXA3xx. 608 * needed for that mode are only available on PXA3xx.
620 */ 609 */
621 610 if (ssp->type != PXA3xx_SSP)
622#ifdef CONFIG_PXA3xx
623 if (!cpu_is_pxa3xx())
624 return -EINVAL; 611 return -EINVAL;
625 612
626 sspsp |= SSPSP_SFRMWDTH(width * 2); 613 sspsp |= SSPSP_SFRMWDTH(width * 2);
@@ -628,9 +615,6 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
628 sspsp |= SSPSP_EDMYSTOP(3); 615 sspsp |= SSPSP_EDMYSTOP(3);
629 sspsp |= SSPSP_DMYSTOP(3); 616 sspsp |= SSPSP_DMYSTOP(3);
630 sspsp |= SSPSP_DMYSTRT(1); 617 sspsp |= SSPSP_DMYSTRT(1);
631#else
632 return -EINVAL;
633#endif
634 } else { 618 } else {
635 /* The frame width is the width the LRCLK is 619 /* The frame width is the width the LRCLK is
636 * asserted for; the delay is expressed in 620 * asserted for; the delay is expressed in
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 0b0df49d9d33..3b6da91188a9 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -346,6 +346,17 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
346 return 0; 346 return 0;
347} 347}
348 348
349static int tegra_wm8903_remove(struct snd_soc_card *card)
350{
351 struct snd_soc_pcm_runtime *rtd = &(card->rtd[0]);
352 struct snd_soc_dai *codec_dai = rtd->codec_dai;
353 struct snd_soc_codec *codec = codec_dai->codec;
354
355 wm8903_mic_detect(codec, NULL, 0, 0);
356
357 return 0;
358}
359
349static struct snd_soc_dai_link tegra_wm8903_dai = { 360static struct snd_soc_dai_link tegra_wm8903_dai = {
350 .name = "WM8903", 361 .name = "WM8903",
351 .stream_name = "WM8903 PCM", 362 .stream_name = "WM8903 PCM",
@@ -363,6 +374,8 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
363 .dai_link = &tegra_wm8903_dai, 374 .dai_link = &tegra_wm8903_dai,
364 .num_links = 1, 375 .num_links = 1,
365 376
377 .remove = tegra_wm8903_remove,
378
366 .controls = tegra_wm8903_controls, 379 .controls = tegra_wm8903_controls,
367 .num_controls = ARRAY_SIZE(tegra_wm8903_controls), 380 .num_controls = ARRAY_SIZE(tegra_wm8903_controls),
368 .dapm_widgets = tegra_wm8903_dapm_widgets, 381 .dapm_widgets = tegra_wm8903_dapm_widgets,
diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
index 6f9715ab32fe..56ad923bf6b5 100644
--- a/sound/usb/6fire/firmware.c
+++ b/sound/usb/6fire/firmware.c
@@ -209,7 +209,7 @@ static int usb6fire_fw_ezusb_upload(
209 int ret; 209 int ret;
210 u8 data; 210 u8 data;
211 struct usb_device *device = interface_to_usbdev(intf); 211 struct usb_device *device = interface_to_usbdev(intf);
212 const struct firmware *fw = 0; 212 const struct firmware *fw = NULL;
213 struct ihex_record *rec = kmalloc(sizeof(struct ihex_record), 213 struct ihex_record *rec = kmalloc(sizeof(struct ihex_record),
214 GFP_KERNEL); 214 GFP_KERNEL);
215 215
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index 41daaa24c25f..e71fe55cebef 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -341,6 +341,14 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
341 .map = audigy2nx_map, 341 .map = audigy2nx_map,
342 .selector_map = audigy2nx_selectors, 342 .selector_map = audigy2nx_selectors,
343 }, 343 },
344 { /* Logitech, Inc. QuickCam Pro for Notebooks */
345 .id = USB_ID(0x046d, 0x0991),
346 .ignore_ctl_error = 1,
347 },
348 { /* Logitech, Inc. QuickCam E 3500 */
349 .id = USB_ID(0x046d, 0x09a4),
350 .ignore_ctl_error = 1,
351 },
344 { 352 {
345 /* Hercules DJ Console (Windows Edition) */ 353 /* Hercules DJ Console (Windows Edition) */
346 .id = USB_ID(0x06f8, 0xb000), 354 .id = USB_ID(0x06f8, 0xb000),
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index cdf8b7601973..54607f8c4f66 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -354,17 +354,21 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
354 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 354 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
355 get_endpoint(alts, 1)->bSynchAddress != 0 && 355 get_endpoint(alts, 1)->bSynchAddress != 0 &&
356 !implicit_fb)) { 356 !implicit_fb)) {
357 snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n", 357 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n",
358 dev->devnum, fmt->iface, fmt->altsetting); 358 dev->devnum, fmt->iface, fmt->altsetting,
359 get_endpoint(alts, 1)->bmAttributes,
360 get_endpoint(alts, 1)->bLength,
361 get_endpoint(alts, 1)->bSynchAddress);
359 return -EINVAL; 362 return -EINVAL;
360 } 363 }
361 ep = get_endpoint(alts, 1)->bEndpointAddress; 364 ep = get_endpoint(alts, 1)->bEndpointAddress;
362 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 365 if (!implicit_fb &&
366 get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
363 (( is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || 367 (( is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
364 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)) || 368 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
365 ( is_playback && !implicit_fb))) { 369 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n",
366 snd_printk(KERN_ERR "%d:%d:%d : invalid synch pipe\n", 370 dev->devnum, fmt->iface, fmt->altsetting,
367 dev->devnum, fmt->iface, fmt->altsetting); 371 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress);
368 return -EINVAL; 372 return -EINVAL;
369 } 373 }
370 374
@@ -1147,7 +1151,8 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea
1147 return -EINVAL; 1151 return -EINVAL;
1148} 1152}
1149 1153
1150int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream, int cmd) 1154static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream,
1155 int cmd)
1151{ 1156{
1152 int err; 1157 int err;
1153 struct snd_usb_substream *subs = substream->runtime->private_data; 1158 struct snd_usb_substream *subs = substream->runtime->private_data;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index d89ab4c7d44b..79780fa57a43 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -1831,6 +1831,36 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1831 } 1831 }
1832 } 1832 }
1833}, 1833},
1834{
1835 USB_DEVICE(0x0582, 0x014d),
1836 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1837 /* .vendor_name = "BOSS", */
1838 /* .product_name = "GT-100", */
1839 .ifnum = QUIRK_ANY_INTERFACE,
1840 .type = QUIRK_COMPOSITE,
1841 .data = (const struct snd_usb_audio_quirk[]) {
1842 {
1843 .ifnum = 1,
1844 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1845 },
1846 {
1847 .ifnum = 2,
1848 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1849 },
1850 {
1851 .ifnum = 3,
1852 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1853 .data = & (const struct snd_usb_midi_endpoint_info) {
1854 .out_cables = 0x0001,
1855 .in_cables = 0x0001
1856 }
1857 },
1858 {
1859 .ifnum = -1
1860 }
1861 }
1862 }
1863},
1834 1864
1835/* Guillemot devices */ 1865/* Guillemot devices */
1836{ 1866{
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 146fd6147e84..d9834b362943 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -701,14 +701,18 @@ int main(void)
701 pfd.fd = fd; 701 pfd.fd = fd;
702 702
703 while (1) { 703 while (1) {
704 struct sockaddr *addr_p = (struct sockaddr *) &addr;
705 socklen_t addr_l = sizeof(addr);
704 pfd.events = POLLIN; 706 pfd.events = POLLIN;
705 pfd.revents = 0; 707 pfd.revents = 0;
706 poll(&pfd, 1, -1); 708 poll(&pfd, 1, -1);
707 709
708 len = recv(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0); 710 len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0,
711 addr_p, &addr_l);
709 712
710 if (len < 0) { 713 if (len < 0 || addr.nl_pid) {
711 syslog(LOG_ERR, "recv failed; error:%d", len); 714 syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
715 addr.nl_pid, errno, strerror(errno));
712 close(fd); 716 close(fd);
713 return -1; 717 return -1;
714 } 718 }
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 262589991ea4..07b5c7703dd1 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1179,6 +1179,12 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
1179 fprintf(stderr, "cannot use both --output and --log-fd\n"); 1179 fprintf(stderr, "cannot use both --output and --log-fd\n");
1180 usage_with_options(stat_usage, options); 1180 usage_with_options(stat_usage, options);
1181 } 1181 }
1182
1183 if (output_fd < 0) {
1184 fprintf(stderr, "argument to --log-fd must be a > 0\n");
1185 usage_with_options(stat_usage, options);
1186 }
1187
1182 if (!output) { 1188 if (!output) {
1183 struct timespec tm; 1189 struct timespec tm;
1184 mode = append_file ? "a" : "w"; 1190 mode = append_file ? "a" : "w";
@@ -1190,7 +1196,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
1190 } 1196 }
1191 clock_gettime(CLOCK_REALTIME, &tm); 1197 clock_gettime(CLOCK_REALTIME, &tm);
1192 fprintf(output, "# started on %s\n", ctime(&tm.tv_sec)); 1198 fprintf(output, "# started on %s\n", ctime(&tm.tv_sec));
1193 } else if (output_fd != 2) { 1199 } else if (output_fd > 0) {
1194 mode = append_file ? "a" : "w"; 1200 mode = append_file ? "a" : "w";
1195 output = fdopen(output_fd, mode); 1201 output = fdopen(output_fd, mode);
1196 if (!output) { 1202 if (!output) {
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 2dd5edf161b7..e909d43cf542 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1942,7 +1942,6 @@ int perf_file_header__read(struct perf_file_header *header,
1942 else 1942 else
1943 return -1; 1943 return -1;
1944 } else if (ph->needs_swap) { 1944 } else if (ph->needs_swap) {
1945 unsigned int i;
1946 /* 1945 /*
1947 * feature bitmap is declared as an array of unsigned longs -- 1946 * feature bitmap is declared as an array of unsigned longs --
1948 * not good since its size can differ between the host that 1947 * not good since its size can differ between the host that
@@ -1958,14 +1957,17 @@ int perf_file_header__read(struct perf_file_header *header,
1958 * file), punt and fallback to the original behavior -- 1957 * file), punt and fallback to the original behavior --
1959 * clearing all feature bits and setting buildid. 1958 * clearing all feature bits and setting buildid.
1960 */ 1959 */
1961 for (i = 0; i < BITS_TO_LONGS(HEADER_FEAT_BITS); ++i) 1960 mem_bswap_64(&header->adds_features,
1962 header->adds_features[i] = bswap_64(header->adds_features[i]); 1961 BITS_TO_U64(HEADER_FEAT_BITS));
1963 1962
1964 if (!test_bit(HEADER_HOSTNAME, header->adds_features)) { 1963 if (!test_bit(HEADER_HOSTNAME, header->adds_features)) {
1965 for (i = 0; i < BITS_TO_LONGS(HEADER_FEAT_BITS); ++i) { 1964 /* unswap as u64 */
1966 header->adds_features[i] = bswap_64(header->adds_features[i]); 1965 mem_bswap_64(&header->adds_features,
1967 header->adds_features[i] = bswap_32(header->adds_features[i]); 1966 BITS_TO_U64(HEADER_FEAT_BITS));
1968 } 1967
1968 /* unswap as u32 */
1969 mem_bswap_32(&header->adds_features,
1970 BITS_TO_U32(HEADER_FEAT_BITS));
1969 } 1971 }
1970 1972
1971 if (!test_bit(HEADER_HOSTNAME, header->adds_features)) { 1973 if (!test_bit(HEADER_HOSTNAME, header->adds_features)) {
@@ -2091,6 +2093,35 @@ static int read_attr(int fd, struct perf_header *ph,
2091 return ret <= 0 ? -1 : 0; 2093 return ret <= 0 ? -1 : 0;
2092} 2094}
2093 2095
2096static int perf_evsel__set_tracepoint_name(struct perf_evsel *evsel)
2097{
2098 struct event_format *event = trace_find_event(evsel->attr.config);
2099 char bf[128];
2100
2101 if (event == NULL)
2102 return -1;
2103
2104 snprintf(bf, sizeof(bf), "%s:%s", event->system, event->name);
2105 evsel->name = strdup(bf);
2106 if (event->name == NULL)
2107 return -1;
2108
2109 return 0;
2110}
2111
2112static int perf_evlist__set_tracepoint_names(struct perf_evlist *evlist)
2113{
2114 struct perf_evsel *pos;
2115
2116 list_for_each_entry(pos, &evlist->entries, node) {
2117 if (pos->attr.type == PERF_TYPE_TRACEPOINT &&
2118 perf_evsel__set_tracepoint_name(pos))
2119 return -1;
2120 }
2121
2122 return 0;
2123}
2124
2094int perf_session__read_header(struct perf_session *session, int fd) 2125int perf_session__read_header(struct perf_session *session, int fd)
2095{ 2126{
2096 struct perf_header *header = &session->header; 2127 struct perf_header *header = &session->header;
@@ -2172,6 +2203,9 @@ int perf_session__read_header(struct perf_session *session, int fd)
2172 2203
2173 lseek(fd, header->data_offset, SEEK_SET); 2204 lseek(fd, header->data_offset, SEEK_SET);
2174 2205
2206 if (perf_evlist__set_tracepoint_names(session->evlist))
2207 goto out_delete_evlist;
2208
2175 header->frozen = 1; 2209 header->frozen = 1;
2176 return 0; 2210 return 0;
2177out_errno: 2211out_errno:
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
index f1584833bd22..587a230d2075 100644
--- a/tools/perf/util/include/linux/bitops.h
+++ b/tools/perf/util/include/linux/bitops.h
@@ -8,6 +8,8 @@
8#define BITS_PER_LONG __WORDSIZE 8#define BITS_PER_LONG __WORDSIZE
9#define BITS_PER_BYTE 8 9#define BITS_PER_BYTE 8
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64))
12#define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32))
11 13
12#define for_each_set_bit(bit, addr, size) \ 14#define for_each_set_bit(bit, addr, size) \
13 for ((bit) = find_first_bit((addr), (size)); \ 15 for ((bit) = find_first_bit((addr), (size)); \
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 2600916efa83..c3e399bcf18d 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -442,6 +442,16 @@ static void perf_tool__fill_defaults(struct perf_tool *tool)
442 tool->finished_round = process_finished_round_stub; 442 tool->finished_round = process_finished_round_stub;
443 } 443 }
444} 444}
445
446void mem_bswap_32(void *src, int byte_size)
447{
448 u32 *m = src;
449 while (byte_size > 0) {
450 *m = bswap_32(*m);
451 byte_size -= sizeof(u32);
452 ++m;
453 }
454}
445 455
446void mem_bswap_64(void *src, int byte_size) 456void mem_bswap_64(void *src, int byte_size)
447{ 457{
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 7a5434c00565..0c702e3f0a36 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -80,6 +80,7 @@ struct branch_info *machine__resolve_bstack(struct machine *self,
80bool perf_session__has_traces(struct perf_session *self, const char *msg); 80bool perf_session__has_traces(struct perf_session *self, const char *msg);
81 81
82void mem_bswap_64(void *src, int byte_size); 82void mem_bswap_64(void *src, int byte_size);
83void mem_bswap_32(void *src, int byte_size);
83void perf_event__attr_swap(struct perf_event_attr *attr); 84void perf_event__attr_swap(struct perf_event_attr *attr);
84 85
85int perf_session__create_kernel_maps(struct perf_session *self); 86int perf_session__create_kernel_maps(struct perf_session *self);
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 01f572c10c71..b1e091ae2f37 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -635,7 +635,6 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
635 int r = 0, idx; 635 int r = 0, idx;
636 struct kvm_assigned_dev_kernel *match; 636 struct kvm_assigned_dev_kernel *match;
637 struct pci_dev *dev; 637 struct pci_dev *dev;
638 u8 header_type;
639 638
640 if (!(assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU)) 639 if (!(assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU))
641 return -EINVAL; 640 return -EINVAL;
@@ -668,8 +667,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
668 } 667 }
669 668
670 /* Don't allow bridges to be assigned */ 669 /* Don't allow bridges to be assigned */
671 pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); 670 if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL) {
672 if ((header_type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL) {
673 r = -EPERM; 671 r = -EPERM;
674 goto out_put; 672 goto out_put;
675 } 673 }
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index f59c1e8de7a2..7d7e2aaffece 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -198,7 +198,7 @@ static void irqfd_update(struct kvm *kvm, struct _irqfd *irqfd,
198} 198}
199 199
200static int 200static int
201kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi) 201kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
202{ 202{
203 struct kvm_irq_routing_table *irq_rt; 203 struct kvm_irq_routing_table *irq_rt;
204 struct _irqfd *irqfd, *tmp; 204 struct _irqfd *irqfd, *tmp;
@@ -212,12 +212,12 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
212 return -ENOMEM; 212 return -ENOMEM;
213 213
214 irqfd->kvm = kvm; 214 irqfd->kvm = kvm;
215 irqfd->gsi = gsi; 215 irqfd->gsi = args->gsi;
216 INIT_LIST_HEAD(&irqfd->list); 216 INIT_LIST_HEAD(&irqfd->list);
217 INIT_WORK(&irqfd->inject, irqfd_inject); 217 INIT_WORK(&irqfd->inject, irqfd_inject);
218 INIT_WORK(&irqfd->shutdown, irqfd_shutdown); 218 INIT_WORK(&irqfd->shutdown, irqfd_shutdown);
219 219
220 file = eventfd_fget(fd); 220 file = eventfd_fget(args->fd);
221 if (IS_ERR(file)) { 221 if (IS_ERR(file)) {
222 ret = PTR_ERR(file); 222 ret = PTR_ERR(file);
223 goto fail; 223 goto fail;
@@ -298,19 +298,19 @@ kvm_eventfd_init(struct kvm *kvm)
298 * shutdown any irqfd's that match fd+gsi 298 * shutdown any irqfd's that match fd+gsi
299 */ 299 */
300static int 300static int
301kvm_irqfd_deassign(struct kvm *kvm, int fd, int gsi) 301kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args)
302{ 302{
303 struct _irqfd *irqfd, *tmp; 303 struct _irqfd *irqfd, *tmp;
304 struct eventfd_ctx *eventfd; 304 struct eventfd_ctx *eventfd;
305 305
306 eventfd = eventfd_ctx_fdget(fd); 306 eventfd = eventfd_ctx_fdget(args->fd);
307 if (IS_ERR(eventfd)) 307 if (IS_ERR(eventfd))
308 return PTR_ERR(eventfd); 308 return PTR_ERR(eventfd);
309 309
310 spin_lock_irq(&kvm->irqfds.lock); 310 spin_lock_irq(&kvm->irqfds.lock);
311 311
312 list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) { 312 list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) {
313 if (irqfd->eventfd == eventfd && irqfd->gsi == gsi) { 313 if (irqfd->eventfd == eventfd && irqfd->gsi == args->gsi) {
314 /* 314 /*
315 * This rcu_assign_pointer is needed for when 315 * This rcu_assign_pointer is needed for when
316 * another thread calls kvm_irq_routing_update before 316 * another thread calls kvm_irq_routing_update before
@@ -338,12 +338,15 @@ kvm_irqfd_deassign(struct kvm *kvm, int fd, int gsi)
338} 338}
339 339
340int 340int
341kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags) 341kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
342{ 342{
343 if (flags & KVM_IRQFD_FLAG_DEASSIGN) 343 if (args->flags & ~KVM_IRQFD_FLAG_DEASSIGN)
344 return kvm_irqfd_deassign(kvm, fd, gsi); 344 return -EINVAL;
345
346 if (args->flags & KVM_IRQFD_FLAG_DEASSIGN)
347 return kvm_irqfd_deassign(kvm, args);
345 348
346 return kvm_irqfd_assign(kvm, fd, gsi); 349 return kvm_irqfd_assign(kvm, args);
347} 350}
348 351
349/* 352/*
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 7e140683ff14..44ee7124b16d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2047,7 +2047,7 @@ static long kvm_vm_ioctl(struct file *filp,
2047 r = -EFAULT; 2047 r = -EFAULT;
2048 if (copy_from_user(&data, argp, sizeof data)) 2048 if (copy_from_user(&data, argp, sizeof data))
2049 goto out; 2049 goto out;
2050 r = kvm_irqfd(kvm, data.fd, data.gsi, data.flags); 2050 r = kvm_irqfd(kvm, &data);
2051 break; 2051 break;
2052 } 2052 }
2053 case KVM_IOEVENTFD: { 2053 case KVM_IOEVENTFD: {
@@ -2845,6 +2845,7 @@ void kvm_exit(void)
2845 kvm_arch_hardware_unsetup(); 2845 kvm_arch_hardware_unsetup();
2846 kvm_arch_exit(); 2846 kvm_arch_exit();
2847 free_cpumask_var(cpus_hardware_enabled); 2847 free_cpumask_var(cpus_hardware_enabled);
2848 __free_page(fault_page);
2848 __free_page(hwpoison_page); 2849 __free_page(hwpoison_page);
2849 __free_page(bad_page); 2850 __free_page(bad_page);
2850} 2851}