aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/filesystems.tmpl4
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/porting5
-rw-r--r--Documentation/filesystems/vfs.txt4
-rw-r--r--Documentation/laptops/laptop-mode.txt12
-rw-r--r--Documentation/security/Yama.txt14
-rw-r--r--Documentation/sysctl/vm.txt14
-rw-r--r--Documentation/w1/slaves/w1_therm2
-rw-r--r--MAINTAINERS57
-rw-r--r--Makefile2
-rw-r--r--arch/arm/boot/dts/imx23.dtsi52
-rw-r--r--arch/arm/boot/dts/imx27-3ds.dts2
-rw-r--r--arch/arm/boot/dts/imx27.dtsi6
-rw-r--r--arch/arm/boot/dts/imx28.dtsi74
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts2
-rw-r--r--arch/arm/boot/dts/imx51.dtsi4
-rw-r--r--arch/arm/boot/dts/imx53-ard.dts22
-rw-r--r--arch/arm/boot/dts/imx53.dtsi7
-rw-r--r--arch/arm/boot/dts/imx6q-sabrelite.dts1
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi7
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig1
-rw-r--r--arch/arm/configs/mxs_defconfig1
-rw-r--r--arch/arm/configs/tct_hammer_defconfig2
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c39
-rw-r--r--arch/arm/mach-exynos/pm_domains.c2
-rw-r--r--arch/arm/mach-imx/clk-imx27.c8
-rw-r--r--arch/arm/mach-imx/clk-imx31.c2
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c1
-rw-r--r--arch/arm/mach-integrator/core.c1
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c2
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot4
-rw-r--r--arch/arm/mach-mxs/Kconfig6
-rw-r--r--arch/arm/mach-mxs/Makefile3
-rw-r--r--arch/arm/mach-pxa/raumfeld.c2
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig4
-rw-r--r--arch/arm/mach-sa1100/leds-hackkit.c1
-rw-r--r--arch/arm/mach-tegra/board-harmony-power.c32
-rw-r--r--arch/arm/mm/dma-mapping.c12
-rw-r--r--arch/arm/plat-samsung/Kconfig3
-rw-r--r--arch/blackfin/kernel/setup.c1
-rw-r--r--arch/c6x/Kconfig1
-rw-r--r--arch/c6x/include/asm/cache.h16
-rw-r--r--arch/ia64/kernel/acpi.c5
-rw-r--r--arch/m68k/Kconfig12
-rw-r--r--arch/m68k/Kconfig.cpu14
-rw-r--r--arch/m68k/apollo/config.c16
-rw-r--r--arch/m68k/include/asm/Kbuild25
-rw-r--r--arch/m68k/include/asm/MC68332.h152
-rw-r--r--arch/m68k/include/asm/apollodma.h248
-rw-r--r--arch/m68k/include/asm/apollohw.h2
-rw-r--r--arch/m68k/include/asm/bitsperlong.h1
-rw-r--r--arch/m68k/include/asm/cputime.h6
-rw-r--r--arch/m68k/include/asm/delay.h2
-rw-r--r--arch/m68k/include/asm/device.h7
-rw-r--r--arch/m68k/include/asm/emergency-restart.h6
-rw-r--r--arch/m68k/include/asm/errno.h6
-rw-r--r--arch/m68k/include/asm/futex.h6
-rw-r--r--arch/m68k/include/asm/ioctl.h1
-rw-r--r--arch/m68k/include/asm/ipcbuf.h1
-rw-r--r--arch/m68k/include/asm/irq_regs.h1
-rw-r--r--arch/m68k/include/asm/kdebug.h1
-rw-r--r--arch/m68k/include/asm/kmap_types.h6
-rw-r--r--arch/m68k/include/asm/kvm_para.h1
-rw-r--r--arch/m68k/include/asm/local.h6
-rw-r--r--arch/m68k/include/asm/local64.h1
-rw-r--r--arch/m68k/include/asm/mac_mouse.h23
-rw-r--r--arch/m68k/include/asm/mcfmbus.h77
-rw-r--r--arch/m68k/include/asm/mman.h1
-rw-r--r--arch/m68k/include/asm/mutex.h9
-rw-r--r--arch/m68k/include/asm/percpu.h6
-rw-r--r--arch/m68k/include/asm/resource.h6
-rw-r--r--arch/m68k/include/asm/sbus.h45
-rw-r--r--arch/m68k/include/asm/scatterlist.h6
-rw-r--r--arch/m68k/include/asm/sections.h8
-rw-r--r--arch/m68k/include/asm/shm.h31
-rw-r--r--arch/m68k/include/asm/siginfo.h6
-rw-r--r--arch/m68k/include/asm/statfs.h6
-rw-r--r--arch/m68k/include/asm/topology.h6
-rw-r--r--arch/m68k/include/asm/types.h22
-rw-r--r--arch/m68k/include/asm/unaligned.h4
-rw-r--r--arch/m68k/include/asm/xor.h1
-rw-r--r--arch/m68k/kernel/setup_no.c11
-rw-r--r--arch/m68k/kernel/sys_m68k.c8
-rw-r--r--arch/m68k/kernel/vmlinux-nommu.lds2
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds2
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds2
-rw-r--r--arch/m68k/lib/muldi3.c2
-rw-r--r--arch/m68k/mm/init_mm.c2
-rw-r--r--arch/m68k/mm/init_no.c2
-rw-r--r--arch/m68k/platform/68328/head-de2.S8
-rw-r--r--arch/m68k/platform/68328/head-pilot.S10
-rw-r--r--arch/m68k/platform/68328/head-ram.S4
-rw-r--r--arch/m68k/platform/68328/head-rom.S6
-rw-r--r--arch/m68k/platform/68360/head-ram.S6
-rw-r--r--arch/m68k/platform/68360/head-rom.S8
-rw-r--r--arch/m68k/platform/coldfire/head.S10
-rw-r--r--arch/m68k/sun3/prom/init.c48
-rw-r--r--arch/microblaze/include/asm/sections.h4
-rw-r--r--arch/microblaze/kernel/microblaze_ksyms.c3
-rw-r--r--arch/microblaze/kernel/setup.c4
-rw-r--r--arch/microblaze/kernel/vmlinux.lds.S1
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/sparsemem.h2
-rw-r--r--arch/s390/include/asm/syscall.h10
-rw-r--r--arch/s390/kernel/compat_linux.c2
-rw-r--r--arch/s390/kernel/compat_wrapper.S4
-rw-r--r--arch/s390/kernel/ptrace.c7
-rw-r--r--arch/s390/kernel/sys_s390.c9
-rw-r--r--arch/sh/drivers/dma/dma-sh.c2
-rw-r--r--arch/sh/include/asm/sections.h1
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/sh7269.h36
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c195
-rw-r--r--arch/sh/kernel/setup.c2
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c1
-rw-r--r--arch/sh/kernel/vmlinux.lds.S1
-rw-r--r--arch/sh/lib/mcount.S8
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c10
-rw-r--r--arch/sparc/mm/init_64.c28
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/include/asm/mce.h8
-rw-r--r--arch/x86/include/asm/perf_event.h11
-rw-r--r--arch/x86/kernel/acpi/sleep.c4
-rw-r--r--arch/x86/kernel/acpi/sleep.h2
-rw-r--r--arch/x86/kernel/acpi/wakeup_32.S4
-rw-r--r--arch/x86/kernel/acpi/wakeup_64.S4
-rw-r--r--arch/x86/kernel/alternative.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-severity.c7
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c43
-rw-r--r--arch/x86/kernel/cpu/perf_event.c89
-rw-r--r--arch/x86/kernel/cpu/perf_event.h20
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c7
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h2
-rw-r--r--arch/x86/kernel/irq.c1
-rw-r--r--arch/x86/kernel/kdebugfs.c6
-rw-r--r--arch/x86/kvm/i8259.c17
-rw-r--r--arch/x86/kvm/vmx.c20
-rw-r--r--arch/x86/kvm/x86.c4
-rw-r--r--arch/x86/mm/srat.c15
-rw-r--r--arch/x86/syscalls/syscall_64.tbl2
-rw-r--r--arch/x86/xen/p2m.c5
-rw-r--r--drivers/acpi/ac.c4
-rw-r--r--drivers/acpi/acpica/achware.h12
-rw-r--r--drivers/acpi/acpica/hwesleep.c19
-rw-r--r--drivers/acpi/acpica/hwsleep.c20
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c22
-rw-r--r--drivers/acpi/battery.c2
-rw-r--r--drivers/acpi/button.c4
-rw-r--r--drivers/acpi/fan.c4
-rw-r--r--drivers/acpi/numa.c12
-rw-r--r--drivers/acpi/pci_root.c11
-rw-r--r--drivers/acpi/power.c4
-rw-r--r--drivers/acpi/processor_driver.c2
-rw-r--r--drivers/acpi/sbs.c2
-rw-r--r--drivers/acpi/sleep.c75
-rw-r--r--drivers/acpi/sysfs.c4
-rw-r--r--drivers/acpi/thermal.c4
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/base/core.c9
-rw-r--r--drivers/base/power/clock_ops.c3
-rw-r--r--drivers/base/power/common.c4
-rw-r--r--drivers/bcma/host_pci.c1
-rw-r--r--drivers/bcma/sprom.c4
-rw-r--r--drivers/block/drbd/drbd_main.c4
-rw-r--r--drivers/char/agp/intel-agp.h39
-rw-r--r--drivers/char/agp/intel-gtt.c60
-rw-r--r--drivers/char/hw_random/omap-rng.c2
-rw-r--r--drivers/char/tpm/tpm_tis.c2
-rw-r--r--drivers/cpufreq/pcc-cpufreq.c1
-rw-r--r--drivers/dma/imx-dma.c36
-rw-r--r--drivers/dma/tegra20-apb-dma.c18
-rw-r--r--drivers/extcon/extcon_gpio.c3
-rw-r--r--drivers/gpio/gpio-em.c2
-rw-r--r--drivers/gpio/gpio-langwell.c7
-rw-r--r--drivers/gpio/gpio-msic.c2
-rw-r--r--drivers/gpio/gpio-mxc.c5
-rw-r--r--drivers/gpio/gpio-pxa.c30
-rw-r--r--drivers/gpio/gpio-samsung.c14
-rw-r--r--drivers/gpio/gpio-sch.c3
-rw-r--r--drivers/gpu/drm/drm_edid_load.c8
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c31
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c1
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c20
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c3
-rw-r--r--drivers/gpu/drm/i915/i915_sysfs.c12
-rw-r--r--drivers/gpu/drm/i915/intel_display.c12
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c14
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h20
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c10
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c15
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c6
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c48
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c5
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_mode.c12
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_i2c.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv84_fifo.c9
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_pm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvd0_display.c2
-rw-r--r--drivers/gpu/drm/nouveau/nve0_fifo.c37
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c22
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c71
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c13
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h2
-rw-r--r--drivers/gpu/drm/radeon/ni.c14
-rw-r--r--drivers/gpu/drm/radeon/r600.c20
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c65
-rw-r--r--drivers/gpu/drm/radeon/r600d.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon.h12
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h10
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c49
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c57
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c32
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c26
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c35
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_crtc.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c6
-rw-r--r--drivers/gpu/drm/radeon/rv515.c13
-rw-r--r--drivers/gpu/drm/radeon/si.c35
-rw-r--r--drivers/gpu/drm/radeon/sid.h3
-rw-r--r--drivers/gpu/drm/udl/udl_gem.c2
-rw-r--r--drivers/iio/frequency/adf4350.c24
-rw-r--r--drivers/iio/light/adjd_s311.c7
-rw-r--r--drivers/iio/light/lm3533-als.c4
-rw-r--r--drivers/input/touchscreen/eeti_ts.c21
-rw-r--r--drivers/iommu/amd_iommu.c25
-rw-r--r--drivers/iommu/amd_iommu_init.c6
-rw-r--r--drivers/iommu/exynos-iommu.c6
-rw-r--r--drivers/iommu/intel-iommu.c26
-rw-r--r--drivers/iommu/tegra-smmu.c17
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c12
-rw-r--r--drivers/isdn/mISDN/layer2.c2
-rw-r--r--drivers/leds/led-triggers.c2
-rw-r--r--drivers/leds/leds-lp8788.c2
-rw-r--r--drivers/leds/leds-renesas-tpu.c2
-rw-r--r--drivers/mfd/asic3.c1
-rw-r--r--drivers/mfd/ezx-pcap.c2
-rw-r--r--drivers/misc/mei/interrupt.c2
-rw-r--r--drivers/misc/mei/main.c27
-rw-r--r--drivers/misc/ti-st/st_ll.c2
-rw-r--r--drivers/mtd/maps/uclinux.c5
-rw-r--r--drivers/mtd/nand/Kconfig2
-rw-r--r--drivers/mtd/nand/omap2.c7
-rw-r--r--drivers/net/appletalk/cops.c4
-rw-r--r--drivers/net/appletalk/ltpc.c4
-rw-r--r--drivers/net/cris/eth_v10.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c72
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c2
-rw-r--r--drivers/net/ethernet/intel/e1000e/82571.c10
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c36
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c16
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_regs.h8
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c28
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c19
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/sense.c14
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c13
-rw-r--r--drivers/net/ethernet/sfc/efx.c6
-rw-r--r--drivers/net/ethernet/sfc/efx.h14
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c16
-rw-r--r--drivers/net/ethernet/sfc/tx.c19
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c2
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c1
-rw-r--r--drivers/net/hyperv/netvsc.c7
-rw-r--r--drivers/net/hyperv/rndis_filter.c11
-rw-r--r--drivers/net/irda/bfin_sir.c8
-rw-r--r--drivers/net/macvtap.c3
-rw-r--r--drivers/net/phy/mdio-mux-gpio.c1
-rw-r--r--drivers/net/ppp/pptp.c4
-rw-r--r--drivers/net/tun.c1
-rw-r--r--drivers/net/usb/cdc-phonet.c1
-rw-r--r--drivers/net/usb/cdc_ncm.c20
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c1
-rw-r--r--drivers/net/wireless/b43/main.c21
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/channel.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c13
-rw-r--r--drivers/net/wireless/libertas/cfg.c1
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c1
-rw-r--r--drivers/net/wireless/libertas/main.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c68
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c71
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c3
-rw-r--r--drivers/pinctrl/pinctrl-imx23.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx28.c2
-rw-r--r--drivers/pinctrl/pinctrl-nomadik-db8500.c2
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c1
-rw-r--r--drivers/pinctrl/pinctrl-sirf.c1
-rw-r--r--drivers/pinctrl/pinctrl-u300.c8
-rw-r--r--drivers/platform/x86/classmate-laptop.c4
-rw-r--r--drivers/platform/x86/fujitsu-tablet.c2
-rw-r--r--drivers/platform/x86/hdaps.c2
-rw-r--r--drivers/platform/x86/hp_accel.c2
-rw-r--r--drivers/platform/x86/msi-laptop.c4
-rw-r--r--drivers/platform/x86/panasonic-laptop.c4
-rw-r--r--drivers/platform/x86/sony-laptop.c12
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c2
-rw-r--r--drivers/platform/x86/toshiba_acpi.c2
-rw-r--r--drivers/platform/x86/toshiba_bluetooth.c4
-rw-r--r--drivers/platform/x86/xo15-ebook.c2
-rw-r--r--drivers/rtc/interface.c2
-rw-r--r--drivers/rtc/rtc-cmos.c1
-rw-r--r--drivers/s390/char/sclp_sdias.c2
-rw-r--r--drivers/sh/intc/core.c27
-rw-r--r--drivers/spi/spi-s3c64xx.c2
-rw-r--r--drivers/staging/comedi/drivers.c2
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1710.c3
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1723.c2
-rw-r--r--drivers/staging/comedi/drivers/adv_pci_dio.c2
-rw-r--r--drivers/staging/comedi/drivers/daqboard2000.c17
-rw-r--r--drivers/staging/comedi/drivers/dt3000.c6
-rw-r--r--drivers/staging/comedi/drivers/rtd520.c26
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c4
-rw-r--r--drivers/staging/comedi/drivers/usbduxfast.c4
-rw-r--r--drivers/staging/comedi/drivers/usbduxsigma.c4
-rw-r--r--drivers/staging/csr/Kconfig2
-rw-r--r--drivers/staging/iio/adc/ad7192.c48
-rw-r--r--drivers/staging/iio/adc/ad7298_ring.c2
-rw-r--r--drivers/staging/iio/adc/ad7780.c10
-rw-r--r--drivers/staging/iio/adc/ad7793.c99
-rw-r--r--drivers/tty/serial/Kconfig10
-rw-r--r--drivers/tty/serial/ifx6x60.c2
-rw-r--r--drivers/tty/serial/mxs-auart.c14
-rw-r--r--drivers/tty/serial/pmac_zilog.c12
-rw-r--r--drivers/usb/chipidea/Kconfig9
-rw-r--r--drivers/usb/early/ehci-dbgp.c2
-rw-r--r--drivers/usb/gadget/u_ether.c6
-rw-r--r--drivers/usb/host/ehci-omap.c167
-rw-r--r--drivers/usb/host/ehci-sead3.c2
-rw-r--r--drivers/usb/host/ehci-tegra.c3
-rw-r--r--drivers/usb/host/isp1362-hcd.c8
-rw-r--r--drivers/usb/host/ohci-omap.c2
-rw-r--r--drivers/usb/host/pci-quirks.c7
-rw-r--r--drivers/usb/host/pci-quirks.h1
-rw-r--r--drivers/usb/host/xhci-pci.c10
-rw-r--r--drivers/usb/host/xhci-ring.c40
-rw-r--r--drivers/usb/host/xhci.c8
-rw-r--r--drivers/usb/host/xhci.h3
-rw-r--r--drivers/usb/musb/Kconfig4
-rw-r--r--drivers/usb/musb/musb_dsps.c19
-rw-r--r--drivers/usb/renesas_usbhs/common.c6
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c8
-rw-r--r--drivers/usb/serial/bus.c15
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h7
-rw-r--r--drivers/usb/serial/ipw.c3
-rw-r--r--drivers/usb/serial/mos7840.c16
-rw-r--r--drivers/usb/serial/option.c285
-rw-r--r--drivers/usb/serial/qcserial.c47
-rw-r--r--drivers/usb/serial/usb-wwan.h3
-rw-r--r--drivers/usb/serial/usb_wwan.c68
-rw-r--r--drivers/vhost/Kconfig3
-rw-r--r--drivers/vhost/Kconfig.tcm6
-rw-r--r--drivers/vhost/Makefile2
-rw-r--r--drivers/vhost/tcm_vhost.c1628
-rw-r--r--drivers/vhost/tcm_vhost.h101
-rw-r--r--drivers/w1/slaves/w1_therm.c9
-rw-r--r--drivers/w1/w1_family.h1
-rw-r--r--drivers/zorro/zorro.c2
-rw-r--r--fs/autofs4/expire.c36
-rw-r--r--fs/bio.c2
-rw-r--r--fs/btrfs/inode.c3
-rw-r--r--fs/btrfs/ioctl.c5
-rw-r--r--fs/btrfs/ordered-data.c2
-rw-r--r--fs/btrfs/super.c4
-rw-r--r--fs/btrfs/volumes.c4
-rw-r--r--fs/exofs/inode.c27
-rw-r--r--fs/exofs/ore.c14
-rw-r--r--fs/exofs/super.c11
-rw-r--r--fs/ext3/inode.c8
-rw-r--r--fs/ext3/super.c11
-rw-r--r--fs/ext4/balloc.c62
-rw-r--r--fs/ext4/bitmap.c1
-rw-r--r--fs/ext4/extents.c1
-rw-r--r--fs/ext4/inode.c10
-rw-r--r--fs/ext4/super.c17
-rw-r--r--fs/fuse/file.c15
-rw-r--r--fs/fuse/fuse_i.h3
-rw-r--r--fs/fuse/inode.c32
-rw-r--r--fs/gfs2/meta_io.c2
-rw-r--r--fs/hfs/mdb.c4
-rw-r--r--fs/jbd/journal.c4
-rw-r--r--fs/jbd2/journal.c7
-rw-r--r--fs/nilfs2/super.c4
-rw-r--r--fs/nilfs2/the_nilfs.h2
-rw-r--r--fs/open.c2
-rw-r--r--fs/super.c40
-rw-r--r--fs/ubifs/file.c10
-rw-r--r--fs/ubifs/super.c2
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/drm/drm_pciids.h3
-rw-r--r--include/drm/radeon_drm.h2
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h2
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h6
-rw-r--r--include/linux/can.h25
-rw-r--r--include/linux/fs.h3
-rw-r--r--include/linux/ftrace_event.h5
-rw-r--r--include/linux/fuse.h19
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/iio/frequency/adf4350.h2
-rw-r--r--include/linux/input/eeti_ts.h1
-rw-r--r--include/linux/iommu.h2
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/jiffies.h29
-rw-r--r--include/linux/kdb.h2
-rw-r--r--include/linux/mfd/ezx-pcap.h1
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/perf_event.h3
-rw-r--r--include/linux/sched.h8
-rw-r--r--include/linux/security.h2
-rw-r--r--include/linux/timex.h2
-rw-r--r--include/linux/topology.h1
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--include/net/codel.h8
-rw-r--r--include/net/dst.h2
-rw-r--r--include/net/inet_connection_sock.h1
-rw-r--r--include/net/inet_sock.h9
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/sock.h2
-rw-r--r--include/net/tcp.h1
-rw-r--r--include/net/xfrm.h4
-rw-r--r--include/trace/events/sched.h4
-rw-r--r--include/trace/ftrace.h6
-rw-r--r--kernel/debug/kdb/kdb_debugger.c4
-rw-r--r--kernel/debug/kdb/kdb_io.c11
-rw-r--r--kernel/debug/kdb/kdb_main.c15
-rw-r--r--kernel/events/callchain.c9
-rw-r--r--kernel/events/core.c30
-rw-r--r--kernel/events/internal.h3
-rw-r--r--kernel/futex.c17
-rw-r--r--kernel/irq/manage.c15
-rw-r--r--kernel/power/suspend.c3
-rw-r--r--kernel/printk.c2
-rw-r--r--kernel/sched/core.c4
-rw-r--r--kernel/sched/cpupri.c10
-rw-r--r--kernel/sched/fair.c29
-rw-r--r--kernel/time/jiffies.c2
-rw-r--r--kernel/time/ntp.c2
-rw-r--r--kernel/time/timekeeping.c407
-rw-r--r--kernel/trace/trace_event_perf.c2
-rw-r--r--kernel/trace/trace_kprobe.c6
-rw-r--r--kernel/trace/trace_syscalls.c4
-rw-r--r--kernel/trace/trace_uprobe.c2
-rw-r--r--kernel/watchdog.c21
-rw-r--r--mm/backing-dev.c52
-rw-r--r--mm/page-writeback.c1
-rw-r--r--net/batman-adv/gateway_client.c6
-rw-r--r--net/batman-adv/translation-table.c1
-rw-r--r--net/core/dev.c11
-rw-r--r--net/core/dst.c10
-rw-r--r--net/core/sock.c1
-rw-r--r--net/ipv4/fib_trie.c2
-rw-r--r--net/ipv4/ip_output.c8
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp.c4
-rw-r--r--net/ipv4/tcp_cong.c3
-rw-r--r--net/ipv4/tcp_input.c4
-rw-r--r--net/ipv4/tcp_ipv4.c14
-rw-r--r--net/ipv4/tcp_metrics.c12
-rw-r--r--net/ipv4/tcp_minisocks.c2
-rw-r--r--net/ipv4/tcp_output.c23
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/ipv6/tcp_ipv6.c28
-rw-r--r--net/llc/llc_station.c6
-rw-r--r--net/mac80211/mesh.c3
-rw-r--r--net/mac80211/mlme.c2
-rw-r--r--net/mac80211/scan.c3
-rw-r--r--net/packet/af_packet.c3
-rw-r--r--net/sched/act_gact.c14
-rw-r--r--net/sched/act_ipt.c7
-rw-r--r--net/sched/act_pedit.c5
-rw-r--r--net/sched/act_simple.c5
-rw-r--r--net/sched/sch_qfq.c95
-rw-r--r--net/wireless/core.c5
-rw-r--r--net/wireless/core.h1
-rw-r--r--net/wireless/reg.c19
-rw-r--r--net/wireless/util.c2
-rw-r--r--net/xfrm/xfrm_state.c21
-rwxr-xr-xscripts/decodecode2
-rwxr-xr-xscripts/kernel-doc1
-rw-r--r--security/yama/yama_lsm.c43
-rw-r--r--sound/core/sgbuf.c2
-rw-r--r--sound/pci/emu10k1/memory.c5
-rw-r--r--sound/pci/hda/hda_auto_parser.c5
-rw-r--r--sound/pci/hda/patch_conexant.c6
-rw-r--r--sound/pci/hda/patch_hdmi.c12
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/soc/codecs/ab8500-codec.c4
-rw-r--r--sound/soc/codecs/ad1980.c1
-rw-r--r--sound/soc/codecs/mc13783.c2
-rw-r--r--sound/soc/codecs/sgtl5000.c3
-rw-r--r--sound/soc/codecs/stac9766.c1
-rw-r--r--sound/soc/codecs/wm8962.c3
-rw-r--r--sound/soc/codecs/wm8994.c15
-rw-r--r--sound/soc/codecs/wm9712.c1
-rw-r--r--sound/soc/codecs/wm9713.c1
-rw-r--r--sound/soc/mxs/mxs-saif.c24
-rw-r--r--sound/soc/omap/omap-mcbsp.c1
-rw-r--r--sound/soc/omap/omap-pcm.c1
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/soc/tegra/tegra_alc5632.c2
-rw-r--r--sound/soc/tegra/tegra_wm8903.c10
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c2
-rw-r--r--sound/soc/ux500/ux500_msp_i2s.c2
-rw-r--r--sound/soc/ux500/ux500_msp_i2s.h2
-rw-r--r--tools/perf/Makefile7
-rw-r--r--tools/perf/builtin-record.c4
-rw-r--r--tools/perf/builtin-report.c5
-rw-r--r--tools/perf/builtin-test.c19
-rw-r--r--tools/perf/builtin-top.c23
-rw-r--r--tools/perf/util/event.h3
-rw-r--r--tools/perf/util/evlist.c7
-rw-r--r--tools/perf/util/evlist.h3
-rw-r--r--tools/perf/util/evsel.c15
-rw-r--r--tools/perf/util/evsel.h10
-rw-r--r--tools/perf/util/header.c9
-rw-r--r--tools/perf/util/intlist.c101
-rw-r--r--tools/perf/util/intlist.h75
-rw-r--r--tools/perf/util/parse-events-test.c12
-rw-r--r--tools/perf/util/parse-options.c3
-rw-r--r--tools/perf/util/python.c6
-rw-r--r--tools/perf/util/rblist.c107
-rw-r--r--tools/perf/util/rblist.h47
-rw-r--r--tools/perf/util/session.c48
-rw-r--r--tools/perf/util/session.h24
-rw-r--r--tools/perf/util/strlist.c130
-rw-r--r--tools/perf/util/strlist.h11
-rw-r--r--tools/perf/util/symbol.c14
-rw-r--r--tools/perf/util/target.c2
549 files changed, 5687 insertions, 3495 deletions
diff --git a/Documentation/DocBook/filesystems.tmpl b/Documentation/DocBook/filesystems.tmpl
index 3fca32c41927..25b58efd955d 100644
--- a/Documentation/DocBook/filesystems.tmpl
+++ b/Documentation/DocBook/filesystems.tmpl
@@ -224,8 +224,8 @@ all your transactions.
224</para> 224</para>
225 225
226<para> 226<para>
227Then at umount time , in your put_super() (2.4) or write_super() (2.5) 227Then at umount time , in your put_super() you can then call journal_destroy()
228you can then call journal_destroy() to clean up your in-core journal object. 228to clean up your in-core journal object.
229</para> 229</para>
230 230
231<para> 231<para>
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 0f103e39b4f6..e540a24e5d06 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -114,7 +114,6 @@ prototypes:
114 int (*drop_inode) (struct inode *); 114 int (*drop_inode) (struct inode *);
115 void (*evict_inode) (struct inode *); 115 void (*evict_inode) (struct inode *);
116 void (*put_super) (struct super_block *); 116 void (*put_super) (struct super_block *);
117 void (*write_super) (struct super_block *);
118 int (*sync_fs)(struct super_block *sb, int wait); 117 int (*sync_fs)(struct super_block *sb, int wait);
119 int (*freeze_fs) (struct super_block *); 118 int (*freeze_fs) (struct super_block *);
120 int (*unfreeze_fs) (struct super_block *); 119 int (*unfreeze_fs) (struct super_block *);
@@ -136,7 +135,6 @@ write_inode:
136drop_inode: !!!inode->i_lock!!! 135drop_inode: !!!inode->i_lock!!!
137evict_inode: 136evict_inode:
138put_super: write 137put_super: write
139write_super: read
140sync_fs: read 138sync_fs: read
141freeze_fs: write 139freeze_fs: write
142unfreeze_fs: write 140unfreeze_fs: write
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 2bef2b3843d1..0742feebc6e2 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -94,9 +94,8 @@ protected.
94--- 94---
95[mandatory] 95[mandatory]
96 96
97BKL is also moved from around sb operations. ->write_super() Is now called 97BKL is also moved from around sb operations. BKL should have been shifted into
98without BKL held. BKL should have been shifted into individual fs sb_op 98individual fs sb_op functions. If you don't need it, remove it.
99functions. If you don't need it, remove it.
100 99
101--- 100---
102[informational] 101[informational]
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 065aa2dc0835..2ee133e030c3 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -216,7 +216,6 @@ struct super_operations {
216 void (*drop_inode) (struct inode *); 216 void (*drop_inode) (struct inode *);
217 void (*delete_inode) (struct inode *); 217 void (*delete_inode) (struct inode *);
218 void (*put_super) (struct super_block *); 218 void (*put_super) (struct super_block *);
219 void (*write_super) (struct super_block *);
220 int (*sync_fs)(struct super_block *sb, int wait); 219 int (*sync_fs)(struct super_block *sb, int wait);
221 int (*freeze_fs) (struct super_block *); 220 int (*freeze_fs) (struct super_block *);
222 int (*unfreeze_fs) (struct super_block *); 221 int (*unfreeze_fs) (struct super_block *);
@@ -273,9 +272,6 @@ or bottom half).
273 put_super: called when the VFS wishes to free the superblock 272 put_super: called when the VFS wishes to free the superblock
274 (i.e. unmount). This is called with the superblock lock held 273 (i.e. unmount). This is called with the superblock lock held
275 274
276 write_super: called when the VFS superblock needs to be written to
277 disc. This method is optional
278
279 sync_fs: called when VFS is writing out all dirty data associated with 275 sync_fs: called when VFS is writing out all dirty data associated with
280 a superblock. The second parameter indicates whether the method 276 a superblock. The second parameter indicates whether the method
281 should wait until the write out has been completed. Optional. 277 should wait until the write out has been completed. Optional.
diff --git a/Documentation/laptops/laptop-mode.txt b/Documentation/laptops/laptop-mode.txt
index 0bf25eebce94..4ebbfc3f1c6e 100644
--- a/Documentation/laptops/laptop-mode.txt
+++ b/Documentation/laptops/laptop-mode.txt
@@ -262,9 +262,9 @@ MINIMUM_BATTERY_MINUTES=10
262 262
263# 263#
264# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been 264# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been
265# exceeded, the kernel will wake pdflush which will then reduce the amount 265# exceeded, the kernel will wake flusher threads which will then reduce the
266# of dirty memory to dirty_background_ratio. Set this nice and low, so once 266# amount of dirty memory to dirty_background_ratio. Set this nice and low,
267# some writeout has commenced, we do a lot of it. 267# so once some writeout has commenced, we do a lot of it.
268# 268#
269#DIRTY_BACKGROUND_RATIO=5 269#DIRTY_BACKGROUND_RATIO=5
270 270
@@ -384,9 +384,9 @@ CPU_MAXFREQ=${CPU_MAXFREQ:-'slowest'}
384 384
385# 385#
386# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been 386# Allowed dirty background ratio, in percent. Once DIRTY_RATIO has been
387# exceeded, the kernel will wake pdflush which will then reduce the amount 387# exceeded, the kernel will wake flusher threads which will then reduce the
388# of dirty memory to dirty_background_ratio. Set this nice and low, so once 388# amount of dirty memory to dirty_background_ratio. Set this nice and low,
389# some writeout has commenced, we do a lot of it. 389# so once some writeout has commenced, we do a lot of it.
390# 390#
391DIRTY_BACKGROUND_RATIO=${DIRTY_BACKGROUND_RATIO:-'5'} 391DIRTY_BACKGROUND_RATIO=${DIRTY_BACKGROUND_RATIO:-'5'}
392 392
diff --git a/Documentation/security/Yama.txt b/Documentation/security/Yama.txt
index e369de2d48cd..dd908cf64ecf 100644
--- a/Documentation/security/Yama.txt
+++ b/Documentation/security/Yama.txt
@@ -46,14 +46,13 @@ restrictions, it can call prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, ...)
46so that any otherwise allowed process (even those in external pid namespaces) 46so that any otherwise allowed process (even those in external pid namespaces)
47may attach. 47may attach.
48 48
49These restrictions do not change how ptrace via PTRACE_TRACEME operates. 49The sysctl settings (writable only with CAP_SYS_PTRACE) are:
50
51The sysctl settings are:
52 50
530 - classic ptrace permissions: a process can PTRACE_ATTACH to any other 510 - classic ptrace permissions: a process can PTRACE_ATTACH to any other
54 process running under the same uid, as long as it is dumpable (i.e. 52 process running under the same uid, as long as it is dumpable (i.e.
55 did not transition uids, start privileged, or have called 53 did not transition uids, start privileged, or have called
56 prctl(PR_SET_DUMPABLE...) already). 54 prctl(PR_SET_DUMPABLE...) already). Similarly, PTRACE_TRACEME is
55 unchanged.
57 56
581 - restricted ptrace: a process must have a predefined relationship 571 - restricted ptrace: a process must have a predefined relationship
59 with the inferior it wants to call PTRACE_ATTACH on. By default, 58 with the inferior it wants to call PTRACE_ATTACH on. By default,
@@ -61,12 +60,13 @@ The sysctl settings are:
61 classic criteria is also met. To change the relationship, an 60 classic criteria is also met. To change the relationship, an
62 inferior can call prctl(PR_SET_PTRACER, debugger, ...) to declare 61 inferior can call prctl(PR_SET_PTRACER, debugger, ...) to declare
63 an allowed debugger PID to call PTRACE_ATTACH on the inferior. 62 an allowed debugger PID to call PTRACE_ATTACH on the inferior.
63 Using PTRACE_TRACEME is unchanged.
64 64
652 - admin-only attach: only processes with CAP_SYS_PTRACE may use ptrace 652 - admin-only attach: only processes with CAP_SYS_PTRACE may use ptrace
66 with PTRACE_ATTACH. 66 with PTRACE_ATTACH, or through children calling PTRACE_TRACEME.
67 67
683 - no attach: no processes may use ptrace with PTRACE_ATTACH. Once set, 683 - no attach: no processes may use ptrace with PTRACE_ATTACH nor via
69 this sysctl cannot be changed to a lower value. 69 PTRACE_TRACEME. Once set, this sysctl value cannot be changed.
70 70
71The original children-only logic was based on the restrictions in grsecurity. 71The original children-only logic was based on the restrictions in grsecurity.
72 72
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index dcc2a94ae34e..078701fdbd4d 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -76,8 +76,8 @@ huge pages although processes will also directly compact memory as required.
76 76
77dirty_background_bytes 77dirty_background_bytes
78 78
79Contains the amount of dirty memory at which the pdflush background writeback 79Contains the amount of dirty memory at which the background kernel
80daemon will start writeback. 80flusher threads will start writeback.
81 81
82Note: dirty_background_bytes is the counterpart of dirty_background_ratio. Only 82Note: dirty_background_bytes is the counterpart of dirty_background_ratio. Only
83one of them may be specified at a time. When one sysctl is written it is 83one of them may be specified at a time. When one sysctl is written it is
@@ -89,7 +89,7 @@ other appears as 0 when read.
89dirty_background_ratio 89dirty_background_ratio
90 90
91Contains, as a percentage of total system memory, the number of pages at which 91Contains, as a percentage of total system memory, the number of pages at which
92the pdflush background writeback daemon will start writing out dirty data. 92the background kernel flusher threads will start writing out dirty data.
93 93
94============================================================== 94==============================================================
95 95
@@ -112,9 +112,9 @@ retained.
112dirty_expire_centisecs 112dirty_expire_centisecs
113 113
114This tunable is used to define when dirty data is old enough to be eligible 114This tunable is used to define when dirty data is old enough to be eligible
115for writeout by the pdflush daemons. It is expressed in 100'ths of a second. 115for writeout by the kernel flusher threads. It is expressed in 100'ths
116Data which has been dirty in-memory for longer than this interval will be 116of a second. Data which has been dirty in-memory for longer than this
117written out next time a pdflush daemon wakes up. 117interval will be written out next time a flusher thread wakes up.
118 118
119============================================================== 119==============================================================
120 120
@@ -128,7 +128,7 @@ data.
128 128
129dirty_writeback_centisecs 129dirty_writeback_centisecs
130 130
131The pdflush writeback daemons will periodically wake up and write `old' data 131The kernel flusher threads will periodically wake up and write `old' data
132out to disk. This tunable expresses the interval between those wakeups, in 132out to disk. This tunable expresses the interval between those wakeups, in
133100'ths of a second. 133100'ths of a second.
134 134
diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm
index 0403aaaba878..874a8ca93feb 100644
--- a/Documentation/w1/slaves/w1_therm
+++ b/Documentation/w1/slaves/w1_therm
@@ -3,6 +3,7 @@ Kernel driver w1_therm
3 3
4Supported chips: 4Supported chips:
5 * Maxim ds18*20 based temperature sensors. 5 * Maxim ds18*20 based temperature sensors.
6 * Maxim ds1825 based temperature sensors.
6 7
7Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru> 8Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
8 9
@@ -15,6 +16,7 @@ supported family codes:
15W1_THERM_DS18S20 0x10 16W1_THERM_DS18S20 0x10
16W1_THERM_DS1822 0x22 17W1_THERM_DS1822 0x22
17W1_THERM_DS18B20 0x28 18W1_THERM_DS18B20 0x28
19W1_THERM_DS1825 0x3B
18 20
19Support is provided through the sysfs w1_slave file. Each open and 21Support is provided through the sysfs w1_slave file. Each open and
20read sequence will initiate a temperature conversion then provide two 22read sequence will initiate a temperature conversion then provide two
diff --git a/MAINTAINERS b/MAINTAINERS
index 94b823f71e94..3aed8325a902 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -827,24 +827,24 @@ F: arch/arm/mach-pxa/colibri-pxa270-income.c
827 827
828ARM/INTEL IOP32X ARM ARCHITECTURE 828ARM/INTEL IOP32X ARM ARCHITECTURE
829M: Lennert Buytenhek <kernel@wantstofly.org> 829M: Lennert Buytenhek <kernel@wantstofly.org>
830M: Dan Williams <dan.j.williams@intel.com> 830M: Dan Williams <djbw@fb.com>
831L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 831L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
832S: Maintained 832S: Maintained
833 833
834ARM/INTEL IOP33X ARM ARCHITECTURE 834ARM/INTEL IOP33X ARM ARCHITECTURE
835M: Dan Williams <dan.j.williams@intel.com> 835M: Dan Williams <djbw@fb.com>
836L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 836L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
837S: Maintained 837S: Maintained
838 838
839ARM/INTEL IOP13XX ARM ARCHITECTURE 839ARM/INTEL IOP13XX ARM ARCHITECTURE
840M: Lennert Buytenhek <kernel@wantstofly.org> 840M: Lennert Buytenhek <kernel@wantstofly.org>
841M: Dan Williams <dan.j.williams@intel.com> 841M: Dan Williams <djbw@fb.com>
842L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 842L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
843S: Maintained 843S: Maintained
844 844
845ARM/INTEL IQ81342EX MACHINE SUPPORT 845ARM/INTEL IQ81342EX MACHINE SUPPORT
846M: Lennert Buytenhek <kernel@wantstofly.org> 846M: Lennert Buytenhek <kernel@wantstofly.org>
847M: Dan Williams <dan.j.williams@intel.com> 847M: Dan Williams <djbw@fb.com>
848L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 848L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
849S: Maintained 849S: Maintained
850 850
@@ -869,7 +869,7 @@ F: drivers/pcmcia/pxa2xx_stargate2.c
869 869
870ARM/INTEL XSC3 (MANZANO) ARM CORE 870ARM/INTEL XSC3 (MANZANO) ARM CORE
871M: Lennert Buytenhek <kernel@wantstofly.org> 871M: Lennert Buytenhek <kernel@wantstofly.org>
872M: Dan Williams <dan.j.williams@intel.com> 872M: Dan Williams <djbw@fb.com>
873L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 873L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
874S: Maintained 874S: Maintained
875 875
@@ -925,14 +925,14 @@ S: Maintained
925 925
926ARM/NOMADIK ARCHITECTURE 926ARM/NOMADIK ARCHITECTURE
927M: Alessandro Rubini <rubini@unipv.it> 927M: Alessandro Rubini <rubini@unipv.it>
928M: Linus Walleij <linus.walleij@stericsson.com> 928M: Linus Walleij <linus.walleij@linaro.org>
929M: STEricsson <STEricsson_nomadik_linux@list.st.com> 929M: STEricsson <STEricsson_nomadik_linux@list.st.com>
930L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 930L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
931S: Maintained 931S: Maintained
932F: arch/arm/mach-nomadik/ 932F: arch/arm/mach-nomadik/
933F: arch/arm/plat-nomadik/ 933F: arch/arm/plat-nomadik/
934F: drivers/i2c/busses/i2c-nomadik.c 934F: drivers/i2c/busses/i2c-nomadik.c
935T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git 935T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
936 936
937ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT 937ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT
938M: Nelson Castillo <arhuaco@freaks-unidos.net> 938M: Nelson Castillo <arhuaco@freaks-unidos.net>
@@ -1146,7 +1146,7 @@ F: drivers/usb/host/ehci-w90x900.c
1146F: drivers/video/nuc900fb.c 1146F: drivers/video/nuc900fb.c
1147 1147
1148ARM/U300 MACHINE SUPPORT 1148ARM/U300 MACHINE SUPPORT
1149M: Linus Walleij <linus.walleij@stericsson.com> 1149M: Linus Walleij <linus.walleij@linaro.org>
1150L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1150L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1151S: Supported 1151S: Supported
1152F: arch/arm/mach-u300/ 1152F: arch/arm/mach-u300/
@@ -1161,15 +1161,20 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
1161 1161
1162ARM/Ux500 ARM ARCHITECTURE 1162ARM/Ux500 ARM ARCHITECTURE
1163M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> 1163M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
1164M: Linus Walleij <linus.walleij@stericsson.com> 1164M: Linus Walleij <linus.walleij@linaro.org>
1165L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1165L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1166S: Maintained 1166S: Maintained
1167F: arch/arm/mach-ux500/ 1167F: arch/arm/mach-ux500/
1168F: drivers/clocksource/clksrc-dbx500-prcmu.c
1168F: drivers/dma/ste_dma40* 1169F: drivers/dma/ste_dma40*
1170F: drivers/hwspinlock/u8500_hsem.c
1169F: drivers/mfd/abx500* 1171F: drivers/mfd/abx500*
1170F: drivers/mfd/ab8500* 1172F: drivers/mfd/ab8500*
1171F: drivers/mfd/stmpe* 1173F: drivers/mfd/dbx500*
1174F: drivers/mfd/db8500*
1175F: drivers/pinctrl/pinctrl-nomadik*
1172F: drivers/rtc/rtc-ab8500.c 1176F: drivers/rtc/rtc-ab8500.c
1177F: drivers/rtc/rtc-pl031.c
1173T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git 1178T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
1174 1179
1175ARM/VFP SUPPORT 1180ARM/VFP SUPPORT
@@ -1227,9 +1232,9 @@ S: Maintained
1227F: drivers/hwmon/asb100.c 1232F: drivers/hwmon/asb100.c
1228 1233
1229ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API 1234ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
1230M: Dan Williams <dan.j.williams@intel.com> 1235M: Dan Williams <djbw@fb.com>
1231W: http://sourceforge.net/projects/xscaleiop 1236W: http://sourceforge.net/projects/xscaleiop
1232S: Supported 1237S: Maintained
1233F: Documentation/crypto/async-tx-api.txt 1238F: Documentation/crypto/async-tx-api.txt
1234F: crypto/async_tx/ 1239F: crypto/async_tx/
1235F: drivers/dma/ 1240F: drivers/dma/
@@ -2212,7 +2217,7 @@ S: Maintained
2212F: drivers/scsi/tmscsim.* 2217F: drivers/scsi/tmscsim.*
2213 2218
2214DC395x SCSI driver 2219DC395x SCSI driver
2215M: Oliver Neukum <oliver@neukum.name> 2220M: Oliver Neukum <oliver@neukum.org>
2216M: Ali Akcaagac <aliakc@web.de> 2221M: Ali Akcaagac <aliakc@web.de>
2217M: Jamie Lenehan <lenehan@twibble.org> 2222M: Jamie Lenehan <lenehan@twibble.org>
2218W: http://twibble.org/dist/dc395x/ 2223W: http://twibble.org/dist/dc395x/
@@ -2359,7 +2364,7 @@ T: git git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git
2359 2364
2360DMA GENERIC OFFLOAD ENGINE SUBSYSTEM 2365DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
2361M: Vinod Koul <vinod.koul@intel.com> 2366M: Vinod Koul <vinod.koul@intel.com>
2362M: Dan Williams <dan.j.williams@intel.com> 2367M: Dan Williams <djbw@fb.com>
2363S: Supported 2368S: Supported
2364F: drivers/dma/ 2369F: drivers/dma/
2365F: include/linux/dma* 2370F: include/linux/dma*
@@ -3094,7 +3099,7 @@ F: include/linux/gigaset_dev.h
3094 3099
3095GPIO SUBSYSTEM 3100GPIO SUBSYSTEM
3096M: Grant Likely <grant.likely@secretlab.ca> 3101M: Grant Likely <grant.likely@secretlab.ca>
3097M: Linus Walleij <linus.walleij@stericsson.com> 3102M: Linus Walleij <linus.walleij@linaro.org>
3098S: Maintained 3103S: Maintained
3099T: git git://git.secretlab.ca/git/linux-2.6.git 3104T: git git://git.secretlab.ca/git/linux-2.6.git
3100F: Documentation/gpio.txt 3105F: Documentation/gpio.txt
@@ -3547,7 +3552,6 @@ K: \b(ABS|SYN)_MT_
3547 3552
3548INTEL C600 SERIES SAS CONTROLLER DRIVER 3553INTEL C600 SERIES SAS CONTROLLER DRIVER
3549M: Intel SCU Linux support <intel-linux-scu@intel.com> 3554M: Intel SCU Linux support <intel-linux-scu@intel.com>
3550M: Dan Williams <dan.j.williams@intel.com>
3551M: Dave Jiang <dave.jiang@intel.com> 3555M: Dave Jiang <dave.jiang@intel.com>
3552M: Ed Nadolski <edmund.nadolski@intel.com> 3556M: Ed Nadolski <edmund.nadolski@intel.com>
3553L: linux-scsi@vger.kernel.org 3557L: linux-scsi@vger.kernel.org
@@ -3590,8 +3594,8 @@ F: arch/x86/kernel/microcode_core.c
3590F: arch/x86/kernel/microcode_intel.c 3594F: arch/x86/kernel/microcode_intel.c
3591 3595
3592INTEL I/OAT DMA DRIVER 3596INTEL I/OAT DMA DRIVER
3593M: Dan Williams <dan.j.williams@intel.com> 3597M: Dan Williams <djbw@fb.com>
3594S: Supported 3598S: Maintained
3595F: drivers/dma/ioat* 3599F: drivers/dma/ioat*
3596 3600
3597INTEL IOMMU (VT-d) 3601INTEL IOMMU (VT-d)
@@ -3603,8 +3607,8 @@ F: drivers/iommu/intel-iommu.c
3603F: include/linux/intel-iommu.h 3607F: include/linux/intel-iommu.h
3604 3608
3605INTEL IOP-ADMA DMA DRIVER 3609INTEL IOP-ADMA DMA DRIVER
3606M: Dan Williams <dan.j.williams@intel.com> 3610M: Dan Williams <djbw@fb.com>
3607S: Maintained 3611S: Odd fixes
3608F: drivers/dma/iop-adma.c 3612F: drivers/dma/iop-adma.c
3609 3613
3610INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT 3614INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT
@@ -4533,7 +4537,7 @@ S: Supported
4533F: arch/microblaze/ 4537F: arch/microblaze/
4534 4538
4535MICROTEK X6 SCANNER 4539MICROTEK X6 SCANNER
4536M: Oliver Neukum <oliver@neukum.name> 4540M: Oliver Neukum <oliver@neukum.org>
4537S: Maintained 4541S: Maintained
4538F: drivers/usb/image/microtek.* 4542F: drivers/usb/image/microtek.*
4539 4543
@@ -5329,14 +5333,15 @@ PIN CONTROL SUBSYSTEM
5329M: Linus Walleij <linus.walleij@linaro.org> 5333M: Linus Walleij <linus.walleij@linaro.org>
5330S: Maintained 5334S: Maintained
5331F: drivers/pinctrl/ 5335F: drivers/pinctrl/
5336F: include/linux/pinctrl/
5332 5337
5333PIN CONTROLLER - ST SPEAR 5338PIN CONTROLLER - ST SPEAR
5334M: Viresh Kumar <viresh.linux@gmail.com> 5339M: Viresh Kumar <viresh.linux@gmail.com>
5335L: spear-devel@list.st.com 5340L: spear-devel@list.st.com
5336L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 5341L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
5337W: http://www.st.com/spear 5342W: http://www.st.com/spear
5338S: Maintained 5343S: Maintained
5339F: driver/pinctrl/spear/ 5344F: drivers/pinctrl/spear/
5340 5345
5341PKTCDVD DRIVER 5346PKTCDVD DRIVER
5342M: Peter Osterlund <petero2@telia.com> 5347M: Peter Osterlund <petero2@telia.com>
@@ -7071,7 +7076,7 @@ F: include/linux/mtd/ubi.h
7071F: include/mtd/ubi-user.h 7076F: include/mtd/ubi-user.h
7072 7077
7073USB ACM DRIVER 7078USB ACM DRIVER
7074M: Oliver Neukum <oliver@neukum.name> 7079M: Oliver Neukum <oliver@neukum.org>
7075L: linux-usb@vger.kernel.org 7080L: linux-usb@vger.kernel.org
7076S: Maintained 7081S: Maintained
7077F: Documentation/usb/acm.txt 7082F: Documentation/usb/acm.txt
@@ -7092,7 +7097,7 @@ S: Supported
7092F: drivers/block/ub.c 7097F: drivers/block/ub.c
7093 7098
7094USB CDC ETHERNET DRIVER 7099USB CDC ETHERNET DRIVER
7095M: Oliver Neukum <oliver@neukum.name> 7100M: Oliver Neukum <oliver@neukum.org>
7096L: linux-usb@vger.kernel.org 7101L: linux-usb@vger.kernel.org
7097S: Maintained 7102S: Maintained
7098F: drivers/net/usb/cdc_*.c 7103F: drivers/net/usb/cdc_*.c
@@ -7165,7 +7170,7 @@ F: drivers/usb/host/isp116x*
7165F: include/linux/usb/isp116x.h 7170F: include/linux/usb/isp116x.h
7166 7171
7167USB KAWASAKI LSI DRIVER 7172USB KAWASAKI LSI DRIVER
7168M: Oliver Neukum <oliver@neukum.name> 7173M: Oliver Neukum <oliver@neukum.org>
7169L: linux-usb@vger.kernel.org 7174L: linux-usb@vger.kernel.org
7170S: Maintained 7175S: Maintained
7171F: drivers/usb/serial/kl5kusb105.* 7176F: drivers/usb/serial/kl5kusb105.*
diff --git a/Makefile b/Makefile
index ddf5be952e45..9cc77acfc881 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Saber-toothed Squirrel 5NAME = Saber-toothed Squirrel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index a874dbfb5ae6..e6138310e5ce 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -51,11 +51,11 @@
51 51
52 dma-apbh@80004000 { 52 dma-apbh@80004000 {
53 compatible = "fsl,imx23-dma-apbh"; 53 compatible = "fsl,imx23-dma-apbh";
54 reg = <0x80004000 2000>; 54 reg = <0x80004000 0x2000>;
55 }; 55 };
56 56
57 ecc@80008000 { 57 ecc@80008000 {
58 reg = <0x80008000 2000>; 58 reg = <0x80008000 0x2000>;
59 status = "disabled"; 59 status = "disabled";
60 }; 60 };
61 61
@@ -63,7 +63,7 @@
63 compatible = "fsl,imx23-gpmi-nand"; 63 compatible = "fsl,imx23-gpmi-nand";
64 #address-cells = <1>; 64 #address-cells = <1>;
65 #size-cells = <1>; 65 #size-cells = <1>;
66 reg = <0x8000c000 2000>, <0x8000a000 2000>; 66 reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
67 reg-names = "gpmi-nand", "bch"; 67 reg-names = "gpmi-nand", "bch";
68 interrupts = <13>, <56>; 68 interrupts = <13>, <56>;
69 interrupt-names = "gpmi-dma", "bch"; 69 interrupt-names = "gpmi-dma", "bch";
@@ -72,14 +72,14 @@
72 }; 72 };
73 73
74 ssp0: ssp@80010000 { 74 ssp0: ssp@80010000 {
75 reg = <0x80010000 2000>; 75 reg = <0x80010000 0x2000>;
76 interrupts = <15 14>; 76 interrupts = <15 14>;
77 fsl,ssp-dma-channel = <1>; 77 fsl,ssp-dma-channel = <1>;
78 status = "disabled"; 78 status = "disabled";
79 }; 79 };
80 80
81 etm@80014000 { 81 etm@80014000 {
82 reg = <0x80014000 2000>; 82 reg = <0x80014000 0x2000>;
83 status = "disabled"; 83 status = "disabled";
84 }; 84 };
85 85
@@ -87,7 +87,7 @@
87 #address-cells = <1>; 87 #address-cells = <1>;
88 #size-cells = <0>; 88 #size-cells = <0>;
89 compatible = "fsl,imx23-pinctrl", "simple-bus"; 89 compatible = "fsl,imx23-pinctrl", "simple-bus";
90 reg = <0x80018000 2000>; 90 reg = <0x80018000 0x2000>;
91 91
92 gpio0: gpio@0 { 92 gpio0: gpio@0 {
93 compatible = "fsl,imx23-gpio", "fsl,mxs-gpio"; 93 compatible = "fsl,imx23-gpio", "fsl,mxs-gpio";
@@ -273,32 +273,32 @@
273 }; 273 };
274 274
275 emi@80020000 { 275 emi@80020000 {
276 reg = <0x80020000 2000>; 276 reg = <0x80020000 0x2000>;
277 status = "disabled"; 277 status = "disabled";
278 }; 278 };
279 279
280 dma-apbx@80024000 { 280 dma-apbx@80024000 {
281 compatible = "fsl,imx23-dma-apbx"; 281 compatible = "fsl,imx23-dma-apbx";
282 reg = <0x80024000 2000>; 282 reg = <0x80024000 0x2000>;
283 }; 283 };
284 284
285 dcp@80028000 { 285 dcp@80028000 {
286 reg = <0x80028000 2000>; 286 reg = <0x80028000 0x2000>;
287 status = "disabled"; 287 status = "disabled";
288 }; 288 };
289 289
290 pxp@8002a000 { 290 pxp@8002a000 {
291 reg = <0x8002a000 2000>; 291 reg = <0x8002a000 0x2000>;
292 status = "disabled"; 292 status = "disabled";
293 }; 293 };
294 294
295 ocotp@8002c000 { 295 ocotp@8002c000 {
296 reg = <0x8002c000 2000>; 296 reg = <0x8002c000 0x2000>;
297 status = "disabled"; 297 status = "disabled";
298 }; 298 };
299 299
300 axi-ahb@8002e000 { 300 axi-ahb@8002e000 {
301 reg = <0x8002e000 2000>; 301 reg = <0x8002e000 0x2000>;
302 status = "disabled"; 302 status = "disabled";
303 }; 303 };
304 304
@@ -310,14 +310,14 @@
310 }; 310 };
311 311
312 ssp1: ssp@80034000 { 312 ssp1: ssp@80034000 {
313 reg = <0x80034000 2000>; 313 reg = <0x80034000 0x2000>;
314 interrupts = <2 20>; 314 interrupts = <2 20>;
315 fsl,ssp-dma-channel = <2>; 315 fsl,ssp-dma-channel = <2>;
316 status = "disabled"; 316 status = "disabled";
317 }; 317 };
318 318
319 tvenc@80038000 { 319 tvenc@80038000 {
320 reg = <0x80038000 2000>; 320 reg = <0x80038000 0x2000>;
321 status = "disabled"; 321 status = "disabled";
322 }; 322 };
323 }; 323 };
@@ -330,37 +330,37 @@
330 ranges; 330 ranges;
331 331
332 clkctl@80040000 { 332 clkctl@80040000 {
333 reg = <0x80040000 2000>; 333 reg = <0x80040000 0x2000>;
334 status = "disabled"; 334 status = "disabled";
335 }; 335 };
336 336
337 saif0: saif@80042000 { 337 saif0: saif@80042000 {
338 reg = <0x80042000 2000>; 338 reg = <0x80042000 0x2000>;
339 status = "disabled"; 339 status = "disabled";
340 }; 340 };
341 341
342 power@80044000 { 342 power@80044000 {
343 reg = <0x80044000 2000>; 343 reg = <0x80044000 0x2000>;
344 status = "disabled"; 344 status = "disabled";
345 }; 345 };
346 346
347 saif1: saif@80046000 { 347 saif1: saif@80046000 {
348 reg = <0x80046000 2000>; 348 reg = <0x80046000 0x2000>;
349 status = "disabled"; 349 status = "disabled";
350 }; 350 };
351 351
352 audio-out@80048000 { 352 audio-out@80048000 {
353 reg = <0x80048000 2000>; 353 reg = <0x80048000 0x2000>;
354 status = "disabled"; 354 status = "disabled";
355 }; 355 };
356 356
357 audio-in@8004c000 { 357 audio-in@8004c000 {
358 reg = <0x8004c000 2000>; 358 reg = <0x8004c000 0x2000>;
359 status = "disabled"; 359 status = "disabled";
360 }; 360 };
361 361
362 lradc@80050000 { 362 lradc@80050000 {
363 reg = <0x80050000 2000>; 363 reg = <0x80050000 0x2000>;
364 status = "disabled"; 364 status = "disabled";
365 }; 365 };
366 366
@@ -370,26 +370,26 @@
370 }; 370 };
371 371
372 i2c@80058000 { 372 i2c@80058000 {
373 reg = <0x80058000 2000>; 373 reg = <0x80058000 0x2000>;
374 status = "disabled"; 374 status = "disabled";
375 }; 375 };
376 376
377 rtc@8005c000 { 377 rtc@8005c000 {
378 compatible = "fsl,imx23-rtc", "fsl,stmp3xxx-rtc"; 378 compatible = "fsl,imx23-rtc", "fsl,stmp3xxx-rtc";
379 reg = <0x8005c000 2000>; 379 reg = <0x8005c000 0x2000>;
380 interrupts = <22>; 380 interrupts = <22>;
381 }; 381 };
382 382
383 pwm: pwm@80064000 { 383 pwm: pwm@80064000 {
384 compatible = "fsl,imx23-pwm"; 384 compatible = "fsl,imx23-pwm";
385 reg = <0x80064000 2000>; 385 reg = <0x80064000 0x2000>;
386 #pwm-cells = <2>; 386 #pwm-cells = <2>;
387 fsl,pwm-number = <5>; 387 fsl,pwm-number = <5>;
388 status = "disabled"; 388 status = "disabled";
389 }; 389 };
390 390
391 timrot@80068000 { 391 timrot@80068000 {
392 reg = <0x80068000 2000>; 392 reg = <0x80068000 0x2000>;
393 status = "disabled"; 393 status = "disabled";
394 }; 394 };
395 395
@@ -429,7 +429,7 @@
429 ranges; 429 ranges;
430 430
431 usbctrl@80080000 { 431 usbctrl@80080000 {
432 reg = <0x80080000 0x10000>; 432 reg = <0x80080000 0x40000>;
433 status = "disabled"; 433 status = "disabled";
434 }; 434 };
435 }; 435 };
diff --git a/arch/arm/boot/dts/imx27-3ds.dts b/arch/arm/boot/dts/imx27-3ds.dts
index d3f8296e19e0..0a8978a40ece 100644
--- a/arch/arm/boot/dts/imx27-3ds.dts
+++ b/arch/arm/boot/dts/imx27-3ds.dts
@@ -27,7 +27,7 @@
27 status = "okay"; 27 status = "okay";
28 }; 28 };
29 29
30 uart@1000a000 { 30 uart1: serial@1000a000 {
31 fsl,uart-has-rtscts; 31 fsl,uart-has-rtscts;
32 status = "okay"; 32 status = "okay";
33 }; 33 };
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 00bae3aad5ab..5303ab680a34 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -19,6 +19,12 @@
19 serial3 = &uart4; 19 serial3 = &uart4;
20 serial4 = &uart5; 20 serial4 = &uart5;
21 serial5 = &uart6; 21 serial5 = &uart6;
22 gpio0 = &gpio1;
23 gpio1 = &gpio2;
24 gpio2 = &gpio3;
25 gpio3 = &gpio4;
26 gpio4 = &gpio5;
27 gpio5 = &gpio6;
22 }; 28 };
23 29
24 avic: avic-interrupt-controller@e0000000 { 30 avic: avic-interrupt-controller@e0000000 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 787efac68da8..3fa6d190fab4 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -57,18 +57,18 @@
57 }; 57 };
58 58
59 hsadc@80002000 { 59 hsadc@80002000 {
60 reg = <0x80002000 2000>; 60 reg = <0x80002000 0x2000>;
61 interrupts = <13 87>; 61 interrupts = <13 87>;
62 status = "disabled"; 62 status = "disabled";
63 }; 63 };
64 64
65 dma-apbh@80004000 { 65 dma-apbh@80004000 {
66 compatible = "fsl,imx28-dma-apbh"; 66 compatible = "fsl,imx28-dma-apbh";
67 reg = <0x80004000 2000>; 67 reg = <0x80004000 0x2000>;
68 }; 68 };
69 69
70 perfmon@80006000 { 70 perfmon@80006000 {
71 reg = <0x80006000 800>; 71 reg = <0x80006000 0x800>;
72 interrupts = <27>; 72 interrupts = <27>;
73 status = "disabled"; 73 status = "disabled";
74 }; 74 };
@@ -77,7 +77,7 @@
77 compatible = "fsl,imx28-gpmi-nand"; 77 compatible = "fsl,imx28-gpmi-nand";
78 #address-cells = <1>; 78 #address-cells = <1>;
79 #size-cells = <1>; 79 #size-cells = <1>;
80 reg = <0x8000c000 2000>, <0x8000a000 2000>; 80 reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
81 reg-names = "gpmi-nand", "bch"; 81 reg-names = "gpmi-nand", "bch";
82 interrupts = <88>, <41>; 82 interrupts = <88>, <41>;
83 interrupt-names = "gpmi-dma", "bch"; 83 interrupt-names = "gpmi-dma", "bch";
@@ -86,28 +86,28 @@
86 }; 86 };
87 87
88 ssp0: ssp@80010000 { 88 ssp0: ssp@80010000 {
89 reg = <0x80010000 2000>; 89 reg = <0x80010000 0x2000>;
90 interrupts = <96 82>; 90 interrupts = <96 82>;
91 fsl,ssp-dma-channel = <0>; 91 fsl,ssp-dma-channel = <0>;
92 status = "disabled"; 92 status = "disabled";
93 }; 93 };
94 94
95 ssp1: ssp@80012000 { 95 ssp1: ssp@80012000 {
96 reg = <0x80012000 2000>; 96 reg = <0x80012000 0x2000>;
97 interrupts = <97 83>; 97 interrupts = <97 83>;
98 fsl,ssp-dma-channel = <1>; 98 fsl,ssp-dma-channel = <1>;
99 status = "disabled"; 99 status = "disabled";
100 }; 100 };
101 101
102 ssp2: ssp@80014000 { 102 ssp2: ssp@80014000 {
103 reg = <0x80014000 2000>; 103 reg = <0x80014000 0x2000>;
104 interrupts = <98 84>; 104 interrupts = <98 84>;
105 fsl,ssp-dma-channel = <2>; 105 fsl,ssp-dma-channel = <2>;
106 status = "disabled"; 106 status = "disabled";
107 }; 107 };
108 108
109 ssp3: ssp@80016000 { 109 ssp3: ssp@80016000 {
110 reg = <0x80016000 2000>; 110 reg = <0x80016000 0x2000>;
111 interrupts = <99 85>; 111 interrupts = <99 85>;
112 fsl,ssp-dma-channel = <3>; 112 fsl,ssp-dma-channel = <3>;
113 status = "disabled"; 113 status = "disabled";
@@ -117,7 +117,7 @@
117 #address-cells = <1>; 117 #address-cells = <1>;
118 #size-cells = <0>; 118 #size-cells = <0>;
119 compatible = "fsl,imx28-pinctrl", "simple-bus"; 119 compatible = "fsl,imx28-pinctrl", "simple-bus";
120 reg = <0x80018000 2000>; 120 reg = <0x80018000 0x2000>;
121 121
122 gpio0: gpio@0 { 122 gpio0: gpio@0 {
123 compatible = "fsl,imx28-gpio", "fsl,mxs-gpio"; 123 compatible = "fsl,imx28-gpio", "fsl,mxs-gpio";
@@ -510,96 +510,96 @@
510 }; 510 };
511 511
512 digctl@8001c000 { 512 digctl@8001c000 {
513 reg = <0x8001c000 2000>; 513 reg = <0x8001c000 0x2000>;
514 interrupts = <89>; 514 interrupts = <89>;
515 status = "disabled"; 515 status = "disabled";
516 }; 516 };
517 517
518 etm@80022000 { 518 etm@80022000 {
519 reg = <0x80022000 2000>; 519 reg = <0x80022000 0x2000>;
520 status = "disabled"; 520 status = "disabled";
521 }; 521 };
522 522
523 dma-apbx@80024000 { 523 dma-apbx@80024000 {
524 compatible = "fsl,imx28-dma-apbx"; 524 compatible = "fsl,imx28-dma-apbx";
525 reg = <0x80024000 2000>; 525 reg = <0x80024000 0x2000>;
526 }; 526 };
527 527
528 dcp@80028000 { 528 dcp@80028000 {
529 reg = <0x80028000 2000>; 529 reg = <0x80028000 0x2000>;
530 interrupts = <52 53 54>; 530 interrupts = <52 53 54>;
531 status = "disabled"; 531 status = "disabled";
532 }; 532 };
533 533
534 pxp@8002a000 { 534 pxp@8002a000 {
535 reg = <0x8002a000 2000>; 535 reg = <0x8002a000 0x2000>;
536 interrupts = <39>; 536 interrupts = <39>;
537 status = "disabled"; 537 status = "disabled";
538 }; 538 };
539 539
540 ocotp@8002c000 { 540 ocotp@8002c000 {
541 reg = <0x8002c000 2000>; 541 reg = <0x8002c000 0x2000>;
542 status = "disabled"; 542 status = "disabled";
543 }; 543 };
544 544
545 axi-ahb@8002e000 { 545 axi-ahb@8002e000 {
546 reg = <0x8002e000 2000>; 546 reg = <0x8002e000 0x2000>;
547 status = "disabled"; 547 status = "disabled";
548 }; 548 };
549 549
550 lcdif@80030000 { 550 lcdif@80030000 {
551 compatible = "fsl,imx28-lcdif"; 551 compatible = "fsl,imx28-lcdif";
552 reg = <0x80030000 2000>; 552 reg = <0x80030000 0x2000>;
553 interrupts = <38 86>; 553 interrupts = <38 86>;
554 status = "disabled"; 554 status = "disabled";
555 }; 555 };
556 556
557 can0: can@80032000 { 557 can0: can@80032000 {
558 compatible = "fsl,imx28-flexcan", "fsl,p1010-flexcan"; 558 compatible = "fsl,imx28-flexcan", "fsl,p1010-flexcan";
559 reg = <0x80032000 2000>; 559 reg = <0x80032000 0x2000>;
560 interrupts = <8>; 560 interrupts = <8>;
561 status = "disabled"; 561 status = "disabled";
562 }; 562 };
563 563
564 can1: can@80034000 { 564 can1: can@80034000 {
565 compatible = "fsl,imx28-flexcan", "fsl,p1010-flexcan"; 565 compatible = "fsl,imx28-flexcan", "fsl,p1010-flexcan";
566 reg = <0x80034000 2000>; 566 reg = <0x80034000 0x2000>;
567 interrupts = <9>; 567 interrupts = <9>;
568 status = "disabled"; 568 status = "disabled";
569 }; 569 };
570 570
571 simdbg@8003c000 { 571 simdbg@8003c000 {
572 reg = <0x8003c000 200>; 572 reg = <0x8003c000 0x200>;
573 status = "disabled"; 573 status = "disabled";
574 }; 574 };
575 575
576 simgpmisel@8003c200 { 576 simgpmisel@8003c200 {
577 reg = <0x8003c200 100>; 577 reg = <0x8003c200 0x100>;
578 status = "disabled"; 578 status = "disabled";
579 }; 579 };
580 580
581 simsspsel@8003c300 { 581 simsspsel@8003c300 {
582 reg = <0x8003c300 100>; 582 reg = <0x8003c300 0x100>;
583 status = "disabled"; 583 status = "disabled";
584 }; 584 };
585 585
586 simmemsel@8003c400 { 586 simmemsel@8003c400 {
587 reg = <0x8003c400 100>; 587 reg = <0x8003c400 0x100>;
588 status = "disabled"; 588 status = "disabled";
589 }; 589 };
590 590
591 gpiomon@8003c500 { 591 gpiomon@8003c500 {
592 reg = <0x8003c500 100>; 592 reg = <0x8003c500 0x100>;
593 status = "disabled"; 593 status = "disabled";
594 }; 594 };
595 595
596 simenet@8003c700 { 596 simenet@8003c700 {
597 reg = <0x8003c700 100>; 597 reg = <0x8003c700 0x100>;
598 status = "disabled"; 598 status = "disabled";
599 }; 599 };
600 600
601 armjtag@8003c800 { 601 armjtag@8003c800 {
602 reg = <0x8003c800 100>; 602 reg = <0x8003c800 0x100>;
603 status = "disabled"; 603 status = "disabled";
604 }; 604 };
605 }; 605 };
@@ -612,45 +612,45 @@
612 ranges; 612 ranges;
613 613
614 clkctl@80040000 { 614 clkctl@80040000 {
615 reg = <0x80040000 2000>; 615 reg = <0x80040000 0x2000>;
616 status = "disabled"; 616 status = "disabled";
617 }; 617 };
618 618
619 saif0: saif@80042000 { 619 saif0: saif@80042000 {
620 compatible = "fsl,imx28-saif"; 620 compatible = "fsl,imx28-saif";
621 reg = <0x80042000 2000>; 621 reg = <0x80042000 0x2000>;
622 interrupts = <59 80>; 622 interrupts = <59 80>;
623 fsl,saif-dma-channel = <4>; 623 fsl,saif-dma-channel = <4>;
624 status = "disabled"; 624 status = "disabled";
625 }; 625 };
626 626
627 power@80044000 { 627 power@80044000 {
628 reg = <0x80044000 2000>; 628 reg = <0x80044000 0x2000>;
629 status = "disabled"; 629 status = "disabled";
630 }; 630 };
631 631
632 saif1: saif@80046000 { 632 saif1: saif@80046000 {
633 compatible = "fsl,imx28-saif"; 633 compatible = "fsl,imx28-saif";
634 reg = <0x80046000 2000>; 634 reg = <0x80046000 0x2000>;
635 interrupts = <58 81>; 635 interrupts = <58 81>;
636 fsl,saif-dma-channel = <5>; 636 fsl,saif-dma-channel = <5>;
637 status = "disabled"; 637 status = "disabled";
638 }; 638 };
639 639
640 lradc@80050000 { 640 lradc@80050000 {
641 reg = <0x80050000 2000>; 641 reg = <0x80050000 0x2000>;
642 status = "disabled"; 642 status = "disabled";
643 }; 643 };
644 644
645 spdif@80054000 { 645 spdif@80054000 {
646 reg = <0x80054000 2000>; 646 reg = <0x80054000 0x2000>;
647 interrupts = <45 66>; 647 interrupts = <45 66>;
648 status = "disabled"; 648 status = "disabled";
649 }; 649 };
650 650
651 rtc@80056000 { 651 rtc@80056000 {
652 compatible = "fsl,imx28-rtc", "fsl,stmp3xxx-rtc"; 652 compatible = "fsl,imx28-rtc", "fsl,stmp3xxx-rtc";
653 reg = <0x80056000 2000>; 653 reg = <0x80056000 0x2000>;
654 interrupts = <29>; 654 interrupts = <29>;
655 }; 655 };
656 656
@@ -658,7 +658,7 @@
658 #address-cells = <1>; 658 #address-cells = <1>;
659 #size-cells = <0>; 659 #size-cells = <0>;
660 compatible = "fsl,imx28-i2c"; 660 compatible = "fsl,imx28-i2c";
661 reg = <0x80058000 2000>; 661 reg = <0x80058000 0x2000>;
662 interrupts = <111 68>; 662 interrupts = <111 68>;
663 clock-frequency = <100000>; 663 clock-frequency = <100000>;
664 status = "disabled"; 664 status = "disabled";
@@ -668,7 +668,7 @@
668 #address-cells = <1>; 668 #address-cells = <1>;
669 #size-cells = <0>; 669 #size-cells = <0>;
670 compatible = "fsl,imx28-i2c"; 670 compatible = "fsl,imx28-i2c";
671 reg = <0x8005a000 2000>; 671 reg = <0x8005a000 0x2000>;
672 interrupts = <110 69>; 672 interrupts = <110 69>;
673 clock-frequency = <100000>; 673 clock-frequency = <100000>;
674 status = "disabled"; 674 status = "disabled";
@@ -676,14 +676,14 @@
676 676
677 pwm: pwm@80064000 { 677 pwm: pwm@80064000 {
678 compatible = "fsl,imx28-pwm", "fsl,imx23-pwm"; 678 compatible = "fsl,imx28-pwm", "fsl,imx23-pwm";
679 reg = <0x80064000 2000>; 679 reg = <0x80064000 0x2000>;
680 #pwm-cells = <2>; 680 #pwm-cells = <2>;
681 fsl,pwm-number = <8>; 681 fsl,pwm-number = <8>;
682 status = "disabled"; 682 status = "disabled";
683 }; 683 };
684 684
685 timrot@80068000 { 685 timrot@80068000 {
686 reg = <0x80068000 2000>; 686 reg = <0x80068000 0x2000>;
687 status = "disabled"; 687 status = "disabled";
688 }; 688 };
689 689
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index de065b5976e6..cd86177a3ea2 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -53,7 +53,7 @@
53 spi-max-frequency = <6000000>; 53 spi-max-frequency = <6000000>;
54 reg = <0>; 54 reg = <0>;
55 interrupt-parent = <&gpio1>; 55 interrupt-parent = <&gpio1>;
56 interrupts = <8>; 56 interrupts = <8 0x4>;
57 57
58 regulators { 58 regulators {
59 sw1_reg: sw1 { 59 sw1_reg: sw1 {
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 53cbaa3d4f90..aba28dc87fc8 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -17,6 +17,10 @@
17 serial0 = &uart1; 17 serial0 = &uart1;
18 serial1 = &uart2; 18 serial1 = &uart2;
19 serial2 = &uart3; 19 serial2 = &uart3;
20 gpio0 = &gpio1;
21 gpio1 = &gpio2;
22 gpio2 = &gpio3;
23 gpio3 = &gpio4;
20 }; 24 };
21 25
22 tzic: tz-interrupt-controller@e0000000 { 26 tzic: tz-interrupt-controller@e0000000 {
diff --git a/arch/arm/boot/dts/imx53-ard.dts b/arch/arm/boot/dts/imx53-ard.dts
index 5b8eafcdbeec..da895e93a999 100644
--- a/arch/arm/boot/dts/imx53-ard.dts
+++ b/arch/arm/boot/dts/imx53-ard.dts
@@ -64,12 +64,32 @@
64 reg = <0xf4000000 0x2000000>; 64 reg = <0xf4000000 0x2000000>;
65 phy-mode = "mii"; 65 phy-mode = "mii";
66 interrupt-parent = <&gpio2>; 66 interrupt-parent = <&gpio2>;
67 interrupts = <31>; 67 interrupts = <31 0x8>;
68 reg-io-width = <4>; 68 reg-io-width = <4>;
69 /*
70 * VDD33A and VDDVARIO of LAN9220 are supplied by
71 * SW4_3V3 of LTC3589. Before the regulator driver
72 * for this PMIC is available, we use a fixed dummy
73 * 3V3 regulator to get LAN9220 driver probing work.
74 */
75 vdd33a-supply = <&reg_3p3v>;
76 vddvario-supply = <&reg_3p3v>;
69 smsc,irq-push-pull; 77 smsc,irq-push-pull;
70 }; 78 };
71 }; 79 };
72 80
81 regulators {
82 compatible = "simple-bus";
83
84 reg_3p3v: 3p3v {
85 compatible = "regulator-fixed";
86 regulator-name = "3P3V";
87 regulator-min-microvolt = <3300000>;
88 regulator-max-microvolt = <3300000>;
89 regulator-always-on;
90 };
91 };
92
73 gpio-keys { 93 gpio-keys {
74 compatible = "gpio-keys"; 94 compatible = "gpio-keys";
75 95
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index fc79cdc4b4e6..cd37165edce5 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -19,6 +19,13 @@
19 serial2 = &uart3; 19 serial2 = &uart3;
20 serial3 = &uart4; 20 serial3 = &uart4;
21 serial4 = &uart5; 21 serial4 = &uart5;
22 gpio0 = &gpio1;
23 gpio1 = &gpio2;
24 gpio2 = &gpio3;
25 gpio3 = &gpio4;
26 gpio4 = &gpio5;
27 gpio5 = &gpio6;
28 gpio6 = &gpio7;
22 }; 29 };
23 30
24 tzic: tz-interrupt-controller@0fffc000 { 31 tzic: tz-interrupt-controller@0fffc000 {
diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts
index d42e851ceb97..72f30f3e6171 100644
--- a/arch/arm/boot/dts/imx6q-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6q-sabrelite.dts
@@ -53,6 +53,7 @@
53 fsl,pins = < 53 fsl,pins = <
54 144 0x80000000 /* MX6Q_PAD_EIM_D22__GPIO_3_22 */ 54 144 0x80000000 /* MX6Q_PAD_EIM_D22__GPIO_3_22 */
55 121 0x80000000 /* MX6Q_PAD_EIM_D19__GPIO_3_19 */ 55 121 0x80000000 /* MX6Q_PAD_EIM_D19__GPIO_3_19 */
56 953 0x80000000 /* MX6Q_PAD_GPIO_0__CCM_CLKO */
56 >; 57 >;
57 }; 58 };
58 }; 59 };
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 3d3c64b014e6..fd57079f71a9 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -19,6 +19,13 @@
19 serial2 = &uart3; 19 serial2 = &uart3;
20 serial3 = &uart4; 20 serial3 = &uart4;
21 serial4 = &uart5; 21 serial4 = &uart5;
22 gpio0 = &gpio1;
23 gpio1 = &gpio2;
24 gpio2 = &gpio3;
25 gpio3 = &gpio4;
26 gpio4 = &gpio5;
27 gpio5 = &gpio6;
28 gpio6 = &gpio7;
22 }; 29 };
23 30
24 cpus { 31 cpus {
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index f725b9637b33..3c9f32f9b6b4 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -192,6 +192,7 @@ CONFIG_RTC_DRV_MC13XXX=y
192CONFIG_RTC_DRV_MXC=y 192CONFIG_RTC_DRV_MXC=y
193CONFIG_DMADEVICES=y 193CONFIG_DMADEVICES=y
194CONFIG_IMX_SDMA=y 194CONFIG_IMX_SDMA=y
195CONFIG_MXS_DMA=y
195CONFIG_COMMON_CLK_DEBUG=y 196CONFIG_COMMON_CLK_DEBUG=y
196# CONFIG_IOMMU_SUPPORT is not set 197# CONFIG_IOMMU_SUPPORT is not set
197CONFIG_EXT2_FS=y 198CONFIG_EXT2_FS=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index ccdb6357fb74..4edcfb4e4dee 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -34,7 +34,6 @@ CONFIG_NO_HZ=y
34CONFIG_HIGH_RES_TIMERS=y 34CONFIG_HIGH_RES_TIMERS=y
35CONFIG_PREEMPT_VOLUNTARY=y 35CONFIG_PREEMPT_VOLUNTARY=y
36CONFIG_AEABI=y 36CONFIG_AEABI=y
37CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
38CONFIG_AUTO_ZRELADDR=y 37CONFIG_AUTO_ZRELADDR=y
39CONFIG_FPE_NWFPE=y 38CONFIG_FPE_NWFPE=y
40CONFIG_NET=y 39CONFIG_NET=y
diff --git a/arch/arm/configs/tct_hammer_defconfig b/arch/arm/configs/tct_hammer_defconfig
index 1d24f8458bef..71277a1591ba 100644
--- a/arch/arm/configs/tct_hammer_defconfig
+++ b/arch/arm/configs/tct_hammer_defconfig
@@ -7,7 +7,7 @@ CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_EXPERT=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_BUG is not set 10# CONFIG_BUGVERBOSE is not set
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12# CONFIG_SHMEM is not set 12# CONFIG_SHMEM is not set
13CONFIG_SLOB=y 13CONFIG_SLOB=y
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 5de69f2fcca9..f6b9fc70161b 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -162,38 +162,6 @@ static void __init davinci_ntosd2_map_io(void)
162 dm644x_init(); 162 dm644x_init();
163} 163}
164 164
165/*
166 I2C initialization
167*/
168static struct davinci_i2c_platform_data ntosd2_i2c_pdata = {
169 .bus_freq = 20 /* kHz */,
170 .bus_delay = 100 /* usec */,
171};
172
173static struct i2c_board_info __initdata ntosd2_i2c_info[] = {
174};
175
176static int ntosd2_init_i2c(void)
177{
178 int status;
179
180 davinci_init_i2c(&ntosd2_i2c_pdata);
181 status = gpio_request(NTOSD2_MSP430_IRQ, ntosd2_i2c_info[0].type);
182 if (status == 0) {
183 status = gpio_direction_input(NTOSD2_MSP430_IRQ);
184 if (status == 0) {
185 status = gpio_to_irq(NTOSD2_MSP430_IRQ);
186 if (status > 0) {
187 ntosd2_i2c_info[0].irq = status;
188 i2c_register_board_info(1,
189 ntosd2_i2c_info,
190 ARRAY_SIZE(ntosd2_i2c_info));
191 }
192 }
193 }
194 return status;
195}
196
197static struct davinci_mmc_config davinci_ntosd2_mmc_config = { 165static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
198 .wires = 4, 166 .wires = 4,
199 .version = MMC_CTLR_VERSION_1 167 .version = MMC_CTLR_VERSION_1
@@ -218,7 +186,6 @@ static __init void davinci_ntosd2_init(void)
218{ 186{
219 struct clk *aemif_clk; 187 struct clk *aemif_clk;
220 struct davinci_soc_info *soc_info = &davinci_soc_info; 188 struct davinci_soc_info *soc_info = &davinci_soc_info;
221 int status;
222 189
223 aemif_clk = clk_get(NULL, "aemif"); 190 aemif_clk = clk_get(NULL, "aemif");
224 clk_enable(aemif_clk); 191 clk_enable(aemif_clk);
@@ -242,12 +209,6 @@ static __init void davinci_ntosd2_init(void)
242 platform_add_devices(davinci_ntosd2_devices, 209 platform_add_devices(davinci_ntosd2_devices,
243 ARRAY_SIZE(davinci_ntosd2_devices)); 210 ARRAY_SIZE(davinci_ntosd2_devices));
244 211
245 /* Initialize I2C interface specific for this board */
246 status = ntosd2_init_i2c();
247 if (status < 0)
248 pr_warning("davinci_ntosd2_init: msp430 irq setup failed:"
249 " %d\n", status);
250
251 davinci_serial_init(&uart_config); 212 davinci_serial_init(&uart_config);
252 dm644x_init_asp(&dm644x_ntosd2_snd_data); 213 dm644x_init_asp(&dm644x_ntosd2_snd_data);
253 214
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 373c3c00d24c..c0bc83a7663e 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -115,7 +115,7 @@ static __init int exynos_pm_dt_parse_domains(void)
115} 115}
116#endif /* CONFIG_OF */ 116#endif /* CONFIG_OF */
117 117
118static __init void exynos_pm_add_dev_to_genpd(struct platform_device *pdev, 118static __init __maybe_unused void exynos_pm_add_dev_to_genpd(struct platform_device *pdev,
119 struct exynos_pm_domain *pd) 119 struct exynos_pm_domain *pd)
120{ 120{
121 if (pdev->dev.bus) { 121 if (pdev->dev.bus) {
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 7aa6313fb167..f69ca4680049 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -223,7 +223,7 @@ int __init mx27_clocks_init(unsigned long fref)
223 clk_register_clkdev(clk[per3_gate], "per", "imx-fb.0"); 223 clk_register_clkdev(clk[per3_gate], "per", "imx-fb.0");
224 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0"); 224 clk_register_clkdev(clk[lcdc_ipg_gate], "ipg", "imx-fb.0");
225 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx-fb.0"); 225 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx-fb.0");
226 clk_register_clkdev(clk[csi_ahb_gate], NULL, "mx2-camera.0"); 226 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "mx2-camera.0");
227 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 227 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc");
228 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc"); 228 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc");
229 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc"); 229 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc");
@@ -250,8 +250,10 @@ int __init mx27_clocks_init(unsigned long fref)
250 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx-i2c.1"); 250 clk_register_clkdev(clk[i2c2_ipg_gate], NULL, "imx-i2c.1");
251 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0"); 251 clk_register_clkdev(clk[owire_ipg_gate], NULL, "mxc_w1.0");
252 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad"); 252 clk_register_clkdev(clk[kpp_ipg_gate], NULL, "imx-keypad");
253 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "imx-emma"); 253 clk_register_clkdev(clk[emma_ahb_gate], "emma-ahb", "mx2-camera.0");
254 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "imx-emma"); 254 clk_register_clkdev(clk[emma_ipg_gate], "emma-ipg", "mx2-camera.0");
255 clk_register_clkdev(clk[emma_ahb_gate], "ahb", "m2m-emmaprp.0");
256 clk_register_clkdev(clk[emma_ipg_gate], "ipg", "m2m-emmaprp.0");
255 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL); 257 clk_register_clkdev(clk[iim_ipg_gate], "iim", NULL);
256 clk_register_clkdev(clk[gpio_ipg_gate], "gpio", NULL); 258 clk_register_clkdev(clk[gpio_ipg_gate], "gpio", NULL);
257 clk_register_clkdev(clk[brom_ahb_gate], "brom", NULL); 259 clk_register_clkdev(clk[brom_ahb_gate], "brom", NULL);
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 8e19e70f90f9..1253af2d9971 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -130,7 +130,7 @@ int __init mx31_clocks_init(unsigned long fref)
130 clk_register_clkdev(clk[nfc], NULL, "mxc_nand.0"); 130 clk_register_clkdev(clk[nfc], NULL, "mxc_nand.0");
131 clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core"); 131 clk_register_clkdev(clk[ipu_gate], NULL, "ipu-core");
132 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb"); 132 clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");
133 clk_register_clkdev(clk[kpp_gate], "kpp", NULL); 133 clk_register_clkdev(clk[kpp_gate], NULL, "imx-keypad");
134 clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.0"); 134 clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.0");
135 clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.0"); 135 clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.0");
136 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0"); 136 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0");
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index f6086693ebd2..4bdcaa97bd98 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -303,6 +303,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
303 clk_prepare_enable(clk[aips_tz2]); /* fec */ 303 clk_prepare_enable(clk[aips_tz2]); /* fec */
304 clk_prepare_enable(clk[spba]); 304 clk_prepare_enable(clk[spba]);
305 clk_prepare_enable(clk[emi_fast_gate]); /* fec */ 305 clk_prepare_enable(clk[emi_fast_gate]); /* fec */
306 clk_prepare_enable(clk[emi_slow_gate]); /* eim */
306 clk_prepare_enable(clk[tmax1]); 307 clk_prepare_enable(clk[tmax1]);
307 clk_prepare_enable(clk[tmax2]); /* esdhc2, fec */ 308 clk_prepare_enable(clk[tmax2]); /* esdhc2, fec */
308 clk_prepare_enable(clk[tmax3]); /* esdhc1, esdhc4 */ 309 clk_prepare_enable(clk[tmax3]); /* esdhc1, esdhc4 */
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index ebf680bebdf2..3fa6c51390da 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/export.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/irq.h> 17#include <linux/irq.h>
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 7b1055c8e0b9..3b2267529f5e 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -456,7 +456,7 @@ static void __init ap_init_timer(void)
456 456
457 clk = clk_get_sys("ap_timer", NULL); 457 clk = clk_get_sys("ap_timer", NULL);
458 BUG_ON(IS_ERR(clk)); 458 BUG_ON(IS_ERR(clk));
459 clk_enable(clk); 459 clk_prepare_enable(clk);
460 rate = clk_get_rate(clk); 460 rate = clk_get_rate(clk);
461 461
462 writel(0, TIMER0_VA_BASE + TIMER_CTRL); 462 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 2a576abf409b..a5717558ee89 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -9,5 +9,5 @@ dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb 9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
10dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb 10dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb
11dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb 11dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
12dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb 12dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
13dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb 13dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index ccdf83b17cf1..9a8bbda195b2 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -2,9 +2,6 @@ if ARCH_MXS
2 2
3source "arch/arm/mach-mxs/devices/Kconfig" 3source "arch/arm/mach-mxs/devices/Kconfig"
4 4
5config MXS_OCOTP
6 bool
7
8config SOC_IMX23 5config SOC_IMX23
9 bool 6 bool
10 select ARM_AMBA 7 select ARM_AMBA
@@ -66,7 +63,6 @@ config MACH_MX28EVK
66 select MXS_HAVE_PLATFORM_MXS_SAIF 63 select MXS_HAVE_PLATFORM_MXS_SAIF
67 select MXS_HAVE_PLATFORM_MXS_I2C 64 select MXS_HAVE_PLATFORM_MXS_I2C
68 select MXS_HAVE_PLATFORM_RTC_STMP3XXX 65 select MXS_HAVE_PLATFORM_RTC_STMP3XXX
69 select MXS_OCOTP
70 help 66 help
71 Include support for MX28EVK platform. This includes specific 67 Include support for MX28EVK platform. This includes specific
72 configurations for the board and its peripherals. 68 configurations for the board and its peripherals.
@@ -94,7 +90,6 @@ config MODULE_M28
94 select MXS_HAVE_PLATFORM_MXS_I2C 90 select MXS_HAVE_PLATFORM_MXS_I2C
95 select MXS_HAVE_PLATFORM_MXS_MMC 91 select MXS_HAVE_PLATFORM_MXS_MMC
96 select MXS_HAVE_PLATFORM_MXSFB 92 select MXS_HAVE_PLATFORM_MXSFB
97 select MXS_OCOTP
98 93
99config MODULE_APX4 94config MODULE_APX4
100 bool 95 bool
@@ -106,7 +101,6 @@ config MODULE_APX4
106 select MXS_HAVE_PLATFORM_MXS_I2C 101 select MXS_HAVE_PLATFORM_MXS_I2C
107 select MXS_HAVE_PLATFORM_MXS_MMC 102 select MXS_HAVE_PLATFORM_MXS_MMC
108 select MXS_HAVE_PLATFORM_MXS_SAIF 103 select MXS_HAVE_PLATFORM_MXS_SAIF
109 select MXS_OCOTP
110 104
111config MACH_TX28 105config MACH_TX28
112 bool "Ka-Ro TX28 module" 106 bool "Ka-Ro TX28 module"
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index e41590ccb437..fed3695a1339 100644
--- a/arch/arm/mach-mxs/Makefile
+++ b/arch/arm/mach-mxs/Makefile
@@ -1,7 +1,6 @@
1# Common support 1# Common support
2obj-y := devices.o icoll.o iomux.o system.o timer.o mm.o 2obj-y := devices.o icoll.o iomux.o ocotp.o system.o timer.o mm.o
3 3
4obj-$(CONFIG_MXS_OCOTP) += ocotp.o
5obj-$(CONFIG_PM) += pm.o 4obj-$(CONFIG_PM) += pm.o
6 5
7obj-$(CONFIG_MACH_MXS_DT) += mach-mxs.o 6obj-$(CONFIG_MACH_MXS_DT) += mach-mxs.o
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 5905ed130e94..d89d87ae144c 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -953,12 +953,12 @@ static struct i2c_board_info raumfeld_connector_i2c_board_info __initdata = {
953 953
954static struct eeti_ts_platform_data eeti_ts_pdata = { 954static struct eeti_ts_platform_data eeti_ts_pdata = {
955 .irq_active_high = 1, 955 .irq_active_high = 1,
956 .irq_gpio = GPIO_TOUCH_IRQ,
956}; 957};
957 958
958static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = { 959static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
959 .type = "eeti_ts", 960 .type = "eeti_ts",
960 .addr = 0x0a, 961 .addr = 0x0a,
961 .irq = PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
962 .platform_data = &eeti_ts_pdata, 962 .platform_data = &eeti_ts_pdata,
963}; 963};
964 964
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index e24961109b70..d56b0f7f2b20 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -483,7 +483,7 @@ config MACH_NEO1973_GTA02
483 select I2C 483 select I2C
484 select POWER_SUPPLY 484 select POWER_SUPPLY
485 select MACH_NEO1973 485 select MACH_NEO1973
486 select S3C2410_PWM 486 select S3C24XX_PWM
487 select S3C_DEV_USB_HOST 487 select S3C_DEV_USB_HOST
488 help 488 help
489 Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone 489 Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone
@@ -493,7 +493,7 @@ config MACH_RX1950
493 select S3C24XX_DCLK 493 select S3C24XX_DCLK
494 select PM_H1940 if PM 494 select PM_H1940 if PM
495 select I2C 495 select I2C
496 select S3C2410_PWM 496 select S3C24XX_PWM
497 select S3C_DEV_NAND 497 select S3C_DEV_NAND
498 select S3C2410_IOTIMING if S3C2440_CPUFREQ 498 select S3C2410_IOTIMING if S3C2440_CPUFREQ
499 select S3C2440_XTAL_16934400 499 select S3C2440_XTAL_16934400
diff --git a/arch/arm/mach-sa1100/leds-hackkit.c b/arch/arm/mach-sa1100/leds-hackkit.c
index 6a2352436e62..f8e47235babe 100644
--- a/arch/arm/mach-sa1100/leds-hackkit.c
+++ b/arch/arm/mach-sa1100/leds-hackkit.c
@@ -10,6 +10,7 @@
10 * as cpu led, the green one is used as timer led. 10 * as cpu led, the green one is used as timer led.
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/io.h>
13 14
14#include <mach/hardware.h> 15#include <mach/hardware.h>
15#include <asm/leds.h> 16#include <asm/leds.h>
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c
index 8fd387bf31f0..b7344beec102 100644
--- a/arch/arm/mach-tegra/board-harmony-power.c
+++ b/arch/arm/mach-tegra/board-harmony-power.c
@@ -51,7 +51,7 @@ static struct regulator_init_data ldo0_data = {
51 .consumer_supplies = tps658621_ldo0_supply, 51 .consumer_supplies = tps658621_ldo0_supply,
52}; 52};
53 53
54#define HARMONY_REGULATOR_INIT(_id, _name, _supply, _minmv, _maxmv) \ 54#define HARMONY_REGULATOR_INIT(_id, _name, _supply, _minmv, _maxmv, _on)\
55 static struct regulator_init_data _id##_data = { \ 55 static struct regulator_init_data _id##_data = { \
56 .supply_regulator = _supply, \ 56 .supply_regulator = _supply, \
57 .constraints = { \ 57 .constraints = { \
@@ -63,21 +63,22 @@ static struct regulator_init_data ldo0_data = {
63 .valid_ops_mask = (REGULATOR_CHANGE_MODE | \ 63 .valid_ops_mask = (REGULATOR_CHANGE_MODE | \
64 REGULATOR_CHANGE_STATUS | \ 64 REGULATOR_CHANGE_STATUS | \
65 REGULATOR_CHANGE_VOLTAGE), \ 65 REGULATOR_CHANGE_VOLTAGE), \
66 .always_on = _on, \
66 }, \ 67 }, \
67 } 68 }
68 69
69HARMONY_REGULATOR_INIT(sm0, "vdd_sm0", "vdd_sys", 725, 1500); 70HARMONY_REGULATOR_INIT(sm0, "vdd_sm0", "vdd_sys", 725, 1500, 1);
70HARMONY_REGULATOR_INIT(sm1, "vdd_sm1", "vdd_sys", 725, 1500); 71HARMONY_REGULATOR_INIT(sm1, "vdd_sm1", "vdd_sys", 725, 1500, 1);
71HARMONY_REGULATOR_INIT(sm2, "vdd_sm2", "vdd_sys", 3000, 4550); 72HARMONY_REGULATOR_INIT(sm2, "vdd_sm2", "vdd_sys", 3000, 4550, 1);
72HARMONY_REGULATOR_INIT(ldo1, "vdd_ldo1", "vdd_sm2", 725, 1500); 73HARMONY_REGULATOR_INIT(ldo1, "vdd_ldo1", "vdd_sm2", 725, 1500, 1);
73HARMONY_REGULATOR_INIT(ldo2, "vdd_ldo2", "vdd_sm2", 725, 1500); 74HARMONY_REGULATOR_INIT(ldo2, "vdd_ldo2", "vdd_sm2", 725, 1500, 0);
74HARMONY_REGULATOR_INIT(ldo3, "vdd_ldo3", "vdd_sm2", 1250, 3300); 75HARMONY_REGULATOR_INIT(ldo3, "vdd_ldo3", "vdd_sm2", 1250, 3300, 1);
75HARMONY_REGULATOR_INIT(ldo4, "vdd_ldo4", "vdd_sm2", 1700, 2475); 76HARMONY_REGULATOR_INIT(ldo4, "vdd_ldo4", "vdd_sm2", 1700, 2475, 1);
76HARMONY_REGULATOR_INIT(ldo5, "vdd_ldo5", NULL, 1250, 3300); 77HARMONY_REGULATOR_INIT(ldo5, "vdd_ldo5", NULL, 1250, 3300, 1);
77HARMONY_REGULATOR_INIT(ldo6, "vdd_ldo6", "vdd_sm2", 1250, 3300); 78HARMONY_REGULATOR_INIT(ldo6, "vdd_ldo6", "vdd_sm2", 1250, 3300, 0);
78HARMONY_REGULATOR_INIT(ldo7, "vdd_ldo7", "vdd_sm2", 1250, 3300); 79HARMONY_REGULATOR_INIT(ldo7, "vdd_ldo7", "vdd_sm2", 1250, 3300, 0);
79HARMONY_REGULATOR_INIT(ldo8, "vdd_ldo8", "vdd_sm2", 1250, 3300); 80HARMONY_REGULATOR_INIT(ldo8, "vdd_ldo8", "vdd_sm2", 1250, 3300, 0);
80HARMONY_REGULATOR_INIT(ldo9, "vdd_ldo9", "vdd_sm2", 1250, 3300); 81HARMONY_REGULATOR_INIT(ldo9, "vdd_ldo9", "vdd_sm2", 1250, 3300, 1);
81 82
82#define TPS_REG(_id, _data) \ 83#define TPS_REG(_id, _data) \
83 { \ 84 { \
@@ -119,9 +120,10 @@ static struct i2c_board_info __initdata harmony_regulators[] = {
119 120
120int __init harmony_regulator_init(void) 121int __init harmony_regulator_init(void)
121{ 122{
123 regulator_register_always_on(0, "vdd_sys",
124 NULL, 0, 5000000);
125
122 if (machine_is_harmony()) { 126 if (machine_is_harmony()) {
123 regulator_register_always_on(0, "vdd_sys",
124 NULL, 0, 5000000);
125 i2c_register_board_info(3, harmony_regulators, 1); 127 i2c_register_board_info(3, harmony_regulators, 1);
126 } else { /* Harmony, booted using device tree */ 128 } else { /* Harmony, booted using device tree */
127 struct device_node *np; 129 struct device_node *np;
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c2cdf6500f75..4e7d1182e8a3 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -358,7 +358,7 @@ void __init dma_contiguous_remap(void)
358 if (end > arm_lowmem_limit) 358 if (end > arm_lowmem_limit)
359 end = arm_lowmem_limit; 359 end = arm_lowmem_limit;
360 if (start >= end) 360 if (start >= end)
361 return; 361 continue;
362 362
363 map.pfn = __phys_to_pfn(start); 363 map.pfn = __phys_to_pfn(start);
364 map.virtual = __phys_to_virt(start); 364 map.virtual = __phys_to_virt(start);
@@ -423,7 +423,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
423 unsigned int pageno; 423 unsigned int pageno;
424 unsigned long flags; 424 unsigned long flags;
425 void *ptr = NULL; 425 void *ptr = NULL;
426 size_t align; 426 unsigned long align_mask;
427 427
428 if (!pool->vaddr) { 428 if (!pool->vaddr) {
429 WARN(1, "coherent pool not initialised!\n"); 429 WARN(1, "coherent pool not initialised!\n");
@@ -435,11 +435,11 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)
435 * small, so align them to their order in pages, minimum is a page 435 * small, so align them to their order in pages, minimum is a page
436 * size. This helps reduce fragmentation of the DMA space. 436 * size. This helps reduce fragmentation of the DMA space.
437 */ 437 */
438 align = PAGE_SIZE << get_order(size); 438 align_mask = (1 << get_order(size)) - 1;
439 439
440 spin_lock_irqsave(&pool->lock, flags); 440 spin_lock_irqsave(&pool->lock, flags);
441 pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages, 441 pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages,
442 0, count, (1 << align) - 1); 442 0, count, align_mask);
443 if (pageno < pool->nr_pages) { 443 if (pageno < pool->nr_pages) {
444 bitmap_set(pool->bitmap, pageno, count); 444 bitmap_set(pool->bitmap, pageno, count);
445 ptr = pool->vaddr + PAGE_SIZE * pageno; 445 ptr = pool->vaddr + PAGE_SIZE * pageno;
@@ -648,12 +648,12 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
648 648
649 if (arch_is_coherent() || nommu()) { 649 if (arch_is_coherent() || nommu()) {
650 __dma_free_buffer(page, size); 650 __dma_free_buffer(page, size);
651 } else if (__free_from_pool(cpu_addr, size)) {
652 return;
651 } else if (!IS_ENABLED(CONFIG_CMA)) { 653 } else if (!IS_ENABLED(CONFIG_CMA)) {
652 __dma_free_remap(cpu_addr, size); 654 __dma_free_remap(cpu_addr, size);
653 __dma_free_buffer(page, size); 655 __dma_free_buffer(page, size);
654 } else { 656 } else {
655 if (__free_from_pool(cpu_addr, size))
656 return;
657 /* 657 /*
658 * Non-atomic allocations cannot be freed with IRQs disabled 658 * Non-atomic allocations cannot be freed with IRQs disabled
659 */ 659 */
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 7aca31c1df1f..9c3b90c3538e 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -403,7 +403,8 @@ config S5P_DEV_USB_EHCI
403 403
404config S3C24XX_PWM 404config S3C24XX_PWM
405 bool "PWM device support" 405 bool "PWM device support"
406 select HAVE_PWM 406 select PWM
407 select PWM_SAMSUNG
407 help 408 help
408 Support for exporting the PWM timer blocks via the pwm device 409 Support for exporting the PWM timer blocks via the pwm device
409 system 410 system
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index ada8f0fc71e4..fb96e607adcf 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -52,7 +52,6 @@ EXPORT_SYMBOL(reserved_mem_dcache_on);
52#ifdef CONFIG_MTD_UCLINUX 52#ifdef CONFIG_MTD_UCLINUX
53extern struct map_info uclinux_ram_map; 53extern struct map_info uclinux_ram_map;
54unsigned long memory_mtd_end, memory_mtd_start, mtd_size; 54unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
55unsigned long _ebss;
56EXPORT_SYMBOL(memory_mtd_end); 55EXPORT_SYMBOL(memory_mtd_end);
57EXPORT_SYMBOL(memory_mtd_start); 56EXPORT_SYMBOL(memory_mtd_start);
58EXPORT_SYMBOL(mtd_size); 57EXPORT_SYMBOL(mtd_size);
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index 052f81a76239..983c859e40b7 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,6 +6,7 @@
6config C6X 6config C6X
7 def_bool y 7 def_bool y
8 select CLKDEV_LOOKUP 8 select CLKDEV_LOOKUP
9 select GENERIC_ATOMIC64
9 select GENERIC_IRQ_SHOW 10 select GENERIC_IRQ_SHOW
10 select HAVE_ARCH_TRACEHOOK 11 select HAVE_ARCH_TRACEHOOK
11 select HAVE_DMA_API_DEBUG 12 select HAVE_DMA_API_DEBUG
diff --git a/arch/c6x/include/asm/cache.h b/arch/c6x/include/asm/cache.h
index 6d521d96d941..09c5a0f5f4d1 100644
--- a/arch/c6x/include/asm/cache.h
+++ b/arch/c6x/include/asm/cache.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Port on Texas Instruments TMS320C6x architecture 2 * Port on Texas Instruments TMS320C6x architecture
3 * 3 *
4 * Copyright (C) 2005, 2006, 2009, 2010 Texas Instruments Incorporated 4 * Copyright (C) 2005, 2006, 2009, 2010, 2012 Texas Instruments Incorporated
5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 5 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -16,9 +16,14 @@
16/* 16/*
17 * Cache line size 17 * Cache line size
18 */ 18 */
19#define L1D_CACHE_BYTES 64 19#define L1D_CACHE_SHIFT 6
20#define L1P_CACHE_BYTES 32 20#define L1D_CACHE_BYTES (1 << L1D_CACHE_SHIFT)
21#define L2_CACHE_BYTES 128 21
22#define L1P_CACHE_SHIFT 5
23#define L1P_CACHE_BYTES (1 << L1P_CACHE_SHIFT)
24
25#define L2_CACHE_SHIFT 7
26#define L2_CACHE_BYTES (1 << L2_CACHE_SHIFT)
22 27
23/* 28/*
24 * L2 used as cache 29 * L2 used as cache
@@ -29,7 +34,8 @@
29 * For practical reasons the L1_CACHE_BYTES defines should not be smaller than 34 * For practical reasons the L1_CACHE_BYTES defines should not be smaller than
30 * the L2 line size 35 * the L2 line size
31 */ 36 */
32#define L1_CACHE_BYTES L2_CACHE_BYTES 37#define L1_CACHE_SHIFT L2_CACHE_SHIFT
38#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
33 39
34#define L2_CACHE_ALIGN_LOW(x) \ 40#define L2_CACHE_ALIGN_LOW(x) \
35 (((x) & ~(L2_CACHE_BYTES - 1))) 41 (((x) & ~(L2_CACHE_BYTES - 1)))
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 6f38b6120d96..440578850ae5 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -497,7 +497,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
497 srat_num_cpus++; 497 srat_num_cpus++;
498} 498}
499 499
500void __init 500int __init
501acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) 501acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
502{ 502{
503 unsigned long paddr, size; 503 unsigned long paddr, size;
@@ -512,7 +512,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
512 512
513 /* Ignore disabled entries */ 513 /* Ignore disabled entries */
514 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) 514 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
515 return; 515 return -1;
516 516
517 /* record this node in proximity bitmap */ 517 /* record this node in proximity bitmap */
518 pxm_bit_set(pxm); 518 pxm_bit_set(pxm);
@@ -531,6 +531,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
531 p->size = size; 531 p->size = size;
532 p->nid = pxm; 532 p->nid = pxm;
533 num_node_memblks++; 533 num_node_memblks++;
534 return 0;
534} 535}
535 536
536void __init acpi_numa_arch_fixup(void) 537void __init acpi_numa_arch_fixup(void)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 0b0f8b8c4a26..4a469907f04a 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -54,18 +54,6 @@ config ZONE_DMA
54 bool 54 bool
55 default y 55 default y
56 56
57config CPU_HAS_NO_BITFIELDS
58 bool
59
60config CPU_HAS_NO_MULDIV64
61 bool
62
63config CPU_HAS_ADDRESS_SPACES
64 bool
65
66config FPU
67 bool
68
69config HZ 57config HZ
70 int 58 int
71 default 1000 if CLEOPATRA 59 default 1000 if CLEOPATRA
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 43a9f8f1b8eb..82068349a2bb 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -37,6 +37,7 @@ config M68000
37 bool 37 bool
38 select CPU_HAS_NO_BITFIELDS 38 select CPU_HAS_NO_BITFIELDS
39 select CPU_HAS_NO_MULDIV64 39 select CPU_HAS_NO_MULDIV64
40 select CPU_HAS_NO_UNALIGNED
40 select GENERIC_CSUM 41 select GENERIC_CSUM
41 help 42 help
42 The Freescale (was Motorola) 68000 CPU is the first generation of 43 The Freescale (was Motorola) 68000 CPU is the first generation of
@@ -48,6 +49,7 @@ config M68000
48config MCPU32 49config MCPU32
49 bool 50 bool
50 select CPU_HAS_NO_BITFIELDS 51 select CPU_HAS_NO_BITFIELDS
52 select CPU_HAS_NO_UNALIGNED
51 help 53 help
52 The Freescale (was then Motorola) CPU32 is a CPU core that is 54 The Freescale (was then Motorola) CPU32 is a CPU core that is
53 based on the 68020 processor. For the most part it is used in 55 based on the 68020 processor. For the most part it is used in
@@ -376,6 +378,18 @@ config NODES_SHIFT
376 default "3" 378 default "3"
377 depends on !SINGLE_MEMORY_CHUNK 379 depends on !SINGLE_MEMORY_CHUNK
378 380
381config CPU_HAS_NO_BITFIELDS
382 bool
383
384config CPU_HAS_NO_MULDIV64
385 bool
386
387config CPU_HAS_NO_UNALIGNED
388 bool
389
390config CPU_HAS_ADDRESS_SPACES
391 bool
392
379config FPU 393config FPU
380 bool 394 bool
381 395
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index 0a30406b9442..f5565d6eeb8e 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -177,8 +177,8 @@ irqreturn_t dn_timer_int(int irq, void *dev_id)
177 177
178 timer_handler(irq, dev_id); 178 timer_handler(irq, dev_id);
179 179
180 x=*(volatile unsigned char *)(timer+3); 180 x = *(volatile unsigned char *)(apollo_timer + 3);
181 x=*(volatile unsigned char *)(timer+5); 181 x = *(volatile unsigned char *)(apollo_timer + 5);
182 182
183 return IRQ_HANDLED; 183 return IRQ_HANDLED;
184} 184}
@@ -186,17 +186,17 @@ irqreturn_t dn_timer_int(int irq, void *dev_id)
186void dn_sched_init(irq_handler_t timer_routine) 186void dn_sched_init(irq_handler_t timer_routine)
187{ 187{
188 /* program timer 1 */ 188 /* program timer 1 */
189 *(volatile unsigned char *)(timer+3)=0x01; 189 *(volatile unsigned char *)(apollo_timer + 3) = 0x01;
190 *(volatile unsigned char *)(timer+1)=0x40; 190 *(volatile unsigned char *)(apollo_timer + 1) = 0x40;
191 *(volatile unsigned char *)(timer+5)=0x09; 191 *(volatile unsigned char *)(apollo_timer + 5) = 0x09;
192 *(volatile unsigned char *)(timer+7)=0xc4; 192 *(volatile unsigned char *)(apollo_timer + 7) = 0xc4;
193 193
194 /* enable IRQ of PIC B */ 194 /* enable IRQ of PIC B */
195 *(volatile unsigned char *)(pica+1)&=(~8); 195 *(volatile unsigned char *)(pica+1)&=(~8);
196 196
197#if 0 197#if 0
198 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3)); 198 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(apollo_timer + 0x3));
199 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3)); 199 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(apollo_timer + 0x3));
200#endif 200#endif
201 201
202 if (request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine)) 202 if (request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine))
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index eafa2539a8ee..a74e5d95c384 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,4 +1,29 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2header-y += cachectl.h 2header-y += cachectl.h
3 3
4generic-y += bitsperlong.h
5generic-y += cputime.h
6generic-y += device.h
7generic-y += emergency-restart.h
8generic-y += errno.h
9generic-y += futex.h
10generic-y += ioctl.h
11generic-y += ipcbuf.h
12generic-y += irq_regs.h
13generic-y += kdebug.h
14generic-y += kmap_types.h
15generic-y += kvm_para.h
16generic-y += local64.h
17generic-y += local.h
18generic-y += mman.h
19generic-y += mutex.h
20generic-y += percpu.h
21generic-y += resource.h
22generic-y += scatterlist.h
23generic-y += sections.h
24generic-y += siginfo.h
25generic-y += statfs.h
26generic-y += topology.h
27generic-y += types.h
4generic-y += word-at-a-time.h 28generic-y += word-at-a-time.h
29generic-y += xor.h
diff --git a/arch/m68k/include/asm/MC68332.h b/arch/m68k/include/asm/MC68332.h
deleted file mode 100644
index 6bb8f02685a2..000000000000
--- a/arch/m68k/include/asm/MC68332.h
+++ /dev/null
@@ -1,152 +0,0 @@
1
2/* include/asm-m68knommu/MC68332.h: '332 control registers
3 *
4 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>,
5 *
6 */
7
8#ifndef _MC68332_H_
9#define _MC68332_H_
10
11#define BYTE_REF(addr) (*((volatile unsigned char*)addr))
12#define WORD_REF(addr) (*((volatile unsigned short*)addr))
13
14#define PORTE_ADDR 0xfffa11
15#define PORTE BYTE_REF(PORTE_ADDR)
16#define DDRE_ADDR 0xfffa15
17#define DDRE BYTE_REF(DDRE_ADDR)
18#define PEPAR_ADDR 0xfffa17
19#define PEPAR BYTE_REF(PEPAR_ADDR)
20
21#define PORTF_ADDR 0xfffa19
22#define PORTF BYTE_REF(PORTF_ADDR)
23#define DDRF_ADDR 0xfffa1d
24#define DDRF BYTE_REF(DDRF_ADDR)
25#define PFPAR_ADDR 0xfffa1f
26#define PFPAR BYTE_REF(PFPAR_ADDR)
27
28#define PORTQS_ADDR 0xfffc15
29#define PORTQS BYTE_REF(PORTQS_ADDR)
30#define DDRQS_ADDR 0xfffc17
31#define DDRQS BYTE_REF(DDRQS_ADDR)
32#define PQSPAR_ADDR 0xfffc16
33#define PQSPAR BYTE_REF(PQSPAR_ADDR)
34
35#define CSPAR0_ADDR 0xFFFA44
36#define CSPAR0 WORD_REF(CSPAR0_ADDR)
37#define CSPAR1_ADDR 0xFFFA46
38#define CSPAR1 WORD_REF(CSPAR1_ADDR)
39#define CSARBT_ADDR 0xFFFA48
40#define CSARBT WORD_REF(CSARBT_ADDR)
41#define CSOPBT_ADDR 0xFFFA4A
42#define CSOPBT WORD_REF(CSOPBT_ADDR)
43#define CSBAR0_ADDR 0xFFFA4C
44#define CSBAR0 WORD_REF(CSBAR0_ADDR)
45#define CSOR0_ADDR 0xFFFA4E
46#define CSOR0 WORD_REF(CSOR0_ADDR)
47#define CSBAR1_ADDR 0xFFFA50
48#define CSBAR1 WORD_REF(CSBAR1_ADDR)
49#define CSOR1_ADDR 0xFFFA52
50#define CSOR1 WORD_REF(CSOR1_ADDR)
51#define CSBAR2_ADDR 0xFFFA54
52#define CSBAR2 WORD_REF(CSBAR2_ADDR)
53#define CSOR2_ADDR 0xFFFA56
54#define CSOR2 WORD_REF(CSOR2_ADDR)
55#define CSBAR3_ADDR 0xFFFA58
56#define CSBAR3 WORD_REF(CSBAR3_ADDR)
57#define CSOR3_ADDR 0xFFFA5A
58#define CSOR3 WORD_REF(CSOR3_ADDR)
59#define CSBAR4_ADDR 0xFFFA5C
60#define CSBAR4 WORD_REF(CSBAR4_ADDR)
61#define CSOR4_ADDR 0xFFFA5E
62#define CSOR4 WORD_REF(CSOR4_ADDR)
63#define CSBAR5_ADDR 0xFFFA60
64#define CSBAR5 WORD_REF(CSBAR5_ADDR)
65#define CSOR5_ADDR 0xFFFA62
66#define CSOR5 WORD_REF(CSOR5_ADDR)
67#define CSBAR6_ADDR 0xFFFA64
68#define CSBAR6 WORD_REF(CSBAR6_ADDR)
69#define CSOR6_ADDR 0xFFFA66
70#define CSOR6 WORD_REF(CSOR6_ADDR)
71#define CSBAR7_ADDR 0xFFFA68
72#define CSBAR7 WORD_REF(CSBAR7_ADDR)
73#define CSOR7_ADDR 0xFFFA6A
74#define CSOR7 WORD_REF(CSOR7_ADDR)
75#define CSBAR8_ADDR 0xFFFA6C
76#define CSBAR8 WORD_REF(CSBAR8_ADDR)
77#define CSOR8_ADDR 0xFFFA6E
78#define CSOR8 WORD_REF(CSOR8_ADDR)
79#define CSBAR9_ADDR 0xFFFA70
80#define CSBAR9 WORD_REF(CSBAR9_ADDR)
81#define CSOR9_ADDR 0xFFFA72
82#define CSOR9 WORD_REF(CSOR9_ADDR)
83#define CSBAR10_ADDR 0xFFFA74
84#define CSBAR10 WORD_REF(CSBAR10_ADDR)
85#define CSOR10_ADDR 0xFFFA76
86#define CSOR10 WORD_REF(CSOR10_ADDR)
87
88#define CSOR_MODE_ASYNC 0x0000
89#define CSOR_MODE_SYNC 0x8000
90#define CSOR_MODE_MASK 0x8000
91#define CSOR_BYTE_DISABLE 0x0000
92#define CSOR_BYTE_UPPER 0x4000
93#define CSOR_BYTE_LOWER 0x2000
94#define CSOR_BYTE_BOTH 0x6000
95#define CSOR_BYTE_MASK 0x6000
96#define CSOR_RW_RSVD 0x0000
97#define CSOR_RW_READ 0x0800
98#define CSOR_RW_WRITE 0x1000
99#define CSOR_RW_BOTH 0x1800
100#define CSOR_RW_MASK 0x1800
101#define CSOR_STROBE_DS 0x0400
102#define CSOR_STROBE_AS 0x0000
103#define CSOR_STROBE_MASK 0x0400
104#define CSOR_DSACK_WAIT(x) (wait << 6)
105#define CSOR_DSACK_FTERM (14 << 6)
106#define CSOR_DSACK_EXTERNAL (15 << 6)
107#define CSOR_DSACK_MASK 0x03c0
108#define CSOR_SPACE_CPU 0x0000
109#define CSOR_SPACE_USER 0x0010
110#define CSOR_SPACE_SU 0x0020
111#define CSOR_SPACE_BOTH 0x0030
112#define CSOR_SPACE_MASK 0x0030
113#define CSOR_IPL_ALL 0x0000
114#define CSOR_IPL_PRIORITY(x) (x << 1)
115#define CSOR_IPL_MASK 0x000e
116#define CSOR_AVEC_ON 0x0001
117#define CSOR_AVEC_OFF 0x0000
118#define CSOR_AVEC_MASK 0x0001
119
120#define CSBAR_ADDR(x) ((addr >> 11) << 3)
121#define CSBAR_ADDR_MASK 0xfff8
122#define CSBAR_BLKSIZE_2K 0x0000
123#define CSBAR_BLKSIZE_8K 0x0001
124#define CSBAR_BLKSIZE_16K 0x0002
125#define CSBAR_BLKSIZE_64K 0x0003
126#define CSBAR_BLKSIZE_128K 0x0004
127#define CSBAR_BLKSIZE_256K 0x0005
128#define CSBAR_BLKSIZE_512K 0x0006
129#define CSBAR_BLKSIZE_1M 0x0007
130#define CSBAR_BLKSIZE_MASK 0x0007
131
132#define CSPAR_DISC 0
133#define CSPAR_ALT 1
134#define CSPAR_CS8 2
135#define CSPAR_CS16 3
136#define CSPAR_MASK 3
137
138#define CSPAR0_CSBOOT(x) (x << 0)
139#define CSPAR0_CS0(x) (x << 2)
140#define CSPAR0_CS1(x) (x << 4)
141#define CSPAR0_CS2(x) (x << 6)
142#define CSPAR0_CS3(x) (x << 8)
143#define CSPAR0_CS4(x) (x << 10)
144#define CSPAR0_CS5(x) (x << 12)
145
146#define CSPAR1_CS6(x) (x << 0)
147#define CSPAR1_CS7(x) (x << 2)
148#define CSPAR1_CS8(x) (x << 4)
149#define CSPAR1_CS9(x) (x << 6)
150#define CSPAR1_CS10(x) (x << 8)
151
152#endif
diff --git a/arch/m68k/include/asm/apollodma.h b/arch/m68k/include/asm/apollodma.h
deleted file mode 100644
index 954adc851adb..000000000000
--- a/arch/m68k/include/asm/apollodma.h
+++ /dev/null
@@ -1,248 +0,0 @@
1/*
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen
5 * and John Boyd, Nov. 1992.
6 */
7
8#ifndef _ASM_APOLLO_DMA_H
9#define _ASM_APOLLO_DMA_H
10
11#include <asm/apollohw.h> /* need byte IO */
12#include <linux/spinlock.h> /* And spinlocks */
13#include <linux/delay.h>
14
15
16#define dma_outb(val,addr) (*((volatile unsigned char *)(addr+IO_BASE)) = (val))
17#define dma_inb(addr) (*((volatile unsigned char *)(addr+IO_BASE)))
18
19/*
20 * NOTES about DMA transfers:
21 *
22 * controller 1: channels 0-3, byte operations, ports 00-1F
23 * controller 2: channels 4-7, word operations, ports C0-DF
24 *
25 * - ALL registers are 8 bits only, regardless of transfer size
26 * - channel 4 is not used - cascades 1 into 2.
27 * - channels 0-3 are byte - addresses/counts are for physical bytes
28 * - channels 5-7 are word - addresses/counts are for physical words
29 * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
30 * - transfer count loaded to registers is 1 less than actual count
31 * - controller 2 offsets are all even (2x offsets for controller 1)
32 * - page registers for 5-7 don't use data bit 0, represent 128K pages
33 * - page registers for 0-3 use bit 0, represent 64K pages
34 *
35 * DMA transfers are limited to the lower 16MB of _physical_ memory.
36 * Note that addresses loaded into registers must be _physical_ addresses,
37 * not logical addresses (which may differ if paging is active).
38 *
39 * Address mapping for channels 0-3:
40 *
41 * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
42 * | ... | | ... | | ... |
43 * | ... | | ... | | ... |
44 * | ... | | ... | | ... |
45 * P7 ... P0 A7 ... A0 A7 ... A0
46 * | Page | Addr MSB | Addr LSB | (DMA registers)
47 *
48 * Address mapping for channels 5-7:
49 *
50 * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
51 * | ... | \ \ ... \ \ \ ... \ \
52 * | ... | \ \ ... \ \ \ ... \ (not used)
53 * | ... | \ \ ... \ \ \ ... \
54 * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
55 * | Page | Addr MSB | Addr LSB | (DMA registers)
56 *
57 * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
58 * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
59 * the hardware level, so odd-byte transfers aren't possible).
60 *
61 * Transfer count (_not # bytes_) is limited to 64K, represented as actual
62 * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
63 * and up to 128K bytes may be transferred on channels 5-7 in one operation.
64 *
65 */
66
67#define MAX_DMA_CHANNELS 8
68
69/* The maximum address that we can perform a DMA transfer to on this platform */#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x1000000)
70
71/* 8237 DMA controllers */
72#define IO_DMA1_BASE 0x10C00 /* 8 bit slave DMA, channels 0..3 */
73#define IO_DMA2_BASE 0x10D00 /* 16 bit master DMA, ch 4(=slave input)..7 */
74
75/* DMA controller registers */
76#define DMA1_CMD_REG (IO_DMA1_BASE+0x08) /* command register (w) */
77#define DMA1_STAT_REG (IO_DMA1_BASE+0x08) /* status register (r) */
78#define DMA1_REQ_REG (IO_DMA1_BASE+0x09) /* request register (w) */
79#define DMA1_MASK_REG (IO_DMA1_BASE+0x0A) /* single-channel mask (w) */
80#define DMA1_MODE_REG (IO_DMA1_BASE+0x0B) /* mode register (w) */
81#define DMA1_CLEAR_FF_REG (IO_DMA1_BASE+0x0C) /* clear pointer flip-flop (w) */
82#define DMA1_TEMP_REG (IO_DMA1_BASE+0x0D) /* Temporary Register (r) */
83#define DMA1_RESET_REG (IO_DMA1_BASE+0x0D) /* Master Clear (w) */
84#define DMA1_CLR_MASK_REG (IO_DMA1_BASE+0x0E) /* Clear Mask */
85#define DMA1_MASK_ALL_REG (IO_DMA1_BASE+0x0F) /* all-channels mask (w) */
86
87#define DMA2_CMD_REG (IO_DMA2_BASE+0x10) /* command register (w) */
88#define DMA2_STAT_REG (IO_DMA2_BASE+0x10) /* status register (r) */
89#define DMA2_REQ_REG (IO_DMA2_BASE+0x12) /* request register (w) */
90#define DMA2_MASK_REG (IO_DMA2_BASE+0x14) /* single-channel mask (w) */
91#define DMA2_MODE_REG (IO_DMA2_BASE+0x16) /* mode register (w) */
92#define DMA2_CLEAR_FF_REG (IO_DMA2_BASE+0x18) /* clear pointer flip-flop (w) */
93#define DMA2_TEMP_REG (IO_DMA2_BASE+0x1A) /* Temporary Register (r) */
94#define DMA2_RESET_REG (IO_DMA2_BASE+0x1A) /* Master Clear (w) */
95#define DMA2_CLR_MASK_REG (IO_DMA2_BASE+0x1C) /* Clear Mask */
96#define DMA2_MASK_ALL_REG (IO_DMA2_BASE+0x1E) /* all-channels mask (w) */
97
98#define DMA_ADDR_0 (IO_DMA1_BASE+0x00) /* DMA address registers */
99#define DMA_ADDR_1 (IO_DMA1_BASE+0x02)
100#define DMA_ADDR_2 (IO_DMA1_BASE+0x04)
101#define DMA_ADDR_3 (IO_DMA1_BASE+0x06)
102#define DMA_ADDR_4 (IO_DMA2_BASE+0x00)
103#define DMA_ADDR_5 (IO_DMA2_BASE+0x04)
104#define DMA_ADDR_6 (IO_DMA2_BASE+0x08)
105#define DMA_ADDR_7 (IO_DMA2_BASE+0x0C)
106
107#define DMA_CNT_0 (IO_DMA1_BASE+0x01) /* DMA count registers */
108#define DMA_CNT_1 (IO_DMA1_BASE+0x03)
109#define DMA_CNT_2 (IO_DMA1_BASE+0x05)
110#define DMA_CNT_3 (IO_DMA1_BASE+0x07)
111#define DMA_CNT_4 (IO_DMA2_BASE+0x02)
112#define DMA_CNT_5 (IO_DMA2_BASE+0x06)
113#define DMA_CNT_6 (IO_DMA2_BASE+0x0A)
114#define DMA_CNT_7 (IO_DMA2_BASE+0x0E)
115
116#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
117#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
118#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
119
120#define DMA_AUTOINIT 0x10
121
122#define DMA_8BIT 0
123#define DMA_16BIT 1
124#define DMA_BUSMASTER 2
125
126extern spinlock_t dma_spin_lock;
127
128static __inline__ unsigned long claim_dma_lock(void)
129{
130 unsigned long flags;
131 spin_lock_irqsave(&dma_spin_lock, flags);
132 return flags;
133}
134
135static __inline__ void release_dma_lock(unsigned long flags)
136{
137 spin_unlock_irqrestore(&dma_spin_lock, flags);
138}
139
140/* enable/disable a specific DMA channel */
141static __inline__ void enable_dma(unsigned int dmanr)
142{
143 if (dmanr<=3)
144 dma_outb(dmanr, DMA1_MASK_REG);
145 else
146 dma_outb(dmanr & 3, DMA2_MASK_REG);
147}
148
149static __inline__ void disable_dma(unsigned int dmanr)
150{
151 if (dmanr<=3)
152 dma_outb(dmanr | 4, DMA1_MASK_REG);
153 else
154 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
155}
156
157/* Clear the 'DMA Pointer Flip Flop'.
158 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
159 * Use this once to initialize the FF to a known state.
160 * After that, keep track of it. :-)
161 * --- In order to do that, the DMA routines below should ---
162 * --- only be used while holding the DMA lock ! ---
163 */
164static __inline__ void clear_dma_ff(unsigned int dmanr)
165{
166 if (dmanr<=3)
167 dma_outb(0, DMA1_CLEAR_FF_REG);
168 else
169 dma_outb(0, DMA2_CLEAR_FF_REG);
170}
171
172/* set mode (above) for a specific DMA channel */
173static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
174{
175 if (dmanr<=3)
176 dma_outb(mode | dmanr, DMA1_MODE_REG);
177 else
178 dma_outb(mode | (dmanr&3), DMA2_MODE_REG);
179}
180
181/* Set transfer address & page bits for specific DMA channel.
182 * Assumes dma flipflop is clear.
183 */
184static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
185{
186 if (dmanr <= 3) {
187 dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
188 dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
189 } else {
190 dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
191 dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
192 }
193}
194
195
196/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
197 * a specific DMA channel.
198 * You must ensure the parameters are valid.
199 * NOTE: from a manual: "the number of transfers is one more
200 * than the initial word count"! This is taken into account.
201 * Assumes dma flip-flop is clear.
202 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
203 */
204static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
205{
206 count--;
207 if (dmanr <= 3) {
208 dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
209 dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
210 } else {
211 dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
212 dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
213 }
214}
215
216
217/* Get DMA residue count. After a DMA transfer, this
218 * should return zero. Reading this while a DMA transfer is
219 * still in progress will return unpredictable results.
220 * If called before the channel has been used, it may return 1.
221 * Otherwise, it returns the number of _bytes_ left to transfer.
222 *
223 * Assumes DMA flip-flop is clear.
224 */
225static __inline__ int get_dma_residue(unsigned int dmanr)
226{
227 unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
228 : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
229
230 /* using short to get 16-bit wrap around */
231 unsigned short count;
232
233 count = 1 + dma_inb(io_port);
234 count += dma_inb(io_port) << 8;
235
236 return (dmanr<=3)? count : (count<<1);
237}
238
239
240/* These are in kernel/dma.c: */
241extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
242extern void free_dma(unsigned int dmanr); /* release it again */
243
244/* These are in arch/m68k/apollo/dma.c: */
245extern unsigned short dma_map_page(unsigned long phys_addr,int count,int type);
246extern void dma_unmap_page(unsigned short dma_addr);
247
248#endif /* _ASM_APOLLO_DMA_H */
diff --git a/arch/m68k/include/asm/apollohw.h b/arch/m68k/include/asm/apollohw.h
index a1373b9aa281..635ef4f89010 100644
--- a/arch/m68k/include/asm/apollohw.h
+++ b/arch/m68k/include/asm/apollohw.h
@@ -98,7 +98,7 @@ extern u_long timer_physaddr;
98#define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr)) 98#define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr))
99#define pica (IO_BASE + pica_physaddr) 99#define pica (IO_BASE + pica_physaddr)
100#define picb (IO_BASE + picb_physaddr) 100#define picb (IO_BASE + picb_physaddr)
101#define timer (IO_BASE + timer_physaddr) 101#define apollo_timer (IO_BASE + timer_physaddr)
102#define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000)) 102#define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000))
103 103
104#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) 104#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
diff --git a/arch/m68k/include/asm/bitsperlong.h b/arch/m68k/include/asm/bitsperlong.h
deleted file mode 100644
index 6dc0bb0c13b2..000000000000
--- a/arch/m68k/include/asm/bitsperlong.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bitsperlong.h>
diff --git a/arch/m68k/include/asm/cputime.h b/arch/m68k/include/asm/cputime.h
deleted file mode 100644
index c79c5e892305..000000000000
--- a/arch/m68k/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __M68K_CPUTIME_H
2#define __M68K_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __M68K_CPUTIME_H */
diff --git a/arch/m68k/include/asm/delay.h b/arch/m68k/include/asm/delay.h
index 9c09becfd4c9..12d8fe4f1d30 100644
--- a/arch/m68k/include/asm/delay.h
+++ b/arch/m68k/include/asm/delay.h
@@ -43,7 +43,7 @@ static inline void __delay(unsigned long loops)
43extern void __bad_udelay(void); 43extern void __bad_udelay(void);
44 44
45 45
46#if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) 46#ifdef CONFIG_CPU_HAS_NO_MULDIV64
47/* 47/*
48 * The simpler m68k and ColdFire processors do not have a 32*32->64 48 * The simpler m68k and ColdFire processors do not have a 32*32->64
49 * multiply instruction. So we need to handle them a little differently. 49 * multiply instruction. So we need to handle them a little differently.
diff --git a/arch/m68k/include/asm/device.h b/arch/m68k/include/asm/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/arch/m68k/include/asm/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/m68k/include/asm/emergency-restart.h b/arch/m68k/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/arch/m68k/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/m68k/include/asm/errno.h b/arch/m68k/include/asm/errno.h
deleted file mode 100644
index 0d4e188d6ef6..000000000000
--- a/arch/m68k/include/asm/errno.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_ERRNO_H
2#define _M68K_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* _M68K_ERRNO_H */
diff --git a/arch/m68k/include/asm/futex.h b/arch/m68k/include/asm/futex.h
deleted file mode 100644
index 6a332a9f099c..000000000000
--- a/arch/m68k/include/asm/futex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif
diff --git a/arch/m68k/include/asm/ioctl.h b/arch/m68k/include/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/arch/m68k/include/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/m68k/include/asm/ipcbuf.h b/arch/m68k/include/asm/ipcbuf.h
deleted file mode 100644
index 84c7e51cb6d0..000000000000
--- a/arch/m68k/include/asm/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipcbuf.h>
diff --git a/arch/m68k/include/asm/irq_regs.h b/arch/m68k/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/m68k/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/m68k/include/asm/kdebug.h b/arch/m68k/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/arch/m68k/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/m68k/include/asm/kmap_types.h b/arch/m68k/include/asm/kmap_types.h
deleted file mode 100644
index 3413cc1390ec..000000000000
--- a/arch/m68k/include/asm/kmap_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_M68K_KMAP_TYPES_H
2#define __ASM_M68K_KMAP_TYPES_H
3
4#include <asm-generic/kmap_types.h>
5
6#endif /* __ASM_M68K_KMAP_TYPES_H */
diff --git a/arch/m68k/include/asm/kvm_para.h b/arch/m68k/include/asm/kvm_para.h
deleted file mode 100644
index 14fab8f0b957..000000000000
--- a/arch/m68k/include/asm/kvm_para.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kvm_para.h>
diff --git a/arch/m68k/include/asm/local.h b/arch/m68k/include/asm/local.h
deleted file mode 100644
index 6c259263e1f0..000000000000
--- a/arch/m68k/include/asm/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M68K_LOCAL_H
2#define _ASM_M68K_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif /* _ASM_M68K_LOCAL_H */
diff --git a/arch/m68k/include/asm/local64.h b/arch/m68k/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc239..000000000000
--- a/arch/m68k/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/m68k/include/asm/mac_mouse.h b/arch/m68k/include/asm/mac_mouse.h
deleted file mode 100644
index 39a5c292eaee..000000000000
--- a/arch/m68k/include/asm/mac_mouse.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _ASM_MAC_MOUSE_H
2#define _ASM_MAC_MOUSE_H
3
4/*
5 * linux/include/asm-m68k/mac_mouse.h
6 * header file for Macintosh ADB mouse driver
7 * 27-10-97 Michael Schmitz
8 * copied from:
9 * header file for Atari Mouse driver
10 * by Robert de Vries (robert@and.nl) on 19Jul93
11 */
12
13struct mouse_status {
14 char buttons;
15 short dx;
16 short dy;
17 int ready;
18 int active;
19 wait_queue_head_t wait;
20 struct fasync_struct *fasyncptr;
21};
22
23#endif
diff --git a/arch/m68k/include/asm/mcfmbus.h b/arch/m68k/include/asm/mcfmbus.h
deleted file mode 100644
index 319899c47a2c..000000000000
--- a/arch/m68k/include/asm/mcfmbus.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/****************************************************************************/
2
3/*
4 * mcfmbus.h -- Coldfire MBUS support defines.
5 *
6 * (C) Copyright 1999, Martin Floeer (mfloeer@axcent.de)
7 */
8
9/****************************************************************************/
10
11
12#ifndef mcfmbus_h
13#define mcfmbus_h
14
15
16#define MCFMBUS_BASE 0x280
17#define MCFMBUS_IRQ_VECTOR 0x19
18#define MCFMBUS_IRQ 0x1
19#define MCFMBUS_CLK 0x3f
20#define MCFMBUS_IRQ_LEVEL 0x07 /*IRQ Level 1*/
21#define MCFMBUS_ADDRESS 0x01
22
23
24/*
25* Define the 5307 MBUS register set addresses
26*/
27
28#define MCFMBUS_MADR 0x00
29#define MCFMBUS_MFDR 0x04
30#define MCFMBUS_MBCR 0x08
31#define MCFMBUS_MBSR 0x0C
32#define MCFMBUS_MBDR 0x10
33
34
35#define MCFMBUS_MADR_ADDR(a) (((a)&0x7F)<<0x01) /*Slave Address*/
36
37#define MCFMBUS_MFDR_MBC(a) ((a)&0x3F) /*M-Bus Clock*/
38
39/*
40* Define bit flags in Control Register
41*/
42
43#define MCFMBUS_MBCR_MEN (0x80) /* M-Bus Enable */
44#define MCFMBUS_MBCR_MIEN (0x40) /* M-Bus Interrupt Enable */
45#define MCFMBUS_MBCR_MSTA (0x20) /* Master/Slave Mode Select Bit */
46#define MCFMBUS_MBCR_MTX (0x10) /* Transmit/Rcv Mode Select Bit */
47#define MCFMBUS_MBCR_TXAK (0x08) /* Transmit Acknowledge Enable */
48#define MCFMBUS_MBCR_RSTA (0x04) /* Repeat Start */
49
50/*
51* Define bit flags in Status Register
52*/
53
54#define MCFMBUS_MBSR_MCF (0x80) /* Data Transfer Complete */
55#define MCFMBUS_MBSR_MAAS (0x40) /* Addressed as a Slave */
56#define MCFMBUS_MBSR_MBB (0x20) /* Bus Busy */
57#define MCFMBUS_MBSR_MAL (0x10) /* Arbitration Lost */
58#define MCFMBUS_MBSR_SRW (0x04) /* Slave Transmit */
59#define MCFMBUS_MBSR_MIF (0x02) /* M-Bus Interrupt */
60#define MCFMBUS_MBSR_RXAK (0x01) /* No Acknowledge Received */
61
62/*
63* Define bit flags in DATA I/O Register
64*/
65
66#define MCFMBUS_MBDR_READ (0x01) /* 1=read 0=write MBUS */
67
68#define MBUSIOCSCLOCK 1
69#define MBUSIOCGCLOCK 2
70#define MBUSIOCSADDR 3
71#define MBUSIOCGADDR 4
72#define MBUSIOCSSLADDR 5
73#define MBUSIOCGSLADDR 6
74#define MBUSIOCSSUBADDR 7
75#define MBUSIOCGSUBADDR 8
76
77#endif
diff --git a/arch/m68k/include/asm/mman.h b/arch/m68k/include/asm/mman.h
deleted file mode 100644
index 8eebf89f5ab1..000000000000
--- a/arch/m68k/include/asm/mman.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/mman.h>
diff --git a/arch/m68k/include/asm/mutex.h b/arch/m68k/include/asm/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/arch/m68k/include/asm/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/m68k/include/asm/percpu.h b/arch/m68k/include/asm/percpu.h
deleted file mode 100644
index 0859d048faf5..000000000000
--- a/arch/m68k/include/asm/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_M68K_PERCPU_H
2#define __ASM_M68K_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_M68K_PERCPU_H */
diff --git a/arch/m68k/include/asm/resource.h b/arch/m68k/include/asm/resource.h
deleted file mode 100644
index e7d35019f337..000000000000
--- a/arch/m68k/include/asm/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_RESOURCE_H
2#define _M68K_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* _M68K_RESOURCE_H */
diff --git a/arch/m68k/include/asm/sbus.h b/arch/m68k/include/asm/sbus.h
deleted file mode 100644
index bfe3ba147f2e..000000000000
--- a/arch/m68k/include/asm/sbus.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * some sbus structures and macros to make usage of sbus drivers possible
3 */
4
5#ifndef __M68K_SBUS_H
6#define __M68K_SBUS_H
7
8struct sbus_dev {
9 struct {
10 unsigned int which_io;
11 unsigned int phys_addr;
12 } reg_addrs[1];
13};
14
15/* sbus IO functions stolen from include/asm-sparc/io.h for the serial driver */
16/* No SBUS on the Sun3, kludge -- sam */
17
18static inline void _sbus_writeb(unsigned char val, unsigned long addr)
19{
20 *(volatile unsigned char *)addr = val;
21}
22
23static inline unsigned char _sbus_readb(unsigned long addr)
24{
25 return *(volatile unsigned char *)addr;
26}
27
28static inline void _sbus_writel(unsigned long val, unsigned long addr)
29{
30 *(volatile unsigned long *)addr = val;
31
32}
33
34extern inline unsigned long _sbus_readl(unsigned long addr)
35{
36 return *(volatile unsigned long *)addr;
37}
38
39
40#define sbus_readb(a) _sbus_readb((unsigned long)a)
41#define sbus_writeb(v, a) _sbus_writeb(v, (unsigned long)a)
42#define sbus_readl(a) _sbus_readl((unsigned long)a)
43#define sbus_writel(v, a) _sbus_writel(v, (unsigned long)a)
44
45#endif
diff --git a/arch/m68k/include/asm/scatterlist.h b/arch/m68k/include/asm/scatterlist.h
deleted file mode 100644
index 312505452a1e..000000000000
--- a/arch/m68k/include/asm/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_SCATTERLIST_H
2#define _M68K_SCATTERLIST_H
3
4#include <asm-generic/scatterlist.h>
5
6#endif /* !(_M68K_SCATTERLIST_H) */
diff --git a/arch/m68k/include/asm/sections.h b/arch/m68k/include/asm/sections.h
deleted file mode 100644
index 5277e52715ec..000000000000
--- a/arch/m68k/include/asm/sections.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_M68K_SECTIONS_H
2#define _ASM_M68K_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6extern char _sbss[], _ebss[];
7
8#endif /* _ASM_M68K_SECTIONS_H */
diff --git a/arch/m68k/include/asm/shm.h b/arch/m68k/include/asm/shm.h
deleted file mode 100644
index fa56ec84a126..000000000000
--- a/arch/m68k/include/asm/shm.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _M68K_SHM_H
2#define _M68K_SHM_H
3
4
5/* format of page table entries that correspond to shared memory pages
6 currently out in swap space (see also mm/swap.c):
7 bits 0-1 (PAGE_PRESENT) is = 0
8 bits 8..2 (SWP_TYPE) are = SHM_SWP_TYPE
9 bits 31..9 are used like this:
10 bits 15..9 (SHM_ID) the id of the shared memory segment
11 bits 30..16 (SHM_IDX) the index of the page within the shared memory segment
12 (actually only bits 25..16 get used since SHMMAX is so low)
13 bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach
14*/
15/* on the m68k both bits 0 and 1 must be zero */
16/* format on the sun3 is similar, but bits 30, 31 are set to zero and all
17 others are reduced by 2. --m */
18
19#ifndef CONFIG_SUN3
20#define SHM_ID_SHIFT 9
21#else
22#define SHM_ID_SHIFT 7
23#endif
24#define _SHM_ID_BITS 7
25#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1)
26
27#define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS)
28#define _SHM_IDX_BITS 15
29#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1)
30
31#endif /* _M68K_SHM_H */
diff --git a/arch/m68k/include/asm/siginfo.h b/arch/m68k/include/asm/siginfo.h
deleted file mode 100644
index 851d3d784b53..000000000000
--- a/arch/m68k/include/asm/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_SIGINFO_H
2#define _M68K_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/arch/m68k/include/asm/statfs.h b/arch/m68k/include/asm/statfs.h
deleted file mode 100644
index 08d93f14e061..000000000000
--- a/arch/m68k/include/asm/statfs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M68K_STATFS_H
2#define _M68K_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* _M68K_STATFS_H */
diff --git a/arch/m68k/include/asm/topology.h b/arch/m68k/include/asm/topology.h
deleted file mode 100644
index ca173e9f26ff..000000000000
--- a/arch/m68k/include/asm/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M68K_TOPOLOGY_H
2#define _ASM_M68K_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_M68K_TOPOLOGY_H */
diff --git a/arch/m68k/include/asm/types.h b/arch/m68k/include/asm/types.h
deleted file mode 100644
index 89705adcbd52..000000000000
--- a/arch/m68k/include/asm/types.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _M68K_TYPES_H
2#define _M68K_TYPES_H
3
4/*
5 * This file is never included by application software unless
6 * explicitly requested (e.g., via linux/types.h) in which case the
7 * application is Linux specific so (user-) name space pollution is
8 * not a major issue. However, for interoperability, libraries still
9 * need to be careful to avoid a name clashes.
10 */
11#include <asm-generic/int-ll64.h>
12
13/*
14 * These aren't exported outside the kernel to avoid name space clashes
15 */
16#ifdef __KERNEL__
17
18#define BITS_PER_LONG 32
19
20#endif /* __KERNEL__ */
21
22#endif /* _M68K_TYPES_H */
diff --git a/arch/m68k/include/asm/unaligned.h b/arch/m68k/include/asm/unaligned.h
index f4043ae63db1..2b3ca0bf7a0d 100644
--- a/arch/m68k/include/asm/unaligned.h
+++ b/arch/m68k/include/asm/unaligned.h
@@ -2,7 +2,7 @@
2#define _ASM_M68K_UNALIGNED_H 2#define _ASM_M68K_UNALIGNED_H
3 3
4 4
5#if defined(CONFIG_COLDFIRE) || defined(CONFIG_M68000) 5#ifdef CONFIG_CPU_HAS_NO_UNALIGNED
6#include <linux/unaligned/be_struct.h> 6#include <linux/unaligned/be_struct.h>
7#include <linux/unaligned/le_byteshift.h> 7#include <linux/unaligned/le_byteshift.h>
8#include <linux/unaligned/generic.h> 8#include <linux/unaligned/generic.h>
@@ -12,7 +12,7 @@
12 12
13#else 13#else
14/* 14/*
15 * The m68k can do unaligned accesses itself. 15 * The m68k can do unaligned accesses itself.
16 */ 16 */
17#include <linux/unaligned/access_ok.h> 17#include <linux/unaligned/access_ok.h>
18#include <linux/unaligned/generic.h> 18#include <linux/unaligned/generic.h>
diff --git a/arch/m68k/include/asm/xor.h b/arch/m68k/include/asm/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/arch/m68k/include/asm/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index 7dc186b7a85f..71fb29938dba 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -218,13 +218,10 @@ void __init setup_arch(char **cmdline_p)
218 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n"); 218 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n");
219#endif 219#endif
220 220
221 pr_debug("KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x " 221 pr_debug("KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p BSS=0x%p-0x%p\n",
222 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext, 222 _stext, _etext, _sdata, _edata, __bss_start, __bss_stop);
223 (int) &_sdata, (int) &_edata, 223 pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ",
224 (int) &_sbss, (int) &_ebss); 224 __bss_stop, memory_start, memory_start, memory_end);
225 pr_debug("MEMORY -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x\n ",
226 (int) &_ebss, (int) memory_start,
227 (int) memory_start, (int) memory_end);
228 225
229 /* Keep a copy of command line */ 226 /* Keep a copy of command line */
230 *cmdline_p = &command_line[0]; 227 *cmdline_p = &command_line[0];
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 8623f8dc16f8..9a5932ec3689 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
479 goto bad_access; 479 goto bad_access;
480 } 480 }
481 481
482 mem_value = *mem; 482 /*
483 * No need to check for EFAULT; we know that the page is
484 * present and writable.
485 */
486 __get_user(mem_value, mem);
483 if (mem_value == oldval) 487 if (mem_value == oldval)
484 *mem = newval; 488 __put_user(newval, mem);
485 489
486 pte_unmap_unlock(pte, ptl); 490 pte_unmap_unlock(pte, ptl);
487 up_read(&mm->mmap_sem); 491 up_read(&mm->mmap_sem);
diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds
index 40e02d9c38b4..06a763f49fd3 100644
--- a/arch/m68k/kernel/vmlinux-nommu.lds
+++ b/arch/m68k/kernel/vmlinux-nommu.lds
@@ -78,9 +78,7 @@ SECTIONS {
78 __init_end = .; 78 __init_end = .;
79 } 79 }
80 80
81 _sbss = .;
82 BSS_SECTION(0, 0, 0) 81 BSS_SECTION(0, 0, 0)
83 _ebss = .;
84 82
85 _end = .; 83 _end = .;
86 84
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 63407c836826..d0993594f558 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -31,9 +31,7 @@ SECTIONS
31 31
32 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) 32 RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE)
33 33
34 _sbss = .;
35 BSS_SECTION(0, 0, 0) 34 BSS_SECTION(0, 0, 0)
36 _ebss = .;
37 35
38 _edata = .; /* End of data section */ 36 _edata = .; /* End of data section */
39 37
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index ad0f46d64c0b..8080469ee6c1 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -44,9 +44,7 @@ __init_begin = .;
44 . = ALIGN(PAGE_SIZE); 44 . = ALIGN(PAGE_SIZE);
45 __init_end = .; 45 __init_end = .;
46 46
47 _sbss = .;
48 BSS_SECTION(0, 0, 0) 47 BSS_SECTION(0, 0, 0)
49 _ebss = .;
50 48
51 _end = . ; 49 _end = . ;
52 50
diff --git a/arch/m68k/lib/muldi3.c b/arch/m68k/lib/muldi3.c
index 79e928a525d0..ee5f0b1b5c5d 100644
--- a/arch/m68k/lib/muldi3.c
+++ b/arch/m68k/lib/muldi3.c
@@ -19,7 +19,7 @@ along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330, 19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */ 20Boston, MA 02111-1307, USA. */
21 21
22#if defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE) 22#ifdef CONFIG_CPU_HAS_NO_MULDIV64
23 23
24#define SI_TYPE_SIZE 32 24#define SI_TYPE_SIZE 32
25#define __BITS4 (SI_TYPE_SIZE / 4) 25#define __BITS4 (SI_TYPE_SIZE / 4)
diff --git a/arch/m68k/mm/init_mm.c b/arch/m68k/mm/init_mm.c
index f77f258dce3a..282f9de68966 100644
--- a/arch/m68k/mm/init_mm.c
+++ b/arch/m68k/mm/init_mm.c
@@ -104,7 +104,7 @@ void __init print_memmap(void)
104 MLK_ROUNDUP(__init_begin, __init_end), 104 MLK_ROUNDUP(__init_begin, __init_end),
105 MLK_ROUNDUP(_stext, _etext), 105 MLK_ROUNDUP(_stext, _etext),
106 MLK_ROUNDUP(_sdata, _edata), 106 MLK_ROUNDUP(_sdata, _edata),
107 MLK_ROUNDUP(_sbss, _ebss)); 107 MLK_ROUNDUP(__bss_start, __bss_stop));
108} 108}
109 109
110void __init mem_init(void) 110void __init mem_init(void)
diff --git a/arch/m68k/mm/init_no.c b/arch/m68k/mm/init_no.c
index 345ec0d83e3d..688e3664aea0 100644
--- a/arch/m68k/mm/init_no.c
+++ b/arch/m68k/mm/init_no.c
@@ -91,7 +91,7 @@ void __init mem_init(void)
91 totalram_pages = free_all_bootmem(); 91 totalram_pages = free_all_bootmem();
92 92
93 codek = (_etext - _stext) >> 10; 93 codek = (_etext - _stext) >> 10;
94 datak = (_ebss - _sdata) >> 10; 94 datak = (__bss_stop - _sdata) >> 10;
95 initk = (__init_begin - __init_end) >> 10; 95 initk = (__init_begin - __init_end) >> 10;
96 96
97 tmp = nr_free_pages() << PAGE_SHIFT; 97 tmp = nr_free_pages() << PAGE_SHIFT;
diff --git a/arch/m68k/platform/68328/head-de2.S b/arch/m68k/platform/68328/head-de2.S
index f632fdcb93e9..537d3245b539 100644
--- a/arch/m68k/platform/68328/head-de2.S
+++ b/arch/m68k/platform/68328/head-de2.S
@@ -60,8 +60,8 @@ _start:
60 * Move ROM filesystem above bss :-) 60 * Move ROM filesystem above bss :-)
61 */ 61 */
62 62
63 moveal #_sbss, %a0 /* romfs at the start of bss */ 63 moveal #__bss_start, %a0 /* romfs at the start of bss */
64 moveal #_ebss, %a1 /* Set up destination */ 64 moveal #__bss_stop, %a1 /* Set up destination */
65 movel %a0, %a2 /* Copy of bss start */ 65 movel %a0, %a2 /* Copy of bss start */
66 66
67 movel 8(%a0), %d1 /* Get size of ROMFS */ 67 movel 8(%a0), %d1 /* Get size of ROMFS */
@@ -84,8 +84,8 @@ _start:
84 * Initialize BSS segment to 0 84 * Initialize BSS segment to 0
85 */ 85 */
86 86
87 lea _sbss, %a0 87 lea __bss_start, %a0
88 lea _ebss, %a1 88 lea __bss_stop, %a1
89 89
90 /* Copy 0 to %a0 until %a0 == %a1 */ 90 /* Copy 0 to %a0 until %a0 == %a1 */
912: cmpal %a0, %a1 912: cmpal %a0, %a1
diff --git a/arch/m68k/platform/68328/head-pilot.S b/arch/m68k/platform/68328/head-pilot.S
index 2ebfd6420818..45a9dad29e3d 100644
--- a/arch/m68k/platform/68328/head-pilot.S
+++ b/arch/m68k/platform/68328/head-pilot.S
@@ -110,7 +110,7 @@ L0:
110 movel #CONFIG_VECTORBASE, %d7 110 movel #CONFIG_VECTORBASE, %d7
111 addl #16, %d7 111 addl #16, %d7
112 moveal %d7, %a0 112 moveal %d7, %a0
113 moveal #_ebss, %a1 113 moveal #__bss_stop, %a1
114 lea %a1@(512), %a2 114 lea %a1@(512), %a2
115 115
116 DBG_PUTC('C') 116 DBG_PUTC('C')
@@ -138,8 +138,8 @@ LD1:
138 138
139 DBG_PUTC('E') 139 DBG_PUTC('E')
140 140
141 moveal #_sbss, %a0 141 moveal #__bss_start, %a0
142 moveal #_ebss, %a1 142 moveal #__bss_stop, %a1
143 143
144 /* Copy 0 to %a0 until %a0 == %a1 */ 144 /* Copy 0 to %a0 until %a0 == %a1 */
145L1: 145L1:
@@ -150,7 +150,7 @@ L1:
150 DBG_PUTC('F') 150 DBG_PUTC('F')
151 151
152 /* Copy command line from end of bss to command line */ 152 /* Copy command line from end of bss to command line */
153 moveal #_ebss, %a0 153 moveal #__bss_stop, %a0
154 moveal #command_line, %a1 154 moveal #command_line, %a1
155 lea %a1@(512), %a2 155 lea %a1@(512), %a2
156 156
@@ -165,7 +165,7 @@ L3:
165 165
166 movel #_sdata, %d0 166 movel #_sdata, %d0
167 movel %d0, _rambase 167 movel %d0, _rambase
168 movel #_ebss, %d0 168 movel #__bss_stop, %d0
169 movel %d0, _ramstart 169 movel %d0, _ramstart
170 170
171 movel %a4, %d0 171 movel %a4, %d0
diff --git a/arch/m68k/platform/68328/head-ram.S b/arch/m68k/platform/68328/head-ram.S
index 7f1aeeacb219..5189ef926098 100644
--- a/arch/m68k/platform/68328/head-ram.S
+++ b/arch/m68k/platform/68328/head-ram.S
@@ -76,8 +76,8 @@ pclp3:
76 beq pclp3 76 beq pclp3
77#endif /* DEBUG */ 77#endif /* DEBUG */
78 moveal #0x007ffff0, %ssp 78 moveal #0x007ffff0, %ssp
79 moveal #_sbss, %a0 79 moveal #__bss_start, %a0
80 moveal #_ebss, %a1 80 moveal #__bss_stop, %a1
81 81
82 /* Copy 0 to %a0 until %a0 >= %a1 */ 82 /* Copy 0 to %a0 until %a0 >= %a1 */
83L1: 83L1:
diff --git a/arch/m68k/platform/68328/head-rom.S b/arch/m68k/platform/68328/head-rom.S
index a5ff96d0295f..3dff98ba2e97 100644
--- a/arch/m68k/platform/68328/head-rom.S
+++ b/arch/m68k/platform/68328/head-rom.S
@@ -59,8 +59,8 @@ _stext: movew #0x2700,%sr
59 cmpal %a1, %a2 59 cmpal %a1, %a2
60 bhi 1b 60 bhi 1b
61 61
62 moveal #_sbss, %a0 62 moveal #__bss_start, %a0
63 moveal #_ebss, %a1 63 moveal #__bss_stop, %a1
64 /* Copy 0 to %a0 until %a0 == %a1 */ 64 /* Copy 0 to %a0 until %a0 == %a1 */
65 65
661: 661:
@@ -70,7 +70,7 @@ _stext: movew #0x2700,%sr
70 70
71 movel #_sdata, %d0 71 movel #_sdata, %d0
72 movel %d0, _rambase 72 movel %d0, _rambase
73 movel #_ebss, %d0 73 movel #__bss_stop, %d0
74 movel %d0, _ramstart 74 movel %d0, _ramstart
75 movel #RAMEND-CONFIG_MEMORY_RESERVE*0x100000, %d0 75 movel #RAMEND-CONFIG_MEMORY_RESERVE*0x100000, %d0
76 movel %d0, _ramend 76 movel %d0, _ramend
diff --git a/arch/m68k/platform/68360/head-ram.S b/arch/m68k/platform/68360/head-ram.S
index 8eb94fb6b971..acd213170d80 100644
--- a/arch/m68k/platform/68360/head-ram.S
+++ b/arch/m68k/platform/68360/head-ram.S
@@ -219,8 +219,8 @@ LD1:
219 cmp.l #_edata, %a1 219 cmp.l #_edata, %a1
220 blt LD1 220 blt LD1
221 221
222 moveal #_sbss, %a0 222 moveal #__bss_start, %a0
223 moveal #_ebss, %a1 223 moveal #__bss_stop, %a1
224 224
225 /* Copy 0 to %a0 until %a0 == %a1 */ 225 /* Copy 0 to %a0 until %a0 == %a1 */
226L1: 226L1:
@@ -234,7 +234,7 @@ load_quicc:
234store_ram_size: 234store_ram_size:
235 /* Set ram size information */ 235 /* Set ram size information */
236 move.l #_sdata, _rambase 236 move.l #_sdata, _rambase
237 move.l #_ebss, _ramstart 237 move.l #__bss_stop, _ramstart
238 move.l #RAMEND, %d0 238 move.l #RAMEND, %d0
239 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/ 239 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/
240 move.l %d0, _ramend /* Different from RAMEND.*/ 240 move.l %d0, _ramend /* Different from RAMEND.*/
diff --git a/arch/m68k/platform/68360/head-rom.S b/arch/m68k/platform/68360/head-rom.S
index 97510e55b802..dfc756d99886 100644
--- a/arch/m68k/platform/68360/head-rom.S
+++ b/arch/m68k/platform/68360/head-rom.S
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15.global _stext 15.global _stext
16.global _sbss 16.global __bss_start
17.global _start 17.global _start
18 18
19.global _rambase 19.global _rambase
@@ -229,8 +229,8 @@ LD1:
229 cmp.l #_edata, %a1 229 cmp.l #_edata, %a1
230 blt LD1 230 blt LD1
231 231
232 moveal #_sbss, %a0 232 moveal #__bss_start, %a0
233 moveal #_ebss, %a1 233 moveal #__bss_stop, %a1
234 234
235 /* Copy 0 to %a0 until %a0 == %a1 */ 235 /* Copy 0 to %a0 until %a0 == %a1 */
236L1: 236L1:
@@ -244,7 +244,7 @@ load_quicc:
244store_ram_size: 244store_ram_size:
245 /* Set ram size information */ 245 /* Set ram size information */
246 move.l #_sdata, _rambase 246 move.l #_sdata, _rambase
247 move.l #_ebss, _ramstart 247 move.l #__bss_stop, _ramstart
248 move.l #RAMEND, %d0 248 move.l #RAMEND, %d0
249 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/ 249 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/
250 move.l %d0, _ramend /* Different from RAMEND.*/ 250 move.l %d0, _ramend /* Different from RAMEND.*/
diff --git a/arch/m68k/platform/coldfire/head.S b/arch/m68k/platform/coldfire/head.S
index 4e0c9eb3bd1f..b88f5716f357 100644
--- a/arch/m68k/platform/coldfire/head.S
+++ b/arch/m68k/platform/coldfire/head.S
@@ -230,8 +230,8 @@ _vstart:
230 /* 230 /*
231 * Move ROM filesystem above bss :-) 231 * Move ROM filesystem above bss :-)
232 */ 232 */
233 lea _sbss,%a0 /* get start of bss */ 233 lea __bss_start,%a0 /* get start of bss */
234 lea _ebss,%a1 /* set up destination */ 234 lea __bss_stop,%a1 /* set up destination */
235 movel %a0,%a2 /* copy of bss start */ 235 movel %a0,%a2 /* copy of bss start */
236 236
237 movel 8(%a0),%d0 /* get size of ROMFS */ 237 movel 8(%a0),%d0 /* get size of ROMFS */
@@ -249,7 +249,7 @@ _copy_romfs:
249 bne _copy_romfs 249 bne _copy_romfs
250 250
251#else /* CONFIG_ROMFS_FS */ 251#else /* CONFIG_ROMFS_FS */
252 lea _ebss,%a1 252 lea __bss_stop,%a1
253 movel %a1,_ramstart 253 movel %a1,_ramstart
254#endif /* CONFIG_ROMFS_FS */ 254#endif /* CONFIG_ROMFS_FS */
255 255
@@ -257,8 +257,8 @@ _copy_romfs:
257 /* 257 /*
258 * Zero out the bss region. 258 * Zero out the bss region.
259 */ 259 */
260 lea _sbss,%a0 /* get start of bss */ 260 lea __bss_start,%a0 /* get start of bss */
261 lea _ebss,%a1 /* get end of bss */ 261 lea __bss_stop,%a1 /* get end of bss */
262 clrl %d0 /* set value */ 262 clrl %d0 /* set value */
263_clear_bss: 263_clear_bss:
264 movel %d0,(%a0)+ /* clear each word */ 264 movel %d0,(%a0)+ /* clear each word */
diff --git a/arch/m68k/sun3/prom/init.c b/arch/m68k/sun3/prom/init.c
index d8e6349336b4..eeba067d565f 100644
--- a/arch/m68k/sun3/prom/init.c
+++ b/arch/m68k/sun3/prom/init.c
@@ -22,57 +22,13 @@ int prom_root_node;
22struct linux_nodeops *prom_nodeops; 22struct linux_nodeops *prom_nodeops;
23 23
24/* You must call prom_init() before you attempt to use any of the 24/* You must call prom_init() before you attempt to use any of the
25 * routines in the prom library. It returns 0 on success, 1 on 25 * routines in the prom library.
26 * failure. It gets passed the pointer to the PROM vector. 26 * It gets passed the pointer to the PROM vector.
27 */ 27 */
28 28
29extern void prom_meminit(void);
30extern void prom_ranges_init(void);
31
32void __init prom_init(struct linux_romvec *rp) 29void __init prom_init(struct linux_romvec *rp)
33{ 30{
34 romvec = rp; 31 romvec = rp;
35#ifndef CONFIG_SUN3
36 switch(romvec->pv_romvers) {
37 case 0:
38 prom_vers = PROM_V0;
39 break;
40 case 2:
41 prom_vers = PROM_V2;
42 break;
43 case 3:
44 prom_vers = PROM_V3;
45 break;
46 case 4:
47 prom_vers = PROM_P1275;
48 prom_printf("PROMLIB: Sun IEEE Prom not supported yet\n");
49 prom_halt();
50 break;
51 default:
52 prom_printf("PROMLIB: Bad PROM version %d\n",
53 romvec->pv_romvers);
54 prom_halt();
55 break;
56 };
57
58 prom_rev = romvec->pv_plugin_revision;
59 prom_prev = romvec->pv_printrev;
60 prom_nodeops = romvec->pv_nodeops;
61
62 prom_root_node = prom_getsibling(0);
63 if((prom_root_node == 0) || (prom_root_node == -1))
64 prom_halt();
65
66 if((((unsigned long) prom_nodeops) == 0) ||
67 (((unsigned long) prom_nodeops) == -1))
68 prom_halt();
69
70 prom_meminit();
71
72 prom_ranges_init();
73#endif
74// printk("PROMLIB: Sun Boot Prom Version %d Revision %d\n",
75// romvec->pv_romvers, prom_rev);
76 32
77 /* Initialization successful. */ 33 /* Initialization successful. */
78 return; 34 return;
diff --git a/arch/microblaze/include/asm/sections.h b/arch/microblaze/include/asm/sections.h
index 4487e150b455..c07ed5d2a820 100644
--- a/arch/microblaze/include/asm/sections.h
+++ b/arch/microblaze/include/asm/sections.h
@@ -18,10 +18,6 @@ extern char _ssbss[], _esbss[];
18extern unsigned long __ivt_start[], __ivt_end[]; 18extern unsigned long __ivt_start[], __ivt_end[];
19extern char _etext[], _stext[]; 19extern char _etext[], _stext[];
20 20
21# ifdef CONFIG_MTD_UCLINUX
22extern char *_ebss;
23# endif
24
25extern u32 _fdt_start[], _fdt_end[]; 21extern u32 _fdt_start[], _fdt_end[];
26 22
27# endif /* !__ASSEMBLY__ */ 23# endif /* !__ASSEMBLY__ */
diff --git a/arch/microblaze/kernel/microblaze_ksyms.c b/arch/microblaze/kernel/microblaze_ksyms.c
index bb4907c828dc..2b25bcf05c00 100644
--- a/arch/microblaze/kernel/microblaze_ksyms.c
+++ b/arch/microblaze/kernel/microblaze_ksyms.c
@@ -21,9 +21,6 @@
21#include <linux/ftrace.h> 21#include <linux/ftrace.h>
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23 23
24extern char *_ebss;
25EXPORT_SYMBOL_GPL(_ebss);
26
27#ifdef CONFIG_FUNCTION_TRACER 24#ifdef CONFIG_FUNCTION_TRACER
28extern void _mcount(void); 25extern void _mcount(void);
29EXPORT_SYMBOL(_mcount); 26EXPORT_SYMBOL(_mcount);
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 16d8dfd9094b..4da971d4392f 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -121,7 +121,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
121 121
122 /* Move ROMFS out of BSS before clearing it */ 122 /* Move ROMFS out of BSS before clearing it */
123 if (romfs_size > 0) { 123 if (romfs_size > 0) {
124 memmove(&_ebss, (int *)romfs_base, romfs_size); 124 memmove(&__bss_stop, (int *)romfs_base, romfs_size);
125 klimit += romfs_size; 125 klimit += romfs_size;
126 } 126 }
127#endif 127#endif
@@ -165,7 +165,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
165 BUG_ON(romfs_size < 0); /* What else can we do? */ 165 BUG_ON(romfs_size < 0); /* What else can we do? */
166 166
167 printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", 167 printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",
168 romfs_size, romfs_base, (unsigned)&_ebss); 168 romfs_size, romfs_base, (unsigned)&__bss_stop);
169 169
170 printk("New klimit: 0x%08x\n", (unsigned)klimit); 170 printk("New klimit: 0x%08x\n", (unsigned)klimit);
171#endif 171#endif
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index 109e9d86ade4..936d01a689d7 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -131,7 +131,6 @@ SECTIONS {
131 *(COMMON) 131 *(COMMON)
132 . = ALIGN (4) ; 132 . = ALIGN (4) ;
133 __bss_stop = . ; 133 __bss_stop = . ;
134 _ebss = . ;
135 } 134 }
136 . = ALIGN(PAGE_SIZE); 135 . = ALIGN(PAGE_SIZE);
137 _end = .; 136 _end = .;
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 76de6b68487c..107610e01a29 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -124,6 +124,7 @@ config S390
124 select GENERIC_TIME_VSYSCALL 124 select GENERIC_TIME_VSYSCALL
125 select GENERIC_CLOCKEVENTS 125 select GENERIC_CLOCKEVENTS
126 select KTIME_SCALAR if 32BIT 126 select KTIME_SCALAR if 32BIT
127 select HAVE_ARCH_SECCOMP_FILTER
127 128
128config SCHED_OMIT_FRAME_POINTER 129config SCHED_OMIT_FRAME_POINTER
129 def_bool y 130 def_bool y
diff --git a/arch/s390/include/asm/sparsemem.h b/arch/s390/include/asm/sparsemem.h
index 0fb34027d3f6..a60d085ddb4d 100644
--- a/arch/s390/include/asm/sparsemem.h
+++ b/arch/s390/include/asm/sparsemem.h
@@ -4,13 +4,11 @@
4#ifdef CONFIG_64BIT 4#ifdef CONFIG_64BIT
5 5
6#define SECTION_SIZE_BITS 28 6#define SECTION_SIZE_BITS 28
7#define MAX_PHYSADDR_BITS 46
8#define MAX_PHYSMEM_BITS 46 7#define MAX_PHYSMEM_BITS 46
9 8
10#else 9#else
11 10
12#define SECTION_SIZE_BITS 25 11#define SECTION_SIZE_BITS 25
13#define MAX_PHYSADDR_BITS 31
14#define MAX_PHYSMEM_BITS 31 12#define MAX_PHYSMEM_BITS 31
15 13
16#endif /* CONFIG_64BIT */ 14#endif /* CONFIG_64BIT */
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index fb214dd9b7e0..fe7b99759e12 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -12,6 +12,7 @@
12#ifndef _ASM_SYSCALL_H 12#ifndef _ASM_SYSCALL_H
13#define _ASM_SYSCALL_H 1 13#define _ASM_SYSCALL_H 1
14 14
15#include <linux/audit.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/err.h> 17#include <linux/err.h>
17#include <asm/ptrace.h> 18#include <asm/ptrace.h>
@@ -87,4 +88,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
87 regs->orig_gpr2 = args[0]; 88 regs->orig_gpr2 = args[0];
88} 89}
89 90
91static inline int syscall_get_arch(struct task_struct *task,
92 struct pt_regs *regs)
93{
94#ifdef CONFIG_COMPAT
95 if (test_tsk_thread_flag(task, TIF_31BIT))
96 return AUDIT_ARCH_S390;
97#endif
98 return sizeof(long) == 8 ? AUDIT_ARCH_S390X : AUDIT_ARCH_S390;
99}
90#endif /* _ASM_SYSCALL_H */ 100#endif /* _ASM_SYSCALL_H */
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index d1225089a4bb..f606d935f495 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -620,7 +620,6 @@ asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
620 return -EFAULT; 620 return -EFAULT;
621 if (a.offset & ~PAGE_MASK) 621 if (a.offset & ~PAGE_MASK)
622 return -EINVAL; 622 return -EINVAL;
623 a.addr = (unsigned long) compat_ptr(a.addr);
624 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 623 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
625 a.offset >> PAGE_SHIFT); 624 a.offset >> PAGE_SHIFT);
626} 625}
@@ -631,7 +630,6 @@ asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
631 630
632 if (copy_from_user(&a, arg, sizeof(a))) 631 if (copy_from_user(&a, arg, sizeof(a)))
633 return -EFAULT; 632 return -EFAULT;
634 a.addr = (unsigned long) compat_ptr(a.addr);
635 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 633 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
636} 634}
637 635
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index e835d6d5b7fd..2d82cfcbce5b 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1635,7 +1635,7 @@ ENTRY(compat_sys_process_vm_readv_wrapper)
1635 llgfr %r6,%r6 # unsigned long 1635 llgfr %r6,%r6 # unsigned long
1636 llgf %r0,164(%r15) # unsigned long 1636 llgf %r0,164(%r15) # unsigned long
1637 stg %r0,160(%r15) 1637 stg %r0,160(%r15)
1638 jg sys_process_vm_readv 1638 jg compat_sys_process_vm_readv
1639 1639
1640ENTRY(compat_sys_process_vm_writev_wrapper) 1640ENTRY(compat_sys_process_vm_writev_wrapper)
1641 lgfr %r2,%r2 # compat_pid_t 1641 lgfr %r2,%r2 # compat_pid_t
@@ -1645,4 +1645,4 @@ ENTRY(compat_sys_process_vm_writev_wrapper)
1645 llgfr %r6,%r6 # unsigned long 1645 llgfr %r6,%r6 # unsigned long
1646 llgf %r0,164(%r15) # unsigned long 1646 llgf %r0,164(%r15) # unsigned long
1647 stg %r0,160(%r15) 1647 stg %r0,160(%r15)
1648 jg sys_process_vm_writev 1648 jg compat_sys_process_vm_writev
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f4eb37680b91..e4be113fbac6 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -719,7 +719,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
719 long ret = 0; 719 long ret = 0;
720 720
721 /* Do the secure computing check first. */ 721 /* Do the secure computing check first. */
722 secure_computing_strict(regs->gprs[2]); 722 if (secure_computing(regs->gprs[2])) {
723 /* seccomp failures shouldn't expose any additional code. */
724 ret = -1;
725 goto out;
726 }
723 727
724 /* 728 /*
725 * The sysc_tracesys code in entry.S stored the system 729 * The sysc_tracesys code in entry.S stored the system
@@ -745,6 +749,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
745 regs->gprs[2], regs->orig_gpr2, 749 regs->gprs[2], regs->orig_gpr2,
746 regs->gprs[3], regs->gprs[4], 750 regs->gprs[3], regs->gprs[4],
747 regs->gprs[5]); 751 regs->gprs[5]);
752out:
748 return ret ?: regs->gprs[2]; 753 return ret ?: regs->gprs[2];
749} 754}
750 755
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index b4a29eee41b8..d0964d22adb5 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -81,11 +81,12 @@ SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
81{ 81{
82 unsigned int ret; 82 unsigned int ret;
83 83
84 if (current->personality == PER_LINUX32 && personality == PER_LINUX) 84 if (personality(current->personality) == PER_LINUX32 &&
85 personality = PER_LINUX32; 85 personality(personality) == PER_LINUX)
86 personality |= PER_LINUX32;
86 ret = sys_personality(personality); 87 ret = sys_personality(personality);
87 if (ret == PER_LINUX32) 88 if (personality(ret) == PER_LINUX32)
88 ret = PER_LINUX; 89 ret &= ~PER_LINUX32;
89 90
90 return ret; 91 return ret;
91} 92}
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 4c171f13b0e8..b22565623142 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -335,7 +335,7 @@ static int dmae_irq_init(void)
335 335
336 for (n = 0; n < NR_DMAE; n++) { 336 for (n = 0; n < NR_DMAE; n++) {
337 int i = request_irq(get_dma_error_irq(n), dma_err, 337 int i = request_irq(get_dma_error_irq(n), dma_err,
338 IRQF_SHARED, dmae_name[n], NULL); 338 IRQF_SHARED, dmae_name[n], (void *)dmae_name[n]);
339 if (unlikely(i < 0)) { 339 if (unlikely(i < 0)) {
340 printk(KERN_ERR "%s request_irq fail\n", dmae_name[n]); 340 printk(KERN_ERR "%s request_irq fail\n", dmae_name[n]);
341 return i; 341 return i;
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h
index 4a5350037c8f..1b6199740e98 100644
--- a/arch/sh/include/asm/sections.h
+++ b/arch/sh/include/asm/sections.h
@@ -6,7 +6,6 @@
6extern long __nosave_begin, __nosave_end; 6extern long __nosave_begin, __nosave_end;
7extern long __machvec_start, __machvec_end; 7extern long __machvec_start, __machvec_end;
8extern char __uncached_start, __uncached_end; 8extern char __uncached_start, __uncached_end;
9extern char _ebss[];
10extern char __start_eh_frame[], __stop_eh_frame[]; 9extern char __start_eh_frame[], __stop_eh_frame[];
11 10
12#endif /* __ASM_SH_SECTIONS_H */ 11#endif /* __ASM_SH_SECTIONS_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/sh7269.h b/arch/sh/include/cpu-sh2a/cpu/sh7269.h
index 48d14498e774..2a0ca8780f0d 100644
--- a/arch/sh/include/cpu-sh2a/cpu/sh7269.h
+++ b/arch/sh/include/cpu-sh2a/cpu/sh7269.h
@@ -183,18 +183,30 @@ enum {
183 GPIO_FN_DV_DATA1, GPIO_FN_DV_DATA0, 183 GPIO_FN_DV_DATA1, GPIO_FN_DV_DATA0,
184 GPIO_FN_LCD_CLK, GPIO_FN_LCD_EXTCLK, 184 GPIO_FN_LCD_CLK, GPIO_FN_LCD_EXTCLK,
185 GPIO_FN_LCD_VSYNC, GPIO_FN_LCD_HSYNC, GPIO_FN_LCD_DE, 185 GPIO_FN_LCD_VSYNC, GPIO_FN_LCD_HSYNC, GPIO_FN_LCD_DE,
186 GPIO_FN_LCD_DATA23, GPIO_FN_LCD_DATA22, 186 GPIO_FN_LCD_DATA23_PG23, GPIO_FN_LCD_DATA22_PG22,
187 GPIO_FN_LCD_DATA21, GPIO_FN_LCD_DATA20, 187 GPIO_FN_LCD_DATA21_PG21, GPIO_FN_LCD_DATA20_PG20,
188 GPIO_FN_LCD_DATA19, GPIO_FN_LCD_DATA18, 188 GPIO_FN_LCD_DATA19_PG19, GPIO_FN_LCD_DATA18_PG18,
189 GPIO_FN_LCD_DATA17, GPIO_FN_LCD_DATA16, 189 GPIO_FN_LCD_DATA17_PG17, GPIO_FN_LCD_DATA16_PG16,
190 GPIO_FN_LCD_DATA15, GPIO_FN_LCD_DATA14, 190 GPIO_FN_LCD_DATA15_PG15, GPIO_FN_LCD_DATA14_PG14,
191 GPIO_FN_LCD_DATA13, GPIO_FN_LCD_DATA12, 191 GPIO_FN_LCD_DATA13_PG13, GPIO_FN_LCD_DATA12_PG12,
192 GPIO_FN_LCD_DATA11, GPIO_FN_LCD_DATA10, 192 GPIO_FN_LCD_DATA11_PG11, GPIO_FN_LCD_DATA10_PG10,
193 GPIO_FN_LCD_DATA9, GPIO_FN_LCD_DATA8, 193 GPIO_FN_LCD_DATA9_PG9, GPIO_FN_LCD_DATA8_PG8,
194 GPIO_FN_LCD_DATA7, GPIO_FN_LCD_DATA6, 194 GPIO_FN_LCD_DATA7_PG7, GPIO_FN_LCD_DATA6_PG6,
195 GPIO_FN_LCD_DATA5, GPIO_FN_LCD_DATA4, 195 GPIO_FN_LCD_DATA5_PG5, GPIO_FN_LCD_DATA4_PG4,
196 GPIO_FN_LCD_DATA3, GPIO_FN_LCD_DATA2, 196 GPIO_FN_LCD_DATA3_PG3, GPIO_FN_LCD_DATA2_PG2,
197 GPIO_FN_LCD_DATA1, GPIO_FN_LCD_DATA0, 197 GPIO_FN_LCD_DATA1_PG1, GPIO_FN_LCD_DATA0_PG0,
198 GPIO_FN_LCD_DATA23_PJ23, GPIO_FN_LCD_DATA22_PJ22,
199 GPIO_FN_LCD_DATA21_PJ21, GPIO_FN_LCD_DATA20_PJ20,
200 GPIO_FN_LCD_DATA19_PJ19, GPIO_FN_LCD_DATA18_PJ18,
201 GPIO_FN_LCD_DATA17_PJ17, GPIO_FN_LCD_DATA16_PJ16,
202 GPIO_FN_LCD_DATA15_PJ15, GPIO_FN_LCD_DATA14_PJ14,
203 GPIO_FN_LCD_DATA13_PJ13, GPIO_FN_LCD_DATA12_PJ12,
204 GPIO_FN_LCD_DATA11_PJ11, GPIO_FN_LCD_DATA10_PJ10,
205 GPIO_FN_LCD_DATA9_PJ9, GPIO_FN_LCD_DATA8_PJ8,
206 GPIO_FN_LCD_DATA7_PJ7, GPIO_FN_LCD_DATA6_PJ6,
207 GPIO_FN_LCD_DATA5_PJ5, GPIO_FN_LCD_DATA4_PJ4,
208 GPIO_FN_LCD_DATA3_PJ3, GPIO_FN_LCD_DATA2_PJ2,
209 GPIO_FN_LCD_DATA1_PJ1, GPIO_FN_LCD_DATA0_PJ0,
198 GPIO_FN_LCD_M_DISP, 210 GPIO_FN_LCD_M_DISP,
199}; 211};
200 212
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
index f25127c46eca..039e4587dd9b 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
@@ -758,12 +758,22 @@ enum {
758 DV_DATA3_MARK, DV_DATA2_MARK, DV_DATA1_MARK, DV_DATA0_MARK, 758 DV_DATA3_MARK, DV_DATA2_MARK, DV_DATA1_MARK, DV_DATA0_MARK,
759 LCD_CLK_MARK, LCD_EXTCLK_MARK, 759 LCD_CLK_MARK, LCD_EXTCLK_MARK,
760 LCD_VSYNC_MARK, LCD_HSYNC_MARK, LCD_DE_MARK, 760 LCD_VSYNC_MARK, LCD_HSYNC_MARK, LCD_DE_MARK,
761 LCD_DATA23_MARK, LCD_DATA22_MARK, LCD_DATA21_MARK, LCD_DATA20_MARK, 761 LCD_DATA23_PG23_MARK, LCD_DATA22_PG22_MARK, LCD_DATA21_PG21_MARK,
762 LCD_DATA19_MARK, LCD_DATA18_MARK, LCD_DATA17_MARK, LCD_DATA16_MARK, 762 LCD_DATA20_PG20_MARK, LCD_DATA19_PG19_MARK, LCD_DATA18_PG18_MARK,
763 LCD_DATA15_MARK, LCD_DATA14_MARK, LCD_DATA13_MARK, LCD_DATA12_MARK, 763 LCD_DATA17_PG17_MARK, LCD_DATA16_PG16_MARK, LCD_DATA15_PG15_MARK,
764 LCD_DATA11_MARK, LCD_DATA10_MARK, LCD_DATA9_MARK, LCD_DATA8_MARK, 764 LCD_DATA14_PG14_MARK, LCD_DATA13_PG13_MARK, LCD_DATA12_PG12_MARK,
765 LCD_DATA7_MARK, LCD_DATA6_MARK, LCD_DATA5_MARK, LCD_DATA4_MARK, 765 LCD_DATA11_PG11_MARK, LCD_DATA10_PG10_MARK, LCD_DATA9_PG9_MARK,
766 LCD_DATA3_MARK, LCD_DATA2_MARK, LCD_DATA1_MARK, LCD_DATA0_MARK, 766 LCD_DATA8_PG8_MARK, LCD_DATA7_PG7_MARK, LCD_DATA6_PG6_MARK,
767 LCD_DATA5_PG5_MARK, LCD_DATA4_PG4_MARK, LCD_DATA3_PG3_MARK,
768 LCD_DATA2_PG2_MARK, LCD_DATA1_PG1_MARK, LCD_DATA0_PG0_MARK,
769 LCD_DATA23_PJ23_MARK, LCD_DATA22_PJ22_MARK, LCD_DATA21_PJ21_MARK,
770 LCD_DATA20_PJ20_MARK, LCD_DATA19_PJ19_MARK, LCD_DATA18_PJ18_MARK,
771 LCD_DATA17_PJ17_MARK, LCD_DATA16_PJ16_MARK, LCD_DATA15_PJ15_MARK,
772 LCD_DATA14_PJ14_MARK, LCD_DATA13_PJ13_MARK, LCD_DATA12_PJ12_MARK,
773 LCD_DATA11_PJ11_MARK, LCD_DATA10_PJ10_MARK, LCD_DATA9_PJ9_MARK,
774 LCD_DATA8_PJ8_MARK, LCD_DATA7_PJ7_MARK, LCD_DATA6_PJ6_MARK,
775 LCD_DATA5_PJ5_MARK, LCD_DATA4_PJ4_MARK, LCD_DATA3_PJ3_MARK,
776 LCD_DATA2_PJ2_MARK, LCD_DATA1_PJ1_MARK, LCD_DATA0_PJ0_MARK,
767 LCD_TCON6_MARK, LCD_TCON5_MARK, LCD_TCON4_MARK, 777 LCD_TCON6_MARK, LCD_TCON5_MARK, LCD_TCON4_MARK,
768 LCD_TCON3_MARK, LCD_TCON2_MARK, LCD_TCON1_MARK, LCD_TCON0_MARK, 778 LCD_TCON3_MARK, LCD_TCON2_MARK, LCD_TCON1_MARK, LCD_TCON0_MARK,
769 LCD_M_DISP_MARK, 779 LCD_M_DISP_MARK,
@@ -1036,6 +1046,7 @@ static pinmux_enum_t pinmux_data[] = {
1036 1046
1037 PINMUX_DATA(PF1_DATA, PF1MD_000), 1047 PINMUX_DATA(PF1_DATA, PF1MD_000),
1038 PINMUX_DATA(BACK_MARK, PF1MD_001), 1048 PINMUX_DATA(BACK_MARK, PF1MD_001),
1049 PINMUX_DATA(SSL10_MARK, PF1MD_011),
1039 PINMUX_DATA(TIOC4B_MARK, PF1MD_100), 1050 PINMUX_DATA(TIOC4B_MARK, PF1MD_100),
1040 PINMUX_DATA(DACK0_MARK, PF1MD_101), 1051 PINMUX_DATA(DACK0_MARK, PF1MD_101),
1041 1052
@@ -1049,47 +1060,50 @@ static pinmux_enum_t pinmux_data[] = {
1049 PINMUX_DATA(PG27_DATA, PG27MD_00), 1060 PINMUX_DATA(PG27_DATA, PG27MD_00),
1050 PINMUX_DATA(LCD_TCON2_MARK, PG27MD_10), 1061 PINMUX_DATA(LCD_TCON2_MARK, PG27MD_10),
1051 PINMUX_DATA(LCD_EXTCLK_MARK, PG27MD_11), 1062 PINMUX_DATA(LCD_EXTCLK_MARK, PG27MD_11),
1063 PINMUX_DATA(LCD_DE_MARK, PG27MD_11),
1052 1064
1053 PINMUX_DATA(PG26_DATA, PG26MD_00), 1065 PINMUX_DATA(PG26_DATA, PG26MD_00),
1054 PINMUX_DATA(LCD_TCON1_MARK, PG26MD_10), 1066 PINMUX_DATA(LCD_TCON1_MARK, PG26MD_10),
1067 PINMUX_DATA(LCD_HSYNC_MARK, PG26MD_10),
1055 1068
1056 PINMUX_DATA(PG25_DATA, PG25MD_00), 1069 PINMUX_DATA(PG25_DATA, PG25MD_00),
1057 PINMUX_DATA(LCD_TCON0_MARK, PG25MD_10), 1070 PINMUX_DATA(LCD_TCON0_MARK, PG25MD_10),
1071 PINMUX_DATA(LCD_VSYNC_MARK, PG25MD_10),
1058 1072
1059 PINMUX_DATA(PG24_DATA, PG24MD_00), 1073 PINMUX_DATA(PG24_DATA, PG24MD_00),
1060 PINMUX_DATA(LCD_CLK_MARK, PG24MD_10), 1074 PINMUX_DATA(LCD_CLK_MARK, PG24MD_10),
1061 1075
1062 PINMUX_DATA(PG23_DATA, PG23MD_000), 1076 PINMUX_DATA(PG23_DATA, PG23MD_000),
1063 PINMUX_DATA(LCD_DATA23_MARK, PG23MD_010), 1077 PINMUX_DATA(LCD_DATA23_PG23_MARK, PG23MD_010),
1064 PINMUX_DATA(LCD_TCON6_MARK, PG23MD_011), 1078 PINMUX_DATA(LCD_TCON6_MARK, PG23MD_011),
1065 PINMUX_DATA(TXD5_MARK, PG23MD_100), 1079 PINMUX_DATA(TXD5_MARK, PG23MD_100),
1066 1080
1067 PINMUX_DATA(PG22_DATA, PG22MD_000), 1081 PINMUX_DATA(PG22_DATA, PG22MD_000),
1068 PINMUX_DATA(LCD_DATA22_MARK, PG22MD_010), 1082 PINMUX_DATA(LCD_DATA22_PG22_MARK, PG22MD_010),
1069 PINMUX_DATA(LCD_TCON5_MARK, PG22MD_011), 1083 PINMUX_DATA(LCD_TCON5_MARK, PG22MD_011),
1070 PINMUX_DATA(RXD5_MARK, PG22MD_100), 1084 PINMUX_DATA(RXD5_MARK, PG22MD_100),
1071 1085
1072 PINMUX_DATA(PG21_DATA, PG21MD_000), 1086 PINMUX_DATA(PG21_DATA, PG21MD_000),
1073 PINMUX_DATA(DV_DATA7_MARK, PG21MD_001), 1087 PINMUX_DATA(DV_DATA7_MARK, PG21MD_001),
1074 PINMUX_DATA(LCD_DATA21_MARK, PG21MD_010), 1088 PINMUX_DATA(LCD_DATA21_PG21_MARK, PG21MD_010),
1075 PINMUX_DATA(LCD_TCON4_MARK, PG21MD_011), 1089 PINMUX_DATA(LCD_TCON4_MARK, PG21MD_011),
1076 PINMUX_DATA(TXD4_MARK, PG21MD_100), 1090 PINMUX_DATA(TXD4_MARK, PG21MD_100),
1077 1091
1078 PINMUX_DATA(PG20_DATA, PG20MD_000), 1092 PINMUX_DATA(PG20_DATA, PG20MD_000),
1079 PINMUX_DATA(DV_DATA6_MARK, PG20MD_001), 1093 PINMUX_DATA(DV_DATA6_MARK, PG20MD_001),
1080 PINMUX_DATA(LCD_DATA20_MARK, PG21MD_010), 1094 PINMUX_DATA(LCD_DATA20_PG20_MARK, PG21MD_010),
1081 PINMUX_DATA(LCD_TCON3_MARK, PG20MD_011), 1095 PINMUX_DATA(LCD_TCON3_MARK, PG20MD_011),
1082 PINMUX_DATA(RXD4_MARK, PG20MD_100), 1096 PINMUX_DATA(RXD4_MARK, PG20MD_100),
1083 1097
1084 PINMUX_DATA(PG19_DATA, PG19MD_000), 1098 PINMUX_DATA(PG19_DATA, PG19MD_000),
1085 PINMUX_DATA(DV_DATA5_MARK, PG19MD_001), 1099 PINMUX_DATA(DV_DATA5_MARK, PG19MD_001),
1086 PINMUX_DATA(LCD_DATA19_MARK, PG19MD_010), 1100 PINMUX_DATA(LCD_DATA19_PG19_MARK, PG19MD_010),
1087 PINMUX_DATA(SPDIF_OUT_MARK, PG19MD_011), 1101 PINMUX_DATA(SPDIF_OUT_MARK, PG19MD_011),
1088 PINMUX_DATA(SCK5_MARK, PG19MD_100), 1102 PINMUX_DATA(SCK5_MARK, PG19MD_100),
1089 1103
1090 PINMUX_DATA(PG18_DATA, PG18MD_000), 1104 PINMUX_DATA(PG18_DATA, PG18MD_000),
1091 PINMUX_DATA(DV_DATA4_MARK, PG18MD_001), 1105 PINMUX_DATA(DV_DATA4_MARK, PG18MD_001),
1092 PINMUX_DATA(LCD_DATA18_MARK, PG18MD_010), 1106 PINMUX_DATA(LCD_DATA18_PG18_MARK, PG18MD_010),
1093 PINMUX_DATA(SPDIF_IN_MARK, PG18MD_011), 1107 PINMUX_DATA(SPDIF_IN_MARK, PG18MD_011),
1094 PINMUX_DATA(SCK4_MARK, PG18MD_100), 1108 PINMUX_DATA(SCK4_MARK, PG18MD_100),
1095 1109
@@ -1097,103 +1111,103 @@ static pinmux_enum_t pinmux_data[] = {
1097// we're going with 2 bits 1111// we're going with 2 bits
1098 PINMUX_DATA(PG17_DATA, PG17MD_00), 1112 PINMUX_DATA(PG17_DATA, PG17MD_00),
1099 PINMUX_DATA(WE3ICIOWRAHDQMUU_MARK, PG17MD_01), 1113 PINMUX_DATA(WE3ICIOWRAHDQMUU_MARK, PG17MD_01),
1100 PINMUX_DATA(LCD_DATA17_MARK, PG17MD_10), 1114 PINMUX_DATA(LCD_DATA17_PG17_MARK, PG17MD_10),
1101 1115
1102// TODO hardware manual has PG16 3 bits wide in reg picture and 2 bits in description 1116// TODO hardware manual has PG16 3 bits wide in reg picture and 2 bits in description
1103// we're going with 2 bits 1117// we're going with 2 bits
1104 PINMUX_DATA(PG16_DATA, PG16MD_00), 1118 PINMUX_DATA(PG16_DATA, PG16MD_00),
1105 PINMUX_DATA(WE2ICIORDDQMUL_MARK, PG16MD_01), 1119 PINMUX_DATA(WE2ICIORDDQMUL_MARK, PG16MD_01),
1106 PINMUX_DATA(LCD_DATA16_MARK, PG16MD_10), 1120 PINMUX_DATA(LCD_DATA16_PG16_MARK, PG16MD_10),
1107 1121
1108 PINMUX_DATA(PG15_DATA, PG15MD_00), 1122 PINMUX_DATA(PG15_DATA, PG15MD_00),
1109 PINMUX_DATA(D31_MARK, PG15MD_01), 1123 PINMUX_DATA(D31_MARK, PG15MD_01),
1110 PINMUX_DATA(LCD_DATA15_MARK, PG15MD_10), 1124 PINMUX_DATA(LCD_DATA15_PG15_MARK, PG15MD_10),
1111 PINMUX_DATA(PINT7_PG_MARK, PG15MD_11), 1125 PINMUX_DATA(PINT7_PG_MARK, PG15MD_11),
1112 1126
1113 PINMUX_DATA(PG14_DATA, PG14MD_00), 1127 PINMUX_DATA(PG14_DATA, PG14MD_00),
1114 PINMUX_DATA(D30_MARK, PG14MD_01), 1128 PINMUX_DATA(D30_MARK, PG14MD_01),
1115 PINMUX_DATA(LCD_DATA14_MARK, PG14MD_10), 1129 PINMUX_DATA(LCD_DATA14_PG14_MARK, PG14MD_10),
1116 PINMUX_DATA(PINT6_PG_MARK, PG14MD_11), 1130 PINMUX_DATA(PINT6_PG_MARK, PG14MD_11),
1117 1131
1118 PINMUX_DATA(PG13_DATA, PG13MD_00), 1132 PINMUX_DATA(PG13_DATA, PG13MD_00),
1119 PINMUX_DATA(D29_MARK, PG13MD_01), 1133 PINMUX_DATA(D29_MARK, PG13MD_01),
1120 PINMUX_DATA(LCD_DATA13_MARK, PG13MD_10), 1134 PINMUX_DATA(LCD_DATA13_PG13_MARK, PG13MD_10),
1121 PINMUX_DATA(PINT5_PG_MARK, PG13MD_11), 1135 PINMUX_DATA(PINT5_PG_MARK, PG13MD_11),
1122 1136
1123 PINMUX_DATA(PG12_DATA, PG12MD_00), 1137 PINMUX_DATA(PG12_DATA, PG12MD_00),
1124 PINMUX_DATA(D28_MARK, PG12MD_01), 1138 PINMUX_DATA(D28_MARK, PG12MD_01),
1125 PINMUX_DATA(LCD_DATA12_MARK, PG12MD_10), 1139 PINMUX_DATA(LCD_DATA12_PG12_MARK, PG12MD_10),
1126 PINMUX_DATA(PINT4_PG_MARK, PG12MD_11), 1140 PINMUX_DATA(PINT4_PG_MARK, PG12MD_11),
1127 1141
1128 PINMUX_DATA(PG11_DATA, PG11MD_000), 1142 PINMUX_DATA(PG11_DATA, PG11MD_000),
1129 PINMUX_DATA(D27_MARK, PG11MD_001), 1143 PINMUX_DATA(D27_MARK, PG11MD_001),
1130 PINMUX_DATA(LCD_DATA11_MARK, PG11MD_010), 1144 PINMUX_DATA(LCD_DATA11_PG11_MARK, PG11MD_010),
1131 PINMUX_DATA(PINT3_PG_MARK, PG11MD_011), 1145 PINMUX_DATA(PINT3_PG_MARK, PG11MD_011),
1132 PINMUX_DATA(TIOC3D_MARK, PG11MD_100), 1146 PINMUX_DATA(TIOC3D_MARK, PG11MD_100),
1133 1147
1134 PINMUX_DATA(PG10_DATA, PG10MD_000), 1148 PINMUX_DATA(PG10_DATA, PG10MD_000),
1135 PINMUX_DATA(D26_MARK, PG10MD_001), 1149 PINMUX_DATA(D26_MARK, PG10MD_001),
1136 PINMUX_DATA(LCD_DATA10_MARK, PG10MD_010), 1150 PINMUX_DATA(LCD_DATA10_PG10_MARK, PG10MD_010),
1137 PINMUX_DATA(PINT2_PG_MARK, PG10MD_011), 1151 PINMUX_DATA(PINT2_PG_MARK, PG10MD_011),
1138 PINMUX_DATA(TIOC3C_MARK, PG10MD_100), 1152 PINMUX_DATA(TIOC3C_MARK, PG10MD_100),
1139 1153
1140 PINMUX_DATA(PG9_DATA, PG9MD_000), 1154 PINMUX_DATA(PG9_DATA, PG9MD_000),
1141 PINMUX_DATA(D25_MARK, PG9MD_001), 1155 PINMUX_DATA(D25_MARK, PG9MD_001),
1142 PINMUX_DATA(LCD_DATA9_MARK, PG9MD_010), 1156 PINMUX_DATA(LCD_DATA9_PG9_MARK, PG9MD_010),
1143 PINMUX_DATA(PINT1_PG_MARK, PG9MD_011), 1157 PINMUX_DATA(PINT1_PG_MARK, PG9MD_011),
1144 PINMUX_DATA(TIOC3B_MARK, PG9MD_100), 1158 PINMUX_DATA(TIOC3B_MARK, PG9MD_100),
1145 1159
1146 PINMUX_DATA(PG8_DATA, PG8MD_000), 1160 PINMUX_DATA(PG8_DATA, PG8MD_000),
1147 PINMUX_DATA(D24_MARK, PG8MD_001), 1161 PINMUX_DATA(D24_MARK, PG8MD_001),
1148 PINMUX_DATA(LCD_DATA8_MARK, PG8MD_010), 1162 PINMUX_DATA(LCD_DATA8_PG8_MARK, PG8MD_010),
1149 PINMUX_DATA(PINT0_PG_MARK, PG8MD_011), 1163 PINMUX_DATA(PINT0_PG_MARK, PG8MD_011),
1150 PINMUX_DATA(TIOC3A_MARK, PG8MD_100), 1164 PINMUX_DATA(TIOC3A_MARK, PG8MD_100),
1151 1165
1152 PINMUX_DATA(PG7_DATA, PG7MD_000), 1166 PINMUX_DATA(PG7_DATA, PG7MD_000),
1153 PINMUX_DATA(D23_MARK, PG7MD_001), 1167 PINMUX_DATA(D23_MARK, PG7MD_001),
1154 PINMUX_DATA(LCD_DATA7_MARK, PG7MD_010), 1168 PINMUX_DATA(LCD_DATA7_PG7_MARK, PG7MD_010),
1155 PINMUX_DATA(IRQ7_PG_MARK, PG7MD_011), 1169 PINMUX_DATA(IRQ7_PG_MARK, PG7MD_011),
1156 PINMUX_DATA(TIOC2B_MARK, PG7MD_100), 1170 PINMUX_DATA(TIOC2B_MARK, PG7MD_100),
1157 1171
1158 PINMUX_DATA(PG6_DATA, PG6MD_000), 1172 PINMUX_DATA(PG6_DATA, PG6MD_000),
1159 PINMUX_DATA(D22_MARK, PG6MD_001), 1173 PINMUX_DATA(D22_MARK, PG6MD_001),
1160 PINMUX_DATA(LCD_DATA6_MARK, PG6MD_010), 1174 PINMUX_DATA(LCD_DATA6_PG6_MARK, PG6MD_010),
1161 PINMUX_DATA(IRQ6_PG_MARK, PG6MD_011), 1175 PINMUX_DATA(IRQ6_PG_MARK, PG6MD_011),
1162 PINMUX_DATA(TIOC2A_MARK, PG6MD_100), 1176 PINMUX_DATA(TIOC2A_MARK, PG6MD_100),
1163 1177
1164 PINMUX_DATA(PG5_DATA, PG5MD_000), 1178 PINMUX_DATA(PG5_DATA, PG5MD_000),
1165 PINMUX_DATA(D21_MARK, PG5MD_001), 1179 PINMUX_DATA(D21_MARK, PG5MD_001),
1166 PINMUX_DATA(LCD_DATA5_MARK, PG5MD_010), 1180 PINMUX_DATA(LCD_DATA5_PG5_MARK, PG5MD_010),
1167 PINMUX_DATA(IRQ5_PG_MARK, PG5MD_011), 1181 PINMUX_DATA(IRQ5_PG_MARK, PG5MD_011),
1168 PINMUX_DATA(TIOC1B_MARK, PG5MD_100), 1182 PINMUX_DATA(TIOC1B_MARK, PG5MD_100),
1169 1183
1170 PINMUX_DATA(PG4_DATA, PG4MD_000), 1184 PINMUX_DATA(PG4_DATA, PG4MD_000),
1171 PINMUX_DATA(D20_MARK, PG4MD_001), 1185 PINMUX_DATA(D20_MARK, PG4MD_001),
1172 PINMUX_DATA(LCD_DATA4_MARK, PG4MD_010), 1186 PINMUX_DATA(LCD_DATA4_PG4_MARK, PG4MD_010),
1173 PINMUX_DATA(IRQ4_PG_MARK, PG4MD_011), 1187 PINMUX_DATA(IRQ4_PG_MARK, PG4MD_011),
1174 PINMUX_DATA(TIOC1A_MARK, PG4MD_100), 1188 PINMUX_DATA(TIOC1A_MARK, PG4MD_100),
1175 1189
1176 PINMUX_DATA(PG3_DATA, PG3MD_000), 1190 PINMUX_DATA(PG3_DATA, PG3MD_000),
1177 PINMUX_DATA(D19_MARK, PG3MD_001), 1191 PINMUX_DATA(D19_MARK, PG3MD_001),
1178 PINMUX_DATA(LCD_DATA3_MARK, PG3MD_010), 1192 PINMUX_DATA(LCD_DATA3_PG3_MARK, PG3MD_010),
1179 PINMUX_DATA(IRQ3_PG_MARK, PG3MD_011), 1193 PINMUX_DATA(IRQ3_PG_MARK, PG3MD_011),
1180 PINMUX_DATA(TIOC0D_MARK, PG3MD_100), 1194 PINMUX_DATA(TIOC0D_MARK, PG3MD_100),
1181 1195
1182 PINMUX_DATA(PG2_DATA, PG2MD_000), 1196 PINMUX_DATA(PG2_DATA, PG2MD_000),
1183 PINMUX_DATA(D18_MARK, PG2MD_001), 1197 PINMUX_DATA(D18_MARK, PG2MD_001),
1184 PINMUX_DATA(LCD_DATA2_MARK, PG2MD_010), 1198 PINMUX_DATA(LCD_DATA2_PG2_MARK, PG2MD_010),
1185 PINMUX_DATA(IRQ2_PG_MARK, PG2MD_011), 1199 PINMUX_DATA(IRQ2_PG_MARK, PG2MD_011),
1186 PINMUX_DATA(TIOC0C_MARK, PG2MD_100), 1200 PINMUX_DATA(TIOC0C_MARK, PG2MD_100),
1187 1201
1188 PINMUX_DATA(PG1_DATA, PG1MD_000), 1202 PINMUX_DATA(PG1_DATA, PG1MD_000),
1189 PINMUX_DATA(D17_MARK, PG1MD_001), 1203 PINMUX_DATA(D17_MARK, PG1MD_001),
1190 PINMUX_DATA(LCD_DATA1_MARK, PG1MD_010), 1204 PINMUX_DATA(LCD_DATA1_PG1_MARK, PG1MD_010),
1191 PINMUX_DATA(IRQ1_PG_MARK, PG1MD_011), 1205 PINMUX_DATA(IRQ1_PG_MARK, PG1MD_011),
1192 PINMUX_DATA(TIOC0B_MARK, PG1MD_100), 1206 PINMUX_DATA(TIOC0B_MARK, PG1MD_100),
1193 1207
1194 PINMUX_DATA(PG0_DATA, PG0MD_000), 1208 PINMUX_DATA(PG0_DATA, PG0MD_000),
1195 PINMUX_DATA(D16_MARK, PG0MD_001), 1209 PINMUX_DATA(D16_MARK, PG0MD_001),
1196 PINMUX_DATA(LCD_DATA0_MARK, PG0MD_010), 1210 PINMUX_DATA(LCD_DATA0_PG0_MARK, PG0MD_010),
1197 PINMUX_DATA(IRQ0_PG_MARK, PG0MD_011), 1211 PINMUX_DATA(IRQ0_PG_MARK, PG0MD_011),
1198 PINMUX_DATA(TIOC0A_MARK, PG0MD_100), 1212 PINMUX_DATA(TIOC0A_MARK, PG0MD_100),
1199 1213
@@ -1275,14 +1289,14 @@ static pinmux_enum_t pinmux_data[] = {
1275 1289
1276 PINMUX_DATA(PJ23_DATA, PJ23MD_000), 1290 PINMUX_DATA(PJ23_DATA, PJ23MD_000),
1277 PINMUX_DATA(DV_DATA23_MARK, PJ23MD_001), 1291 PINMUX_DATA(DV_DATA23_MARK, PJ23MD_001),
1278 PINMUX_DATA(LCD_DATA23_MARK, PJ23MD_010), 1292 PINMUX_DATA(LCD_DATA23_PJ23_MARK, PJ23MD_010),
1279 PINMUX_DATA(LCD_TCON6_MARK, PJ23MD_011), 1293 PINMUX_DATA(LCD_TCON6_MARK, PJ23MD_011),
1280 PINMUX_DATA(IRQ3_PJ_MARK, PJ23MD_100), 1294 PINMUX_DATA(IRQ3_PJ_MARK, PJ23MD_100),
1281 PINMUX_DATA(CTX1_MARK, PJ23MD_101), 1295 PINMUX_DATA(CTX1_MARK, PJ23MD_101),
1282 1296
1283 PINMUX_DATA(PJ22_DATA, PJ22MD_000), 1297 PINMUX_DATA(PJ22_DATA, PJ22MD_000),
1284 PINMUX_DATA(DV_DATA22_MARK, PJ22MD_001), 1298 PINMUX_DATA(DV_DATA22_MARK, PJ22MD_001),
1285 PINMUX_DATA(LCD_DATA22_MARK, PJ22MD_010), 1299 PINMUX_DATA(LCD_DATA22_PJ22_MARK, PJ22MD_010),
1286 PINMUX_DATA(LCD_TCON5_MARK, PJ22MD_011), 1300 PINMUX_DATA(LCD_TCON5_MARK, PJ22MD_011),
1287 PINMUX_DATA(IRQ2_PJ_MARK, PJ22MD_100), 1301 PINMUX_DATA(IRQ2_PJ_MARK, PJ22MD_100),
1288 PINMUX_DATA(CRX1_MARK, PJ22MD_101), 1302 PINMUX_DATA(CRX1_MARK, PJ22MD_101),
@@ -1290,14 +1304,14 @@ static pinmux_enum_t pinmux_data[] = {
1290 1304
1291 PINMUX_DATA(PJ21_DATA, PJ21MD_000), 1305 PINMUX_DATA(PJ21_DATA, PJ21MD_000),
1292 PINMUX_DATA(DV_DATA21_MARK, PJ21MD_001), 1306 PINMUX_DATA(DV_DATA21_MARK, PJ21MD_001),
1293 PINMUX_DATA(LCD_DATA21_MARK, PJ21MD_010), 1307 PINMUX_DATA(LCD_DATA21_PJ21_MARK, PJ21MD_010),
1294 PINMUX_DATA(LCD_TCON4_MARK, PJ21MD_011), 1308 PINMUX_DATA(LCD_TCON4_MARK, PJ21MD_011),
1295 PINMUX_DATA(IRQ1_PJ_MARK, PJ21MD_100), 1309 PINMUX_DATA(IRQ1_PJ_MARK, PJ21MD_100),
1296 PINMUX_DATA(CTX2_MARK, PJ21MD_101), 1310 PINMUX_DATA(CTX2_MARK, PJ21MD_101),
1297 1311
1298 PINMUX_DATA(PJ20_DATA, PJ20MD_000), 1312 PINMUX_DATA(PJ20_DATA, PJ20MD_000),
1299 PINMUX_DATA(DV_DATA20_MARK, PJ20MD_001), 1313 PINMUX_DATA(DV_DATA20_MARK, PJ20MD_001),
1300 PINMUX_DATA(LCD_DATA20_MARK, PJ20MD_010), 1314 PINMUX_DATA(LCD_DATA20_PJ20_MARK, PJ20MD_010),
1301 PINMUX_DATA(LCD_TCON3_MARK, PJ20MD_011), 1315 PINMUX_DATA(LCD_TCON3_MARK, PJ20MD_011),
1302 PINMUX_DATA(IRQ0_PJ_MARK, PJ20MD_100), 1316 PINMUX_DATA(IRQ0_PJ_MARK, PJ20MD_100),
1303 PINMUX_DATA(CRX2_MARK, PJ20MD_101), 1317 PINMUX_DATA(CRX2_MARK, PJ20MD_101),
@@ -1305,7 +1319,7 @@ static pinmux_enum_t pinmux_data[] = {
1305 1319
1306 PINMUX_DATA(PJ19_DATA, PJ19MD_000), 1320 PINMUX_DATA(PJ19_DATA, PJ19MD_000),
1307 PINMUX_DATA(DV_DATA19_MARK, PJ19MD_001), 1321 PINMUX_DATA(DV_DATA19_MARK, PJ19MD_001),
1308 PINMUX_DATA(LCD_DATA19_MARK, PJ19MD_010), 1322 PINMUX_DATA(LCD_DATA19_PJ19_MARK, PJ19MD_010),
1309 PINMUX_DATA(MISO0_PJ19_MARK, PJ19MD_011), 1323 PINMUX_DATA(MISO0_PJ19_MARK, PJ19MD_011),
1310 PINMUX_DATA(TIOC0D_MARK, PJ19MD_100), 1324 PINMUX_DATA(TIOC0D_MARK, PJ19MD_100),
1311 PINMUX_DATA(SIOFRXD_MARK, PJ19MD_101), 1325 PINMUX_DATA(SIOFRXD_MARK, PJ19MD_101),
@@ -1313,126 +1327,126 @@ static pinmux_enum_t pinmux_data[] = {
1313 1327
1314 PINMUX_DATA(PJ18_DATA, PJ18MD_000), 1328 PINMUX_DATA(PJ18_DATA, PJ18MD_000),
1315 PINMUX_DATA(DV_DATA18_MARK, PJ18MD_001), 1329 PINMUX_DATA(DV_DATA18_MARK, PJ18MD_001),
1316 PINMUX_DATA(LCD_DATA18_MARK, PJ18MD_010), 1330 PINMUX_DATA(LCD_DATA18_PJ18_MARK, PJ18MD_010),
1317 PINMUX_DATA(MOSI0_PJ18_MARK, PJ18MD_011), 1331 PINMUX_DATA(MOSI0_PJ18_MARK, PJ18MD_011),
1318 PINMUX_DATA(TIOC0C_MARK, PJ18MD_100), 1332 PINMUX_DATA(TIOC0C_MARK, PJ18MD_100),
1319 PINMUX_DATA(SIOFTXD_MARK, PJ18MD_101), 1333 PINMUX_DATA(SIOFTXD_MARK, PJ18MD_101),
1320 1334
1321 PINMUX_DATA(PJ17_DATA, PJ17MD_000), 1335 PINMUX_DATA(PJ17_DATA, PJ17MD_000),
1322 PINMUX_DATA(DV_DATA17_MARK, PJ17MD_001), 1336 PINMUX_DATA(DV_DATA17_MARK, PJ17MD_001),
1323 PINMUX_DATA(LCD_DATA17_MARK, PJ17MD_010), 1337 PINMUX_DATA(LCD_DATA17_PJ17_MARK, PJ17MD_010),
1324 PINMUX_DATA(SSL00_PJ17_MARK, PJ17MD_011), 1338 PINMUX_DATA(SSL00_PJ17_MARK, PJ17MD_011),
1325 PINMUX_DATA(TIOC0B_MARK, PJ17MD_100), 1339 PINMUX_DATA(TIOC0B_MARK, PJ17MD_100),
1326 PINMUX_DATA(SIOFSYNC_MARK, PJ17MD_101), 1340 PINMUX_DATA(SIOFSYNC_MARK, PJ17MD_101),
1327 1341
1328 PINMUX_DATA(PJ16_DATA, PJ16MD_000), 1342 PINMUX_DATA(PJ16_DATA, PJ16MD_000),
1329 PINMUX_DATA(DV_DATA16_MARK, PJ16MD_001), 1343 PINMUX_DATA(DV_DATA16_MARK, PJ16MD_001),
1330 PINMUX_DATA(LCD_DATA16_MARK, PJ16MD_010), 1344 PINMUX_DATA(LCD_DATA16_PJ16_MARK, PJ16MD_010),
1331 PINMUX_DATA(RSPCK0_PJ16_MARK, PJ16MD_011), 1345 PINMUX_DATA(RSPCK0_PJ16_MARK, PJ16MD_011),
1332 PINMUX_DATA(TIOC0A_MARK, PJ16MD_100), 1346 PINMUX_DATA(TIOC0A_MARK, PJ16MD_100),
1333 PINMUX_DATA(SIOFSCK_MARK, PJ16MD_101), 1347 PINMUX_DATA(SIOFSCK_MARK, PJ16MD_101),
1334 1348
1335 PINMUX_DATA(PJ15_DATA, PJ15MD_000), 1349 PINMUX_DATA(PJ15_DATA, PJ15MD_000),
1336 PINMUX_DATA(DV_DATA15_MARK, PJ15MD_001), 1350 PINMUX_DATA(DV_DATA15_MARK, PJ15MD_001),
1337 PINMUX_DATA(LCD_DATA15_MARK, PJ15MD_010), 1351 PINMUX_DATA(LCD_DATA15_PJ15_MARK, PJ15MD_010),
1338 PINMUX_DATA(PINT7_PJ_MARK, PJ15MD_011), 1352 PINMUX_DATA(PINT7_PJ_MARK, PJ15MD_011),
1339 PINMUX_DATA(PWM2H_MARK, PJ15MD_100), 1353 PINMUX_DATA(PWM2H_MARK, PJ15MD_100),
1340 PINMUX_DATA(TXD7_MARK, PJ15MD_101), 1354 PINMUX_DATA(TXD7_MARK, PJ15MD_101),
1341 1355
1342 PINMUX_DATA(PJ14_DATA, PJ14MD_000), 1356 PINMUX_DATA(PJ14_DATA, PJ14MD_000),
1343 PINMUX_DATA(DV_DATA14_MARK, PJ14MD_001), 1357 PINMUX_DATA(DV_DATA14_MARK, PJ14MD_001),
1344 PINMUX_DATA(LCD_DATA14_MARK, PJ14MD_010), 1358 PINMUX_DATA(LCD_DATA14_PJ14_MARK, PJ14MD_010),
1345 PINMUX_DATA(PINT6_PJ_MARK, PJ14MD_011), 1359 PINMUX_DATA(PINT6_PJ_MARK, PJ14MD_011),
1346 PINMUX_DATA(PWM2G_MARK, PJ14MD_100), 1360 PINMUX_DATA(PWM2G_MARK, PJ14MD_100),
1347 PINMUX_DATA(TXD6_MARK, PJ14MD_101), 1361 PINMUX_DATA(TXD6_MARK, PJ14MD_101),
1348 1362
1349 PINMUX_DATA(PJ13_DATA, PJ13MD_000), 1363 PINMUX_DATA(PJ13_DATA, PJ13MD_000),
1350 PINMUX_DATA(DV_DATA13_MARK, PJ13MD_001), 1364 PINMUX_DATA(DV_DATA13_MARK, PJ13MD_001),
1351 PINMUX_DATA(LCD_DATA13_MARK, PJ13MD_010), 1365 PINMUX_DATA(LCD_DATA13_PJ13_MARK, PJ13MD_010),
1352 PINMUX_DATA(PINT5_PJ_MARK, PJ13MD_011), 1366 PINMUX_DATA(PINT5_PJ_MARK, PJ13MD_011),
1353 PINMUX_DATA(PWM2F_MARK, PJ13MD_100), 1367 PINMUX_DATA(PWM2F_MARK, PJ13MD_100),
1354 PINMUX_DATA(TXD5_MARK, PJ13MD_101), 1368 PINMUX_DATA(TXD5_MARK, PJ13MD_101),
1355 1369
1356 PINMUX_DATA(PJ12_DATA, PJ12MD_000), 1370 PINMUX_DATA(PJ12_DATA, PJ12MD_000),
1357 PINMUX_DATA(DV_DATA12_MARK, PJ12MD_001), 1371 PINMUX_DATA(DV_DATA12_MARK, PJ12MD_001),
1358 PINMUX_DATA(LCD_DATA12_MARK, PJ12MD_010), 1372 PINMUX_DATA(LCD_DATA12_PJ12_MARK, PJ12MD_010),
1359 PINMUX_DATA(PINT4_PJ_MARK, PJ12MD_011), 1373 PINMUX_DATA(PINT4_PJ_MARK, PJ12MD_011),
1360 PINMUX_DATA(PWM2E_MARK, PJ12MD_100), 1374 PINMUX_DATA(PWM2E_MARK, PJ12MD_100),
1361 PINMUX_DATA(SCK7_MARK, PJ12MD_101), 1375 PINMUX_DATA(SCK7_MARK, PJ12MD_101),
1362 1376
1363 PINMUX_DATA(PJ11_DATA, PJ11MD_000), 1377 PINMUX_DATA(PJ11_DATA, PJ11MD_000),
1364 PINMUX_DATA(DV_DATA11_MARK, PJ11MD_001), 1378 PINMUX_DATA(DV_DATA11_MARK, PJ11MD_001),
1365 PINMUX_DATA(LCD_DATA11_MARK, PJ11MD_010), 1379 PINMUX_DATA(LCD_DATA11_PJ11_MARK, PJ11MD_010),
1366 PINMUX_DATA(PINT3_PJ_MARK, PJ11MD_011), 1380 PINMUX_DATA(PINT3_PJ_MARK, PJ11MD_011),
1367 PINMUX_DATA(PWM2D_MARK, PJ11MD_100), 1381 PINMUX_DATA(PWM2D_MARK, PJ11MD_100),
1368 PINMUX_DATA(SCK6_MARK, PJ11MD_101), 1382 PINMUX_DATA(SCK6_MARK, PJ11MD_101),
1369 1383
1370 PINMUX_DATA(PJ10_DATA, PJ10MD_000), 1384 PINMUX_DATA(PJ10_DATA, PJ10MD_000),
1371 PINMUX_DATA(DV_DATA10_MARK, PJ10MD_001), 1385 PINMUX_DATA(DV_DATA10_MARK, PJ10MD_001),
1372 PINMUX_DATA(LCD_DATA10_MARK, PJ10MD_010), 1386 PINMUX_DATA(LCD_DATA10_PJ10_MARK, PJ10MD_010),
1373 PINMUX_DATA(PINT2_PJ_MARK, PJ10MD_011), 1387 PINMUX_DATA(PINT2_PJ_MARK, PJ10MD_011),
1374 PINMUX_DATA(PWM2C_MARK, PJ10MD_100), 1388 PINMUX_DATA(PWM2C_MARK, PJ10MD_100),
1375 PINMUX_DATA(SCK5_MARK, PJ10MD_101), 1389 PINMUX_DATA(SCK5_MARK, PJ10MD_101),
1376 1390
1377 PINMUX_DATA(PJ9_DATA, PJ9MD_000), 1391 PINMUX_DATA(PJ9_DATA, PJ9MD_000),
1378 PINMUX_DATA(DV_DATA9_MARK, PJ9MD_001), 1392 PINMUX_DATA(DV_DATA9_MARK, PJ9MD_001),
1379 PINMUX_DATA(LCD_DATA9_MARK, PJ9MD_010), 1393 PINMUX_DATA(LCD_DATA9_PJ9_MARK, PJ9MD_010),
1380 PINMUX_DATA(PINT1_PJ_MARK, PJ9MD_011), 1394 PINMUX_DATA(PINT1_PJ_MARK, PJ9MD_011),
1381 PINMUX_DATA(PWM2B_MARK, PJ9MD_100), 1395 PINMUX_DATA(PWM2B_MARK, PJ9MD_100),
1382 PINMUX_DATA(RTS5_MARK, PJ9MD_101), 1396 PINMUX_DATA(RTS5_MARK, PJ9MD_101),
1383 1397
1384 PINMUX_DATA(PJ8_DATA, PJ8MD_000), 1398 PINMUX_DATA(PJ8_DATA, PJ8MD_000),
1385 PINMUX_DATA(DV_DATA8_MARK, PJ8MD_001), 1399 PINMUX_DATA(DV_DATA8_MARK, PJ8MD_001),
1386 PINMUX_DATA(LCD_DATA8_MARK, PJ8MD_010), 1400 PINMUX_DATA(LCD_DATA8_PJ8_MARK, PJ8MD_010),
1387 PINMUX_DATA(PINT0_PJ_MARK, PJ8MD_011), 1401 PINMUX_DATA(PINT0_PJ_MARK, PJ8MD_011),
1388 PINMUX_DATA(PWM2A_MARK, PJ8MD_100), 1402 PINMUX_DATA(PWM2A_MARK, PJ8MD_100),
1389 PINMUX_DATA(CTS5_MARK, PJ8MD_101), 1403 PINMUX_DATA(CTS5_MARK, PJ8MD_101),
1390 1404
1391 PINMUX_DATA(PJ7_DATA, PJ7MD_000), 1405 PINMUX_DATA(PJ7_DATA, PJ7MD_000),
1392 PINMUX_DATA(DV_DATA7_MARK, PJ7MD_001), 1406 PINMUX_DATA(DV_DATA7_MARK, PJ7MD_001),
1393 PINMUX_DATA(LCD_DATA7_MARK, PJ7MD_010), 1407 PINMUX_DATA(LCD_DATA7_PJ7_MARK, PJ7MD_010),
1394 PINMUX_DATA(SD_D2_MARK, PJ7MD_011), 1408 PINMUX_DATA(SD_D2_MARK, PJ7MD_011),
1395 PINMUX_DATA(PWM1H_MARK, PJ7MD_100), 1409 PINMUX_DATA(PWM1H_MARK, PJ7MD_100),
1396 1410
1397 PINMUX_DATA(PJ6_DATA, PJ6MD_000), 1411 PINMUX_DATA(PJ6_DATA, PJ6MD_000),
1398 PINMUX_DATA(DV_DATA6_MARK, PJ6MD_001), 1412 PINMUX_DATA(DV_DATA6_MARK, PJ6MD_001),
1399 PINMUX_DATA(LCD_DATA6_MARK, PJ6MD_010), 1413 PINMUX_DATA(LCD_DATA6_PJ6_MARK, PJ6MD_010),
1400 PINMUX_DATA(SD_D3_MARK, PJ6MD_011), 1414 PINMUX_DATA(SD_D3_MARK, PJ6MD_011),
1401 PINMUX_DATA(PWM1G_MARK, PJ6MD_100), 1415 PINMUX_DATA(PWM1G_MARK, PJ6MD_100),
1402 1416
1403 PINMUX_DATA(PJ5_DATA, PJ5MD_000), 1417 PINMUX_DATA(PJ5_DATA, PJ5MD_000),
1404 PINMUX_DATA(DV_DATA5_MARK, PJ5MD_001), 1418 PINMUX_DATA(DV_DATA5_MARK, PJ5MD_001),
1405 PINMUX_DATA(LCD_DATA5_MARK, PJ5MD_010), 1419 PINMUX_DATA(LCD_DATA5_PJ5_MARK, PJ5MD_010),
1406 PINMUX_DATA(SD_CMD_MARK, PJ5MD_011), 1420 PINMUX_DATA(SD_CMD_MARK, PJ5MD_011),
1407 PINMUX_DATA(PWM1F_MARK, PJ5MD_100), 1421 PINMUX_DATA(PWM1F_MARK, PJ5MD_100),
1408 1422
1409 PINMUX_DATA(PJ4_DATA, PJ4MD_000), 1423 PINMUX_DATA(PJ4_DATA, PJ4MD_000),
1410 PINMUX_DATA(DV_DATA4_MARK, PJ4MD_001), 1424 PINMUX_DATA(DV_DATA4_MARK, PJ4MD_001),
1411 PINMUX_DATA(LCD_DATA4_MARK, PJ4MD_010), 1425 PINMUX_DATA(LCD_DATA4_PJ4_MARK, PJ4MD_010),
1412 PINMUX_DATA(SD_CLK_MARK, PJ4MD_011), 1426 PINMUX_DATA(SD_CLK_MARK, PJ4MD_011),
1413 PINMUX_DATA(PWM1E_MARK, PJ4MD_100), 1427 PINMUX_DATA(PWM1E_MARK, PJ4MD_100),
1414 1428
1415 PINMUX_DATA(PJ3_DATA, PJ3MD_000), 1429 PINMUX_DATA(PJ3_DATA, PJ3MD_000),
1416 PINMUX_DATA(DV_DATA3_MARK, PJ3MD_001), 1430 PINMUX_DATA(DV_DATA3_MARK, PJ3MD_001),
1417 PINMUX_DATA(LCD_DATA3_MARK, PJ3MD_010), 1431 PINMUX_DATA(LCD_DATA3_PJ3_MARK, PJ3MD_010),
1418 PINMUX_DATA(SD_D0_MARK, PJ3MD_011), 1432 PINMUX_DATA(SD_D0_MARK, PJ3MD_011),
1419 PINMUX_DATA(PWM1D_MARK, PJ3MD_100), 1433 PINMUX_DATA(PWM1D_MARK, PJ3MD_100),
1420 1434
1421 PINMUX_DATA(PJ2_DATA, PJ2MD_000), 1435 PINMUX_DATA(PJ2_DATA, PJ2MD_000),
1422 PINMUX_DATA(DV_DATA2_MARK, PJ2MD_001), 1436 PINMUX_DATA(DV_DATA2_MARK, PJ2MD_001),
1423 PINMUX_DATA(LCD_DATA2_MARK, PJ2MD_010), 1437 PINMUX_DATA(LCD_DATA2_PJ2_MARK, PJ2MD_010),
1424 PINMUX_DATA(SD_D1_MARK, PJ2MD_011), 1438 PINMUX_DATA(SD_D1_MARK, PJ2MD_011),
1425 PINMUX_DATA(PWM1C_MARK, PJ2MD_100), 1439 PINMUX_DATA(PWM1C_MARK, PJ2MD_100),
1426 1440
1427 PINMUX_DATA(PJ1_DATA, PJ1MD_000), 1441 PINMUX_DATA(PJ1_DATA, PJ1MD_000),
1428 PINMUX_DATA(DV_DATA1_MARK, PJ1MD_001), 1442 PINMUX_DATA(DV_DATA1_MARK, PJ1MD_001),
1429 PINMUX_DATA(LCD_DATA1_MARK, PJ1MD_010), 1443 PINMUX_DATA(LCD_DATA1_PJ1_MARK, PJ1MD_010),
1430 PINMUX_DATA(SD_WP_MARK, PJ1MD_011), 1444 PINMUX_DATA(SD_WP_MARK, PJ1MD_011),
1431 PINMUX_DATA(PWM1B_MARK, PJ1MD_100), 1445 PINMUX_DATA(PWM1B_MARK, PJ1MD_100),
1432 1446
1433 PINMUX_DATA(PJ0_DATA, PJ0MD_000), 1447 PINMUX_DATA(PJ0_DATA, PJ0MD_000),
1434 PINMUX_DATA(DV_DATA0_MARK, PJ0MD_001), 1448 PINMUX_DATA(DV_DATA0_MARK, PJ0MD_001),
1435 PINMUX_DATA(LCD_DATA0_MARK, PJ0MD_010), 1449 PINMUX_DATA(LCD_DATA0_PJ0_MARK, PJ0MD_010),
1436 PINMUX_DATA(SD_CD_MARK, PJ0MD_011), 1450 PINMUX_DATA(SD_CD_MARK, PJ0MD_011),
1437 PINMUX_DATA(PWM1A_MARK, PJ0MD_100), 1451 PINMUX_DATA(PWM1A_MARK, PJ0MD_100),
1438}; 1452};
@@ -1877,30 +1891,55 @@ static struct pinmux_gpio pinmux_gpios[] = {
1877 PINMUX_GPIO(GPIO_FN_LCD_HSYNC, LCD_HSYNC_MARK), 1891 PINMUX_GPIO(GPIO_FN_LCD_HSYNC, LCD_HSYNC_MARK),
1878 PINMUX_GPIO(GPIO_FN_LCD_DE, LCD_DE_MARK), 1892 PINMUX_GPIO(GPIO_FN_LCD_DE, LCD_DE_MARK),
1879 1893
1880 PINMUX_GPIO(GPIO_FN_LCD_DATA23, LCD_DATA23_MARK), 1894 PINMUX_GPIO(GPIO_FN_LCD_DATA23_PG23, LCD_DATA23_PG23_MARK),
1881 PINMUX_GPIO(GPIO_FN_LCD_DATA22, LCD_DATA22_MARK), 1895 PINMUX_GPIO(GPIO_FN_LCD_DATA22_PG22, LCD_DATA22_PG22_MARK),
1882 PINMUX_GPIO(GPIO_FN_LCD_DATA21, LCD_DATA21_MARK), 1896 PINMUX_GPIO(GPIO_FN_LCD_DATA21_PG21, LCD_DATA21_PG21_MARK),
1883 PINMUX_GPIO(GPIO_FN_LCD_DATA20, LCD_DATA20_MARK), 1897 PINMUX_GPIO(GPIO_FN_LCD_DATA20_PG20, LCD_DATA20_PG20_MARK),
1884 PINMUX_GPIO(GPIO_FN_LCD_DATA19, LCD_DATA19_MARK), 1898 PINMUX_GPIO(GPIO_FN_LCD_DATA19_PG19, LCD_DATA19_PG19_MARK),
1885 PINMUX_GPIO(GPIO_FN_LCD_DATA18, LCD_DATA18_MARK), 1899 PINMUX_GPIO(GPIO_FN_LCD_DATA18_PG18, LCD_DATA18_PG18_MARK),
1886 PINMUX_GPIO(GPIO_FN_LCD_DATA17, LCD_DATA17_MARK), 1900 PINMUX_GPIO(GPIO_FN_LCD_DATA17_PG17, LCD_DATA17_PG17_MARK),
1887 PINMUX_GPIO(GPIO_FN_LCD_DATA16, LCD_DATA16_MARK), 1901 PINMUX_GPIO(GPIO_FN_LCD_DATA16_PG16, LCD_DATA16_PG16_MARK),
1888 PINMUX_GPIO(GPIO_FN_LCD_DATA15, LCD_DATA15_MARK), 1902 PINMUX_GPIO(GPIO_FN_LCD_DATA15_PG15, LCD_DATA15_PG15_MARK),
1889 PINMUX_GPIO(GPIO_FN_LCD_DATA14, LCD_DATA14_MARK), 1903 PINMUX_GPIO(GPIO_FN_LCD_DATA14_PG14, LCD_DATA14_PG14_MARK),
1890 PINMUX_GPIO(GPIO_FN_LCD_DATA13, LCD_DATA13_MARK), 1904 PINMUX_GPIO(GPIO_FN_LCD_DATA13_PG13, LCD_DATA13_PG13_MARK),
1891 PINMUX_GPIO(GPIO_FN_LCD_DATA12, LCD_DATA12_MARK), 1905 PINMUX_GPIO(GPIO_FN_LCD_DATA12_PG12, LCD_DATA12_PG12_MARK),
1892 PINMUX_GPIO(GPIO_FN_LCD_DATA11, LCD_DATA11_MARK), 1906 PINMUX_GPIO(GPIO_FN_LCD_DATA11_PG11, LCD_DATA11_PG11_MARK),
1893 PINMUX_GPIO(GPIO_FN_LCD_DATA10, LCD_DATA10_MARK), 1907 PINMUX_GPIO(GPIO_FN_LCD_DATA10_PG10, LCD_DATA10_PG10_MARK),
1894 PINMUX_GPIO(GPIO_FN_LCD_DATA9, LCD_DATA9_MARK), 1908 PINMUX_GPIO(GPIO_FN_LCD_DATA9_PG9, LCD_DATA9_PG9_MARK),
1895 PINMUX_GPIO(GPIO_FN_LCD_DATA8, LCD_DATA8_MARK), 1909 PINMUX_GPIO(GPIO_FN_LCD_DATA8_PG8, LCD_DATA8_PG8_MARK),
1896 PINMUX_GPIO(GPIO_FN_LCD_DATA7, LCD_DATA7_MARK), 1910 PINMUX_GPIO(GPIO_FN_LCD_DATA7_PG7, LCD_DATA7_PG7_MARK),
1897 PINMUX_GPIO(GPIO_FN_LCD_DATA6, LCD_DATA6_MARK), 1911 PINMUX_GPIO(GPIO_FN_LCD_DATA6_PG6, LCD_DATA6_PG6_MARK),
1898 PINMUX_GPIO(GPIO_FN_LCD_DATA5, LCD_DATA5_MARK), 1912 PINMUX_GPIO(GPIO_FN_LCD_DATA5_PG5, LCD_DATA5_PG5_MARK),
1899 PINMUX_GPIO(GPIO_FN_LCD_DATA4, LCD_DATA4_MARK), 1913 PINMUX_GPIO(GPIO_FN_LCD_DATA4_PG4, LCD_DATA4_PG4_MARK),
1900 PINMUX_GPIO(GPIO_FN_LCD_DATA3, LCD_DATA3_MARK), 1914 PINMUX_GPIO(GPIO_FN_LCD_DATA3_PG3, LCD_DATA3_PG3_MARK),
1901 PINMUX_GPIO(GPIO_FN_LCD_DATA2, LCD_DATA2_MARK), 1915 PINMUX_GPIO(GPIO_FN_LCD_DATA2_PG2, LCD_DATA2_PG2_MARK),
1902 PINMUX_GPIO(GPIO_FN_LCD_DATA1, LCD_DATA1_MARK), 1916 PINMUX_GPIO(GPIO_FN_LCD_DATA1_PG1, LCD_DATA1_PG1_MARK),
1903 PINMUX_GPIO(GPIO_FN_LCD_DATA0, LCD_DATA0_MARK), 1917 PINMUX_GPIO(GPIO_FN_LCD_DATA0_PG0, LCD_DATA0_PG0_MARK),
1918
1919 PINMUX_GPIO(GPIO_FN_LCD_DATA23_PJ23, LCD_DATA23_PJ23_MARK),
1920 PINMUX_GPIO(GPIO_FN_LCD_DATA22_PJ22, LCD_DATA22_PJ22_MARK),
1921 PINMUX_GPIO(GPIO_FN_LCD_DATA21_PJ21, LCD_DATA21_PJ21_MARK),
1922 PINMUX_GPIO(GPIO_FN_LCD_DATA20_PJ20, LCD_DATA20_PJ20_MARK),
1923 PINMUX_GPIO(GPIO_FN_LCD_DATA19_PJ19, LCD_DATA19_PJ19_MARK),
1924 PINMUX_GPIO(GPIO_FN_LCD_DATA18_PJ18, LCD_DATA18_PJ18_MARK),
1925 PINMUX_GPIO(GPIO_FN_LCD_DATA17_PJ17, LCD_DATA17_PJ17_MARK),
1926 PINMUX_GPIO(GPIO_FN_LCD_DATA16_PJ16, LCD_DATA16_PJ16_MARK),
1927 PINMUX_GPIO(GPIO_FN_LCD_DATA15_PJ15, LCD_DATA15_PJ15_MARK),
1928 PINMUX_GPIO(GPIO_FN_LCD_DATA14_PJ14, LCD_DATA14_PJ14_MARK),
1929 PINMUX_GPIO(GPIO_FN_LCD_DATA13_PJ13, LCD_DATA13_PJ13_MARK),
1930 PINMUX_GPIO(GPIO_FN_LCD_DATA12_PJ12, LCD_DATA12_PJ12_MARK),
1931 PINMUX_GPIO(GPIO_FN_LCD_DATA11_PJ11, LCD_DATA11_PJ11_MARK),
1932 PINMUX_GPIO(GPIO_FN_LCD_DATA10_PJ10, LCD_DATA10_PJ10_MARK),
1933 PINMUX_GPIO(GPIO_FN_LCD_DATA9_PJ9, LCD_DATA9_PJ9_MARK),
1934 PINMUX_GPIO(GPIO_FN_LCD_DATA8_PJ8, LCD_DATA8_PJ8_MARK),
1935 PINMUX_GPIO(GPIO_FN_LCD_DATA7_PJ7, LCD_DATA7_PJ7_MARK),
1936 PINMUX_GPIO(GPIO_FN_LCD_DATA6_PJ6, LCD_DATA6_PJ6_MARK),
1937 PINMUX_GPIO(GPIO_FN_LCD_DATA5_PJ5, LCD_DATA5_PJ5_MARK),
1938 PINMUX_GPIO(GPIO_FN_LCD_DATA4_PJ4, LCD_DATA4_PJ4_MARK),
1939 PINMUX_GPIO(GPIO_FN_LCD_DATA3_PJ3, LCD_DATA3_PJ3_MARK),
1940 PINMUX_GPIO(GPIO_FN_LCD_DATA2_PJ2, LCD_DATA2_PJ2_MARK),
1941 PINMUX_GPIO(GPIO_FN_LCD_DATA1_PJ1, LCD_DATA1_PJ1_MARK),
1942 PINMUX_GPIO(GPIO_FN_LCD_DATA0_PJ0, LCD_DATA0_PJ0_MARK),
1904 1943
1905 PINMUX_GPIO(GPIO_FN_LCD_M_DISP, LCD_M_DISP_MARK), 1944 PINMUX_GPIO(GPIO_FN_LCD_M_DISP, LCD_M_DISP_MARK),
1906}; 1945};
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 7b57bf1dc855..ebe7a7d97215 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -273,7 +273,7 @@ void __init setup_arch(char **cmdline_p)
273 data_resource.start = virt_to_phys(_etext); 273 data_resource.start = virt_to_phys(_etext);
274 data_resource.end = virt_to_phys(_edata)-1; 274 data_resource.end = virt_to_phys(_edata)-1;
275 bss_resource.start = virt_to_phys(__bss_start); 275 bss_resource.start = virt_to_phys(__bss_start);
276 bss_resource.end = virt_to_phys(_ebss)-1; 276 bss_resource.end = virt_to_phys(__bss_stop)-1;
277 277
278#ifdef CONFIG_CMDLINE_OVERWRITE 278#ifdef CONFIG_CMDLINE_OVERWRITE
279 strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line)); 279 strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index 3896f26efa4a..2a0a596ebf67 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -19,7 +19,6 @@ EXPORT_SYMBOL(csum_partial);
19EXPORT_SYMBOL(csum_partial_copy_generic); 19EXPORT_SYMBOL(csum_partial_copy_generic);
20EXPORT_SYMBOL(copy_page); 20EXPORT_SYMBOL(copy_page);
21EXPORT_SYMBOL(__clear_user); 21EXPORT_SYMBOL(__clear_user);
22EXPORT_SYMBOL(_ebss);
23EXPORT_SYMBOL(empty_zero_page); 22EXPORT_SYMBOL(empty_zero_page);
24 23
25#define DECLARE_EXPORT(name) \ 24#define DECLARE_EXPORT(name) \
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index c98905f71e28..db88cbf9eafd 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -78,7 +78,6 @@ SECTIONS
78 . = ALIGN(PAGE_SIZE); 78 . = ALIGN(PAGE_SIZE);
79 __init_end = .; 79 __init_end = .;
80 BSS_SECTION(0, PAGE_SIZE, 4) 80 BSS_SECTION(0, PAGE_SIZE, 4)
81 _ebss = .; /* uClinux MTD sucks */
82 _end = . ; 81 _end = . ;
83 82
84 STABS_DEBUG 83 STABS_DEBUG
diff --git a/arch/sh/lib/mcount.S b/arch/sh/lib/mcount.S
index 84a57761f17e..60164e65d665 100644
--- a/arch/sh/lib/mcount.S
+++ b/arch/sh/lib/mcount.S
@@ -39,7 +39,7 @@
39 * 39 *
40 * Make sure the stack pointer contains a valid address. Valid 40 * Make sure the stack pointer contains a valid address. Valid
41 * addresses for kernel stacks are anywhere after the bss 41 * addresses for kernel stacks are anywhere after the bss
42 * (after _ebss) and anywhere in init_thread_union (init_stack). 42 * (after __bss_stop) and anywhere in init_thread_union (init_stack).
43 */ 43 */
44#define STACK_CHECK() \ 44#define STACK_CHECK() \
45 mov #(THREAD_SIZE >> 10), r0; \ 45 mov #(THREAD_SIZE >> 10), r0; \
@@ -60,7 +60,7 @@
60 cmp/hi r2, r1; \ 60 cmp/hi r2, r1; \
61 bf stack_panic; \ 61 bf stack_panic; \
62 \ 62 \
63 /* If sp > _ebss then we're OK. */ \ 63 /* If sp > __bss_stop then we're OK. */ \
64 mov.l .L_ebss, r1; \ 64 mov.l .L_ebss, r1; \
65 cmp/hi r1, r15; \ 65 cmp/hi r1, r15; \
66 bt 1f; \ 66 bt 1f; \
@@ -70,7 +70,7 @@
70 cmp/hs r1, r15; \ 70 cmp/hs r1, r15; \
71 bf stack_panic; \ 71 bf stack_panic; \
72 \ 72 \
73 /* If sp > init_stack && sp < _ebss, not OK. */ \ 73 /* If sp > init_stack && sp < __bss_stop, not OK. */ \
74 add r0, r1; \ 74 add r0, r1; \
75 cmp/hs r1, r15; \ 75 cmp/hs r1, r15; \
76 bt stack_panic; \ 76 bt stack_panic; \
@@ -292,8 +292,6 @@ stack_panic:
292 nop 292 nop
293 293
294 .align 2 294 .align 2
295.L_ebss:
296 .long _ebss
297.L_init_thread_union: 295.L_init_thread_union:
298 .long init_thread_union 296 .long init_thread_union
299.Lpanic: 297.Lpanic:
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 0dc1f5786081..11c6c9603e71 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -502,12 +502,12 @@ SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality)
502{ 502{
503 int ret; 503 int ret;
504 504
505 if (current->personality == PER_LINUX32 && 505 if (personality(current->personality) == PER_LINUX32 &&
506 personality == PER_LINUX) 506 personality(personality) == PER_LINUX)
507 personality = PER_LINUX32; 507 personality |= PER_LINUX32;
508 ret = sys_personality(personality); 508 ret = sys_personality(personality);
509 if (ret == PER_LINUX32) 509 if (personality(ret) == PER_LINUX32)
510 ret = PER_LINUX; 510 ret &= ~PER_LINUX32;
511 511
512 return ret; 512 return ret;
513} 513}
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 6026fdd1b2ed..d58edf5fefdb 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2020,6 +2020,9 @@ EXPORT_SYMBOL(_PAGE_CACHE);
2020#ifdef CONFIG_SPARSEMEM_VMEMMAP 2020#ifdef CONFIG_SPARSEMEM_VMEMMAP
2021unsigned long vmemmap_table[VMEMMAP_SIZE]; 2021unsigned long vmemmap_table[VMEMMAP_SIZE];
2022 2022
2023static long __meminitdata addr_start, addr_end;
2024static int __meminitdata node_start;
2025
2023int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node) 2026int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
2024{ 2027{
2025 unsigned long vstart = (unsigned long) start; 2028 unsigned long vstart = (unsigned long) start;
@@ -2050,15 +2053,30 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
2050 2053
2051 *vmem_pp = pte_base | __pa(block); 2054 *vmem_pp = pte_base | __pa(block);
2052 2055
2053 printk(KERN_INFO "[%p-%p] page_structs=%lu " 2056 /* check to see if we have contiguous blocks */
2054 "node=%d entry=%lu/%lu\n", start, block, nr, 2057 if (addr_end != addr || node_start != node) {
2055 node, 2058 if (addr_start)
2056 addr >> VMEMMAP_CHUNK_SHIFT, 2059 printk(KERN_DEBUG " [%lx-%lx] on node %d\n",
2057 VMEMMAP_SIZE); 2060 addr_start, addr_end-1, node_start);
2061 addr_start = addr;
2062 node_start = node;
2063 }
2064 addr_end = addr + VMEMMAP_CHUNK;
2058 } 2065 }
2059 } 2066 }
2060 return 0; 2067 return 0;
2061} 2068}
2069
2070void __meminit vmemmap_populate_print_last(void)
2071{
2072 if (addr_start) {
2073 printk(KERN_DEBUG " [%lx-%lx] on node %d\n",
2074 addr_start, addr_end-1, node_start);
2075 addr_start = 0;
2076 addr_end = 0;
2077 node_start = 0;
2078 }
2079}
2062#endif /* CONFIG_SPARSEMEM_VMEMMAP */ 2080#endif /* CONFIG_SPARSEMEM_VMEMMAP */
2063 2081
2064static void prot_init_common(unsigned long page_none, 2082static void prot_init_common(unsigned long page_none,
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ba2657c49217..8ec3a1aa4abd 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1527,7 +1527,7 @@ config SECCOMP
1527 If unsure, say Y. Only embedded should say N here. 1527 If unsure, say Y. Only embedded should say N here.
1528 1528
1529config CC_STACKPROTECTOR 1529config CC_STACKPROTECTOR
1530 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" 1530 bool "Enable -fstack-protector buffer overflow detection"
1531 ---help--- 1531 ---help---
1532 This option turns on the -fstack-protector GCC feature. This 1532 This option turns on the -fstack-protector GCC feature. This
1533 feature puts, at the beginning of functions, a canary value on 1533 feature puts, at the beginning of functions, a canary value on
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 441520e4174f..a3ac52b29cbf 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -33,6 +33,14 @@
33#define MCI_STATUS_PCC (1ULL<<57) /* processor context corrupt */ 33#define MCI_STATUS_PCC (1ULL<<57) /* processor context corrupt */
34#define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */ 34#define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */
35#define MCI_STATUS_AR (1ULL<<55) /* Action required */ 35#define MCI_STATUS_AR (1ULL<<55) /* Action required */
36#define MCACOD 0xffff /* MCA Error Code */
37
38/* Architecturally defined codes from SDM Vol. 3B Chapter 15 */
39#define MCACOD_SCRUB 0x00C0 /* 0xC0-0xCF Memory Scrubbing */
40#define MCACOD_SCRUBMSK 0xfff0
41#define MCACOD_L3WB 0x017A /* L3 Explicit Writeback */
42#define MCACOD_DATA 0x0134 /* Data Load */
43#define MCACOD_INSTR 0x0150 /* Instruction Fetch */
36 44
37/* MCi_MISC register defines */ 45/* MCi_MISC register defines */
38#define MCI_MISC_ADDR_LSB(m) ((m) & 0x3f) 46#define MCI_MISC_ADDR_LSB(m) ((m) & 0x3f)
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index dab39350e51e..cb4e43bce98a 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -196,11 +196,16 @@ static inline u32 get_ibs_caps(void) { return 0; }
196extern void perf_events_lapic_init(void); 196extern void perf_events_lapic_init(void);
197 197
198/* 198/*
199 * Abuse bit 3 of the cpu eflags register to indicate proper PEBS IP fixups. 199 * Abuse bits {3,5} of the cpu eflags register. These flags are otherwise
200 * This flag is otherwise unused and ABI specified to be 0, so nobody should 200 * unused and ABI specified to be 0, so nobody should care what we do with
201 * care what we do with it. 201 * them.
202 *
203 * EXACT - the IP points to the exact instruction that triggered the
204 * event (HW bugs exempt).
205 * VM - original X86_VM_MASK; see set_linear_ip().
202 */ 206 */
203#define PERF_EFLAGS_EXACT (1UL << 3) 207#define PERF_EFLAGS_EXACT (1UL << 3)
208#define PERF_EFLAGS_VM (1UL << 5)
204 209
205struct pt_regs; 210struct pt_regs;
206extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 211extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 95bf99de9058..1b8e5a03d942 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -25,10 +25,6 @@ unsigned long acpi_realmode_flags;
25static char temp_stack[4096]; 25static char temp_stack[4096];
26#endif 26#endif
27 27
28asmlinkage void acpi_enter_s3(void)
29{
30 acpi_enter_sleep_state(3, wake_sleep_flags);
31}
32/** 28/**
33 * acpi_suspend_lowlevel - save kernel state 29 * acpi_suspend_lowlevel - save kernel state
34 * 30 *
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h
index 5653a5791ec9..67f59f8c6956 100644
--- a/arch/x86/kernel/acpi/sleep.h
+++ b/arch/x86/kernel/acpi/sleep.h
@@ -2,7 +2,6 @@
2 * Variables and functions used by the code in sleep.c 2 * Variables and functions used by the code in sleep.c
3 */ 3 */
4 4
5#include <linux/linkage.h>
6#include <asm/realmode.h> 5#include <asm/realmode.h>
7 6
8extern unsigned long saved_video_mode; 7extern unsigned long saved_video_mode;
@@ -11,7 +10,6 @@ extern long saved_magic;
11extern int wakeup_pmode_return; 10extern int wakeup_pmode_return;
12 11
13extern u8 wake_sleep_flags; 12extern u8 wake_sleep_flags;
14extern asmlinkage void acpi_enter_s3(void);
15 13
16extern unsigned long acpi_copy_wakeup_routine(unsigned long); 14extern unsigned long acpi_copy_wakeup_routine(unsigned long);
17extern void wakeup_long64(void); 15extern void wakeup_long64(void);
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 72610839f03b..13ab720573e3 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -74,7 +74,9 @@ restore_registers:
74ENTRY(do_suspend_lowlevel) 74ENTRY(do_suspend_lowlevel)
75 call save_processor_state 75 call save_processor_state
76 call save_registers 76 call save_registers
77 call acpi_enter_s3 77 pushl $3
78 call acpi_enter_sleep_state
79 addl $4, %esp
78 80
79# In case of S3 failure, we'll emerge here. Jump 81# In case of S3 failure, we'll emerge here. Jump
80# to ret_point to recover 82# to ret_point to recover
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
index 014d1d28c397..8ea5164cbd04 100644
--- a/arch/x86/kernel/acpi/wakeup_64.S
+++ b/arch/x86/kernel/acpi/wakeup_64.S
@@ -71,7 +71,9 @@ ENTRY(do_suspend_lowlevel)
71 movq %rsi, saved_rsi 71 movq %rsi, saved_rsi
72 72
73 addq $8, %rsp 73 addq $8, %rsp
74 call acpi_enter_s3 74 movl $3, %edi
75 xorl %eax, %eax
76 call acpi_enter_sleep_state
75 /* in case something went wrong, restore the machine status and go on */ 77 /* in case something went wrong, restore the machine status and go on */
76 jmp resume_point 78 jmp resume_point
77 79
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 931280ff8299..afb7ff79a29f 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -224,7 +224,7 @@ void __init arch_init_ideal_nops(void)
224 ideal_nops = intel_nops; 224 ideal_nops = intel_nops;
225#endif 225#endif
226 } 226 }
227 227 break;
228 default: 228 default:
229#ifdef CONFIG_X86_64 229#ifdef CONFIG_X86_64
230 ideal_nops = k8_nops; 230 ideal_nops = k8_nops;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 406eee784684..a6c64aaddf9a 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1204,7 +1204,7 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg)
1204 BUG_ON(!cfg->vector); 1204 BUG_ON(!cfg->vector);
1205 1205
1206 vector = cfg->vector; 1206 vector = cfg->vector;
1207 for_each_cpu(cpu, cfg->domain) 1207 for_each_cpu_and(cpu, cfg->domain, cpu_online_mask)
1208 per_cpu(vector_irq, cpu)[vector] = -1; 1208 per_cpu(vector_irq, cpu)[vector] = -1;
1209 1209
1210 cfg->vector = 0; 1210 cfg->vector = 0;
@@ -1212,7 +1212,7 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg)
1212 1212
1213 if (likely(!cfg->move_in_progress)) 1213 if (likely(!cfg->move_in_progress))
1214 return; 1214 return;
1215 for_each_cpu(cpu, cfg->old_domain) { 1215 for_each_cpu_and(cpu, cfg->old_domain, cpu_online_mask) {
1216 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; 1216 for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
1217 vector++) { 1217 vector++) {
1218 if (per_cpu(vector_irq, cpu)[vector] != irq) 1218 if (per_cpu(vector_irq, cpu)[vector] != irq)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index 413c2ced887c..13017626f9a8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -55,13 +55,6 @@ static struct severity {
55#define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S) 55#define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S)
56#define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR) 56#define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR)
57#define MCI_ADDR (MCI_STATUS_ADDRV|MCI_STATUS_MISCV) 57#define MCI_ADDR (MCI_STATUS_ADDRV|MCI_STATUS_MISCV)
58#define MCACOD 0xffff
59/* Architecturally defined codes from SDM Vol. 3B Chapter 15 */
60#define MCACOD_SCRUB 0x00C0 /* 0xC0-0xCF Memory Scrubbing */
61#define MCACOD_SCRUBMSK 0xfff0
62#define MCACOD_L3WB 0x017A /* L3 Explicit Writeback */
63#define MCACOD_DATA 0x0134 /* Data Load */
64#define MCACOD_INSTR 0x0150 /* Instruction Fetch */
65 58
66 MCESEV( 59 MCESEV(
67 NO, "Invalid", 60 NO, "Invalid",
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5e095f873e3e..292d0258311c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -103,6 +103,8 @@ DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = {
103 103
104static DEFINE_PER_CPU(struct work_struct, mce_work); 104static DEFINE_PER_CPU(struct work_struct, mce_work);
105 105
106static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
107
106/* 108/*
107 * CPU/chipset specific EDAC code can register a notifier call here to print 109 * CPU/chipset specific EDAC code can register a notifier call here to print
108 * MCE errors in a human-readable form. 110 * MCE errors in a human-readable form.
@@ -650,14 +652,18 @@ EXPORT_SYMBOL_GPL(machine_check_poll);
650 * Do a quick check if any of the events requires a panic. 652 * Do a quick check if any of the events requires a panic.
651 * This decides if we keep the events around or clear them. 653 * This decides if we keep the events around or clear them.
652 */ 654 */
653static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp) 655static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
656 struct pt_regs *regs)
654{ 657{
655 int i, ret = 0; 658 int i, ret = 0;
656 659
657 for (i = 0; i < banks; i++) { 660 for (i = 0; i < banks; i++) {
658 m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); 661 m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i));
659 if (m->status & MCI_STATUS_VAL) 662 if (m->status & MCI_STATUS_VAL) {
660 __set_bit(i, validp); 663 __set_bit(i, validp);
664 if (quirk_no_way_out)
665 quirk_no_way_out(i, m, regs);
666 }
661 if (mce_severity(m, tolerant, msg) >= MCE_PANIC_SEVERITY) 667 if (mce_severity(m, tolerant, msg) >= MCE_PANIC_SEVERITY)
662 ret = 1; 668 ret = 1;
663 } 669 }
@@ -1040,7 +1046,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1040 *final = m; 1046 *final = m;
1041 1047
1042 memset(valid_banks, 0, sizeof(valid_banks)); 1048 memset(valid_banks, 0, sizeof(valid_banks));
1043 no_way_out = mce_no_way_out(&m, &msg, valid_banks); 1049 no_way_out = mce_no_way_out(&m, &msg, valid_banks, regs);
1044 1050
1045 barrier(); 1051 barrier();
1046 1052
@@ -1418,6 +1424,34 @@ static void __mcheck_cpu_init_generic(void)
1418 } 1424 }
1419} 1425}
1420 1426
1427/*
1428 * During IFU recovery Sandy Bridge -EP4S processors set the RIPV and
1429 * EIPV bits in MCG_STATUS to zero on the affected logical processor (SDM
1430 * Vol 3B Table 15-20). But this confuses both the code that determines
1431 * whether the machine check occurred in kernel or user mode, and also
1432 * the severity assessment code. Pretend that EIPV was set, and take the
1433 * ip/cs values from the pt_regs that mce_gather_info() ignored earlier.
1434 */
1435static void quirk_sandybridge_ifu(int bank, struct mce *m, struct pt_regs *regs)
1436{
1437 if (bank != 0)
1438 return;
1439 if ((m->mcgstatus & (MCG_STATUS_EIPV|MCG_STATUS_RIPV)) != 0)
1440 return;
1441 if ((m->status & (MCI_STATUS_OVER|MCI_STATUS_UC|
1442 MCI_STATUS_EN|MCI_STATUS_MISCV|MCI_STATUS_ADDRV|
1443 MCI_STATUS_PCC|MCI_STATUS_S|MCI_STATUS_AR|
1444 MCACOD)) !=
1445 (MCI_STATUS_UC|MCI_STATUS_EN|
1446 MCI_STATUS_MISCV|MCI_STATUS_ADDRV|MCI_STATUS_S|
1447 MCI_STATUS_AR|MCACOD_INSTR))
1448 return;
1449
1450 m->mcgstatus |= MCG_STATUS_EIPV;
1451 m->ip = regs->ip;
1452 m->cs = regs->cs;
1453}
1454
1421/* Add per CPU specific workarounds here */ 1455/* Add per CPU specific workarounds here */
1422static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) 1456static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1423{ 1457{
@@ -1515,6 +1549,9 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1515 */ 1549 */
1516 if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0) 1550 if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0)
1517 mce_bootlog = 0; 1551 mce_bootlog = 0;
1552
1553 if (c->x86 == 6 && c->x86_model == 45)
1554 quirk_no_way_out = quirk_sandybridge_ifu;
1518 } 1555 }
1519 if (monarch_timeout < 0) 1556 if (monarch_timeout < 0)
1520 monarch_timeout = 0; 1557 monarch_timeout = 0;
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 29557aa06dda..915b876edd1e 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -32,6 +32,8 @@
32#include <asm/smp.h> 32#include <asm/smp.h>
33#include <asm/alternative.h> 33#include <asm/alternative.h>
34#include <asm/timer.h> 34#include <asm/timer.h>
35#include <asm/desc.h>
36#include <asm/ldt.h>
35 37
36#include "perf_event.h" 38#include "perf_event.h"
37 39
@@ -1738,6 +1740,29 @@ valid_user_frame(const void __user *fp, unsigned long size)
1738 return (__range_not_ok(fp, size, TASK_SIZE) == 0); 1740 return (__range_not_ok(fp, size, TASK_SIZE) == 0);
1739} 1741}
1740 1742
1743static unsigned long get_segment_base(unsigned int segment)
1744{
1745 struct desc_struct *desc;
1746 int idx = segment >> 3;
1747
1748 if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {
1749 if (idx > LDT_ENTRIES)
1750 return 0;
1751
1752 if (idx > current->active_mm->context.size)
1753 return 0;
1754
1755 desc = current->active_mm->context.ldt;
1756 } else {
1757 if (idx > GDT_ENTRIES)
1758 return 0;
1759
1760 desc = __this_cpu_ptr(&gdt_page.gdt[0]);
1761 }
1762
1763 return get_desc_base(desc + idx);
1764}
1765
1741#ifdef CONFIG_COMPAT 1766#ifdef CONFIG_COMPAT
1742 1767
1743#include <asm/compat.h> 1768#include <asm/compat.h>
@@ -1746,13 +1771,17 @@ static inline int
1746perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) 1771perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
1747{ 1772{
1748 /* 32-bit process in 64-bit kernel. */ 1773 /* 32-bit process in 64-bit kernel. */
1774 unsigned long ss_base, cs_base;
1749 struct stack_frame_ia32 frame; 1775 struct stack_frame_ia32 frame;
1750 const void __user *fp; 1776 const void __user *fp;
1751 1777
1752 if (!test_thread_flag(TIF_IA32)) 1778 if (!test_thread_flag(TIF_IA32))
1753 return 0; 1779 return 0;
1754 1780
1755 fp = compat_ptr(regs->bp); 1781 cs_base = get_segment_base(regs->cs);
1782 ss_base = get_segment_base(regs->ss);
1783
1784 fp = compat_ptr(ss_base + regs->bp);
1756 while (entry->nr < PERF_MAX_STACK_DEPTH) { 1785 while (entry->nr < PERF_MAX_STACK_DEPTH) {
1757 unsigned long bytes; 1786 unsigned long bytes;
1758 frame.next_frame = 0; 1787 frame.next_frame = 0;
@@ -1765,8 +1794,8 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
1765 if (!valid_user_frame(fp, sizeof(frame))) 1794 if (!valid_user_frame(fp, sizeof(frame)))
1766 break; 1795 break;
1767 1796
1768 perf_callchain_store(entry, frame.return_address); 1797 perf_callchain_store(entry, cs_base + frame.return_address);
1769 fp = compat_ptr(frame.next_frame); 1798 fp = compat_ptr(ss_base + frame.next_frame);
1770 } 1799 }
1771 return 1; 1800 return 1;
1772} 1801}
@@ -1789,6 +1818,12 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1789 return; 1818 return;
1790 } 1819 }
1791 1820
1821 /*
1822 * We don't know what to do with VM86 stacks.. ignore them for now.
1823 */
1824 if (regs->flags & (X86_VM_MASK | PERF_EFLAGS_VM))
1825 return;
1826
1792 fp = (void __user *)regs->bp; 1827 fp = (void __user *)regs->bp;
1793 1828
1794 perf_callchain_store(entry, regs->ip); 1829 perf_callchain_store(entry, regs->ip);
@@ -1816,16 +1851,50 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1816 } 1851 }
1817} 1852}
1818 1853
1819unsigned long perf_instruction_pointer(struct pt_regs *regs) 1854/*
1855 * Deal with code segment offsets for the various execution modes:
1856 *
1857 * VM86 - the good olde 16 bit days, where the linear address is
1858 * 20 bits and we use regs->ip + 0x10 * regs->cs.
1859 *
1860 * IA32 - Where we need to look at GDT/LDT segment descriptor tables
1861 * to figure out what the 32bit base address is.
1862 *
1863 * X32 - has TIF_X32 set, but is running in x86_64
1864 *
1865 * X86_64 - CS,DS,SS,ES are all zero based.
1866 */
1867static unsigned long code_segment_base(struct pt_regs *regs)
1820{ 1868{
1821 unsigned long ip; 1869 /*
1870 * If we are in VM86 mode, add the segment offset to convert to a
1871 * linear address.
1872 */
1873 if (regs->flags & X86_VM_MASK)
1874 return 0x10 * regs->cs;
1875
1876 /*
1877 * For IA32 we look at the GDT/LDT segment base to convert the
1878 * effective IP to a linear address.
1879 */
1880#ifdef CONFIG_X86_32
1881 if (user_mode(regs) && regs->cs != __USER_CS)
1882 return get_segment_base(regs->cs);
1883#else
1884 if (test_thread_flag(TIF_IA32)) {
1885 if (user_mode(regs) && regs->cs != __USER32_CS)
1886 return get_segment_base(regs->cs);
1887 }
1888#endif
1889 return 0;
1890}
1822 1891
1892unsigned long perf_instruction_pointer(struct pt_regs *regs)
1893{
1823 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) 1894 if (perf_guest_cbs && perf_guest_cbs->is_in_guest())
1824 ip = perf_guest_cbs->get_guest_ip(); 1895 return perf_guest_cbs->get_guest_ip();
1825 else
1826 ip = instruction_pointer(regs);
1827 1896
1828 return ip; 1897 return regs->ip + code_segment_base(regs);
1829} 1898}
1830 1899
1831unsigned long perf_misc_flags(struct pt_regs *regs) 1900unsigned long perf_misc_flags(struct pt_regs *regs)
@@ -1838,7 +1907,7 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
1838 else 1907 else
1839 misc |= PERF_RECORD_MISC_GUEST_KERNEL; 1908 misc |= PERF_RECORD_MISC_GUEST_KERNEL;
1840 } else { 1909 } else {
1841 if (!kernel_ip(regs->ip)) 1910 if (user_mode(regs))
1842 misc |= PERF_RECORD_MISC_USER; 1911 misc |= PERF_RECORD_MISC_USER;
1843 else 1912 else
1844 misc |= PERF_RECORD_MISC_KERNEL; 1913 misc |= PERF_RECORD_MISC_KERNEL;
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 821d53b696d1..6605a81ba339 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -516,6 +516,26 @@ static inline bool kernel_ip(unsigned long ip)
516#endif 516#endif
517} 517}
518 518
519/*
520 * Not all PMUs provide the right context information to place the reported IP
521 * into full context. Specifically segment registers are typically not
522 * supplied.
523 *
524 * Assuming the address is a linear address (it is for IBS), we fake the CS and
525 * vm86 mode using the known zero-based code segment and 'fix up' the registers
526 * to reflect this.
527 *
528 * Intel PEBS/LBR appear to typically provide the effective address, nothing
529 * much we can do about that but pray and treat it like a linear address.
530 */
531static inline void set_linear_ip(struct pt_regs *regs, unsigned long ip)
532{
533 regs->cs = kernel_ip(ip) ? __KERNEL_CS : __USER_CS;
534 if (regs->flags & X86_VM_MASK)
535 regs->flags ^= (PERF_EFLAGS_VM | X86_VM_MASK);
536 regs->ip = ip;
537}
538
519#ifdef CONFIG_CPU_SUP_AMD 539#ifdef CONFIG_CPU_SUP_AMD
520 540
521int amd_pmu_init(void); 541int amd_pmu_init(void);
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
index da9bcdcd9856..7bfb5bec8630 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -13,6 +13,8 @@
13 13
14#include <asm/apic.h> 14#include <asm/apic.h>
15 15
16#include "perf_event.h"
17
16static u32 ibs_caps; 18static u32 ibs_caps;
17 19
18#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) 20#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
@@ -536,7 +538,7 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
536 if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) { 538 if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) {
537 regs.flags &= ~PERF_EFLAGS_EXACT; 539 regs.flags &= ~PERF_EFLAGS_EXACT;
538 } else { 540 } else {
539 instruction_pointer_set(&regs, ibs_data.regs[1]); 541 set_linear_ip(&regs, ibs_data.regs[1]);
540 regs.flags |= PERF_EFLAGS_EXACT; 542 regs.flags |= PERF_EFLAGS_EXACT;
541 } 543 }
542 544
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 629ae0b7ad90..e38d97bf4259 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -499,7 +499,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
499 * We sampled a branch insn, rewind using the LBR stack 499 * We sampled a branch insn, rewind using the LBR stack
500 */ 500 */
501 if (ip == to) { 501 if (ip == to) {
502 regs->ip = from; 502 set_linear_ip(regs, from);
503 return 1; 503 return 1;
504 } 504 }
505 505
@@ -529,7 +529,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
529 } while (to < ip); 529 } while (to < ip);
530 530
531 if (to == ip) { 531 if (to == ip) {
532 regs->ip = old_to; 532 set_linear_ip(regs, old_to);
533 return 1; 533 return 1;
534 } 534 }
535 535
@@ -569,7 +569,8 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
569 * A possible PERF_SAMPLE_REGS will have to transfer all regs. 569 * A possible PERF_SAMPLE_REGS will have to transfer all regs.
570 */ 570 */
571 regs = *iregs; 571 regs = *iregs;
572 regs.ip = pebs->ip; 572 regs.flags = pebs->flags;
573 set_linear_ip(&regs, pebs->ip);
573 regs.bp = pebs->bp; 574 regs.bp = pebs->bp;
574 regs.sp = pebs->sp; 575 regs.sp = pebs->sp;
575 576
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index f3851892e077..c9e5dc56630a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -5,7 +5,7 @@
5#include "perf_event.h" 5#include "perf_event.h"
6 6
7#define UNCORE_PMU_NAME_LEN 32 7#define UNCORE_PMU_NAME_LEN 32
8#define UNCORE_PMU_HRTIMER_INTERVAL (60 * NSEC_PER_SEC) 8#define UNCORE_PMU_HRTIMER_INTERVAL (60LL * NSEC_PER_SEC)
9 9
10#define UNCORE_FIXED_EVENT 0xff 10#define UNCORE_FIXED_EVENT 0xff
11#define UNCORE_PMC_IDX_MAX_GENERIC 8 11#define UNCORE_PMC_IDX_MAX_GENERIC 8
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 1f5f1d5d2a02..7ad683d78645 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -328,6 +328,7 @@ void fixup_irqs(void)
328 chip->irq_retrigger(data); 328 chip->irq_retrigger(data);
329 raw_spin_unlock(&desc->lock); 329 raw_spin_unlock(&desc->lock);
330 } 330 }
331 __this_cpu_write(vector_irq[vector], -1);
331 } 332 }
332} 333}
333#endif 334#endif
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index 1d5d31ea686b..dc1404bf8e4b 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -107,7 +107,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
107{ 107{
108 struct setup_data_node *node; 108 struct setup_data_node *node;
109 struct setup_data *data; 109 struct setup_data *data;
110 int error = -ENOMEM; 110 int error;
111 struct dentry *d; 111 struct dentry *d;
112 struct page *pg; 112 struct page *pg;
113 u64 pa_data; 113 u64 pa_data;
@@ -121,8 +121,10 @@ static int __init create_setup_data_nodes(struct dentry *parent)
121 121
122 while (pa_data) { 122 while (pa_data) {
123 node = kmalloc(sizeof(*node), GFP_KERNEL); 123 node = kmalloc(sizeof(*node), GFP_KERNEL);
124 if (!node) 124 if (!node) {
125 error = -ENOMEM;
125 goto err_dir; 126 goto err_dir;
127 }
126 128
127 pg = pfn_to_page((pa_data+sizeof(*data)-1) >> PAGE_SHIFT); 129 pg = pfn_to_page((pa_data+sizeof(*data)-1) >> PAGE_SHIFT);
128 if (PageHighMem(pg)) { 130 if (PageHighMem(pg)) {
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 1df8fb9e1d5d..e498b18f010c 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -316,6 +316,11 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
316 addr &= 1; 316 addr &= 1;
317 if (addr == 0) { 317 if (addr == 0) {
318 if (val & 0x10) { 318 if (val & 0x10) {
319 u8 edge_irr = s->irr & ~s->elcr;
320 int i;
321 bool found;
322 struct kvm_vcpu *vcpu;
323
319 s->init4 = val & 1; 324 s->init4 = val & 1;
320 s->last_irr = 0; 325 s->last_irr = 0;
321 s->irr &= s->elcr; 326 s->irr &= s->elcr;
@@ -333,6 +338,18 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
333 if (val & 0x08) 338 if (val & 0x08)
334 pr_pic_unimpl( 339 pr_pic_unimpl(
335 "level sensitive irq not supported"); 340 "level sensitive irq not supported");
341
342 kvm_for_each_vcpu(i, vcpu, s->pics_state->kvm)
343 if (kvm_apic_accept_pic_intr(vcpu)) {
344 found = true;
345 break;
346 }
347
348
349 if (found)
350 for (irq = 0; irq < PIC_NUM_PINS/2; irq++)
351 if (edge_irr & (1 << irq))
352 pic_clear_isr(s, irq);
336 } else if (val & 0x08) { 353 } else if (val & 0x08) {
337 if (val & 0x04) 354 if (val & 0x04)
338 s->poll = 1; 355 s->poll = 1;
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c39b60707e02..c00f03de1b79 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1488,13 +1488,6 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
1488 loadsegment(ds, vmx->host_state.ds_sel); 1488 loadsegment(ds, vmx->host_state.ds_sel);
1489 loadsegment(es, vmx->host_state.es_sel); 1489 loadsegment(es, vmx->host_state.es_sel);
1490 } 1490 }
1491#else
1492 /*
1493 * The sysexit path does not restore ds/es, so we must set them to
1494 * a reasonable value ourselves.
1495 */
1496 loadsegment(ds, __USER_DS);
1497 loadsegment(es, __USER_DS);
1498#endif 1491#endif
1499 reload_tss(); 1492 reload_tss();
1500#ifdef CONFIG_X86_64 1493#ifdef CONFIG_X86_64
@@ -6370,6 +6363,19 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
6370#endif 6363#endif
6371 ); 6364 );
6372 6365
6366#ifndef CONFIG_X86_64
6367 /*
6368 * The sysexit path does not restore ds/es, so we must set them to
6369 * a reasonable value ourselves.
6370 *
6371 * We can't defer this to vmx_load_host_state() since that function
6372 * may be executed in interrupt context, which saves and restore segments
6373 * around it, nullifying its effect.
6374 */
6375 loadsegment(ds, __USER_DS);
6376 loadsegment(es, __USER_DS);
6377#endif
6378
6373 vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP) 6379 vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP)
6374 | (1 << VCPU_EXREG_RFLAGS) 6380 | (1 << VCPU_EXREG_RFLAGS)
6375 | (1 << VCPU_EXREG_CPL) 6381 | (1 << VCPU_EXREG_CPL)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 59b59508ff07..42bce48f6928 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -925,6 +925,10 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
925 */ 925 */
926 getboottime(&boot); 926 getboottime(&boot);
927 927
928 if (kvm->arch.kvmclock_offset) {
929 struct timespec ts = ns_to_timespec(kvm->arch.kvmclock_offset);
930 boot = timespec_sub(boot, ts);
931 }
928 wc.sec = boot.tv_sec; 932 wc.sec = boot.tv_sec;
929 wc.nsec = boot.tv_nsec; 933 wc.nsec = boot.tv_nsec;
930 wc.version = version; 934 wc.version = version;
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 4599c3e8bcb6..4ddf497ca65b 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -142,23 +142,23 @@ static inline int save_add_info(void) {return 0;}
142#endif 142#endif
143 143
144/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 144/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
145void __init 145int __init
146acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) 146acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
147{ 147{
148 u64 start, end; 148 u64 start, end;
149 int node, pxm; 149 int node, pxm;
150 150
151 if (srat_disabled()) 151 if (srat_disabled())
152 return; 152 return -1;
153 if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { 153 if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) {
154 bad_srat(); 154 bad_srat();
155 return; 155 return -1;
156 } 156 }
157 if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) 157 if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
158 return; 158 return -1;
159 159
160 if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info()) 160 if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info())
161 return; 161 return -1;
162 start = ma->base_address; 162 start = ma->base_address;
163 end = start + ma->length; 163 end = start + ma->length;
164 pxm = ma->proximity_domain; 164 pxm = ma->proximity_domain;
@@ -168,12 +168,12 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
168 if (node < 0) { 168 if (node < 0) {
169 printk(KERN_ERR "SRAT: Too many proximity domains.\n"); 169 printk(KERN_ERR "SRAT: Too many proximity domains.\n");
170 bad_srat(); 170 bad_srat();
171 return; 171 return -1;
172 } 172 }
173 173
174 if (numa_add_memblk(node, start, end) < 0) { 174 if (numa_add_memblk(node, start, end) < 0) {
175 bad_srat(); 175 bad_srat();
176 return; 176 return -1;
177 } 177 }
178 178
179 node_set(node, numa_nodes_parsed); 179 node_set(node, numa_nodes_parsed);
@@ -181,6 +181,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
181 printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", 181 printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n",
182 node, pxm, 182 node, pxm,
183 (unsigned long long) start, (unsigned long long) end - 1); 183 (unsigned long long) start, (unsigned long long) end - 1);
184 return 0;
184} 185}
185 186
186void __init acpi_numa_arch_fixup(void) {} 187void __init acpi_numa_arch_fixup(void) {}
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index 51171aeff0dc..29aed7ac2c02 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -318,7 +318,7 @@
318309 common getcpu sys_getcpu 318309 common getcpu sys_getcpu
319310 64 process_vm_readv sys_process_vm_readv 319310 64 process_vm_readv sys_process_vm_readv
320311 64 process_vm_writev sys_process_vm_writev 320311 64 process_vm_writev sys_process_vm_writev
321312 64 kcmp sys_kcmp 321312 common kcmp sys_kcmp
322 322
323# 323#
324# x32-specific system call numbers start at 512 to avoid cache impact 324# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 64effdc6da94..b2e91d40a4cb 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -194,6 +194,11 @@ RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID
194 * boundary violation will require three middle nodes. */ 194 * boundary violation will require three middle nodes. */
195RESERVE_BRK(p2m_mid_identity, PAGE_SIZE * 2 * 3); 195RESERVE_BRK(p2m_mid_identity, PAGE_SIZE * 2 * 3);
196 196
197/* When we populate back during bootup, the amount of pages can vary. The
198 * max we have is seen is 395979, but that does not mean it can't be more.
199 * But some machines can have 3GB I/O holes even. So lets reserve enough
200 * for 4GB of I/O and E820 holes. */
201RESERVE_BRK(p2m_populated, PMD_SIZE * 4);
197static inline unsigned p2m_top_index(unsigned long pfn) 202static inline unsigned p2m_top_index(unsigned long pfn)
198{ 203{
199 BUG_ON(pfn >= MAX_P2M_PFN); 204 BUG_ON(pfn >= MAX_P2M_PFN);
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index ac7034129f3f..d5fdd36190cc 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -69,7 +69,9 @@ static const struct acpi_device_id ac_device_ids[] = {
69}; 69};
70MODULE_DEVICE_TABLE(acpi, ac_device_ids); 70MODULE_DEVICE_TABLE(acpi, ac_device_ids);
71 71
72#ifdef CONFIG_PM_SLEEP
72static int acpi_ac_resume(struct device *dev); 73static int acpi_ac_resume(struct device *dev);
74#endif
73static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); 75static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
74 76
75static struct acpi_driver acpi_ac_driver = { 77static struct acpi_driver acpi_ac_driver = {
@@ -313,6 +315,7 @@ static int acpi_ac_add(struct acpi_device *device)
313 return result; 315 return result;
314} 316}
315 317
318#ifdef CONFIG_PM_SLEEP
316static int acpi_ac_resume(struct device *dev) 319static int acpi_ac_resume(struct device *dev)
317{ 320{
318 struct acpi_ac *ac; 321 struct acpi_ac *ac;
@@ -332,6 +335,7 @@ static int acpi_ac_resume(struct device *dev)
332 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 335 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
333 return 0; 336 return 0;
334} 337}
338#endif
335 339
336static int acpi_ac_remove(struct acpi_device *device, int type) 340static int acpi_ac_remove(struct acpi_device *device, int type)
337{ 341{
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index 5ccb99ae3a6f..5de4ec72766d 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -83,22 +83,22 @@ acpi_status acpi_hw_clear_acpi_status(void);
83/* 83/*
84 * hwsleep - sleep/wake support (Legacy sleep registers) 84 * hwsleep - sleep/wake support (Legacy sleep registers)
85 */ 85 */
86acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags); 86acpi_status acpi_hw_legacy_sleep(u8 sleep_state);
87 87
88acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state, u8 flags); 88acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state);
89 89
90acpi_status acpi_hw_legacy_wake(u8 sleep_state, u8 flags); 90acpi_status acpi_hw_legacy_wake(u8 sleep_state);
91 91
92/* 92/*
93 * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers) 93 * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers)
94 */ 94 */
95void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument); 95void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument);
96 96
97acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags); 97acpi_status acpi_hw_extended_sleep(u8 sleep_state);
98 98
99acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 flags); 99acpi_status acpi_hw_extended_wake_prep(u8 sleep_state);
100 100
101acpi_status acpi_hw_extended_wake(u8 sleep_state, u8 flags); 101acpi_status acpi_hw_extended_wake(u8 sleep_state);
102 102
103/* 103/*
104 * hwvalid - Port I/O with validation 104 * hwvalid - Port I/O with validation
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 48518dac5342..94996f9ae3ad 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -90,7 +90,6 @@ void acpi_hw_execute_sleep_method(char *method_pathname, u32 integer_argument)
90 * FUNCTION: acpi_hw_extended_sleep 90 * FUNCTION: acpi_hw_extended_sleep
91 * 91 *
92 * PARAMETERS: sleep_state - Which sleep state to enter 92 * PARAMETERS: sleep_state - Which sleep state to enter
93 * flags - ACPI_EXECUTE_GTS to run optional method
94 * 93 *
95 * RETURN: Status 94 * RETURN: Status
96 * 95 *
@@ -100,7 +99,7 @@ void acpi_hw_execute_sleep_method(char *method_pathname, u32 integer_argument)
100 * 99 *
101 ******************************************************************************/ 100 ******************************************************************************/
102 101
103acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags) 102acpi_status acpi_hw_extended_sleep(u8 sleep_state)
104{ 103{
105 acpi_status status; 104 acpi_status status;
106 u8 sleep_type_value; 105 u8 sleep_type_value;
@@ -125,12 +124,6 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
125 124
126 acpi_gbl_system_awake_and_running = FALSE; 125 acpi_gbl_system_awake_and_running = FALSE;
127 126
128 /* Optionally execute _GTS (Going To Sleep) */
129
130 if (flags & ACPI_EXECUTE_GTS) {
131 acpi_hw_execute_sleep_method(METHOD_PATHNAME__GTS, sleep_state);
132 }
133
134 /* Flush caches, as per ACPI specification */ 127 /* Flush caches, as per ACPI specification */
135 128
136 ACPI_FLUSH_CPU_CACHE(); 129 ACPI_FLUSH_CPU_CACHE();
@@ -172,7 +165,6 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
172 * FUNCTION: acpi_hw_extended_wake_prep 165 * FUNCTION: acpi_hw_extended_wake_prep
173 * 166 *
174 * PARAMETERS: sleep_state - Which sleep state we just exited 167 * PARAMETERS: sleep_state - Which sleep state we just exited
175 * flags - ACPI_EXECUTE_BFS to run optional method
176 * 168 *
177 * RETURN: Status 169 * RETURN: Status
178 * 170 *
@@ -181,7 +173,7 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
181 * 173 *
182 ******************************************************************************/ 174 ******************************************************************************/
183 175
184acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 flags) 176acpi_status acpi_hw_extended_wake_prep(u8 sleep_state)
185{ 177{
186 acpi_status status; 178 acpi_status status;
187 u8 sleep_type_value; 179 u8 sleep_type_value;
@@ -200,11 +192,6 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 flags)
200 &acpi_gbl_FADT.sleep_control); 192 &acpi_gbl_FADT.sleep_control);
201 } 193 }
202 194
203 /* Optionally execute _BFS (Back From Sleep) */
204
205 if (flags & ACPI_EXECUTE_BFS) {
206 acpi_hw_execute_sleep_method(METHOD_PATHNAME__BFS, sleep_state);
207 }
208 return_ACPI_STATUS(AE_OK); 195 return_ACPI_STATUS(AE_OK);
209} 196}
210 197
@@ -222,7 +209,7 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 flags)
222 * 209 *
223 ******************************************************************************/ 210 ******************************************************************************/
224 211
225acpi_status acpi_hw_extended_wake(u8 sleep_state, u8 flags) 212acpi_status acpi_hw_extended_wake(u8 sleep_state)
226{ 213{
227 ACPI_FUNCTION_TRACE(hw_extended_wake); 214 ACPI_FUNCTION_TRACE(hw_extended_wake);
228 215
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 9960fe9ef533..3fddde056a5e 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -56,7 +56,6 @@ ACPI_MODULE_NAME("hwsleep")
56 * FUNCTION: acpi_hw_legacy_sleep 56 * FUNCTION: acpi_hw_legacy_sleep
57 * 57 *
58 * PARAMETERS: sleep_state - Which sleep state to enter 58 * PARAMETERS: sleep_state - Which sleep state to enter
59 * flags - ACPI_EXECUTE_GTS to run optional method
60 * 59 *
61 * RETURN: Status 60 * RETURN: Status
62 * 61 *
@@ -64,7 +63,7 @@ ACPI_MODULE_NAME("hwsleep")
64 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 63 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
65 * 64 *
66 ******************************************************************************/ 65 ******************************************************************************/
67acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags) 66acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
68{ 67{
69 struct acpi_bit_register_info *sleep_type_reg_info; 68 struct acpi_bit_register_info *sleep_type_reg_info;
70 struct acpi_bit_register_info *sleep_enable_reg_info; 69 struct acpi_bit_register_info *sleep_enable_reg_info;
@@ -110,12 +109,6 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags)
110 return_ACPI_STATUS(status); 109 return_ACPI_STATUS(status);
111 } 110 }
112 111
113 /* Optionally execute _GTS (Going To Sleep) */
114
115 if (flags & ACPI_EXECUTE_GTS) {
116 acpi_hw_execute_sleep_method(METHOD_PATHNAME__GTS, sleep_state);
117 }
118
119 /* Get current value of PM1A control */ 112 /* Get current value of PM1A control */
120 113
121 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, 114 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
@@ -214,7 +207,6 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags)
214 * FUNCTION: acpi_hw_legacy_wake_prep 207 * FUNCTION: acpi_hw_legacy_wake_prep
215 * 208 *
216 * PARAMETERS: sleep_state - Which sleep state we just exited 209 * PARAMETERS: sleep_state - Which sleep state we just exited
217 * flags - ACPI_EXECUTE_BFS to run optional method
218 * 210 *
219 * RETURN: Status 211 * RETURN: Status
220 * 212 *
@@ -224,7 +216,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags)
224 * 216 *
225 ******************************************************************************/ 217 ******************************************************************************/
226 218
227acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state, u8 flags) 219acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state)
228{ 220{
229 acpi_status status; 221 acpi_status status;
230 struct acpi_bit_register_info *sleep_type_reg_info; 222 struct acpi_bit_register_info *sleep_type_reg_info;
@@ -275,11 +267,6 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state, u8 flags)
275 } 267 }
276 } 268 }
277 269
278 /* Optionally execute _BFS (Back From Sleep) */
279
280 if (flags & ACPI_EXECUTE_BFS) {
281 acpi_hw_execute_sleep_method(METHOD_PATHNAME__BFS, sleep_state);
282 }
283 return_ACPI_STATUS(status); 270 return_ACPI_STATUS(status);
284} 271}
285 272
@@ -288,7 +275,6 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state, u8 flags)
288 * FUNCTION: acpi_hw_legacy_wake 275 * FUNCTION: acpi_hw_legacy_wake
289 * 276 *
290 * PARAMETERS: sleep_state - Which sleep state we just exited 277 * PARAMETERS: sleep_state - Which sleep state we just exited
291 * flags - Reserved, set to zero
292 * 278 *
293 * RETURN: Status 279 * RETURN: Status
294 * 280 *
@@ -297,7 +283,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state, u8 flags)
297 * 283 *
298 ******************************************************************************/ 284 ******************************************************************************/
299 285
300acpi_status acpi_hw_legacy_wake(u8 sleep_state, u8 flags) 286acpi_status acpi_hw_legacy_wake(u8 sleep_state)
301{ 287{
302 acpi_status status; 288 acpi_status status;
303 289
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index f8684bfe7907..1f165a750ae2 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("hwxfsleep")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static acpi_status 52static acpi_status
53acpi_hw_sleep_dispatch(u8 sleep_state, u8 flags, u32 function_id); 53acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
54 54
55/* 55/*
56 * Dispatch table used to efficiently branch to the various sleep 56 * Dispatch table used to efficiently branch to the various sleep
@@ -235,7 +235,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
235 * 235 *
236 ******************************************************************************/ 236 ******************************************************************************/
237static acpi_status 237static acpi_status
238acpi_hw_sleep_dispatch(u8 sleep_state, u8 flags, u32 function_id) 238acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
239{ 239{
240 acpi_status status; 240 acpi_status status;
241 struct acpi_sleep_functions *sleep_functions = 241 struct acpi_sleep_functions *sleep_functions =
@@ -248,11 +248,11 @@ acpi_hw_sleep_dispatch(u8 sleep_state, u8 flags, u32 function_id)
248 * use the extended sleep registers 248 * use the extended sleep registers
249 */ 249 */
250 if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { 250 if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) {
251 status = sleep_functions->extended_function(sleep_state, flags); 251 status = sleep_functions->extended_function(sleep_state);
252 } else { 252 } else {
253 /* Legacy sleep */ 253 /* Legacy sleep */
254 254
255 status = sleep_functions->legacy_function(sleep_state, flags); 255 status = sleep_functions->legacy_function(sleep_state);
256 } 256 }
257 257
258 return (status); 258 return (status);
@@ -262,7 +262,7 @@ acpi_hw_sleep_dispatch(u8 sleep_state, u8 flags, u32 function_id)
262 * For the case where reduced-hardware-only code is being generated, 262 * For the case where reduced-hardware-only code is being generated,
263 * we know that only the extended sleep registers are available 263 * we know that only the extended sleep registers are available
264 */ 264 */
265 status = sleep_functions->extended_function(sleep_state, flags); 265 status = sleep_functions->extended_function(sleep_state);
266 return (status); 266 return (status);
267 267
268#endif /* !ACPI_REDUCED_HARDWARE */ 268#endif /* !ACPI_REDUCED_HARDWARE */
@@ -349,7 +349,6 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
349 * FUNCTION: acpi_enter_sleep_state 349 * FUNCTION: acpi_enter_sleep_state
350 * 350 *
351 * PARAMETERS: sleep_state - Which sleep state to enter 351 * PARAMETERS: sleep_state - Which sleep state to enter
352 * flags - ACPI_EXECUTE_GTS to run optional method
353 * 352 *
354 * RETURN: Status 353 * RETURN: Status
355 * 354 *
@@ -357,7 +356,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
357 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED 356 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
358 * 357 *
359 ******************************************************************************/ 358 ******************************************************************************/
360acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state, u8 flags) 359acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
361{ 360{
362 acpi_status status; 361 acpi_status status;
363 362
@@ -371,7 +370,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state, u8 flags)
371 } 370 }
372 371
373 status = 372 status =
374 acpi_hw_sleep_dispatch(sleep_state, flags, ACPI_SLEEP_FUNCTION_ID); 373 acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID);
375 return_ACPI_STATUS(status); 374 return_ACPI_STATUS(status);
376} 375}
377 376
@@ -391,14 +390,14 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
391 * Called with interrupts DISABLED. 390 * Called with interrupts DISABLED.
392 * 391 *
393 ******************************************************************************/ 392 ******************************************************************************/
394acpi_status acpi_leave_sleep_state_prep(u8 sleep_state, u8 flags) 393acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
395{ 394{
396 acpi_status status; 395 acpi_status status;
397 396
398 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep); 397 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
399 398
400 status = 399 status =
401 acpi_hw_sleep_dispatch(sleep_state, flags, 400 acpi_hw_sleep_dispatch(sleep_state,
402 ACPI_WAKE_PREP_FUNCTION_ID); 401 ACPI_WAKE_PREP_FUNCTION_ID);
403 return_ACPI_STATUS(status); 402 return_ACPI_STATUS(status);
404} 403}
@@ -423,8 +422,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
423 422
424 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); 423 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
425 424
426 425 status = acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_FUNCTION_ID);
427 status = acpi_hw_sleep_dispatch(sleep_state, 0, ACPI_WAKE_FUNCTION_ID);
428 return_ACPI_STATUS(status); 426 return_ACPI_STATUS(status);
429} 427}
430 428
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index ff2c876ec412..45e3e1759fb8 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1052,6 +1052,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
1052 return 0; 1052 return 0;
1053} 1053}
1054 1054
1055#ifdef CONFIG_PM_SLEEP
1055/* this is needed to learn about changes made in suspended state */ 1056/* this is needed to learn about changes made in suspended state */
1056static int acpi_battery_resume(struct device *dev) 1057static int acpi_battery_resume(struct device *dev)
1057{ 1058{
@@ -1068,6 +1069,7 @@ static int acpi_battery_resume(struct device *dev)
1068 acpi_battery_update(battery); 1069 acpi_battery_update(battery);
1069 return 0; 1070 return 0;
1070} 1071}
1072#endif
1071 1073
1072static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume); 1074static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
1073 1075
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 79d4c22f7a6d..314a3b84bbc7 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -78,7 +78,9 @@ static int acpi_button_add(struct acpi_device *device);
78static int acpi_button_remove(struct acpi_device *device, int type); 78static int acpi_button_remove(struct acpi_device *device, int type);
79static void acpi_button_notify(struct acpi_device *device, u32 event); 79static void acpi_button_notify(struct acpi_device *device, u32 event);
80 80
81#ifdef CONFIG_PM_SLEEP
81static int acpi_button_resume(struct device *dev); 82static int acpi_button_resume(struct device *dev);
83#endif
82static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume); 84static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume);
83 85
84static struct acpi_driver acpi_button_driver = { 86static struct acpi_driver acpi_button_driver = {
@@ -310,6 +312,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
310 } 312 }
311} 313}
312 314
315#ifdef CONFIG_PM_SLEEP
313static int acpi_button_resume(struct device *dev) 316static int acpi_button_resume(struct device *dev)
314{ 317{
315 struct acpi_device *device = to_acpi_device(dev); 318 struct acpi_device *device = to_acpi_device(dev);
@@ -319,6 +322,7 @@ static int acpi_button_resume(struct device *dev)
319 return acpi_lid_send_state(device); 322 return acpi_lid_send_state(device);
320 return 0; 323 return 0;
321} 324}
325#endif
322 326
323static int acpi_button_add(struct acpi_device *device) 327static int acpi_button_add(struct acpi_device *device)
324{ 328{
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 669d9ee80d16..bc36a476f1ab 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -53,8 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = {
53}; 53};
54MODULE_DEVICE_TABLE(acpi, fan_device_ids); 54MODULE_DEVICE_TABLE(acpi, fan_device_ids);
55 55
56#ifdef CONFIG_PM_SLEEP
56static int acpi_fan_suspend(struct device *dev); 57static int acpi_fan_suspend(struct device *dev);
57static int acpi_fan_resume(struct device *dev); 58static int acpi_fan_resume(struct device *dev);
59#endif
58static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume); 60static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);
59 61
60static struct acpi_driver acpi_fan_driver = { 62static struct acpi_driver acpi_fan_driver = {
@@ -184,6 +186,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
184 return 0; 186 return 0;
185} 187}
186 188
189#ifdef CONFIG_PM_SLEEP
187static int acpi_fan_suspend(struct device *dev) 190static int acpi_fan_suspend(struct device *dev)
188{ 191{
189 if (!dev) 192 if (!dev)
@@ -207,6 +210,7 @@ static int acpi_fan_resume(struct device *dev)
207 210
208 return result; 211 return result;
209} 212}
213#endif
210 214
211static int __init acpi_fan_init(void) 215static int __init acpi_fan_init(void)
212{ 216{
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index e56f3be7b07d..cb31298ca684 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -237,6 +237,8 @@ acpi_parse_processor_affinity(struct acpi_subtable_header *header,
237 return 0; 237 return 0;
238} 238}
239 239
240static int __initdata parsed_numa_memblks;
241
240static int __init 242static int __init
241acpi_parse_memory_affinity(struct acpi_subtable_header * header, 243acpi_parse_memory_affinity(struct acpi_subtable_header * header,
242 const unsigned long end) 244 const unsigned long end)
@@ -250,8 +252,8 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,
250 acpi_table_print_srat_entry(header); 252 acpi_table_print_srat_entry(header);
251 253
252 /* let architecture-dependent part to do it */ 254 /* let architecture-dependent part to do it */
253 acpi_numa_memory_affinity_init(memory_affinity); 255 if (!acpi_numa_memory_affinity_init(memory_affinity))
254 256 parsed_numa_memblks++;
255 return 0; 257 return 0;
256} 258}
257 259
@@ -304,8 +306,10 @@ int __init acpi_numa_init(void)
304 306
305 acpi_numa_arch_fixup(); 307 acpi_numa_arch_fixup();
306 308
307 if (cnt <= 0) 309 if (cnt < 0)
308 return cnt ?: -ENOENT; 310 return cnt;
311 else if (!parsed_numa_memblks)
312 return -ENOENT;
309 return 0; 313 return 0;
310} 314}
311 315
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ec54014c321c..72a2c98bc429 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -573,8 +573,15 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
573 OSC_CLOCK_PWR_CAPABILITY_SUPPORT; 573 OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
574 if (pci_msi_enabled()) 574 if (pci_msi_enabled())
575 flags |= OSC_MSI_SUPPORT; 575 flags |= OSC_MSI_SUPPORT;
576 if (flags != base_flags) 576 if (flags != base_flags) {
577 acpi_pci_osc_support(root, flags); 577 status = acpi_pci_osc_support(root, flags);
578 if (ACPI_FAILURE(status)) {
579 dev_info(root->bus->bridge, "ACPI _OSC support "
580 "notification failed, disabling PCIe ASPM\n");
581 pcie_no_aspm();
582 flags = base_flags;
583 }
584 }
578 585
579 if (!pcie_ports_disabled 586 if (!pcie_ports_disabled
580 && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { 587 && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 215ecd097408..fc1803414629 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -67,7 +67,9 @@ static const struct acpi_device_id power_device_ids[] = {
67}; 67};
68MODULE_DEVICE_TABLE(acpi, power_device_ids); 68MODULE_DEVICE_TABLE(acpi, power_device_ids);
69 69
70#ifdef CONFIG_PM_SLEEP
70static int acpi_power_resume(struct device *dev); 71static int acpi_power_resume(struct device *dev);
72#endif
71static SIMPLE_DEV_PM_OPS(acpi_power_pm, NULL, acpi_power_resume); 73static SIMPLE_DEV_PM_OPS(acpi_power_pm, NULL, acpi_power_resume);
72 74
73static struct acpi_driver acpi_power_driver = { 75static struct acpi_driver acpi_power_driver = {
@@ -775,6 +777,7 @@ static int acpi_power_remove(struct acpi_device *device, int type)
775 return 0; 777 return 0;
776} 778}
777 779
780#ifdef CONFIG_PM_SLEEP
778static int acpi_power_resume(struct device *dev) 781static int acpi_power_resume(struct device *dev)
779{ 782{
780 int result = 0, state; 783 int result = 0, state;
@@ -803,6 +806,7 @@ static int acpi_power_resume(struct device *dev)
803 806
804 return result; 807 return result;
805} 808}
809#endif
806 810
807int __init acpi_power_init(void) 811int __init acpi_power_init(void)
808{ 812{
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index ff8e04f2fab4..bfc31cb0dd3e 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -437,7 +437,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
437 /* Normal CPU soft online event */ 437 /* Normal CPU soft online event */
438 } else { 438 } else {
439 acpi_processor_ppc_has_changed(pr, 0); 439 acpi_processor_ppc_has_changed(pr, 0);
440 acpi_processor_cst_has_changed(pr); 440 acpi_processor_hotplug(pr);
441 acpi_processor_reevaluate_tstate(pr, action); 441 acpi_processor_reevaluate_tstate(pr, action);
442 acpi_processor_tstate_has_changed(pr); 442 acpi_processor_tstate_has_changed(pr);
443 } 443 }
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index c0b9aa5faf4c..ff0740e0a9c2 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -988,6 +988,7 @@ static void acpi_sbs_rmdirs(void)
988#endif 988#endif
989} 989}
990 990
991#ifdef CONFIG_PM_SLEEP
991static int acpi_sbs_resume(struct device *dev) 992static int acpi_sbs_resume(struct device *dev)
992{ 993{
993 struct acpi_sbs *sbs; 994 struct acpi_sbs *sbs;
@@ -997,6 +998,7 @@ static int acpi_sbs_resume(struct device *dev)
997 acpi_sbs_callback(sbs); 998 acpi_sbs_callback(sbs);
998 return 0; 999 return 0;
999} 1000}
1001#endif
1000 1002
1001static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume); 1003static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
1002 1004
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 7a7a9c929247..fdcdbb652915 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -28,36 +28,7 @@
28#include "internal.h" 28#include "internal.h"
29#include "sleep.h" 29#include "sleep.h"
30 30
31u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS;
32static unsigned int gts, bfs;
33static int set_param_wake_flag(const char *val, struct kernel_param *kp)
34{
35 int ret = param_set_int(val, kp);
36
37 if (ret)
38 return ret;
39
40 if (kp->arg == (const char *)&gts) {
41 if (gts)
42 wake_sleep_flags |= ACPI_EXECUTE_GTS;
43 else
44 wake_sleep_flags &= ~ACPI_EXECUTE_GTS;
45 }
46 if (kp->arg == (const char *)&bfs) {
47 if (bfs)
48 wake_sleep_flags |= ACPI_EXECUTE_BFS;
49 else
50 wake_sleep_flags &= ~ACPI_EXECUTE_BFS;
51 }
52 return ret;
53}
54module_param_call(gts, set_param_wake_flag, param_get_int, &gts, 0644);
55module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644);
56MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
57MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
58
59static u8 sleep_states[ACPI_S_STATE_COUNT]; 31static u8 sleep_states[ACPI_S_STATE_COUNT];
60static bool pwr_btn_event_pending;
61 32
62static void acpi_sleep_tts_switch(u32 acpi_state) 33static void acpi_sleep_tts_switch(u32 acpi_state)
63{ 34{
@@ -110,6 +81,7 @@ static int acpi_sleep_prepare(u32 acpi_state)
110 81
111#ifdef CONFIG_ACPI_SLEEP 82#ifdef CONFIG_ACPI_SLEEP
112static u32 acpi_target_sleep_state = ACPI_STATE_S0; 83static u32 acpi_target_sleep_state = ACPI_STATE_S0;
84static bool pwr_btn_event_pending;
113 85
114/* 86/*
115 * The ACPI specification wants us to save NVS memory regions during hibernation 87 * The ACPI specification wants us to save NVS memory regions during hibernation
@@ -305,7 +277,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
305 switch (acpi_state) { 277 switch (acpi_state) {
306 case ACPI_STATE_S1: 278 case ACPI_STATE_S1:
307 barrier(); 279 barrier();
308 status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); 280 status = acpi_enter_sleep_state(acpi_state);
309 break; 281 break;
310 282
311 case ACPI_STATE_S3: 283 case ACPI_STATE_S3:
@@ -319,8 +291,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
319 /* This violates the spec but is required for bug compatibility. */ 291 /* This violates the spec but is required for bug compatibility. */
320 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); 292 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
321 293
322 /* Reprogram control registers and execute _BFS */ 294 /* Reprogram control registers */
323 acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); 295 acpi_leave_sleep_state_prep(acpi_state);
324 296
325 /* ACPI 3.0 specs (P62) says that it's the responsibility 297 /* ACPI 3.0 specs (P62) says that it's the responsibility
326 * of the OSPM to clear the status bit [ implying that the 298 * of the OSPM to clear the status bit [ implying that the
@@ -603,9 +575,9 @@ static int acpi_hibernation_enter(void)
603 ACPI_FLUSH_CPU_CACHE(); 575 ACPI_FLUSH_CPU_CACHE();
604 576
605 /* This shouldn't return. If it returns, we have a problem */ 577 /* This shouldn't return. If it returns, we have a problem */
606 status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); 578 status = acpi_enter_sleep_state(ACPI_STATE_S4);
607 /* Reprogram control registers and execute _BFS */ 579 /* Reprogram control registers */
608 acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); 580 acpi_leave_sleep_state_prep(ACPI_STATE_S4);
609 581
610 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 582 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
611} 583}
@@ -617,8 +589,8 @@ static void acpi_hibernation_leave(void)
617 * enable it here. 589 * enable it here.
618 */ 590 */
619 acpi_enable(); 591 acpi_enable();
620 /* Reprogram control registers and execute _BFS */ 592 /* Reprogram control registers */
621 acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); 593 acpi_leave_sleep_state_prep(ACPI_STATE_S4);
622 /* Check the hardware signature */ 594 /* Check the hardware signature */
623 if (facs && s4_hardware_signature != facs->hardware_signature) { 595 if (facs && s4_hardware_signature != facs->hardware_signature) {
624 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " 596 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
@@ -892,33 +864,7 @@ static void acpi_power_off(void)
892 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 864 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
893 printk(KERN_DEBUG "%s called\n", __func__); 865 printk(KERN_DEBUG "%s called\n", __func__);
894 local_irq_disable(); 866 local_irq_disable();
895 acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); 867 acpi_enter_sleep_state(ACPI_STATE_S5);
896}
897
898/*
899 * ACPI 2.0 created the optional _GTS and _BFS,
900 * but industry adoption has been neither rapid nor broad.
901 *
902 * Linux gets into trouble when it executes poorly validated
903 * paths through the BIOS, so disable _GTS and _BFS by default,
904 * but do speak up and offer the option to enable them.
905 */
906static void __init acpi_gts_bfs_check(void)
907{
908 acpi_handle dummy;
909
910 if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_PATHNAME__GTS, &dummy)))
911 {
912 printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n");
913 printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, "
914 "please notify linux-acpi@vger.kernel.org\n");
915 }
916 if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_PATHNAME__BFS, &dummy)))
917 {
918 printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n");
919 printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, "
920 "please notify linux-acpi@vger.kernel.org\n");
921 }
922} 868}
923 869
924int __init acpi_sleep_init(void) 870int __init acpi_sleep_init(void)
@@ -979,6 +925,5 @@ int __init acpi_sleep_init(void)
979 * object can also be evaluated when the system enters S5. 925 * object can also be evaluated when the system enters S5.
980 */ 926 */
981 register_reboot_notifier(&tts_notifier); 927 register_reboot_notifier(&tts_notifier);
982 acpi_gts_bfs_check();
983 return 0; 928 return 0;
984} 929}
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 240a24400976..7c3f98ba4afe 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"))) { 176 if (!strncmp(val, "enable", sizeof("enable") - 1)) {
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"))) { 184 if (!strncmp(val, "disable", sizeof("disable") - 1)) {
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/thermal.c b/drivers/acpi/thermal.c
index 9fe90e9fecb5..edda74a43406 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -106,7 +106,9 @@ static const struct acpi_device_id thermal_device_ids[] = {
106}; 106};
107MODULE_DEVICE_TABLE(acpi, thermal_device_ids); 107MODULE_DEVICE_TABLE(acpi, thermal_device_ids);
108 108
109#ifdef CONFIG_PM_SLEEP
109static int acpi_thermal_resume(struct device *dev); 110static int acpi_thermal_resume(struct device *dev);
111#endif
110static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume); 112static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume);
111 113
112static struct acpi_driver acpi_thermal_driver = { 114static struct acpi_driver acpi_thermal_driver = {
@@ -1041,6 +1043,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1041 return 0; 1043 return 0;
1042} 1044}
1043 1045
1046#ifdef CONFIG_PM_SLEEP
1044static int acpi_thermal_resume(struct device *dev) 1047static int acpi_thermal_resume(struct device *dev)
1045{ 1048{
1046 struct acpi_thermal *tz; 1049 struct acpi_thermal *tz;
@@ -1075,6 +1078,7 @@ static int acpi_thermal_resume(struct device *dev)
1075 1078
1076 return AE_OK; 1079 return AE_OK;
1077} 1080}
1081#endif
1078 1082
1079static int thermal_act(const struct dmi_system_id *d) { 1083static int thermal_act(const struct dmi_system_id *d) {
1080 1084
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index d4386019af5d..96cce6d53195 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2362,7 +2362,7 @@ static int __devinit ia_init(struct atm_dev *dev)
2362 { 2362 {
2363 printk(DEV_LABEL " (itf %d): can't set up page mapping\n", 2363 printk(DEV_LABEL " (itf %d): can't set up page mapping\n",
2364 dev->number); 2364 dev->number);
2365 return error; 2365 return -ENOMEM;
2366 } 2366 }
2367 IF_INIT(printk(DEV_LABEL " (itf %d): rev.%d,base=%p,irq=%d\n", 2367 IF_INIT(printk(DEV_LABEL " (itf %d): rev.%d,base=%p,irq=%d\n",
2368 dev->number, iadev->pci->revision, base, iadev->irq);) 2368 dev->number, iadev->pci->revision, base, iadev->irq);)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f338037a4f3d..cdd01c52c629 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1865,6 +1865,7 @@ int __dev_printk(const char *level, const struct device *dev,
1865 struct va_format *vaf) 1865 struct va_format *vaf)
1866{ 1866{
1867 char dict[128]; 1867 char dict[128];
1868 const char *level_extra = "";
1868 size_t dictlen = 0; 1869 size_t dictlen = 0;
1869 const char *subsys; 1870 const char *subsys;
1870 1871
@@ -1911,10 +1912,14 @@ int __dev_printk(const char *level, const struct device *dev,
1911 "DEVICE=+%s:%s", subsys, dev_name(dev)); 1912 "DEVICE=+%s:%s", subsys, dev_name(dev));
1912 } 1913 }
1913skip: 1914skip:
1915 if (level[3])
1916 level_extra = &level[3]; /* skip past "<L>" */
1917
1914 return printk_emit(0, level[1] - '0', 1918 return printk_emit(0, level[1] - '0',
1915 dictlen ? dict : NULL, dictlen, 1919 dictlen ? dict : NULL, dictlen,
1916 "%s %s: %pV", 1920 "%s %s: %s%pV",
1917 dev_driver_string(dev), dev_name(dev), vaf); 1921 dev_driver_string(dev), dev_name(dev),
1922 level_extra, vaf);
1918} 1923}
1919EXPORT_SYMBOL(__dev_printk); 1924EXPORT_SYMBOL(__dev_printk);
1920 1925
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 869d7ff2227f..eb78e9640c4a 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -169,8 +169,7 @@ void pm_clk_init(struct device *dev)
169 */ 169 */
170int pm_clk_create(struct device *dev) 170int pm_clk_create(struct device *dev)
171{ 171{
172 int ret = dev_pm_get_subsys_data(dev); 172 return dev_pm_get_subsys_data(dev);
173 return ret < 0 ? ret : 0;
174} 173}
175 174
176/** 175/**
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index a14085cc613f..39c32529b833 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -24,7 +24,6 @@
24int dev_pm_get_subsys_data(struct device *dev) 24int dev_pm_get_subsys_data(struct device *dev)
25{ 25{
26 struct pm_subsys_data *psd; 26 struct pm_subsys_data *psd;
27 int ret = 0;
28 27
29 psd = kzalloc(sizeof(*psd), GFP_KERNEL); 28 psd = kzalloc(sizeof(*psd), GFP_KERNEL);
30 if (!psd) 29 if (!psd)
@@ -40,7 +39,6 @@ int dev_pm_get_subsys_data(struct device *dev)
40 dev->power.subsys_data = psd; 39 dev->power.subsys_data = psd;
41 pm_clk_init(dev); 40 pm_clk_init(dev);
42 psd = NULL; 41 psd = NULL;
43 ret = 1;
44 } 42 }
45 43
46 spin_unlock_irq(&dev->power.lock); 44 spin_unlock_irq(&dev->power.lock);
@@ -48,7 +46,7 @@ int dev_pm_get_subsys_data(struct device *dev)
48 /* kfree() verifies that its argument is nonzero. */ 46 /* kfree() verifies that its argument is nonzero. */
49 kfree(psd); 47 kfree(psd);
50 48
51 return ret; 49 return 0;
52} 50}
53EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data); 51EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data);
54 52
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 11b32d2642df..a6e5672c67e7 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -272,6 +272,7 @@ static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = {
272 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, 272 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
273 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, 273 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) },
274 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, 274 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
275 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
275 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, 276 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
276 { 0, }, 277 { 0, },
277}; 278};
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index 26823d97fd9f..9ea4627dc0c2 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
@@ -507,7 +507,9 @@ static bool bcma_sprom_onchip_available(struct bcma_bus *bus)
507 /* for these chips OTP is always available */ 507 /* for these chips OTP is always available */
508 present = true; 508 present = true;
509 break; 509 break;
510 510 case BCMA_CHIP_ID_BCM43228:
511 present = chip_status & BCMA_CC_CHIPST_43228_OTP_PRESENT;
512 break;
511 default: 513 default:
512 present = false; 514 present = false;
513 break; 515 break;
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 2e0e7fc1dbba..dbe6135a2abe 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3537,9 +3537,9 @@ static void drbd_cleanup(void)
3537} 3537}
3538 3538
3539/** 3539/**
3540 * drbd_congested() - Callback for pdflush 3540 * drbd_congested() - Callback for the flusher thread
3541 * @congested_data: User data 3541 * @congested_data: User data
3542 * @bdi_bits: Bits pdflush is currently interested in 3542 * @bdi_bits: Bits the BDI flusher thread is currently interested in
3543 * 3543 *
3544 * Returns 1<<BDI_async_congested and/or 1<<BDI_sync_congested if we are congested. 3544 * Returns 1<<BDI_async_congested and/or 1<<BDI_sync_congested if we are congested.
3545 */ 3545 */
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h
index 57226424690c..6f007b6c240d 100644
--- a/drivers/char/agp/intel-agp.h
+++ b/drivers/char/agp/intel-agp.h
@@ -239,16 +239,45 @@
239#define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG 0x016A 239#define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG 0x016A
240#define PCI_DEVICE_ID_INTEL_VALLEYVIEW_HB 0x0F00 /* VLV1 */ 240#define PCI_DEVICE_ID_INTEL_VALLEYVIEW_HB 0x0F00 /* VLV1 */
241#define PCI_DEVICE_ID_INTEL_VALLEYVIEW_IG 0x0F30 241#define PCI_DEVICE_ID_INTEL_VALLEYVIEW_IG 0x0F30
242#define PCI_DEVICE_ID_INTEL_HASWELL_HB 0x0400 /* Desktop */ 242#define PCI_DEVICE_ID_INTEL_HASWELL_HB 0x0400 /* Desktop */
243#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG 0x0402 243#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG 0x0402
244#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG 0x0412 244#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG 0x0412
245#define PCI_DEVICE_ID_INTEL_HASWELL_M_HB 0x0404 /* Mobile */ 245#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_PLUS_IG 0x0422
246#define PCI_DEVICE_ID_INTEL_HASWELL_M_HB 0x0404 /* Mobile */
246#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG 0x0406 247#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG 0x0406
247#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG 0x0416 248#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG 0x0416
248#define PCI_DEVICE_ID_INTEL_HASWELL_S_HB 0x0408 /* Server */ 249#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_PLUS_IG 0x0426
250#define PCI_DEVICE_ID_INTEL_HASWELL_S_HB 0x0408 /* Server */
249#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG 0x040a 251#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG 0x040a
250#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG 0x041a 252#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG 0x041a
251#define PCI_DEVICE_ID_INTEL_HASWELL_SDV 0x0c16 /* SDV */ 253#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_PLUS_IG 0x042a
252#define PCI_DEVICE_ID_INTEL_HASWELL_E_HB 0x0c04 254#define PCI_DEVICE_ID_INTEL_HASWELL_E_HB 0x0c04
255#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_D_GT1_IG 0x0C02
256#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_D_GT2_IG 0x0C12
257#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_D_GT2_PLUS_IG 0x0C22
258#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_M_GT1_IG 0x0C06
259#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_M_GT2_IG 0x0C16
260#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_M_GT2_PLUS_IG 0x0C26
261#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_S_GT1_IG 0x0C0A
262#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_S_GT2_IG 0x0C1A
263#define PCI_DEVICE_ID_INTEL_HASWELL_SDV_S_GT2_PLUS_IG 0x0C2A
264#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_D_GT1_IG 0x0A02
265#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_D_GT2_IG 0x0A12
266#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_D_GT2_PLUS_IG 0x0A22
267#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_M_GT1_IG 0x0A06
268#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_M_GT2_IG 0x0A16
269#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_M_GT2_PLUS_IG 0x0A26
270#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_S_GT1_IG 0x0A0A
271#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_S_GT2_IG 0x0A1A
272#define PCI_DEVICE_ID_INTEL_HASWELL_ULT_S_GT2_PLUS_IG 0x0A2A
273#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_D_GT1_IG 0x0D12
274#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_D_GT2_IG 0x0D22
275#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_D_GT2_PLUS_IG 0x0D32
276#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_M_GT1_IG 0x0D16
277#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_M_GT2_IG 0x0D26
278#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_M_GT2_PLUS_IG 0x0D36
279#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_S_GT1_IG 0x0D1A
280#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_S_GT2_IG 0x0D2A
281#define PCI_DEVICE_ID_INTEL_HASWELL_CRW_S_GT2_PLUS_IG 0x0D3A
253 282
254#endif 283#endif
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9ed92ef5829b..08fc5cbb13cd 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -1502,15 +1502,73 @@ static const struct intel_gtt_driver_description {
1502 "Haswell", &sandybridge_gtt_driver }, 1502 "Haswell", &sandybridge_gtt_driver },
1503 { PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG, 1503 { PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG,
1504 "Haswell", &sandybridge_gtt_driver }, 1504 "Haswell", &sandybridge_gtt_driver },
1505 { PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_PLUS_IG,
1506 "Haswell", &sandybridge_gtt_driver },
1505 { PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG, 1507 { PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG,
1506 "Haswell", &sandybridge_gtt_driver }, 1508 "Haswell", &sandybridge_gtt_driver },
1507 { PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG, 1509 { PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG,
1508 "Haswell", &sandybridge_gtt_driver }, 1510 "Haswell", &sandybridge_gtt_driver },
1511 { PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_PLUS_IG,
1512 "Haswell", &sandybridge_gtt_driver },
1509 { PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG, 1513 { PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG,
1510 "Haswell", &sandybridge_gtt_driver }, 1514 "Haswell", &sandybridge_gtt_driver },
1511 { PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG, 1515 { PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG,
1512 "Haswell", &sandybridge_gtt_driver }, 1516 "Haswell", &sandybridge_gtt_driver },
1513 { PCI_DEVICE_ID_INTEL_HASWELL_SDV, 1517 { PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_PLUS_IG,
1518 "Haswell", &sandybridge_gtt_driver },
1519 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_D_GT1_IG,
1520 "Haswell", &sandybridge_gtt_driver },
1521 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_D_GT2_IG,
1522 "Haswell", &sandybridge_gtt_driver },
1523 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_D_GT2_PLUS_IG,
1524 "Haswell", &sandybridge_gtt_driver },
1525 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_M_GT1_IG,
1526 "Haswell", &sandybridge_gtt_driver },
1527 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_M_GT2_IG,
1528 "Haswell", &sandybridge_gtt_driver },
1529 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_M_GT2_PLUS_IG,
1530 "Haswell", &sandybridge_gtt_driver },
1531 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_S_GT1_IG,
1532 "Haswell", &sandybridge_gtt_driver },
1533 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_S_GT2_IG,
1534 "Haswell", &sandybridge_gtt_driver },
1535 { PCI_DEVICE_ID_INTEL_HASWELL_SDV_S_GT2_PLUS_IG,
1536 "Haswell", &sandybridge_gtt_driver },
1537 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_D_GT1_IG,
1538 "Haswell", &sandybridge_gtt_driver },
1539 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_D_GT2_IG,
1540 "Haswell", &sandybridge_gtt_driver },
1541 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_D_GT2_PLUS_IG,
1542 "Haswell", &sandybridge_gtt_driver },
1543 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_M_GT1_IG,
1544 "Haswell", &sandybridge_gtt_driver },
1545 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_M_GT2_IG,
1546 "Haswell", &sandybridge_gtt_driver },
1547 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_M_GT2_PLUS_IG,
1548 "Haswell", &sandybridge_gtt_driver },
1549 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_S_GT1_IG,
1550 "Haswell", &sandybridge_gtt_driver },
1551 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_S_GT2_IG,
1552 "Haswell", &sandybridge_gtt_driver },
1553 { PCI_DEVICE_ID_INTEL_HASWELL_ULT_S_GT2_PLUS_IG,
1554 "Haswell", &sandybridge_gtt_driver },
1555 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_D_GT1_IG,
1556 "Haswell", &sandybridge_gtt_driver },
1557 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_D_GT2_IG,
1558 "Haswell", &sandybridge_gtt_driver },
1559 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_D_GT2_PLUS_IG,
1560 "Haswell", &sandybridge_gtt_driver },
1561 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_M_GT1_IG,
1562 "Haswell", &sandybridge_gtt_driver },
1563 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_M_GT2_IG,
1564 "Haswell", &sandybridge_gtt_driver },
1565 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_M_GT2_PLUS_IG,
1566 "Haswell", &sandybridge_gtt_driver },
1567 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_S_GT1_IG,
1568 "Haswell", &sandybridge_gtt_driver },
1569 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_S_GT2_IG,
1570 "Haswell", &sandybridge_gtt_driver },
1571 { PCI_DEVICE_ID_INTEL_HASWELL_CRW_S_GT2_PLUS_IG,
1514 "Haswell", &sandybridge_gtt_driver }, 1572 "Haswell", &sandybridge_gtt_driver },
1515 { 0, NULL, NULL } 1573 { 0, NULL, NULL }
1516}; 1574};
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index d706bd0e9e80..4fbdceb6f773 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -160,7 +160,7 @@ static int __exit omap_rng_remove(struct platform_device *pdev)
160 return 0; 160 return 0;
161} 161}
162 162
163#ifdef CONFIG_PM 163#ifdef CONFIG_PM_SLEEP
164 164
165static int omap_rng_suspend(struct device *dev) 165static int omap_rng_suspend(struct device *dev)
166{ 166{
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 89682fa8801e..c4be3519a587 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -807,6 +807,7 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
807MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); 807MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
808#endif 808#endif
809 809
810#ifdef CONFIG_PM_SLEEP
810static int tpm_tis_resume(struct device *dev) 811static int tpm_tis_resume(struct device *dev)
811{ 812{
812 struct tpm_chip *chip = dev_get_drvdata(dev); 813 struct tpm_chip *chip = dev_get_drvdata(dev);
@@ -816,6 +817,7 @@ static int tpm_tis_resume(struct device *dev)
816 817
817 return tpm_pm_resume(dev); 818 return tpm_pm_resume(dev);
818} 819}
820#endif
819 821
820static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); 822static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume);
821 823
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index cdc02ac8f41a..503996a94a6a 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -454,6 +454,7 @@ static int __init pcc_cpufreq_probe(void)
454 mem_resource->address_length); 454 mem_resource->address_length);
455 if (pcch_virt_addr == NULL) { 455 if (pcch_virt_addr == NULL) {
456 pr_debug("probe: could not map shared mem region\n"); 456 pr_debug("probe: could not map shared mem region\n");
457 ret = -ENOMEM;
457 goto out_free; 458 goto out_free;
458 } 459 }
459 pcch_hdr = pcch_virt_addr; 460 pcch_hdr = pcch_virt_addr;
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index fcfeb3cd8d31..5084975d793c 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -172,7 +172,8 @@ struct imxdma_engine {
172 struct device_dma_parameters dma_parms; 172 struct device_dma_parameters dma_parms;
173 struct dma_device dma_device; 173 struct dma_device dma_device;
174 void __iomem *base; 174 void __iomem *base;
175 struct clk *dma_clk; 175 struct clk *dma_ahb;
176 struct clk *dma_ipg;
176 spinlock_t lock; 177 spinlock_t lock;
177 struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS]; 178 struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS];
178 struct imxdma_channel channel[IMX_DMA_CHANNELS]; 179 struct imxdma_channel channel[IMX_DMA_CHANNELS];
@@ -976,10 +977,20 @@ static int __init imxdma_probe(struct platform_device *pdev)
976 return 0; 977 return 0;
977 } 978 }
978 979
979 imxdma->dma_clk = clk_get(NULL, "dma"); 980 imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
980 if (IS_ERR(imxdma->dma_clk)) 981 if (IS_ERR(imxdma->dma_ipg)) {
981 return PTR_ERR(imxdma->dma_clk); 982 ret = PTR_ERR(imxdma->dma_ipg);
982 clk_enable(imxdma->dma_clk); 983 goto err_clk;
984 }
985
986 imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
987 if (IS_ERR(imxdma->dma_ahb)) {
988 ret = PTR_ERR(imxdma->dma_ahb);
989 goto err_clk;
990 }
991
992 clk_prepare_enable(imxdma->dma_ipg);
993 clk_prepare_enable(imxdma->dma_ahb);
983 994
984 /* reset DMA module */ 995 /* reset DMA module */
985 imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR); 996 imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
@@ -988,16 +999,14 @@ static int __init imxdma_probe(struct platform_device *pdev)
988 ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", imxdma); 999 ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", imxdma);
989 if (ret) { 1000 if (ret) {
990 dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); 1001 dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
991 kfree(imxdma); 1002 goto err_enable;
992 return ret;
993 } 1003 }
994 1004
995 ret = request_irq(MX1_DMA_ERR, imxdma_err_handler, 0, "DMA", imxdma); 1005 ret = request_irq(MX1_DMA_ERR, imxdma_err_handler, 0, "DMA", imxdma);
996 if (ret) { 1006 if (ret) {
997 dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); 1007 dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
998 free_irq(MX1_DMA_INT, NULL); 1008 free_irq(MX1_DMA_INT, NULL);
999 kfree(imxdma); 1009 goto err_enable;
1000 return ret;
1001 } 1010 }
1002 } 1011 }
1003 1012
@@ -1094,7 +1103,10 @@ err_init:
1094 free_irq(MX1_DMA_INT, NULL); 1103 free_irq(MX1_DMA_INT, NULL);
1095 free_irq(MX1_DMA_ERR, NULL); 1104 free_irq(MX1_DMA_ERR, NULL);
1096 } 1105 }
1097 1106err_enable:
1107 clk_disable_unprepare(imxdma->dma_ipg);
1108 clk_disable_unprepare(imxdma->dma_ahb);
1109err_clk:
1098 kfree(imxdma); 1110 kfree(imxdma);
1099 return ret; 1111 return ret;
1100} 1112}
@@ -1114,7 +1126,9 @@ static int __exit imxdma_remove(struct platform_device *pdev)
1114 free_irq(MX1_DMA_ERR, NULL); 1126 free_irq(MX1_DMA_ERR, NULL);
1115 } 1127 }
1116 1128
1117 kfree(imxdma); 1129 clk_disable_unprepare(imxdma->dma_ipg);
1130 clk_disable_unprepare(imxdma->dma_ahb);
1131 kfree(imxdma);
1118 1132
1119 return 0; 1133 return 0;
1120} 1134}
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index d52dbc6c54ab..24acd711e032 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1119,15 +1119,21 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
1119static int tegra_dma_alloc_chan_resources(struct dma_chan *dc) 1119static int tegra_dma_alloc_chan_resources(struct dma_chan *dc)
1120{ 1120{
1121 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); 1121 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
1122 struct tegra_dma *tdma = tdc->tdma;
1123 int ret;
1122 1124
1123 dma_cookie_init(&tdc->dma_chan); 1125 dma_cookie_init(&tdc->dma_chan);
1124 tdc->config_init = false; 1126 tdc->config_init = false;
1125 return 0; 1127 ret = clk_prepare_enable(tdma->dma_clk);
1128 if (ret < 0)
1129 dev_err(tdc2dev(tdc), "clk_prepare_enable failed: %d\n", ret);
1130 return ret;
1126} 1131}
1127 1132
1128static void tegra_dma_free_chan_resources(struct dma_chan *dc) 1133static void tegra_dma_free_chan_resources(struct dma_chan *dc)
1129{ 1134{
1130 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); 1135 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
1136 struct tegra_dma *tdma = tdc->tdma;
1131 1137
1132 struct tegra_dma_desc *dma_desc; 1138 struct tegra_dma_desc *dma_desc;
1133 struct tegra_dma_sg_req *sg_req; 1139 struct tegra_dma_sg_req *sg_req;
@@ -1163,6 +1169,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
1163 list_del(&sg_req->node); 1169 list_del(&sg_req->node);
1164 kfree(sg_req); 1170 kfree(sg_req);
1165 } 1171 }
1172 clk_disable_unprepare(tdma->dma_clk);
1166} 1173}
1167 1174
1168/* Tegra20 specific DMA controller information */ 1175/* Tegra20 specific DMA controller information */
@@ -1255,6 +1262,13 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
1255 } 1262 }
1256 } 1263 }
1257 1264
1265 /* Enable clock before accessing registers */
1266 ret = clk_prepare_enable(tdma->dma_clk);
1267 if (ret < 0) {
1268 dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
1269 goto err_pm_disable;
1270 }
1271
1258 /* Reset DMA controller */ 1272 /* Reset DMA controller */
1259 tegra_periph_reset_assert(tdma->dma_clk); 1273 tegra_periph_reset_assert(tdma->dma_clk);
1260 udelay(2); 1274 udelay(2);
@@ -1265,6 +1279,8 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
1265 tdma_write(tdma, TEGRA_APBDMA_CONTROL, 0); 1279 tdma_write(tdma, TEGRA_APBDMA_CONTROL, 0);
1266 tdma_write(tdma, TEGRA_APBDMA_IRQ_MASK_SET, 0xFFFFFFFFul); 1280 tdma_write(tdma, TEGRA_APBDMA_IRQ_MASK_SET, 0xFFFFFFFFul);
1267 1281
1282 clk_disable_unprepare(tdma->dma_clk);
1283
1268 INIT_LIST_HEAD(&tdma->dma_dev.channels); 1284 INIT_LIST_HEAD(&tdma->dma_dev.channels);
1269 for (i = 0; i < cdata->nr_channels; i++) { 1285 for (i = 0; i < cdata->nr_channels; i++) {
1270 struct tegra_dma_channel *tdc = &tdma->channels[i]; 1286 struct tegra_dma_channel *tdc = &tdma->channels[i];
diff --git a/drivers/extcon/extcon_gpio.c b/drivers/extcon/extcon_gpio.c
index fe3db45fa83c..3cc152e690b0 100644
--- a/drivers/extcon/extcon_gpio.c
+++ b/drivers/extcon/extcon_gpio.c
@@ -107,7 +107,8 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev)
107 if (ret < 0) 107 if (ret < 0)
108 return ret; 108 return ret;
109 109
110 ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name); 110 ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
111 pdev->name);
111 if (ret < 0) 112 if (ret < 0)
112 goto err; 113 goto err;
113 114
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 150d9768811d..ae37181798b3 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -266,7 +266,7 @@ static int __devinit em_gio_irq_domain_init(struct em_gio_priv *p)
266 return 0; 266 return 0;
267} 267}
268 268
269static void __devexit em_gio_irq_domain_cleanup(struct em_gio_priv *p) 269static void em_gio_irq_domain_cleanup(struct em_gio_priv *p)
270{ 270{
271 struct gpio_em_config *pdata = p->pdev->dev.platform_data; 271 struct gpio_em_config *pdata = p->pdev->dev.platform_data;
272 272
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index a1c8754f52cf..202a99207b7d 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -339,7 +339,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev,
339 resource_size_t start, len; 339 resource_size_t start, len;
340 struct lnw_gpio *lnw; 340 struct lnw_gpio *lnw;
341 u32 gpio_base; 341 u32 gpio_base;
342 int retval = 0; 342 int retval;
343 int ngpio = id->driver_data; 343 int ngpio = id->driver_data;
344 344
345 retval = pci_enable_device(pdev); 345 retval = pci_enable_device(pdev);
@@ -357,6 +357,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev,
357 base = ioremap_nocache(start, len); 357 base = ioremap_nocache(start, len);
358 if (!base) { 358 if (!base) {
359 dev_err(&pdev->dev, "error mapping bar1\n"); 359 dev_err(&pdev->dev, "error mapping bar1\n");
360 retval = -EFAULT;
360 goto err3; 361 goto err3;
361 } 362 }
362 gpio_base = *((u32 *)base + 1); 363 gpio_base = *((u32 *)base + 1);
@@ -381,8 +382,10 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev,
381 382
382 lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, 383 lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
383 &lnw_gpio_irq_ops, lnw); 384 &lnw_gpio_irq_ops, lnw);
384 if (!lnw->domain) 385 if (!lnw->domain) {
386 retval = -ENOMEM;
385 goto err3; 387 goto err3;
388 }
386 389
387 lnw->reg_base = base; 390 lnw->reg_base = base;
388 lnw->chip.label = dev_name(&pdev->dev); 391 lnw->chip.label = dev_name(&pdev->dev);
diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c
index 71a838f44501..b38986285868 100644
--- a/drivers/gpio/gpio-msic.c
+++ b/drivers/gpio/gpio-msic.c
@@ -99,7 +99,7 @@ static int msic_gpio_to_oreg(unsigned offset)
99 if (offset < 20) 99 if (offset < 20)
100 return INTEL_MSIC_GPIO0HV0CTLO - offset + 16; 100 return INTEL_MSIC_GPIO0HV0CTLO - offset + 16;
101 101
102 return INTEL_MSIC_GPIO1HV0CTLO + offset + 20; 102 return INTEL_MSIC_GPIO1HV0CTLO - offset + 20;
103} 103}
104 104
105static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 105static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 4db460b6ecf7..80f44bb64a87 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -465,9 +465,8 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
465 goto out_iounmap; 465 goto out_iounmap;
466 466
467 port->bgc.gc.to_irq = mxc_gpio_to_irq; 467 port->bgc.gc.to_irq = mxc_gpio_to_irq;
468 port->bgc.gc.base = pdev->id * 32; 468 port->bgc.gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
469 port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); 469 pdev->id * 32;
470 port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);
471 470
472 err = gpiochip_add(&port->bgc.gc); 471 err = gpiochip_add(&port->bgc.gc);
473 if (err) 472 if (err)
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 58a6a63a6ece..9cac88a65f78 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -62,6 +62,7 @@ int pxa_last_gpio;
62 62
63#ifdef CONFIG_OF 63#ifdef CONFIG_OF
64static struct irq_domain *domain; 64static struct irq_domain *domain;
65static struct device_node *pxa_gpio_of_node;
65#endif 66#endif
66 67
67struct pxa_gpio_chip { 68struct pxa_gpio_chip {
@@ -277,6 +278,24 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
277 (value ? GPSR_OFFSET : GPCR_OFFSET)); 278 (value ? GPSR_OFFSET : GPCR_OFFSET));
278} 279}
279 280
281#ifdef CONFIG_OF_GPIO
282static int pxa_gpio_of_xlate(struct gpio_chip *gc,
283 const struct of_phandle_args *gpiospec,
284 u32 *flags)
285{
286 if (gpiospec->args[0] > pxa_last_gpio)
287 return -EINVAL;
288
289 if (gc != &pxa_gpio_chips[gpiospec->args[0] / 32].chip)
290 return -EINVAL;
291
292 if (flags)
293 *flags = gpiospec->args[1];
294
295 return gpiospec->args[0] % 32;
296}
297#endif
298
280static int __devinit pxa_init_gpio_chip(int gpio_end, 299static int __devinit pxa_init_gpio_chip(int gpio_end,
281 int (*set_wake)(unsigned int, unsigned int)) 300 int (*set_wake)(unsigned int, unsigned int))
282{ 301{
@@ -304,6 +323,11 @@ static int __devinit pxa_init_gpio_chip(int gpio_end,
304 c->get = pxa_gpio_get; 323 c->get = pxa_gpio_get;
305 c->set = pxa_gpio_set; 324 c->set = pxa_gpio_set;
306 c->to_irq = pxa_gpio_to_irq; 325 c->to_irq = pxa_gpio_to_irq;
326#ifdef CONFIG_OF_GPIO
327 c->of_node = pxa_gpio_of_node;
328 c->of_xlate = pxa_gpio_of_xlate;
329 c->of_gpio_n_cells = 2;
330#endif
307 331
308 /* number of GPIOs on last bank may be less than 32 */ 332 /* number of GPIOs on last bank may be less than 32 */
309 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; 333 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
@@ -488,6 +512,7 @@ static int pxa_gpio_nums(void)
488 return count; 512 return count;
489} 513}
490 514
515#ifdef CONFIG_OF
491static struct of_device_id pxa_gpio_dt_ids[] = { 516static struct of_device_id pxa_gpio_dt_ids[] = {
492 { .compatible = "mrvl,pxa-gpio" }, 517 { .compatible = "mrvl,pxa-gpio" },
493 { .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO }, 518 { .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO },
@@ -505,9 +530,9 @@ static int pxa_irq_domain_map(struct irq_domain *d, unsigned int irq,
505 530
506const struct irq_domain_ops pxa_irq_domain_ops = { 531const struct irq_domain_ops pxa_irq_domain_ops = {
507 .map = pxa_irq_domain_map, 532 .map = pxa_irq_domain_map,
533 .xlate = irq_domain_xlate_twocell,
508}; 534};
509 535
510#ifdef CONFIG_OF
511static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) 536static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev)
512{ 537{
513 int ret, nr_banks, nr_gpios, irq_base; 538 int ret, nr_banks, nr_gpios, irq_base;
@@ -545,6 +570,7 @@ static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev)
545 } 570 }
546 domain = irq_domain_add_legacy(np, nr_gpios, irq_base, 0, 571 domain = irq_domain_add_legacy(np, nr_gpios, irq_base, 0,
547 &pxa_irq_domain_ops, NULL); 572 &pxa_irq_domain_ops, NULL);
573 pxa_gpio_of_node = np;
548 return 0; 574 return 0;
549err: 575err:
550 iounmap(gpio_reg_base); 576 iounmap(gpio_reg_base);
@@ -653,7 +679,7 @@ static struct platform_driver pxa_gpio_driver = {
653 .probe = pxa_gpio_probe, 679 .probe = pxa_gpio_probe,
654 .driver = { 680 .driver = {
655 .name = "pxa-gpio", 681 .name = "pxa-gpio",
656 .of_match_table = pxa_gpio_dt_ids, 682 .of_match_table = of_match_ptr(pxa_gpio_dt_ids),
657 }, 683 },
658}; 684};
659 685
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 92f7b2bb79d4..ba126cc04073 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -2454,12 +2454,6 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = {
2454 }, 2454 },
2455 }, { 2455 }, {
2456 .chip = { 2456 .chip = {
2457 .base = EXYNOS5_GPC4(0),
2458 .ngpio = EXYNOS5_GPIO_C4_NR,
2459 .label = "GPC4",
2460 },
2461 }, {
2462 .chip = {
2463 .base = EXYNOS5_GPD0(0), 2457 .base = EXYNOS5_GPD0(0),
2464 .ngpio = EXYNOS5_GPIO_D0_NR, 2458 .ngpio = EXYNOS5_GPIO_D0_NR,
2465 .label = "GPD0", 2459 .label = "GPD0",
@@ -2513,6 +2507,12 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = {
2513 .label = "GPY6", 2507 .label = "GPY6",
2514 }, 2508 },
2515 }, { 2509 }, {
2510 .chip = {
2511 .base = EXYNOS5_GPC4(0),
2512 .ngpio = EXYNOS5_GPIO_C4_NR,
2513 .label = "GPC4",
2514 },
2515 }, {
2516 .config = &samsung_gpio_cfgs[9], 2516 .config = &samsung_gpio_cfgs[9],
2517 .irq_base = IRQ_EINT(0), 2517 .irq_base = IRQ_EINT(0),
2518 .chip = { 2518 .chip = {
@@ -2836,7 +2836,7 @@ static __init void exynos5_gpiolib_init(void)
2836 } 2836 }
2837 2837
2838 /* need to set base address for gpc4 */ 2838 /* need to set base address for gpc4 */
2839 exynos5_gpios_1[11].base = gpio_base1 + 0x2E0; 2839 exynos5_gpios_1[20].base = gpio_base1 + 0x2E0;
2840 2840
2841 /* need to set base address for gpx */ 2841 /* need to set base address for gpx */
2842 chip = &exynos5_gpios_1[21]; 2842 chip = &exynos5_gpios_1[21];
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 424dce8e3f30..8707d4572a06 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -241,7 +241,8 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev)
241 break; 241 break;
242 242
243 default: 243 default:
244 return -ENODEV; 244 err = -ENODEV;
245 goto err_sch_gpio_core;
245 } 246 }
246 247
247 sch_gpio_core.dev = &pdev->dev; 248 sch_gpio_core.dev = &pdev->dev;
diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
index 66d4a28ad5a2..0303935d10e2 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -119,7 +119,7 @@ static int edid_load(struct drm_connector *connector, char *name,
119{ 119{
120 const struct firmware *fw; 120 const struct firmware *fw;
121 struct platform_device *pdev; 121 struct platform_device *pdev;
122 u8 *fwdata = NULL, *edid; 122 u8 *fwdata = NULL, *edid, *new_edid;
123 int fwsize, expected; 123 int fwsize, expected;
124 int builtin = 0, err = 0; 124 int builtin = 0, err = 0;
125 int i, valid_extensions = 0; 125 int i, valid_extensions = 0;
@@ -195,12 +195,14 @@ static int edid_load(struct drm_connector *connector, char *name,
195 "\"%s\" for connector \"%s\"\n", valid_extensions, 195 "\"%s\" for connector \"%s\"\n", valid_extensions,
196 edid[0x7e], name, connector_name); 196 edid[0x7e], name, connector_name);
197 edid[0x7e] = valid_extensions; 197 edid[0x7e] = valid_extensions;
198 edid = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH, 198 new_edid = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH,
199 GFP_KERNEL); 199 GFP_KERNEL);
200 if (edid == NULL) { 200 if (new_edid == NULL) {
201 err = -ENOMEM; 201 err = -ENOMEM;
202 kfree(edid);
202 goto relfw_out; 203 goto relfw_out;
203 } 204 }
205 edid = new_edid;
204 } 206 }
205 207
206 connector->display_info.raw_edid = edid; 208 connector->display_info.raw_edid = edid;
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index ed22612bc847..a24ffbe97c01 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -346,11 +346,40 @@ static const struct pci_device_id pciidlist[] = { /* aka */
346 INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ 346 INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */
347 INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */ 347 INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */
348 INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */ 348 INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */
349 INTEL_VGA_DEVICE(0x0422, &intel_haswell_d_info), /* GT2 desktop */
349 INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */ 350 INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */
350 INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */ 351 INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */
352 INTEL_VGA_DEVICE(0x042a, &intel_haswell_d_info), /* GT2 server */
351 INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */ 353 INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */
352 INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */ 354 INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */
353 INTEL_VGA_DEVICE(0x0c16, &intel_haswell_d_info), /* SDV */ 355 INTEL_VGA_DEVICE(0x0426, &intel_haswell_m_info), /* GT2 mobile */
356 INTEL_VGA_DEVICE(0x0C02, &intel_haswell_d_info), /* SDV GT1 desktop */
357 INTEL_VGA_DEVICE(0x0C12, &intel_haswell_d_info), /* SDV GT2 desktop */
358 INTEL_VGA_DEVICE(0x0C22, &intel_haswell_d_info), /* SDV GT2 desktop */
359 INTEL_VGA_DEVICE(0x0C0A, &intel_haswell_d_info), /* SDV GT1 server */
360 INTEL_VGA_DEVICE(0x0C1A, &intel_haswell_d_info), /* SDV GT2 server */
361 INTEL_VGA_DEVICE(0x0C2A, &intel_haswell_d_info), /* SDV GT2 server */
362 INTEL_VGA_DEVICE(0x0C06, &intel_haswell_m_info), /* SDV GT1 mobile */
363 INTEL_VGA_DEVICE(0x0C16, &intel_haswell_m_info), /* SDV GT2 mobile */
364 INTEL_VGA_DEVICE(0x0C26, &intel_haswell_m_info), /* SDV GT2 mobile */
365 INTEL_VGA_DEVICE(0x0A02, &intel_haswell_d_info), /* ULT GT1 desktop */
366 INTEL_VGA_DEVICE(0x0A12, &intel_haswell_d_info), /* ULT GT2 desktop */
367 INTEL_VGA_DEVICE(0x0A22, &intel_haswell_d_info), /* ULT GT2 desktop */
368 INTEL_VGA_DEVICE(0x0A0A, &intel_haswell_d_info), /* ULT GT1 server */
369 INTEL_VGA_DEVICE(0x0A1A, &intel_haswell_d_info), /* ULT GT2 server */
370 INTEL_VGA_DEVICE(0x0A2A, &intel_haswell_d_info), /* ULT GT2 server */
371 INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */
372 INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */
373 INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT2 mobile */
374 INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT1 desktop */
375 INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT2 desktop */
376 INTEL_VGA_DEVICE(0x0D32, &intel_haswell_d_info), /* CRW GT2 desktop */
377 INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT1 server */
378 INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT2 server */
379 INTEL_VGA_DEVICE(0x0D3A, &intel_haswell_d_info), /* CRW GT2 server */
380 INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT1 mobile */
381 INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT2 mobile */
382 INTEL_VGA_DEVICE(0x0D36, &intel_haswell_m_info), /* CRW GT2 mobile */
354 INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info), 383 INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info),
355 INTEL_VGA_DEVICE(0x0157, &intel_valleyview_m_info), 384 INTEL_VGA_DEVICE(0x0157, &intel_valleyview_m_info),
356 INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info), 385 INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info),
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index da8b01fb1bf8..a9d58d72bb4d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -451,7 +451,6 @@ int i915_switch_context(struct intel_ring_buffer *ring,
451 struct drm_i915_file_private *file_priv = NULL; 451 struct drm_i915_file_private *file_priv = NULL;
452 struct i915_hw_context *to; 452 struct i915_hw_context *to;
453 struct drm_i915_gem_object *from_obj = ring->last_context_obj; 453 struct drm_i915_gem_object *from_obj = ring->last_context_obj;
454 int ret;
455 454
456 if (dev_priv->hw_contexts_disabled) 455 if (dev_priv->hw_contexts_disabled)
457 return 0; 456 return 0;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 5af631e788c8..ff2819ea0813 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -291,6 +291,16 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
291 target_i915_obj = to_intel_bo(target_obj); 291 target_i915_obj = to_intel_bo(target_obj);
292 target_offset = target_i915_obj->gtt_offset; 292 target_offset = target_i915_obj->gtt_offset;
293 293
294 /* Sandybridge PPGTT errata: We need a global gtt mapping for MI and
295 * pipe_control writes because the gpu doesn't properly redirect them
296 * through the ppgtt for non_secure batchbuffers. */
297 if (unlikely(IS_GEN6(dev) &&
298 reloc->write_domain == I915_GEM_DOMAIN_INSTRUCTION &&
299 !target_i915_obj->has_global_gtt_mapping)) {
300 i915_gem_gtt_bind_object(target_i915_obj,
301 target_i915_obj->cache_level);
302 }
303
294 /* The target buffer should have appeared before us in the 304 /* The target buffer should have appeared before us in the
295 * exec_object list, so it should have a GTT space bound by now. 305 * exec_object list, so it should have a GTT space bound by now.
296 */ 306 */
@@ -399,16 +409,6 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
399 io_mapping_unmap_atomic(reloc_page); 409 io_mapping_unmap_atomic(reloc_page);
400 } 410 }
401 411
402 /* Sandybridge PPGTT errata: We need a global gtt mapping for MI and
403 * pipe_control writes because the gpu doesn't properly redirect them
404 * through the ppgtt for non_secure batchbuffers. */
405 if (unlikely(IS_GEN6(dev) &&
406 reloc->write_domain == I915_GEM_DOMAIN_INSTRUCTION &&
407 !target_i915_obj->has_global_gtt_mapping)) {
408 i915_gem_gtt_bind_object(target_i915_obj,
409 target_i915_obj->cache_level);
410 }
411
412 /* and update the user's relocation entry */ 412 /* and update the user's relocation entry */
413 reloc->presumed_offset = target_offset; 413 reloc->presumed_offset = target_offset;
414 414
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 9fd25a435536..ee9b68f6bc36 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -361,7 +361,8 @@ int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj)
361 struct drm_device *dev = obj->base.dev; 361 struct drm_device *dev = obj->base.dev;
362 struct drm_i915_private *dev_priv = dev->dev_private; 362 struct drm_i915_private *dev_priv = dev->dev_private;
363 363
364 if (dev_priv->mm.gtt->needs_dmar) 364 /* don't map imported dma buf objects */
365 if (dev_priv->mm.gtt->needs_dmar && !obj->sg_table)
365 return intel_gtt_map_memory(obj->pages, 366 return intel_gtt_map_memory(obj->pages,
366 obj->base.size >> PAGE_SHIFT, 367 obj->base.size >> PAGE_SHIFT,
367 &obj->sg_list, 368 &obj->sg_list,
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 2f5388af8df9..7631807a2788 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -32,6 +32,7 @@
32#include "intel_drv.h" 32#include "intel_drv.h"
33#include "i915_drv.h" 33#include "i915_drv.h"
34 34
35#ifdef CONFIG_PM
35static u32 calc_residency(struct drm_device *dev, const u32 reg) 36static u32 calc_residency(struct drm_device *dev, const u32 reg)
36{ 37{
37 struct drm_i915_private *dev_priv = dev->dev_private; 38 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -224,3 +225,14 @@ void i915_teardown_sysfs(struct drm_device *dev)
224 device_remove_bin_file(&dev->primary->kdev, &dpf_attrs); 225 device_remove_bin_file(&dev->primary->kdev, &dpf_attrs);
225 sysfs_unmerge_group(&dev->primary->kdev.kobj, &rc6_attr_group); 226 sysfs_unmerge_group(&dev->primary->kdev.kobj, &rc6_attr_group);
226} 227}
228#else
229void i915_setup_sysfs(struct drm_device *dev)
230{
231 return;
232}
233
234void i915_teardown_sysfs(struct drm_device *dev)
235{
236 return;
237}
238#endif /* CONFIG_PM */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f6159765f1eb..a69a3d0d3acf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -869,6 +869,7 @@ intel_vlv_find_best_pll(const intel_limit_t *limit, struct drm_crtc *crtc,
869 unsigned long bestppm, ppm, absppm; 869 unsigned long bestppm, ppm, absppm;
870 int dotclk, flag; 870 int dotclk, flag;
871 871
872 flag = 0;
872 dotclk = target * 1000; 873 dotclk = target * 1000;
873 bestppm = 1000000; 874 bestppm = 1000000;
874 ppm = absppm = 0; 875 ppm = absppm = 0;
@@ -3753,17 +3754,6 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
3753 continue; 3754 continue;
3754 } 3755 }
3755 3756
3756 if (intel_encoder->type == INTEL_OUTPUT_EDP) {
3757 /* Use VBT settings if we have an eDP panel */
3758 unsigned int edp_bpc = dev_priv->edp.bpp / 3;
3759
3760 if (edp_bpc < display_bpc) {
3761 DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
3762 display_bpc = edp_bpc;
3763 }
3764 continue;
3765 }
3766
3767 /* Not one of the known troublemakers, check the EDID */ 3757 /* Not one of the known troublemakers, check the EDID */
3768 list_for_each_entry(connector, &dev->mode_config.connector_list, 3758 list_for_each_entry(connector, &dev->mode_config.connector_list,
3769 head) { 3759 head) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0a56b9ab0f58..a6c426afaa7a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1174,10 +1174,14 @@ static void ironlake_edp_panel_off(struct intel_dp *intel_dp)
1174 WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); 1174 WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n");
1175 1175
1176 pp = ironlake_get_pp_control(dev_priv); 1176 pp = ironlake_get_pp_control(dev_priv);
1177 pp &= ~(POWER_TARGET_ON | PANEL_POWER_RESET | EDP_BLC_ENABLE); 1177 /* We need to switch off panel power _and_ force vdd, for otherwise some
1178 * panels get very unhappy and cease to work. */
1179 pp &= ~(POWER_TARGET_ON | EDP_FORCE_VDD | PANEL_POWER_RESET | EDP_BLC_ENABLE);
1178 I915_WRITE(PCH_PP_CONTROL, pp); 1180 I915_WRITE(PCH_PP_CONTROL, pp);
1179 POSTING_READ(PCH_PP_CONTROL); 1181 POSTING_READ(PCH_PP_CONTROL);
1180 1182
1183 intel_dp->want_panel_vdd = false;
1184
1181 ironlake_wait_panel_off(intel_dp); 1185 ironlake_wait_panel_off(intel_dp);
1182} 1186}
1183 1187
@@ -1287,11 +1291,9 @@ static void intel_dp_prepare(struct drm_encoder *encoder)
1287 * ensure that we have vdd while we switch off the panel. */ 1291 * ensure that we have vdd while we switch off the panel. */
1288 ironlake_edp_panel_vdd_on(intel_dp); 1292 ironlake_edp_panel_vdd_on(intel_dp);
1289 ironlake_edp_backlight_off(intel_dp); 1293 ironlake_edp_backlight_off(intel_dp);
1290 ironlake_edp_panel_off(intel_dp);
1291
1292 intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); 1294 intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
1295 ironlake_edp_panel_off(intel_dp);
1293 intel_dp_link_down(intel_dp); 1296 intel_dp_link_down(intel_dp);
1294 ironlake_edp_panel_vdd_off(intel_dp, false);
1295} 1297}
1296 1298
1297static void intel_dp_commit(struct drm_encoder *encoder) 1299static void intel_dp_commit(struct drm_encoder *encoder)
@@ -1326,11 +1328,9 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
1326 /* Switching the panel off requires vdd. */ 1328 /* Switching the panel off requires vdd. */
1327 ironlake_edp_panel_vdd_on(intel_dp); 1329 ironlake_edp_panel_vdd_on(intel_dp);
1328 ironlake_edp_backlight_off(intel_dp); 1330 ironlake_edp_backlight_off(intel_dp);
1329 ironlake_edp_panel_off(intel_dp);
1330
1331 intel_dp_sink_dpms(intel_dp, mode); 1331 intel_dp_sink_dpms(intel_dp, mode);
1332 ironlake_edp_panel_off(intel_dp);
1332 intel_dp_link_down(intel_dp); 1333 intel_dp_link_down(intel_dp);
1333 ironlake_edp_panel_vdd_off(intel_dp, false);
1334 1334
1335 if (is_cpu_edp(intel_dp)) 1335 if (is_cpu_edp(intel_dp))
1336 ironlake_edp_pll_off(encoder); 1336 ironlake_edp_pll_off(encoder);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 84353559441c..132ab511b90c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -46,15 +46,16 @@
46}) 46})
47 47
48#define wait_for_atomic_us(COND, US) ({ \ 48#define wait_for_atomic_us(COND, US) ({ \
49 int i, ret__ = -ETIMEDOUT; \ 49 unsigned long timeout__ = jiffies + usecs_to_jiffies(US); \
50 for (i = 0; i < (US); i++) { \ 50 int ret__ = 0; \
51 if ((COND)) { \ 51 while (!(COND)) { \
52 ret__ = 0; \ 52 if (time_after(jiffies, timeout__)) { \
53 break; \ 53 ret__ = -ETIMEDOUT; \
54 } \ 54 break; \
55 udelay(1); \ 55 } \
56 } \ 56 cpu_relax(); \
57 ret__; \ 57 } \
58 ret__; \
58}) 59})
59 60
60#define wait_for(COND, MS) _wait_for(COND, MS, 1) 61#define wait_for(COND, MS) _wait_for(COND, MS, 1)
@@ -380,7 +381,6 @@ extern void intel_pch_panel_fitting(struct drm_device *dev,
380 const struct drm_display_mode *mode, 381 const struct drm_display_mode *mode,
381 struct drm_display_mode *adjusted_mode); 382 struct drm_display_mode *adjusted_mode);
382extern u32 intel_panel_get_max_backlight(struct drm_device *dev); 383extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
383extern u32 intel_panel_get_backlight(struct drm_device *dev);
384extern void intel_panel_set_backlight(struct drm_device *dev, u32 level); 384extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
385extern int intel_panel_setup_backlight(struct drm_device *dev); 385extern int intel_panel_setup_backlight(struct drm_device *dev);
386extern void intel_panel_enable_backlight(struct drm_device *dev, 386extern void intel_panel_enable_backlight(struct drm_device *dev,
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 1991a4408cf9..b9755f6378d8 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -486,9 +486,6 @@ int intel_setup_gmbus(struct drm_device *dev)
486 bus->dev_priv = dev_priv; 486 bus->dev_priv = dev_priv;
487 487
488 bus->adapter.algo = &gmbus_algorithm; 488 bus->adapter.algo = &gmbus_algorithm;
489 ret = i2c_add_adapter(&bus->adapter);
490 if (ret)
491 goto err;
492 489
493 /* By default use a conservative clock rate */ 490 /* By default use a conservative clock rate */
494 bus->reg0 = port | GMBUS_RATE_100KHZ; 491 bus->reg0 = port | GMBUS_RATE_100KHZ;
@@ -498,6 +495,10 @@ int intel_setup_gmbus(struct drm_device *dev)
498 bus->force_bit = true; 495 bus->force_bit = true;
499 496
500 intel_gpio_setup(bus, port); 497 intel_gpio_setup(bus, port);
498
499 ret = i2c_add_adapter(&bus->adapter);
500 if (ret)
501 goto err;
501 } 502 }
502 503
503 intel_i2c_reset(dev_priv->dev); 504 intel_i2c_reset(dev_priv->dev);
@@ -540,9 +541,6 @@ void intel_teardown_gmbus(struct drm_device *dev)
540 struct drm_i915_private *dev_priv = dev->dev_private; 541 struct drm_i915_private *dev_priv = dev->dev_private;
541 int i; 542 int i;
542 543
543 if (dev_priv->gmbus == NULL)
544 return;
545
546 for (i = 0; i < GMBUS_NUM_PORTS; i++) { 544 for (i = 0; i < GMBUS_NUM_PORTS; i++) {
547 struct intel_gmbus *bus = &dev_priv->gmbus[i]; 545 struct intel_gmbus *bus = &dev_priv->gmbus[i];
548 i2c_del_adapter(&bus->adapter); 546 i2c_del_adapter(&bus->adapter);
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 10c7d39034e1..3df4f5fa892a 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -213,7 +213,7 @@ static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val)
213 return val; 213 return val;
214} 214}
215 215
216u32 intel_panel_get_backlight(struct drm_device *dev) 216static u32 intel_panel_get_backlight(struct drm_device *dev)
217{ 217{
218 struct drm_i915_private *dev_priv = dev->dev_private; 218 struct drm_i915_private *dev_priv = dev->dev_private;
219 u32 val; 219 u32 val;
@@ -311,9 +311,6 @@ void intel_panel_enable_backlight(struct drm_device *dev,
311 if (dev_priv->backlight_level == 0) 311 if (dev_priv->backlight_level == 0)
312 dev_priv->backlight_level = intel_panel_get_max_backlight(dev); 312 dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
313 313
314 dev_priv->backlight_enabled = true;
315 intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
316
317 if (INTEL_INFO(dev)->gen >= 4) { 314 if (INTEL_INFO(dev)->gen >= 4) {
318 uint32_t reg, tmp; 315 uint32_t reg, tmp;
319 316
@@ -326,7 +323,7 @@ void intel_panel_enable_backlight(struct drm_device *dev,
326 * we don't track the backlight dpms state, hence check whether 323 * we don't track the backlight dpms state, hence check whether
327 * we have to do anything first. */ 324 * we have to do anything first. */
328 if (tmp & BLM_PWM_ENABLE) 325 if (tmp & BLM_PWM_ENABLE)
329 return; 326 goto set_level;
330 327
331 if (dev_priv->num_pipe == 3) 328 if (dev_priv->num_pipe == 3)
332 tmp &= ~BLM_PIPE_SELECT_IVB; 329 tmp &= ~BLM_PIPE_SELECT_IVB;
@@ -347,6 +344,14 @@ void intel_panel_enable_backlight(struct drm_device *dev,
347 I915_WRITE(BLC_PWM_PCH_CTL1, tmp); 344 I915_WRITE(BLC_PWM_PCH_CTL1, tmp);
348 } 345 }
349 } 346 }
347
348set_level:
349 /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
350 * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
351 * registers are set.
352 */
353 dev_priv->backlight_enabled = true;
354 intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
350} 355}
351 356
352static void intel_panel_init_backlight(struct drm_device *dev) 357static void intel_panel_init_backlight(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 94aabcaa3a67..58c07cdafb7e 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3963,6 +3963,7 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
3963 DRM_ERROR("Force wake wait timed out\n"); 3963 DRM_ERROR("Force wake wait timed out\n");
3964 3964
3965 I915_WRITE_NOTRACE(FORCEWAKE, 1); 3965 I915_WRITE_NOTRACE(FORCEWAKE, 1);
3966 POSTING_READ(FORCEWAKE);
3966 3967
3967 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1), 500)) 3968 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1), 500))
3968 DRM_ERROR("Force wake wait timed out\n"); 3969 DRM_ERROR("Force wake wait timed out\n");
@@ -3983,6 +3984,7 @@ static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)
3983 DRM_ERROR("Force wake wait timed out\n"); 3984 DRM_ERROR("Force wake wait timed out\n");
3984 3985
3985 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(1)); 3986 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(1));
3987 POSTING_READ(FORCEWAKE_MT);
3986 3988
3987 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1), 500)) 3989 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1), 500))
3988 DRM_ERROR("Force wake wait timed out\n"); 3990 DRM_ERROR("Force wake wait timed out\n");
@@ -4018,14 +4020,14 @@ void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv)
4018static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) 4020static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
4019{ 4021{
4020 I915_WRITE_NOTRACE(FORCEWAKE, 0); 4022 I915_WRITE_NOTRACE(FORCEWAKE, 0);
4021 /* The below doubles as a POSTING_READ */ 4023 POSTING_READ(FORCEWAKE);
4022 gen6_gt_check_fifodbg(dev_priv); 4024 gen6_gt_check_fifodbg(dev_priv);
4023} 4025}
4024 4026
4025static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) 4027static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv)
4026{ 4028{
4027 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(1)); 4029 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(1));
4028 /* The below doubles as a POSTING_READ */ 4030 POSTING_READ(FORCEWAKE_MT);
4029 gen6_gt_check_fifodbg(dev_priv); 4031 gen6_gt_check_fifodbg(dev_priv);
4030} 4032}
4031 4033
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index bf0195a96d53..e2a73b38abe9 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -227,31 +227,36 @@ gen6_render_ring_flush(struct intel_ring_buffer *ring,
227 * number of bits based on the write domains has little performance 227 * number of bits based on the write domains has little performance
228 * impact. 228 * impact.
229 */ 229 */
230 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH; 230 if (flush_domains) {
231 flags |= PIPE_CONTROL_TLB_INVALIDATE; 231 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;
232 flags |= PIPE_CONTROL_INSTRUCTION_CACHE_INVALIDATE; 232 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;
233 flags |= PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE; 233 /*
234 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH; 234 * Ensure that any following seqno writes only happen
235 flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE; 235 * when the render cache is indeed flushed.
236 flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE; 236 */
237 flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE;
238 /*
239 * Ensure that any following seqno writes only happen when the render
240 * cache is indeed flushed (but only if the caller actually wants that).
241 */
242 if (flush_domains)
243 flags |= PIPE_CONTROL_CS_STALL; 237 flags |= PIPE_CONTROL_CS_STALL;
238 }
239 if (invalidate_domains) {
240 flags |= PIPE_CONTROL_TLB_INVALIDATE;
241 flags |= PIPE_CONTROL_INSTRUCTION_CACHE_INVALIDATE;
242 flags |= PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE;
243 flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE;
244 flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE;
245 flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE;
246 /*
247 * TLB invalidate requires a post-sync write.
248 */
249 flags |= PIPE_CONTROL_QW_WRITE;
250 }
244 251
245 ret = intel_ring_begin(ring, 6); 252 ret = intel_ring_begin(ring, 4);
246 if (ret) 253 if (ret)
247 return ret; 254 return ret;
248 255
249 intel_ring_emit(ring, GFX_OP_PIPE_CONTROL(5)); 256 intel_ring_emit(ring, GFX_OP_PIPE_CONTROL(4));
250 intel_ring_emit(ring, flags); 257 intel_ring_emit(ring, flags);
251 intel_ring_emit(ring, scratch_addr | PIPE_CONTROL_GLOBAL_GTT); 258 intel_ring_emit(ring, scratch_addr | PIPE_CONTROL_GLOBAL_GTT);
252 intel_ring_emit(ring, 0); /* lower dword */ 259 intel_ring_emit(ring, 0);
253 intel_ring_emit(ring, 0); /* uppwer dword */
254 intel_ring_emit(ring, MI_NOOP);
255 intel_ring_advance(ring); 260 intel_ring_advance(ring);
256 261
257 return 0; 262 return 0;
@@ -289,8 +294,6 @@ static int init_ring_common(struct intel_ring_buffer *ring)
289 I915_WRITE_HEAD(ring, 0); 294 I915_WRITE_HEAD(ring, 0);
290 ring->write_tail(ring, 0); 295 ring->write_tail(ring, 0);
291 296
292 /* Initialize the ring. */
293 I915_WRITE_START(ring, obj->gtt_offset);
294 head = I915_READ_HEAD(ring) & HEAD_ADDR; 297 head = I915_READ_HEAD(ring) & HEAD_ADDR;
295 298
296 /* G45 ring initialization fails to reset head to zero */ 299 /* G45 ring initialization fails to reset head to zero */
@@ -316,6 +319,11 @@ static int init_ring_common(struct intel_ring_buffer *ring)
316 } 319 }
317 } 320 }
318 321
322 /* Initialize the ring. This must happen _after_ we've cleared the ring
323 * registers with the above sequence (the readback of the HEAD registers
324 * also enforces ordering), otherwise the hw might lose the new ring
325 * register values. */
326 I915_WRITE_START(ring, obj->gtt_offset);
319 I915_WRITE_CTL(ring, 327 I915_WRITE_CTL(ring,
320 ((ring->size - PAGE_SIZE) & RING_NR_PAGES) 328 ((ring->size - PAGE_SIZE) & RING_NR_PAGES)
321 | RING_VALID); 329 | RING_VALID);
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 26a6a4d0d078..d172e9873131 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -444,13 +444,16 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
444 struct i2c_msg *msgs; 444 struct i2c_msg *msgs;
445 int i, ret = true; 445 int i, ret = true;
446 446
447 /* Would be simpler to allocate both in one go ? */
447 buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL); 448 buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL);
448 if (!buf) 449 if (!buf)
449 return false; 450 return false;
450 451
451 msgs = kcalloc(args_len + 3, sizeof(*msgs), GFP_KERNEL); 452 msgs = kcalloc(args_len + 3, sizeof(*msgs), GFP_KERNEL);
452 if (!msgs) 453 if (!msgs) {
454 kfree(buf);
453 return false; 455 return false;
456 }
454 457
455 intel_sdvo_debug_write(intel_sdvo, cmd, args, args_len); 458 intel_sdvo_debug_write(intel_sdvo, cmd, args, args_len);
456 459
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index a4d7c500c97b..b69642d5d850 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -468,10 +468,11 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock)
468{ 468{
469 unsigned int vcomax, vcomin, pllreffreq; 469 unsigned int vcomax, vcomin, pllreffreq;
470 unsigned int delta, tmpdelta; 470 unsigned int delta, tmpdelta;
471 unsigned int testr, testn, testm, testo; 471 int testr, testn, testm, testo;
472 unsigned int p, m, n; 472 unsigned int p, m, n;
473 unsigned int computed; 473 unsigned int computed, vco;
474 int tmp; 474 int tmp;
475 const unsigned int m_div_val[] = { 1, 2, 4, 8 };
475 476
476 m = n = p = 0; 477 m = n = p = 0;
477 vcomax = 1488000; 478 vcomax = 1488000;
@@ -490,12 +491,13 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock)
490 if (delta == 0) 491 if (delta == 0)
491 break; 492 break;
492 for (testo = 5; testo < 33; testo++) { 493 for (testo = 5; testo < 33; testo++) {
493 computed = pllreffreq * (testn + 1) / 494 vco = pllreffreq * (testn + 1) /
494 (testr + 1); 495 (testr + 1);
495 if (computed < vcomin) 496 if (vco < vcomin)
496 continue; 497 continue;
497 if (computed > vcomax) 498 if (vco > vcomax)
498 continue; 499 continue;
500 computed = vco / (m_div_val[testm] * (testo + 1));
499 if (computed > clock) 501 if (computed > clock)
500 tmpdelta = computed - clock; 502 tmpdelta = computed - clock;
501 else 503 else
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.c b/drivers/gpu/drm/nouveau/nouveau_i2c.c
index 77e564667b5c..240cf962c999 100644
--- a/drivers/gpu/drm/nouveau/nouveau_i2c.c
+++ b/drivers/gpu/drm/nouveau/nouveau_i2c.c
@@ -229,7 +229,7 @@ nouveau_i2c_init(struct drm_device *dev)
229 } 229 }
230 break; 230 break;
231 case 6: /* NV50- DP AUX */ 231 case 6: /* NV50- DP AUX */
232 port->drive = entry[0]; 232 port->drive = entry[0] & 0x0f;
233 port->sense = port->drive; 233 port->sense = port->drive;
234 port->adapter.algo = &nouveau_dp_i2c_algo; 234 port->adapter.algo = &nouveau_dp_i2c_algo;
235 break; 235 break;
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 1cdfd6e757ce..1866dbb49979 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -731,7 +731,6 @@ nouveau_card_init(struct drm_device *dev)
731 case 0xa3: 731 case 0xa3:
732 case 0xa5: 732 case 0xa5:
733 case 0xa8: 733 case 0xa8:
734 case 0xaf:
735 nva3_copy_create(dev); 734 nva3_copy_create(dev);
736 break; 735 break;
737 } 736 }
diff --git a/drivers/gpu/drm/nouveau/nv84_fifo.c b/drivers/gpu/drm/nouveau/nv84_fifo.c
index cc82d799fc3b..c564c5e4c30a 100644
--- a/drivers/gpu/drm/nouveau/nv84_fifo.c
+++ b/drivers/gpu/drm/nouveau/nv84_fifo.c
@@ -117,17 +117,22 @@ nv84_fifo_context_del(struct nouveau_channel *chan, int engine)
117 struct drm_device *dev = chan->dev; 117 struct drm_device *dev = chan->dev;
118 struct drm_nouveau_private *dev_priv = dev->dev_private; 118 struct drm_nouveau_private *dev_priv = dev->dev_private;
119 unsigned long flags; 119 unsigned long flags;
120 u32 save;
120 121
121 /* remove channel from playlist, will context switch if active */ 122 /* remove channel from playlist, will context switch if active */
122 spin_lock_irqsave(&dev_priv->context_switch_lock, flags); 123 spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
123 nv_mask(dev, 0x002600 + (chan->id * 4), 0x80000000, 0x00000000); 124 nv_mask(dev, 0x002600 + (chan->id * 4), 0x80000000, 0x00000000);
124 nv50_fifo_playlist_update(dev); 125 nv50_fifo_playlist_update(dev);
125 126
127 save = nv_mask(dev, 0x002520, 0x0000003f, 0x15);
128
126 /* tell any engines on this channel to unload their contexts */ 129 /* tell any engines on this channel to unload their contexts */
127 nv_wr32(dev, 0x0032fc, chan->ramin->vinst >> 12); 130 nv_wr32(dev, 0x0032fc, chan->ramin->vinst >> 12);
128 if (!nv_wait_ne(dev, 0x0032fc, 0xffffffff, 0xffffffff)) 131 if (!nv_wait_ne(dev, 0x0032fc, 0xffffffff, 0xffffffff))
129 NV_INFO(dev, "PFIFO: channel %d unload timeout\n", chan->id); 132 NV_INFO(dev, "PFIFO: channel %d unload timeout\n", chan->id);
130 133
134 nv_wr32(dev, 0x002520, save);
135
131 nv_wr32(dev, 0x002600 + (chan->id * 4), 0x00000000); 136 nv_wr32(dev, 0x002600 + (chan->id * 4), 0x00000000);
132 spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); 137 spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
133 138
@@ -184,10 +189,13 @@ nv84_fifo_fini(struct drm_device *dev, int engine, bool suspend)
184 struct drm_nouveau_private *dev_priv = dev->dev_private; 189 struct drm_nouveau_private *dev_priv = dev->dev_private;
185 struct nv84_fifo_priv *priv = nv_engine(dev, engine); 190 struct nv84_fifo_priv *priv = nv_engine(dev, engine);
186 int i; 191 int i;
192 u32 save;
187 193
188 /* set playlist length to zero, fifo will unload context */ 194 /* set playlist length to zero, fifo will unload context */
189 nv_wr32(dev, 0x0032ec, 0); 195 nv_wr32(dev, 0x0032ec, 0);
190 196
197 save = nv_mask(dev, 0x002520, 0x0000003f, 0x15);
198
191 /* tell all connected engines to unload their contexts */ 199 /* tell all connected engines to unload their contexts */
192 for (i = 0; i < priv->base.channels; i++) { 200 for (i = 0; i < priv->base.channels; i++) {
193 struct nouveau_channel *chan = dev_priv->channels.ptr[i]; 201 struct nouveau_channel *chan = dev_priv->channels.ptr[i];
@@ -199,6 +207,7 @@ nv84_fifo_fini(struct drm_device *dev, int engine, bool suspend)
199 } 207 }
200 } 208 }
201 209
210 nv_wr32(dev, 0x002520, save);
202 nv_wr32(dev, 0x002140, 0); 211 nv_wr32(dev, 0x002140, 0);
203 return 0; 212 return 0;
204} 213}
diff --git a/drivers/gpu/drm/nouveau/nvc0_pm.c b/drivers/gpu/drm/nouveau/nvc0_pm.c
index 7c95c44e2887..4e712b10ebdb 100644
--- a/drivers/gpu/drm/nouveau/nvc0_pm.c
+++ b/drivers/gpu/drm/nouveau/nvc0_pm.c
@@ -557,7 +557,7 @@ prog_mem(struct drm_device *dev, struct nvc0_pm_state *info)
557 nouveau_mem_exec(&exec, info->perflvl); 557 nouveau_mem_exec(&exec, info->perflvl);
558 558
559 if (dev_priv->chipset < 0xd0) 559 if (dev_priv->chipset < 0xd0)
560 nv_wr32(dev, 0x611200, 0x00003300); 560 nv_wr32(dev, 0x611200, 0x00003330);
561 else 561 else
562 nv_wr32(dev, 0x62c000, 0x03030300); 562 nv_wr32(dev, 0x62c000, 0x03030300);
563} 563}
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index d0d60e1e7f95..dac525b2994e 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -790,7 +790,7 @@ nvd0_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
790 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 790 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
791 int ch = EVO_CURS(nv_crtc->index); 791 int ch = EVO_CURS(nv_crtc->index);
792 792
793 evo_piow(crtc->dev, ch, 0x0084, (y << 16) | x); 793 evo_piow(crtc->dev, ch, 0x0084, (y << 16) | (x & 0xffff));
794 evo_piow(crtc->dev, ch, 0x0080, 0x00000000); 794 evo_piow(crtc->dev, ch, 0x0080, 0x00000000);
795 return 0; 795 return 0;
796} 796}
diff --git a/drivers/gpu/drm/nouveau/nve0_fifo.c b/drivers/gpu/drm/nouveau/nve0_fifo.c
index 1855ecbd843b..e98d144e6eb9 100644
--- a/drivers/gpu/drm/nouveau/nve0_fifo.c
+++ b/drivers/gpu/drm/nouveau/nve0_fifo.c
@@ -294,6 +294,25 @@ nve0_fifo_isr_vm_fault(struct drm_device *dev, int unit)
294 printk(" on channel 0x%010llx\n", (u64)inst << 12); 294 printk(" on channel 0x%010llx\n", (u64)inst << 12);
295} 295}
296 296
297static int
298nve0_fifo_page_flip(struct drm_device *dev, u32 chid)
299{
300 struct nve0_fifo_priv *priv = nv_engine(dev, NVOBJ_ENGINE_FIFO);
301 struct drm_nouveau_private *dev_priv = dev->dev_private;
302 struct nouveau_channel *chan = NULL;
303 unsigned long flags;
304 int ret = -EINVAL;
305
306 spin_lock_irqsave(&dev_priv->channels.lock, flags);
307 if (likely(chid >= 0 && chid < priv->base.channels)) {
308 chan = dev_priv->channels.ptr[chid];
309 if (likely(chan))
310 ret = nouveau_finish_page_flip(chan, NULL);
311 }
312 spin_unlock_irqrestore(&dev_priv->channels.lock, flags);
313 return ret;
314}
315
297static void 316static void
298nve0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit) 317nve0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit)
299{ 318{
@@ -303,11 +322,21 @@ nve0_fifo_isr_subfifo_intr(struct drm_device *dev, int unit)
303 u32 chid = nv_rd32(dev, 0x040120 + (unit * 0x2000)) & 0x7f; 322 u32 chid = nv_rd32(dev, 0x040120 + (unit * 0x2000)) & 0x7f;
304 u32 subc = (addr & 0x00070000); 323 u32 subc = (addr & 0x00070000);
305 u32 mthd = (addr & 0x00003ffc); 324 u32 mthd = (addr & 0x00003ffc);
325 u32 show = stat;
326
327 if (stat & 0x00200000) {
328 if (mthd == 0x0054) {
329 if (!nve0_fifo_page_flip(dev, chid))
330 show &= ~0x00200000;
331 }
332 }
306 333
307 NV_INFO(dev, "PSUBFIFO %d:", unit); 334 if (show) {
308 nouveau_bitfield_print(nve0_fifo_subfifo_intr, stat); 335 NV_INFO(dev, "PFIFO%d:", unit);
309 NV_INFO(dev, "PSUBFIFO %d: ch %d subc %d mthd 0x%04x data 0x%08x\n", 336 nouveau_bitfield_print(nve0_fifo_subfifo_intr, show);
310 unit, chid, subc, mthd, data); 337 NV_INFO(dev, "PFIFO%d: ch %d subc %d mthd 0x%04x data 0x%08x\n",
338 unit, chid, subc, mthd, data);
339 }
311 340
312 nv_wr32(dev, 0x0400c0 + (unit * 0x2000), 0x80600008); 341 nv_wr32(dev, 0x0400c0 + (unit * 0x2000), 0x80600008);
313 nv_wr32(dev, 0x040108 + (unit * 0x2000), stat); 342 nv_wr32(dev, 0x040108 + (unit * 0x2000), stat);
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 9e6f76fec527..c6fcb5b86a45 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -259,7 +259,7 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
259 /* adjust pm to dpms changes BEFORE enabling crtcs */ 259 /* adjust pm to dpms changes BEFORE enabling crtcs */
260 radeon_pm_compute_clocks(rdev); 260 radeon_pm_compute_clocks(rdev);
261 /* disable crtc pair power gating before programming */ 261 /* disable crtc pair power gating before programming */
262 if (ASIC_IS_DCE6(rdev)) 262 if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
263 atombios_powergate_crtc(crtc, ATOM_DISABLE); 263 atombios_powergate_crtc(crtc, ATOM_DISABLE);
264 atombios_enable_crtc(crtc, ATOM_ENABLE); 264 atombios_enable_crtc(crtc, ATOM_ENABLE);
265 if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev)) 265 if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev))
@@ -279,7 +279,7 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
279 atombios_enable_crtc(crtc, ATOM_DISABLE); 279 atombios_enable_crtc(crtc, ATOM_DISABLE);
280 radeon_crtc->enabled = false; 280 radeon_crtc->enabled = false;
281 /* power gating is per-pair */ 281 /* power gating is per-pair */
282 if (ASIC_IS_DCE6(rdev)) { 282 if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) {
283 struct drm_crtc *other_crtc; 283 struct drm_crtc *other_crtc;
284 struct radeon_crtc *other_radeon_crtc; 284 struct radeon_crtc *other_radeon_crtc;
285 list_for_each_entry(other_crtc, &rdev->ddev->mode_config.crtc_list, head) { 285 list_for_each_entry(other_crtc, &rdev->ddev->mode_config.crtc_list, head) {
@@ -1531,12 +1531,12 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
1531 * crtc virtual pixel clock. 1531 * crtc virtual pixel clock.
1532 */ 1532 */
1533 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) { 1533 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) {
1534 if (ASIC_IS_DCE5(rdev)) 1534 if (rdev->clock.dp_extclk)
1535 return ATOM_DCPLL; 1535 return ATOM_PPLL_INVALID;
1536 else if (ASIC_IS_DCE6(rdev)) 1536 else if (ASIC_IS_DCE6(rdev))
1537 return ATOM_PPLL0; 1537 return ATOM_PPLL0;
1538 else if (rdev->clock.dp_extclk) 1538 else if (ASIC_IS_DCE5(rdev))
1539 return ATOM_PPLL_INVALID; 1539 return ATOM_DCPLL;
1540 } 1540 }
1541 } 1541 }
1542 } 1542 }
@@ -1635,18 +1635,28 @@ static bool atombios_crtc_mode_fixup(struct drm_crtc *crtc,
1635static void atombios_crtc_prepare(struct drm_crtc *crtc) 1635static void atombios_crtc_prepare(struct drm_crtc *crtc)
1636{ 1636{
1637 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 1637 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1638 struct drm_device *dev = crtc->dev;
1639 struct radeon_device *rdev = dev->dev_private;
1638 1640
1641 radeon_crtc->in_mode_set = true;
1639 /* pick pll */ 1642 /* pick pll */
1640 radeon_crtc->pll_id = radeon_atom_pick_pll(crtc); 1643 radeon_crtc->pll_id = radeon_atom_pick_pll(crtc);
1641 1644
1645 /* disable crtc pair power gating before programming */
1646 if (ASIC_IS_DCE6(rdev))
1647 atombios_powergate_crtc(crtc, ATOM_DISABLE);
1648
1642 atombios_lock_crtc(crtc, ATOM_ENABLE); 1649 atombios_lock_crtc(crtc, ATOM_ENABLE);
1643 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); 1650 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
1644} 1651}
1645 1652
1646static void atombios_crtc_commit(struct drm_crtc *crtc) 1653static void atombios_crtc_commit(struct drm_crtc *crtc)
1647{ 1654{
1655 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1656
1648 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON); 1657 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
1649 atombios_lock_crtc(crtc, ATOM_DISABLE); 1658 atombios_lock_crtc(crtc, ATOM_DISABLE);
1659 radeon_crtc->in_mode_set = false;
1650} 1660}
1651 1661
1652static void atombios_crtc_disable(struct drm_crtc *crtc) 1662static void atombios_crtc_disable(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index e585a3b947eb..e93b80a6d4e9 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1229,24 +1229,8 @@ void evergreen_agp_enable(struct radeon_device *rdev)
1229 1229
1230void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save) 1230void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save)
1231{ 1231{
1232 save->vga_control[0] = RREG32(D1VGA_CONTROL);
1233 save->vga_control[1] = RREG32(D2VGA_CONTROL);
1234 save->vga_render_control = RREG32(VGA_RENDER_CONTROL); 1232 save->vga_render_control = RREG32(VGA_RENDER_CONTROL);
1235 save->vga_hdp_control = RREG32(VGA_HDP_CONTROL); 1233 save->vga_hdp_control = RREG32(VGA_HDP_CONTROL);
1236 save->crtc_control[0] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET);
1237 save->crtc_control[1] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET);
1238 if (rdev->num_crtc >= 4) {
1239 save->vga_control[2] = RREG32(EVERGREEN_D3VGA_CONTROL);
1240 save->vga_control[3] = RREG32(EVERGREEN_D4VGA_CONTROL);
1241 save->crtc_control[2] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET);
1242 save->crtc_control[3] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET);
1243 }
1244 if (rdev->num_crtc >= 6) {
1245 save->vga_control[4] = RREG32(EVERGREEN_D5VGA_CONTROL);
1246 save->vga_control[5] = RREG32(EVERGREEN_D6VGA_CONTROL);
1247 save->crtc_control[4] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET);
1248 save->crtc_control[5] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET);
1249 }
1250 1234
1251 /* Stop all video */ 1235 /* Stop all video */
1252 WREG32(VGA_RENDER_CONTROL, 0); 1236 WREG32(VGA_RENDER_CONTROL, 0);
@@ -1357,47 +1341,6 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
1357 /* Unlock host access */ 1341 /* Unlock host access */
1358 WREG32(VGA_HDP_CONTROL, save->vga_hdp_control); 1342 WREG32(VGA_HDP_CONTROL, save->vga_hdp_control);
1359 mdelay(1); 1343 mdelay(1);
1360 /* Restore video state */
1361 WREG32(D1VGA_CONTROL, save->vga_control[0]);
1362 WREG32(D2VGA_CONTROL, save->vga_control[1]);
1363 if (rdev->num_crtc >= 4) {
1364 WREG32(EVERGREEN_D3VGA_CONTROL, save->vga_control[2]);
1365 WREG32(EVERGREEN_D4VGA_CONTROL, save->vga_control[3]);
1366 }
1367 if (rdev->num_crtc >= 6) {
1368 WREG32(EVERGREEN_D5VGA_CONTROL, save->vga_control[4]);
1369 WREG32(EVERGREEN_D6VGA_CONTROL, save->vga_control[5]);
1370 }
1371 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 1);
1372 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 1);
1373 if (rdev->num_crtc >= 4) {
1374 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 1);
1375 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 1);
1376 }
1377 if (rdev->num_crtc >= 6) {
1378 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 1);
1379 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 1);
1380 }
1381 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, save->crtc_control[0]);
1382 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, save->crtc_control[1]);
1383 if (rdev->num_crtc >= 4) {
1384 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, save->crtc_control[2]);
1385 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, save->crtc_control[3]);
1386 }
1387 if (rdev->num_crtc >= 6) {
1388 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, save->crtc_control[4]);
1389 WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, save->crtc_control[5]);
1390 }
1391 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
1392 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
1393 if (rdev->num_crtc >= 4) {
1394 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
1395 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
1396 }
1397 if (rdev->num_crtc >= 6) {
1398 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
1399 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
1400 }
1401 WREG32(VGA_RENDER_CONTROL, save->vga_render_control); 1344 WREG32(VGA_RENDER_CONTROL, save->vga_render_control);
1402} 1345}
1403 1346
@@ -1986,10 +1929,18 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1986 if (rdev->flags & RADEON_IS_IGP) 1929 if (rdev->flags & RADEON_IS_IGP)
1987 rdev->config.evergreen.tile_config |= 1 << 4; 1930 rdev->config.evergreen.tile_config |= 1 << 4;
1988 else { 1931 else {
1989 if ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) 1932 switch ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) {
1990 rdev->config.evergreen.tile_config |= 1 << 4; 1933 case 0: /* four banks */
1991 else
1992 rdev->config.evergreen.tile_config |= 0 << 4; 1934 rdev->config.evergreen.tile_config |= 0 << 4;
1935 break;
1936 case 1: /* eight banks */
1937 rdev->config.evergreen.tile_config |= 1 << 4;
1938 break;
1939 case 2: /* sixteen banks */
1940 default:
1941 rdev->config.evergreen.tile_config |= 2 << 4;
1942 break;
1943 }
1993 } 1944 }
1994 rdev->config.evergreen.tile_config |= 0 << 8; 1945 rdev->config.evergreen.tile_config |= 0 << 8;
1995 rdev->config.evergreen.tile_config |= 1946 rdev->config.evergreen.tile_config |=
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index c16554122ccd..e44a62a07fe3 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -788,6 +788,13 @@ static int evergreen_cs_track_validate_texture(struct radeon_cs_parser *p,
788 case V_030000_SQ_TEX_DIM_1D_ARRAY: 788 case V_030000_SQ_TEX_DIM_1D_ARRAY:
789 case V_030000_SQ_TEX_DIM_2D_ARRAY: 789 case V_030000_SQ_TEX_DIM_2D_ARRAY:
790 depth = 1; 790 depth = 1;
791 break;
792 case V_030000_SQ_TEX_DIM_2D_MSAA:
793 case V_030000_SQ_TEX_DIM_2D_ARRAY_MSAA:
794 surf.nsamples = 1 << llevel;
795 llevel = 0;
796 depth = 1;
797 break;
791 case V_030000_SQ_TEX_DIM_3D: 798 case V_030000_SQ_TEX_DIM_3D:
792 break; 799 break;
793 default: 800 default:
@@ -961,13 +968,15 @@ static int evergreen_cs_track_check(struct radeon_cs_parser *p)
961 968
962 if (track->db_dirty) { 969 if (track->db_dirty) {
963 /* Check stencil buffer */ 970 /* Check stencil buffer */
964 if (G_028800_STENCIL_ENABLE(track->db_depth_control)) { 971 if (G_028044_FORMAT(track->db_s_info) != V_028044_STENCIL_INVALID &&
972 G_028800_STENCIL_ENABLE(track->db_depth_control)) {
965 r = evergreen_cs_track_validate_stencil(p); 973 r = evergreen_cs_track_validate_stencil(p);
966 if (r) 974 if (r)
967 return r; 975 return r;
968 } 976 }
969 /* Check depth buffer */ 977 /* Check depth buffer */
970 if (G_028800_Z_ENABLE(track->db_depth_control)) { 978 if (G_028040_FORMAT(track->db_z_info) != V_028040_Z_INVALID &&
979 G_028800_Z_ENABLE(track->db_depth_control)) {
971 r = evergreen_cs_track_validate_depth(p); 980 r = evergreen_cs_track_validate_depth(p);
972 if (r) 981 if (r)
973 return r; 982 return r;
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index d3bd098e4e19..79347855d9bf 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -1277,6 +1277,8 @@
1277#define S_028044_FORMAT(x) (((x) & 0x1) << 0) 1277#define S_028044_FORMAT(x) (((x) & 0x1) << 0)
1278#define G_028044_FORMAT(x) (((x) >> 0) & 0x1) 1278#define G_028044_FORMAT(x) (((x) >> 0) & 0x1)
1279#define C_028044_FORMAT 0xFFFFFFFE 1279#define C_028044_FORMAT 0xFFFFFFFE
1280#define V_028044_STENCIL_INVALID 0
1281#define V_028044_STENCIL_8 1
1280#define G_028044_TILE_SPLIT(x) (((x) >> 8) & 0x7) 1282#define G_028044_TILE_SPLIT(x) (((x) >> 8) & 0x7)
1281#define DB_Z_READ_BASE 0x28048 1283#define DB_Z_READ_BASE 0x28048
1282#define DB_STENCIL_READ_BASE 0x2804c 1284#define DB_STENCIL_READ_BASE 0x2804c
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 9945d86d9001..853800e8582f 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -574,10 +574,18 @@ static void cayman_gpu_init(struct radeon_device *rdev)
574 if (rdev->flags & RADEON_IS_IGP) 574 if (rdev->flags & RADEON_IS_IGP)
575 rdev->config.cayman.tile_config |= 1 << 4; 575 rdev->config.cayman.tile_config |= 1 << 4;
576 else { 576 else {
577 if ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) 577 switch ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) {
578 rdev->config.cayman.tile_config |= 1 << 4; 578 case 0: /* four banks */
579 else
580 rdev->config.cayman.tile_config |= 0 << 4; 579 rdev->config.cayman.tile_config |= 0 << 4;
580 break;
581 case 1: /* eight banks */
582 rdev->config.cayman.tile_config |= 1 << 4;
583 break;
584 case 2: /* sixteen banks */
585 default:
586 rdev->config.cayman.tile_config |= 2 << 4;
587 break;
588 }
581 } 589 }
582 rdev->config.cayman.tile_config |= 590 rdev->config.cayman.tile_config |=
583 ((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8; 591 ((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 637280f541a3..d79c639ae739 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3789,3 +3789,23 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev)
3789 WREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl); 3789 WREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl);
3790 } 3790 }
3791} 3791}
3792
3793/**
3794 * r600_get_gpu_clock - return GPU clock counter snapshot
3795 *
3796 * @rdev: radeon_device pointer
3797 *
3798 * Fetches a GPU clock counter snapshot (R6xx-cayman).
3799 * Returns the 64 bit clock counter snapshot.
3800 */
3801uint64_t r600_get_gpu_clock(struct radeon_device *rdev)
3802{
3803 uint64_t clock;
3804
3805 mutex_lock(&rdev->gpu_clock_mutex);
3806 WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1);
3807 clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) |
3808 ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL);
3809 mutex_unlock(&rdev->gpu_clock_mutex);
3810 return clock;
3811}
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index ca87f7afaf23..3dab49cb1d4a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -764,8 +764,10 @@ static int r600_cs_track_check(struct radeon_cs_parser *p)
764 } 764 }
765 765
766 /* Check depth buffer */ 766 /* Check depth buffer */
767 if (track->db_dirty && (G_028800_STENCIL_ENABLE(track->db_depth_control) || 767 if (track->db_dirty &&
768 G_028800_Z_ENABLE(track->db_depth_control))) { 768 G_028010_FORMAT(track->db_depth_info) != V_028010_DEPTH_INVALID &&
769 (G_028800_STENCIL_ENABLE(track->db_depth_control) ||
770 G_028800_Z_ENABLE(track->db_depth_control))) {
769 r = r600_cs_track_validate_db(p); 771 r = r600_cs_track_validate_db(p);
770 if (r) 772 if (r)
771 return r; 773 return r;
@@ -1557,13 +1559,14 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1557 u32 tiling_flags) 1559 u32 tiling_flags)
1558{ 1560{
1559 struct r600_cs_track *track = p->track; 1561 struct r600_cs_track *track = p->track;
1560 u32 nfaces, llevel, blevel, w0, h0, d0; 1562 u32 dim, nfaces, llevel, blevel, w0, h0, d0;
1561 u32 word0, word1, l0_size, mipmap_size, word2, word3; 1563 u32 word0, word1, l0_size, mipmap_size, word2, word3, word4, word5;
1562 u32 height_align, pitch, pitch_align, depth_align; 1564 u32 height_align, pitch, pitch_align, depth_align;
1563 u32 array, barray, larray; 1565 u32 barray, larray;
1564 u64 base_align; 1566 u64 base_align;
1565 struct array_mode_checker array_check; 1567 struct array_mode_checker array_check;
1566 u32 format; 1568 u32 format;
1569 bool is_array;
1567 1570
1568 /* on legacy kernel we don't perform advanced check */ 1571 /* on legacy kernel we don't perform advanced check */
1569 if (p->rdev == NULL) 1572 if (p->rdev == NULL)
@@ -1581,12 +1584,28 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1581 word0 |= S_038000_TILE_MODE(V_038000_ARRAY_1D_TILED_THIN1); 1584 word0 |= S_038000_TILE_MODE(V_038000_ARRAY_1D_TILED_THIN1);
1582 } 1585 }
1583 word1 = radeon_get_ib_value(p, idx + 1); 1586 word1 = radeon_get_ib_value(p, idx + 1);
1587 word2 = radeon_get_ib_value(p, idx + 2) << 8;
1588 word3 = radeon_get_ib_value(p, idx + 3) << 8;
1589 word4 = radeon_get_ib_value(p, idx + 4);
1590 word5 = radeon_get_ib_value(p, idx + 5);
1591 dim = G_038000_DIM(word0);
1584 w0 = G_038000_TEX_WIDTH(word0) + 1; 1592 w0 = G_038000_TEX_WIDTH(word0) + 1;
1593 pitch = (G_038000_PITCH(word0) + 1) * 8;
1585 h0 = G_038004_TEX_HEIGHT(word1) + 1; 1594 h0 = G_038004_TEX_HEIGHT(word1) + 1;
1586 d0 = G_038004_TEX_DEPTH(word1); 1595 d0 = G_038004_TEX_DEPTH(word1);
1596 format = G_038004_DATA_FORMAT(word1);
1597 blevel = G_038010_BASE_LEVEL(word4);
1598 llevel = G_038014_LAST_LEVEL(word5);
1599 /* pitch in texels */
1600 array_check.array_mode = G_038000_TILE_MODE(word0);
1601 array_check.group_size = track->group_size;
1602 array_check.nbanks = track->nbanks;
1603 array_check.npipes = track->npipes;
1604 array_check.nsamples = 1;
1605 array_check.blocksize = r600_fmt_get_blocksize(format);
1587 nfaces = 1; 1606 nfaces = 1;
1588 array = 0; 1607 is_array = false;
1589 switch (G_038000_DIM(word0)) { 1608 switch (dim) {
1590 case V_038000_SQ_TEX_DIM_1D: 1609 case V_038000_SQ_TEX_DIM_1D:
1591 case V_038000_SQ_TEX_DIM_2D: 1610 case V_038000_SQ_TEX_DIM_2D:
1592 case V_038000_SQ_TEX_DIM_3D: 1611 case V_038000_SQ_TEX_DIM_3D:
@@ -1599,29 +1618,25 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1599 break; 1618 break;
1600 case V_038000_SQ_TEX_DIM_1D_ARRAY: 1619 case V_038000_SQ_TEX_DIM_1D_ARRAY:
1601 case V_038000_SQ_TEX_DIM_2D_ARRAY: 1620 case V_038000_SQ_TEX_DIM_2D_ARRAY:
1602 array = 1; 1621 is_array = true;
1603 break; 1622 break;
1604 case V_038000_SQ_TEX_DIM_2D_MSAA:
1605 case V_038000_SQ_TEX_DIM_2D_ARRAY_MSAA: 1623 case V_038000_SQ_TEX_DIM_2D_ARRAY_MSAA:
1624 is_array = true;
1625 /* fall through */
1626 case V_038000_SQ_TEX_DIM_2D_MSAA:
1627 array_check.nsamples = 1 << llevel;
1628 llevel = 0;
1629 break;
1606 default: 1630 default:
1607 dev_warn(p->dev, "this kernel doesn't support %d texture dim\n", G_038000_DIM(word0)); 1631 dev_warn(p->dev, "this kernel doesn't support %d texture dim\n", G_038000_DIM(word0));
1608 return -EINVAL; 1632 return -EINVAL;
1609 } 1633 }
1610 format = G_038004_DATA_FORMAT(word1);
1611 if (!r600_fmt_is_valid_texture(format, p->family)) { 1634 if (!r600_fmt_is_valid_texture(format, p->family)) {
1612 dev_warn(p->dev, "%s:%d texture invalid format %d\n", 1635 dev_warn(p->dev, "%s:%d texture invalid format %d\n",
1613 __func__, __LINE__, format); 1636 __func__, __LINE__, format);
1614 return -EINVAL; 1637 return -EINVAL;
1615 } 1638 }
1616 1639
1617 /* pitch in texels */
1618 pitch = (G_038000_PITCH(word0) + 1) * 8;
1619 array_check.array_mode = G_038000_TILE_MODE(word0);
1620 array_check.group_size = track->group_size;
1621 array_check.nbanks = track->nbanks;
1622 array_check.npipes = track->npipes;
1623 array_check.nsamples = 1;
1624 array_check.blocksize = r600_fmt_get_blocksize(format);
1625 if (r600_get_array_mode_alignment(&array_check, 1640 if (r600_get_array_mode_alignment(&array_check,
1626 &pitch_align, &height_align, &depth_align, &base_align)) { 1641 &pitch_align, &height_align, &depth_align, &base_align)) {
1627 dev_warn(p->dev, "%s:%d tex array mode (%d) invalid\n", 1642 dev_warn(p->dev, "%s:%d tex array mode (%d) invalid\n",
@@ -1647,20 +1662,13 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1647 return -EINVAL; 1662 return -EINVAL;
1648 } 1663 }
1649 1664
1650 word2 = radeon_get_ib_value(p, idx + 2) << 8;
1651 word3 = radeon_get_ib_value(p, idx + 3) << 8;
1652
1653 word0 = radeon_get_ib_value(p, idx + 4);
1654 word1 = radeon_get_ib_value(p, idx + 5);
1655 blevel = G_038010_BASE_LEVEL(word0);
1656 llevel = G_038014_LAST_LEVEL(word1);
1657 if (blevel > llevel) { 1665 if (blevel > llevel) {
1658 dev_warn(p->dev, "texture blevel %d > llevel %d\n", 1666 dev_warn(p->dev, "texture blevel %d > llevel %d\n",
1659 blevel, llevel); 1667 blevel, llevel);
1660 } 1668 }
1661 if (array == 1) { 1669 if (is_array) {
1662 barray = G_038014_BASE_ARRAY(word1); 1670 barray = G_038014_BASE_ARRAY(word5);
1663 larray = G_038014_LAST_ARRAY(word1); 1671 larray = G_038014_LAST_ARRAY(word5);
1664 1672
1665 nfaces = larray - barray + 1; 1673 nfaces = larray - barray + 1;
1666 } 1674 }
@@ -1677,7 +1685,6 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1677 return -EINVAL; 1685 return -EINVAL;
1678 } 1686 }
1679 /* using get ib will give us the offset into the mipmap bo */ 1687 /* using get ib will give us the offset into the mipmap bo */
1680 word3 = radeon_get_ib_value(p, idx + 3) << 8;
1681 if ((mipmap_size + word3) > radeon_bo_size(mipmap)) { 1688 if ((mipmap_size + word3) > radeon_bo_size(mipmap)) {
1682 /*dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n", 1689 /*dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n",
1683 w0, h0, format, blevel, nlevels, word3, mipmap_size, radeon_bo_size(texture));*/ 1690 w0, h0, format, blevel, nlevels, word3, mipmap_size, radeon_bo_size(texture));*/
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 4b116ae75fc2..fd328f4c3ea8 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -602,6 +602,9 @@
602#define RLC_HB_WPTR 0x3f1c 602#define RLC_HB_WPTR 0x3f1c
603#define RLC_HB_WPTR_LSB_ADDR 0x3f14 603#define RLC_HB_WPTR_LSB_ADDR 0x3f14
604#define RLC_HB_WPTR_MSB_ADDR 0x3f18 604#define RLC_HB_WPTR_MSB_ADDR 0x3f18
605#define RLC_GPU_CLOCK_COUNT_LSB 0x3f38
606#define RLC_GPU_CLOCK_COUNT_MSB 0x3f3c
607#define RLC_CAPTURE_GPU_CLOCK_COUNT 0x3f40
605#define RLC_MC_CNTL 0x3f44 608#define RLC_MC_CNTL 0x3f44
606#define RLC_UCODE_CNTL 0x3f48 609#define RLC_UCODE_CNTL 0x3f48
607#define RLC_UCODE_ADDR 0x3f2c 610#define RLC_UCODE_ADDR 0x3f2c
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5431af292408..99304194a65c 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -300,6 +300,7 @@ struct radeon_bo_va {
300 uint64_t soffset; 300 uint64_t soffset;
301 uint64_t eoffset; 301 uint64_t eoffset;
302 uint32_t flags; 302 uint32_t flags;
303 struct radeon_fence *fence;
303 bool valid; 304 bool valid;
304}; 305};
305 306
@@ -1533,6 +1534,7 @@ struct radeon_device {
1533 unsigned debugfs_count; 1534 unsigned debugfs_count;
1534 /* virtual memory */ 1535 /* virtual memory */
1535 struct radeon_vm_manager vm_manager; 1536 struct radeon_vm_manager vm_manager;
1537 struct mutex gpu_clock_mutex;
1536}; 1538};
1537 1539
1538int radeon_device_init(struct radeon_device *rdev, 1540int radeon_device_init(struct radeon_device *rdev,
@@ -1733,11 +1735,11 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
1733#define radeon_pm_finish(rdev) (rdev)->asic->pm.finish((rdev)) 1735#define radeon_pm_finish(rdev) (rdev)->asic->pm.finish((rdev))
1734#define radeon_pm_init_profile(rdev) (rdev)->asic->pm.init_profile((rdev)) 1736#define radeon_pm_init_profile(rdev) (rdev)->asic->pm.init_profile((rdev))
1735#define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm.get_dynpm_state((rdev)) 1737#define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm.get_dynpm_state((rdev))
1736#define radeon_pre_page_flip(rdev, crtc) rdev->asic->pflip.pre_page_flip((rdev), (crtc)) 1738#define radeon_pre_page_flip(rdev, crtc) (rdev)->asic->pflip.pre_page_flip((rdev), (crtc))
1737#define radeon_page_flip(rdev, crtc, base) rdev->asic->pflip.page_flip((rdev), (crtc), (base)) 1739#define radeon_page_flip(rdev, crtc, base) (rdev)->asic->pflip.page_flip((rdev), (crtc), (base))
1738#define radeon_post_page_flip(rdev, crtc) rdev->asic->pflip.post_page_flip((rdev), (crtc)) 1740#define radeon_post_page_flip(rdev, crtc) (rdev)->asic->pflip.post_page_flip((rdev), (crtc))
1739#define radeon_wait_for_vblank(rdev, crtc) rdev->asic->display.wait_for_vblank((rdev), (crtc)) 1741#define radeon_wait_for_vblank(rdev, crtc) (rdev)->asic->display.wait_for_vblank((rdev), (crtc))
1740#define radeon_mc_wait_for_idle(rdev) rdev->asic->mc_wait_for_idle((rdev)) 1742#define radeon_mc_wait_for_idle(rdev) (rdev)->asic->mc_wait_for_idle((rdev))
1741 1743
1742/* Common functions */ 1744/* Common functions */
1743/* AGP */ 1745/* AGP */
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index f4af24310438..18c38d14c8cd 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -255,13 +255,10 @@ extern int rs690_mc_wait_for_idle(struct radeon_device *rdev);
255 * rv515 255 * rv515
256 */ 256 */
257struct rv515_mc_save { 257struct rv515_mc_save {
258 u32 d1vga_control;
259 u32 d2vga_control;
260 u32 vga_render_control; 258 u32 vga_render_control;
261 u32 vga_hdp_control; 259 u32 vga_hdp_control;
262 u32 d1crtc_control;
263 u32 d2crtc_control;
264}; 260};
261
265int rv515_init(struct radeon_device *rdev); 262int rv515_init(struct radeon_device *rdev);
266void rv515_fini(struct radeon_device *rdev); 263void rv515_fini(struct radeon_device *rdev);
267uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg); 264uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg);
@@ -371,6 +368,7 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
371 unsigned num_gpu_pages, 368 unsigned num_gpu_pages,
372 struct radeon_sa_bo *vb); 369 struct radeon_sa_bo *vb);
373int r600_mc_wait_for_idle(struct radeon_device *rdev); 370int r600_mc_wait_for_idle(struct radeon_device *rdev);
371uint64_t r600_get_gpu_clock(struct radeon_device *rdev);
374 372
375/* 373/*
376 * rv770,rv730,rv710,rv740 374 * rv770,rv730,rv710,rv740
@@ -389,11 +387,10 @@ void r700_cp_fini(struct radeon_device *rdev);
389 * evergreen 387 * evergreen
390 */ 388 */
391struct evergreen_mc_save { 389struct evergreen_mc_save {
392 u32 vga_control[6];
393 u32 vga_render_control; 390 u32 vga_render_control;
394 u32 vga_hdp_control; 391 u32 vga_hdp_control;
395 u32 crtc_control[6];
396}; 392};
393
397void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev); 394void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev);
398int evergreen_init(struct radeon_device *rdev); 395int evergreen_init(struct radeon_device *rdev);
399void evergreen_fini(struct radeon_device *rdev); 396void evergreen_fini(struct radeon_device *rdev);
@@ -472,5 +469,6 @@ int si_vm_bind(struct radeon_device *rdev, struct radeon_vm *vm, int id);
472void si_vm_unbind(struct radeon_device *rdev, struct radeon_vm *vm); 469void si_vm_unbind(struct radeon_device *rdev, struct radeon_vm *vm);
473void si_vm_tlb_flush(struct radeon_device *rdev, struct radeon_vm *vm); 470void si_vm_tlb_flush(struct radeon_device *rdev, struct radeon_vm *vm);
474int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib); 471int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
472uint64_t si_get_gpu_clock(struct radeon_device *rdev);
475 473
476#endif 474#endif
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index b1e3820df363..f9c21f9d16bc 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1263,6 +1263,8 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)
1263union igp_info { 1263union igp_info {
1264 struct _ATOM_INTEGRATED_SYSTEM_INFO info; 1264 struct _ATOM_INTEGRATED_SYSTEM_INFO info;
1265 struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2; 1265 struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2;
1266 struct _ATOM_INTEGRATED_SYSTEM_INFO_V6 info_6;
1267 struct _ATOM_INTEGRATED_SYSTEM_INFO_V1_7 info_7;
1266}; 1268};
1267 1269
1268bool radeon_atombios_sideport_present(struct radeon_device *rdev) 1270bool radeon_atombios_sideport_present(struct radeon_device *rdev)
@@ -1390,27 +1392,50 @@ static void radeon_atombios_get_igp_ss_overrides(struct radeon_device *rdev,
1390 struct radeon_mode_info *mode_info = &rdev->mode_info; 1392 struct radeon_mode_info *mode_info = &rdev->mode_info;
1391 int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); 1393 int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo);
1392 u16 data_offset, size; 1394 u16 data_offset, size;
1393 struct _ATOM_INTEGRATED_SYSTEM_INFO_V6 *igp_info; 1395 union igp_info *igp_info;
1394 u8 frev, crev; 1396 u8 frev, crev;
1395 u16 percentage = 0, rate = 0; 1397 u16 percentage = 0, rate = 0;
1396 1398
1397 /* get any igp specific overrides */ 1399 /* get any igp specific overrides */
1398 if (atom_parse_data_header(mode_info->atom_context, index, &size, 1400 if (atom_parse_data_header(mode_info->atom_context, index, &size,
1399 &frev, &crev, &data_offset)) { 1401 &frev, &crev, &data_offset)) {
1400 igp_info = (struct _ATOM_INTEGRATED_SYSTEM_INFO_V6 *) 1402 igp_info = (union igp_info *)
1401 (mode_info->atom_context->bios + data_offset); 1403 (mode_info->atom_context->bios + data_offset);
1402 switch (id) { 1404 switch (crev) {
1403 case ASIC_INTERNAL_SS_ON_TMDS: 1405 case 6:
1404 percentage = le16_to_cpu(igp_info->usDVISSPercentage); 1406 switch (id) {
1405 rate = le16_to_cpu(igp_info->usDVISSpreadRateIn10Hz); 1407 case ASIC_INTERNAL_SS_ON_TMDS:
1408 percentage = le16_to_cpu(igp_info->info_6.usDVISSPercentage);
1409 rate = le16_to_cpu(igp_info->info_6.usDVISSpreadRateIn10Hz);
1410 break;
1411 case ASIC_INTERNAL_SS_ON_HDMI:
1412 percentage = le16_to_cpu(igp_info->info_6.usHDMISSPercentage);
1413 rate = le16_to_cpu(igp_info->info_6.usHDMISSpreadRateIn10Hz);
1414 break;
1415 case ASIC_INTERNAL_SS_ON_LVDS:
1416 percentage = le16_to_cpu(igp_info->info_6.usLvdsSSPercentage);
1417 rate = le16_to_cpu(igp_info->info_6.usLvdsSSpreadRateIn10Hz);
1418 break;
1419 }
1406 break; 1420 break;
1407 case ASIC_INTERNAL_SS_ON_HDMI: 1421 case 7:
1408 percentage = le16_to_cpu(igp_info->usHDMISSPercentage); 1422 switch (id) {
1409 rate = le16_to_cpu(igp_info->usHDMISSpreadRateIn10Hz); 1423 case ASIC_INTERNAL_SS_ON_TMDS:
1424 percentage = le16_to_cpu(igp_info->info_7.usDVISSPercentage);
1425 rate = le16_to_cpu(igp_info->info_7.usDVISSpreadRateIn10Hz);
1426 break;
1427 case ASIC_INTERNAL_SS_ON_HDMI:
1428 percentage = le16_to_cpu(igp_info->info_7.usHDMISSPercentage);
1429 rate = le16_to_cpu(igp_info->info_7.usHDMISSpreadRateIn10Hz);
1430 break;
1431 case ASIC_INTERNAL_SS_ON_LVDS:
1432 percentage = le16_to_cpu(igp_info->info_7.usLvdsSSPercentage);
1433 rate = le16_to_cpu(igp_info->info_7.usLvdsSSpreadRateIn10Hz);
1434 break;
1435 }
1410 break; 1436 break;
1411 case ASIC_INTERNAL_SS_ON_LVDS: 1437 default:
1412 percentage = le16_to_cpu(igp_info->usLvdsSSPercentage); 1438 DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev);
1413 rate = le16_to_cpu(igp_info->usLvdsSSpreadRateIn10Hz);
1414 break; 1439 break;
1415 } 1440 }
1416 if (percentage) 1441 if (percentage)
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 576f4f6919f2..f75247d42ffd 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -719,6 +719,34 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
719 return i2c; 719 return i2c;
720} 720}
721 721
722static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct radeon_device *rdev)
723{
724 struct drm_device *dev = rdev->ddev;
725 struct radeon_i2c_bus_rec i2c;
726 u16 offset;
727 u8 id, blocks, clk, data;
728 int i;
729
730 i2c.valid = false;
731
732 offset = combios_get_table_offset(dev, COMBIOS_I2C_INFO_TABLE);
733 if (offset) {
734 blocks = RBIOS8(offset + 2);
735 for (i = 0; i < blocks; i++) {
736 id = RBIOS8(offset + 3 + (i * 5) + 0);
737 if (id == 136) {
738 clk = RBIOS8(offset + 3 + (i * 5) + 3);
739 data = RBIOS8(offset + 3 + (i * 5) + 4);
740 /* gpiopad */
741 i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
742 (1 << clk), (1 << data));
743 break;
744 }
745 }
746 }
747 return i2c;
748}
749
722void radeon_combios_i2c_init(struct radeon_device *rdev) 750void radeon_combios_i2c_init(struct radeon_device *rdev)
723{ 751{
724 struct drm_device *dev = rdev->ddev; 752 struct drm_device *dev = rdev->ddev;
@@ -755,30 +783,14 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
755 } else if (rdev->family == CHIP_RS300 || 783 } else if (rdev->family == CHIP_RS300 ||
756 rdev->family == CHIP_RS400 || 784 rdev->family == CHIP_RS400 ||
757 rdev->family == CHIP_RS480) { 785 rdev->family == CHIP_RS480) {
758 u16 offset;
759 u8 id, blocks, clk, data;
760 int i;
761
762 /* 0x68 */ 786 /* 0x68 */
763 i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); 787 i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0);
764 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); 788 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
765 789
766 offset = combios_get_table_offset(dev, COMBIOS_I2C_INFO_TABLE); 790 /* gpiopad */
767 if (offset) { 791 i2c = radeon_combios_get_i2c_info_from_table(rdev);
768 blocks = RBIOS8(offset + 2); 792 if (i2c.valid)
769 for (i = 0; i < blocks; i++) { 793 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
770 id = RBIOS8(offset + 3 + (i * 5) + 0);
771 if (id == 136) {
772 clk = RBIOS8(offset + 3 + (i * 5) + 3);
773 data = RBIOS8(offset + 3 + (i * 5) + 4);
774 /* gpiopad */
775 i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
776 (1 << clk), (1 << data));
777 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
778 break;
779 }
780 }
781 }
782 } else if ((rdev->family == CHIP_R200) || 794 } else if ((rdev->family == CHIP_R200) ||
783 (rdev->family >= CHIP_R300)) { 795 (rdev->family >= CHIP_R300)) {
784 /* 0x68 */ 796 /* 0x68 */
@@ -2321,7 +2333,10 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
2321 connector = (tmp >> 12) & 0xf; 2333 connector = (tmp >> 12) & 0xf;
2322 2334
2323 ddc_type = (tmp >> 8) & 0xf; 2335 ddc_type = (tmp >> 8) & 0xf;
2324 ddc_i2c = combios_setup_i2c_bus(rdev, ddc_type, 0, 0); 2336 if (ddc_type == 5)
2337 ddc_i2c = radeon_combios_get_i2c_info_from_table(rdev);
2338 else
2339 ddc_i2c = combios_setup_i2c_bus(rdev, ddc_type, 0, 0);
2325 2340
2326 switch (connector) { 2341 switch (connector) {
2327 case CONNECTOR_PROPRIETARY_LEGACY: 2342 case CONNECTOR_PROPRIETARY_LEGACY:
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 8a4c49ef0cc4..b4a0db24f4dd 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -278,6 +278,30 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
278 return 0; 278 return 0;
279} 279}
280 280
281static void radeon_bo_vm_fence_va(struct radeon_cs_parser *parser,
282 struct radeon_fence *fence)
283{
284 struct radeon_fpriv *fpriv = parser->filp->driver_priv;
285 struct radeon_vm *vm = &fpriv->vm;
286 struct radeon_bo_list *lobj;
287
288 if (parser->chunk_ib_idx == -1) {
289 return;
290 }
291 if ((parser->cs_flags & RADEON_CS_USE_VM) == 0) {
292 return;
293 }
294
295 list_for_each_entry(lobj, &parser->validated, tv.head) {
296 struct radeon_bo_va *bo_va;
297 struct radeon_bo *rbo = lobj->bo;
298
299 bo_va = radeon_bo_va(rbo, vm);
300 radeon_fence_unref(&bo_va->fence);
301 bo_va->fence = radeon_fence_ref(fence);
302 }
303}
304
281/** 305/**
282 * cs_parser_fini() - clean parser states 306 * cs_parser_fini() - clean parser states
283 * @parser: parser structure holding parsing context. 307 * @parser: parser structure holding parsing context.
@@ -290,11 +314,14 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
290{ 314{
291 unsigned i; 315 unsigned i;
292 316
293 if (!error) 317 if (!error) {
318 /* fence all bo va before ttm_eu_fence_buffer_objects so bo are still reserved */
319 radeon_bo_vm_fence_va(parser, parser->ib.fence);
294 ttm_eu_fence_buffer_objects(&parser->validated, 320 ttm_eu_fence_buffer_objects(&parser->validated,
295 parser->ib.fence); 321 parser->ib.fence);
296 else 322 } else {
297 ttm_eu_backoff_reservation(&parser->validated); 323 ttm_eu_backoff_reservation(&parser->validated);
324 }
298 325
299 if (parser->relocs != NULL) { 326 if (parser->relocs != NULL) {
300 for (i = 0; i < parser->nrelocs; i++) { 327 for (i = 0; i < parser->nrelocs; i++) {
@@ -388,7 +415,6 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
388 415
389 if (parser->chunk_ib_idx == -1) 416 if (parser->chunk_ib_idx == -1)
390 return 0; 417 return 0;
391
392 if ((parser->cs_flags & RADEON_CS_USE_VM) == 0) 418 if ((parser->cs_flags & RADEON_CS_USE_VM) == 0)
393 return 0; 419 return 0;
394 420
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 711e95ad39bf..8794744cdf1a 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -67,7 +67,8 @@ static void radeon_hide_cursor(struct drm_crtc *crtc)
67 67
68 if (ASIC_IS_DCE4(rdev)) { 68 if (ASIC_IS_DCE4(rdev)) {
69 WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset); 69 WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset);
70 WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT)); 70 WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT) |
71 EVERGREEN_CURSOR_URGENT_CONTROL(EVERGREEN_CURSOR_URGENT_1_2));
71 } else if (ASIC_IS_AVIVO(rdev)) { 72 } else if (ASIC_IS_AVIVO(rdev)) {
72 WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset); 73 WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset);
73 WREG32(RADEON_MM_DATA, (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); 74 WREG32(RADEON_MM_DATA, (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT));
@@ -94,7 +95,8 @@ static void radeon_show_cursor(struct drm_crtc *crtc)
94 if (ASIC_IS_DCE4(rdev)) { 95 if (ASIC_IS_DCE4(rdev)) {
95 WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset); 96 WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset);
96 WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_EN | 97 WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_EN |
97 EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT)); 98 EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT) |
99 EVERGREEN_CURSOR_URGENT_CONTROL(EVERGREEN_CURSOR_URGENT_1_2));
98 } else if (ASIC_IS_AVIVO(rdev)) { 100 } else if (ASIC_IS_AVIVO(rdev)) {
99 WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset); 101 WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset);
100 WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN | 102 WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 742af8244e89..d2e243867ac6 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1009,6 +1009,7 @@ int radeon_device_init(struct radeon_device *rdev,
1009 atomic_set(&rdev->ih.lock, 0); 1009 atomic_set(&rdev->ih.lock, 0);
1010 mutex_init(&rdev->gem.mutex); 1010 mutex_init(&rdev->gem.mutex);
1011 mutex_init(&rdev->pm.mutex); 1011 mutex_init(&rdev->pm.mutex);
1012 mutex_init(&rdev->gpu_clock_mutex);
1012 init_rwsem(&rdev->pm.mclk_lock); 1013 init_rwsem(&rdev->pm.mclk_lock);
1013 init_rwsem(&rdev->exclusive_lock); 1014 init_rwsem(&rdev->exclusive_lock);
1014 init_waitqueue_head(&rdev->irq.vblank_queue); 1015 init_waitqueue_head(&rdev->irq.vblank_queue);
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index dcea6f01ae4e..d7269f48d37c 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -59,9 +59,12 @@
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 * 2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
62 * 2.18.0 - r600-eg: allow "invalid" DB formats
63 * 2.19.0 - r600-eg: MSAA textures
64 * 2.20.0 - r600-si: RADEON_INFO_TIMESTAMP query
62 */ 65 */
63#define KMS_DRIVER_MAJOR 2 66#define KMS_DRIVER_MAJOR 2
64#define KMS_DRIVER_MINOR 17 67#define KMS_DRIVER_MINOR 20
65#define KMS_DRIVER_PATCHLEVEL 0 68#define KMS_DRIVER_PATCHLEVEL 0
66int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 69int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
67int radeon_driver_unload_kms(struct drm_device *dev); 70int 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 b3720054614d..bb3b7fe05ccd 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -814,7 +814,7 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
814 return -EINVAL; 814 return -EINVAL;
815 } 815 }
816 816
817 if (bo_va->valid) 817 if (bo_va->valid && mem)
818 return 0; 818 return 0;
819 819
820 ngpu_pages = radeon_bo_ngpu_pages(bo); 820 ngpu_pages = radeon_bo_ngpu_pages(bo);
@@ -859,11 +859,27 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
859 struct radeon_bo *bo) 859 struct radeon_bo *bo)
860{ 860{
861 struct radeon_bo_va *bo_va; 861 struct radeon_bo_va *bo_va;
862 int r;
862 863
863 bo_va = radeon_bo_va(bo, vm); 864 bo_va = radeon_bo_va(bo, vm);
864 if (bo_va == NULL) 865 if (bo_va == NULL)
865 return 0; 866 return 0;
866 867
868 /* wait for va use to end */
869 while (bo_va->fence) {
870 r = radeon_fence_wait(bo_va->fence, false);
871 if (r) {
872 DRM_ERROR("error while waiting for fence: %d\n", r);
873 }
874 if (r == -EDEADLK) {
875 r = radeon_gpu_reset(rdev);
876 if (!r)
877 continue;
878 }
879 break;
880 }
881 radeon_fence_unref(&bo_va->fence);
882
867 mutex_lock(&rdev->vm_manager.lock); 883 mutex_lock(&rdev->vm_manager.lock);
868 mutex_lock(&vm->mutex); 884 mutex_lock(&vm->mutex);
869 radeon_vm_bo_update_pte(rdev, vm, bo, NULL); 885 radeon_vm_bo_update_pte(rdev, vm, bo, NULL);
@@ -934,7 +950,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
934} 950}
935 951
936/** 952/**
937 * radeon_vm_init - tear down a vm instance 953 * radeon_vm_fini - tear down a vm instance
938 * 954 *
939 * @rdev: radeon_device pointer 955 * @rdev: radeon_device pointer
940 * @vm: requested vm 956 * @vm: requested vm
@@ -952,12 +968,15 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm)
952 radeon_vm_unbind_locked(rdev, vm); 968 radeon_vm_unbind_locked(rdev, vm);
953 mutex_unlock(&rdev->vm_manager.lock); 969 mutex_unlock(&rdev->vm_manager.lock);
954 970
955 /* remove all bo */ 971 /* remove all bo at this point non are busy any more because unbind
972 * waited for the last vm fence to signal
973 */
956 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); 974 r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
957 if (!r) { 975 if (!r) {
958 bo_va = radeon_bo_va(rdev->ring_tmp_bo.bo, vm); 976 bo_va = radeon_bo_va(rdev->ring_tmp_bo.bo, vm);
959 list_del_init(&bo_va->bo_list); 977 list_del_init(&bo_va->bo_list);
960 list_del_init(&bo_va->vm_list); 978 list_del_init(&bo_va->vm_list);
979 radeon_fence_unref(&bo_va->fence);
961 radeon_bo_unreserve(rdev->ring_tmp_bo.bo); 980 radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
962 kfree(bo_va); 981 kfree(bo_va);
963 } 982 }
@@ -969,6 +988,7 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm)
969 r = radeon_bo_reserve(bo_va->bo, false); 988 r = radeon_bo_reserve(bo_va->bo, false);
970 if (!r) { 989 if (!r) {
971 list_del_init(&bo_va->bo_list); 990 list_del_init(&bo_va->bo_list);
991 radeon_fence_unref(&bo_va->fence);
972 radeon_bo_unreserve(bo_va->bo); 992 radeon_bo_unreserve(bo_va->bo);
973 kfree(bo_va); 993 kfree(bo_va);
974 } 994 }
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 84d045245739..1b57b0058ad6 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -134,25 +134,16 @@ void radeon_gem_object_close(struct drm_gem_object *obj,
134 struct radeon_device *rdev = rbo->rdev; 134 struct radeon_device *rdev = rbo->rdev;
135 struct radeon_fpriv *fpriv = file_priv->driver_priv; 135 struct radeon_fpriv *fpriv = file_priv->driver_priv;
136 struct radeon_vm *vm = &fpriv->vm; 136 struct radeon_vm *vm = &fpriv->vm;
137 struct radeon_bo_va *bo_va, *tmp;
138 137
139 if (rdev->family < CHIP_CAYMAN) { 138 if (rdev->family < CHIP_CAYMAN) {
140 return; 139 return;
141 } 140 }
142 141
143 if (radeon_bo_reserve(rbo, false)) { 142 if (radeon_bo_reserve(rbo, false)) {
143 dev_err(rdev->dev, "leaking bo va because we fail to reserve bo\n");
144 return; 144 return;
145 } 145 }
146 list_for_each_entry_safe(bo_va, tmp, &rbo->va, bo_list) { 146 radeon_vm_bo_rmv(rdev, vm, rbo);
147 if (bo_va->vm == vm) {
148 /* remove from this vm address space */
149 mutex_lock(&vm->mutex);
150 list_del(&bo_va->vm_list);
151 mutex_unlock(&vm->mutex);
152 list_del(&bo_va->bo_list);
153 kfree(bo_va);
154 }
155 }
156 radeon_bo_unreserve(rbo); 147 radeon_bo_unreserve(rbo);
157} 148}
158 149
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 1d73f16b5d97..414b4acf6947 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -29,6 +29,7 @@
29#include "drm_sarea.h" 29#include "drm_sarea.h"
30#include "radeon.h" 30#include "radeon.h"
31#include "radeon_drm.h" 31#include "radeon_drm.h"
32#include "radeon_asic.h"
32 33
33#include <linux/vga_switcheroo.h> 34#include <linux/vga_switcheroo.h>
34#include <linux/slab.h> 35#include <linux/slab.h>
@@ -167,17 +168,39 @@ static void radeon_set_filp_rights(struct drm_device *dev,
167int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) 168int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
168{ 169{
169 struct radeon_device *rdev = dev->dev_private; 170 struct radeon_device *rdev = dev->dev_private;
170 struct drm_radeon_info *info; 171 struct drm_radeon_info *info = data;
171 struct radeon_mode_info *minfo = &rdev->mode_info; 172 struct radeon_mode_info *minfo = &rdev->mode_info;
172 uint32_t *value_ptr; 173 uint32_t value, *value_ptr;
173 uint32_t value; 174 uint64_t value64, *value_ptr64;
174 struct drm_crtc *crtc; 175 struct drm_crtc *crtc;
175 int i, found; 176 int i, found;
176 177
177 info = data; 178 /* TIMESTAMP is a 64-bit value, needs special handling. */
179 if (info->request == RADEON_INFO_TIMESTAMP) {
180 if (rdev->family >= CHIP_R600) {
181 value_ptr64 = (uint64_t*)((unsigned long)info->value);
182 if (rdev->family >= CHIP_TAHITI) {
183 value64 = si_get_gpu_clock(rdev);
184 } else {
185 value64 = r600_get_gpu_clock(rdev);
186 }
187
188 if (DRM_COPY_TO_USER(value_ptr64, &value64, sizeof(value64))) {
189 DRM_ERROR("copy_to_user %s:%u\n", __func__, __LINE__);
190 return -EFAULT;
191 }
192 return 0;
193 } else {
194 DRM_DEBUG_KMS("timestamp is r6xx+ only!\n");
195 return -EINVAL;
196 }
197 }
198
178 value_ptr = (uint32_t *)((unsigned long)info->value); 199 value_ptr = (uint32_t *)((unsigned long)info->value);
179 if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value))) 200 if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value))) {
201 DRM_ERROR("copy_from_user %s:%u\n", __func__, __LINE__);
180 return -EFAULT; 202 return -EFAULT;
203 }
181 204
182 switch (info->request) { 205 switch (info->request) {
183 case RADEON_INFO_DEVICE_ID: 206 case RADEON_INFO_DEVICE_ID:
@@ -337,7 +360,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
337 return -EINVAL; 360 return -EINVAL;
338 } 361 }
339 if (DRM_COPY_TO_USER(value_ptr, &value, sizeof(uint32_t))) { 362 if (DRM_COPY_TO_USER(value_ptr, &value, sizeof(uint32_t))) {
340 DRM_ERROR("copy_to_user\n"); 363 DRM_ERROR("copy_to_user %s:%u\n", __func__, __LINE__);
341 return -EFAULT; 364 return -EFAULT;
342 } 365 }
343 return 0; 366 return 0;
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index d5fd615897ec..94b4a1c12893 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1025,9 +1025,11 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc,
1025 1025
1026static void radeon_crtc_prepare(struct drm_crtc *crtc) 1026static void radeon_crtc_prepare(struct drm_crtc *crtc)
1027{ 1027{
1028 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1028 struct drm_device *dev = crtc->dev; 1029 struct drm_device *dev = crtc->dev;
1029 struct drm_crtc *crtci; 1030 struct drm_crtc *crtci;
1030 1031
1032 radeon_crtc->in_mode_set = true;
1031 /* 1033 /*
1032 * The hardware wedges sometimes if you reconfigure one CRTC 1034 * The hardware wedges sometimes if you reconfigure one CRTC
1033 * whilst another is running (see fdo bug #24611). 1035 * whilst another is running (see fdo bug #24611).
@@ -1038,6 +1040,7 @@ static void radeon_crtc_prepare(struct drm_crtc *crtc)
1038 1040
1039static void radeon_crtc_commit(struct drm_crtc *crtc) 1041static void radeon_crtc_commit(struct drm_crtc *crtc)
1040{ 1042{
1043 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1041 struct drm_device *dev = crtc->dev; 1044 struct drm_device *dev = crtc->dev;
1042 struct drm_crtc *crtci; 1045 struct drm_crtc *crtci;
1043 1046
@@ -1048,6 +1051,7 @@ static void radeon_crtc_commit(struct drm_crtc *crtc)
1048 if (crtci->enabled) 1051 if (crtci->enabled)
1049 radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON); 1052 radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON);
1050 } 1053 }
1054 radeon_crtc->in_mode_set = false;
1051} 1055}
1052 1056
1053static const struct drm_crtc_helper_funcs legacy_helper_funcs = { 1057static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index f380d59c5763..d56978949f34 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -275,6 +275,7 @@ struct radeon_crtc {
275 u16 lut_r[256], lut_g[256], lut_b[256]; 275 u16 lut_r[256], lut_g[256], lut_b[256];
276 bool enabled; 276 bool enabled;
277 bool can_tile; 277 bool can_tile;
278 bool in_mode_set;
278 uint32_t crtc_offset; 279 uint32_t crtc_offset;
279 struct drm_gem_object *cursor_bo; 280 struct drm_gem_object *cursor_bo;
280 uint64_t cursor_addr; 281 uint64_t cursor_addr;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 1f1a4c803c1d..1cb014b571ab 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -52,11 +52,7 @@ void radeon_bo_clear_va(struct radeon_bo *bo)
52 52
53 list_for_each_entry_safe(bo_va, tmp, &bo->va, bo_list) { 53 list_for_each_entry_safe(bo_va, tmp, &bo->va, bo_list) {
54 /* remove from all vm address space */ 54 /* remove from all vm address space */
55 mutex_lock(&bo_va->vm->mutex); 55 radeon_vm_bo_rmv(bo->rdev, bo_va->vm, bo);
56 list_del(&bo_va->vm_list);
57 mutex_unlock(&bo_va->vm->mutex);
58 list_del(&bo_va->bo_list);
59 kfree(bo_va);
60 } 56 }
61} 57}
62 58
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index a12fbcc8ccb6..aa8ef491ef3c 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -281,12 +281,8 @@ int rv515_debugfs_ga_info_init(struct radeon_device *rdev)
281 281
282void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save) 282void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save)
283{ 283{
284 save->d1vga_control = RREG32(R_000330_D1VGA_CONTROL);
285 save->d2vga_control = RREG32(R_000338_D2VGA_CONTROL);
286 save->vga_render_control = RREG32(R_000300_VGA_RENDER_CONTROL); 284 save->vga_render_control = RREG32(R_000300_VGA_RENDER_CONTROL);
287 save->vga_hdp_control = RREG32(R_000328_VGA_HDP_CONTROL); 285 save->vga_hdp_control = RREG32(R_000328_VGA_HDP_CONTROL);
288 save->d1crtc_control = RREG32(R_006080_D1CRTC_CONTROL);
289 save->d2crtc_control = RREG32(R_006880_D2CRTC_CONTROL);
290 286
291 /* Stop all video */ 287 /* Stop all video */
292 WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); 288 WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
@@ -311,15 +307,6 @@ void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save)
311 /* Unlock host access */ 307 /* Unlock host access */
312 WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control); 308 WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control);
313 mdelay(1); 309 mdelay(1);
314 /* Restore video state */
315 WREG32(R_000330_D1VGA_CONTROL, save->d1vga_control);
316 WREG32(R_000338_D2VGA_CONTROL, save->d2vga_control);
317 WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1);
318 WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 1);
319 WREG32(R_006080_D1CRTC_CONTROL, save->d1crtc_control);
320 WREG32(R_006880_D2CRTC_CONTROL, save->d2crtc_control);
321 WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0);
322 WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
323 WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control); 310 WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control);
324} 311}
325 312
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index c053f8193771..0139e227e3c7 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -1639,11 +1639,19 @@ static void si_gpu_init(struct radeon_device *rdev)
1639 /* XXX what about 12? */ 1639 /* XXX what about 12? */
1640 rdev->config.si.tile_config |= (3 << 0); 1640 rdev->config.si.tile_config |= (3 << 0);
1641 break; 1641 break;
1642 } 1642 }
1643 if ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) 1643 switch ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) {
1644 rdev->config.si.tile_config |= 1 << 4; 1644 case 0: /* four banks */
1645 else
1646 rdev->config.si.tile_config |= 0 << 4; 1645 rdev->config.si.tile_config |= 0 << 4;
1646 break;
1647 case 1: /* eight banks */
1648 rdev->config.si.tile_config |= 1 << 4;
1649 break;
1650 case 2: /* sixteen banks */
1651 default:
1652 rdev->config.si.tile_config |= 2 << 4;
1653 break;
1654 }
1647 rdev->config.si.tile_config |= 1655 rdev->config.si.tile_config |=
1648 ((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8; 1656 ((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8;
1649 rdev->config.si.tile_config |= 1657 rdev->config.si.tile_config |=
@@ -3960,3 +3968,22 @@ void si_fini(struct radeon_device *rdev)
3960 rdev->bios = NULL; 3968 rdev->bios = NULL;
3961} 3969}
3962 3970
3971/**
3972 * si_get_gpu_clock - return GPU clock counter snapshot
3973 *
3974 * @rdev: radeon_device pointer
3975 *
3976 * Fetches a GPU clock counter snapshot (SI).
3977 * Returns the 64 bit clock counter snapshot.
3978 */
3979uint64_t si_get_gpu_clock(struct radeon_device *rdev)
3980{
3981 uint64_t clock;
3982
3983 mutex_lock(&rdev->gpu_clock_mutex);
3984 WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1);
3985 clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) |
3986 ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL);
3987 mutex_unlock(&rdev->gpu_clock_mutex);
3988 return clock;
3989}
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h
index 7869089e8761..ef4815c27b1c 100644
--- a/drivers/gpu/drm/radeon/sid.h
+++ b/drivers/gpu/drm/radeon/sid.h
@@ -698,6 +698,9 @@
698#define RLC_UCODE_ADDR 0xC32C 698#define RLC_UCODE_ADDR 0xC32C
699#define RLC_UCODE_DATA 0xC330 699#define RLC_UCODE_DATA 0xC330
700 700
701#define RLC_GPU_CLOCK_COUNT_LSB 0xC338
702#define RLC_GPU_CLOCK_COUNT_MSB 0xC33C
703#define RLC_CAPTURE_GPU_CLOCK_COUNT 0xC340
701#define RLC_MC_CNTL 0xC344 704#define RLC_MC_CNTL 0xC344
702#define RLC_UCODE_CNTL 0xC348 705#define RLC_UCODE_CNTL 0xC348
703 706
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
index 7bd65bdd15a8..291ecc145585 100644
--- a/drivers/gpu/drm/udl/udl_gem.c
+++ b/drivers/gpu/drm/udl/udl_gem.c
@@ -308,7 +308,7 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev,
308 /* need to attach */ 308 /* need to attach */
309 attach = dma_buf_attach(dma_buf, dev->dev); 309 attach = dma_buf_attach(dma_buf, dev->dev);
310 if (IS_ERR(attach)) 310 if (IS_ERR(attach))
311 return ERR_PTR(PTR_ERR(attach)); 311 return ERR_CAST(attach);
312 312
313 sg = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); 313 sg = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
314 if (IS_ERR(sg)) { 314 if (IS_ERR(sg)) {
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index 59fbb3ae40e7..e35bb8f6fe75 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -129,7 +129,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
129{ 129{
130 struct adf4350_platform_data *pdata = st->pdata; 130 struct adf4350_platform_data *pdata = st->pdata;
131 u64 tmp; 131 u64 tmp;
132 u32 div_gcd, prescaler; 132 u32 div_gcd, prescaler, chspc;
133 u16 mdiv, r_cnt = 0; 133 u16 mdiv, r_cnt = 0;
134 u8 band_sel_div; 134 u8 band_sel_div;
135 135
@@ -158,14 +158,20 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
158 if (pdata->ref_div_factor) 158 if (pdata->ref_div_factor)
159 r_cnt = pdata->ref_div_factor - 1; 159 r_cnt = pdata->ref_div_factor - 1;
160 160
161 do { 161 chspc = st->chspc;
162 r_cnt = adf4350_tune_r_cnt(st, r_cnt);
163 162
164 st->r1_mod = st->fpfd / st->chspc; 163 do {
165 while (st->r1_mod > ADF4350_MAX_MODULUS) { 164 do {
166 r_cnt = adf4350_tune_r_cnt(st, r_cnt); 165 do {
167 st->r1_mod = st->fpfd / st->chspc; 166 r_cnt = adf4350_tune_r_cnt(st, r_cnt);
168 } 167 st->r1_mod = st->fpfd / chspc;
168 if (r_cnt > ADF4350_MAX_R_CNT) {
169 /* try higher spacing values */
170 chspc++;
171 r_cnt = 0;
172 }
173 } while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt);
174 } while (r_cnt == 0);
169 175
170 tmp = freq * (u64)st->r1_mod + (st->fpfd > 1); 176 tmp = freq * (u64)st->r1_mod + (st->fpfd > 1);
171 do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */ 177 do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */
@@ -194,7 +200,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
194 st->regs[ADF4350_REG0] = ADF4350_REG0_INT(st->r0_int) | 200 st->regs[ADF4350_REG0] = ADF4350_REG0_INT(st->r0_int) |
195 ADF4350_REG0_FRACT(st->r0_fract); 201 ADF4350_REG0_FRACT(st->r0_fract);
196 202
197 st->regs[ADF4350_REG1] = ADF4350_REG1_PHASE(0) | 203 st->regs[ADF4350_REG1] = ADF4350_REG1_PHASE(1) |
198 ADF4350_REG1_MOD(st->r1_mod) | 204 ADF4350_REG1_MOD(st->r1_mod) |
199 prescaler; 205 prescaler;
200 206
diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
index 1cbb449b319a..9a99f43094f0 100644
--- a/drivers/iio/light/adjd_s311.c
+++ b/drivers/iio/light/adjd_s311.c
@@ -271,9 +271,10 @@ static int adjd_s311_update_scan_mode(struct iio_dev *indio_dev,
271 const unsigned long *scan_mask) 271 const unsigned long *scan_mask)
272{ 272{
273 struct adjd_s311_data *data = iio_priv(indio_dev); 273 struct adjd_s311_data *data = iio_priv(indio_dev);
274 data->buffer = krealloc(data->buffer, indio_dev->scan_bytes, 274
275 GFP_KERNEL); 275 kfree(data->buffer);
276 if (!data->buffer) 276 data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
277 if (data->buffer == NULL)
277 return -ENOMEM; 278 return -ENOMEM;
278 279
279 return 0; 280 return 0;
diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index c3e7bac13123..e45712a921ce 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -404,7 +404,7 @@ out:
404 return ret; 404 return ret;
405} 405}
406 406
407static int show_thresh_either_en(struct device *dev, 407static ssize_t show_thresh_either_en(struct device *dev,
408 struct device_attribute *attr, 408 struct device_attribute *attr,
409 char *buf) 409 char *buf)
410{ 410{
@@ -424,7 +424,7 @@ static int show_thresh_either_en(struct device *dev,
424 return scnprintf(buf, PAGE_SIZE, "%u\n", enable); 424 return scnprintf(buf, PAGE_SIZE, "%u\n", enable);
425} 425}
426 426
427static int store_thresh_either_en(struct device *dev, 427static ssize_t store_thresh_either_en(struct device *dev,
428 struct device_attribute *attr, 428 struct device_attribute *attr,
429 const char *buf, size_t len) 429 const char *buf, size_t len)
430{ 430{
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 503c7096ed36..908407efc672 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -48,7 +48,7 @@ struct eeti_ts_priv {
48 struct input_dev *input; 48 struct input_dev *input;
49 struct work_struct work; 49 struct work_struct work;
50 struct mutex mutex; 50 struct mutex mutex;
51 int irq, irq_active_high; 51 int irq_gpio, irq, irq_active_high;
52}; 52};
53 53
54#define EETI_TS_BITDEPTH (11) 54#define EETI_TS_BITDEPTH (11)
@@ -62,7 +62,7 @@ struct eeti_ts_priv {
62 62
63static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv) 63static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
64{ 64{
65 return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high; 65 return gpio_get_value(priv->irq_gpio) == priv->irq_active_high;
66} 66}
67 67
68static void eeti_ts_read(struct work_struct *work) 68static void eeti_ts_read(struct work_struct *work)
@@ -157,7 +157,7 @@ static void eeti_ts_close(struct input_dev *dev)
157static int __devinit eeti_ts_probe(struct i2c_client *client, 157static int __devinit eeti_ts_probe(struct i2c_client *client,
158 const struct i2c_device_id *idp) 158 const struct i2c_device_id *idp)
159{ 159{
160 struct eeti_ts_platform_data *pdata; 160 struct eeti_ts_platform_data *pdata = client->dev.platform_data;
161 struct eeti_ts_priv *priv; 161 struct eeti_ts_priv *priv;
162 struct input_dev *input; 162 struct input_dev *input;
163 unsigned int irq_flags; 163 unsigned int irq_flags;
@@ -199,9 +199,12 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
199 199
200 priv->client = client; 200 priv->client = client;
201 priv->input = input; 201 priv->input = input;
202 priv->irq = client->irq; 202 priv->irq_gpio = pdata->irq_gpio;
203 priv->irq = gpio_to_irq(pdata->irq_gpio);
203 204
204 pdata = client->dev.platform_data; 205 err = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name);
206 if (err < 0)
207 goto err1;
205 208
206 if (pdata) 209 if (pdata)
207 priv->irq_active_high = pdata->irq_active_high; 210 priv->irq_active_high = pdata->irq_active_high;
@@ -215,13 +218,13 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
215 218
216 err = input_register_device(input); 219 err = input_register_device(input);
217 if (err) 220 if (err)
218 goto err1; 221 goto err2;
219 222
220 err = request_irq(priv->irq, eeti_ts_isr, irq_flags, 223 err = request_irq(priv->irq, eeti_ts_isr, irq_flags,
221 client->name, priv); 224 client->name, priv);
222 if (err) { 225 if (err) {
223 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); 226 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
224 goto err2; 227 goto err3;
225 } 228 }
226 229
227 /* 230 /*
@@ -233,9 +236,11 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
233 device_init_wakeup(&client->dev, 0); 236 device_init_wakeup(&client->dev, 0);
234 return 0; 237 return 0;
235 238
236err2: 239err3:
237 input_unregister_device(input); 240 input_unregister_device(input);
238 input = NULL; /* so we dont try to free it below */ 241 input = NULL; /* so we dont try to free it below */
242err2:
243 gpio_free(pdata->irq_gpio);
239err1: 244err1:
240 input_free_device(input); 245 input_free_device(input);
241 kfree(priv); 246 kfree(priv);
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 6d1cbdfc9b2a..b64502dfa9f4 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -296,8 +296,13 @@ static int iommu_init_device(struct device *dev)
296 } else 296 } else
297 dma_pdev = pci_dev_get(pdev); 297 dma_pdev = pci_dev_get(pdev);
298 298
299 /* Account for quirked devices */
299 swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev)); 300 swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev));
300 301
302 /*
303 * If it's a multifunction device that does not support our
304 * required ACS flags, add to the same group as function 0.
305 */
301 if (dma_pdev->multifunction && 306 if (dma_pdev->multifunction &&
302 !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS)) 307 !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS))
303 swap_pci_ref(&dma_pdev, 308 swap_pci_ref(&dma_pdev,
@@ -305,14 +310,28 @@ static int iommu_init_device(struct device *dev)
305 PCI_DEVFN(PCI_SLOT(dma_pdev->devfn), 310 PCI_DEVFN(PCI_SLOT(dma_pdev->devfn),
306 0))); 311 0)));
307 312
313 /*
314 * Devices on the root bus go through the iommu. If that's not us,
315 * find the next upstream device and test ACS up to the root bus.
316 * Finding the next device may require skipping virtual buses.
317 */
308 while (!pci_is_root_bus(dma_pdev->bus)) { 318 while (!pci_is_root_bus(dma_pdev->bus)) {
309 if (pci_acs_path_enabled(dma_pdev->bus->self, 319 struct pci_bus *bus = dma_pdev->bus;
310 NULL, REQ_ACS_FLAGS)) 320
321 while (!bus->self) {
322 if (!pci_is_root_bus(bus))
323 bus = bus->parent;
324 else
325 goto root_bus;
326 }
327
328 if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
311 break; 329 break;
312 330
313 swap_pci_ref(&dma_pdev, pci_dev_get(dma_pdev->bus->self)); 331 swap_pci_ref(&dma_pdev, pci_dev_get(bus->self));
314 } 332 }
315 333
334root_bus:
316 group = iommu_group_get(&dma_pdev->dev); 335 group = iommu_group_get(&dma_pdev->dev);
317 pci_dev_put(dma_pdev); 336 pci_dev_put(dma_pdev);
318 if (!group) { 337 if (!group) {
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 500e7f15f5c2..0a2ea317120a 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1131,9 +1131,6 @@ static int __init amd_iommu_init_pci(void)
1131 break; 1131 break;
1132 } 1132 }
1133 1133
1134 /* Make sure ACS will be enabled */
1135 pci_request_acs();
1136
1137 ret = amd_iommu_init_devices(); 1134 ret = amd_iommu_init_devices();
1138 1135
1139 print_iommu_info(); 1136 print_iommu_info();
@@ -1652,6 +1649,9 @@ static bool detect_ivrs(void)
1652 1649
1653 early_acpi_os_unmap_memory((char __iomem *)ivrs_base, ivrs_size); 1650 early_acpi_os_unmap_memory((char __iomem *)ivrs_base, ivrs_size);
1654 1651
1652 /* Make sure ACS will be enabled during PCI probe */
1653 pci_request_acs();
1654
1655 return true; 1655 return true;
1656} 1656}
1657 1657
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 45350ff5e93c..80bad32aa463 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -732,9 +732,9 @@ static int exynos_iommu_domain_init(struct iommu_domain *domain)
732 spin_lock_init(&priv->pgtablelock); 732 spin_lock_init(&priv->pgtablelock);
733 INIT_LIST_HEAD(&priv->clients); 733 INIT_LIST_HEAD(&priv->clients);
734 734
735 dom->geometry.aperture_start = 0; 735 domain->geometry.aperture_start = 0;
736 dom->geometry.aperture_end = ~0UL; 736 domain->geometry.aperture_end = ~0UL;
737 dom->geometry.force_aperture = true; 737 domain->geometry.force_aperture = true;
738 738
739 domain->priv = priv; 739 domain->priv = priv;
740 return 0; 740 return 0;
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 7469b5346643..2297ec193eb4 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2008,6 +2008,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
2008 if (!drhd) { 2008 if (!drhd) {
2009 printk(KERN_ERR "IOMMU: can't find DMAR for device %s\n", 2009 printk(KERN_ERR "IOMMU: can't find DMAR for device %s\n",
2010 pci_name(pdev)); 2010 pci_name(pdev));
2011 free_domain_mem(domain);
2011 return NULL; 2012 return NULL;
2012 } 2013 }
2013 iommu = drhd->iommu; 2014 iommu = drhd->iommu;
@@ -4124,8 +4125,13 @@ static int intel_iommu_add_device(struct device *dev)
4124 } else 4125 } else
4125 dma_pdev = pci_dev_get(pdev); 4126 dma_pdev = pci_dev_get(pdev);
4126 4127
4128 /* Account for quirked devices */
4127 swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev)); 4129 swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev));
4128 4130
4131 /*
4132 * If it's a multifunction device that does not support our
4133 * required ACS flags, add to the same group as function 0.
4134 */
4129 if (dma_pdev->multifunction && 4135 if (dma_pdev->multifunction &&
4130 !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS)) 4136 !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS))
4131 swap_pci_ref(&dma_pdev, 4137 swap_pci_ref(&dma_pdev,
@@ -4133,14 +4139,28 @@ static int intel_iommu_add_device(struct device *dev)
4133 PCI_DEVFN(PCI_SLOT(dma_pdev->devfn), 4139 PCI_DEVFN(PCI_SLOT(dma_pdev->devfn),
4134 0))); 4140 0)));
4135 4141
4142 /*
4143 * Devices on the root bus go through the iommu. If that's not us,
4144 * find the next upstream device and test ACS up to the root bus.
4145 * Finding the next device may require skipping virtual buses.
4146 */
4136 while (!pci_is_root_bus(dma_pdev->bus)) { 4147 while (!pci_is_root_bus(dma_pdev->bus)) {
4137 if (pci_acs_path_enabled(dma_pdev->bus->self, 4148 struct pci_bus *bus = dma_pdev->bus;
4138 NULL, REQ_ACS_FLAGS)) 4149
4150 while (!bus->self) {
4151 if (!pci_is_root_bus(bus))
4152 bus = bus->parent;
4153 else
4154 goto root_bus;
4155 }
4156
4157 if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
4139 break; 4158 break;
4140 4159
4141 swap_pci_ref(&dma_pdev, pci_dev_get(dma_pdev->bus->self)); 4160 swap_pci_ref(&dma_pdev, pci_dev_get(bus->self));
4142 } 4161 }
4143 4162
4163root_bus:
4144 group = iommu_group_get(&dma_pdev->dev); 4164 group = iommu_group_get(&dma_pdev->dev);
4145 pci_dev_put(dma_pdev); 4165 pci_dev_put(dma_pdev);
4146 if (!group) { 4166 if (!group) {
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 4ba325ab6262..2a4bb36bc688 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -799,14 +799,14 @@ static void smmu_iommu_detach_dev(struct iommu_domain *domain,
799 goto out; 799 goto out;
800 } 800 }
801 } 801 }
802 dev_err(smmu->dev, "Couldn't find %s\n", dev_name(c->dev)); 802 dev_err(smmu->dev, "Couldn't find %s\n", dev_name(dev));
803out: 803out:
804 spin_unlock(&as->client_lock); 804 spin_unlock(&as->client_lock);
805} 805}
806 806
807static int smmu_iommu_domain_init(struct iommu_domain *domain) 807static int smmu_iommu_domain_init(struct iommu_domain *domain)
808{ 808{
809 int i, err = -ENODEV; 809 int i, err = -EAGAIN;
810 unsigned long flags; 810 unsigned long flags;
811 struct smmu_as *as; 811 struct smmu_as *as;
812 struct smmu_device *smmu = smmu_handle; 812 struct smmu_device *smmu = smmu_handle;
@@ -814,11 +814,14 @@ static int smmu_iommu_domain_init(struct iommu_domain *domain)
814 /* Look for a free AS with lock held */ 814 /* Look for a free AS with lock held */
815 for (i = 0; i < smmu->num_as; i++) { 815 for (i = 0; i < smmu->num_as; i++) {
816 as = &smmu->as[i]; 816 as = &smmu->as[i];
817 if (!as->pdir_page) { 817
818 err = alloc_pdir(as); 818 if (as->pdir_page)
819 if (!err) 819 continue;
820 goto found; 820
821 } 821 err = alloc_pdir(as);
822 if (!err)
823 goto found;
824
822 if (err != -EAGAIN) 825 if (err != -EAGAIN)
823 break; 826 break;
824 } 827 }
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index 5405ec644db3..baf2686aa8eb 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -16,7 +16,6 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include "isdnloop.h" 17#include "isdnloop.h"
18 18
19static char *revision = "$Revision: 1.11.6.7 $";
20static char *isdnloop_id = "loop0"; 19static char *isdnloop_id = "loop0";
21 20
22MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); 21MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
@@ -1494,17 +1493,6 @@ isdnloop_addcard(char *id1)
1494static int __init 1493static int __init
1495isdnloop_init(void) 1494isdnloop_init(void)
1496{ 1495{
1497 char *p;
1498 char rev[10];
1499
1500 if ((p = strchr(revision, ':'))) {
1501 strcpy(rev, p + 1);
1502 p = strchr(rev, '$');
1503 *p = 0;
1504 } else
1505 strcpy(rev, " ??? ");
1506 printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
1507
1508 if (isdnloop_id) 1496 if (isdnloop_id)
1509 return (isdnloop_addcard(isdnloop_id)); 1497 return (isdnloop_addcard(isdnloop_id));
1510 1498
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c
index 0dc8abca1407..949cabb88f1c 100644
--- a/drivers/isdn/mISDN/layer2.c
+++ b/drivers/isdn/mISDN/layer2.c
@@ -2222,7 +2222,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei,
2222 InitWin(l2); 2222 InitWin(l2);
2223 l2->l2m.fsm = &l2fsm; 2223 l2->l2m.fsm = &l2fsm;
2224 if (test_bit(FLG_LAPB, &l2->flag) || 2224 if (test_bit(FLG_LAPB, &l2->flag) ||
2225 test_bit(FLG_PTP, &l2->flag) || 2225 test_bit(FLG_FIXED_TEI, &l2->flag) ||
2226 test_bit(FLG_LAPD_NET, &l2->flag)) 2226 test_bit(FLG_LAPD_NET, &l2->flag))
2227 l2->l2m.state = ST_L2_4; 2227 l2->l2m.state = ST_L2_4;
2228 else 2228 else
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 6157cbbf4113..363975b3c925 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig,
224 struct led_classdev *led_cdev; 224 struct led_classdev *led_cdev;
225 225
226 led_cdev = list_entry(entry, struct led_classdev, trig_list); 226 led_cdev = list_entry(entry, struct led_classdev, trig_list);
227 led_set_brightness(led_cdev, brightness); 227 __led_set_brightness(led_cdev, brightness);
228 } 228 }
229 read_unlock(&trig->leddev_list_lock); 229 read_unlock(&trig->leddev_list_lock);
230} 230}
diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c
index 53bd136f1ef0..0ade6ebfc914 100644
--- a/drivers/leds/leds-lp8788.c
+++ b/drivers/leds/leds-lp8788.c
@@ -63,7 +63,7 @@ static int lp8788_led_init_device(struct lp8788_led *led,
63 /* scale configuration */ 63 /* scale configuration */
64 addr = LP8788_ISINK_CTRL; 64 addr = LP8788_ISINK_CTRL;
65 mask = 1 << (cfg->num + LP8788_ISINK_SCALE_OFFSET); 65 mask = 1 << (cfg->num + LP8788_ISINK_SCALE_OFFSET);
66 val = cfg->scale << cfg->num; 66 val = cfg->scale << (cfg->num + LP8788_ISINK_SCALE_OFFSET);
67 ret = lp8788_update_bits(led->lp, addr, mask, val); 67 ret = lp8788_update_bits(led->lp, addr, mask, val);
68 if (ret) 68 if (ret)
69 return ret; 69 return ret;
diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c
index 9ee12c28059a..771ea067e680 100644
--- a/drivers/leds/leds-renesas-tpu.c
+++ b/drivers/leds/leds-renesas-tpu.c
@@ -247,7 +247,7 @@ static int __devinit r_tpu_probe(struct platform_device *pdev)
247 247
248 if (!cfg) { 248 if (!cfg) {
249 dev_err(&pdev->dev, "missing platform data\n"); 249 dev_err(&pdev->dev, "missing platform data\n");
250 goto err0; 250 return -ENODEV;
251 } 251 }
252 252
253 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); 253 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 383421bf5760..683e18a23329 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -925,6 +925,7 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
925 goto out; 925 goto out;
926 } 926 }
927 927
928 ret = 0;
928 if (pdata->leds) { 929 if (pdata->leds) {
929 int i; 930 int i;
930 931
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 43a76c41cfcc..db662e2dcfa5 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -202,7 +202,7 @@ static void pcap_isr_work(struct work_struct *work)
202 } 202 }
203 local_irq_enable(); 203 local_irq_enable();
204 ezx_pcap_write(pcap, PCAP_REG_MSR, pcap->msr); 204 ezx_pcap_write(pcap, PCAP_REG_MSR, pcap->msr);
205 } while (gpio_get_value(irq_to_gpio(pcap->spi->irq))); 205 } while (gpio_get_value(pdata->gpio));
206} 206}
207 207
208static void pcap_irq_handler(unsigned int irq, struct irq_desc *desc) 208static void pcap_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index c6ffbbe5a6c0..d78c05e693f7 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -1253,7 +1253,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
1253 if (dev->wd_timeout) 1253 if (dev->wd_timeout)
1254 *slots -= mei_data2slots(MEI_START_WD_DATA_SIZE); 1254 *slots -= mei_data2slots(MEI_START_WD_DATA_SIZE);
1255 else 1255 else
1256 *slots -= mei_data2slots(MEI_START_WD_DATA_SIZE); 1256 *slots -= mei_data2slots(MEI_WD_PARAMS_SIZE);
1257 } 1257 }
1258 } 1258 }
1259 if (dev->stop) 1259 if (dev->stop)
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 092330208869..7422c7652845 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -925,6 +925,27 @@ static struct miscdevice mei_misc_device = {
925}; 925};
926 926
927/** 927/**
928 * mei_quirk_probe - probe for devices that doesn't valid ME interface
929 * @pdev: PCI device structure
930 * @ent: entry into pci_device_table
931 *
932 * returns true if ME Interface is valid, false otherwise
933 */
934static bool __devinit mei_quirk_probe(struct pci_dev *pdev,
935 const struct pci_device_id *ent)
936{
937 u32 reg;
938 if (ent->device == MEI_DEV_ID_PBG_1) {
939 pci_read_config_dword(pdev, 0x48, &reg);
940 /* make sure that bit 9 is up and bit 10 is down */
941 if ((reg & 0x600) == 0x200) {
942 dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n");
943 return false;
944 }
945 }
946 return true;
947}
948/**
928 * mei_probe - Device Initialization Routine 949 * mei_probe - Device Initialization Routine
929 * 950 *
930 * @pdev: PCI device structure 951 * @pdev: PCI device structure
@@ -939,6 +960,12 @@ static int __devinit mei_probe(struct pci_dev *pdev,
939 int err; 960 int err;
940 961
941 mutex_lock(&mei_mutex); 962 mutex_lock(&mei_mutex);
963
964 if (!mei_quirk_probe(pdev, ent)) {
965 err = -ENODEV;
966 goto end;
967 }
968
942 if (mei_device) { 969 if (mei_device) {
943 err = -EEXIST; 970 err = -EEXIST;
944 goto end; 971 goto end;
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
index 1ff460a8e9c7..93b4d67cc4a3 100644
--- a/drivers/misc/ti-st/st_ll.c
+++ b/drivers/misc/ti-st/st_ll.c
@@ -87,7 +87,7 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
87 /* communicate to platform about chip wakeup */ 87 /* communicate to platform about chip wakeup */
88 kim_data = st_data->kim_data; 88 kim_data = st_data->kim_data;
89 pdata = kim_data->kim_pdev->dev.platform_data; 89 pdata = kim_data->kim_pdev->dev.platform_data;
90 if (pdata->chip_asleep) 90 if (pdata->chip_awake)
91 pdata->chip_awake(NULL); 91 pdata->chip_awake(NULL);
92} 92}
93 93
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index cfff454f628b..c3bb304eca07 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -19,14 +19,13 @@
19#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/sections.h>
22 23
23/****************************************************************************/ 24/****************************************************************************/
24 25
25extern char _ebss;
26
27struct map_info uclinux_ram_map = { 26struct map_info uclinux_ram_map = {
28 .name = "RAM", 27 .name = "RAM",
29 .phys = (unsigned long)&_ebss, 28 .phys = (unsigned long)__bss_stop,
30 .size = 0, 29 .size = 0,
31}; 30};
32 31
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 31bb7e5b504a..8ca417614c57 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -480,7 +480,7 @@ config MTD_NAND_NANDSIM
480 480
481config MTD_NAND_GPMI_NAND 481config MTD_NAND_GPMI_NAND
482 bool "GPMI NAND Flash Controller driver" 482 bool "GPMI NAND Flash Controller driver"
483 depends on MTD_NAND && (SOC_IMX23 || SOC_IMX28 || SOC_IMX6Q) 483 depends on MTD_NAND && MXS_DMA
484 help 484 help
485 Enables NAND Flash support for IMX23 or IMX28. 485 Enables NAND Flash support for IMX23 or IMX28.
486 The GPMI controller is very powerful, with the help of BCH 486 The GPMI controller is very powerful, with the help of BCH
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index e9309b3659e7..ac4fd756eda3 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1245,7 +1245,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
1245 goto out_release_mem_region; 1245 goto out_release_mem_region;
1246 } else { 1246 } else {
1247 struct dma_slave_config cfg; 1247 struct dma_slave_config cfg;
1248 int rc;
1249 1248
1250 memset(&cfg, 0, sizeof(cfg)); 1249 memset(&cfg, 0, sizeof(cfg));
1251 cfg.src_addr = info->phys_base; 1250 cfg.src_addr = info->phys_base;
@@ -1254,10 +1253,10 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
1254 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 1253 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1255 cfg.src_maxburst = 16; 1254 cfg.src_maxburst = 16;
1256 cfg.dst_maxburst = 16; 1255 cfg.dst_maxburst = 16;
1257 rc = dmaengine_slave_config(info->dma, &cfg); 1256 err = dmaengine_slave_config(info->dma, &cfg);
1258 if (rc) { 1257 if (err) {
1259 dev_err(&pdev->dev, "DMA engine slave config failed: %d\n", 1258 dev_err(&pdev->dev, "DMA engine slave config failed: %d\n",
1260 rc); 1259 err);
1261 goto out_release_mem_region; 1260 goto out_release_mem_region;
1262 } 1261 }
1263 info->nand.read_buf = omap_read_buf_dma_pref; 1262 info->nand.read_buf = omap_read_buf_dma_pref;
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 545c09ed9079..cff6f023c03a 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -996,9 +996,7 @@ static int __init cops_module_init(void)
996 printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n", 996 printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n",
997 cardname); 997 cardname);
998 cops_dev = cops_probe(-1); 998 cops_dev = cops_probe(-1);
999 if (IS_ERR(cops_dev)) 999 return PTR_RET(cops_dev);
1000 return PTR_ERR(cops_dev);
1001 return 0;
1002} 1000}
1003 1001
1004static void __exit cops_module_exit(void) 1002static void __exit cops_module_exit(void)
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 0910dce3996d..b5782cdf0bca 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1243,9 +1243,7 @@ static int __init ltpc_module_init(void)
1243 "ltpc: Autoprobing is not recommended for modules\n"); 1243 "ltpc: Autoprobing is not recommended for modules\n");
1244 1244
1245 dev_ltpc = ltpc_probe(); 1245 dev_ltpc = ltpc_probe();
1246 if (IS_ERR(dev_ltpc)) 1246 return PTR_RET(dev_ltpc);
1247 return PTR_ERR(dev_ltpc);
1248 return 0;
1249} 1247}
1250module_init(ltpc_module_init); 1248module_init(ltpc_module_init);
1251#endif 1249#endif
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index f0c8bd54ce29..021d69c5d9bc 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -1712,7 +1712,7 @@ e100_set_network_leds(int active)
1712static void 1712static void
1713e100_netpoll(struct net_device* netdev) 1713e100_netpoll(struct net_device* netdev)
1714{ 1714{
1715 e100rxtx_interrupt(NETWORK_DMA_TX_IRQ_NBR, netdev, NULL); 1715 e100rxtx_interrupt(NETWORK_DMA_TX_IRQ_NBR, netdev);
1716} 1716}
1717#endif 1717#endif
1718 1718
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 77bcd4cb4ffb..463b9ec57d80 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1278,7 +1278,7 @@ struct bnx2x {
1278#define BNX2X_FW_RX_ALIGN_START (1UL << BNX2X_RX_ALIGN_SHIFT) 1278#define BNX2X_FW_RX_ALIGN_START (1UL << BNX2X_RX_ALIGN_SHIFT)
1279 1279
1280#define BNX2X_FW_RX_ALIGN_END \ 1280#define BNX2X_FW_RX_ALIGN_END \
1281 max(1UL << BNX2X_RX_ALIGN_SHIFT, \ 1281 max_t(u64, 1UL << BNX2X_RX_ALIGN_SHIFT, \
1282 SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 1282 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
1283 1283
1284#define BNX2X_PXP_DRAM_ALIGN (BNX2X_RX_ALIGN_SHIFT - 5) 1284#define BNX2X_PXP_DRAM_ALIGN (BNX2X_RX_ALIGN_SHIFT - 5)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index dd451c3dd83d..02b5a343b195 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -4041,20 +4041,6 @@ static bool bnx2x_get_load_status(struct bnx2x *bp, int engine)
4041 return val != 0; 4041 return val != 0;
4042} 4042}
4043 4043
4044/*
4045 * Reset the load status for the current engine.
4046 */
4047static void bnx2x_clear_load_status(struct bnx2x *bp)
4048{
4049 u32 val;
4050 u32 mask = (BP_PATH(bp) ? BNX2X_PATH1_LOAD_CNT_MASK :
4051 BNX2X_PATH0_LOAD_CNT_MASK);
4052 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
4053 val = REG_RD(bp, BNX2X_RECOVERY_GLOB_REG);
4054 REG_WR(bp, BNX2X_RECOVERY_GLOB_REG, val & (~mask));
4055 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RECOVERY_REG);
4056}
4057
4058static void _print_next_block(int idx, const char *blk) 4044static void _print_next_block(int idx, const char *blk)
4059{ 4045{
4060 pr_cont("%s%s", idx ? ", " : "", blk); 4046 pr_cont("%s%s", idx ? ", " : "", blk);
@@ -9384,32 +9370,24 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp)
9384 return rc; 9370 return rc;
9385} 9371}
9386 9372
9387static bool __devinit bnx2x_can_flr(struct bnx2x *bp)
9388{
9389 int pos;
9390 u32 cap;
9391 struct pci_dev *dev = bp->pdev;
9392
9393 pos = pci_pcie_cap(dev);
9394 if (!pos)
9395 return false;
9396
9397 pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap);
9398 if (!(cap & PCI_EXP_DEVCAP_FLR))
9399 return false;
9400
9401 return true;
9402}
9403
9404static int __devinit bnx2x_do_flr(struct bnx2x *bp) 9373static int __devinit bnx2x_do_flr(struct bnx2x *bp)
9405{ 9374{
9406 int i, pos; 9375 int i, pos;
9407 u16 status; 9376 u16 status;
9408 struct pci_dev *dev = bp->pdev; 9377 struct pci_dev *dev = bp->pdev;
9409 9378
9410 /* probe the capability first */ 9379
9411 if (bnx2x_can_flr(bp)) 9380 if (CHIP_IS_E1x(bp)) {
9412 return -ENOTTY; 9381 BNX2X_DEV_INFO("FLR not supported in E1/E1H\n");
9382 return -EINVAL;
9383 }
9384
9385 /* only bootcode REQ_BC_VER_4_INITIATE_FLR and onwards support flr */
9386 if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9387 BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9388 bp->common.bc_ver);
9389 return -EINVAL;
9390 }
9413 9391
9414 pos = pci_pcie_cap(dev); 9392 pos = pci_pcie_cap(dev);
9415 if (!pos) 9393 if (!pos)
@@ -9429,12 +9407,8 @@ static int __devinit bnx2x_do_flr(struct bnx2x *bp)
9429 "transaction is not cleared; proceeding with reset anyway\n"); 9407 "transaction is not cleared; proceeding with reset anyway\n");
9430 9408
9431clear: 9409clear:
9432 if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) {
9433 BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n",
9434 bp->common.bc_ver);
9435 return -EINVAL;
9436 }
9437 9410
9411 BNX2X_DEV_INFO("Initiating FLR\n");
9438 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0); 9412 bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0);
9439 9413
9440 return 0; 9414 return 0;
@@ -9454,8 +9428,21 @@ static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp)
9454 * the one required, then FLR will be sufficient to clean any residue 9428 * the one required, then FLR will be sufficient to clean any residue
9455 * left by previous driver 9429 * left by previous driver
9456 */ 9430 */
9457 if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp)) 9431 rc = bnx2x_test_firmware_version(bp, false);
9458 return bnx2x_do_flr(bp); 9432
9433 if (!rc) {
9434 /* fw version is good */
9435 BNX2X_DEV_INFO("FW version matches our own. Attempting FLR\n");
9436 rc = bnx2x_do_flr(bp);
9437 }
9438
9439 if (!rc) {
9440 /* FLR was performed */
9441 BNX2X_DEV_INFO("FLR successful\n");
9442 return 0;
9443 }
9444
9445 BNX2X_DEV_INFO("Could not FLR\n");
9459 9446
9460 /* Close the MCP request, return failure*/ 9447 /* Close the MCP request, return failure*/
9461 rc = bnx2x_prev_mcp_done(bp); 9448 rc = bnx2x_prev_mcp_done(bp);
@@ -11427,9 +11414,6 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
11427 if (!chip_is_e1x) 11414 if (!chip_is_e1x)
11428 REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1); 11415 REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_TARGET_READ, 1);
11429 11416
11430 /* Reset the load counter */
11431 bnx2x_clear_load_status(bp);
11432
11433 dev->watchdog_timeo = TX_TIMEOUT; 11417 dev->watchdog_timeo = TX_TIMEOUT;
11434 11418
11435 dev->netdev_ops = &bnx2x_netdev_ops; 11419 dev->netdev_ops = &bnx2x_netdev_ops;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
index 734fd87cd990..62f754bd0dfe 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
@@ -2485,6 +2485,7 @@ static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp,
2485 break; 2485 break;
2486 2486
2487 default: 2487 default:
2488 kfree(new_cmd);
2488 BNX2X_ERR("Unknown command: %d\n", cmd); 2489 BNX2X_ERR("Unknown command: %d\n", cmd);
2489 return -EINVAL; 2490 return -EINVAL;
2490 } 2491 }
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index c60de89b6669..90a903d83d87 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1948,7 +1948,7 @@ static int be_rx_cqs_create(struct be_adapter *adapter)
1948 1948
1949 if (adapter->num_rx_qs != MAX_RX_QS) 1949 if (adapter->num_rx_qs != MAX_RX_QS)
1950 dev_info(&adapter->pdev->dev, 1950 dev_info(&adapter->pdev->dev,
1951 "Created only %d receive queues", adapter->num_rx_qs); 1951 "Created only %d receive queues\n", adapter->num_rx_qs);
1952 1952
1953 return 0; 1953 return 0;
1954} 1954}
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index 0b3bade957fd..080c89093feb 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -999,7 +999,7 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
999 **/ 999 **/
1000static s32 e1000_reset_hw_82571(struct e1000_hw *hw) 1000static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
1001{ 1001{
1002 u32 ctrl, ctrl_ext, eecd; 1002 u32 ctrl, ctrl_ext, eecd, tctl;
1003 s32 ret_val; 1003 s32 ret_val;
1004 1004
1005 /* 1005 /*
@@ -1014,7 +1014,9 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
1014 ew32(IMC, 0xffffffff); 1014 ew32(IMC, 0xffffffff);
1015 1015
1016 ew32(RCTL, 0); 1016 ew32(RCTL, 0);
1017 ew32(TCTL, E1000_TCTL_PSP); 1017 tctl = er32(TCTL);
1018 tctl &= ~E1000_TCTL_EN;
1019 ew32(TCTL, tctl);
1018 e1e_flush(); 1020 e1e_flush();
1019 1021
1020 usleep_range(10000, 20000); 1022 usleep_range(10000, 20000);
@@ -1601,10 +1603,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1601 * auto-negotiation in the TXCW register and disable 1603 * auto-negotiation in the TXCW register and disable
1602 * forced link in the Device Control register in an 1604 * forced link in the Device Control register in an
1603 * attempt to auto-negotiate with our link partner. 1605 * attempt to auto-negotiate with our link partner.
1604 * If the partner code word is null, stop forcing
1605 * and restart auto negotiation.
1606 */ 1606 */
1607 if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) { 1607 if (rxcw & E1000_RXCW_C) {
1608 /* Enable autoneg, and unforce link up */ 1608 /* Enable autoneg, and unforce link up */
1609 ew32(TXCW, mac->txcw); 1609 ew32(TXCW, mac->txcw);
1610 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); 1610 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 95b245310f17..46c3b1f9ff89 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -178,6 +178,24 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
178 pr_info("%-15s %08x %08x\n", rname, regs[0], regs[1]); 178 pr_info("%-15s %08x %08x\n", rname, regs[0], regs[1]);
179} 179}
180 180
181static void e1000e_dump_ps_pages(struct e1000_adapter *adapter,
182 struct e1000_buffer *bi)
183{
184 int i;
185 struct e1000_ps_page *ps_page;
186
187 for (i = 0; i < adapter->rx_ps_pages; i++) {
188 ps_page = &bi->ps_pages[i];
189
190 if (ps_page->page) {
191 pr_info("packet dump for ps_page %d:\n", i);
192 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
193 16, 1, page_address(ps_page->page),
194 PAGE_SIZE, true);
195 }
196 }
197}
198
181/* 199/*
182 * e1000e_dump - Print registers, Tx-ring and Rx-ring 200 * e1000e_dump - Print registers, Tx-ring and Rx-ring
183 */ 201 */
@@ -299,10 +317,10 @@ static void e1000e_dump(struct e1000_adapter *adapter)
299 (unsigned long long)buffer_info->time_stamp, 317 (unsigned long long)buffer_info->time_stamp,
300 buffer_info->skb, next_desc); 318 buffer_info->skb, next_desc);
301 319
302 if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) 320 if (netif_msg_pktdata(adapter) && buffer_info->skb)
303 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 321 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
304 16, 1, phys_to_virt(buffer_info->dma), 322 16, 1, buffer_info->skb->data,
305 buffer_info->length, true); 323 buffer_info->skb->len, true);
306 } 324 }
307 325
308 /* Print Rx Ring Summary */ 326 /* Print Rx Ring Summary */
@@ -381,10 +399,8 @@ rx_ring_summary:
381 buffer_info->skb, next_desc); 399 buffer_info->skb, next_desc);
382 400
383 if (netif_msg_pktdata(adapter)) 401 if (netif_msg_pktdata(adapter))
384 print_hex_dump(KERN_INFO, "", 402 e1000e_dump_ps_pages(adapter,
385 DUMP_PREFIX_ADDRESS, 16, 1, 403 buffer_info);
386 phys_to_virt(buffer_info->dma),
387 adapter->rx_ps_bsize0, true);
388 } 404 }
389 } 405 }
390 break; 406 break;
@@ -444,12 +460,12 @@ rx_ring_summary:
444 (unsigned long long)buffer_info->dma, 460 (unsigned long long)buffer_info->dma,
445 buffer_info->skb, next_desc); 461 buffer_info->skb, next_desc);
446 462
447 if (netif_msg_pktdata(adapter)) 463 if (netif_msg_pktdata(adapter) &&
464 buffer_info->skb)
448 print_hex_dump(KERN_INFO, "", 465 print_hex_dump(KERN_INFO, "",
449 DUMP_PREFIX_ADDRESS, 16, 466 DUMP_PREFIX_ADDRESS, 16,
450 1, 467 1,
451 phys_to_virt 468 buffer_info->skb->data,
452 (buffer_info->dma),
453 adapter->rx_buffer_len, 469 adapter->rx_buffer_len,
454 true); 470 true);
455 } 471 }
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 5e84eaac48c1..ba994fb4cec6 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -254,6 +254,14 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
254 */ 254 */
255 size += NVM_WORD_SIZE_BASE_SHIFT; 255 size += NVM_WORD_SIZE_BASE_SHIFT;
256 256
257 /*
258 * Check for invalid size
259 */
260 if ((hw->mac.type == e1000_82576) && (size > 15)) {
261 pr_notice("The NVM size is not valid, defaulting to 32K\n");
262 size = 15;
263 }
264
257 nvm->word_size = 1 << size; 265 nvm->word_size = 1 << size;
258 if (hw->mac.type < e1000_i210) { 266 if (hw->mac.type < e1000_i210) {
259 nvm->opcode_bits = 8; 267 nvm->opcode_bits = 8;
@@ -281,14 +289,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
281 } else 289 } else
282 nvm->type = e1000_nvm_flash_hw; 290 nvm->type = e1000_nvm_flash_hw;
283 291
284 /*
285 * Check for invalid size
286 */
287 if ((hw->mac.type == e1000_82576) && (size > 15)) {
288 pr_notice("The NVM size is not valid, defaulting to 32K\n");
289 size = 15;
290 }
291
292 /* NVM Function Pointers */ 292 /* NVM Function Pointers */
293 switch (hw->mac.type) { 293 switch (hw->mac.type) {
294 case e1000_82580: 294 case e1000_82580:
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
index 10efcd88dca0..28394bea5253 100644
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
@@ -156,8 +156,12 @@
156 : (0x0E018 + ((_n) * 0x40))) 156 : (0x0E018 + ((_n) * 0x40)))
157#define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) \ 157#define E1000_TXDCTL(_n) ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) \
158 : (0x0E028 + ((_n) * 0x40))) 158 : (0x0E028 + ((_n) * 0x40)))
159#define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8)) 159#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \
160#define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8)) 160 (0x0C014 + ((_n) * 0x40)))
161#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n)
162#define E1000_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \
163 (0x0E014 + ((_n) * 0x40)))
164#define E1000_DCA_TXCTRL(_n) E1000_TXCTL(_n)
161#define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) \ 165#define E1000_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) \
162 : (0x0E038 + ((_n) * 0x40))) 166 : (0x0E038 + ((_n) * 0x40)))
163#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) \ 167#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) \
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index a19c84cad0e9..70591117051b 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -209,8 +209,8 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
209 /* When SoL/IDER sessions are active, autoneg/speed/duplex 209 /* When SoL/IDER sessions are active, autoneg/speed/duplex
210 * cannot be changed */ 210 * cannot be changed */
211 if (igb_check_reset_block(hw)) { 211 if (igb_check_reset_block(hw)) {
212 dev_err(&adapter->pdev->dev, "Cannot change link " 212 dev_err(&adapter->pdev->dev,
213 "characteristics when SoL/IDER is active.\n"); 213 "Cannot change link characteristics when SoL/IDER is active.\n");
214 return -EINVAL; 214 return -EINVAL;
215 } 215 }
216 216
@@ -1089,8 +1089,8 @@ static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data,
1089 wr32(reg, (_test[pat] & write)); 1089 wr32(reg, (_test[pat] & write));
1090 val = rd32(reg) & mask; 1090 val = rd32(reg) & mask;
1091 if (val != (_test[pat] & write & mask)) { 1091 if (val != (_test[pat] & write & mask)) {
1092 dev_err(&adapter->pdev->dev, "pattern test reg %04X " 1092 dev_err(&adapter->pdev->dev,
1093 "failed: got 0x%08X expected 0x%08X\n", 1093 "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n",
1094 reg, val, (_test[pat] & write & mask)); 1094 reg, val, (_test[pat] & write & mask));
1095 *data = reg; 1095 *data = reg;
1096 return 1; 1096 return 1;
@@ -1108,8 +1108,8 @@ static bool reg_set_and_check(struct igb_adapter *adapter, u64 *data,
1108 wr32(reg, write & mask); 1108 wr32(reg, write & mask);
1109 val = rd32(reg); 1109 val = rd32(reg);
1110 if ((write & mask) != (val & mask)) { 1110 if ((write & mask) != (val & mask)) {
1111 dev_err(&adapter->pdev->dev, "set/check reg %04X test failed:" 1111 dev_err(&adapter->pdev->dev,
1112 " got 0x%08X expected 0x%08X\n", reg, 1112 "set/check reg %04X test failed: got 0x%08X expected 0x%08X\n", reg,
1113 (val & mask), (write & mask)); 1113 (val & mask), (write & mask));
1114 *data = reg; 1114 *data = reg;
1115 return 1; 1115 return 1;
@@ -1171,8 +1171,9 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data)
1171 wr32(E1000_STATUS, toggle); 1171 wr32(E1000_STATUS, toggle);
1172 after = rd32(E1000_STATUS) & toggle; 1172 after = rd32(E1000_STATUS) & toggle;
1173 if (value != after) { 1173 if (value != after) {
1174 dev_err(&adapter->pdev->dev, "failed STATUS register test " 1174 dev_err(&adapter->pdev->dev,
1175 "got: 0x%08X expected: 0x%08X\n", after, value); 1175 "failed STATUS register test got: 0x%08X expected: 0x%08X\n",
1176 after, value);
1176 *data = 1; 1177 *data = 1;
1177 return 1; 1178 return 1;
1178 } 1179 }
@@ -1497,6 +1498,9 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
1497 break; 1498 break;
1498 } 1499 }
1499 1500
1501 /* add small delay to avoid loopback test failure */
1502 msleep(50);
1503
1500 /* force 1000, set loopback */ 1504 /* force 1000, set loopback */
1501 igb_write_phy_reg(hw, PHY_CONTROL, 0x4140); 1505 igb_write_phy_reg(hw, PHY_CONTROL, 0x4140);
1502 1506
@@ -1777,16 +1781,14 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
1777 * sessions are active */ 1781 * sessions are active */
1778 if (igb_check_reset_block(&adapter->hw)) { 1782 if (igb_check_reset_block(&adapter->hw)) {
1779 dev_err(&adapter->pdev->dev, 1783 dev_err(&adapter->pdev->dev,
1780 "Cannot do PHY loopback test " 1784 "Cannot do PHY loopback test when SoL/IDER is active.\n");
1781 "when SoL/IDER is active.\n");
1782 *data = 0; 1785 *data = 0;
1783 goto out; 1786 goto out;
1784 } 1787 }
1785 if ((adapter->hw.mac.type == e1000_i210) 1788 if ((adapter->hw.mac.type == e1000_i210)
1786 || (adapter->hw.mac.type == e1000_i210)) { 1789 || (adapter->hw.mac.type == e1000_i211)) {
1787 dev_err(&adapter->pdev->dev, 1790 dev_err(&adapter->pdev->dev,
1788 "Loopback test not supported " 1791 "Loopback test not supported on this part at this time.\n");
1789 "on this part at this time.\n");
1790 *data = 0; 1792 *data = 0;
1791 goto out; 1793 goto out;
1792 } 1794 }
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index b7c2d5050572..48cc4fb1a307 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -462,10 +462,10 @@ static void igb_dump(struct igb_adapter *adapter)
462 (u64)buffer_info->time_stamp, 462 (u64)buffer_info->time_stamp,
463 buffer_info->skb, next_desc); 463 buffer_info->skb, next_desc);
464 464
465 if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) 465 if (netif_msg_pktdata(adapter) && buffer_info->skb)
466 print_hex_dump(KERN_INFO, "", 466 print_hex_dump(KERN_INFO, "",
467 DUMP_PREFIX_ADDRESS, 467 DUMP_PREFIX_ADDRESS,
468 16, 1, phys_to_virt(buffer_info->dma), 468 16, 1, buffer_info->skb->data,
469 buffer_info->length, true); 469 buffer_info->length, true);
470 } 470 }
471 } 471 }
@@ -547,18 +547,17 @@ rx_ring_summary:
547 (u64)buffer_info->dma, 547 (u64)buffer_info->dma,
548 buffer_info->skb, next_desc); 548 buffer_info->skb, next_desc);
549 549
550 if (netif_msg_pktdata(adapter)) { 550 if (netif_msg_pktdata(adapter) &&
551 buffer_info->dma && buffer_info->skb) {
551 print_hex_dump(KERN_INFO, "", 552 print_hex_dump(KERN_INFO, "",
552 DUMP_PREFIX_ADDRESS, 553 DUMP_PREFIX_ADDRESS,
553 16, 1, 554 16, 1, buffer_info->skb->data,
554 phys_to_virt(buffer_info->dma), 555 IGB_RX_HDR_LEN, true);
555 IGB_RX_HDR_LEN, true);
556 print_hex_dump(KERN_INFO, "", 556 print_hex_dump(KERN_INFO, "",
557 DUMP_PREFIX_ADDRESS, 557 DUMP_PREFIX_ADDRESS,
558 16, 1, 558 16, 1,
559 phys_to_virt( 559 page_address(buffer_info->page) +
560 buffer_info->page_dma + 560 buffer_info->page_offset,
561 buffer_info->page_offset),
562 PAGE_SIZE/2, true); 561 PAGE_SIZE/2, true);
563 } 562 }
564 } 563 }
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index 50fc137501da..18bf08c9d7a4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -804,12 +804,13 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
804 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { 804 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
805 /* Set KX4/KX/KR support according to speed requested */ 805 /* Set KX4/KX/KR support according to speed requested */
806 autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP); 806 autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
807 if (speed & IXGBE_LINK_SPEED_10GB_FULL) 807 if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
808 if (orig_autoc & IXGBE_AUTOC_KX4_SUPP) 808 if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
809 autoc |= IXGBE_AUTOC_KX4_SUPP; 809 autoc |= IXGBE_AUTOC_KX4_SUPP;
810 if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) && 810 if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
811 (hw->phy.smart_speed_active == false)) 811 (hw->phy.smart_speed_active == false))
812 autoc |= IXGBE_AUTOC_KR_SUPP; 812 autoc |= IXGBE_AUTOC_KR_SUPP;
813 }
813 if (speed & IXGBE_LINK_SPEED_1GB_FULL) 814 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
814 autoc |= IXGBE_AUTOC_KX_SUPP; 815 autoc |= IXGBE_AUTOC_KX_SUPP;
815 } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) && 816 } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index f32e70300770..5aba5ecdf1e2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -614,8 +614,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
614 /* If source MAC is equal to our own MAC and not performing 614 /* If source MAC is equal to our own MAC and not performing
615 * the selftest or flb disabled - drop the packet */ 615 * the selftest or flb disabled - drop the packet */
616 if (s_mac == priv->mac && 616 if (s_mac == priv->mac &&
617 (!(dev->features & NETIF_F_LOOPBACK) || 617 !((dev->features & NETIF_F_LOOPBACK) ||
618 !priv->validate_loopback)) 618 priv->validate_loopback))
619 goto next; 619 goto next;
620 620
621 /* 621 /*
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 019d856b1334..10bba09c44ea 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -164,7 +164,6 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
164 ring->cons = 0xffffffff; 164 ring->cons = 0xffffffff;
165 ring->last_nr_txbb = 1; 165 ring->last_nr_txbb = 1;
166 ring->poll_cnt = 0; 166 ring->poll_cnt = 0;
167 ring->blocked = 0;
168 memset(ring->tx_info, 0, ring->size * sizeof(struct mlx4_en_tx_info)); 167 memset(ring->tx_info, 0, ring->size * sizeof(struct mlx4_en_tx_info));
169 memset(ring->buf, 0, ring->buf_size); 168 memset(ring->buf, 0, ring->buf_size);
170 169
@@ -365,14 +364,13 @@ static void mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq)
365 ring->cons += txbbs_skipped; 364 ring->cons += txbbs_skipped;
366 netdev_tx_completed_queue(ring->tx_queue, packets, bytes); 365 netdev_tx_completed_queue(ring->tx_queue, packets, bytes);
367 366
368 /* Wakeup Tx queue if this ring stopped it */ 367 /*
369 if (unlikely(ring->blocked)) { 368 * Wakeup Tx queue if this stopped, and at least 1 packet
370 if ((u32) (ring->prod - ring->cons) <= 369 * was completed
371 ring->size - HEADROOM - MAX_DESC_TXBBS) { 370 */
372 ring->blocked = 0; 371 if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) {
373 netif_tx_wake_queue(ring->tx_queue); 372 netif_tx_wake_queue(ring->tx_queue);
374 priv->port_stats.wake_queue++; 373 priv->port_stats.wake_queue++;
375 }
376 } 374 }
377} 375}
378 376
@@ -592,7 +590,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
592 ring->size - HEADROOM - MAX_DESC_TXBBS)) { 590 ring->size - HEADROOM - MAX_DESC_TXBBS)) {
593 /* every full Tx ring stops queue */ 591 /* every full Tx ring stops queue */
594 netif_tx_stop_queue(ring->tx_queue); 592 netif_tx_stop_queue(ring->tx_queue);
595 ring->blocked = 1;
596 priv->port_stats.queue_stopped++; 593 priv->port_stats.queue_stopped++;
597 594
598 return NETDEV_TX_BUSY; 595 return NETDEV_TX_BUSY;
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 48d0e90194cb..827b72dfce99 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -157,9 +157,6 @@ int mlx4_check_port_params(struct mlx4_dev *dev,
157 "on this HCA, aborting.\n"); 157 "on this HCA, aborting.\n");
158 return -EINVAL; 158 return -EINVAL;
159 } 159 }
160 if (port_type[i] == MLX4_PORT_TYPE_ETH &&
161 port_type[i + 1] == MLX4_PORT_TYPE_IB)
162 return -EINVAL;
163 } 160 }
164 } 161 }
165 162
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 5f1ab105debc..9d27e42264e2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -248,7 +248,6 @@ struct mlx4_en_tx_ring {
248 u32 doorbell_qpn; 248 u32 doorbell_qpn;
249 void *buf; 249 void *buf;
250 u16 poll_cnt; 250 u16 poll_cnt;
251 int blocked;
252 struct mlx4_en_tx_info *tx_info; 251 struct mlx4_en_tx_info *tx_info;
253 u8 *bounce_buf; 252 u8 *bounce_buf;
254 u32 last_nr_txbb; 253 u32 last_nr_txbb;
diff --git a/drivers/net/ethernet/mellanox/mlx4/sense.c b/drivers/net/ethernet/mellanox/mlx4/sense.c
index 802498293528..34ee09bae36e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/sense.c
+++ b/drivers/net/ethernet/mellanox/mlx4/sense.c
@@ -81,20 +81,6 @@ void mlx4_do_sense_ports(struct mlx4_dev *dev,
81 } 81 }
82 82
83 /* 83 /*
84 * Adjust port configuration:
85 * If port 1 sensed nothing and port 2 is IB, set both as IB
86 * If port 2 sensed nothing and port 1 is Eth, set both as Eth
87 */
88 if (stype[0] == MLX4_PORT_TYPE_ETH) {
89 for (i = 1; i < dev->caps.num_ports; i++)
90 stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_ETH;
91 }
92 if (stype[dev->caps.num_ports - 1] == MLX4_PORT_TYPE_IB) {
93 for (i = 0; i < dev->caps.num_ports - 1; i++)
94 stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_IB;
95 }
96
97 /*
98 * If sensed nothing, remain in current configuration. 84 * If sensed nothing, remain in current configuration.
99 */ 85 */
100 for (i = 0; i < dev->caps.num_ports; i++) 86 for (i = 0; i < dev->caps.num_ports; i++)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 4069edab229e..53743f7a2ca9 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -346,28 +346,15 @@ static phy_interface_t lpc_phy_interface_mode(struct device *dev)
346 "phy-mode", NULL); 346 "phy-mode", NULL);
347 if (mode && !strcmp(mode, "mii")) 347 if (mode && !strcmp(mode, "mii"))
348 return PHY_INTERFACE_MODE_MII; 348 return PHY_INTERFACE_MODE_MII;
349 return PHY_INTERFACE_MODE_RMII;
350 } 349 }
351
352 /* non-DT */
353#ifdef CONFIG_ARCH_LPC32XX_MII_SUPPORT
354 return PHY_INTERFACE_MODE_MII;
355#else
356 return PHY_INTERFACE_MODE_RMII; 350 return PHY_INTERFACE_MODE_RMII;
357#endif
358} 351}
359 352
360static bool use_iram_for_net(struct device *dev) 353static bool use_iram_for_net(struct device *dev)
361{ 354{
362 if (dev && dev->of_node) 355 if (dev && dev->of_node)
363 return of_property_read_bool(dev->of_node, "use-iram"); 356 return of_property_read_bool(dev->of_node, "use-iram");
364
365 /* non-DT */
366#ifdef CONFIG_ARCH_LPC32XX_IRAM_FOR_NET
367 return true;
368#else
369 return false; 357 return false;
370#endif
371} 358}
372 359
373/* Receive Status information word */ 360/* Receive Status information word */
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 70554a1b2b02..65a8d49106a4 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1503,6 +1503,11 @@ static int efx_probe_all(struct efx_nic *efx)
1503 goto fail2; 1503 goto fail2;
1504 } 1504 }
1505 1505
1506 BUILD_BUG_ON(EFX_DEFAULT_DMAQ_SIZE < EFX_RXQ_MIN_ENT);
1507 if (WARN_ON(EFX_DEFAULT_DMAQ_SIZE < EFX_TXQ_MIN_ENT(efx))) {
1508 rc = -EINVAL;
1509 goto fail3;
1510 }
1506 efx->rxq_entries = efx->txq_entries = EFX_DEFAULT_DMAQ_SIZE; 1511 efx->rxq_entries = efx->txq_entries = EFX_DEFAULT_DMAQ_SIZE;
1507 1512
1508 rc = efx_probe_filters(efx); 1513 rc = efx_probe_filters(efx);
@@ -2070,6 +2075,7 @@ static int efx_register_netdev(struct efx_nic *efx)
2070 net_dev->irq = efx->pci_dev->irq; 2075 net_dev->irq = efx->pci_dev->irq;
2071 net_dev->netdev_ops = &efx_netdev_ops; 2076 net_dev->netdev_ops = &efx_netdev_ops;
2072 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops); 2077 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops);
2078 net_dev->gso_max_segs = EFX_TSO_MAX_SEGS;
2073 2079
2074 rtnl_lock(); 2080 rtnl_lock();
2075 2081
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index be8f9158a714..70755c97251a 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -30,6 +30,7 @@ extern netdev_tx_t
30efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); 30efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
31extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); 31extern void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
32extern int efx_setup_tc(struct net_device *net_dev, u8 num_tc); 32extern int efx_setup_tc(struct net_device *net_dev, u8 num_tc);
33extern unsigned int efx_tx_max_skb_descs(struct efx_nic *efx);
33 34
34/* RX */ 35/* RX */
35extern int efx_probe_rx_queue(struct efx_rx_queue *rx_queue); 36extern int efx_probe_rx_queue(struct efx_rx_queue *rx_queue);
@@ -52,10 +53,15 @@ extern void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue);
52#define EFX_MAX_EVQ_SIZE 16384UL 53#define EFX_MAX_EVQ_SIZE 16384UL
53#define EFX_MIN_EVQ_SIZE 512UL 54#define EFX_MIN_EVQ_SIZE 512UL
54 55
55/* The smallest [rt]xq_entries that the driver supports. Callers of 56/* Maximum number of TCP segments we support for soft-TSO */
56 * efx_wake_queue() assume that they can subsequently send at least one 57#define EFX_TSO_MAX_SEGS 100
57 * skb. Falcon/A1 may require up to three descriptors per skb_frag. */ 58
58#define EFX_MIN_RING_SIZE (roundup_pow_of_two(2 * 3 * MAX_SKB_FRAGS)) 59/* The smallest [rt]xq_entries that the driver supports. RX minimum
60 * is a bit arbitrary. For TX, we must have space for at least 2
61 * TSO skbs.
62 */
63#define EFX_RXQ_MIN_ENT 128U
64#define EFX_TXQ_MIN_ENT(efx) (2 * efx_tx_max_skb_descs(efx))
59 65
60/* Filters */ 66/* Filters */
61extern int efx_probe_filters(struct efx_nic *efx); 67extern int efx_probe_filters(struct efx_nic *efx);
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 10536f93b561..8cba2df82b18 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -680,21 +680,27 @@ static int efx_ethtool_set_ringparam(struct net_device *net_dev,
680 struct ethtool_ringparam *ring) 680 struct ethtool_ringparam *ring)
681{ 681{
682 struct efx_nic *efx = netdev_priv(net_dev); 682 struct efx_nic *efx = netdev_priv(net_dev);
683 u32 txq_entries;
683 684
684 if (ring->rx_mini_pending || ring->rx_jumbo_pending || 685 if (ring->rx_mini_pending || ring->rx_jumbo_pending ||
685 ring->rx_pending > EFX_MAX_DMAQ_SIZE || 686 ring->rx_pending > EFX_MAX_DMAQ_SIZE ||
686 ring->tx_pending > EFX_MAX_DMAQ_SIZE) 687 ring->tx_pending > EFX_MAX_DMAQ_SIZE)
687 return -EINVAL; 688 return -EINVAL;
688 689
689 if (ring->rx_pending < EFX_MIN_RING_SIZE || 690 if (ring->rx_pending < EFX_RXQ_MIN_ENT) {
690 ring->tx_pending < EFX_MIN_RING_SIZE) {
691 netif_err(efx, drv, efx->net_dev, 691 netif_err(efx, drv, efx->net_dev,
692 "TX and RX queues cannot be smaller than %ld\n", 692 "RX queues cannot be smaller than %u\n",
693 EFX_MIN_RING_SIZE); 693 EFX_RXQ_MIN_ENT);
694 return -EINVAL; 694 return -EINVAL;
695 } 695 }
696 696
697 return efx_realloc_channels(efx, ring->rx_pending, ring->tx_pending); 697 txq_entries = max(ring->tx_pending, EFX_TXQ_MIN_ENT(efx));
698 if (txq_entries != ring->tx_pending)
699 netif_warn(efx, drv, efx->net_dev,
700 "increasing TX queue size to minimum of %u\n",
701 txq_entries);
702
703 return efx_realloc_channels(efx, ring->rx_pending, txq_entries);
698} 704}
699 705
700static int efx_ethtool_set_pauseparam(struct net_device *net_dev, 706static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 9b225a7769f7..18713436b443 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -119,6 +119,25 @@ efx_max_tx_len(struct efx_nic *efx, dma_addr_t dma_addr)
119 return len; 119 return len;
120} 120}
121 121
122unsigned int efx_tx_max_skb_descs(struct efx_nic *efx)
123{
124 /* Header and payload descriptor for each output segment, plus
125 * one for every input fragment boundary within a segment
126 */
127 unsigned int max_descs = EFX_TSO_MAX_SEGS * 2 + MAX_SKB_FRAGS;
128
129 /* Possibly one more per segment for the alignment workaround */
130 if (EFX_WORKAROUND_5391(efx))
131 max_descs += EFX_TSO_MAX_SEGS;
132
133 /* Possibly more for PCIe page boundaries within input fragments */
134 if (PAGE_SIZE > EFX_PAGE_SIZE)
135 max_descs += max_t(unsigned int, MAX_SKB_FRAGS,
136 DIV_ROUND_UP(GSO_MAX_SIZE, EFX_PAGE_SIZE));
137
138 return max_descs;
139}
140
122/* 141/*
123 * Add a socket buffer to a TX queue 142 * Add a socket buffer to a TX queue
124 * 143 *
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index cd01ee7ecef1..b93245c11995 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -74,7 +74,7 @@ static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
74 * the necessary resources and invokes the main to init 74 * the necessary resources and invokes the main to init
75 * the net device, register the mdio bus etc. 75 * the net device, register the mdio bus etc.
76 */ 76 */
77static int stmmac_pltfr_probe(struct platform_device *pdev) 77static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
78{ 78{
79 int ret = 0; 79 int ret = 0;
80 struct resource *res; 80 struct resource *res;
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 482648fcf0b6..98934bdf6acf 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1003,6 +1003,7 @@ static int ixp4xx_nway_reset(struct net_device *dev)
1003} 1003}
1004 1004
1005int ixp46x_phc_index = -1; 1005int ixp46x_phc_index = -1;
1006EXPORT_SYMBOL_GPL(ixp46x_phc_index);
1006 1007
1007static int ixp4xx_get_ts_info(struct net_device *dev, 1008static int ixp4xx_get_ts_info(struct net_device *dev,
1008 struct ethtool_ts_info *info) 1009 struct ethtool_ts_info *info)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 6cee2917eb02..4a1a5f58fa73 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -383,13 +383,6 @@ int netvsc_device_remove(struct hv_device *device)
383 unsigned long flags; 383 unsigned long flags;
384 384
385 net_device = hv_get_drvdata(device); 385 net_device = hv_get_drvdata(device);
386 spin_lock_irqsave(&device->channel->inbound_lock, flags);
387 net_device->destroy = true;
388 spin_unlock_irqrestore(&device->channel->inbound_lock, flags);
389
390 /* Wait for all send completions */
391 wait_event(net_device->wait_drain,
392 atomic_read(&net_device->num_outstanding_sends) == 0);
393 386
394 netvsc_disconnect_vsp(net_device); 387 netvsc_disconnect_vsp(net_device);
395 388
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index e5d6146937fa..1e88a1095934 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -718,6 +718,9 @@ static void rndis_filter_halt_device(struct rndis_device *dev)
718{ 718{
719 struct rndis_request *request; 719 struct rndis_request *request;
720 struct rndis_halt_request *halt; 720 struct rndis_halt_request *halt;
721 struct netvsc_device *nvdev = dev->net_dev;
722 struct hv_device *hdev = nvdev->dev;
723 ulong flags;
721 724
722 /* Attempt to do a rndis device halt */ 725 /* Attempt to do a rndis device halt */
723 request = get_rndis_request(dev, RNDIS_MSG_HALT, 726 request = get_rndis_request(dev, RNDIS_MSG_HALT,
@@ -735,6 +738,14 @@ static void rndis_filter_halt_device(struct rndis_device *dev)
735 dev->state = RNDIS_DEV_UNINITIALIZED; 738 dev->state = RNDIS_DEV_UNINITIALIZED;
736 739
737cleanup: 740cleanup:
741 spin_lock_irqsave(&hdev->channel->inbound_lock, flags);
742 nvdev->destroy = true;
743 spin_unlock_irqrestore(&hdev->channel->inbound_lock, flags);
744
745 /* Wait for all send completions */
746 wait_event(nvdev->wait_drain,
747 atomic_read(&nvdev->num_outstanding_sends) == 0);
748
738 if (request) 749 if (request)
739 put_rndis_request(dev, request); 750 put_rndis_request(dev, request);
740 return; 751 return;
diff --git a/drivers/net/irda/bfin_sir.c b/drivers/net/irda/bfin_sir.c
index a561ae44a9ac..c6a0299aa9f9 100644
--- a/drivers/net/irda/bfin_sir.c
+++ b/drivers/net/irda/bfin_sir.c
@@ -158,7 +158,7 @@ static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed)
158 /* If not add the 'RPOLC', we can't catch the receive interrupt. 158 /* If not add the 'RPOLC', we can't catch the receive interrupt.
159 * It's related with the HW layout and the IR transiver. 159 * It's related with the HW layout and the IR transiver.
160 */ 160 */
161 val |= IREN | RPOLC; 161 val |= UMOD_IRDA | RPOLC;
162 UART_PUT_GCTL(port, val); 162 UART_PUT_GCTL(port, val);
163 return ret; 163 return ret;
164} 164}
@@ -432,7 +432,7 @@ static void bfin_sir_shutdown(struct bfin_sir_port *port, struct net_device *dev
432 bfin_sir_stop_rx(port); 432 bfin_sir_stop_rx(port);
433 433
434 val = UART_GET_GCTL(port); 434 val = UART_GET_GCTL(port);
435 val &= ~(UCEN | IREN | RPOLC); 435 val &= ~(UCEN | UMOD_MASK | RPOLC);
436 UART_PUT_GCTL(port, val); 436 UART_PUT_GCTL(port, val);
437 437
438#ifdef CONFIG_SIR_BFIN_DMA 438#ifdef CONFIG_SIR_BFIN_DMA
@@ -518,10 +518,10 @@ static void bfin_sir_send_work(struct work_struct *work)
518 * reset all the UART. 518 * reset all the UART.
519 */ 519 */
520 val = UART_GET_GCTL(port); 520 val = UART_GET_GCTL(port);
521 val &= ~(IREN | RPOLC); 521 val &= ~(UMOD_MASK | RPOLC);
522 UART_PUT_GCTL(port, val); 522 UART_PUT_GCTL(port, val);
523 SSYNC(); 523 SSYNC();
524 val |= IREN | RPOLC; 524 val |= UMOD_IRDA | RPOLC;
525 UART_PUT_GCTL(port, val); 525 UART_PUT_GCTL(port, val);
526 SSYNC(); 526 SSYNC();
527 /* bfin_sir_set_speed(port, self->speed); */ 527 /* bfin_sir_set_speed(port, self->speed); */
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 0737bd4d1669..0f0f9ce3a776 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -94,7 +94,8 @@ static int get_slot(struct macvlan_dev *vlan, struct macvtap_queue *q)
94 int i; 94 int i;
95 95
96 for (i = 0; i < MAX_MACVTAP_QUEUES; i++) { 96 for (i = 0; i < MAX_MACVTAP_QUEUES; i++) {
97 if (rcu_dereference(vlan->taps[i]) == q) 97 if (rcu_dereference_protected(vlan->taps[i],
98 lockdep_is_held(&macvtap_lock)) == q)
98 return i; 99 return i;
99 } 100 }
100 101
diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c
index e0cc4ef33dee..eefe49e8713c 100644
--- a/drivers/net/phy/mdio-mux-gpio.c
+++ b/drivers/net/phy/mdio-mux-gpio.c
@@ -101,7 +101,6 @@ err:
101 n--; 101 n--;
102 gpio_free(s->gpio[n]); 102 gpio_free(s->gpio[n]);
103 } 103 }
104 devm_kfree(&pdev->dev, s);
105 return r; 104 return r;
106} 105}
107 106
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
index 1c98321b56cc..162464fe86bf 100644
--- a/drivers/net/ppp/pptp.c
+++ b/drivers/net/ppp/pptp.c
@@ -189,7 +189,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
189 if (sk_pppox(po)->sk_state & PPPOX_DEAD) 189 if (sk_pppox(po)->sk_state & PPPOX_DEAD)
190 goto tx_error; 190 goto tx_error;
191 191
192 rt = ip_route_output_ports(&init_net, &fl4, NULL, 192 rt = ip_route_output_ports(sock_net(sk), &fl4, NULL,
193 opt->dst_addr.sin_addr.s_addr, 193 opt->dst_addr.sin_addr.s_addr,
194 opt->src_addr.sin_addr.s_addr, 194 opt->src_addr.sin_addr.s_addr,
195 0, 0, IPPROTO_GRE, 195 0, 0, IPPROTO_GRE,
@@ -468,7 +468,7 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
468 po->chan.private = sk; 468 po->chan.private = sk;
469 po->chan.ops = &pptp_chan_ops; 469 po->chan.ops = &pptp_chan_ops;
470 470
471 rt = ip_route_output_ports(&init_net, &fl4, sk, 471 rt = ip_route_output_ports(sock_net(sk), &fl4, sk,
472 opt->dst_addr.sin_addr.s_addr, 472 opt->dst_addr.sin_addr.s_addr,
473 opt->src_addr.sin_addr.s_addr, 473 opt->src_addr.sin_addr.s_addr,
474 0, 0, 474 0, 0,
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 926d4db5cb38..3a16d4fdaa05 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -187,7 +187,6 @@ static void __tun_detach(struct tun_struct *tun)
187 netif_tx_lock_bh(tun->dev); 187 netif_tx_lock_bh(tun->dev);
188 netif_carrier_off(tun->dev); 188 netif_carrier_off(tun->dev);
189 tun->tfile = NULL; 189 tun->tfile = NULL;
190 tun->socket.file = NULL;
191 netif_tx_unlock_bh(tun->dev); 190 netif_tx_unlock_bh(tun->dev);
192 191
193 /* Drop read queue */ 192 /* Drop read queue */
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 64610048ce87..7d78669000d7 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -232,6 +232,7 @@ static int usbpn_open(struct net_device *dev)
232 struct urb *req = usb_alloc_urb(0, GFP_KERNEL); 232 struct urb *req = usb_alloc_urb(0, GFP_KERNEL);
233 233
234 if (!req || rx_submit(pnd, req, GFP_KERNEL | __GFP_COLD)) { 234 if (!req || rx_submit(pnd, req, GFP_KERNEL | __GFP_COLD)) {
235 usb_free_urb(req);
235 usbpn_close(dev); 236 usbpn_close(dev);
236 return -ENOMEM; 237 return -ENOMEM;
237 } 238 }
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index f4ce5957df32..4cd582a4f625 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1225,6 +1225,26 @@ static const struct usb_device_id cdc_devs[] = {
1225 .driver_info = (unsigned long) &wwan_info, 1225 .driver_info = (unsigned long) &wwan_info,
1226 }, 1226 },
1227 1227
1228 /* Dell branded MBM devices like DW5550 */
1229 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
1230 | USB_DEVICE_ID_MATCH_VENDOR,
1231 .idVendor = 0x413c,
1232 .bInterfaceClass = USB_CLASS_COMM,
1233 .bInterfaceSubClass = USB_CDC_SUBCLASS_NCM,
1234 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
1235 .driver_info = (unsigned long) &wwan_info,
1236 },
1237
1238 /* Toshiba branded MBM devices */
1239 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
1240 | USB_DEVICE_ID_MATCH_VENDOR,
1241 .idVendor = 0x0930,
1242 .bInterfaceClass = USB_CLASS_COMM,
1243 .bInterfaceSubClass = USB_CDC_SUBCLASS_NCM,
1244 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
1245 .driver_info = (unsigned long) &wwan_info,
1246 },
1247
1228 /* Generic CDC-NCM devices */ 1248 /* Generic CDC-NCM devices */
1229 { USB_INTERFACE_INFO(USB_CLASS_COMM, 1249 { USB_INTERFACE_INFO(USB_CLASS_COMM,
1230 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 1250 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index cfa91ab7acf8..60b6a9daff7e 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -730,6 +730,7 @@ int ath9k_hw_init(struct ath_hw *ah)
730 case AR9300_DEVID_QCA955X: 730 case AR9300_DEVID_QCA955X:
731 case AR9300_DEVID_AR9580: 731 case AR9300_DEVID_AR9580:
732 case AR9300_DEVID_AR9462: 732 case AR9300_DEVID_AR9462:
733 case AR9485_DEVID_AR1111:
733 break; 734 break;
734 default: 735 default:
735 if (common->bus_ops->ath_bus_type == ATH_USB) 736 if (common->bus_ops->ath_bus_type == ATH_USB)
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index dd0c146d81dc..ce7332c64efb 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -49,6 +49,7 @@
49#define AR9300_DEVID_AR9462 0x0034 49#define AR9300_DEVID_AR9462 0x0034
50#define AR9300_DEVID_AR9330 0x0035 50#define AR9300_DEVID_AR9330 0x0035
51#define AR9300_DEVID_QCA955X 0x0038 51#define AR9300_DEVID_QCA955X 0x0038
52#define AR9485_DEVID_AR1111 0x0037
52 53
53#define AR5416_AR9100_DEVID 0x000b 54#define AR5416_AR9100_DEVID 0x000b
54 55
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 87b89d55e637..d455de9162ec 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -37,6 +37,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
37 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */ 37 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
38 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */ 38 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
39 { PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E AR9462 */ 39 { PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E AR9462 */
40 { PCI_VDEVICE(ATHEROS, 0x0037) }, /* PCI-E AR1111/AR9485 */
40 { 0 } 41 { 0 }
41}; 42};
42 43
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index b80352b308d5..a140165dfee0 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2719,32 +2719,37 @@ static int b43_gpio_init(struct b43_wldev *dev)
2719 if (dev->dev->chip_id == 0x4301) { 2719 if (dev->dev->chip_id == 0x4301) {
2720 mask |= 0x0060; 2720 mask |= 0x0060;
2721 set |= 0x0060; 2721 set |= 0x0060;
2722 } else if (dev->dev->chip_id == 0x5354) {
2723 /* Don't allow overtaking buttons GPIOs */
2724 set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */
2722 } 2725 }
2723 if (dev->dev->chip_id == 0x5354) 2726
2724 set &= 0xff02;
2725 if (0 /* FIXME: conditional unknown */ ) { 2727 if (0 /* FIXME: conditional unknown */ ) {
2726 b43_write16(dev, B43_MMIO_GPIO_MASK, 2728 b43_write16(dev, B43_MMIO_GPIO_MASK,
2727 b43_read16(dev, B43_MMIO_GPIO_MASK) 2729 b43_read16(dev, B43_MMIO_GPIO_MASK)
2728 | 0x0100); 2730 | 0x0100);
2729 mask |= 0x0180; 2731 /* BT Coexistance Input */
2730 set |= 0x0180; 2732 mask |= 0x0080;
2733 set |= 0x0080;
2734 /* BT Coexistance Out */
2735 mask |= 0x0100;
2736 set |= 0x0100;
2731 } 2737 }
2732 if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) { 2738 if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) {
2739 /* PA is controlled by gpio 9, let ucode handle it */
2733 b43_write16(dev, B43_MMIO_GPIO_MASK, 2740 b43_write16(dev, B43_MMIO_GPIO_MASK,
2734 b43_read16(dev, B43_MMIO_GPIO_MASK) 2741 b43_read16(dev, B43_MMIO_GPIO_MASK)
2735 | 0x0200); 2742 | 0x0200);
2736 mask |= 0x0200; 2743 mask |= 0x0200;
2737 set |= 0x0200; 2744 set |= 0x0200;
2738 } 2745 }
2739 if (dev->dev->core_rev >= 2)
2740 mask |= 0x0010; /* FIXME: This is redundant. */
2741 2746
2742 switch (dev->dev->bus_type) { 2747 switch (dev->dev->bus_type) {
2743#ifdef CONFIG_B43_BCMA 2748#ifdef CONFIG_B43_BCMA
2744 case B43_BUS_BCMA: 2749 case B43_BUS_BCMA:
2745 bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL, 2750 bcma_cc_write32(&dev->dev->bdev->bus->drv_cc, BCMA_CC_GPIOCTL,
2746 (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc, 2751 (bcma_cc_read32(&dev->dev->bdev->bus->drv_cc,
2747 BCMA_CC_GPIOCTL) & mask) | set); 2752 BCMA_CC_GPIOCTL) & ~mask) | set);
2748 break; 2753 break;
2749#endif 2754#endif
2750#ifdef CONFIG_B43_SSB 2755#ifdef CONFIG_B43_SSB
@@ -2753,7 +2758,7 @@ static int b43_gpio_init(struct b43_wldev *dev)
2753 if (gpiodev) 2758 if (gpiodev)
2754 ssb_write32(gpiodev, B43_GPIO_CONTROL, 2759 ssb_write32(gpiodev, B43_GPIO_CONTROL,
2755 (ssb_read32(gpiodev, B43_GPIO_CONTROL) 2760 (ssb_read32(gpiodev, B43_GPIO_CONTROL)
2756 & mask) | set); 2761 & ~mask) | set);
2757 break; 2762 break;
2758#endif 2763#endif
2759 } 2764 }
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
index 9a4c63f927cb..7ed7d7577024 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -382,9 +382,7 @@ brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec,
382{ 382{
383 struct brcms_c_info *wlc = wlc_cm->wlc; 383 struct brcms_c_info *wlc = wlc_cm->wlc;
384 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; 384 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel;
385 const struct ieee80211_reg_rule *reg_rule;
386 struct txpwr_limits txpwr; 385 struct txpwr_limits txpwr;
387 int ret;
388 386
389 brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr); 387 brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr);
390 388
@@ -393,8 +391,7 @@ brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec,
393 ); 391 );
394 392
395 /* set or restore gmode as required by regulatory */ 393 /* set or restore gmode as required by regulatory */
396 ret = freq_reg_info(wlc->wiphy, ch->center_freq, 0, &reg_rule); 394 if (ch->flags & IEEE80211_CHAN_NO_OFDM)
397 if (!ret && (reg_rule->flags & NL80211_RRF_NO_OFDM))
398 brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false); 395 brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false);
399 else 396 else
400 brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); 397 brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 9e79d47e077f..192ad5c1fcc8 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -121,7 +121,8 @@ static struct ieee80211_channel brcms_2ghz_chantable[] = {
121 IEEE80211_CHAN_NO_HT40PLUS), 121 IEEE80211_CHAN_NO_HT40PLUS),
122 CHAN2GHZ(14, 2484, 122 CHAN2GHZ(14, 2484,
123 IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS | 123 IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS |
124 IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 124 IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS |
125 IEEE80211_CHAN_NO_OFDM)
125}; 126};
126 127
127static struct ieee80211_channel brcms_5ghz_nphy_chantable[] = { 128static struct ieee80211_channel brcms_5ghz_nphy_chantable[] = {
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index 6fddd2785e6e..a82f46c10f5e 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -707,11 +707,14 @@ static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
707 */ 707 */
708static bool rs_use_green(struct ieee80211_sta *sta) 708static bool rs_use_green(struct ieee80211_sta *sta)
709{ 709{
710 struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; 710 /*
711 struct iwl_rxon_context *ctx = sta_priv->ctx; 711 * There's a bug somewhere in this code that causes the
712 712 * scaling to get stuck because GF+SGI can't be combined
713 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && 713 * in SISO rates. Until we find that bug, disable GF, it
714 !(ctx->ht.non_gf_sta_present); 714 * has only limited benefit and we still interoperate with
715 * GF APs since we can always receive GF transmissions.
716 */
717 return false;
715} 718}
716 719
717/** 720/**
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index eb5de800ed90..1c10b542ab23 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1254,6 +1254,7 @@ static int lbs_associate(struct lbs_private *priv,
1254 netif_tx_wake_all_queues(priv->dev); 1254 netif_tx_wake_all_queues(priv->dev);
1255 } 1255 }
1256 1256
1257 kfree(cmd);
1257done: 1258done:
1258 lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); 1259 lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret);
1259 return ret; 1260 return ret;
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 76caebaa4397..e970897f6ab5 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1314,6 +1314,7 @@ static void if_sdio_remove(struct sdio_func *func)
1314 kfree(packet); 1314 kfree(packet);
1315 } 1315 }
1316 1316
1317 kfree(card);
1317 lbs_deb_leave(LBS_DEB_SDIO); 1318 lbs_deb_leave(LBS_DEB_SDIO);
1318} 1319}
1319 1320
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 58048189bd24..fe1ea43c5149 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -571,7 +571,10 @@ static int lbs_thread(void *data)
571 netdev_info(dev, "Timeout submitting command 0x%04x\n", 571 netdev_info(dev, "Timeout submitting command 0x%04x\n",
572 le16_to_cpu(cmdnode->cmdbuf->command)); 572 le16_to_cpu(cmdnode->cmdbuf->command));
573 lbs_complete_command(priv, cmdnode, -ETIMEDOUT); 573 lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
574 if (priv->reset_card) 574
575 /* Reset card, but only when it isn't in the process
576 * of being shutdown anyway. */
577 if (!dev->dismantle && priv->reset_card)
575 priv->reset_card(priv); 578 priv->reset_card(priv);
576 } 579 }
577 priv->cmd_timed_out = 0; 580 priv->cmd_timed_out = 0;
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 88455b1b9fe0..cb8c2aca54e4 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -221,6 +221,67 @@ static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev,
221 mutex_unlock(&rt2x00dev->csr_mutex); 221 mutex_unlock(&rt2x00dev->csr_mutex);
222} 222}
223 223
224static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
225{
226 u32 reg;
227 int i, count;
228
229 rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
230 if (rt2x00_get_field32(reg, WLAN_EN))
231 return 0;
232
233 rt2x00_set_field32(&reg, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
234 rt2x00_set_field32(&reg, FRC_WL_ANT_SET, 1);
235 rt2x00_set_field32(&reg, WLAN_CLK_EN, 0);
236 rt2x00_set_field32(&reg, WLAN_EN, 1);
237 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
238
239 udelay(REGISTER_BUSY_DELAY);
240
241 count = 0;
242 do {
243 /*
244 * Check PLL_LD & XTAL_RDY.
245 */
246 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
247 rt2800_register_read(rt2x00dev, CMB_CTRL, &reg);
248 if (rt2x00_get_field32(reg, PLL_LD) &&
249 rt2x00_get_field32(reg, XTAL_RDY))
250 break;
251 udelay(REGISTER_BUSY_DELAY);
252 }
253
254 if (i >= REGISTER_BUSY_COUNT) {
255
256 if (count >= 10)
257 return -EIO;
258
259 rt2800_register_write(rt2x00dev, 0x58, 0x018);
260 udelay(REGISTER_BUSY_DELAY);
261 rt2800_register_write(rt2x00dev, 0x58, 0x418);
262 udelay(REGISTER_BUSY_DELAY);
263 rt2800_register_write(rt2x00dev, 0x58, 0x618);
264 udelay(REGISTER_BUSY_DELAY);
265 count++;
266 } else {
267 count = 0;
268 }
269
270 rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
271 rt2x00_set_field32(&reg, PCIE_APP0_CLK_REQ, 0);
272 rt2x00_set_field32(&reg, WLAN_CLK_EN, 1);
273 rt2x00_set_field32(&reg, WLAN_RESET, 1);
274 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
275 udelay(10);
276 rt2x00_set_field32(&reg, WLAN_RESET, 0);
277 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
278 udelay(10);
279 rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff);
280 } while (count != 0);
281
282 return 0;
283}
284
224void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, 285void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
225 const u8 command, const u8 token, 286 const u8 command, const u8 token,
226 const u8 arg0, const u8 arg1) 287 const u8 arg0, const u8 arg1)
@@ -400,6 +461,13 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
400{ 461{
401 unsigned int i; 462 unsigned int i;
402 u32 reg; 463 u32 reg;
464 int retval;
465
466 if (rt2x00_rt(rt2x00dev, RT3290)) {
467 retval = rt2800_enable_wlan_rt3290(rt2x00dev);
468 if (retval)
469 return -EBUSY;
470 }
403 471
404 /* 472 /*
405 * If driver doesn't wake up firmware here, 473 * If driver doesn't wake up firmware here,
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 235376e9cb04..98aa426a3564 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -980,66 +980,6 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
980 return rt2800_validate_eeprom(rt2x00dev); 980 return rt2800_validate_eeprom(rt2x00dev);
981} 981}
982 982
983static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
984{
985 u32 reg;
986 int i, count;
987
988 rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
989 if (rt2x00_get_field32(reg, WLAN_EN))
990 return 0;
991
992 rt2x00_set_field32(&reg, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
993 rt2x00_set_field32(&reg, FRC_WL_ANT_SET, 1);
994 rt2x00_set_field32(&reg, WLAN_CLK_EN, 0);
995 rt2x00_set_field32(&reg, WLAN_EN, 1);
996 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
997
998 udelay(REGISTER_BUSY_DELAY);
999
1000 count = 0;
1001 do {
1002 /*
1003 * Check PLL_LD & XTAL_RDY.
1004 */
1005 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
1006 rt2800_register_read(rt2x00dev, CMB_CTRL, &reg);
1007 if (rt2x00_get_field32(reg, PLL_LD) &&
1008 rt2x00_get_field32(reg, XTAL_RDY))
1009 break;
1010 udelay(REGISTER_BUSY_DELAY);
1011 }
1012
1013 if (i >= REGISTER_BUSY_COUNT) {
1014
1015 if (count >= 10)
1016 return -EIO;
1017
1018 rt2800_register_write(rt2x00dev, 0x58, 0x018);
1019 udelay(REGISTER_BUSY_DELAY);
1020 rt2800_register_write(rt2x00dev, 0x58, 0x418);
1021 udelay(REGISTER_BUSY_DELAY);
1022 rt2800_register_write(rt2x00dev, 0x58, 0x618);
1023 udelay(REGISTER_BUSY_DELAY);
1024 count++;
1025 } else {
1026 count = 0;
1027 }
1028
1029 rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
1030 rt2x00_set_field32(&reg, PCIE_APP0_CLK_REQ, 0);
1031 rt2x00_set_field32(&reg, WLAN_CLK_EN, 1);
1032 rt2x00_set_field32(&reg, WLAN_RESET, 1);
1033 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
1034 udelay(10);
1035 rt2x00_set_field32(&reg, WLAN_RESET, 0);
1036 rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg);
1037 udelay(10);
1038 rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff);
1039 } while (count != 0);
1040
1041 return 0;
1042}
1043static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) 983static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1044{ 984{
1045 int retval; 985 int retval;
@@ -1063,17 +1003,6 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1063 return retval; 1003 return retval;
1064 1004
1065 /* 1005 /*
1066 * In probe phase call rt2800_enable_wlan_rt3290 to enable wlan
1067 * clk for rt3290. That avoid the MCU fail in start phase.
1068 */
1069 if (rt2x00_rt(rt2x00dev, RT3290)) {
1070 retval = rt2800_enable_wlan_rt3290(rt2x00dev);
1071
1072 if (retval)
1073 return retval;
1074 }
1075
1076 /*
1077 * This device has multiple filters for control frames 1006 * This device has multiple filters for control frames
1078 * and has a separate filter for PS Poll frames. 1007 * and has a separate filter for PS Poll frames.
1079 */ 1008 */
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index f32259686b45..3f7bc5cadf9a 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2243,8 +2243,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
2243 2243
2244static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev) 2244static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev)
2245{ 2245{
2246 struct ieee80211_conf conf = { .flags = 0 }; 2246 struct rt2x00lib_conf libconf = { .conf = &rt2x00dev->hw->conf };
2247 struct rt2x00lib_conf libconf = { .conf = &conf };
2248 2247
2249 rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); 2248 rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS);
2250} 2249}
diff --git a/drivers/pinctrl/pinctrl-imx23.c b/drivers/pinctrl/pinctrl-imx23.c
index 75d3eff94296..3674d877ed7c 100644
--- a/drivers/pinctrl/pinctrl-imx23.c
+++ b/drivers/pinctrl/pinctrl-imx23.c
@@ -292,7 +292,7 @@ static int __init imx23_pinctrl_init(void)
292{ 292{
293 return platform_driver_register(&imx23_pinctrl_driver); 293 return platform_driver_register(&imx23_pinctrl_driver);
294} 294}
295arch_initcall(imx23_pinctrl_init); 295postcore_initcall(imx23_pinctrl_init);
296 296
297static void __exit imx23_pinctrl_exit(void) 297static void __exit imx23_pinctrl_exit(void)
298{ 298{
diff --git a/drivers/pinctrl/pinctrl-imx28.c b/drivers/pinctrl/pinctrl-imx28.c
index b973026811a2..0f5b2122b1ba 100644
--- a/drivers/pinctrl/pinctrl-imx28.c
+++ b/drivers/pinctrl/pinctrl-imx28.c
@@ -408,7 +408,7 @@ static int __init imx28_pinctrl_init(void)
408{ 408{
409 return platform_driver_register(&imx28_pinctrl_driver); 409 return platform_driver_register(&imx28_pinctrl_driver);
410} 410}
411arch_initcall(imx28_pinctrl_init); 411postcore_initcall(imx28_pinctrl_init);
412 412
413static void __exit imx28_pinctrl_exit(void) 413static void __exit imx28_pinctrl_exit(void)
414{ 414{
diff --git a/drivers/pinctrl/pinctrl-nomadik-db8500.c b/drivers/pinctrl/pinctrl-nomadik-db8500.c
index 6f99769c6733..5f3e9d0221e1 100644
--- a/drivers/pinctrl/pinctrl-nomadik-db8500.c
+++ b/drivers/pinctrl/pinctrl-nomadik-db8500.c
@@ -766,7 +766,7 @@ DB8500_FUNC_GROUPS(ipgpio, "ipgpio0_a_1", "ipgpio1_a_1", "ipgpio7_b_1",
766DB8500_FUNC_GROUPS(msp2, "msp2sck_a_1", "msp2_a_1"); 766DB8500_FUNC_GROUPS(msp2, "msp2sck_a_1", "msp2_a_1");
767DB8500_FUNC_GROUPS(mc4, "mc4_a_1", "mc4rstn_c_1"); 767DB8500_FUNC_GROUPS(mc4, "mc4_a_1", "mc4rstn_c_1");
768DB8500_FUNC_GROUPS(mc1, "mc1_a_1", "mc1dir_a_1"); 768DB8500_FUNC_GROUPS(mc1, "mc1_a_1", "mc1dir_a_1");
769DB8500_FUNC_GROUPS(hsi, "hsir1_a_1", "hsit1_a_1", "hsit_a_2"); 769DB8500_FUNC_GROUPS(hsi, "hsir_a_1", "hsit_a_1", "hsit_a_2");
770DB8500_FUNC_GROUPS(clkout, "clkout_a_1", "clkout_a_2", "clkout_c_1"); 770DB8500_FUNC_GROUPS(clkout, "clkout_a_1", "clkout_a_2", "clkout_c_1");
771DB8500_FUNC_GROUPS(usb, "usb_a_1"); 771DB8500_FUNC_GROUPS(usb, "usb_a_1");
772DB8500_FUNC_GROUPS(trig, "trig_b_1"); 772DB8500_FUNC_GROUPS(trig, "trig_b_1");
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 53b0d49a7a1c..ec6ac501b23a 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -1731,7 +1731,6 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)
1731 for (i = 0; i < npct->soc->gpio_num_ranges; i++) { 1731 for (i = 0; i < npct->soc->gpio_num_ranges; i++) {
1732 if (!nmk_gpio_chips[i]) { 1732 if (!nmk_gpio_chips[i]) {
1733 dev_warn(&pdev->dev, "GPIO chip %d not registered yet\n", i); 1733 dev_warn(&pdev->dev, "GPIO chip %d not registered yet\n", i);
1734 devm_kfree(&pdev->dev, npct);
1735 return -EPROBE_DEFER; 1734 return -EPROBE_DEFER;
1736 } 1735 }
1737 npct->soc->gpio_ranges[i].gc = &nmk_gpio_chips[i]->chip; 1736 npct->soc->gpio_ranges[i].gc = &nmk_gpio_chips[i]->chip;
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index 2aae8a8978e9..7fca6ce5952b 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -1217,7 +1217,6 @@ out_no_rsc_remap:
1217 iounmap(spmx->gpio_virtbase); 1217 iounmap(spmx->gpio_virtbase);
1218out_no_gpio_remap: 1218out_no_gpio_remap:
1219 platform_set_drvdata(pdev, NULL); 1219 platform_set_drvdata(pdev, NULL);
1220 devm_kfree(&pdev->dev, spmx);
1221 return ret; 1220 return ret;
1222} 1221}
1223 1222
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index a7ad8c112d91..309f5b9a70ec 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -1121,10 +1121,8 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
1121 upmx->dev = &pdev->dev; 1121 upmx->dev = &pdev->dev;
1122 1122
1123 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1123 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1124 if (!res) { 1124 if (!res)
1125 ret = -ENOENT; 1125 return -ENOENT;
1126 goto out_no_resource;
1127 }
1128 upmx->phybase = res->start; 1126 upmx->phybase = res->start;
1129 upmx->physize = resource_size(res); 1127 upmx->physize = resource_size(res);
1130 1128
@@ -1165,8 +1163,6 @@ out_no_remap:
1165 platform_set_drvdata(pdev, NULL); 1163 platform_set_drvdata(pdev, NULL);
1166out_no_memregion: 1164out_no_memregion:
1167 release_mem_region(upmx->phybase, upmx->physize); 1165 release_mem_region(upmx->phybase, upmx->physize);
1168out_no_resource:
1169 devm_kfree(&pdev->dev, upmx);
1170 return ret; 1166 return ret;
1171} 1167}
1172 1168
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index 2ca7dd1ab3e4..cd33add118ce 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -350,6 +350,7 @@ static void cmpc_accel_idev_init_v4(struct input_dev *inputdev)
350 inputdev->close = cmpc_accel_close_v4; 350 inputdev->close = cmpc_accel_close_v4;
351} 351}
352 352
353#ifdef CONFIG_PM_SLEEP
353static int cmpc_accel_suspend_v4(struct device *dev) 354static int cmpc_accel_suspend_v4(struct device *dev)
354{ 355{
355 struct input_dev *inputdev; 356 struct input_dev *inputdev;
@@ -384,6 +385,7 @@ static int cmpc_accel_resume_v4(struct device *dev)
384 385
385 return 0; 386 return 0;
386} 387}
388#endif
387 389
388static int cmpc_accel_add_v4(struct acpi_device *acpi) 390static int cmpc_accel_add_v4(struct acpi_device *acpi)
389{ 391{
@@ -752,6 +754,7 @@ static int cmpc_tablet_remove(struct acpi_device *acpi, int type)
752 return cmpc_remove_acpi_notify_device(acpi); 754 return cmpc_remove_acpi_notify_device(acpi);
753} 755}
754 756
757#ifdef CONFIG_PM_SLEEP
755static int cmpc_tablet_resume(struct device *dev) 758static int cmpc_tablet_resume(struct device *dev)
756{ 759{
757 struct input_dev *inputdev = dev_get_drvdata(dev); 760 struct input_dev *inputdev = dev_get_drvdata(dev);
@@ -761,6 +764,7 @@ static int cmpc_tablet_resume(struct device *dev)
761 input_report_switch(inputdev, SW_TABLET_MODE, !val); 764 input_report_switch(inputdev, SW_TABLET_MODE, !val);
762 return 0; 765 return 0;
763} 766}
767#endif
764 768
765static SIMPLE_DEV_PM_OPS(cmpc_tablet_pm, NULL, cmpc_tablet_resume); 769static SIMPLE_DEV_PM_OPS(cmpc_tablet_pm, NULL, cmpc_tablet_resume);
766 770
diff --git a/drivers/platform/x86/fujitsu-tablet.c b/drivers/platform/x86/fujitsu-tablet.c
index d2e41735a47b..7acae3f85f3b 100644
--- a/drivers/platform/x86/fujitsu-tablet.c
+++ b/drivers/platform/x86/fujitsu-tablet.c
@@ -440,11 +440,13 @@ static int __devexit acpi_fujitsu_remove(struct acpi_device *adev, int type)
440 return 0; 440 return 0;
441} 441}
442 442
443#ifdef CONFIG_PM_SLEEP
443static int acpi_fujitsu_resume(struct device *dev) 444static int acpi_fujitsu_resume(struct device *dev)
444{ 445{
445 fujitsu_reset(); 446 fujitsu_reset();
446 return 0; 447 return 0;
447} 448}
449#endif
448 450
449static SIMPLE_DEV_PM_OPS(acpi_fujitsu_pm, NULL, acpi_fujitsu_resume); 451static SIMPLE_DEV_PM_OPS(acpi_fujitsu_pm, NULL, acpi_fujitsu_resume);
450 452
diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
index d9ab6f64dcec..777c7e3dda51 100644
--- a/drivers/platform/x86/hdaps.c
+++ b/drivers/platform/x86/hdaps.c
@@ -305,10 +305,12 @@ static int hdaps_probe(struct platform_device *dev)
305 return 0; 305 return 0;
306} 306}
307 307
308#ifdef CONFIG_PM_SLEEP
308static int hdaps_resume(struct device *dev) 309static int hdaps_resume(struct device *dev)
309{ 310{
310 return hdaps_device_init(); 311 return hdaps_device_init();
311} 312}
313#endif
312 314
313static SIMPLE_DEV_PM_OPS(hdaps_pm, NULL, hdaps_resume); 315static SIMPLE_DEV_PM_OPS(hdaps_pm, NULL, hdaps_resume);
314 316
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index f4d91154ad67..6b9af989632b 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -352,7 +352,7 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
352} 352}
353 353
354 354
355#ifdef CONFIG_PM 355#ifdef CONFIG_PM_SLEEP
356static int lis3lv02d_suspend(struct device *dev) 356static int lis3lv02d_suspend(struct device *dev)
357{ 357{
358 /* make sure the device is off when we suspend */ 358 /* make sure the device is off when we suspend */
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index f64441844317..2111dbb7e1e3 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -85,7 +85,9 @@
85#define MSI_STANDARD_EC_TOUCHPAD_ADDRESS 0xe4 85#define MSI_STANDARD_EC_TOUCHPAD_ADDRESS 0xe4
86#define MSI_STANDARD_EC_TOUCHPAD_MASK (1 << 4) 86#define MSI_STANDARD_EC_TOUCHPAD_MASK (1 << 4)
87 87
88#ifdef CONFIG_PM_SLEEP
88static int msi_laptop_resume(struct device *device); 89static int msi_laptop_resume(struct device *device);
90#endif
89static SIMPLE_DEV_PM_OPS(msi_laptop_pm, NULL, msi_laptop_resume); 91static SIMPLE_DEV_PM_OPS(msi_laptop_pm, NULL, msi_laptop_resume);
90 92
91#define MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS 0x2f 93#define MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS 0x2f
@@ -753,6 +755,7 @@ err_bluetooth:
753 return retval; 755 return retval;
754} 756}
755 757
758#ifdef CONFIG_PM_SLEEP
756static int msi_laptop_resume(struct device *device) 759static int msi_laptop_resume(struct device *device)
757{ 760{
758 u8 data; 761 u8 data;
@@ -773,6 +776,7 @@ static int msi_laptop_resume(struct device *device)
773 776
774 return 0; 777 return 0;
775} 778}
779#endif
776 780
777static int __init msi_laptop_input_setup(void) 781static int __init msi_laptop_input_setup(void)
778{ 782{
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 24480074bcf0..8e8caa767d6a 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -188,7 +188,9 @@ static const struct acpi_device_id pcc_device_ids[] = {
188}; 188};
189MODULE_DEVICE_TABLE(acpi, pcc_device_ids); 189MODULE_DEVICE_TABLE(acpi, pcc_device_ids);
190 190
191#ifdef CONFIG_PM_SLEEP
191static int acpi_pcc_hotkey_resume(struct device *dev); 192static int acpi_pcc_hotkey_resume(struct device *dev);
193#endif
192static SIMPLE_DEV_PM_OPS(acpi_pcc_hotkey_pm, NULL, acpi_pcc_hotkey_resume); 194static SIMPLE_DEV_PM_OPS(acpi_pcc_hotkey_pm, NULL, acpi_pcc_hotkey_resume);
193 195
194static struct acpi_driver acpi_pcc_driver = { 196static struct acpi_driver acpi_pcc_driver = {
@@ -540,6 +542,7 @@ static void acpi_pcc_destroy_input(struct pcc_acpi *pcc)
540 542
541/* kernel module interface */ 543/* kernel module interface */
542 544
545#ifdef CONFIG_PM_SLEEP
543static int acpi_pcc_hotkey_resume(struct device *dev) 546static int acpi_pcc_hotkey_resume(struct device *dev)
544{ 547{
545 struct pcc_acpi *pcc; 548 struct pcc_acpi *pcc;
@@ -556,6 +559,7 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
556 559
557 return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode); 560 return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
558} 561}
562#endif
559 563
560static int acpi_pcc_hotkey_add(struct acpi_device *device) 564static int acpi_pcc_hotkey_add(struct acpi_device *device)
561{ 565{
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 9363969ad07a..daaddec68def 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -140,7 +140,10 @@ MODULE_PARM_DESC(kbd_backlight_timeout,
140 "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " 140 "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout "
141 "(default: 0)"); 141 "(default: 0)");
142 142
143#ifdef CONFIG_PM_SLEEP
143static void sony_nc_kbd_backlight_resume(void); 144static void sony_nc_kbd_backlight_resume(void);
145static void sony_nc_thermal_resume(void);
146#endif
144static int sony_nc_kbd_backlight_setup(struct platform_device *pd, 147static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
145 unsigned int handle); 148 unsigned int handle);
146static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd); 149static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd);
@@ -151,7 +154,6 @@ static void sony_nc_battery_care_cleanup(struct platform_device *pd);
151 154
152static int sony_nc_thermal_setup(struct platform_device *pd); 155static int sony_nc_thermal_setup(struct platform_device *pd);
153static void sony_nc_thermal_cleanup(struct platform_device *pd); 156static void sony_nc_thermal_cleanup(struct platform_device *pd);
154static void sony_nc_thermal_resume(void);
155 157
156static int sony_nc_lid_resume_setup(struct platform_device *pd); 158static int sony_nc_lid_resume_setup(struct platform_device *pd);
157static void sony_nc_lid_resume_cleanup(struct platform_device *pd); 159static void sony_nc_lid_resume_cleanup(struct platform_device *pd);
@@ -1431,6 +1433,7 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
1431 sony_nc_handles_cleanup(pd); 1433 sony_nc_handles_cleanup(pd);
1432} 1434}
1433 1435
1436#ifdef CONFIG_PM_SLEEP
1434static void sony_nc_function_resume(void) 1437static void sony_nc_function_resume(void)
1435{ 1438{
1436 unsigned int i, result, bitmask, arg; 1439 unsigned int i, result, bitmask, arg;
@@ -1508,6 +1511,7 @@ static int sony_nc_resume(struct device *dev)
1508 1511
1509 return 0; 1512 return 0;
1510} 1513}
1514#endif
1511 1515
1512static SIMPLE_DEV_PM_OPS(sony_nc_pm, NULL, sony_nc_resume); 1516static SIMPLE_DEV_PM_OPS(sony_nc_pm, NULL, sony_nc_resume);
1513 1517
@@ -1872,6 +1876,7 @@ static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd)
1872 } 1876 }
1873} 1877}
1874 1878
1879#ifdef CONFIG_PM_SLEEP
1875static void sony_nc_kbd_backlight_resume(void) 1880static void sony_nc_kbd_backlight_resume(void)
1876{ 1881{
1877 int ignore = 0; 1882 int ignore = 0;
@@ -1888,6 +1893,7 @@ static void sony_nc_kbd_backlight_resume(void)
1888 (kbdbl_ctl->base + 0x200) | 1893 (kbdbl_ctl->base + 0x200) |
1889 (kbdbl_ctl->timeout << 0x10), &ignore); 1894 (kbdbl_ctl->timeout << 0x10), &ignore);
1890} 1895}
1896#endif
1891 1897
1892struct battery_care_control { 1898struct battery_care_control {
1893 struct device_attribute attrs[2]; 1899 struct device_attribute attrs[2];
@@ -2210,6 +2216,7 @@ static void sony_nc_thermal_cleanup(struct platform_device *pd)
2210 } 2216 }
2211} 2217}
2212 2218
2219#ifdef CONFIG_PM_SLEEP
2213static void sony_nc_thermal_resume(void) 2220static void sony_nc_thermal_resume(void)
2214{ 2221{
2215 unsigned int status = sony_nc_thermal_mode_get(); 2222 unsigned int status = sony_nc_thermal_mode_get();
@@ -2217,6 +2224,7 @@ static void sony_nc_thermal_resume(void)
2217 if (status != th_handle->mode) 2224 if (status != th_handle->mode)
2218 sony_nc_thermal_mode_set(th_handle->mode); 2225 sony_nc_thermal_mode_set(th_handle->mode);
2219} 2226}
2227#endif
2220 2228
2221/* resume on LID open */ 2229/* resume on LID open */
2222struct snc_lid_resume_control { 2230struct snc_lid_resume_control {
@@ -4287,6 +4295,7 @@ err_free_resources:
4287 return result; 4295 return result;
4288} 4296}
4289 4297
4298#ifdef CONFIG_PM_SLEEP
4290static int sony_pic_suspend(struct device *dev) 4299static int sony_pic_suspend(struct device *dev)
4291{ 4300{
4292 if (sony_pic_disable(to_acpi_device(dev))) 4301 if (sony_pic_disable(to_acpi_device(dev)))
@@ -4300,6 +4309,7 @@ static int sony_pic_resume(struct device *dev)
4300 spic_dev.cur_ioport, spic_dev.cur_irq); 4309 spic_dev.cur_ioport, spic_dev.cur_irq);
4301 return 0; 4310 return 0;
4302} 4311}
4312#endif
4303 4313
4304static SIMPLE_DEV_PM_OPS(sony_pic_pm, sony_pic_suspend, sony_pic_resume); 4314static SIMPLE_DEV_PM_OPS(sony_pic_pm, sony_pic_suspend, sony_pic_resume);
4305 4315
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index e7f73287636c..f28f36ccdcf4 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -922,6 +922,7 @@ static struct input_dev *tpacpi_inputdev;
922static struct mutex tpacpi_inputdev_send_mutex; 922static struct mutex tpacpi_inputdev_send_mutex;
923static LIST_HEAD(tpacpi_all_drivers); 923static LIST_HEAD(tpacpi_all_drivers);
924 924
925#ifdef CONFIG_PM_SLEEP
925static int tpacpi_suspend_handler(struct device *dev) 926static int tpacpi_suspend_handler(struct device *dev)
926{ 927{
927 struct ibm_struct *ibm, *itmp; 928 struct ibm_struct *ibm, *itmp;
@@ -949,6 +950,7 @@ static int tpacpi_resume_handler(struct device *dev)
949 950
950 return 0; 951 return 0;
951} 952}
953#endif
952 954
953static SIMPLE_DEV_PM_OPS(tpacpi_pm, 955static SIMPLE_DEV_PM_OPS(tpacpi_pm,
954 tpacpi_suspend_handler, tpacpi_resume_handler); 956 tpacpi_suspend_handler, tpacpi_resume_handler);
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index c13ba5bac93f..5f1256d5e933 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1296,6 +1296,7 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
1296 } 1296 }
1297} 1297}
1298 1298
1299#ifdef CONFIG_PM_SLEEP
1299static int toshiba_acpi_suspend(struct device *device) 1300static int toshiba_acpi_suspend(struct device *device)
1300{ 1301{
1301 struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); 1302 struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device));
@@ -1317,6 +1318,7 @@ static int toshiba_acpi_resume(struct device *device)
1317 1318
1318 return 0; 1319 return 0;
1319} 1320}
1321#endif
1320 1322
1321static SIMPLE_DEV_PM_OPS(toshiba_acpi_pm, 1323static SIMPLE_DEV_PM_OPS(toshiba_acpi_pm,
1322 toshiba_acpi_suspend, toshiba_acpi_resume); 1324 toshiba_acpi_suspend, toshiba_acpi_resume);
diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c
index 715a43cb5e3c..5e5d6317d690 100644
--- a/drivers/platform/x86/toshiba_bluetooth.c
+++ b/drivers/platform/x86/toshiba_bluetooth.c
@@ -41,7 +41,9 @@ static const struct acpi_device_id bt_device_ids[] = {
41}; 41};
42MODULE_DEVICE_TABLE(acpi, bt_device_ids); 42MODULE_DEVICE_TABLE(acpi, bt_device_ids);
43 43
44#ifdef CONFIG_PM_SLEEP
44static int toshiba_bt_resume(struct device *dev); 45static int toshiba_bt_resume(struct device *dev);
46#endif
45static SIMPLE_DEV_PM_OPS(toshiba_bt_pm, NULL, toshiba_bt_resume); 47static SIMPLE_DEV_PM_OPS(toshiba_bt_pm, NULL, toshiba_bt_resume);
46 48
47static struct acpi_driver toshiba_bt_rfkill_driver = { 49static struct acpi_driver toshiba_bt_rfkill_driver = {
@@ -90,10 +92,12 @@ static void toshiba_bt_rfkill_notify(struct acpi_device *device, u32 event)
90 toshiba_bluetooth_enable(device->handle); 92 toshiba_bluetooth_enable(device->handle);
91} 93}
92 94
95#ifdef CONFIG_PM_SLEEP
93static int toshiba_bt_resume(struct device *dev) 96static int toshiba_bt_resume(struct device *dev)
94{ 97{
95 return toshiba_bluetooth_enable(to_acpi_device(dev)->handle); 98 return toshiba_bluetooth_enable(to_acpi_device(dev)->handle);
96} 99}
100#endif
97 101
98static int toshiba_bt_rfkill_add(struct acpi_device *device) 102static int toshiba_bt_rfkill_add(struct acpi_device *device)
99{ 103{
diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
index 849c07c13bf6..38ba39d7ca7d 100644
--- a/drivers/platform/x86/xo15-ebook.c
+++ b/drivers/platform/x86/xo15-ebook.c
@@ -77,10 +77,12 @@ static void ebook_switch_notify(struct acpi_device *device, u32 event)
77 } 77 }
78} 78}
79 79
80#ifdef CONFIG_PM_SLEEP
80static int ebook_switch_resume(struct device *dev) 81static int ebook_switch_resume(struct device *dev)
81{ 82{
82 return ebook_send_state(to_acpi_device(dev)); 83 return ebook_send_state(to_acpi_device(dev));
83} 84}
85#endif
84 86
85static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume); 87static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume);
86 88
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index eb415bd76494..9592b936b71b 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -582,6 +582,7 @@ enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer)
582void rtc_update_irq(struct rtc_device *rtc, 582void rtc_update_irq(struct rtc_device *rtc,
583 unsigned long num, unsigned long events) 583 unsigned long num, unsigned long events)
584{ 584{
585 pm_stay_awake(rtc->dev.parent);
585 schedule_work(&rtc->irqwork); 586 schedule_work(&rtc->irqwork);
586} 587}
587EXPORT_SYMBOL_GPL(rtc_update_irq); 588EXPORT_SYMBOL_GPL(rtc_update_irq);
@@ -844,6 +845,7 @@ void rtc_timer_do_work(struct work_struct *work)
844 845
845 mutex_lock(&rtc->ops_lock); 846 mutex_lock(&rtc->ops_lock);
846again: 847again:
848 pm_relax(rtc->dev.parent);
847 __rtc_read_time(rtc, &tm); 849 __rtc_read_time(rtc, &tm);
848 now = rtc_tm_to_ktime(tm); 850 now = rtc_tm_to_ktime(tm);
849 while ((next = timerqueue_getnext(&rtc->timerqueue))) { 851 while ((next = timerqueue_getnext(&rtc->timerqueue))) {
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 132333d75408..4267789ca995 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -568,7 +568,6 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
568 hpet_mask_rtc_irq_bit(RTC_AIE); 568 hpet_mask_rtc_irq_bit(RTC_AIE);
569 569
570 CMOS_READ(RTC_INTR_FLAGS); 570 CMOS_READ(RTC_INTR_FLAGS);
571 pm_wakeup_event(cmos_rtc.dev, 0);
572 } 571 }
573 spin_unlock(&rtc_lock); 572 spin_unlock(&rtc_lock);
574 573
diff --git a/drivers/s390/char/sclp_sdias.c b/drivers/s390/char/sclp_sdias.c
index 6a6f76bf6e3d..b1032931a1c4 100644
--- a/drivers/s390/char/sclp_sdias.c
+++ b/drivers/s390/char/sclp_sdias.c
@@ -242,11 +242,13 @@ int sclp_sdias_copy(void *dest, int start_blk, int nr_blks)
242 switch (sdias_evbuf.event_status) { 242 switch (sdias_evbuf.event_status) {
243 case EVSTATE_ALL_STORED: 243 case EVSTATE_ALL_STORED:
244 TRACE("all stored\n"); 244 TRACE("all stored\n");
245 break;
245 case EVSTATE_PART_STORED: 246 case EVSTATE_PART_STORED:
246 TRACE("part stored: %i\n", sdias_evbuf.blk_cnt); 247 TRACE("part stored: %i\n", sdias_evbuf.blk_cnt);
247 break; 248 break;
248 case EVSTATE_NO_DATA: 249 case EVSTATE_NO_DATA:
249 TRACE("no data\n"); 250 TRACE("no data\n");
251 /* fall through */
250 default: 252 default:
251 pr_err("Error from SCLP while copying hsa. " 253 pr_err("Error from SCLP while copying hsa. "
252 "Event status = %x\n", 254 "Event status = %x\n",
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 2374468615ed..32c26d795ed0 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -324,8 +324,16 @@ int __init register_intc_controller(struct intc_desc *desc)
324 324
325 res = irq_create_identity_mapping(d->domain, irq); 325 res = irq_create_identity_mapping(d->domain, irq);
326 if (unlikely(res)) { 326 if (unlikely(res)) {
327 pr_err("can't get irq_desc for %d\n", irq); 327 if (res == -EEXIST) {
328 continue; 328 res = irq_domain_associate(d->domain, irq, irq);
329 if (unlikely(res)) {
330 pr_err("domain association failure\n");
331 continue;
332 }
333 } else {
334 pr_err("can't identity map IRQ %d\n", irq);
335 continue;
336 }
329 } 337 }
330 338
331 intc_irq_xlate_set(irq, vect->enum_id, d); 339 intc_irq_xlate_set(irq, vect->enum_id, d);
@@ -345,8 +353,19 @@ int __init register_intc_controller(struct intc_desc *desc)
345 */ 353 */
346 res = irq_create_identity_mapping(d->domain, irq2); 354 res = irq_create_identity_mapping(d->domain, irq2);
347 if (unlikely(res)) { 355 if (unlikely(res)) {
348 pr_err("can't get irq_desc for %d\n", irq2); 356 if (res == -EEXIST) {
349 continue; 357 res = irq_domain_associate(d->domain,
358 irq, irq);
359 if (unlikely(res)) {
360 pr_err("domain association "
361 "failure\n");
362 continue;
363 }
364 } else {
365 pr_err("can't identity map IRQ %d\n",
366 irq);
367 continue;
368 }
350 } 369 }
351 370
352 vect2->enum_id = 0; 371 vect2->enum_id = 0;
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 646a7657fe62..cfa2c35dfeed 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -826,7 +826,7 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
826 struct spi_device *spi) 826 struct spi_device *spi)
827{ 827{
828 struct s3c64xx_spi_csinfo *cs; 828 struct s3c64xx_spi_csinfo *cs;
829 struct device_node *slave_np, *data_np; 829 struct device_node *slave_np, *data_np = NULL;
830 u32 fb_delay = 0; 830 u32 fb_delay = 0;
831 831
832 slave_np = spi->dev.of_node; 832 slave_np = spi->dev.of_node;
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index c0fdb00783ed..2359151af7e1 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -168,7 +168,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
168 dev->board_ptr = comedi_recognize(driv, it->board_name); 168 dev->board_ptr = comedi_recognize(driv, it->board_name);
169 if (dev->board_ptr) 169 if (dev->board_ptr)
170 break; 170 break;
171 } else if (strcmp(driv->driver_name, it->board_name)) 171 } else if (strcmp(driv->driver_name, it->board_name) == 0)
172 break; 172 break;
173 module_put(driv->module); 173 module_put(driv->module);
174 } 174 }
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 31986608eaf1..6b4d0d68e637 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -1349,9 +1349,6 @@ static struct pci_dev *pci1710_find_pci_dev(struct comedi_device *dev,
1349 } 1349 }
1350 if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH) 1350 if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH)
1351 continue; 1351 continue;
1352 if (pci_is_enabled(pcidev))
1353 continue;
1354
1355 if (strcmp(this_board->name, DRV_NAME) == 0) { 1352 if (strcmp(this_board->name, DRV_NAME) == 0) {
1356 for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { 1353 for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) {
1357 if (pcidev->device == boardtypes[i].device_id) { 1354 if (pcidev->device == boardtypes[i].device_id) {
diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c
index da5ee69d2c9d..dfde0f6328dd 100644
--- a/drivers/staging/comedi/drivers/adv_pci1723.c
+++ b/drivers/staging/comedi/drivers/adv_pci1723.c
@@ -301,8 +301,6 @@ static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev,
301 } 301 }
302 if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH) 302 if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH)
303 continue; 303 continue;
304 if (pci_is_enabled(pcidev))
305 continue;
306 return pcidev; 304 return pcidev;
307 } 305 }
308 dev_err(dev->class_dev, 306 dev_err(dev->class_dev,
diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c
index 97f06dc8e48d..2d4cb7f638b2 100644
--- a/drivers/staging/comedi/drivers/adv_pci_dio.c
+++ b/drivers/staging/comedi/drivers/adv_pci_dio.c
@@ -1064,8 +1064,6 @@ static struct pci_dev *pci_dio_find_pci_dev(struct comedi_device *dev,
1064 slot != PCI_SLOT(pcidev->devfn)) 1064 slot != PCI_SLOT(pcidev->devfn))
1065 continue; 1065 continue;
1066 } 1066 }
1067 if (pci_is_enabled(pcidev))
1068 continue;
1069 for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) { 1067 for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) {
1070 if (boardtypes[i].vendor_id != pcidev->vendor) 1068 if (boardtypes[i].vendor_id != pcidev->vendor)
1071 continue; 1069 continue;
diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c
index ef28385c1482..cad559a1a730 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -718,7 +718,8 @@ static struct pci_dev *daqboard2000_find_pci_dev(struct comedi_device *dev,
718 continue; 718 continue;
719 } 719 }
720 if (pcidev->vendor != PCI_VENDOR_ID_IOTECH || 720 if (pcidev->vendor != PCI_VENDOR_ID_IOTECH ||
721 pcidev->device != 0x0409) 721 pcidev->device != 0x0409 ||
722 pcidev->subsystem_device != PCI_VENDOR_ID_IOTECH)
722 continue; 723 continue;
723 724
724 for (i = 0; i < ARRAY_SIZE(boardtypes); i++) { 725 for (i = 0; i < ARRAY_SIZE(boardtypes); i++) {
@@ -739,6 +740,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
739{ 740{
740 struct pci_dev *pcidev; 741 struct pci_dev *pcidev;
741 struct comedi_subdevice *s; 742 struct comedi_subdevice *s;
743 resource_size_t pci_base;
742 void *aux_data; 744 void *aux_data;
743 unsigned int aux_len; 745 unsigned int aux_len;
744 int result; 746 int result;
@@ -758,11 +760,12 @@ static int daqboard2000_attach(struct comedi_device *dev,
758 "failed to enable PCI device and request regions\n"); 760 "failed to enable PCI device and request regions\n");
759 return -EIO; 761 return -EIO;
760 } 762 }
761 dev->iobase = pci_resource_start(pcidev, 2); 763 dev->iobase = 1; /* the "detach" needs this */
762 764
763 devpriv->plx = 765 pci_base = pci_resource_start(pcidev, 0);
764 ioremap(pci_resource_start(pcidev, 0), DAQBOARD2000_PLX_SIZE); 766 devpriv->plx = ioremap(pci_base, DAQBOARD2000_PLX_SIZE);
765 devpriv->daq = ioremap(dev->iobase, DAQBOARD2000_DAQ_SIZE); 767 pci_base = pci_resource_start(pcidev, 2);
768 devpriv->daq = ioremap(pci_base, DAQBOARD2000_DAQ_SIZE);
766 if (!devpriv->plx || !devpriv->daq) 769 if (!devpriv->plx || !devpriv->daq)
767 return -ENOMEM; 770 return -ENOMEM;
768 771
@@ -799,8 +802,6 @@ static int daqboard2000_attach(struct comedi_device *dev,
799 printk("Interrupt after is: %x\n", interrupt); 802 printk("Interrupt after is: %x\n", interrupt);
800 */ 803 */
801 804
802 dev->iobase = (unsigned long)devpriv->daq;
803
804 dev->board_name = this_board->name; 805 dev->board_name = this_board->name;
805 806
806 s = dev->subdevices + 0; 807 s = dev->subdevices + 0;
@@ -824,7 +825,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
824 825
825 s = dev->subdevices + 2; 826 s = dev->subdevices + 2;
826 result = subdev_8255_init(dev, s, daqboard2000_8255_cb, 827 result = subdev_8255_init(dev, s, daqboard2000_8255_cb,
827 (unsigned long)(dev->iobase + 0x40)); 828 (unsigned long)(devpriv->daq + 0x40));
828 829
829out: 830out:
830 return result; 831 return result;
diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c
index a6fe6c9be87e..3476cda0fff0 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -804,6 +804,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
804{ 804{
805 struct pci_dev *pcidev; 805 struct pci_dev *pcidev;
806 struct comedi_subdevice *s; 806 struct comedi_subdevice *s;
807 resource_size_t pci_base;
807 int ret = 0; 808 int ret = 0;
808 809
809 dev_dbg(dev->class_dev, "dt3000:\n"); 810 dev_dbg(dev->class_dev, "dt3000:\n");
@@ -820,9 +821,10 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
820 ret = comedi_pci_enable(pcidev, "dt3000"); 821 ret = comedi_pci_enable(pcidev, "dt3000");
821 if (ret < 0) 822 if (ret < 0)
822 return ret; 823 return ret;
824 dev->iobase = 1; /* the "detach" needs this */
823 825
824 dev->iobase = pci_resource_start(pcidev, 0); 826 pci_base = pci_resource_start(pcidev, 0);
825 devpriv->io_addr = ioremap(dev->iobase, DT3000_SIZE); 827 devpriv->io_addr = ioremap(pci_base, DT3000_SIZE);
826 if (!devpriv->io_addr) 828 if (!devpriv->io_addr)
827 return -ENOMEM; 829 return -ENOMEM;
828 830
diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
index 112fdc3e9c69..5aa8be1e7b92 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -1619,9 +1619,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1619 struct rtdPrivate *devpriv; 1619 struct rtdPrivate *devpriv;
1620 struct pci_dev *pcidev; 1620 struct pci_dev *pcidev;
1621 struct comedi_subdevice *s; 1621 struct comedi_subdevice *s;
1622 resource_size_t pci_base;
1622 int ret; 1623 int ret;
1623 resource_size_t physLas1; /* data area */
1624 resource_size_t physLcfg; /* PLX9080 */
1625#ifdef USE_DMA 1624#ifdef USE_DMA
1626 int index; 1625 int index;
1627#endif 1626#endif
@@ -1655,20 +1654,15 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1655 printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); 1654 printk(KERN_INFO "Failed to enable PCI device and request regions.\n");
1656 return ret; 1655 return ret;
1657 } 1656 }
1658 1657 dev->iobase = 1; /* the "detach" needs this */
1659 /* 1658
1660 * Initialize base addresses 1659 /* Initialize the base addresses */
1661 */ 1660 pci_base = pci_resource_start(pcidev, LAS0_PCIINDEX);
1662 /* Get the physical address from PCI config */ 1661 devpriv->las0 = ioremap_nocache(pci_base, LAS0_PCISIZE);
1663 dev->iobase = pci_resource_start(pcidev, LAS0_PCIINDEX); 1662 pci_base = pci_resource_start(pcidev, LAS1_PCIINDEX);
1664 physLas1 = pci_resource_start(pcidev, LAS1_PCIINDEX); 1663 devpriv->las1 = ioremap_nocache(pci_base, LAS1_PCISIZE);
1665 physLcfg = pci_resource_start(pcidev, LCFG_PCIINDEX); 1664 pci_base = pci_resource_start(pcidev, LCFG_PCIINDEX);
1666 /* Now have the kernel map this into memory */ 1665 devpriv->lcfg = ioremap_nocache(pci_base, LCFG_PCISIZE);
1667 /* ASSUME page aligned */
1668 devpriv->las0 = ioremap_nocache(dev->iobase, LAS0_PCISIZE);
1669 devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE);
1670 devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE);
1671
1672 if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) 1666 if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg)
1673 return -ENOMEM; 1667 return -ENOMEM;
1674 1668
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 848c7ec06976..11ee83681da7 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -102,6 +102,7 @@ sampling rate. If you sample two channels you get 4kHz and so on.
102#define BULK_TIMEOUT 1000 102#define BULK_TIMEOUT 1000
103 103
104/* constants for "firmware" upload and download */ 104/* constants for "firmware" upload and download */
105#define FIRMWARE "usbdux_firmware.bin"
105#define USBDUXSUB_FIRMWARE 0xA0 106#define USBDUXSUB_FIRMWARE 0xA0
106#define VENDOR_DIR_IN 0xC0 107#define VENDOR_DIR_IN 0xC0
107#define VENDOR_DIR_OUT 0x40 108#define VENDOR_DIR_OUT 0x40
@@ -2791,7 +2792,7 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
2791 2792
2792 ret = request_firmware_nowait(THIS_MODULE, 2793 ret = request_firmware_nowait(THIS_MODULE,
2793 FW_ACTION_HOTPLUG, 2794 FW_ACTION_HOTPLUG,
2794 "usbdux_firmware.bin", 2795 FIRMWARE,
2795 &udev->dev, 2796 &udev->dev,
2796 GFP_KERNEL, 2797 GFP_KERNEL,
2797 usbduxsub + index, 2798 usbduxsub + index,
@@ -2850,3 +2851,4 @@ module_comedi_usb_driver(usbdux_driver, usbdux_usb_driver);
2850MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); 2851MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com");
2851MODULE_DESCRIPTION("Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"); 2852MODULE_DESCRIPTION("Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com");
2852MODULE_LICENSE("GPL"); 2853MODULE_LICENSE("GPL");
2854MODULE_FIRMWARE(FIRMWARE);
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index d9911588c10a..8eb41257c6ce 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -57,6 +57,7 @@
57/* 57/*
58 * constants for "firmware" upload and download 58 * constants for "firmware" upload and download
59 */ 59 */
60#define FIRMWARE "usbduxfast_firmware.bin"
60#define USBDUXFASTSUB_FIRMWARE 0xA0 61#define USBDUXFASTSUB_FIRMWARE 0xA0
61#define VENDOR_DIR_IN 0xC0 62#define VENDOR_DIR_IN 0xC0
62#define VENDOR_DIR_OUT 0x40 63#define VENDOR_DIR_OUT 0x40
@@ -1706,7 +1707,7 @@ static int usbduxfast_usb_probe(struct usb_interface *uinterf,
1706 1707
1707 ret = request_firmware_nowait(THIS_MODULE, 1708 ret = request_firmware_nowait(THIS_MODULE,
1708 FW_ACTION_HOTPLUG, 1709 FW_ACTION_HOTPLUG,
1709 "usbduxfast_firmware.bin", 1710 FIRMWARE,
1710 &udev->dev, 1711 &udev->dev,
1711 GFP_KERNEL, 1712 GFP_KERNEL,
1712 usbduxfastsub + index, 1713 usbduxfastsub + index,
@@ -1774,3 +1775,4 @@ module_comedi_usb_driver(usbduxfast_driver, usbduxfast_usb_driver);
1774MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); 1775MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com");
1775MODULE_DESCRIPTION("USB-DUXfast, BerndPorr@f2s.com"); 1776MODULE_DESCRIPTION("USB-DUXfast, BerndPorr@f2s.com");
1776MODULE_LICENSE("GPL"); 1777MODULE_LICENSE("GPL");
1778MODULE_FIRMWARE(FIRMWARE);
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index 543e604791e2..f54ab8c2fcfd 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -63,6 +63,7 @@ Status: testing
63#define BULK_TIMEOUT 1000 63#define BULK_TIMEOUT 1000
64 64
65/* constants for "firmware" upload and download */ 65/* constants for "firmware" upload and download */
66#define FIRMWARE "usbduxsigma_firmware.bin"
66#define USBDUXSUB_FIRMWARE 0xA0 67#define USBDUXSUB_FIRMWARE 0xA0
67#define VENDOR_DIR_IN 0xC0 68#define VENDOR_DIR_IN 0xC0
68#define VENDOR_DIR_OUT 0x40 69#define VENDOR_DIR_OUT 0x40
@@ -2780,7 +2781,7 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
2780 2781
2781 ret = request_firmware_nowait(THIS_MODULE, 2782 ret = request_firmware_nowait(THIS_MODULE,
2782 FW_ACTION_HOTPLUG, 2783 FW_ACTION_HOTPLUG,
2783 "usbduxsigma_firmware.bin", 2784 FIRMWARE,
2784 &udev->dev, 2785 &udev->dev,
2785 GFP_KERNEL, 2786 GFP_KERNEL,
2786 usbduxsub + index, 2787 usbduxsub + index,
@@ -2845,3 +2846,4 @@ module_comedi_usb_driver(usbduxsigma_driver, usbduxsigma_usb_driver);
2845MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com"); 2846MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com");
2846MODULE_DESCRIPTION("Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com"); 2847MODULE_DESCRIPTION("Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com");
2847MODULE_LICENSE("GPL"); 2848MODULE_LICENSE("GPL");
2849MODULE_FIRMWARE(FIRMWARE);
diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig
index cee8d48d2af9..ad2a1096e920 100644
--- a/drivers/staging/csr/Kconfig
+++ b/drivers/staging/csr/Kconfig
@@ -1,6 +1,6 @@
1config CSR_WIFI 1config CSR_WIFI
2 tristate "CSR wireless driver" 2 tristate "CSR wireless driver"
3 depends on MMC && CFG80211_WEXT 3 depends on MMC && CFG80211_WEXT && INET
4 select WIRELESS_EXT 4 select WIRELESS_EXT
5 select WEXT_PRIV 5 select WEXT_PRIV
6 help 6 help
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 22c3923d55eb..095837285f4f 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -754,7 +754,7 @@ static ssize_t ad7192_set(struct device *dev,
754 else 754 else
755 st->mode &= ~AD7192_MODE_ACX; 755 st->mode &= ~AD7192_MODE_ACX;
756 756
757 ad7192_write_reg(st, AD7192_REG_GPOCON, 3, st->mode); 757 ad7192_write_reg(st, AD7192_REG_MODE, 3, st->mode);
758 break; 758 break;
759 default: 759 default:
760 ret = -EINVAL; 760 ret = -EINVAL;
@@ -798,6 +798,11 @@ static const struct attribute_group ad7195_attribute_group = {
798 .attrs = ad7195_attributes, 798 .attrs = ad7195_attributes,
799}; 799};
800 800
801static unsigned int ad7192_get_temp_scale(bool unipolar)
802{
803 return unipolar ? 2815 * 2 : 2815;
804}
805
801static int ad7192_read_raw(struct iio_dev *indio_dev, 806static int ad7192_read_raw(struct iio_dev *indio_dev,
802 struct iio_chan_spec const *chan, 807 struct iio_chan_spec const *chan,
803 int *val, 808 int *val,
@@ -824,19 +829,6 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
824 *val = (smpl >> chan->scan_type.shift) & 829 *val = (smpl >> chan->scan_type.shift) &
825 ((1 << (chan->scan_type.realbits)) - 1); 830 ((1 << (chan->scan_type.realbits)) - 1);
826 831
827 switch (chan->type) {
828 case IIO_VOLTAGE:
829 if (!unipolar)
830 *val -= (1 << (chan->scan_type.realbits - 1));
831 break;
832 case IIO_TEMP:
833 *val -= 0x800000;
834 *val /= 2815; /* temp Kelvin */
835 *val -= 273; /* temp Celsius */
836 break;
837 default:
838 return -EINVAL;
839 }
840 return IIO_VAL_INT; 832 return IIO_VAL_INT;
841 833
842 case IIO_CHAN_INFO_SCALE: 834 case IIO_CHAN_INFO_SCALE:
@@ -848,11 +840,21 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
848 mutex_unlock(&indio_dev->mlock); 840 mutex_unlock(&indio_dev->mlock);
849 return IIO_VAL_INT_PLUS_NANO; 841 return IIO_VAL_INT_PLUS_NANO;
850 case IIO_TEMP: 842 case IIO_TEMP:
851 *val = 1000; 843 *val = 0;
852 return IIO_VAL_INT; 844 *val2 = 1000000000 / ad7192_get_temp_scale(unipolar);
845 return IIO_VAL_INT_PLUS_NANO;
853 default: 846 default:
854 return -EINVAL; 847 return -EINVAL;
855 } 848 }
849 case IIO_CHAN_INFO_OFFSET:
850 if (!unipolar)
851 *val = -(1 << (chan->scan_type.realbits - 1));
852 else
853 *val = 0;
854 /* Kelvin to Celsius */
855 if (chan->type == IIO_TEMP)
856 *val -= 273 * ad7192_get_temp_scale(unipolar);
857 return IIO_VAL_INT;
856 } 858 }
857 859
858 return -EINVAL; 860 return -EINVAL;
@@ -890,7 +892,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
890 } 892 }
891 ret = 0; 893 ret = 0;
892 } 894 }
893 895 break;
894 default: 896 default:
895 ret = -EINVAL; 897 ret = -EINVAL;
896 } 898 }
@@ -942,20 +944,22 @@ static const struct iio_info ad7195_info = {
942 .channel = _chan, \ 944 .channel = _chan, \
943 .channel2 = _chan2, \ 945 .channel2 = _chan2, \
944 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 946 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
945 IIO_CHAN_INFO_SCALE_SHARED_BIT, \ 947 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
948 IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
946 .address = _address, \ 949 .address = _address, \
947 .scan_index = _si, \ 950 .scan_index = _si, \
948 .scan_type = IIO_ST('s', 24, 32, 0)} 951 .scan_type = IIO_ST('u', 24, 32, 0)}
949 952
950#define AD7192_CHAN(_chan, _address, _si) \ 953#define AD7192_CHAN(_chan, _address, _si) \
951 { .type = IIO_VOLTAGE, \ 954 { .type = IIO_VOLTAGE, \
952 .indexed = 1, \ 955 .indexed = 1, \
953 .channel = _chan, \ 956 .channel = _chan, \
954 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 957 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
955 IIO_CHAN_INFO_SCALE_SHARED_BIT, \ 958 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
959 IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
956 .address = _address, \ 960 .address = _address, \
957 .scan_index = _si, \ 961 .scan_index = _si, \
958 .scan_type = IIO_ST('s', 24, 32, 0)} 962 .scan_type = IIO_ST('u', 24, 32, 0)}
959 963
960#define AD7192_CHAN_TEMP(_chan, _address, _si) \ 964#define AD7192_CHAN_TEMP(_chan, _address, _si) \
961 { .type = IIO_TEMP, \ 965 { .type = IIO_TEMP, \
@@ -965,7 +969,7 @@ static const struct iio_info ad7195_info = {
965 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ 969 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
966 .address = _address, \ 970 .address = _address, \
967 .scan_index = _si, \ 971 .scan_index = _si, \
968 .scan_type = IIO_ST('s', 24, 32, 0)} 972 .scan_type = IIO_ST('u', 24, 32, 0)}
969 973
970static struct iio_chan_spec ad7192_channels[] = { 974static struct iio_chan_spec ad7192_channels[] = {
971 AD7192_CHAN_DIFF(1, 2, NULL, AD7192_CH_AIN1P_AIN2M, 0), 975 AD7192_CHAN_DIFF(1, 2, NULL, AD7192_CH_AIN1P_AIN2M, 0),
diff --git a/drivers/staging/iio/adc/ad7298_ring.c b/drivers/staging/iio/adc/ad7298_ring.c
index fd1d855ff57a..506016f01593 100644
--- a/drivers/staging/iio/adc/ad7298_ring.c
+++ b/drivers/staging/iio/adc/ad7298_ring.c
@@ -76,7 +76,7 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p)
76 struct iio_dev *indio_dev = pf->indio_dev; 76 struct iio_dev *indio_dev = pf->indio_dev;
77 struct ad7298_state *st = iio_priv(indio_dev); 77 struct ad7298_state *st = iio_priv(indio_dev);
78 struct iio_buffer *ring = indio_dev->buffer; 78 struct iio_buffer *ring = indio_dev->buffer;
79 s64 time_ns; 79 s64 time_ns = 0;
80 __u16 buf[16]; 80 __u16 buf[16];
81 int b_sent, i; 81 int b_sent, i;
82 82
diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index 1ece2ac8de56..19ee49c95de4 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -131,9 +131,10 @@ static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
131 .indexed = 1, 131 .indexed = 1,
132 .channel = 0, 132 .channel = 0,
133 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 133 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
134 IIO_CHAN_INFO_SCALE_SHARED_BIT, 134 IIO_CHAN_INFO_SCALE_SHARED_BIT |
135 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
135 .scan_type = { 136 .scan_type = {
136 .sign = 's', 137 .sign = 'u',
137 .realbits = 24, 138 .realbits = 24,
138 .storagebits = 32, 139 .storagebits = 32,
139 .shift = 8, 140 .shift = 8,
@@ -146,9 +147,10 @@ static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
146 .indexed = 1, 147 .indexed = 1,
147 .channel = 0, 148 .channel = 0,
148 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 149 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
149 IIO_CHAN_INFO_SCALE_SHARED_BIT, 150 IIO_CHAN_INFO_SCALE_SHARED_BIT |
151 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
150 .scan_type = { 152 .scan_type = {
151 .sign = 's', 153 .sign = 'u',
152 .realbits = 20, 154 .realbits = 20,
153 .storagebits = 32, 155 .storagebits = 32,
154 .shift = 12, 156 .shift = 12,
diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c
index 76fdd7145fc5..112e2b7b5bc4 100644
--- a/drivers/staging/iio/adc/ad7793.c
+++ b/drivers/staging/iio/adc/ad7793.c
@@ -563,8 +563,9 @@ static ssize_t ad7793_show_scale_available(struct device *dev,
563 return len; 563 return len;
564} 564}
565 565
566static IIO_DEVICE_ATTR_NAMED(in_m_in_scale_available, in-in_scale_available, 566static IIO_DEVICE_ATTR_NAMED(in_m_in_scale_available,
567 S_IRUGO, ad7793_show_scale_available, NULL, 0); 567 in_voltage-voltage_scale_available, S_IRUGO,
568 ad7793_show_scale_available, NULL, 0);
568 569
569static struct attribute *ad7793_attributes[] = { 570static struct attribute *ad7793_attributes[] = {
570 &iio_dev_attr_sampling_frequency.dev_attr.attr, 571 &iio_dev_attr_sampling_frequency.dev_attr.attr,
@@ -604,9 +605,6 @@ static int ad7793_read_raw(struct iio_dev *indio_dev,
604 *val = (smpl >> chan->scan_type.shift) & 605 *val = (smpl >> chan->scan_type.shift) &
605 ((1 << (chan->scan_type.realbits)) - 1); 606 ((1 << (chan->scan_type.realbits)) - 1);
606 607
607 if (!unipolar)
608 *val -= (1 << (chan->scan_type.realbits - 1));
609
610 return IIO_VAL_INT; 608 return IIO_VAL_INT;
611 609
612 case IIO_CHAN_INFO_SCALE: 610 case IIO_CHAN_INFO_SCALE:
@@ -620,25 +618,38 @@ static int ad7793_read_raw(struct iio_dev *indio_dev,
620 return IIO_VAL_INT_PLUS_NANO; 618 return IIO_VAL_INT_PLUS_NANO;
621 } else { 619 } else {
622 /* 1170mV / 2^23 * 6 */ 620 /* 1170mV / 2^23 * 6 */
623 scale_uv = (1170ULL * 100000000ULL * 6ULL) 621 scale_uv = (1170ULL * 100000000ULL * 6ULL);
624 >> (chan->scan_type.realbits -
625 (unipolar ? 0 : 1));
626 } 622 }
627 break; 623 break;
628 case IIO_TEMP: 624 case IIO_TEMP:
629 /* Always uses unity gain and internal ref */ 625 /* 1170mV / 0.81 mV/C / 2^23 */
630 scale_uv = (2500ULL * 100000000ULL) 626 scale_uv = 1444444444444ULL;
631 >> (chan->scan_type.realbits -
632 (unipolar ? 0 : 1));
633 break; 627 break;
634 default: 628 default:
635 return -EINVAL; 629 return -EINVAL;
636 } 630 }
637 631
638 *val2 = do_div(scale_uv, 100000000) * 10; 632 scale_uv >>= (chan->scan_type.realbits - (unipolar ? 0 : 1));
639 *val = scale_uv; 633 *val = 0;
640 634 *val2 = scale_uv;
641 return IIO_VAL_INT_PLUS_NANO; 635 return IIO_VAL_INT_PLUS_NANO;
636 case IIO_CHAN_INFO_OFFSET:
637 if (!unipolar)
638 *val = -(1 << (chan->scan_type.realbits - 1));
639 else
640 *val = 0;
641
642 /* Kelvin to Celsius */
643 if (chan->type == IIO_TEMP) {
644 unsigned long long offset;
645 unsigned int shift;
646
647 shift = chan->scan_type.realbits - (unipolar ? 0 : 1);
648 offset = 273ULL << shift;
649 do_div(offset, 1444);
650 *val -= offset;
651 }
652 return IIO_VAL_INT;
642 } 653 }
643 return -EINVAL; 654 return -EINVAL;
644} 655}
@@ -676,7 +687,7 @@ static int ad7793_write_raw(struct iio_dev *indio_dev,
676 } 687 }
677 ret = 0; 688 ret = 0;
678 } 689 }
679 690 break;
680 default: 691 default:
681 ret = -EINVAL; 692 ret = -EINVAL;
682 } 693 }
@@ -720,9 +731,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
720 .channel2 = 0, 731 .channel2 = 0,
721 .address = AD7793_CH_AIN1P_AIN1M, 732 .address = AD7793_CH_AIN1P_AIN1M,
722 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 733 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
723 IIO_CHAN_INFO_SCALE_SHARED_BIT, 734 IIO_CHAN_INFO_SCALE_SHARED_BIT |
735 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
724 .scan_index = 0, 736 .scan_index = 0,
725 .scan_type = IIO_ST('s', 24, 32, 0) 737 .scan_type = IIO_ST('u', 24, 32, 0)
726 }, 738 },
727 .channel[1] = { 739 .channel[1] = {
728 .type = IIO_VOLTAGE, 740 .type = IIO_VOLTAGE,
@@ -732,9 +744,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
732 .channel2 = 1, 744 .channel2 = 1,
733 .address = AD7793_CH_AIN2P_AIN2M, 745 .address = AD7793_CH_AIN2P_AIN2M,
734 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 746 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
735 IIO_CHAN_INFO_SCALE_SHARED_BIT, 747 IIO_CHAN_INFO_SCALE_SHARED_BIT |
748 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
736 .scan_index = 1, 749 .scan_index = 1,
737 .scan_type = IIO_ST('s', 24, 32, 0) 750 .scan_type = IIO_ST('u', 24, 32, 0)
738 }, 751 },
739 .channel[2] = { 752 .channel[2] = {
740 .type = IIO_VOLTAGE, 753 .type = IIO_VOLTAGE,
@@ -744,9 +757,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
744 .channel2 = 2, 757 .channel2 = 2,
745 .address = AD7793_CH_AIN3P_AIN3M, 758 .address = AD7793_CH_AIN3P_AIN3M,
746 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 759 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
747 IIO_CHAN_INFO_SCALE_SHARED_BIT, 760 IIO_CHAN_INFO_SCALE_SHARED_BIT |
761 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
748 .scan_index = 2, 762 .scan_index = 2,
749 .scan_type = IIO_ST('s', 24, 32, 0) 763 .scan_type = IIO_ST('u', 24, 32, 0)
750 }, 764 },
751 .channel[3] = { 765 .channel[3] = {
752 .type = IIO_VOLTAGE, 766 .type = IIO_VOLTAGE,
@@ -757,9 +771,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
757 .channel2 = 2, 771 .channel2 = 2,
758 .address = AD7793_CH_AIN1M_AIN1M, 772 .address = AD7793_CH_AIN1M_AIN1M,
759 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 773 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
760 IIO_CHAN_INFO_SCALE_SHARED_BIT, 774 IIO_CHAN_INFO_SCALE_SHARED_BIT |
775 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
761 .scan_index = 3, 776 .scan_index = 3,
762 .scan_type = IIO_ST('s', 24, 32, 0) 777 .scan_type = IIO_ST('u', 24, 32, 0)
763 }, 778 },
764 .channel[4] = { 779 .channel[4] = {
765 .type = IIO_TEMP, 780 .type = IIO_TEMP,
@@ -769,7 +784,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
769 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 784 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
770 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, 785 IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
771 .scan_index = 4, 786 .scan_index = 4,
772 .scan_type = IIO_ST('s', 24, 32, 0), 787 .scan_type = IIO_ST('u', 24, 32, 0),
773 }, 788 },
774 .channel[5] = { 789 .channel[5] = {
775 .type = IIO_VOLTAGE, 790 .type = IIO_VOLTAGE,
@@ -778,9 +793,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
778 .channel = 4, 793 .channel = 4,
779 .address = AD7793_CH_AVDD_MONITOR, 794 .address = AD7793_CH_AVDD_MONITOR,
780 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 795 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
781 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, 796 IIO_CHAN_INFO_SCALE_SEPARATE_BIT |
797 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
782 .scan_index = 5, 798 .scan_index = 5,
783 .scan_type = IIO_ST('s', 24, 32, 0), 799 .scan_type = IIO_ST('u', 24, 32, 0),
784 }, 800 },
785 .channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6), 801 .channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6),
786 }, 802 },
@@ -793,9 +809,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
793 .channel2 = 0, 809 .channel2 = 0,
794 .address = AD7793_CH_AIN1P_AIN1M, 810 .address = AD7793_CH_AIN1P_AIN1M,
795 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 811 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
796 IIO_CHAN_INFO_SCALE_SHARED_BIT, 812 IIO_CHAN_INFO_SCALE_SHARED_BIT |
813 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
797 .scan_index = 0, 814 .scan_index = 0,
798 .scan_type = IIO_ST('s', 16, 32, 0) 815 .scan_type = IIO_ST('u', 16, 32, 0)
799 }, 816 },
800 .channel[1] = { 817 .channel[1] = {
801 .type = IIO_VOLTAGE, 818 .type = IIO_VOLTAGE,
@@ -805,9 +822,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
805 .channel2 = 1, 822 .channel2 = 1,
806 .address = AD7793_CH_AIN2P_AIN2M, 823 .address = AD7793_CH_AIN2P_AIN2M,
807 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 824 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
808 IIO_CHAN_INFO_SCALE_SHARED_BIT, 825 IIO_CHAN_INFO_SCALE_SHARED_BIT |
826 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
809 .scan_index = 1, 827 .scan_index = 1,
810 .scan_type = IIO_ST('s', 16, 32, 0) 828 .scan_type = IIO_ST('u', 16, 32, 0)
811 }, 829 },
812 .channel[2] = { 830 .channel[2] = {
813 .type = IIO_VOLTAGE, 831 .type = IIO_VOLTAGE,
@@ -817,9 +835,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
817 .channel2 = 2, 835 .channel2 = 2,
818 .address = AD7793_CH_AIN3P_AIN3M, 836 .address = AD7793_CH_AIN3P_AIN3M,
819 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 837 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
820 IIO_CHAN_INFO_SCALE_SHARED_BIT, 838 IIO_CHAN_INFO_SCALE_SHARED_BIT |
839 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
821 .scan_index = 2, 840 .scan_index = 2,
822 .scan_type = IIO_ST('s', 16, 32, 0) 841 .scan_type = IIO_ST('u', 16, 32, 0)
823 }, 842 },
824 .channel[3] = { 843 .channel[3] = {
825 .type = IIO_VOLTAGE, 844 .type = IIO_VOLTAGE,
@@ -830,9 +849,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
830 .channel2 = 2, 849 .channel2 = 2,
831 .address = AD7793_CH_AIN1M_AIN1M, 850 .address = AD7793_CH_AIN1M_AIN1M,
832 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 851 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
833 IIO_CHAN_INFO_SCALE_SHARED_BIT, 852 IIO_CHAN_INFO_SCALE_SHARED_BIT |
853 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
834 .scan_index = 3, 854 .scan_index = 3,
835 .scan_type = IIO_ST('s', 16, 32, 0) 855 .scan_type = IIO_ST('u', 16, 32, 0)
836 }, 856 },
837 .channel[4] = { 857 .channel[4] = {
838 .type = IIO_TEMP, 858 .type = IIO_TEMP,
@@ -842,7 +862,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
842 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 862 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
843 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, 863 IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
844 .scan_index = 4, 864 .scan_index = 4,
845 .scan_type = IIO_ST('s', 16, 32, 0), 865 .scan_type = IIO_ST('u', 16, 32, 0),
846 }, 866 },
847 .channel[5] = { 867 .channel[5] = {
848 .type = IIO_VOLTAGE, 868 .type = IIO_VOLTAGE,
@@ -851,9 +871,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
851 .channel = 4, 871 .channel = 4,
852 .address = AD7793_CH_AVDD_MONITOR, 872 .address = AD7793_CH_AVDD_MONITOR,
853 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | 873 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
854 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, 874 IIO_CHAN_INFO_SCALE_SEPARATE_BIT |
875 IIO_CHAN_INFO_OFFSET_SHARED_BIT,
855 .scan_index = 5, 876 .scan_index = 5,
856 .scan_type = IIO_ST('s', 16, 32, 0), 877 .scan_type = IIO_ST('u', 16, 32, 0),
857 }, 878 },
858 .channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6), 879 .channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6),
859 }, 880 },
@@ -901,7 +922,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
901 else if (voltage_uv) 922 else if (voltage_uv)
902 st->int_vref_mv = voltage_uv / 1000; 923 st->int_vref_mv = voltage_uv / 1000;
903 else 924 else
904 st->int_vref_mv = 2500; /* Build-in ref */ 925 st->int_vref_mv = 1170; /* Build-in ref */
905 926
906 spi_set_drvdata(spi, indio_dev); 927 spi_set_drvdata(spi, indio_dev);
907 st->spi = spi; 928 st->spi = spi;
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 070b442c1f81..4720b4ba096a 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -160,10 +160,12 @@ config SERIAL_KS8695_CONSOLE
160 160
161config SERIAL_CLPS711X 161config SERIAL_CLPS711X
162 tristate "CLPS711X serial port support" 162 tristate "CLPS711X serial port support"
163 depends on ARM && ARCH_CLPS711X 163 depends on ARCH_CLPS711X
164 select SERIAL_CORE 164 select SERIAL_CORE
165 default y
165 help 166 help
166 ::: To be written ::: 167 This enables the driver for the on-chip UARTs of the Cirrus
168 Logic EP711x/EP721x/EP731x processors.
167 169
168config SERIAL_CLPS711X_CONSOLE 170config SERIAL_CLPS711X_CONSOLE
169 bool "Support for console on CLPS711X serial port" 171 bool "Support for console on CLPS711X serial port"
@@ -173,9 +175,7 @@ config SERIAL_CLPS711X_CONSOLE
173 Even if you say Y here, the currently visible virtual console 175 Even if you say Y here, the currently visible virtual console
174 (/dev/tty0) will still be used as the system console by default, but 176 (/dev/tty0) will still be used as the system console by default, but
175 you can alter that using a kernel command line option such as 177 you can alter that using a kernel command line option such as
176 "console=ttyCL1". (Try "man bootparam" or see the documentation of 178 "console=ttyCL1".
177 your boot loader (lilo or loadlin) about how to pass options to the
178 kernel at boot time.)
179 179
180config SERIAL_SAMSUNG 180config SERIAL_SAMSUNG
181 tristate "Samsung SoC serial support" 181 tristate "Samsung SoC serial support"
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 144cd3987d4c..3ad079ffd049 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1331,7 +1331,7 @@ static const struct spi_device_id ifx_id_table[] = {
1331MODULE_DEVICE_TABLE(spi, ifx_id_table); 1331MODULE_DEVICE_TABLE(spi, ifx_id_table);
1332 1332
1333/* spi operations */ 1333/* spi operations */
1334static const struct spi_driver ifx_spi_driver = { 1334static struct spi_driver ifx_spi_driver = {
1335 .driver = { 1335 .driver = {
1336 .name = DRVNAME, 1336 .name = DRVNAME,
1337 .pm = &ifx_spi_pm, 1337 .pm = &ifx_spi_pm,
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 2e341b81ff89..3a667eed63d6 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -73,6 +73,7 @@
73#define AUART_CTRL0_CLKGATE (1 << 30) 73#define AUART_CTRL0_CLKGATE (1 << 30)
74 74
75#define AUART_CTRL2_CTSEN (1 << 15) 75#define AUART_CTRL2_CTSEN (1 << 15)
76#define AUART_CTRL2_RTSEN (1 << 14)
76#define AUART_CTRL2_RTS (1 << 11) 77#define AUART_CTRL2_RTS (1 << 11)
77#define AUART_CTRL2_RXE (1 << 9) 78#define AUART_CTRL2_RXE (1 << 9)
78#define AUART_CTRL2_TXE (1 << 8) 79#define AUART_CTRL2_TXE (1 << 8)
@@ -259,9 +260,12 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
259 260
260 u32 ctrl = readl(u->membase + AUART_CTRL2); 261 u32 ctrl = readl(u->membase + AUART_CTRL2);
261 262
262 ctrl &= ~AUART_CTRL2_RTS; 263 ctrl &= ~AUART_CTRL2_RTSEN;
263 if (mctrl & TIOCM_RTS) 264 if (mctrl & TIOCM_RTS) {
264 ctrl |= AUART_CTRL2_RTS; 265 if (u->state->port.flags & ASYNC_CTS_FLOW)
266 ctrl |= AUART_CTRL2_RTSEN;
267 }
268
265 s->ctrl = mctrl; 269 s->ctrl = mctrl;
266 writel(ctrl, u->membase + AUART_CTRL2); 270 writel(ctrl, u->membase + AUART_CTRL2);
267} 271}
@@ -359,9 +363,9 @@ static void mxs_auart_settermios(struct uart_port *u,
359 363
360 /* figure out the hardware flow control settings */ 364 /* figure out the hardware flow control settings */
361 if (cflag & CRTSCTS) 365 if (cflag & CRTSCTS)
362 ctrl2 |= AUART_CTRL2_CTSEN; 366 ctrl2 |= AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN;
363 else 367 else
364 ctrl2 &= ~AUART_CTRL2_CTSEN; 368 ctrl2 &= ~(AUART_CTRL2_CTSEN | AUART_CTRL2_RTSEN);
365 369
366 /* set baud rate */ 370 /* set baud rate */
367 baud = uart_get_baud_rate(u, termios, old, 0, u->uartclk); 371 baud = uart_get_baud_rate(u, termios, old, 0, u->uartclk);
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 654755a990df..333c8d012b0e 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1348,10 +1348,16 @@ static int pmz_verify_port(struct uart_port *port, struct serial_struct *ser)
1348static int pmz_poll_get_char(struct uart_port *port) 1348static int pmz_poll_get_char(struct uart_port *port)
1349{ 1349{
1350 struct uart_pmac_port *uap = (struct uart_pmac_port *)port; 1350 struct uart_pmac_port *uap = (struct uart_pmac_port *)port;
1351 int tries = 2;
1351 1352
1352 while ((read_zsreg(uap, R0) & Rx_CH_AV) == 0) 1353 while (tries) {
1353 udelay(5); 1354 if ((read_zsreg(uap, R0) & Rx_CH_AV) != 0)
1354 return read_zsdata(uap); 1355 return read_zsdata(uap);
1356 if (tries--)
1357 udelay(5);
1358 }
1359
1360 return NO_POLL_CHAR;
1355} 1361}
1356 1362
1357static void pmz_poll_put_char(struct uart_port *port, unsigned char c) 1363static void pmz_poll_put_char(struct uart_port *port, unsigned char c)
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 8337fb5d988d..47e499c9c0b6 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -1,9 +1,9 @@
1config USB_CHIPIDEA 1config USB_CHIPIDEA
2 tristate "ChipIdea Highspeed Dual Role Controller" 2 tristate "ChipIdea Highspeed Dual Role Controller"
3 depends on USB 3 depends on USB || USB_GADGET
4 help 4 help
5 Say Y here if your system has a dual role high speed USB 5 Say Y here if your system has a dual role high speed USB
6 controller based on ChipIdea silicon IP. Currently, only the 6 controller based on ChipIdea silicon IP. Currently, only the
7 peripheral mode is supported. 7 peripheral mode is supported.
8 8
9 When compiled dynamically, the module will be called ci-hdrc.ko. 9 When compiled dynamically, the module will be called ci-hdrc.ko.
@@ -12,7 +12,7 @@ if USB_CHIPIDEA
12 12
13config USB_CHIPIDEA_UDC 13config USB_CHIPIDEA_UDC
14 bool "ChipIdea device controller" 14 bool "ChipIdea device controller"
15 depends on USB_GADGET 15 depends on USB_GADGET=y || USB_GADGET=USB_CHIPIDEA
16 select USB_GADGET_DUALSPEED 16 select USB_GADGET_DUALSPEED
17 help 17 help
18 Say Y here to enable device controller functionality of the 18 Say Y here to enable device controller functionality of the
@@ -20,6 +20,7 @@ config USB_CHIPIDEA_UDC
20 20
21config USB_CHIPIDEA_HOST 21config USB_CHIPIDEA_HOST
22 bool "ChipIdea host controller" 22 bool "ChipIdea host controller"
23 depends on USB=y || USB=USB_CHIPIDEA
23 select USB_EHCI_ROOT_HUB_TT 24 select USB_EHCI_ROOT_HUB_TT
24 help 25 help
25 Say Y here to enable host controller functionality of the 26 Say Y here to enable host controller functionality of the
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index ee0ebacf8227..89dcf155d57e 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -450,7 +450,7 @@ static int dbgp_ehci_startup(void)
450 writel(FLAG_CF, &ehci_regs->configured_flag); 450 writel(FLAG_CF, &ehci_regs->configured_flag);
451 451
452 /* Wait until the controller is no longer halted */ 452 /* Wait until the controller is no longer halted */
453 loop = 10; 453 loop = 1000;
454 do { 454 do {
455 status = readl(&ehci_regs->status); 455 status = readl(&ehci_regs->status);
456 if (!(status & STS_HALT)) 456 if (!(status & STS_HALT))
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 90e82e288eb9..0e5230926154 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -669,6 +669,8 @@ static int eth_stop(struct net_device *net)
669 spin_lock_irqsave(&dev->lock, flags); 669 spin_lock_irqsave(&dev->lock, flags);
670 if (dev->port_usb) { 670 if (dev->port_usb) {
671 struct gether *link = dev->port_usb; 671 struct gether *link = dev->port_usb;
672 const struct usb_endpoint_descriptor *in;
673 const struct usb_endpoint_descriptor *out;
672 674
673 if (link->close) 675 if (link->close)
674 link->close(link); 676 link->close(link);
@@ -682,10 +684,14 @@ static int eth_stop(struct net_device *net)
682 * their own pace; the network stack can handle old packets. 684 * their own pace; the network stack can handle old packets.
683 * For the moment we leave this here, since it works. 685 * For the moment we leave this here, since it works.
684 */ 686 */
687 in = link->in_ep->desc;
688 out = link->out_ep->desc;
685 usb_ep_disable(link->in_ep); 689 usb_ep_disable(link->in_ep);
686 usb_ep_disable(link->out_ep); 690 usb_ep_disable(link->out_ep);
687 if (netif_carrier_ok(net)) { 691 if (netif_carrier_ok(net)) {
688 DBG(dev, "host still using in/out endpoints\n"); 692 DBG(dev, "host still using in/out endpoints\n");
693 link->in_ep->desc = in;
694 link->out_ep->desc = out;
689 usb_ep_enable(link->in_ep); 695 usb_ep_enable(link->in_ep);
690 usb_ep_enable(link->out_ep); 696 usb_ep_enable(link->out_ep);
691 } 697 }
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bb55eb4a7d48..d7fe287d0678 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -56,15 +56,6 @@
56#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 56#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
57#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 57#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0
58 58
59/* Errata i693 */
60static struct clk *utmi_p1_fck;
61static struct clk *utmi_p2_fck;
62static struct clk *xclk60mhsp1_ck;
63static struct clk *xclk60mhsp2_ck;
64static struct clk *usbhost_p1_fck;
65static struct clk *usbhost_p2_fck;
66static struct clk *init_60m_fclk;
67
68/*-------------------------------------------------------------------------*/ 59/*-------------------------------------------------------------------------*/
69 60
70static const struct hc_driver ehci_omap_hc_driver; 61static const struct hc_driver ehci_omap_hc_driver;
@@ -80,40 +71,6 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
80 return __raw_readl(base + reg); 71 return __raw_readl(base + reg);
81} 72}
82 73
83/* Erratum i693 workaround sequence */
84static void omap_ehci_erratum_i693(struct ehci_hcd *ehci)
85{
86 int ret = 0;
87
88 /* Switch to the internal 60 MHz clock */
89 ret = clk_set_parent(utmi_p1_fck, init_60m_fclk);
90 if (ret != 0)
91 ehci_err(ehci, "init_60m_fclk set parent"
92 "failed error:%d\n", ret);
93
94 ret = clk_set_parent(utmi_p2_fck, init_60m_fclk);
95 if (ret != 0)
96 ehci_err(ehci, "init_60m_fclk set parent"
97 "failed error:%d\n", ret);
98
99 clk_enable(usbhost_p1_fck);
100 clk_enable(usbhost_p2_fck);
101
102 /* Wait 1ms and switch back to the external clock */
103 mdelay(1);
104 ret = clk_set_parent(utmi_p1_fck, xclk60mhsp1_ck);
105 if (ret != 0)
106 ehci_err(ehci, "xclk60mhsp1_ck set parent"
107 "failed error:%d\n", ret);
108
109 ret = clk_set_parent(utmi_p2_fck, xclk60mhsp2_ck);
110 if (ret != 0)
111 ehci_err(ehci, "xclk60mhsp2_ck set parent"
112 "failed error:%d\n", ret);
113
114 clk_disable(usbhost_p1_fck);
115 clk_disable(usbhost_p2_fck);
116}
117 74
118static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port) 75static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port)
119{ 76{
@@ -195,50 +152,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)
195 return rc; 152 return rc;
196} 153}
197 154
198static int omap_ehci_hub_control(
199 struct usb_hcd *hcd,
200 u16 typeReq,
201 u16 wValue,
202 u16 wIndex,
203 char *buf,
204 u16 wLength
205)
206{
207 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
208 u32 __iomem *status_reg = &ehci->regs->port_status[
209 (wIndex & 0xff) - 1];
210 u32 temp;
211 unsigned long flags;
212 int retval = 0;
213
214 spin_lock_irqsave(&ehci->lock, flags);
215
216 if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) {
217 temp = ehci_readl(ehci, status_reg);
218 if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) {
219 retval = -EPIPE;
220 goto done;
221 }
222
223 temp &= ~PORT_WKCONN_E;
224 temp |= PORT_WKDISC_E | PORT_WKOC_E;
225 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
226
227 omap_ehci_erratum_i693(ehci);
228
229 set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
230 goto done;
231 }
232
233 spin_unlock_irqrestore(&ehci->lock, flags);
234
235 /* Handle the hub control events here */
236 return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
237done:
238 spin_unlock_irqrestore(&ehci->lock, flags);
239 return retval;
240}
241
242static void disable_put_regulator( 155static void disable_put_regulator(
243 struct ehci_hcd_omap_platform_data *pdata) 156 struct ehci_hcd_omap_platform_data *pdata)
244{ 157{
@@ -351,79 +264,9 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
351 goto err_pm_runtime; 264 goto err_pm_runtime;
352 } 265 }
353 266
354 /* get clocks */
355 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
356 if (IS_ERR(utmi_p1_fck)) {
357 ret = PTR_ERR(utmi_p1_fck);
358 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
359 goto err_add_hcd;
360 }
361
362 xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
363 if (IS_ERR(xclk60mhsp1_ck)) {
364 ret = PTR_ERR(xclk60mhsp1_ck);
365 dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
366 goto err_utmi_p1_fck;
367 }
368
369 utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
370 if (IS_ERR(utmi_p2_fck)) {
371 ret = PTR_ERR(utmi_p2_fck);
372 dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
373 goto err_xclk60mhsp1_ck;
374 }
375
376 xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
377 if (IS_ERR(xclk60mhsp2_ck)) {
378 ret = PTR_ERR(xclk60mhsp2_ck);
379 dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
380 goto err_utmi_p2_fck;
381 }
382
383 usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
384 if (IS_ERR(usbhost_p1_fck)) {
385 ret = PTR_ERR(usbhost_p1_fck);
386 dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
387 goto err_xclk60mhsp2_ck;
388 }
389
390 usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
391 if (IS_ERR(usbhost_p2_fck)) {
392 ret = PTR_ERR(usbhost_p2_fck);
393 dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
394 goto err_usbhost_p1_fck;
395 }
396
397 init_60m_fclk = clk_get(dev, "init_60m_fclk");
398 if (IS_ERR(init_60m_fclk)) {
399 ret = PTR_ERR(init_60m_fclk);
400 dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
401 goto err_usbhost_p2_fck;
402 }
403 267
404 return 0; 268 return 0;
405 269
406err_usbhost_p2_fck:
407 clk_put(usbhost_p2_fck);
408
409err_usbhost_p1_fck:
410 clk_put(usbhost_p1_fck);
411
412err_xclk60mhsp2_ck:
413 clk_put(xclk60mhsp2_ck);
414
415err_utmi_p2_fck:
416 clk_put(utmi_p2_fck);
417
418err_xclk60mhsp1_ck:
419 clk_put(xclk60mhsp1_ck);
420
421err_utmi_p1_fck:
422 clk_put(utmi_p1_fck);
423
424err_add_hcd:
425 usb_remove_hcd(hcd);
426
427err_pm_runtime: 270err_pm_runtime:
428 disable_put_regulator(pdata); 271 disable_put_regulator(pdata);
429 pm_runtime_put_sync(dev); 272 pm_runtime_put_sync(dev);
@@ -454,14 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
454 iounmap(hcd->regs); 297 iounmap(hcd->regs);
455 usb_put_hcd(hcd); 298 usb_put_hcd(hcd);
456 299
457 clk_put(utmi_p1_fck);
458 clk_put(utmi_p2_fck);
459 clk_put(xclk60mhsp1_ck);
460 clk_put(xclk60mhsp2_ck);
461 clk_put(usbhost_p1_fck);
462 clk_put(usbhost_p2_fck);
463 clk_put(init_60m_fclk);
464
465 pm_runtime_put_sync(dev); 300 pm_runtime_put_sync(dev);
466 pm_runtime_disable(dev); 301 pm_runtime_disable(dev);
467 302
@@ -532,7 +367,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
532 * root hub support 367 * root hub support
533 */ 368 */
534 .hub_status_data = ehci_hub_status_data, 369 .hub_status_data = ehci_hub_status_data,
535 .hub_control = omap_ehci_hub_control, 370 .hub_control = ehci_hub_control,
536 .bus_suspend = ehci_bus_suspend, 371 .bus_suspend = ehci_bus_suspend,
537 .bus_resume = ehci_bus_resume, 372 .bus_resume = ehci_bus_resume,
538 373
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index 58c96bd50d22..0c9e43cfaff5 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -40,7 +40,7 @@ static int ehci_sead3_setup(struct usb_hcd *hcd)
40 ehci->need_io_watchdog = 0; 40 ehci->need_io_watchdog = 0;
41 41
42 /* Set burst length to 16 words. */ 42 /* Set burst length to 16 words. */
43 ehci_writel(ehci, 0x1010, &ehci->regs->reserved[1]); 43 ehci_writel(ehci, 0x1010, &ehci->regs->reserved1[1]);
44 44
45 return ret; 45 return ret;
46} 46}
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 950e95efa381..26dedb30ad0b 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -799,11 +799,12 @@ static int tegra_ehci_remove(struct platform_device *pdev)
799#endif 799#endif
800 800
801 usb_remove_hcd(hcd); 801 usb_remove_hcd(hcd);
802 usb_put_hcd(hcd);
803 802
804 tegra_usb_phy_close(tegra->phy); 803 tegra_usb_phy_close(tegra->phy);
805 iounmap(hcd->regs); 804 iounmap(hcd->regs);
806 805
806 usb_put_hcd(hcd);
807
807 clk_disable_unprepare(tegra->clk); 808 clk_disable_unprepare(tegra->clk);
808 clk_put(tegra->clk); 809 clk_put(tegra->clk);
809 810
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 2ed112d3e159..256326322cfd 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -543,12 +543,12 @@ static void postproc_ep(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep)
543 usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid, 543 usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid,
544 short_ok ? "" : "not_", 544 short_ok ? "" : "not_",
545 PTD_GET_COUNT(ptd), ep->maxpacket, len); 545 PTD_GET_COUNT(ptd), ep->maxpacket, len);
546 /* save the data underrun error code for later and
547 * proceed with the status stage
548 */
549 urb->actual_length += PTD_GET_COUNT(ptd);
546 if (usb_pipecontrol(urb->pipe)) { 550 if (usb_pipecontrol(urb->pipe)) {
547 ep->nextpid = USB_PID_ACK; 551 ep->nextpid = USB_PID_ACK;
548 /* save the data underrun error code for later and
549 * proceed with the status stage
550 */
551 urb->actual_length += PTD_GET_COUNT(ptd);
552 BUG_ON(urb->actual_length > urb->transfer_buffer_length); 552 BUG_ON(urb->actual_length > urb->transfer_buffer_length);
553 553
554 if (urb->status == -EINPROGRESS) 554 if (urb->status == -EINPROGRESS)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index e7d75d295988..f8b2d91851f7 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -403,8 +403,6 @@ err0:
403static inline void 403static inline void
404usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev) 404usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
405{ 405{
406 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
407
408 usb_remove_hcd(hcd); 406 usb_remove_hcd(hcd);
409 if (!IS_ERR_OR_NULL(hcd->phy)) { 407 if (!IS_ERR_OR_NULL(hcd->phy)) {
410 (void) otg_set_host(hcd->phy->otg, 0); 408 (void) otg_set_host(hcd->phy->otg, 0);
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index df0828cb2aa3..c5e9e4a76f14 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -800,6 +800,13 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
800} 800}
801EXPORT_SYMBOL_GPL(usb_enable_xhci_ports); 801EXPORT_SYMBOL_GPL(usb_enable_xhci_ports);
802 802
803void usb_disable_xhci_ports(struct pci_dev *xhci_pdev)
804{
805 pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, 0x0);
806 pci_write_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, 0x0);
807}
808EXPORT_SYMBOL_GPL(usb_disable_xhci_ports);
809
803/** 810/**
804 * PCI Quirks for xHCI. 811 * PCI Quirks for xHCI.
805 * 812 *
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index b1002a8ef96f..ef004a5de20f 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -10,6 +10,7 @@ void usb_amd_quirk_pll_disable(void);
10void usb_amd_quirk_pll_enable(void); 10void usb_amd_quirk_pll_enable(void);
11bool usb_is_intel_switchable_xhci(struct pci_dev *pdev); 11bool usb_is_intel_switchable_xhci(struct pci_dev *pdev);
12void usb_enable_xhci_ports(struct pci_dev *xhci_pdev); 12void usb_enable_xhci_ports(struct pci_dev *xhci_pdev);
13void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
13#else 14#else
14static inline void usb_amd_quirk_pll_disable(void) {} 15static inline void usb_amd_quirk_pll_disable(void) {}
15static inline void usb_amd_quirk_pll_enable(void) {} 16static inline void usb_amd_quirk_pll_enable(void) {}
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 18b231b0c5d3..9bfd4ca1153c 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -94,11 +94,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
94 xhci->quirks |= XHCI_EP_LIMIT_QUIRK; 94 xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
95 xhci->limit_active_eps = 64; 95 xhci->limit_active_eps = 64;
96 xhci->quirks |= XHCI_SW_BW_CHECKING; 96 xhci->quirks |= XHCI_SW_BW_CHECKING;
97 /*
98 * PPT desktop boards DH77EB and DH77DF will power back on after
99 * a few seconds of being shutdown. The fix for this is to
100 * switch the ports from xHCI to EHCI on shutdown. We can't use
101 * DMI information to find those particular boards (since each
102 * vendor will change the board name), so we have to key off all
103 * PPT chipsets.
104 */
105 xhci->quirks |= XHCI_SPURIOUS_REBOOT;
97 } 106 }
98 if (pdev->vendor == PCI_VENDOR_ID_ETRON && 107 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
99 pdev->device == PCI_DEVICE_ID_ASROCK_P67) { 108 pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
100 xhci->quirks |= XHCI_RESET_ON_RESUME; 109 xhci->quirks |= XHCI_RESET_ON_RESUME;
101 xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); 110 xhci_dbg(xhci, "QUIRK: Resetting on resume\n");
111 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
102 } 112 }
103 if (pdev->vendor == PCI_VENDOR_ID_VIA) 113 if (pdev->vendor == PCI_VENDOR_ID_VIA)
104 xhci->quirks |= XHCI_RESET_ON_RESUME; 114 xhci->quirks |= XHCI_RESET_ON_RESUME;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8275645889da..643c2f3f3e73 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -145,29 +145,37 @@ static void next_trb(struct xhci_hcd *xhci,
145 */ 145 */
146static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) 146static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
147{ 147{
148 union xhci_trb *next;
149 unsigned long long addr; 148 unsigned long long addr;
150 149
151 ring->deq_updates++; 150 ring->deq_updates++;
152 151
153 /* If this is not event ring, there is one more usable TRB */ 152 /*
153 * If this is not event ring, and the dequeue pointer
154 * is not on a link TRB, there is one more usable TRB
155 */
154 if (ring->type != TYPE_EVENT && 156 if (ring->type != TYPE_EVENT &&
155 !last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) 157 !last_trb(xhci, ring, ring->deq_seg, ring->dequeue))
156 ring->num_trbs_free++; 158 ring->num_trbs_free++;
157 next = ++(ring->dequeue);
158 159
159 /* Update the dequeue pointer further if that was a link TRB or we're at 160 do {
160 * the end of an event ring segment (which doesn't have link TRBS) 161 /*
161 */ 162 * Update the dequeue pointer further if that was a link TRB or
162 while (last_trb(xhci, ring, ring->deq_seg, next)) { 163 * we're at the end of an event ring segment (which doesn't have
163 if (ring->type == TYPE_EVENT && last_trb_on_last_seg(xhci, 164 * link TRBS)
164 ring, ring->deq_seg, next)) { 165 */
165 ring->cycle_state = (ring->cycle_state ? 0 : 1); 166 if (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) {
167 if (ring->type == TYPE_EVENT &&
168 last_trb_on_last_seg(xhci, ring,
169 ring->deq_seg, ring->dequeue)) {
170 ring->cycle_state = (ring->cycle_state ? 0 : 1);
171 }
172 ring->deq_seg = ring->deq_seg->next;
173 ring->dequeue = ring->deq_seg->trbs;
174 } else {
175 ring->dequeue++;
166 } 176 }
167 ring->deq_seg = ring->deq_seg->next; 177 } while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue));
168 ring->dequeue = ring->deq_seg->trbs; 178
169 next = ring->dequeue;
170 }
171 addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); 179 addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
172} 180}
173 181
@@ -2073,8 +2081,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2073 if (xhci->quirks & XHCI_TRUST_TX_LENGTH) 2081 if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
2074 trb_comp_code = COMP_SHORT_TX; 2082 trb_comp_code = COMP_SHORT_TX;
2075 else 2083 else
2076 xhci_warn(xhci, "WARN Successful completion on short TX: " 2084 xhci_warn_ratelimited(xhci,
2077 "needs XHCI_TRUST_TX_LENGTH quirk?\n"); 2085 "WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n");
2078 case COMP_SHORT_TX: 2086 case COMP_SHORT_TX:
2079 break; 2087 break;
2080 case COMP_STOP: 2088 case COMP_STOP:
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 7648b2d4b268..c59d5b5b6c7d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -166,7 +166,7 @@ int xhci_reset(struct xhci_hcd *xhci)
166 xhci_writel(xhci, command, &xhci->op_regs->command); 166 xhci_writel(xhci, command, &xhci->op_regs->command);
167 167
168 ret = handshake(xhci, &xhci->op_regs->command, 168 ret = handshake(xhci, &xhci->op_regs->command,
169 CMD_RESET, 0, 250 * 1000); 169 CMD_RESET, 0, 10 * 1000 * 1000);
170 if (ret) 170 if (ret)
171 return ret; 171 return ret;
172 172
@@ -175,7 +175,8 @@ int xhci_reset(struct xhci_hcd *xhci)
175 * xHCI cannot write to any doorbells or operational registers other 175 * xHCI cannot write to any doorbells or operational registers other
176 * than status until the "Controller Not Ready" flag is cleared. 176 * than status until the "Controller Not Ready" flag is cleared.
177 */ 177 */
178 ret = handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000); 178 ret = handshake(xhci, &xhci->op_regs->status,
179 STS_CNR, 0, 10 * 1000 * 1000);
179 180
180 for (i = 0; i < 2; ++i) { 181 for (i = 0; i < 2; ++i) {
181 xhci->bus_state[i].port_c_suspend = 0; 182 xhci->bus_state[i].port_c_suspend = 0;
@@ -658,6 +659,9 @@ void xhci_shutdown(struct usb_hcd *hcd)
658{ 659{
659 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 660 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
660 661
662 if (xhci->quirks && XHCI_SPURIOUS_REBOOT)
663 usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
664
661 spin_lock_irq(&xhci->lock); 665 spin_lock_irq(&xhci->lock);
662 xhci_halt(xhci); 666 xhci_halt(xhci);
663 spin_unlock_irq(&xhci->lock); 667 spin_unlock_irq(&xhci->lock);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 55c0785810c9..c713256297ac 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1494,6 +1494,7 @@ struct xhci_hcd {
1494#define XHCI_TRUST_TX_LENGTH (1 << 10) 1494#define XHCI_TRUST_TX_LENGTH (1 << 10)
1495#define XHCI_LPM_SUPPORT (1 << 11) 1495#define XHCI_LPM_SUPPORT (1 << 11)
1496#define XHCI_INTEL_HOST (1 << 12) 1496#define XHCI_INTEL_HOST (1 << 12)
1497#define XHCI_SPURIOUS_REBOOT (1 << 13)
1497 unsigned int num_active_eps; 1498 unsigned int num_active_eps;
1498 unsigned int limit_active_eps; 1499 unsigned int limit_active_eps;
1499 /* There are two roothubs to keep track of bus suspend info for */ 1500 /* There are two roothubs to keep track of bus suspend info for */
@@ -1537,6 +1538,8 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci)
1537 dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args) 1538 dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1538#define xhci_warn(xhci, fmt, args...) \ 1539#define xhci_warn(xhci, fmt, args...) \
1539 dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args) 1540 dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1541#define xhci_warn_ratelimited(xhci, fmt, args...) \
1542 dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1540 1543
1541/* TODO: copied from ehci.h - can be refactored? */ 1544/* TODO: copied from ehci.h - can be refactored? */
1542/* xHCI spec says all registers are little endian */ 1545/* xHCI spec says all registers are little endian */
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index ef0c3f9f0947..6259f0d99324 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -8,7 +8,7 @@ config USB_MUSB_HDRC
8 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 8 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
9 depends on USB && USB_GADGET 9 depends on USB && USB_GADGET
10 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) 10 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
11 select NOP_USB_XCEIV if (SOC_OMAPTI81XX || SOC_OMAPAM33XX) 11 select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX)
12 select TWL4030_USB if MACH_OMAP_3430SDP 12 select TWL4030_USB if MACH_OMAP_3430SDP
13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
14 select USB_OTG_UTILS 14 select USB_OTG_UTILS
@@ -57,7 +57,7 @@ config USB_MUSB_AM35X
57 57
58config USB_MUSB_DSPS 58config USB_MUSB_DSPS
59 tristate "TI DSPS platforms" 59 tristate "TI DSPS platforms"
60 depends on SOC_OMAPTI81XX || SOC_OMAPAM33XX 60 depends on SOC_TI81XX || SOC_AM33XX
61 61
62config USB_MUSB_BLACKFIN 62config USB_MUSB_BLACKFIN
63 tristate "Blackfin" 63 tristate "Blackfin"
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 217808d9fbe1..494772fc9e23 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -479,9 +479,9 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
479 ret = -ENODEV; 479 ret = -ENODEV;
480 goto err0; 480 goto err0;
481 } 481 }
482 strcpy((u8 *)res->name, "mc");
483 res->parent = NULL; 482 res->parent = NULL;
484 resources[1] = *res; 483 resources[1] = *res;
484 resources[1].name = "mc";
485 485
486 /* allocate the child platform device */ 486 /* allocate the child platform device */
487 musb = platform_device_alloc("musb-hdrc", -1); 487 musb = platform_device_alloc("musb-hdrc", -1);
@@ -566,27 +566,28 @@ static int __devinit dsps_probe(struct platform_device *pdev)
566 } 566 }
567 platform_set_drvdata(pdev, glue); 567 platform_set_drvdata(pdev, glue);
568 568
569 /* create the child platform device for first instances of musb */
570 ret = dsps_create_musb_pdev(glue, 0);
571 if (ret != 0) {
572 dev_err(&pdev->dev, "failed to create child pdev\n");
573 goto err2;
574 }
575
576 /* enable the usbss clocks */ 569 /* enable the usbss clocks */
577 pm_runtime_enable(&pdev->dev); 570 pm_runtime_enable(&pdev->dev);
578 571
579 ret = pm_runtime_get_sync(&pdev->dev); 572 ret = pm_runtime_get_sync(&pdev->dev);
580 if (ret < 0) { 573 if (ret < 0) {
581 dev_err(&pdev->dev, "pm_runtime_get_sync FAILED"); 574 dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
575 goto err2;
576 }
577
578 /* create the child platform device for first instances of musb */
579 ret = dsps_create_musb_pdev(glue, 0);
580 if (ret != 0) {
581 dev_err(&pdev->dev, "failed to create child pdev\n");
582 goto err3; 582 goto err3;
583 } 583 }
584 584
585 return 0; 585 return 0;
586 586
587err3: 587err3:
588 pm_runtime_disable(&pdev->dev); 588 pm_runtime_put(&pdev->dev);
589err2: 589err2:
590 pm_runtime_disable(&pdev->dev);
590 kfree(glue->wrp); 591 kfree(glue->wrp);
591err1: 592err1:
592 kfree(glue); 593 kfree(glue);
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 8c9bb1ad3069..681da06170c2 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -603,12 +603,12 @@ static int usbhsc_resume(struct device *dev)
603 struct usbhs_priv *priv = dev_get_drvdata(dev); 603 struct usbhs_priv *priv = dev_get_drvdata(dev);
604 struct platform_device *pdev = usbhs_priv_to_pdev(priv); 604 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
605 605
606 usbhs_platform_call(priv, phy_reset, pdev);
607
608 if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) 606 if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
609 usbhsc_power_ctrl(priv, 1); 607 usbhsc_power_ctrl(priv, 1);
610 608
611 usbhsc_hotplug(priv); 609 usbhs_platform_call(priv, phy_reset, pdev);
610
611 usbhsc_drvcllbck_notify_hotplug(pdev);
612 612
613 return 0; 613 return 0;
614} 614}
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index 1834cf50888c..9b69a1323294 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -1266,6 +1266,12 @@ static int usbhsh_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1266 return ret; 1266 return ret;
1267} 1267}
1268 1268
1269static int usbhsh_bus_nop(struct usb_hcd *hcd)
1270{
1271 /* nothing to do */
1272 return 0;
1273}
1274
1269static struct hc_driver usbhsh_driver = { 1275static struct hc_driver usbhsh_driver = {
1270 .description = usbhsh_hcd_name, 1276 .description = usbhsh_hcd_name,
1271 .hcd_priv_size = sizeof(struct usbhsh_hpriv), 1277 .hcd_priv_size = sizeof(struct usbhsh_hpriv),
@@ -1290,6 +1296,8 @@ static struct hc_driver usbhsh_driver = {
1290 */ 1296 */
1291 .hub_status_data = usbhsh_hub_status_data, 1297 .hub_status_data = usbhsh_hub_status_data,
1292 .hub_control = usbhsh_hub_control, 1298 .hub_control = usbhsh_hub_control,
1299 .bus_suspend = usbhsh_bus_nop,
1300 .bus_resume = usbhsh_bus_nop,
1293}; 1301};
1294 1302
1295/* 1303/*
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index f398d1e34474..c15f2e7cefc7 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -61,18 +61,23 @@ static int usb_serial_device_probe(struct device *dev)
61 goto exit; 61 goto exit;
62 } 62 }
63 63
64 /* make sure suspend/resume doesn't race against port_probe */
65 retval = usb_autopm_get_interface(port->serial->interface);
66 if (retval)
67 goto exit;
68
64 driver = port->serial->type; 69 driver = port->serial->type;
65 if (driver->port_probe) { 70 if (driver->port_probe) {
66 retval = driver->port_probe(port); 71 retval = driver->port_probe(port);
67 if (retval) 72 if (retval)
68 goto exit; 73 goto exit_with_autopm;
69 } 74 }
70 75
71 retval = device_create_file(dev, &dev_attr_port_number); 76 retval = device_create_file(dev, &dev_attr_port_number);
72 if (retval) { 77 if (retval) {
73 if (driver->port_remove) 78 if (driver->port_remove)
74 retval = driver->port_remove(port); 79 retval = driver->port_remove(port);
75 goto exit; 80 goto exit_with_autopm;
76 } 81 }
77 82
78 minor = port->number; 83 minor = port->number;
@@ -81,6 +86,8 @@ static int usb_serial_device_probe(struct device *dev)
81 "%s converter now attached to ttyUSB%d\n", 86 "%s converter now attached to ttyUSB%d\n",
82 driver->description, minor); 87 driver->description, minor);
83 88
89exit_with_autopm:
90 usb_autopm_put_interface(port->serial->interface);
84exit: 91exit:
85 return retval; 92 return retval;
86} 93}
@@ -96,6 +103,9 @@ static int usb_serial_device_remove(struct device *dev)
96 if (!port) 103 if (!port)
97 return -ENODEV; 104 return -ENODEV;
98 105
106 /* make sure suspend/resume doesn't race against port_remove */
107 usb_autopm_get_interface(port->serial->interface);
108
99 device_remove_file(&port->dev, &dev_attr_port_number); 109 device_remove_file(&port->dev, &dev_attr_port_number);
100 110
101 driver = port->serial->type; 111 driver = port->serial->type;
@@ -107,6 +117,7 @@ static int usb_serial_device_remove(struct device *dev)
107 dev_info(dev, "%s converter now disconnected from ttyUSB%d\n", 117 dev_info(dev, "%s converter now disconnected from ttyUSB%d\n",
108 driver->description, minor); 118 driver->description, minor);
109 119
120 usb_autopm_put_interface(port->serial->interface);
110 return retval; 121 return retval;
111} 122}
112 123
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index bc912e5a3beb..5620db6469e5 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -811,6 +811,7 @@ static struct usb_device_id id_table_combined [] = {
811 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) }, 811 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
812 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) }, 812 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
813 { USB_DEVICE(PI_VID, PI_E861_PID) }, 813 { USB_DEVICE(PI_VID, PI_E861_PID) },
814 { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
814 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, 815 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
815 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 816 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
816 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 817 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 5661c7e2d415..5dd96ca6c380 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -795,6 +795,13 @@
795#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */ 795#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */
796 796
797/* 797/*
798 * Kondo Kagaku Co.Ltd.
799 * http://www.kondo-robot.com/EN
800 */
801#define KONDO_VID 0x165c
802#define KONDO_USB_SERIAL_PID 0x0002
803
804/*
798 * Bayer Ascensia Contour blood glucose meter USB-converter cable. 805 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
799 * http://winglucofacts.com/cables/ 806 * http://winglucofacts.com/cables/
800 */ 807 */
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index 5811d34b6c6b..2cb30c535839 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -227,7 +227,6 @@ static void ipw_release(struct usb_serial *serial)
227{ 227{
228 struct usb_wwan_intf_private *data = usb_get_serial_data(serial); 228 struct usb_wwan_intf_private *data = usb_get_serial_data(serial);
229 229
230 usb_wwan_release(serial);
231 usb_set_serial_data(serial, NULL); 230 usb_set_serial_data(serial, NULL);
232 kfree(data); 231 kfree(data);
233} 232}
@@ -309,12 +308,12 @@ static struct usb_serial_driver ipw_device = {
309 .description = "IPWireless converter", 308 .description = "IPWireless converter",
310 .id_table = id_table, 309 .id_table = id_table,
311 .num_ports = 1, 310 .num_ports = 1,
312 .disconnect = usb_wwan_disconnect,
313 .open = ipw_open, 311 .open = ipw_open,
314 .close = ipw_close, 312 .close = ipw_close,
315 .probe = ipw_probe, 313 .probe = ipw_probe,
316 .attach = usb_wwan_startup, 314 .attach = usb_wwan_startup,
317 .release = ipw_release, 315 .release = ipw_release,
316 .port_remove = usb_wwan_port_remove,
318 .dtr_rts = ipw_dtr_rts, 317 .dtr_rts = ipw_dtr_rts,
319 .write = usb_wwan_write, 318 .write = usb_wwan_write,
320}; 319};
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 57eca2448424..2f6da1e89bfa 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -82,8 +82,7 @@
82 * Defines used for sending commands to port 82 * Defines used for sending commands to port
83 */ 83 */
84 84
85#define WAIT_FOR_EVER (HZ * 0) /* timeout urb is wait for ever */ 85#define MOS_WDR_TIMEOUT 5000 /* default urb timeout */
86#define MOS_WDR_TIMEOUT (HZ * 5) /* default urb timeout */
87 86
88#define MOS_PORT1 0x0200 87#define MOS_PORT1 0x0200
89#define MOS_PORT2 0x0300 88#define MOS_PORT2 0x0300
@@ -1232,9 +1231,12 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty)
1232 return 0; 1231 return 0;
1233 1232
1234 spin_lock_irqsave(&mos7840_port->pool_lock, flags); 1233 spin_lock_irqsave(&mos7840_port->pool_lock, flags);
1235 for (i = 0; i < NUM_URBS; ++i) 1234 for (i = 0; i < NUM_URBS; ++i) {
1236 if (mos7840_port->busy[i]) 1235 if (mos7840_port->busy[i]) {
1237 chars += URB_TRANSFER_BUFFER_SIZE; 1236 struct urb *urb = mos7840_port->write_urb_pool[i];
1237 chars += urb->transfer_buffer_length;
1238 }
1239 }
1238 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 1240 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
1239 dbg("%s - returns %d", __func__, chars); 1241 dbg("%s - returns %d", __func__, chars);
1240 return chars; 1242 return chars;
@@ -1344,7 +1346,7 @@ static void mos7840_close(struct usb_serial_port *port)
1344static void mos7840_block_until_chase_response(struct tty_struct *tty, 1346static void mos7840_block_until_chase_response(struct tty_struct *tty,
1345 struct moschip_port *mos7840_port) 1347 struct moschip_port *mos7840_port)
1346{ 1348{
1347 int timeout = 1 * HZ; 1349 int timeout = msecs_to_jiffies(1000);
1348 int wait = 10; 1350 int wait = 10;
1349 int count; 1351 int count;
1350 1352
@@ -2672,7 +2674,7 @@ static int mos7840_startup(struct usb_serial *serial)
2672 2674
2673 /* setting configuration feature to one */ 2675 /* setting configuration feature to one */
2674 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 2676 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
2675 (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5 * HZ); 2677 (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, MOS_WDR_TIMEOUT);
2676 return 0; 2678 return 0;
2677error: 2679error:
2678 for (/* nothing */; i >= 0; i--) { 2680 for (/* nothing */; i >= 0; i--) {
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 08ff9b862049..cc40f47ecea1 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -80,85 +80,9 @@ static void option_instat_callback(struct urb *urb);
80#define OPTION_PRODUCT_GTM380_MODEM 0x7201 80#define OPTION_PRODUCT_GTM380_MODEM 0x7201
81 81
82#define HUAWEI_VENDOR_ID 0x12D1 82#define HUAWEI_VENDOR_ID 0x12D1
83#define HUAWEI_PRODUCT_E600 0x1001
84#define HUAWEI_PRODUCT_E220 0x1003
85#define HUAWEI_PRODUCT_E220BIS 0x1004
86#define HUAWEI_PRODUCT_E1401 0x1401
87#define HUAWEI_PRODUCT_E1402 0x1402
88#define HUAWEI_PRODUCT_E1403 0x1403
89#define HUAWEI_PRODUCT_E1404 0x1404
90#define HUAWEI_PRODUCT_E1405 0x1405
91#define HUAWEI_PRODUCT_E1406 0x1406
92#define HUAWEI_PRODUCT_E1407 0x1407
93#define HUAWEI_PRODUCT_E1408 0x1408
94#define HUAWEI_PRODUCT_E1409 0x1409
95#define HUAWEI_PRODUCT_E140A 0x140A
96#define HUAWEI_PRODUCT_E140B 0x140B
97#define HUAWEI_PRODUCT_E140C 0x140C
98#define HUAWEI_PRODUCT_E140D 0x140D
99#define HUAWEI_PRODUCT_E140E 0x140E
100#define HUAWEI_PRODUCT_E140F 0x140F
101#define HUAWEI_PRODUCT_E1410 0x1410
102#define HUAWEI_PRODUCT_E1411 0x1411
103#define HUAWEI_PRODUCT_E1412 0x1412
104#define HUAWEI_PRODUCT_E1413 0x1413
105#define HUAWEI_PRODUCT_E1414 0x1414
106#define HUAWEI_PRODUCT_E1415 0x1415
107#define HUAWEI_PRODUCT_E1416 0x1416
108#define HUAWEI_PRODUCT_E1417 0x1417
109#define HUAWEI_PRODUCT_E1418 0x1418
110#define HUAWEI_PRODUCT_E1419 0x1419
111#define HUAWEI_PRODUCT_E141A 0x141A
112#define HUAWEI_PRODUCT_E141B 0x141B
113#define HUAWEI_PRODUCT_E141C 0x141C
114#define HUAWEI_PRODUCT_E141D 0x141D
115#define HUAWEI_PRODUCT_E141E 0x141E
116#define HUAWEI_PRODUCT_E141F 0x141F
117#define HUAWEI_PRODUCT_E1420 0x1420
118#define HUAWEI_PRODUCT_E1421 0x1421
119#define HUAWEI_PRODUCT_E1422 0x1422
120#define HUAWEI_PRODUCT_E1423 0x1423
121#define HUAWEI_PRODUCT_E1424 0x1424
122#define HUAWEI_PRODUCT_E1425 0x1425
123#define HUAWEI_PRODUCT_E1426 0x1426
124#define HUAWEI_PRODUCT_E1427 0x1427
125#define HUAWEI_PRODUCT_E1428 0x1428
126#define HUAWEI_PRODUCT_E1429 0x1429
127#define HUAWEI_PRODUCT_E142A 0x142A
128#define HUAWEI_PRODUCT_E142B 0x142B
129#define HUAWEI_PRODUCT_E142C 0x142C
130#define HUAWEI_PRODUCT_E142D 0x142D
131#define HUAWEI_PRODUCT_E142E 0x142E
132#define HUAWEI_PRODUCT_E142F 0x142F
133#define HUAWEI_PRODUCT_E1430 0x1430
134#define HUAWEI_PRODUCT_E1431 0x1431
135#define HUAWEI_PRODUCT_E1432 0x1432
136#define HUAWEI_PRODUCT_E1433 0x1433
137#define HUAWEI_PRODUCT_E1434 0x1434
138#define HUAWEI_PRODUCT_E1435 0x1435
139#define HUAWEI_PRODUCT_E1436 0x1436
140#define HUAWEI_PRODUCT_E1437 0x1437
141#define HUAWEI_PRODUCT_E1438 0x1438
142#define HUAWEI_PRODUCT_E1439 0x1439
143#define HUAWEI_PRODUCT_E143A 0x143A
144#define HUAWEI_PRODUCT_E143B 0x143B
145#define HUAWEI_PRODUCT_E143C 0x143C
146#define HUAWEI_PRODUCT_E143D 0x143D
147#define HUAWEI_PRODUCT_E143E 0x143E
148#define HUAWEI_PRODUCT_E143F 0x143F
149#define HUAWEI_PRODUCT_K4505 0x1464 83#define HUAWEI_PRODUCT_K4505 0x1464
150#define HUAWEI_PRODUCT_K3765 0x1465 84#define HUAWEI_PRODUCT_K3765 0x1465
151#define HUAWEI_PRODUCT_E14AC 0x14AC
152#define HUAWEI_PRODUCT_K3806 0x14AE
153#define HUAWEI_PRODUCT_K4605 0x14C6 85#define HUAWEI_PRODUCT_K4605 0x14C6
154#define HUAWEI_PRODUCT_K5005 0x14C8
155#define HUAWEI_PRODUCT_K3770 0x14C9
156#define HUAWEI_PRODUCT_K3771 0x14CA
157#define HUAWEI_PRODUCT_K4510 0x14CB
158#define HUAWEI_PRODUCT_K4511 0x14CC
159#define HUAWEI_PRODUCT_ETS1220 0x1803
160#define HUAWEI_PRODUCT_E353 0x1506
161#define HUAWEI_PRODUCT_E173S 0x1C05
162 86
163#define QUANTA_VENDOR_ID 0x0408 87#define QUANTA_VENDOR_ID 0x0408
164#define QUANTA_PRODUCT_Q101 0xEA02 88#define QUANTA_PRODUCT_Q101 0xEA02
@@ -615,104 +539,123 @@ static const struct usb_device_id option_ids[] = {
615 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) }, 539 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) },
616 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) }, 540 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) },
617 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, 541 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
618 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
619 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
620 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
621 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) },
622 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1402, 0xff, 0xff, 0xff) },
623 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) },
624 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1404, 0xff, 0xff, 0xff) },
625 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) },
626 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) },
627 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1407, 0xff, 0xff, 0xff) },
628 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) },
629 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) },
630 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140A, 0xff, 0xff, 0xff) },
631 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140B, 0xff, 0xff, 0xff) },
632 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140C, 0xff, 0xff, 0xff) },
633 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140D, 0xff, 0xff, 0xff) },
634 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140E, 0xff, 0xff, 0xff) },
635 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140F, 0xff, 0xff, 0xff) },
636 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) },
637 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) },
638 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) },
639 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413, 0xff, 0xff, 0xff) },
640 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414, 0xff, 0xff, 0xff) },
641 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415, 0xff, 0xff, 0xff) },
642 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416, 0xff, 0xff, 0xff) },
643 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) },
644 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) },
645 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) },
646 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141A, 0xff, 0xff, 0xff) },
647 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141B, 0xff, 0xff, 0xff) },
648 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141C, 0xff, 0xff, 0xff) },
649 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141D, 0xff, 0xff, 0xff) },
650 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141E, 0xff, 0xff, 0xff) },
651 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141F, 0xff, 0xff, 0xff) },
652 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1420, 0xff, 0xff, 0xff) },
653 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1421, 0xff, 0xff, 0xff) },
654 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1422, 0xff, 0xff, 0xff) },
655 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1423, 0xff, 0xff, 0xff) },
656 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1424, 0xff, 0xff, 0xff) },
657 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1425, 0xff, 0xff, 0xff) },
658 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1426, 0xff, 0xff, 0xff) },
659 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1427, 0xff, 0xff, 0xff) },
660 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1428, 0xff, 0xff, 0xff) },
661 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1429, 0xff, 0xff, 0xff) },
662 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142A, 0xff, 0xff, 0xff) },
663 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142B, 0xff, 0xff, 0xff) },
664 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142C, 0xff, 0xff, 0xff) },
665 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142D, 0xff, 0xff, 0xff) },
666 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142E, 0xff, 0xff, 0xff) },
667 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142F, 0xff, 0xff, 0xff) },
668 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1430, 0xff, 0xff, 0xff) },
669 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1431, 0xff, 0xff, 0xff) },
670 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1432, 0xff, 0xff, 0xff) },
671 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1433, 0xff, 0xff, 0xff) },
672 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1434, 0xff, 0xff, 0xff) },
673 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1435, 0xff, 0xff, 0xff) },
674 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1436, 0xff, 0xff, 0xff) },
675 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1437, 0xff, 0xff, 0xff) },
676 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1438, 0xff, 0xff, 0xff) },
677 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1439, 0xff, 0xff, 0xff) },
678 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143A, 0xff, 0xff, 0xff) },
679 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143B, 0xff, 0xff, 0xff) },
680 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143C, 0xff, 0xff, 0xff) },
681 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
682 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
683 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
684 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
685 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), 542 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
686 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 543 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
687 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), 544 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
688 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 545 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
689 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
690 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) },
691 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) },
692 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), 546 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff),
693 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 547 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
694 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0x01, 0x31) }, 548 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
695 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0x01, 0x32) }, 549 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x01) },
696 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x31) }, 550 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x02) },
697 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x32) }, 551 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x03) },
698 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x33) }, 552 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x04) },
699 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, 553 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x05) },
700 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, 554 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x06) },
701 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, 555 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0A) },
702 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x32) }, 556 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0B) },
703 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4510, 0xff, 0x01, 0x31) }, 557 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0D) },
704 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4510, 0xff, 0x01, 0x32) }, 558 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0E) },
705 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x31) }, 559 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0F) },
706 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x32) }, 560 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x10) },
707 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, 561 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x12) },
708 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, 562 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x13) },
709 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, 563 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x14) },
710 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x10) }, 564 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x15) },
711 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x12) }, 565 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x17) },
712 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x13) }, 566 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x18) },
713 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x01) }, /* E398 3G Modem */ 567 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x19) },
714 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x02) }, /* E398 3G PC UI Interface */ 568 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1A) },
715 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x03) }, /* E398 3G Application Interface */ 569 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1B) },
570 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1C) },
571 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x31) },
572 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x32) },
573 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x33) },
574 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x34) },
575 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x35) },
576 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x36) },
577 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3A) },
578 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3B) },
579 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3D) },
580 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3E) },
581 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3F) },
582 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x48) },
583 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x49) },
584 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4A) },
585 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4B) },
586 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4C) },
587 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x61) },
588 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x62) },
589 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x63) },
590 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x64) },
591 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x65) },
592 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x66) },
593 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6A) },
594 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6B) },
595 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) },
596 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) },
597 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) },
598 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) },
599 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) },
600 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) },
601 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7B) },
602 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7C) },
603 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x01) },
604 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x02) },
605 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x03) },
606 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x04) },
607 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x05) },
608 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x06) },
609 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0A) },
610 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0B) },
611 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0D) },
612 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0E) },
613 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0F) },
614 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x10) },
615 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x12) },
616 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x13) },
617 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x14) },
618 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x15) },
619 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x17) },
620 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x18) },
621 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x19) },
622 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1A) },
623 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1B) },
624 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1C) },
625 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x31) },
626 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x32) },
627 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x33) },
628 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x34) },
629 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x35) },
630 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x36) },
631 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3A) },
632 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3B) },
633 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3D) },
634 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3E) },
635 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3F) },
636 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x48) },
637 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x49) },
638 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4A) },
639 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4B) },
640 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4C) },
641 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x61) },
642 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x62) },
643 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x63) },
644 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x64) },
645 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x65) },
646 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x66) },
647 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6A) },
648 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6B) },
649 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) },
650 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) },
651 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) },
652 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) },
653 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) },
654 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) },
655 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7B) },
656 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7C) },
657
658
716 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, 659 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
717 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, 660 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) },
718 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, 661 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
@@ -943,6 +886,8 @@ static const struct usb_device_id option_ids[] = {
943 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), 886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
944 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 887 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
945 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, 888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff),
890 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
946 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, 891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
947 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, 892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
948 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) }, 893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
@@ -1297,8 +1242,8 @@ static struct usb_serial_driver option_1port_device = {
1297 .tiocmset = usb_wwan_tiocmset, 1242 .tiocmset = usb_wwan_tiocmset,
1298 .ioctl = usb_wwan_ioctl, 1243 .ioctl = usb_wwan_ioctl,
1299 .attach = usb_wwan_startup, 1244 .attach = usb_wwan_startup,
1300 .disconnect = usb_wwan_disconnect,
1301 .release = option_release, 1245 .release = option_release,
1246 .port_remove = usb_wwan_port_remove,
1302 .read_int_callback = option_instat_callback, 1247 .read_int_callback = option_instat_callback,
1303#ifdef CONFIG_PM 1248#ifdef CONFIG_PM
1304 .suspend = usb_wwan_suspend, 1249 .suspend = usb_wwan_suspend,
@@ -1414,8 +1359,6 @@ static void option_release(struct usb_serial *serial)
1414 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); 1359 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
1415 struct option_private *priv = intfdata->private; 1360 struct option_private *priv = intfdata->private;
1416 1361
1417 usb_wwan_release(serial);
1418
1419 kfree(priv); 1362 kfree(priv);
1420 kfree(intfdata); 1363 kfree(intfdata);
1421} 1364}
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 8d103019d6aa..bfd50779f0c9 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -199,43 +199,49 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
199 199
200 /* default to enabling interface */ 200 /* default to enabling interface */
201 altsetting = 0; 201 altsetting = 0;
202 switch (ifnum) {
203 /* Composite mode; don't bind to the QMI/net interface as that
204 * gets handled by other drivers.
205 */
206 202
203 /* Composite mode; don't bind to the QMI/net interface as that
204 * gets handled by other drivers.
205 */
206
207 if (is_gobi1k) {
207 /* Gobi 1K USB layout: 208 /* Gobi 1K USB layout:
208 * 0: serial port (doesn't respond) 209 * 0: serial port (doesn't respond)
209 * 1: serial port (doesn't respond) 210 * 1: serial port (doesn't respond)
210 * 2: AT-capable modem port 211 * 2: AT-capable modem port
211 * 3: QMI/net 212 * 3: QMI/net
212 * 213 */
213 * Gobi 2K+ USB layout: 214 if (ifnum == 2)
215 dev_dbg(dev, "Modem port found\n");
216 else
217 altsetting = -1;
218 } else {
219 /* Gobi 2K+ USB layout:
214 * 0: QMI/net 220 * 0: QMI/net
215 * 1: DM/DIAG (use libqcdm from ModemManager for communication) 221 * 1: DM/DIAG (use libqcdm from ModemManager for communication)
216 * 2: AT-capable modem port 222 * 2: AT-capable modem port
217 * 3: NMEA 223 * 3: NMEA
218 */ 224 */
219 225 switch (ifnum) {
220 case 1: 226 case 0:
221 if (is_gobi1k) 227 /* Don't claim the QMI/net interface */
222 altsetting = -1; 228 altsetting = -1;
223 else 229 break;
230 case 1:
224 dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); 231 dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n");
225 break; 232 break;
226 case 2: 233 case 2:
227 dev_dbg(dev, "Modem port found\n"); 234 dev_dbg(dev, "Modem port found\n");
228 break; 235 break;
229 case 3: 236 case 3:
230 if (is_gobi1k)
231 altsetting = -1;
232 else
233 /* 237 /*
234 * NMEA (serial line 9600 8N1) 238 * NMEA (serial line 9600 8N1)
235 * # echo "\$GPS_START" > /dev/ttyUSBx 239 * # echo "\$GPS_START" > /dev/ttyUSBx
236 * # echo "\$GPS_STOP" > /dev/ttyUSBx 240 * # echo "\$GPS_STOP" > /dev/ttyUSBx
237 */ 241 */
238 dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); 242 dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n");
243 break;
244 }
239 } 245 }
240 246
241done: 247done:
@@ -262,8 +268,7 @@ static void qc_release(struct usb_serial *serial)
262{ 268{
263 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); 269 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
264 270
265 /* Call usb_wwan release & free the private data allocated in qcprobe */ 271 /* Free the private data allocated in qcprobe */
266 usb_wwan_release(serial);
267 usb_set_serial_data(serial, NULL); 272 usb_set_serial_data(serial, NULL);
268 kfree(priv); 273 kfree(priv);
269} 274}
@@ -283,8 +288,8 @@ static struct usb_serial_driver qcdevice = {
283 .write_room = usb_wwan_write_room, 288 .write_room = usb_wwan_write_room,
284 .chars_in_buffer = usb_wwan_chars_in_buffer, 289 .chars_in_buffer = usb_wwan_chars_in_buffer,
285 .attach = usb_wwan_startup, 290 .attach = usb_wwan_startup,
286 .disconnect = usb_wwan_disconnect,
287 .release = qc_release, 291 .release = qc_release,
292 .port_remove = usb_wwan_port_remove,
288#ifdef CONFIG_PM 293#ifdef CONFIG_PM
289 .suspend = usb_wwan_suspend, 294 .suspend = usb_wwan_suspend,
290 .resume = usb_wwan_resume, 295 .resume = usb_wwan_resume,
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
index c47b6ec03063..1f034d2397c6 100644
--- a/drivers/usb/serial/usb-wwan.h
+++ b/drivers/usb/serial/usb-wwan.h
@@ -9,8 +9,7 @@ extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
9extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); 9extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
10extern void usb_wwan_close(struct usb_serial_port *port); 10extern void usb_wwan_close(struct usb_serial_port *port);
11extern int usb_wwan_startup(struct usb_serial *serial); 11extern int usb_wwan_startup(struct usb_serial *serial);
12extern void usb_wwan_disconnect(struct usb_serial *serial); 12extern int usb_wwan_port_remove(struct usb_serial_port *port);
13extern void usb_wwan_release(struct usb_serial *serial);
14extern int usb_wwan_write_room(struct tty_struct *tty); 13extern int usb_wwan_write_room(struct tty_struct *tty);
15extern void usb_wwan_set_termios(struct tty_struct *tty, 14extern void usb_wwan_set_termios(struct tty_struct *tty,
16 struct usb_serial_port *port, 15 struct usb_serial_port *port,
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index f35971dff4a5..6855d5ed0331 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -565,62 +565,52 @@ bail_out_error:
565} 565}
566EXPORT_SYMBOL(usb_wwan_startup); 566EXPORT_SYMBOL(usb_wwan_startup);
567 567
568static void stop_read_write_urbs(struct usb_serial *serial) 568int usb_wwan_port_remove(struct usb_serial_port *port)
569{ 569{
570 int i, j; 570 int i;
571 struct usb_serial_port *port;
572 struct usb_wwan_port_private *portdata; 571 struct usb_wwan_port_private *portdata;
573 572
574 /* Stop reading/writing urbs */ 573 portdata = usb_get_serial_port_data(port);
575 for (i = 0; i < serial->num_ports; ++i) { 574 usb_set_serial_port_data(port, NULL);
576 port = serial->port[i]; 575
577 portdata = usb_get_serial_port_data(port); 576 /* Stop reading/writing urbs and free them */
578 for (j = 0; j < N_IN_URB; j++) 577 for (i = 0; i < N_IN_URB; i++) {
579 usb_kill_urb(portdata->in_urbs[j]); 578 usb_kill_urb(portdata->in_urbs[i]);
580 for (j = 0; j < N_OUT_URB; j++) 579 usb_free_urb(portdata->in_urbs[i]);
581 usb_kill_urb(portdata->out_urbs[j]); 580 free_page((unsigned long)portdata->in_buffer[i]);
581 }
582 for (i = 0; i < N_OUT_URB; i++) {
583 usb_kill_urb(portdata->out_urbs[i]);
584 usb_free_urb(portdata->out_urbs[i]);
585 kfree(portdata->out_buffer[i]);
582 } 586 }
583}
584 587
585void usb_wwan_disconnect(struct usb_serial *serial) 588 /* Now free port private data */
586{ 589 kfree(portdata);
587 stop_read_write_urbs(serial); 590 return 0;
588} 591}
589EXPORT_SYMBOL(usb_wwan_disconnect); 592EXPORT_SYMBOL(usb_wwan_port_remove);
590 593
591void usb_wwan_release(struct usb_serial *serial) 594#ifdef CONFIG_PM
595static void stop_read_write_urbs(struct usb_serial *serial)
592{ 596{
593 int i, j; 597 int i, j;
594 struct usb_serial_port *port; 598 struct usb_serial_port *port;
595 struct usb_wwan_port_private *portdata; 599 struct usb_wwan_port_private *portdata;
596 600
597 /* Now free them */ 601 /* Stop reading/writing urbs */
598 for (i = 0; i < serial->num_ports; ++i) { 602 for (i = 0; i < serial->num_ports; ++i) {
599 port = serial->port[i]; 603 port = serial->port[i];
600 portdata = usb_get_serial_port_data(port); 604 portdata = usb_get_serial_port_data(port);
601 605 if (!portdata)
602 for (j = 0; j < N_IN_URB; j++) { 606 continue;
603 usb_free_urb(portdata->in_urbs[j]); 607 for (j = 0; j < N_IN_URB; j++)
604 free_page((unsigned long) 608 usb_kill_urb(portdata->in_urbs[j]);
605 portdata->in_buffer[j]); 609 for (j = 0; j < N_OUT_URB; j++)
606 portdata->in_urbs[j] = NULL; 610 usb_kill_urb(portdata->out_urbs[j]);
607 }
608 for (j = 0; j < N_OUT_URB; j++) {
609 usb_free_urb(portdata->out_urbs[j]);
610 kfree(portdata->out_buffer[j]);
611 portdata->out_urbs[j] = NULL;
612 }
613 }
614
615 /* Now free per port private data */
616 for (i = 0; i < serial->num_ports; i++) {
617 port = serial->port[i];
618 kfree(usb_get_serial_port_data(port));
619 } 611 }
620} 612}
621EXPORT_SYMBOL(usb_wwan_release);
622 613
623#ifdef CONFIG_PM
624int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message) 614int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message)
625{ 615{
626 struct usb_wwan_intf_private *intfdata = serial->private; 616 struct usb_wwan_intf_private *intfdata = serial->private;
@@ -712,7 +702,7 @@ int usb_wwan_resume(struct usb_serial *serial)
712 702
713 /* skip closed ports */ 703 /* skip closed ports */
714 spin_lock_irq(&intfdata->susp_lock); 704 spin_lock_irq(&intfdata->susp_lock);
715 if (!portdata->opened) { 705 if (!portdata || !portdata->opened) {
716 spin_unlock_irq(&intfdata->susp_lock); 706 spin_unlock_irq(&intfdata->susp_lock);
717 continue; 707 continue;
718 } 708 }
diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index e4e2fd1b5107..202bba6c997c 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -9,3 +9,6 @@ config VHOST_NET
9 To compile this driver as a module, choose M here: the module will 9 To compile this driver as a module, choose M here: the module will
10 be called vhost_net. 10 be called vhost_net.
11 11
12if STAGING
13source "drivers/vhost/Kconfig.tcm"
14endif
diff --git a/drivers/vhost/Kconfig.tcm b/drivers/vhost/Kconfig.tcm
new file mode 100644
index 000000000000..a9c6f76e3208
--- /dev/null
+++ b/drivers/vhost/Kconfig.tcm
@@ -0,0 +1,6 @@
1config TCM_VHOST
2 tristate "TCM_VHOST fabric module (EXPERIMENTAL)"
3 depends on TARGET_CORE && EVENTFD && EXPERIMENTAL && m
4 default n
5 ---help---
6 Say M here to enable the TCM_VHOST fabric module for use with virtio-scsi guests
diff --git a/drivers/vhost/Makefile b/drivers/vhost/Makefile
index 72dd02050bb9..a27b053bc9ab 100644
--- a/drivers/vhost/Makefile
+++ b/drivers/vhost/Makefile
@@ -1,2 +1,4 @@
1obj-$(CONFIG_VHOST_NET) += vhost_net.o 1obj-$(CONFIG_VHOST_NET) += vhost_net.o
2vhost_net-y := vhost.o net.o 2vhost_net-y := vhost.o net.o
3
4obj-$(CONFIG_TCM_VHOST) += tcm_vhost.o
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
new file mode 100644
index 000000000000..fb366540ed54
--- /dev/null
+++ b/drivers/vhost/tcm_vhost.c
@@ -0,0 +1,1628 @@
1/*******************************************************************************
2 * Vhost kernel TCM fabric driver for virtio SCSI initiators
3 *
4 * (C) Copyright 2010-2012 RisingTide Systems LLC.
5 * (C) Copyright 2010-2012 IBM Corp.
6 *
7 * Licensed to the Linux Foundation under the General Public License (GPL) version 2.
8 *
9 * Authors: Nicholas A. Bellinger <nab@risingtidesystems.com>
10 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 ****************************************************************************/
23
24#include <linux/module.h>
25#include <linux/moduleparam.h>
26#include <generated/utsrelease.h>
27#include <linux/utsname.h>
28#include <linux/init.h>
29#include <linux/slab.h>
30#include <linux/kthread.h>
31#include <linux/types.h>
32#include <linux/string.h>
33#include <linux/configfs.h>
34#include <linux/ctype.h>
35#include <linux/compat.h>
36#include <linux/eventfd.h>
37#include <linux/vhost.h>
38#include <linux/fs.h>
39#include <linux/miscdevice.h>
40#include <asm/unaligned.h>
41#include <scsi/scsi.h>
42#include <scsi/scsi_tcq.h>
43#include <target/target_core_base.h>
44#include <target/target_core_fabric.h>
45#include <target/target_core_fabric_configfs.h>
46#include <target/target_core_configfs.h>
47#include <target/configfs_macros.h>
48#include <linux/vhost.h>
49#include <linux/virtio_net.h> /* TODO vhost.h currently depends on this */
50#include <linux/virtio_scsi.h>
51
52#include "vhost.c"
53#include "vhost.h"
54#include "tcm_vhost.h"
55
56struct vhost_scsi {
57 atomic_t vhost_ref_cnt;
58 struct tcm_vhost_tpg *vs_tpg;
59 struct vhost_dev dev;
60 struct vhost_virtqueue vqs[3];
61
62 struct vhost_work vs_completion_work; /* cmd completion work item */
63 struct list_head vs_completion_list; /* cmd completion queue */
64 spinlock_t vs_completion_lock; /* protects s_completion_list */
65};
66
67/* Local pointer to allocated TCM configfs fabric module */
68static struct target_fabric_configfs *tcm_vhost_fabric_configfs;
69
70static struct workqueue_struct *tcm_vhost_workqueue;
71
72/* Global spinlock to protect tcm_vhost TPG list for vhost IOCTL access */
73static DEFINE_MUTEX(tcm_vhost_mutex);
74static LIST_HEAD(tcm_vhost_list);
75
76static int tcm_vhost_check_true(struct se_portal_group *se_tpg)
77{
78 return 1;
79}
80
81static int tcm_vhost_check_false(struct se_portal_group *se_tpg)
82{
83 return 0;
84}
85
86static char *tcm_vhost_get_fabric_name(void)
87{
88 return "vhost";
89}
90
91static u8 tcm_vhost_get_fabric_proto_ident(struct se_portal_group *se_tpg)
92{
93 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
94 struct tcm_vhost_tpg, se_tpg);
95 struct tcm_vhost_tport *tport = tpg->tport;
96
97 switch (tport->tport_proto_id) {
98 case SCSI_PROTOCOL_SAS:
99 return sas_get_fabric_proto_ident(se_tpg);
100 case SCSI_PROTOCOL_FCP:
101 return fc_get_fabric_proto_ident(se_tpg);
102 case SCSI_PROTOCOL_ISCSI:
103 return iscsi_get_fabric_proto_ident(se_tpg);
104 default:
105 pr_err("Unknown tport_proto_id: 0x%02x, using"
106 " SAS emulation\n", tport->tport_proto_id);
107 break;
108 }
109
110 return sas_get_fabric_proto_ident(se_tpg);
111}
112
113static char *tcm_vhost_get_fabric_wwn(struct se_portal_group *se_tpg)
114{
115 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
116 struct tcm_vhost_tpg, se_tpg);
117 struct tcm_vhost_tport *tport = tpg->tport;
118
119 return &tport->tport_name[0];
120}
121
122static u16 tcm_vhost_get_tag(struct se_portal_group *se_tpg)
123{
124 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
125 struct tcm_vhost_tpg, se_tpg);
126 return tpg->tport_tpgt;
127}
128
129static u32 tcm_vhost_get_default_depth(struct se_portal_group *se_tpg)
130{
131 return 1;
132}
133
134static u32 tcm_vhost_get_pr_transport_id(
135 struct se_portal_group *se_tpg,
136 struct se_node_acl *se_nacl,
137 struct t10_pr_registration *pr_reg,
138 int *format_code,
139 unsigned char *buf)
140{
141 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
142 struct tcm_vhost_tpg, se_tpg);
143 struct tcm_vhost_tport *tport = tpg->tport;
144
145 switch (tport->tport_proto_id) {
146 case SCSI_PROTOCOL_SAS:
147 return sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
148 format_code, buf);
149 case SCSI_PROTOCOL_FCP:
150 return fc_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
151 format_code, buf);
152 case SCSI_PROTOCOL_ISCSI:
153 return iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
154 format_code, buf);
155 default:
156 pr_err("Unknown tport_proto_id: 0x%02x, using"
157 " SAS emulation\n", tport->tport_proto_id);
158 break;
159 }
160
161 return sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,
162 format_code, buf);
163}
164
165static u32 tcm_vhost_get_pr_transport_id_len(
166 struct se_portal_group *se_tpg,
167 struct se_node_acl *se_nacl,
168 struct t10_pr_registration *pr_reg,
169 int *format_code)
170{
171 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
172 struct tcm_vhost_tpg, se_tpg);
173 struct tcm_vhost_tport *tport = tpg->tport;
174
175 switch (tport->tport_proto_id) {
176 case SCSI_PROTOCOL_SAS:
177 return sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
178 format_code);
179 case SCSI_PROTOCOL_FCP:
180 return fc_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
181 format_code);
182 case SCSI_PROTOCOL_ISCSI:
183 return iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
184 format_code);
185 default:
186 pr_err("Unknown tport_proto_id: 0x%02x, using"
187 " SAS emulation\n", tport->tport_proto_id);
188 break;
189 }
190
191 return sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,
192 format_code);
193}
194
195static char *tcm_vhost_parse_pr_out_transport_id(
196 struct se_portal_group *se_tpg,
197 const char *buf,
198 u32 *out_tid_len,
199 char **port_nexus_ptr)
200{
201 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
202 struct tcm_vhost_tpg, se_tpg);
203 struct tcm_vhost_tport *tport = tpg->tport;
204
205 switch (tport->tport_proto_id) {
206 case SCSI_PROTOCOL_SAS:
207 return sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
208 port_nexus_ptr);
209 case SCSI_PROTOCOL_FCP:
210 return fc_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
211 port_nexus_ptr);
212 case SCSI_PROTOCOL_ISCSI:
213 return iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
214 port_nexus_ptr);
215 default:
216 pr_err("Unknown tport_proto_id: 0x%02x, using"
217 " SAS emulation\n", tport->tport_proto_id);
218 break;
219 }
220
221 return sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,
222 port_nexus_ptr);
223}
224
225static struct se_node_acl *tcm_vhost_alloc_fabric_acl(
226 struct se_portal_group *se_tpg)
227{
228 struct tcm_vhost_nacl *nacl;
229
230 nacl = kzalloc(sizeof(struct tcm_vhost_nacl), GFP_KERNEL);
231 if (!nacl) {
232 pr_err("Unable to alocate struct tcm_vhost_nacl\n");
233 return NULL;
234 }
235
236 return &nacl->se_node_acl;
237}
238
239static void tcm_vhost_release_fabric_acl(
240 struct se_portal_group *se_tpg,
241 struct se_node_acl *se_nacl)
242{
243 struct tcm_vhost_nacl *nacl = container_of(se_nacl,
244 struct tcm_vhost_nacl, se_node_acl);
245 kfree(nacl);
246}
247
248static u32 tcm_vhost_tpg_get_inst_index(struct se_portal_group *se_tpg)
249{
250 return 1;
251}
252
253static void tcm_vhost_release_cmd(struct se_cmd *se_cmd)
254{
255 return;
256}
257
258static int tcm_vhost_shutdown_session(struct se_session *se_sess)
259{
260 return 0;
261}
262
263static void tcm_vhost_close_session(struct se_session *se_sess)
264{
265 return;
266}
267
268static u32 tcm_vhost_sess_get_index(struct se_session *se_sess)
269{
270 return 0;
271}
272
273static int tcm_vhost_write_pending(struct se_cmd *se_cmd)
274{
275 /* Go ahead and process the write immediately */
276 target_execute_cmd(se_cmd);
277 return 0;
278}
279
280static int tcm_vhost_write_pending_status(struct se_cmd *se_cmd)
281{
282 return 0;
283}
284
285static void tcm_vhost_set_default_node_attrs(struct se_node_acl *nacl)
286{
287 return;
288}
289
290static u32 tcm_vhost_get_task_tag(struct se_cmd *se_cmd)
291{
292 return 0;
293}
294
295static int tcm_vhost_get_cmd_state(struct se_cmd *se_cmd)
296{
297 return 0;
298}
299
300static void vhost_scsi_complete_cmd(struct tcm_vhost_cmd *);
301
302static int tcm_vhost_queue_data_in(struct se_cmd *se_cmd)
303{
304 struct tcm_vhost_cmd *tv_cmd = container_of(se_cmd,
305 struct tcm_vhost_cmd, tvc_se_cmd);
306 vhost_scsi_complete_cmd(tv_cmd);
307 return 0;
308}
309
310static int tcm_vhost_queue_status(struct se_cmd *se_cmd)
311{
312 struct tcm_vhost_cmd *tv_cmd = container_of(se_cmd,
313 struct tcm_vhost_cmd, tvc_se_cmd);
314 vhost_scsi_complete_cmd(tv_cmd);
315 return 0;
316}
317
318static int tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd)
319{
320 return 0;
321}
322
323static u16 tcm_vhost_set_fabric_sense_len(struct se_cmd *se_cmd,
324 u32 sense_length)
325{
326 return 0;
327}
328
329static u16 tcm_vhost_get_fabric_sense_len(void)
330{
331 return 0;
332}
333
334static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd)
335{
336 struct se_cmd *se_cmd = &tv_cmd->tvc_se_cmd;
337
338 /* TODO locking against target/backend threads? */
339 transport_generic_free_cmd(se_cmd, 1);
340
341 if (tv_cmd->tvc_sgl_count) {
342 u32 i;
343 for (i = 0; i < tv_cmd->tvc_sgl_count; i++)
344 put_page(sg_page(&tv_cmd->tvc_sgl[i]));
345
346 kfree(tv_cmd->tvc_sgl);
347 }
348
349 kfree(tv_cmd);
350}
351
352/* Dequeue a command from the completion list */
353static struct tcm_vhost_cmd *vhost_scsi_get_cmd_from_completion(
354 struct vhost_scsi *vs)
355{
356 struct tcm_vhost_cmd *tv_cmd = NULL;
357
358 spin_lock_bh(&vs->vs_completion_lock);
359 if (list_empty(&vs->vs_completion_list)) {
360 spin_unlock_bh(&vs->vs_completion_lock);
361 return NULL;
362 }
363
364 list_for_each_entry(tv_cmd, &vs->vs_completion_list,
365 tvc_completion_list) {
366 list_del(&tv_cmd->tvc_completion_list);
367 break;
368 }
369 spin_unlock_bh(&vs->vs_completion_lock);
370 return tv_cmd;
371}
372
373/* Fill in status and signal that we are done processing this command
374 *
375 * This is scheduled in the vhost work queue so we are called with the owner
376 * process mm and can access the vring.
377 */
378static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
379{
380 struct vhost_scsi *vs = container_of(work, struct vhost_scsi,
381 vs_completion_work);
382 struct tcm_vhost_cmd *tv_cmd;
383
384 while ((tv_cmd = vhost_scsi_get_cmd_from_completion(vs)) != NULL) {
385 struct virtio_scsi_cmd_resp v_rsp;
386 struct se_cmd *se_cmd = &tv_cmd->tvc_se_cmd;
387 int ret;
388
389 pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__,
390 tv_cmd, se_cmd->residual_count, se_cmd->scsi_status);
391
392 memset(&v_rsp, 0, sizeof(v_rsp));
393 v_rsp.resid = se_cmd->residual_count;
394 /* TODO is status_qualifier field needed? */
395 v_rsp.status = se_cmd->scsi_status;
396 v_rsp.sense_len = se_cmd->scsi_sense_length;
397 memcpy(v_rsp.sense, tv_cmd->tvc_sense_buf,
398 v_rsp.sense_len);
399 ret = copy_to_user(tv_cmd->tvc_resp, &v_rsp, sizeof(v_rsp));
400 if (likely(ret == 0))
401 vhost_add_used(&vs->vqs[2], tv_cmd->tvc_vq_desc, 0);
402 else
403 pr_err("Faulted on virtio_scsi_cmd_resp\n");
404
405 vhost_scsi_free_cmd(tv_cmd);
406 }
407
408 vhost_signal(&vs->dev, &vs->vqs[2]);
409}
410
411static void vhost_scsi_complete_cmd(struct tcm_vhost_cmd *tv_cmd)
412{
413 struct vhost_scsi *vs = tv_cmd->tvc_vhost;
414
415 pr_debug("%s tv_cmd %p\n", __func__, tv_cmd);
416
417 spin_lock_bh(&vs->vs_completion_lock);
418 list_add_tail(&tv_cmd->tvc_completion_list, &vs->vs_completion_list);
419 spin_unlock_bh(&vs->vs_completion_lock);
420
421 vhost_work_queue(&vs->dev, &vs->vs_completion_work);
422}
423
424static struct tcm_vhost_cmd *vhost_scsi_allocate_cmd(
425 struct tcm_vhost_tpg *tv_tpg,
426 struct virtio_scsi_cmd_req *v_req,
427 u32 exp_data_len,
428 int data_direction)
429{
430 struct tcm_vhost_cmd *tv_cmd;
431 struct tcm_vhost_nexus *tv_nexus;
432 struct se_portal_group *se_tpg = &tv_tpg->se_tpg;
433 struct se_session *se_sess;
434 struct se_cmd *se_cmd;
435 int sam_task_attr;
436
437 tv_nexus = tv_tpg->tpg_nexus;
438 if (!tv_nexus) {
439 pr_err("Unable to locate active struct tcm_vhost_nexus\n");
440 return ERR_PTR(-EIO);
441 }
442 se_sess = tv_nexus->tvn_se_sess;
443
444 tv_cmd = kzalloc(sizeof(struct tcm_vhost_cmd), GFP_ATOMIC);
445 if (!tv_cmd) {
446 pr_err("Unable to allocate struct tcm_vhost_cmd\n");
447 return ERR_PTR(-ENOMEM);
448 }
449 INIT_LIST_HEAD(&tv_cmd->tvc_completion_list);
450 tv_cmd->tvc_tag = v_req->tag;
451
452 se_cmd = &tv_cmd->tvc_se_cmd;
453 /*
454 * Locate the SAM Task Attr from virtio_scsi_cmd_req
455 */
456 sam_task_attr = v_req->task_attr;
457 /*
458 * Initialize struct se_cmd descriptor from TCM infrastructure
459 */
460 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, exp_data_len,
461 data_direction, sam_task_attr,
462 &tv_cmd->tvc_sense_buf[0]);
463
464#if 0 /* FIXME: vhost_scsi_allocate_cmd() BIDI operation */
465 if (bidi)
466 se_cmd->se_cmd_flags |= SCF_BIDI;
467#endif
468 return tv_cmd;
469}
470
471/*
472 * Map a user memory range into a scatterlist
473 *
474 * Returns the number of scatterlist entries used or -errno on error.
475 */
476static int vhost_scsi_map_to_sgl(struct scatterlist *sgl,
477 unsigned int sgl_count, void __user *ptr, size_t len, int write)
478{
479 struct scatterlist *sg = sgl;
480 unsigned int npages = 0;
481 int ret;
482
483 while (len > 0) {
484 struct page *page;
485 unsigned int offset = (uintptr_t)ptr & ~PAGE_MASK;
486 unsigned int nbytes = min_t(unsigned int,
487 PAGE_SIZE - offset, len);
488
489 if (npages == sgl_count) {
490 ret = -ENOBUFS;
491 goto err;
492 }
493
494 ret = get_user_pages_fast((unsigned long)ptr, 1, write, &page);
495 BUG_ON(ret == 0); /* we should either get our page or fail */
496 if (ret < 0)
497 goto err;
498
499 sg_set_page(sg, page, nbytes, offset);
500 ptr += nbytes;
501 len -= nbytes;
502 sg++;
503 npages++;
504 }
505 return npages;
506
507err:
508 /* Put pages that we hold */
509 for (sg = sgl; sg != &sgl[npages]; sg++)
510 put_page(sg_page(sg));
511 return ret;
512}
513
514static int vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *tv_cmd,
515 struct iovec *iov, unsigned int niov, int write)
516{
517 int ret;
518 unsigned int i;
519 u32 sgl_count;
520 struct scatterlist *sg;
521
522 /*
523 * Find out how long sglist needs to be
524 */
525 sgl_count = 0;
526 for (i = 0; i < niov; i++) {
527 sgl_count += (((uintptr_t)iov[i].iov_base + iov[i].iov_len +
528 PAGE_SIZE - 1) >> PAGE_SHIFT) -
529 ((uintptr_t)iov[i].iov_base >> PAGE_SHIFT);
530 }
531 /* TODO overflow checking */
532
533 sg = kmalloc(sizeof(tv_cmd->tvc_sgl[0]) * sgl_count, GFP_ATOMIC);
534 if (!sg)
535 return -ENOMEM;
536 pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
537 sg, sgl_count, IS_ERR(sg));
538 sg_init_table(sg, sgl_count);
539
540 tv_cmd->tvc_sgl = sg;
541 tv_cmd->tvc_sgl_count = sgl_count;
542
543 pr_debug("Mapping %u iovecs for %u pages\n", niov, sgl_count);
544 for (i = 0; i < niov; i++) {
545 ret = vhost_scsi_map_to_sgl(sg, sgl_count, iov[i].iov_base,
546 iov[i].iov_len, write);
547 if (ret < 0) {
548 for (i = 0; i < tv_cmd->tvc_sgl_count; i++)
549 put_page(sg_page(&tv_cmd->tvc_sgl[i]));
550 kfree(tv_cmd->tvc_sgl);
551 tv_cmd->tvc_sgl = NULL;
552 tv_cmd->tvc_sgl_count = 0;
553 return ret;
554 }
555
556 sg += ret;
557 sgl_count -= ret;
558 }
559 return 0;
560}
561
562static void tcm_vhost_submission_work(struct work_struct *work)
563{
564 struct tcm_vhost_cmd *tv_cmd =
565 container_of(work, struct tcm_vhost_cmd, work);
566 struct se_cmd *se_cmd = &tv_cmd->tvc_se_cmd;
567 struct scatterlist *sg_ptr, *sg_bidi_ptr = NULL;
568 int rc, sg_no_bidi = 0;
569 /*
570 * Locate the struct se_lun pointer based on v_req->lun, and
571 * attach it to struct se_cmd
572 */
573 rc = transport_lookup_cmd_lun(&tv_cmd->tvc_se_cmd, tv_cmd->tvc_lun);
574 if (rc < 0) {
575 pr_err("Failed to look up lun: %d\n", tv_cmd->tvc_lun);
576 transport_send_check_condition_and_sense(&tv_cmd->tvc_se_cmd,
577 tv_cmd->tvc_se_cmd.scsi_sense_reason, 0);
578 transport_generic_free_cmd(se_cmd, 0);
579 return;
580 }
581
582 rc = target_setup_cmd_from_cdb(se_cmd, tv_cmd->tvc_cdb);
583 if (rc == -ENOMEM) {
584 transport_send_check_condition_and_sense(se_cmd,
585 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
586 transport_generic_free_cmd(se_cmd, 0);
587 return;
588 } else if (rc < 0) {
589 if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT)
590 tcm_vhost_queue_status(se_cmd);
591 else
592 transport_send_check_condition_and_sense(se_cmd,
593 se_cmd->scsi_sense_reason, 0);
594 transport_generic_free_cmd(se_cmd, 0);
595 return;
596 }
597
598 if (tv_cmd->tvc_sgl_count) {
599 sg_ptr = tv_cmd->tvc_sgl;
600 /*
601 * For BIDI commands, pass in the extra READ buffer
602 * to transport_generic_map_mem_to_cmd() below..
603 */
604/* FIXME: Fix BIDI operation in tcm_vhost_submission_work() */
605#if 0
606 if (se_cmd->se_cmd_flags & SCF_BIDI) {
607 sg_bidi_ptr = NULL;
608 sg_no_bidi = 0;
609 }
610#endif
611 } else {
612 sg_ptr = NULL;
613 }
614
615 rc = transport_generic_map_mem_to_cmd(se_cmd, sg_ptr,
616 tv_cmd->tvc_sgl_count, sg_bidi_ptr,
617 sg_no_bidi);
618 if (rc < 0) {
619 transport_send_check_condition_and_sense(se_cmd,
620 se_cmd->scsi_sense_reason, 0);
621 transport_generic_free_cmd(se_cmd, 0);
622 return;
623 }
624 transport_handle_cdb_direct(se_cmd);
625}
626
627static void vhost_scsi_handle_vq(struct vhost_scsi *vs)
628{
629 struct vhost_virtqueue *vq = &vs->vqs[2];
630 struct virtio_scsi_cmd_req v_req;
631 struct tcm_vhost_tpg *tv_tpg;
632 struct tcm_vhost_cmd *tv_cmd;
633 u32 exp_data_len, data_first, data_num, data_direction;
634 unsigned out, in, i;
635 int head, ret;
636
637 /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */
638 tv_tpg = vs->vs_tpg;
639 if (unlikely(!tv_tpg)) {
640 pr_err("%s endpoint not set\n", __func__);
641 return;
642 }
643
644 mutex_lock(&vq->mutex);
645 vhost_disable_notify(&vs->dev, vq);
646
647 for (;;) {
648 head = vhost_get_vq_desc(&vs->dev, vq, vq->iov,
649 ARRAY_SIZE(vq->iov), &out, &in,
650 NULL, NULL);
651 pr_debug("vhost_get_vq_desc: head: %d, out: %u in: %u\n",
652 head, out, in);
653 /* On error, stop handling until the next kick. */
654 if (unlikely(head < 0))
655 break;
656 /* Nothing new? Wait for eventfd to tell us they refilled. */
657 if (head == vq->num) {
658 if (unlikely(vhost_enable_notify(&vs->dev, vq))) {
659 vhost_disable_notify(&vs->dev, vq);
660 continue;
661 }
662 break;
663 }
664
665/* FIXME: BIDI operation */
666 if (out == 1 && in == 1) {
667 data_direction = DMA_NONE;
668 data_first = 0;
669 data_num = 0;
670 } else if (out == 1 && in > 1) {
671 data_direction = DMA_FROM_DEVICE;
672 data_first = out + 1;
673 data_num = in - 1;
674 } else if (out > 1 && in == 1) {
675 data_direction = DMA_TO_DEVICE;
676 data_first = 1;
677 data_num = out - 1;
678 } else {
679 vq_err(vq, "Invalid buffer layout out: %u in: %u\n",
680 out, in);
681 break;
682 }
683
684 /*
685 * Check for a sane resp buffer so we can report errors to
686 * the guest.
687 */
688 if (unlikely(vq->iov[out].iov_len !=
689 sizeof(struct virtio_scsi_cmd_resp))) {
690 vq_err(vq, "Expecting virtio_scsi_cmd_resp, got %zu"
691 " bytes\n", vq->iov[out].iov_len);
692 break;
693 }
694
695 if (unlikely(vq->iov[0].iov_len != sizeof(v_req))) {
696 vq_err(vq, "Expecting virtio_scsi_cmd_req, got %zu"
697 " bytes\n", vq->iov[0].iov_len);
698 break;
699 }
700 pr_debug("Calling __copy_from_user: vq->iov[0].iov_base: %p,"
701 " len: %zu\n", vq->iov[0].iov_base, sizeof(v_req));
702 ret = __copy_from_user(&v_req, vq->iov[0].iov_base,
703 sizeof(v_req));
704 if (unlikely(ret)) {
705 vq_err(vq, "Faulted on virtio_scsi_cmd_req\n");
706 break;
707 }
708
709 exp_data_len = 0;
710 for (i = 0; i < data_num; i++)
711 exp_data_len += vq->iov[data_first + i].iov_len;
712
713 tv_cmd = vhost_scsi_allocate_cmd(tv_tpg, &v_req,
714 exp_data_len, data_direction);
715 if (IS_ERR(tv_cmd)) {
716 vq_err(vq, "vhost_scsi_allocate_cmd failed %ld\n",
717 PTR_ERR(tv_cmd));
718 break;
719 }
720 pr_debug("Allocated tv_cmd: %p exp_data_len: %d, data_direction"
721 ": %d\n", tv_cmd, exp_data_len, data_direction);
722
723 tv_cmd->tvc_vhost = vs;
724
725 if (unlikely(vq->iov[out].iov_len !=
726 sizeof(struct virtio_scsi_cmd_resp))) {
727 vq_err(vq, "Expecting virtio_scsi_cmd_resp, got %zu"
728 " bytes, out: %d, in: %d\n",
729 vq->iov[out].iov_len, out, in);
730 break;
731 }
732
733 tv_cmd->tvc_resp = vq->iov[out].iov_base;
734
735 /*
736 * Copy in the recieved CDB descriptor into tv_cmd->tvc_cdb
737 * that will be used by tcm_vhost_new_cmd_map() and down into
738 * target_setup_cmd_from_cdb()
739 */
740 memcpy(tv_cmd->tvc_cdb, v_req.cdb, TCM_VHOST_MAX_CDB_SIZE);
741 /*
742 * Check that the recieved CDB size does not exceeded our
743 * hardcoded max for tcm_vhost
744 */
745 /* TODO what if cdb was too small for varlen cdb header? */
746 if (unlikely(scsi_command_size(tv_cmd->tvc_cdb) >
747 TCM_VHOST_MAX_CDB_SIZE)) {
748 vq_err(vq, "Received SCSI CDB with command_size: %d that"
749 " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n",
750 scsi_command_size(tv_cmd->tvc_cdb),
751 TCM_VHOST_MAX_CDB_SIZE);
752 break; /* TODO */
753 }
754 tv_cmd->tvc_lun = ((v_req.lun[2] << 8) | v_req.lun[3]) & 0x3FFF;
755
756 pr_debug("vhost_scsi got command opcode: %#02x, lun: %d\n",
757 tv_cmd->tvc_cdb[0], tv_cmd->tvc_lun);
758
759 if (data_direction != DMA_NONE) {
760 ret = vhost_scsi_map_iov_to_sgl(tv_cmd,
761 &vq->iov[data_first], data_num,
762 data_direction == DMA_TO_DEVICE);
763 if (unlikely(ret)) {
764 vq_err(vq, "Failed to map iov to sgl\n");
765 break; /* TODO */
766 }
767 }
768
769 /*
770 * Save the descriptor from vhost_get_vq_desc() to be used to
771 * complete the virtio-scsi request in TCM callback context via
772 * tcm_vhost_queue_data_in() and tcm_vhost_queue_status()
773 */
774 tv_cmd->tvc_vq_desc = head;
775 /*
776 * Dispatch tv_cmd descriptor for cmwq execution in process
777 * context provided by tcm_vhost_workqueue. This also ensures
778 * tv_cmd is executed on the same kworker CPU as this vhost
779 * thread to gain positive L2 cache locality effects..
780 */
781 INIT_WORK(&tv_cmd->work, tcm_vhost_submission_work);
782 queue_work(tcm_vhost_workqueue, &tv_cmd->work);
783 }
784
785 mutex_unlock(&vq->mutex);
786}
787
788static void vhost_scsi_ctl_handle_kick(struct vhost_work *work)
789{
790 pr_err("%s: The handling func for control queue.\n", __func__);
791}
792
793static void vhost_scsi_evt_handle_kick(struct vhost_work *work)
794{
795 pr_err("%s: The handling func for event queue.\n", __func__);
796}
797
798static void vhost_scsi_handle_kick(struct vhost_work *work)
799{
800 struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
801 poll.work);
802 struct vhost_scsi *vs = container_of(vq->dev, struct vhost_scsi, dev);
803
804 vhost_scsi_handle_vq(vs);
805}
806
807/*
808 * Called from vhost_scsi_ioctl() context to walk the list of available
809 * tcm_vhost_tpg with an active struct tcm_vhost_nexus
810 */
811static int vhost_scsi_set_endpoint(
812 struct vhost_scsi *vs,
813 struct vhost_scsi_target *t)
814{
815 struct tcm_vhost_tport *tv_tport;
816 struct tcm_vhost_tpg *tv_tpg;
817 int index;
818
819 mutex_lock(&vs->dev.mutex);
820 /* Verify that ring has been setup correctly. */
821 for (index = 0; index < vs->dev.nvqs; ++index) {
822 /* Verify that ring has been setup correctly. */
823 if (!vhost_vq_access_ok(&vs->vqs[index])) {
824 mutex_unlock(&vs->dev.mutex);
825 return -EFAULT;
826 }
827 }
828
829 if (vs->vs_tpg) {
830 mutex_unlock(&vs->dev.mutex);
831 return -EEXIST;
832 }
833 mutex_unlock(&vs->dev.mutex);
834
835 mutex_lock(&tcm_vhost_mutex);
836 list_for_each_entry(tv_tpg, &tcm_vhost_list, tv_tpg_list) {
837 mutex_lock(&tv_tpg->tv_tpg_mutex);
838 if (!tv_tpg->tpg_nexus) {
839 mutex_unlock(&tv_tpg->tv_tpg_mutex);
840 continue;
841 }
842 if (atomic_read(&tv_tpg->tv_tpg_vhost_count)) {
843 mutex_unlock(&tv_tpg->tv_tpg_mutex);
844 continue;
845 }
846 tv_tport = tv_tpg->tport;
847
848 if (!strcmp(tv_tport->tport_name, t->vhost_wwpn) &&
849 (tv_tpg->tport_tpgt == t->vhost_tpgt)) {
850 atomic_inc(&tv_tpg->tv_tpg_vhost_count);
851 smp_mb__after_atomic_inc();
852 mutex_unlock(&tv_tpg->tv_tpg_mutex);
853 mutex_unlock(&tcm_vhost_mutex);
854
855 mutex_lock(&vs->dev.mutex);
856 vs->vs_tpg = tv_tpg;
857 atomic_inc(&vs->vhost_ref_cnt);
858 smp_mb__after_atomic_inc();
859 mutex_unlock(&vs->dev.mutex);
860 return 0;
861 }
862 mutex_unlock(&tv_tpg->tv_tpg_mutex);
863 }
864 mutex_unlock(&tcm_vhost_mutex);
865 return -EINVAL;
866}
867
868static int vhost_scsi_clear_endpoint(
869 struct vhost_scsi *vs,
870 struct vhost_scsi_target *t)
871{
872 struct tcm_vhost_tport *tv_tport;
873 struct tcm_vhost_tpg *tv_tpg;
874 int index;
875
876 mutex_lock(&vs->dev.mutex);
877 /* Verify that ring has been setup correctly. */
878 for (index = 0; index < vs->dev.nvqs; ++index) {
879 if (!vhost_vq_access_ok(&vs->vqs[index])) {
880 mutex_unlock(&vs->dev.mutex);
881 return -EFAULT;
882 }
883 }
884
885 if (!vs->vs_tpg) {
886 mutex_unlock(&vs->dev.mutex);
887 return -ENODEV;
888 }
889 tv_tpg = vs->vs_tpg;
890 tv_tport = tv_tpg->tport;
891
892 if (strcmp(tv_tport->tport_name, t->vhost_wwpn) ||
893 (tv_tpg->tport_tpgt != t->vhost_tpgt)) {
894 mutex_unlock(&vs->dev.mutex);
895 pr_warn("tv_tport->tport_name: %s, tv_tpg->tport_tpgt: %hu"
896 " does not match t->vhost_wwpn: %s, t->vhost_tpgt: %hu\n",
897 tv_tport->tport_name, tv_tpg->tport_tpgt,
898 t->vhost_wwpn, t->vhost_tpgt);
899 return -EINVAL;
900 }
901 atomic_dec(&tv_tpg->tv_tpg_vhost_count);
902 vs->vs_tpg = NULL;
903 mutex_unlock(&vs->dev.mutex);
904
905 return 0;
906}
907
908static int vhost_scsi_open(struct inode *inode, struct file *f)
909{
910 struct vhost_scsi *s;
911 int r;
912
913 s = kzalloc(sizeof(*s), GFP_KERNEL);
914 if (!s)
915 return -ENOMEM;
916
917 vhost_work_init(&s->vs_completion_work, vhost_scsi_complete_cmd_work);
918 INIT_LIST_HEAD(&s->vs_completion_list);
919 spin_lock_init(&s->vs_completion_lock);
920
921 s->vqs[0].handle_kick = vhost_scsi_ctl_handle_kick;
922 s->vqs[1].handle_kick = vhost_scsi_evt_handle_kick;
923 s->vqs[2].handle_kick = vhost_scsi_handle_kick;
924 r = vhost_dev_init(&s->dev, s->vqs, 3);
925 if (r < 0) {
926 kfree(s);
927 return r;
928 }
929
930 f->private_data = s;
931 return 0;
932}
933
934static int vhost_scsi_release(struct inode *inode, struct file *f)
935{
936 struct vhost_scsi *s = f->private_data;
937
938 if (s->vs_tpg && s->vs_tpg->tport) {
939 struct vhost_scsi_target backend;
940
941 memcpy(backend.vhost_wwpn, s->vs_tpg->tport->tport_name,
942 sizeof(backend.vhost_wwpn));
943 backend.vhost_tpgt = s->vs_tpg->tport_tpgt;
944 vhost_scsi_clear_endpoint(s, &backend);
945 }
946
947 vhost_dev_cleanup(&s->dev, false);
948 kfree(s);
949 return 0;
950}
951
952static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
953{
954 if (features & ~VHOST_FEATURES)
955 return -EOPNOTSUPP;
956
957 mutex_lock(&vs->dev.mutex);
958 if ((features & (1 << VHOST_F_LOG_ALL)) &&
959 !vhost_log_access_ok(&vs->dev)) {
960 mutex_unlock(&vs->dev.mutex);
961 return -EFAULT;
962 }
963 vs->dev.acked_features = features;
964 /* TODO possibly smp_wmb() and flush vqs */
965 mutex_unlock(&vs->dev.mutex);
966 return 0;
967}
968
969static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,
970 unsigned long arg)
971{
972 struct vhost_scsi *vs = f->private_data;
973 struct vhost_scsi_target backend;
974 void __user *argp = (void __user *)arg;
975 u64 __user *featurep = argp;
976 u64 features;
977 int r;
978
979 switch (ioctl) {
980 case VHOST_SCSI_SET_ENDPOINT:
981 if (copy_from_user(&backend, argp, sizeof backend))
982 return -EFAULT;
983
984 return vhost_scsi_set_endpoint(vs, &backend);
985 case VHOST_SCSI_CLEAR_ENDPOINT:
986 if (copy_from_user(&backend, argp, sizeof backend))
987 return -EFAULT;
988
989 return vhost_scsi_clear_endpoint(vs, &backend);
990 case VHOST_SCSI_GET_ABI_VERSION:
991 if (copy_from_user(&backend, argp, sizeof backend))
992 return -EFAULT;
993
994 backend.abi_version = VHOST_SCSI_ABI_VERSION;
995
996 if (copy_to_user(argp, &backend, sizeof backend))
997 return -EFAULT;
998 return 0;
999 case VHOST_GET_FEATURES:
1000 features = VHOST_FEATURES;
1001 if (copy_to_user(featurep, &features, sizeof features))
1002 return -EFAULT;
1003 return 0;
1004 case VHOST_SET_FEATURES:
1005 if (copy_from_user(&features, featurep, sizeof features))
1006 return -EFAULT;
1007 return vhost_scsi_set_features(vs, features);
1008 default:
1009 mutex_lock(&vs->dev.mutex);
1010 r = vhost_dev_ioctl(&vs->dev, ioctl, arg);
1011 mutex_unlock(&vs->dev.mutex);
1012 return r;
1013 }
1014}
1015
1016static const struct file_operations vhost_scsi_fops = {
1017 .owner = THIS_MODULE,
1018 .release = vhost_scsi_release,
1019 .unlocked_ioctl = vhost_scsi_ioctl,
1020 /* TODO compat ioctl? */
1021 .open = vhost_scsi_open,
1022 .llseek = noop_llseek,
1023};
1024
1025static struct miscdevice vhost_scsi_misc = {
1026 MISC_DYNAMIC_MINOR,
1027 "vhost-scsi",
1028 &vhost_scsi_fops,
1029};
1030
1031static int __init vhost_scsi_register(void)
1032{
1033 return misc_register(&vhost_scsi_misc);
1034}
1035
1036static int vhost_scsi_deregister(void)
1037{
1038 return misc_deregister(&vhost_scsi_misc);
1039}
1040
1041static char *tcm_vhost_dump_proto_id(struct tcm_vhost_tport *tport)
1042{
1043 switch (tport->tport_proto_id) {
1044 case SCSI_PROTOCOL_SAS:
1045 return "SAS";
1046 case SCSI_PROTOCOL_FCP:
1047 return "FCP";
1048 case SCSI_PROTOCOL_ISCSI:
1049 return "iSCSI";
1050 default:
1051 break;
1052 }
1053
1054 return "Unknown";
1055}
1056
1057static int tcm_vhost_port_link(
1058 struct se_portal_group *se_tpg,
1059 struct se_lun *lun)
1060{
1061 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1062 struct tcm_vhost_tpg, se_tpg);
1063
1064 atomic_inc(&tv_tpg->tv_tpg_port_count);
1065 smp_mb__after_atomic_inc();
1066
1067 return 0;
1068}
1069
1070static void tcm_vhost_port_unlink(
1071 struct se_portal_group *se_tpg,
1072 struct se_lun *se_lun)
1073{
1074 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1075 struct tcm_vhost_tpg, se_tpg);
1076
1077 atomic_dec(&tv_tpg->tv_tpg_port_count);
1078 smp_mb__after_atomic_dec();
1079}
1080
1081static struct se_node_acl *tcm_vhost_make_nodeacl(
1082 struct se_portal_group *se_tpg,
1083 struct config_group *group,
1084 const char *name)
1085{
1086 struct se_node_acl *se_nacl, *se_nacl_new;
1087 struct tcm_vhost_nacl *nacl;
1088 u64 wwpn = 0;
1089 u32 nexus_depth;
1090
1091 /* tcm_vhost_parse_wwn(name, &wwpn, 1) < 0)
1092 return ERR_PTR(-EINVAL); */
1093 se_nacl_new = tcm_vhost_alloc_fabric_acl(se_tpg);
1094 if (!se_nacl_new)
1095 return ERR_PTR(-ENOMEM);
1096
1097 nexus_depth = 1;
1098 /*
1099 * se_nacl_new may be released by core_tpg_add_initiator_node_acl()
1100 * when converting a NodeACL from demo mode -> explict
1101 */
1102 se_nacl = core_tpg_add_initiator_node_acl(se_tpg, se_nacl_new,
1103 name, nexus_depth);
1104 if (IS_ERR(se_nacl)) {
1105 tcm_vhost_release_fabric_acl(se_tpg, se_nacl_new);
1106 return se_nacl;
1107 }
1108 /*
1109 * Locate our struct tcm_vhost_nacl and set the FC Nport WWPN
1110 */
1111 nacl = container_of(se_nacl, struct tcm_vhost_nacl, se_node_acl);
1112 nacl->iport_wwpn = wwpn;
1113
1114 return se_nacl;
1115}
1116
1117static void tcm_vhost_drop_nodeacl(struct se_node_acl *se_acl)
1118{
1119 struct tcm_vhost_nacl *nacl = container_of(se_acl,
1120 struct tcm_vhost_nacl, se_node_acl);
1121 core_tpg_del_initiator_node_acl(se_acl->se_tpg, se_acl, 1);
1122 kfree(nacl);
1123}
1124
1125static int tcm_vhost_make_nexus(
1126 struct tcm_vhost_tpg *tv_tpg,
1127 const char *name)
1128{
1129 struct se_portal_group *se_tpg;
1130 struct tcm_vhost_nexus *tv_nexus;
1131
1132 mutex_lock(&tv_tpg->tv_tpg_mutex);
1133 if (tv_tpg->tpg_nexus) {
1134 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1135 pr_debug("tv_tpg->tpg_nexus already exists\n");
1136 return -EEXIST;
1137 }
1138 se_tpg = &tv_tpg->se_tpg;
1139
1140 tv_nexus = kzalloc(sizeof(struct tcm_vhost_nexus), GFP_KERNEL);
1141 if (!tv_nexus) {
1142 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1143 pr_err("Unable to allocate struct tcm_vhost_nexus\n");
1144 return -ENOMEM;
1145 }
1146 /*
1147 * Initialize the struct se_session pointer
1148 */
1149 tv_nexus->tvn_se_sess = transport_init_session();
1150 if (IS_ERR(tv_nexus->tvn_se_sess)) {
1151 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1152 kfree(tv_nexus);
1153 return -ENOMEM;
1154 }
1155 /*
1156 * Since we are running in 'demo mode' this call with generate a
1157 * struct se_node_acl for the tcm_vhost struct se_portal_group with
1158 * the SCSI Initiator port name of the passed configfs group 'name'.
1159 */
1160 tv_nexus->tvn_se_sess->se_node_acl = core_tpg_check_initiator_node_acl(
1161 se_tpg, (unsigned char *)name);
1162 if (!tv_nexus->tvn_se_sess->se_node_acl) {
1163 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1164 pr_debug("core_tpg_check_initiator_node_acl() failed"
1165 " for %s\n", name);
1166 transport_free_session(tv_nexus->tvn_se_sess);
1167 kfree(tv_nexus);
1168 return -ENOMEM;
1169 }
1170 /*
1171 * Now register the TCM vHost virtual I_T Nexus as active with the
1172 * call to __transport_register_session()
1173 */
1174 __transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl,
1175 tv_nexus->tvn_se_sess, tv_nexus);
1176 tv_tpg->tpg_nexus = tv_nexus;
1177
1178 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1179 return 0;
1180}
1181
1182static int tcm_vhost_drop_nexus(
1183 struct tcm_vhost_tpg *tpg)
1184{
1185 struct se_session *se_sess;
1186 struct tcm_vhost_nexus *tv_nexus;
1187
1188 mutex_lock(&tpg->tv_tpg_mutex);
1189 tv_nexus = tpg->tpg_nexus;
1190 if (!tv_nexus) {
1191 mutex_unlock(&tpg->tv_tpg_mutex);
1192 return -ENODEV;
1193 }
1194
1195 se_sess = tv_nexus->tvn_se_sess;
1196 if (!se_sess) {
1197 mutex_unlock(&tpg->tv_tpg_mutex);
1198 return -ENODEV;
1199 }
1200
1201 if (atomic_read(&tpg->tv_tpg_port_count)) {
1202 mutex_unlock(&tpg->tv_tpg_mutex);
1203 pr_err("Unable to remove TCM_vHost I_T Nexus with"
1204 " active TPG port count: %d\n",
1205 atomic_read(&tpg->tv_tpg_port_count));
1206 return -EPERM;
1207 }
1208
1209 if (atomic_read(&tpg->tv_tpg_vhost_count)) {
1210 mutex_unlock(&tpg->tv_tpg_mutex);
1211 pr_err("Unable to remove TCM_vHost I_T Nexus with"
1212 " active TPG vhost count: %d\n",
1213 atomic_read(&tpg->tv_tpg_vhost_count));
1214 return -EPERM;
1215 }
1216
1217 pr_debug("TCM_vHost_ConfigFS: Removing I_T Nexus to emulated"
1218 " %s Initiator Port: %s\n", tcm_vhost_dump_proto_id(tpg->tport),
1219 tv_nexus->tvn_se_sess->se_node_acl->initiatorname);
1220 /*
1221 * Release the SCSI I_T Nexus to the emulated vHost Target Port
1222 */
1223 transport_deregister_session(tv_nexus->tvn_se_sess);
1224 tpg->tpg_nexus = NULL;
1225 mutex_unlock(&tpg->tv_tpg_mutex);
1226
1227 kfree(tv_nexus);
1228 return 0;
1229}
1230
1231static ssize_t tcm_vhost_tpg_show_nexus(
1232 struct se_portal_group *se_tpg,
1233 char *page)
1234{
1235 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1236 struct tcm_vhost_tpg, se_tpg);
1237 struct tcm_vhost_nexus *tv_nexus;
1238 ssize_t ret;
1239
1240 mutex_lock(&tv_tpg->tv_tpg_mutex);
1241 tv_nexus = tv_tpg->tpg_nexus;
1242 if (!tv_nexus) {
1243 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1244 return -ENODEV;
1245 }
1246 ret = snprintf(page, PAGE_SIZE, "%s\n",
1247 tv_nexus->tvn_se_sess->se_node_acl->initiatorname);
1248 mutex_unlock(&tv_tpg->tv_tpg_mutex);
1249
1250 return ret;
1251}
1252
1253static ssize_t tcm_vhost_tpg_store_nexus(
1254 struct se_portal_group *se_tpg,
1255 const char *page,
1256 size_t count)
1257{
1258 struct tcm_vhost_tpg *tv_tpg = container_of(se_tpg,
1259 struct tcm_vhost_tpg, se_tpg);
1260 struct tcm_vhost_tport *tport_wwn = tv_tpg->tport;
1261 unsigned char i_port[TCM_VHOST_NAMELEN], *ptr, *port_ptr;
1262 int ret;
1263 /*
1264 * Shutdown the active I_T nexus if 'NULL' is passed..
1265 */
1266 if (!strncmp(page, "NULL", 4)) {
1267 ret = tcm_vhost_drop_nexus(tv_tpg);
1268 return (!ret) ? count : ret;
1269 }
1270 /*
1271 * Otherwise make sure the passed virtual Initiator port WWN matches
1272 * the fabric protocol_id set in tcm_vhost_make_tport(), and call
1273 * tcm_vhost_make_nexus().
1274 */
1275 if (strlen(page) >= TCM_VHOST_NAMELEN) {
1276 pr_err("Emulated NAA Sas Address: %s, exceeds"
1277 " max: %d\n", page, TCM_VHOST_NAMELEN);
1278 return -EINVAL;
1279 }
1280 snprintf(&i_port[0], TCM_VHOST_NAMELEN, "%s", page);
1281
1282 ptr = strstr(i_port, "naa.");
1283 if (ptr) {
1284 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_SAS) {
1285 pr_err("Passed SAS Initiator Port %s does not"
1286 " match target port protoid: %s\n", i_port,
1287 tcm_vhost_dump_proto_id(tport_wwn));
1288 return -EINVAL;
1289 }
1290 port_ptr = &i_port[0];
1291 goto check_newline;
1292 }
1293 ptr = strstr(i_port, "fc.");
1294 if (ptr) {
1295 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_FCP) {
1296 pr_err("Passed FCP Initiator Port %s does not"
1297 " match target port protoid: %s\n", i_port,
1298 tcm_vhost_dump_proto_id(tport_wwn));
1299 return -EINVAL;
1300 }
1301 port_ptr = &i_port[3]; /* Skip over "fc." */
1302 goto check_newline;
1303 }
1304 ptr = strstr(i_port, "iqn.");
1305 if (ptr) {
1306 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_ISCSI) {
1307 pr_err("Passed iSCSI Initiator Port %s does not"
1308 " match target port protoid: %s\n", i_port,
1309 tcm_vhost_dump_proto_id(tport_wwn));
1310 return -EINVAL;
1311 }
1312 port_ptr = &i_port[0];
1313 goto check_newline;
1314 }
1315 pr_err("Unable to locate prefix for emulated Initiator Port:"
1316 " %s\n", i_port);
1317 return -EINVAL;
1318 /*
1319 * Clear any trailing newline for the NAA WWN
1320 */
1321check_newline:
1322 if (i_port[strlen(i_port)-1] == '\n')
1323 i_port[strlen(i_port)-1] = '\0';
1324
1325 ret = tcm_vhost_make_nexus(tv_tpg, port_ptr);
1326 if (ret < 0)
1327 return ret;
1328
1329 return count;
1330}
1331
1332TF_TPG_BASE_ATTR(tcm_vhost, nexus, S_IRUGO | S_IWUSR);
1333
1334static struct configfs_attribute *tcm_vhost_tpg_attrs[] = {
1335 &tcm_vhost_tpg_nexus.attr,
1336 NULL,
1337};
1338
1339static struct se_portal_group *tcm_vhost_make_tpg(
1340 struct se_wwn *wwn,
1341 struct config_group *group,
1342 const char *name)
1343{
1344 struct tcm_vhost_tport *tport = container_of(wwn,
1345 struct tcm_vhost_tport, tport_wwn);
1346
1347 struct tcm_vhost_tpg *tpg;
1348 unsigned long tpgt;
1349 int ret;
1350
1351 if (strstr(name, "tpgt_") != name)
1352 return ERR_PTR(-EINVAL);
1353 if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)
1354 return ERR_PTR(-EINVAL);
1355
1356 tpg = kzalloc(sizeof(struct tcm_vhost_tpg), GFP_KERNEL);
1357 if (!tpg) {
1358 pr_err("Unable to allocate struct tcm_vhost_tpg");
1359 return ERR_PTR(-ENOMEM);
1360 }
1361 mutex_init(&tpg->tv_tpg_mutex);
1362 INIT_LIST_HEAD(&tpg->tv_tpg_list);
1363 tpg->tport = tport;
1364 tpg->tport_tpgt = tpgt;
1365
1366 ret = core_tpg_register(&tcm_vhost_fabric_configfs->tf_ops, wwn,
1367 &tpg->se_tpg, tpg, TRANSPORT_TPG_TYPE_NORMAL);
1368 if (ret < 0) {
1369 kfree(tpg);
1370 return NULL;
1371 }
1372 mutex_lock(&tcm_vhost_mutex);
1373 list_add_tail(&tpg->tv_tpg_list, &tcm_vhost_list);
1374 mutex_unlock(&tcm_vhost_mutex);
1375
1376 return &tpg->se_tpg;
1377}
1378
1379static void tcm_vhost_drop_tpg(struct se_portal_group *se_tpg)
1380{
1381 struct tcm_vhost_tpg *tpg = container_of(se_tpg,
1382 struct tcm_vhost_tpg, se_tpg);
1383
1384 mutex_lock(&tcm_vhost_mutex);
1385 list_del(&tpg->tv_tpg_list);
1386 mutex_unlock(&tcm_vhost_mutex);
1387 /*
1388 * Release the virtual I_T Nexus for this vHost TPG
1389 */
1390 tcm_vhost_drop_nexus(tpg);
1391 /*
1392 * Deregister the se_tpg from TCM..
1393 */
1394 core_tpg_deregister(se_tpg);
1395 kfree(tpg);
1396}
1397
1398static struct se_wwn *tcm_vhost_make_tport(
1399 struct target_fabric_configfs *tf,
1400 struct config_group *group,
1401 const char *name)
1402{
1403 struct tcm_vhost_tport *tport;
1404 char *ptr;
1405 u64 wwpn = 0;
1406 int off = 0;
1407
1408 /* if (tcm_vhost_parse_wwn(name, &wwpn, 1) < 0)
1409 return ERR_PTR(-EINVAL); */
1410
1411 tport = kzalloc(sizeof(struct tcm_vhost_tport), GFP_KERNEL);
1412 if (!tport) {
1413 pr_err("Unable to allocate struct tcm_vhost_tport");
1414 return ERR_PTR(-ENOMEM);
1415 }
1416 tport->tport_wwpn = wwpn;
1417 /*
1418 * Determine the emulated Protocol Identifier and Target Port Name
1419 * based on the incoming configfs directory name.
1420 */
1421 ptr = strstr(name, "naa.");
1422 if (ptr) {
1423 tport->tport_proto_id = SCSI_PROTOCOL_SAS;
1424 goto check_len;
1425 }
1426 ptr = strstr(name, "fc.");
1427 if (ptr) {
1428 tport->tport_proto_id = SCSI_PROTOCOL_FCP;
1429 off = 3; /* Skip over "fc." */
1430 goto check_len;
1431 }
1432 ptr = strstr(name, "iqn.");
1433 if (ptr) {
1434 tport->tport_proto_id = SCSI_PROTOCOL_ISCSI;
1435 goto check_len;
1436 }
1437
1438 pr_err("Unable to locate prefix for emulated Target Port:"
1439 " %s\n", name);
1440 kfree(tport);
1441 return ERR_PTR(-EINVAL);
1442
1443check_len:
1444 if (strlen(name) >= TCM_VHOST_NAMELEN) {
1445 pr_err("Emulated %s Address: %s, exceeds"
1446 " max: %d\n", name, tcm_vhost_dump_proto_id(tport),
1447 TCM_VHOST_NAMELEN);
1448 kfree(tport);
1449 return ERR_PTR(-EINVAL);
1450 }
1451 snprintf(&tport->tport_name[0], TCM_VHOST_NAMELEN, "%s", &name[off]);
1452
1453 pr_debug("TCM_VHost_ConfigFS: Allocated emulated Target"
1454 " %s Address: %s\n", tcm_vhost_dump_proto_id(tport), name);
1455
1456 return &tport->tport_wwn;
1457}
1458
1459static void tcm_vhost_drop_tport(struct se_wwn *wwn)
1460{
1461 struct tcm_vhost_tport *tport = container_of(wwn,
1462 struct tcm_vhost_tport, tport_wwn);
1463
1464 pr_debug("TCM_VHost_ConfigFS: Deallocating emulated Target"
1465 " %s Address: %s\n", tcm_vhost_dump_proto_id(tport),
1466 tport->tport_name);
1467
1468 kfree(tport);
1469}
1470
1471static ssize_t tcm_vhost_wwn_show_attr_version(
1472 struct target_fabric_configfs *tf,
1473 char *page)
1474{
1475 return sprintf(page, "TCM_VHOST fabric module %s on %s/%s"
1476 "on "UTS_RELEASE"\n", TCM_VHOST_VERSION, utsname()->sysname,
1477 utsname()->machine);
1478}
1479
1480TF_WWN_ATTR_RO(tcm_vhost, version);
1481
1482static struct configfs_attribute *tcm_vhost_wwn_attrs[] = {
1483 &tcm_vhost_wwn_version.attr,
1484 NULL,
1485};
1486
1487static struct target_core_fabric_ops tcm_vhost_ops = {
1488 .get_fabric_name = tcm_vhost_get_fabric_name,
1489 .get_fabric_proto_ident = tcm_vhost_get_fabric_proto_ident,
1490 .tpg_get_wwn = tcm_vhost_get_fabric_wwn,
1491 .tpg_get_tag = tcm_vhost_get_tag,
1492 .tpg_get_default_depth = tcm_vhost_get_default_depth,
1493 .tpg_get_pr_transport_id = tcm_vhost_get_pr_transport_id,
1494 .tpg_get_pr_transport_id_len = tcm_vhost_get_pr_transport_id_len,
1495 .tpg_parse_pr_out_transport_id = tcm_vhost_parse_pr_out_transport_id,
1496 .tpg_check_demo_mode = tcm_vhost_check_true,
1497 .tpg_check_demo_mode_cache = tcm_vhost_check_true,
1498 .tpg_check_demo_mode_write_protect = tcm_vhost_check_false,
1499 .tpg_check_prod_mode_write_protect = tcm_vhost_check_false,
1500 .tpg_alloc_fabric_acl = tcm_vhost_alloc_fabric_acl,
1501 .tpg_release_fabric_acl = tcm_vhost_release_fabric_acl,
1502 .tpg_get_inst_index = tcm_vhost_tpg_get_inst_index,
1503 .release_cmd = tcm_vhost_release_cmd,
1504 .shutdown_session = tcm_vhost_shutdown_session,
1505 .close_session = tcm_vhost_close_session,
1506 .sess_get_index = tcm_vhost_sess_get_index,
1507 .sess_get_initiator_sid = NULL,
1508 .write_pending = tcm_vhost_write_pending,
1509 .write_pending_status = tcm_vhost_write_pending_status,
1510 .set_default_node_attributes = tcm_vhost_set_default_node_attrs,
1511 .get_task_tag = tcm_vhost_get_task_tag,
1512 .get_cmd_state = tcm_vhost_get_cmd_state,
1513 .queue_data_in = tcm_vhost_queue_data_in,
1514 .queue_status = tcm_vhost_queue_status,
1515 .queue_tm_rsp = tcm_vhost_queue_tm_rsp,
1516 .get_fabric_sense_len = tcm_vhost_get_fabric_sense_len,
1517 .set_fabric_sense_len = tcm_vhost_set_fabric_sense_len,
1518 /*
1519 * Setup callers for generic logic in target_core_fabric_configfs.c
1520 */
1521 .fabric_make_wwn = tcm_vhost_make_tport,
1522 .fabric_drop_wwn = tcm_vhost_drop_tport,
1523 .fabric_make_tpg = tcm_vhost_make_tpg,
1524 .fabric_drop_tpg = tcm_vhost_drop_tpg,
1525 .fabric_post_link = tcm_vhost_port_link,
1526 .fabric_pre_unlink = tcm_vhost_port_unlink,
1527 .fabric_make_np = NULL,
1528 .fabric_drop_np = NULL,
1529 .fabric_make_nodeacl = tcm_vhost_make_nodeacl,
1530 .fabric_drop_nodeacl = tcm_vhost_drop_nodeacl,
1531};
1532
1533static int tcm_vhost_register_configfs(void)
1534{
1535 struct target_fabric_configfs *fabric;
1536 int ret;
1537
1538 pr_debug("TCM_VHOST fabric module %s on %s/%s"
1539 " on "UTS_RELEASE"\n", TCM_VHOST_VERSION, utsname()->sysname,
1540 utsname()->machine);
1541 /*
1542 * Register the top level struct config_item_type with TCM core
1543 */
1544 fabric = target_fabric_configfs_init(THIS_MODULE, "vhost");
1545 if (IS_ERR(fabric)) {
1546 pr_err("target_fabric_configfs_init() failed\n");
1547 return PTR_ERR(fabric);
1548 }
1549 /*
1550 * Setup fabric->tf_ops from our local tcm_vhost_ops
1551 */
1552 fabric->tf_ops = tcm_vhost_ops;
1553 /*
1554 * Setup default attribute lists for various fabric->tf_cit_tmpl
1555 */
1556 TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = tcm_vhost_wwn_attrs;
1557 TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = tcm_vhost_tpg_attrs;
1558 TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;
1559 TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
1560 TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
1561 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;
1562 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
1563 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
1564 TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;
1565 /*
1566 * Register the fabric for use within TCM
1567 */
1568 ret = target_fabric_configfs_register(fabric);
1569 if (ret < 0) {
1570 pr_err("target_fabric_configfs_register() failed"
1571 " for TCM_VHOST\n");
1572 return ret;
1573 }
1574 /*
1575 * Setup our local pointer to *fabric
1576 */
1577 tcm_vhost_fabric_configfs = fabric;
1578 pr_debug("TCM_VHOST[0] - Set fabric -> tcm_vhost_fabric_configfs\n");
1579 return 0;
1580};
1581
1582static void tcm_vhost_deregister_configfs(void)
1583{
1584 if (!tcm_vhost_fabric_configfs)
1585 return;
1586
1587 target_fabric_configfs_deregister(tcm_vhost_fabric_configfs);
1588 tcm_vhost_fabric_configfs = NULL;
1589 pr_debug("TCM_VHOST[0] - Cleared tcm_vhost_fabric_configfs\n");
1590};
1591
1592static int __init tcm_vhost_init(void)
1593{
1594 int ret = -ENOMEM;
1595
1596 tcm_vhost_workqueue = alloc_workqueue("tcm_vhost", 0, 0);
1597 if (!tcm_vhost_workqueue)
1598 goto out;
1599
1600 ret = vhost_scsi_register();
1601 if (ret < 0)
1602 goto out_destroy_workqueue;
1603
1604 ret = tcm_vhost_register_configfs();
1605 if (ret < 0)
1606 goto out_vhost_scsi_deregister;
1607
1608 return 0;
1609
1610out_vhost_scsi_deregister:
1611 vhost_scsi_deregister();
1612out_destroy_workqueue:
1613 destroy_workqueue(tcm_vhost_workqueue);
1614out:
1615 return ret;
1616};
1617
1618static void tcm_vhost_exit(void)
1619{
1620 tcm_vhost_deregister_configfs();
1621 vhost_scsi_deregister();
1622 destroy_workqueue(tcm_vhost_workqueue);
1623};
1624
1625MODULE_DESCRIPTION("TCM_VHOST series fabric driver");
1626MODULE_LICENSE("GPL");
1627module_init(tcm_vhost_init);
1628module_exit(tcm_vhost_exit);
diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h
new file mode 100644
index 000000000000..c983ed21e413
--- /dev/null
+++ b/drivers/vhost/tcm_vhost.h
@@ -0,0 +1,101 @@
1#define TCM_VHOST_VERSION "v0.1"
2#define TCM_VHOST_NAMELEN 256
3#define TCM_VHOST_MAX_CDB_SIZE 32
4
5struct tcm_vhost_cmd {
6 /* Descriptor from vhost_get_vq_desc() for virt_queue segment */
7 int tvc_vq_desc;
8 /* The Tag from include/linux/virtio_scsi.h:struct virtio_scsi_cmd_req */
9 u64 tvc_tag;
10 /* The number of scatterlists associated with this cmd */
11 u32 tvc_sgl_count;
12 /* Saved unpacked SCSI LUN for tcm_vhost_submission_work() */
13 u32 tvc_lun;
14 /* Pointer to the SGL formatted memory from virtio-scsi */
15 struct scatterlist *tvc_sgl;
16 /* Pointer to response */
17 struct virtio_scsi_cmd_resp __user *tvc_resp;
18 /* Pointer to vhost_scsi for our device */
19 struct vhost_scsi *tvc_vhost;
20 /* The TCM I/O descriptor that is accessed via container_of() */
21 struct se_cmd tvc_se_cmd;
22 /* work item used for cmwq dispatch to tcm_vhost_submission_work() */
23 struct work_struct work;
24 /* Copy of the incoming SCSI command descriptor block (CDB) */
25 unsigned char tvc_cdb[TCM_VHOST_MAX_CDB_SIZE];
26 /* Sense buffer that will be mapped into outgoing status */
27 unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER];
28 /* Completed commands list, serviced from vhost worker thread */
29 struct list_head tvc_completion_list;
30};
31
32struct tcm_vhost_nexus {
33 /* Pointer to TCM session for I_T Nexus */
34 struct se_session *tvn_se_sess;
35};
36
37struct tcm_vhost_nacl {
38 /* Binary World Wide unique Port Name for Vhost Initiator port */
39 u64 iport_wwpn;
40 /* ASCII formatted WWPN for Sas Initiator port */
41 char iport_name[TCM_VHOST_NAMELEN];
42 /* Returned by tcm_vhost_make_nodeacl() */
43 struct se_node_acl se_node_acl;
44};
45
46struct tcm_vhost_tpg {
47 /* Vhost port target portal group tag for TCM */
48 u16 tport_tpgt;
49 /* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus shutdown */
50 atomic_t tv_tpg_port_count;
51 /* Used for vhost_scsi device reference to tpg_nexus */
52 atomic_t tv_tpg_vhost_count;
53 /* list for tcm_vhost_list */
54 struct list_head tv_tpg_list;
55 /* Used to protect access for tpg_nexus */
56 struct mutex tv_tpg_mutex;
57 /* Pointer to the TCM VHost I_T Nexus for this TPG endpoint */
58 struct tcm_vhost_nexus *tpg_nexus;
59 /* Pointer back to tcm_vhost_tport */
60 struct tcm_vhost_tport *tport;
61 /* Returned by tcm_vhost_make_tpg() */
62 struct se_portal_group se_tpg;
63};
64
65struct tcm_vhost_tport {
66 /* SCSI protocol the tport is providing */
67 u8 tport_proto_id;
68 /* Binary World Wide unique Port Name for Vhost Target port */
69 u64 tport_wwpn;
70 /* ASCII formatted WWPN for Vhost Target port */
71 char tport_name[TCM_VHOST_NAMELEN];
72 /* Returned by tcm_vhost_make_tport() */
73 struct se_wwn tport_wwn;
74};
75
76/*
77 * As per request from MST, keep TCM_VHOST related ioctl defines out of
78 * linux/vhost.h (user-space) for now..
79 */
80
81#include <linux/vhost.h>
82
83/*
84 * Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
85 *
86 * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
87 * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
88 */
89
90#define VHOST_SCSI_ABI_VERSION 0
91
92struct vhost_scsi_target {
93 int abi_version;
94 unsigned char vhost_wwpn[TRANSPORT_IQN_LEN];
95 unsigned short vhost_tpgt;
96};
97
98/* VHOST_SCSI specific defines */
99#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
100#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
101#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct vhost_scsi_target)
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index d90062b211f8..92d08e7fcba2 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -91,6 +91,11 @@ static struct w1_family w1_therm_family_DS28EA00 = {
91 .fops = &w1_therm_fops, 91 .fops = &w1_therm_fops,
92}; 92};
93 93
94static struct w1_family w1_therm_family_DS1825 = {
95 .fid = W1_THERM_DS1825,
96 .fops = &w1_therm_fops,
97};
98
94struct w1_therm_family_converter 99struct w1_therm_family_converter
95{ 100{
96 u8 broken; 101 u8 broken;
@@ -120,6 +125,10 @@ static struct w1_therm_family_converter w1_therm_families[] = {
120 .f = &w1_therm_family_DS28EA00, 125 .f = &w1_therm_family_DS28EA00,
121 .convert = w1_DS18B20_convert_temp 126 .convert = w1_DS18B20_convert_temp
122 }, 127 },
128 {
129 .f = &w1_therm_family_DS1825,
130 .convert = w1_DS18B20_convert_temp
131 }
123}; 132};
124 133
125static inline int w1_DS18B20_convert_temp(u8 rom[9]) 134static inline int w1_DS18B20_convert_temp(u8 rom[9])
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
index b00ada44a89b..a1f0ce151d53 100644
--- a/drivers/w1/w1_family.h
+++ b/drivers/w1/w1_family.h
@@ -39,6 +39,7 @@
39#define W1_EEPROM_DS2431 0x2D 39#define W1_EEPROM_DS2431 0x2D
40#define W1_FAMILY_DS2760 0x30 40#define W1_FAMILY_DS2760 0x30
41#define W1_FAMILY_DS2780 0x32 41#define W1_FAMILY_DS2780 0x32
42#define W1_THERM_DS1825 0x3B
42#define W1_FAMILY_DS2781 0x3D 43#define W1_FAMILY_DS2781 0x3D
43#define W1_THERM_DS28EA00 0x42 44#define W1_THERM_DS28EA00 0x42
44 45
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index 181fa8158a8b..858c9714b2f3 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -37,7 +37,6 @@ struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
37 */ 37 */
38 38
39struct zorro_bus { 39struct zorro_bus {
40 struct list_head devices; /* list of devices on this bus */
41 struct device dev; 40 struct device dev;
42}; 41};
43 42
@@ -136,7 +135,6 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
136 if (!bus) 135 if (!bus)
137 return -ENOMEM; 136 return -ENOMEM;
138 137
139 INIT_LIST_HEAD(&bus->devices);
140 bus->dev.parent = &pdev->dev; 138 bus->dev.parent = &pdev->dev;
141 dev_set_name(&bus->dev, "zorro"); 139 dev_set_name(&bus->dev, "zorro");
142 error = device_register(&bus->dev); 140 error = device_register(&bus->dev);
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 1feb68ecef95..842d00048a65 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -94,25 +94,21 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,
94{ 94{
95 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); 95 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
96 struct list_head *next; 96 struct list_head *next;
97 struct dentry *p, *q; 97 struct dentry *q;
98 98
99 spin_lock(&sbi->lookup_lock); 99 spin_lock(&sbi->lookup_lock);
100 spin_lock(&root->d_lock);
100 101
101 if (prev == NULL) { 102 if (prev)
102 spin_lock(&root->d_lock); 103 next = prev->d_u.d_child.next;
104 else {
103 prev = dget_dlock(root); 105 prev = dget_dlock(root);
104 next = prev->d_subdirs.next; 106 next = prev->d_subdirs.next;
105 p = prev;
106 goto start;
107 } 107 }
108 108
109 p = prev; 109cont:
110 spin_lock(&p->d_lock);
111again:
112 next = p->d_u.d_child.next;
113start:
114 if (next == &root->d_subdirs) { 110 if (next == &root->d_subdirs) {
115 spin_unlock(&p->d_lock); 111 spin_unlock(&root->d_lock);
116 spin_unlock(&sbi->lookup_lock); 112 spin_unlock(&sbi->lookup_lock);
117 dput(prev); 113 dput(prev);
118 return NULL; 114 return NULL;
@@ -121,16 +117,15 @@ start:
121 q = list_entry(next, struct dentry, d_u.d_child); 117 q = list_entry(next, struct dentry, d_u.d_child);
122 118
123 spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); 119 spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
124 /* Negative dentry - try next */ 120 /* Already gone or negative dentry (under construction) - try next */
125 if (!simple_positive(q)) { 121 if (q->d_count == 0 || !simple_positive(q)) {
126 spin_unlock(&p->d_lock); 122 spin_unlock(&q->d_lock);
127 lock_set_subclass(&q->d_lock.dep_map, 0, _RET_IP_); 123 next = q->d_u.d_child.next;
128 p = q; 124 goto cont;
129 goto again;
130 } 125 }
131 dget_dlock(q); 126 dget_dlock(q);
132 spin_unlock(&q->d_lock); 127 spin_unlock(&q->d_lock);
133 spin_unlock(&p->d_lock); 128 spin_unlock(&root->d_lock);
134 spin_unlock(&sbi->lookup_lock); 129 spin_unlock(&sbi->lookup_lock);
135 130
136 dput(prev); 131 dput(prev);
@@ -404,11 +399,6 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
404 DPRINTK("checking mountpoint %p %.*s", 399 DPRINTK("checking mountpoint %p %.*s",
405 dentry, (int)dentry->d_name.len, dentry->d_name.name); 400 dentry, (int)dentry->d_name.len, dentry->d_name.name);
406 401
407 /* Path walk currently on this dentry? */
408 ino_count = atomic_read(&ino->count) + 2;
409 if (dentry->d_count > ino_count)
410 goto next;
411
412 /* Can we umount this guy */ 402 /* Can we umount this guy */
413 if (autofs4_mount_busy(mnt, dentry)) 403 if (autofs4_mount_busy(mnt, dentry))
414 goto next; 404 goto next;
diff --git a/fs/bio.c b/fs/bio.c
index 73922abba832..5eaa70c9d96e 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1312,7 +1312,7 @@ EXPORT_SYMBOL(bio_copy_kern);
1312 * Note that this code is very hard to test under normal circumstances because 1312 * Note that this code is very hard to test under normal circumstances because
1313 * direct-io pins the pages with get_user_pages(). This makes 1313 * direct-io pins the pages with get_user_pages(). This makes
1314 * is_page_cache_freeable return false, and the VM will not clean the pages. 1314 * is_page_cache_freeable return false, and the VM will not clean the pages.
1315 * But other code (eg, pdflush) could clean the pages if they are mapped 1315 * But other code (eg, flusher threads) could clean the pages if they are mapped
1316 * pagecache. 1316 * pagecache.
1317 * 1317 *
1318 * Simply disabling the call to bio_set_pages_dirty() is a good way to test the 1318 * Simply disabling the call to bio_set_pages_dirty() is a good way to test the
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 83baec24946d..6e8f416773d4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -324,7 +324,8 @@ static noinline int add_async_extent(struct async_cow *cow,
324 * If this code finds it can't get good compression, it puts an 324 * If this code finds it can't get good compression, it puts an
325 * entry onto the work queue to write the uncompressed bytes. This 325 * entry onto the work queue to write the uncompressed bytes. This
326 * makes sure that both compressed inodes and uncompressed inodes 326 * makes sure that both compressed inodes and uncompressed inodes
327 * are written in the same order that pdflush sent them down. 327 * are written in the same order that the flusher thread sent them
328 * down.
328 */ 329 */
329static noinline int compress_file_range(struct inode *inode, 330static noinline int compress_file_range(struct inode *inode,
330 struct page *locked_page, 331 struct page *locked_page,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index bc2f6ffff3cf..7bb755677a22 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -664,10 +664,6 @@ static noinline int btrfs_mksubvol(struct path *parent,
664 struct dentry *dentry; 664 struct dentry *dentry;
665 int error; 665 int error;
666 666
667 error = mnt_want_write(parent->mnt);
668 if (error)
669 return error;
670
671 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 667 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
672 668
673 dentry = lookup_one_len(name, parent->dentry, namelen); 669 dentry = lookup_one_len(name, parent->dentry, namelen);
@@ -703,7 +699,6 @@ out_dput:
703 dput(dentry); 699 dput(dentry);
704out_unlock: 700out_unlock:
705 mutex_unlock(&dir->i_mutex); 701 mutex_unlock(&dir->i_mutex);
706 mnt_drop_write(parent->mnt);
707 return error; 702 return error;
708} 703}
709 704
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 643335a4fe3c..051c7fe551dd 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -596,7 +596,7 @@ void btrfs_start_ordered_extent(struct inode *inode,
596 /* 596 /*
597 * pages in the range can be dirty, clean or writeback. We 597 * pages in the range can be dirty, clean or writeback. We
598 * start IO on any dirty ones so the wait doesn't stall waiting 598 * start IO on any dirty ones so the wait doesn't stall waiting
599 * for pdflush to find them 599 * for the flusher thread to find them
600 */ 600 */
601 if (!test_bit(BTRFS_ORDERED_DIRECT, &entry->flags)) 601 if (!test_bit(BTRFS_ORDERED_DIRECT, &entry->flags))
602 filemap_fdatawrite_range(inode->i_mapping, start, end); 602 filemap_fdatawrite_range(inode->i_mapping, start, end);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 8c6e61d6eed5..f2eb24c477a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -100,10 +100,6 @@ static void __save_error_info(struct btrfs_fs_info *fs_info)
100 fs_info->fs_state = BTRFS_SUPER_FLAG_ERROR; 100 fs_info->fs_state = BTRFS_SUPER_FLAG_ERROR;
101} 101}
102 102
103/* NOTE:
104 * We move write_super stuff at umount in order to avoid deadlock
105 * for umount hold all lock.
106 */
107static void save_error_info(struct btrfs_fs_info *fs_info) 103static void save_error_info(struct btrfs_fs_info *fs_info)
108{ 104{
109 __save_error_info(fs_info); 105 __save_error_info(fs_info);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b8708f994e67..e86ae04abe6a 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1744,10 +1744,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1744 1744
1745 device->fs_devices = root->fs_info->fs_devices; 1745 device->fs_devices = root->fs_info->fs_devices;
1746 1746
1747 /*
1748 * we don't want write_supers to jump in here with our device
1749 * half setup
1750 */
1751 mutex_lock(&root->fs_info->fs_devices->device_list_mutex); 1747 mutex_lock(&root->fs_info->fs_devices->device_list_mutex);
1752 list_add_rcu(&device->dev_list, &root->fs_info->fs_devices->devices); 1748 list_add_rcu(&device->dev_list, &root->fs_info->fs_devices->devices);
1753 list_add(&device->dev_alloc_list, 1749 list_add(&device->dev_alloc_list,
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 5badb0c039de..1562c27a2fab 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -37,15 +37,12 @@
37 37
38#define EXOFS_DBGMSG2(M...) do {} while (0) 38#define EXOFS_DBGMSG2(M...) do {} while (0)
39 39
40enum {MAX_PAGES_KMALLOC = PAGE_SIZE / sizeof(struct page *), };
41
42unsigned exofs_max_io_pages(struct ore_layout *layout, 40unsigned exofs_max_io_pages(struct ore_layout *layout,
43 unsigned expected_pages) 41 unsigned expected_pages)
44{ 42{
45 unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC); 43 unsigned pages = min_t(unsigned, expected_pages,
44 layout->max_io_length / PAGE_SIZE);
46 45
47 /* TODO: easily support bio chaining */
48 pages = min_t(unsigned, pages, layout->max_io_length / PAGE_SIZE);
49 return pages; 46 return pages;
50} 47}
51 48
@@ -101,7 +98,8 @@ static void _pcol_reset(struct page_collect *pcol)
101 * it might not end here. don't be left with nothing 98 * it might not end here. don't be left with nothing
102 */ 99 */
103 if (!pcol->expected_pages) 100 if (!pcol->expected_pages)
104 pcol->expected_pages = MAX_PAGES_KMALLOC; 101 pcol->expected_pages =
102 exofs_max_io_pages(&pcol->sbi->layout, ~0);
105} 103}
106 104
107static int pcol_try_alloc(struct page_collect *pcol) 105static int pcol_try_alloc(struct page_collect *pcol)
@@ -389,6 +387,8 @@ static int readpage_strip(void *data, struct page *page)
389 size_t len; 387 size_t len;
390 int ret; 388 int ret;
391 389
390 BUG_ON(!PageLocked(page));
391
392 /* FIXME: Just for debugging, will be removed */ 392 /* FIXME: Just for debugging, will be removed */
393 if (PageUptodate(page)) 393 if (PageUptodate(page))
394 EXOFS_ERR("PageUptodate(0x%lx, 0x%lx)\n", pcol->inode->i_ino, 394 EXOFS_ERR("PageUptodate(0x%lx, 0x%lx)\n", pcol->inode->i_ino,
@@ -572,8 +572,16 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate)
572 572
573 if (!pcol->that_locked_page || 573 if (!pcol->that_locked_page ||
574 (pcol->that_locked_page->index != index)) { 574 (pcol->that_locked_page->index != index)) {
575 struct page *page = find_get_page(pcol->inode->i_mapping, index); 575 struct page *page;
576 loff_t i_size = i_size_read(pcol->inode);
577
578 if (offset >= i_size) {
579 *uptodate = true;
580 EXOFS_DBGMSG("offset >= i_size index=0x%lx\n", index);
581 return ZERO_PAGE(0);
582 }
576 583
584 page = find_get_page(pcol->inode->i_mapping, index);
577 if (!page) { 585 if (!page) {
578 page = find_or_create_page(pcol->inode->i_mapping, 586 page = find_or_create_page(pcol->inode->i_mapping,
579 index, GFP_NOFS); 587 index, GFP_NOFS);
@@ -602,12 +610,13 @@ static void __r4w_put_page(void *priv, struct page *page)
602{ 610{
603 struct page_collect *pcol = priv; 611 struct page_collect *pcol = priv;
604 612
605 if (pcol->that_locked_page != page) { 613 if ((pcol->that_locked_page != page) && (ZERO_PAGE(0) != page)) {
606 EXOFS_DBGMSG("index=0x%lx\n", page->index); 614 EXOFS_DBGMSG("index=0x%lx\n", page->index);
607 page_cache_release(page); 615 page_cache_release(page);
608 return; 616 return;
609 } 617 }
610 EXOFS_DBGMSG("that_locked_page index=0x%lx\n", page->index); 618 EXOFS_DBGMSG("that_locked_page index=0x%lx\n",
619 ZERO_PAGE(0) == page ? -1 : page->index);
611} 620}
612 621
613static const struct _ore_r4w_op _r4w_op = { 622static const struct _ore_r4w_op _r4w_op = {
diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
index 24a49d47e935..1585db1aa365 100644
--- a/fs/exofs/ore.c
+++ b/fs/exofs/ore.c
@@ -837,11 +837,11 @@ static int _write_mirror(struct ore_io_state *ios, int cur_comp)
837 bio->bi_rw |= REQ_WRITE; 837 bio->bi_rw |= REQ_WRITE;
838 } 838 }
839 839
840 osd_req_write(or, _ios_obj(ios, dev), per_dev->offset, 840 osd_req_write(or, _ios_obj(ios, cur_comp),
841 bio, per_dev->length); 841 per_dev->offset, bio, per_dev->length);
842 ORE_DBGMSG("write(0x%llx) offset=0x%llx " 842 ORE_DBGMSG("write(0x%llx) offset=0x%llx "
843 "length=0x%llx dev=%d\n", 843 "length=0x%llx dev=%d\n",
844 _LLU(_ios_obj(ios, dev)->id), 844 _LLU(_ios_obj(ios, cur_comp)->id),
845 _LLU(per_dev->offset), 845 _LLU(per_dev->offset),
846 _LLU(per_dev->length), dev); 846 _LLU(per_dev->length), dev);
847 } else if (ios->kern_buff) { 847 } else if (ios->kern_buff) {
@@ -853,20 +853,20 @@ static int _write_mirror(struct ore_io_state *ios, int cur_comp)
853 (ios->si.unit_off + ios->length > 853 (ios->si.unit_off + ios->length >
854 ios->layout->stripe_unit)); 854 ios->layout->stripe_unit));
855 855
856 ret = osd_req_write_kern(or, _ios_obj(ios, per_dev->dev), 856 ret = osd_req_write_kern(or, _ios_obj(ios, cur_comp),
857 per_dev->offset, 857 per_dev->offset,
858 ios->kern_buff, ios->length); 858 ios->kern_buff, ios->length);
859 if (unlikely(ret)) 859 if (unlikely(ret))
860 goto out; 860 goto out;
861 ORE_DBGMSG2("write_kern(0x%llx) offset=0x%llx " 861 ORE_DBGMSG2("write_kern(0x%llx) offset=0x%llx "
862 "length=0x%llx dev=%d\n", 862 "length=0x%llx dev=%d\n",
863 _LLU(_ios_obj(ios, dev)->id), 863 _LLU(_ios_obj(ios, cur_comp)->id),
864 _LLU(per_dev->offset), 864 _LLU(per_dev->offset),
865 _LLU(ios->length), per_dev->dev); 865 _LLU(ios->length), per_dev->dev);
866 } else { 866 } else {
867 osd_req_set_attributes(or, _ios_obj(ios, dev)); 867 osd_req_set_attributes(or, _ios_obj(ios, cur_comp));
868 ORE_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n", 868 ORE_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n",
869 _LLU(_ios_obj(ios, dev)->id), 869 _LLU(_ios_obj(ios, cur_comp)->id),
870 ios->out_attr_len, dev); 870 ios->out_attr_len, dev);
871 } 871 }
872 872
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 433783624d10..dde41a75c7c8 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -400,8 +400,6 @@ static int exofs_sync_fs(struct super_block *sb, int wait)
400 ret = ore_write(ios); 400 ret = ore_write(ios);
401 if (unlikely(ret)) 401 if (unlikely(ret))
402 EXOFS_ERR("%s: ore_write failed.\n", __func__); 402 EXOFS_ERR("%s: ore_write failed.\n", __func__);
403 else
404 sb->s_dirt = 0;
405 403
406 404
407 unlock_super(sb); 405 unlock_super(sb);
@@ -412,14 +410,6 @@ out:
412 return ret; 410 return ret;
413} 411}
414 412
415static void exofs_write_super(struct super_block *sb)
416{
417 if (!(sb->s_flags & MS_RDONLY))
418 exofs_sync_fs(sb, 1);
419 else
420 sb->s_dirt = 0;
421}
422
423static void _exofs_print_device(const char *msg, const char *dev_path, 413static void _exofs_print_device(const char *msg, const char *dev_path,
424 struct osd_dev *od, u64 pid) 414 struct osd_dev *od, u64 pid)
425{ 415{
@@ -952,7 +942,6 @@ static const struct super_operations exofs_sops = {
952 .write_inode = exofs_write_inode, 942 .write_inode = exofs_write_inode,
953 .evict_inode = exofs_evict_inode, 943 .evict_inode = exofs_evict_inode,
954 .put_super = exofs_put_super, 944 .put_super = exofs_put_super,
955 .write_super = exofs_write_super,
956 .sync_fs = exofs_sync_fs, 945 .sync_fs = exofs_sync_fs,
957 .statfs = exofs_statfs, 946 .statfs = exofs_statfs,
958}; 947};
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 9a4a5c48b1c9..a07597307fd1 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -3459,14 +3459,6 @@ ext3_reserve_inode_write(handle_t *handle, struct inode *inode,
3459 * inode out, but prune_icache isn't a user-visible syncing function. 3459 * inode out, but prune_icache isn't a user-visible syncing function.
3460 * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync) 3460 * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync)
3461 * we start and wait on commits. 3461 * we start and wait on commits.
3462 *
3463 * Is this efficient/effective? Well, we're being nice to the system
3464 * by cleaning up our inodes proactively so they can be reaped
3465 * without I/O. But we are potentially leaving up to five seconds'
3466 * worth of inodes floating about which prune_icache wants us to
3467 * write out. One way to fix that would be to get prune_icache()
3468 * to do a write_super() to free up some memory. It has the desired
3469 * effect.
3470 */ 3462 */
3471int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) 3463int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode)
3472{ 3464{
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index ff9bcdc5b0d5..8c892e93d8e7 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -64,11 +64,6 @@ static int ext3_freeze(struct super_block *sb);
64 64
65/* 65/*
66 * Wrappers for journal_start/end. 66 * Wrappers for journal_start/end.
67 *
68 * The only special thing we need to do here is to make sure that all
69 * journal_end calls result in the superblock being marked dirty, so
70 * that sync() will call the filesystem's write_super callback if
71 * appropriate.
72 */ 67 */
73handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) 68handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks)
74{ 69{
@@ -90,12 +85,6 @@ handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks)
90 return journal_start(journal, nblocks); 85 return journal_start(journal, nblocks);
91} 86}
92 87
93/*
94 * The only special thing we need to do here is to make sure that all
95 * journal_stop calls result in the superblock being marked dirty, so
96 * that sync() will call the filesystem's write_super callback if
97 * appropriate.
98 */
99int __ext3_journal_stop(const char *where, handle_t *handle) 88int __ext3_journal_stop(const char *where, handle_t *handle)
100{ 89{
101 struct super_block *sb; 90 struct super_block *sb;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index d23b31ca9d7a..1b5089067d01 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -280,14 +280,18 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
280 return desc; 280 return desc;
281} 281}
282 282
283static int ext4_valid_block_bitmap(struct super_block *sb, 283/*
284 struct ext4_group_desc *desc, 284 * Return the block number which was discovered to be invalid, or 0 if
285 unsigned int block_group, 285 * the block bitmap is valid.
286 struct buffer_head *bh) 286 */
287static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
288 struct ext4_group_desc *desc,
289 unsigned int block_group,
290 struct buffer_head *bh)
287{ 291{
288 ext4_grpblk_t offset; 292 ext4_grpblk_t offset;
289 ext4_grpblk_t next_zero_bit; 293 ext4_grpblk_t next_zero_bit;
290 ext4_fsblk_t bitmap_blk; 294 ext4_fsblk_t blk;
291 ext4_fsblk_t group_first_block; 295 ext4_fsblk_t group_first_block;
292 296
293 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) { 297 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
@@ -297,37 +301,33 @@ static int ext4_valid_block_bitmap(struct super_block *sb,
297 * or it has to also read the block group where the bitmaps 301 * or it has to also read the block group where the bitmaps
298 * are located to verify they are set. 302 * are located to verify they are set.
299 */ 303 */
300 return 1; 304 return 0;
301 } 305 }
302 group_first_block = ext4_group_first_block_no(sb, block_group); 306 group_first_block = ext4_group_first_block_no(sb, block_group);
303 307
304 /* check whether block bitmap block number is set */ 308 /* check whether block bitmap block number is set */
305 bitmap_blk = ext4_block_bitmap(sb, desc); 309 blk = ext4_block_bitmap(sb, desc);
306 offset = bitmap_blk - group_first_block; 310 offset = blk - group_first_block;
307 if (!ext4_test_bit(offset, bh->b_data)) 311 if (!ext4_test_bit(offset, bh->b_data))
308 /* bad block bitmap */ 312 /* bad block bitmap */
309 goto err_out; 313 return blk;
310 314
311 /* check whether the inode bitmap block number is set */ 315 /* check whether the inode bitmap block number is set */
312 bitmap_blk = ext4_inode_bitmap(sb, desc); 316 blk = ext4_inode_bitmap(sb, desc);
313 offset = bitmap_blk - group_first_block; 317 offset = blk - group_first_block;
314 if (!ext4_test_bit(offset, bh->b_data)) 318 if (!ext4_test_bit(offset, bh->b_data))
315 /* bad block bitmap */ 319 /* bad block bitmap */
316 goto err_out; 320 return blk;
317 321
318 /* check whether the inode table block number is set */ 322 /* check whether the inode table block number is set */
319 bitmap_blk = ext4_inode_table(sb, desc); 323 blk = ext4_inode_table(sb, desc);
320 offset = bitmap_blk - group_first_block; 324 offset = blk - group_first_block;
321 next_zero_bit = ext4_find_next_zero_bit(bh->b_data, 325 next_zero_bit = ext4_find_next_zero_bit(bh->b_data,
322 offset + EXT4_SB(sb)->s_itb_per_group, 326 offset + EXT4_SB(sb)->s_itb_per_group,
323 offset); 327 offset);
324 if (next_zero_bit >= offset + EXT4_SB(sb)->s_itb_per_group) 328 if (next_zero_bit < offset + EXT4_SB(sb)->s_itb_per_group)
325 /* good bitmap for inode tables */ 329 /* bad bitmap for inode tables */
326 return 1; 330 return blk;
327
328err_out:
329 ext4_error(sb, "Invalid block bitmap - block_group = %d, block = %llu",
330 block_group, bitmap_blk);
331 return 0; 331 return 0;
332} 332}
333 333
@@ -336,14 +336,26 @@ void ext4_validate_block_bitmap(struct super_block *sb,
336 unsigned int block_group, 336 unsigned int block_group,
337 struct buffer_head *bh) 337 struct buffer_head *bh)
338{ 338{
339 ext4_fsblk_t blk;
340
339 if (buffer_verified(bh)) 341 if (buffer_verified(bh))
340 return; 342 return;
341 343
342 ext4_lock_group(sb, block_group); 344 ext4_lock_group(sb, block_group);
343 if (ext4_valid_block_bitmap(sb, desc, block_group, bh) && 345 blk = ext4_valid_block_bitmap(sb, desc, block_group, bh);
344 ext4_block_bitmap_csum_verify(sb, block_group, desc, bh, 346 if (unlikely(blk != 0)) {
345 EXT4_BLOCKS_PER_GROUP(sb) / 8)) 347 ext4_unlock_group(sb, block_group);
346 set_buffer_verified(bh); 348 ext4_error(sb, "bg %u: block %llu: invalid block bitmap",
349 block_group, blk);
350 return;
351 }
352 if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
353 desc, bh, EXT4_BLOCKS_PER_GROUP(sb) / 8))) {
354 ext4_unlock_group(sb, block_group);
355 ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
356 return;
357 }
358 set_buffer_verified(bh);
347 ext4_unlock_group(sb, block_group); 359 ext4_unlock_group(sb, block_group);
348} 360}
349 361
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index f8716eab9995..5c2d1813ebe9 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -79,7 +79,6 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
79 if (provided == calculated) 79 if (provided == calculated)
80 return 1; 80 return 1;
81 81
82 ext4_error(sb, "Bad block bitmap checksum: block_group = %u", group);
83 return 0; 82 return 0;
84} 83}
85 84
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index cd0c7ed06772..aabbb3f53683 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2662,6 +2662,7 @@ cont:
2662 } 2662 }
2663 path[0].p_depth = depth; 2663 path[0].p_depth = depth;
2664 path[0].p_hdr = ext_inode_hdr(inode); 2664 path[0].p_hdr = ext_inode_hdr(inode);
2665 i = 0;
2665 2666
2666 if (ext4_ext_check(inode, path[0].p_hdr, depth)) { 2667 if (ext4_ext_check(inode, path[0].p_hdr, depth)) {
2667 err = -EIO; 2668 err = -EIO;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 6324f74e0342..dff171c3a123 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1970,7 +1970,7 @@ static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate);
1970 * This function can get called via... 1970 * This function can get called via...
1971 * - ext4_da_writepages after taking page lock (have journal handle) 1971 * - ext4_da_writepages after taking page lock (have journal handle)
1972 * - journal_submit_inode_data_buffers (no journal handle) 1972 * - journal_submit_inode_data_buffers (no journal handle)
1973 * - shrink_page_list via pdflush (no journal handle) 1973 * - shrink_page_list via the kswapd/direct reclaim (no journal handle)
1974 * - grab_page_cache when doing write_begin (have journal handle) 1974 * - grab_page_cache when doing write_begin (have journal handle)
1975 * 1975 *
1976 * We don't do any block allocation in this function. If we have page with 1976 * We don't do any block allocation in this function. If we have page with
@@ -4589,14 +4589,6 @@ static int ext4_expand_extra_isize(struct inode *inode,
4589 * inode out, but prune_icache isn't a user-visible syncing function. 4589 * inode out, but prune_icache isn't a user-visible syncing function.
4590 * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync) 4590 * Whenever the user wants stuff synced (sys_sync, sys_msync, sys_fsync)
4591 * we start and wait on commits. 4591 * we start and wait on commits.
4592 *
4593 * Is this efficient/effective? Well, we're being nice to the system
4594 * by cleaning up our inodes proactively so they can be reaped
4595 * without I/O. But we are potentially leaving up to five seconds'
4596 * worth of inodes floating about which prune_icache wants us to
4597 * write out. One way to fix that would be to get prune_icache()
4598 * to do a write_super() to free up some memory. It has the desired
4599 * effect.
4600 */ 4592 */
4601int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) 4593int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
4602{ 4594{
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d76ec8277d3f..c6e0cb3d1f4a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -326,11 +326,6 @@ static void ext4_put_nojournal(handle_t *handle)
326 326
327/* 327/*
328 * Wrappers for jbd2_journal_start/end. 328 * Wrappers for jbd2_journal_start/end.
329 *
330 * The only special thing we need to do here is to make sure that all
331 * journal_end calls result in the superblock being marked dirty, so
332 * that sync() will call the filesystem's write_super callback if
333 * appropriate.
334 */ 329 */
335handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) 330handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)
336{ 331{
@@ -356,12 +351,6 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)
356 return jbd2_journal_start(journal, nblocks); 351 return jbd2_journal_start(journal, nblocks);
357} 352}
358 353
359/*
360 * The only special thing we need to do here is to make sure that all
361 * jbd2_journal_stop calls result in the superblock being marked dirty, so
362 * that sync() will call the filesystem's write_super callback if
363 * appropriate.
364 */
365int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle) 354int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)
366{ 355{
367 struct super_block *sb; 356 struct super_block *sb;
@@ -959,6 +948,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
959 ei->i_reserved_meta_blocks = 0; 948 ei->i_reserved_meta_blocks = 0;
960 ei->i_allocated_meta_blocks = 0; 949 ei->i_allocated_meta_blocks = 0;
961 ei->i_da_metadata_calc_len = 0; 950 ei->i_da_metadata_calc_len = 0;
951 ei->i_da_metadata_calc_last_lblock = 0;
962 spin_lock_init(&(ei->i_block_reservation_lock)); 952 spin_lock_init(&(ei->i_block_reservation_lock));
963#ifdef CONFIG_QUOTA 953#ifdef CONFIG_QUOTA
964 ei->i_reserved_quota = 0; 954 ei->i_reserved_quota = 0;
@@ -3119,6 +3109,10 @@ static int count_overhead(struct super_block *sb, ext4_group_t grp,
3119 ext4_group_t i, ngroups = ext4_get_groups_count(sb); 3109 ext4_group_t i, ngroups = ext4_get_groups_count(sb);
3120 int s, j, count = 0; 3110 int s, j, count = 0;
3121 3111
3112 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC))
3113 return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) +
3114 sbi->s_itb_per_group + 2);
3115
3122 first_block = le32_to_cpu(sbi->s_es->s_first_data_block) + 3116 first_block = le32_to_cpu(sbi->s_es->s_first_data_block) +
3123 (grp * EXT4_BLOCKS_PER_GROUP(sb)); 3117 (grp * EXT4_BLOCKS_PER_GROUP(sb));
3124 last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1; 3118 last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1;
@@ -4430,6 +4424,7 @@ static void ext4_clear_journal_err(struct super_block *sb,
4430 ext4_commit_super(sb, 1); 4424 ext4_commit_super(sb, 1);
4431 4425
4432 jbd2_journal_clear_err(journal); 4426 jbd2_journal_clear_err(journal);
4427 jbd2_journal_update_sb_errno(journal);
4433 } 4428 }
4434} 4429}
4435 4430
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 93d8d6c9494d..aba15f1b7ad2 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -703,13 +703,16 @@ static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
703 unsigned long nr_segs, loff_t pos) 703 unsigned long nr_segs, loff_t pos)
704{ 704{
705 struct inode *inode = iocb->ki_filp->f_mapping->host; 705 struct inode *inode = iocb->ki_filp->f_mapping->host;
706 struct fuse_conn *fc = get_fuse_conn(inode);
706 707
707 if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) { 708 /*
709 * In auto invalidate mode, always update attributes on read.
710 * Otherwise, only update if we attempt to read past EOF (to ensure
711 * i_size is up to date).
712 */
713 if (fc->auto_inval_data ||
714 (pos + iov_length(iov, nr_segs) > i_size_read(inode))) {
708 int err; 715 int err;
709 /*
710 * If trying to read past EOF, make sure the i_size
711 * attribute is up-to-date.
712 */
713 err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL); 716 err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL);
714 if (err) 717 if (err)
715 return err; 718 return err;
@@ -1700,7 +1703,7 @@ static int fuse_verify_ioctl_iov(struct iovec *iov, size_t count)
1700 size_t n; 1703 size_t n;
1701 u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT; 1704 u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT;
1702 1705
1703 for (n = 0; n < count; n++) { 1706 for (n = 0; n < count; n++, iov++) {
1704 if (iov->iov_len > (size_t) max) 1707 if (iov->iov_len > (size_t) max)
1705 return -ENOMEM; 1708 return -ENOMEM;
1706 max -= iov->iov_len; 1709 max -= iov->iov_len;
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 771fb6322c07..e24dd74e3068 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -484,6 +484,9 @@ struct fuse_conn {
484 /** Is fallocate not implemented by fs? */ 484 /** Is fallocate not implemented by fs? */
485 unsigned no_fallocate:1; 485 unsigned no_fallocate:1;
486 486
487 /** Use enhanced/automatic page cache invalidation. */
488 unsigned auto_inval_data:1;
489
487 /** The number of requests waiting for completion */ 490 /** The number of requests waiting for completion */
488 atomic_t num_waiting; 491 atomic_t num_waiting;
489 492
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 1cd61652018c..ce0a2838ccd0 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -197,6 +197,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
197 struct fuse_conn *fc = get_fuse_conn(inode); 197 struct fuse_conn *fc = get_fuse_conn(inode);
198 struct fuse_inode *fi = get_fuse_inode(inode); 198 struct fuse_inode *fi = get_fuse_inode(inode);
199 loff_t oldsize; 199 loff_t oldsize;
200 struct timespec old_mtime;
200 201
201 spin_lock(&fc->lock); 202 spin_lock(&fc->lock);
202 if (attr_version != 0 && fi->attr_version > attr_version) { 203 if (attr_version != 0 && fi->attr_version > attr_version) {
@@ -204,15 +205,35 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
204 return; 205 return;
205 } 206 }
206 207
208 old_mtime = inode->i_mtime;
207 fuse_change_attributes_common(inode, attr, attr_valid); 209 fuse_change_attributes_common(inode, attr, attr_valid);
208 210
209 oldsize = inode->i_size; 211 oldsize = inode->i_size;
210 i_size_write(inode, attr->size); 212 i_size_write(inode, attr->size);
211 spin_unlock(&fc->lock); 213 spin_unlock(&fc->lock);
212 214
213 if (S_ISREG(inode->i_mode) && oldsize != attr->size) { 215 if (S_ISREG(inode->i_mode)) {
214 truncate_pagecache(inode, oldsize, attr->size); 216 bool inval = false;
215 invalidate_inode_pages2(inode->i_mapping); 217
218 if (oldsize != attr->size) {
219 truncate_pagecache(inode, oldsize, attr->size);
220 inval = true;
221 } else if (fc->auto_inval_data) {
222 struct timespec new_mtime = {
223 .tv_sec = attr->mtime,
224 .tv_nsec = attr->mtimensec,
225 };
226
227 /*
228 * Auto inval mode also checks and invalidates if mtime
229 * has changed.
230 */
231 if (!timespec_equal(&old_mtime, &new_mtime))
232 inval = true;
233 }
234
235 if (inval)
236 invalidate_inode_pages2(inode->i_mapping);
216 } 237 }
217} 238}
218 239
@@ -834,6 +855,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
834 fc->big_writes = 1; 855 fc->big_writes = 1;
835 if (arg->flags & FUSE_DONT_MASK) 856 if (arg->flags & FUSE_DONT_MASK)
836 fc->dont_mask = 1; 857 fc->dont_mask = 1;
858 if (arg->flags & FUSE_AUTO_INVAL_DATA)
859 fc->auto_inval_data = 1;
837 } else { 860 } else {
838 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 861 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
839 fc->no_lock = 1; 862 fc->no_lock = 1;
@@ -859,7 +882,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
859 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 882 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
860 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC | 883 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC |
861 FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | 884 FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK |
862 FUSE_FLOCK_LOCKS; 885 FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ |
886 FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA;
863 req->in.h.opcode = FUSE_INIT; 887 req->in.h.opcode = FUSE_INIT;
864 req->in.numargs = 1; 888 req->in.numargs = 1;
865 req->in.args[0].size = sizeof(*arg); 889 req->in.args[0].size = sizeof(*arg);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 3a56c8d94de0..22255d96b27e 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -52,7 +52,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
52 /* 52 /*
53 * If it's a fully non-blocking write attempt and we cannot 53 * If it's a fully non-blocking write attempt and we cannot
54 * lock the buffer then redirty the page. Note that this can 54 * lock the buffer then redirty the page. Note that this can
55 * potentially cause a busy-wait loop from pdflush and kswapd 55 * potentially cause a busy-wait loop from flusher thread and kswapd
56 * activity, but those code paths have their own higher-level 56 * activity, but those code paths have their own higher-level
57 * throttling. 57 * throttling.
58 */ 58 */
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c
index 5fd51a5833ff..b7ec224910c5 100644
--- a/fs/hfs/mdb.c
+++ b/fs/hfs/mdb.c
@@ -236,10 +236,10 @@ out:
236 * hfs_mdb_commit() 236 * hfs_mdb_commit()
237 * 237 *
238 * Description: 238 * Description:
239 * This updates the MDB on disk (look also at hfs_write_super()). 239 * This updates the MDB on disk.
240 * It does not check, if the superblock has been modified, or 240 * It does not check, if the superblock has been modified, or
241 * if the filesystem has been mounted read-only. It is mainly 241 * if the filesystem has been mounted read-only. It is mainly
242 * called by hfs_write_super() and hfs_btree_extend(). 242 * called by hfs_sync_fs() and flush_mdb().
243 * Input Variable(s): 243 * Input Variable(s):
244 * struct hfs_mdb *mdb: Pointer to the hfs MDB 244 * struct hfs_mdb *mdb: Pointer to the hfs MDB
245 * int backup; 245 * int backup;
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 425c2f2cf170..09357508ec9a 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -534,8 +534,8 @@ int journal_start_commit(journal_t *journal, tid_t *ptid)
534 ret = 1; 534 ret = 1;
535 } else if (journal->j_committing_transaction) { 535 } else if (journal->j_committing_transaction) {
536 /* 536 /*
537 * If ext3_write_super() recently started a commit, then we 537 * If commit has been started, then we have to wait for
538 * have to wait for completion of that transaction 538 * completion of that transaction.
539 */ 539 */
540 if (ptid) 540 if (ptid)
541 *ptid = journal->j_committing_transaction->t_tid; 541 *ptid = journal->j_committing_transaction->t_tid;
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e9a3c4c85594..e149b99a7ffb 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -612,8 +612,8 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
612 ret = 1; 612 ret = 1;
613 } else if (journal->j_committing_transaction) { 613 } else if (journal->j_committing_transaction) {
614 /* 614 /*
615 * If ext3_write_super() recently started a commit, then we 615 * If commit has been started, then we have to wait for
616 * have to wait for completion of that transaction 616 * completion of that transaction.
617 */ 617 */
618 if (ptid) 618 if (ptid)
619 *ptid = journal->j_committing_transaction->t_tid; 619 *ptid = journal->j_committing_transaction->t_tid;
@@ -1377,7 +1377,7 @@ static void jbd2_mark_journal_empty(journal_t *journal)
1377 * Update a journal's errno. Write updated superblock to disk waiting for IO 1377 * Update a journal's errno. Write updated superblock to disk waiting for IO
1378 * to complete. 1378 * to complete.
1379 */ 1379 */
1380static void jbd2_journal_update_sb_errno(journal_t *journal) 1380void jbd2_journal_update_sb_errno(journal_t *journal)
1381{ 1381{
1382 journal_superblock_t *sb = journal->j_superblock; 1382 journal_superblock_t *sb = journal->j_superblock;
1383 1383
@@ -1390,6 +1390,7 @@ static void jbd2_journal_update_sb_errno(journal_t *journal)
1390 1390
1391 jbd2_write_superblock(journal, WRITE_SYNC); 1391 jbd2_write_superblock(journal, WRITE_SYNC);
1392} 1392}
1393EXPORT_SYMBOL(jbd2_journal_update_sb_errno);
1393 1394
1394/* 1395/*
1395 * Read the superblock for a given journal, performing initial 1396 * Read the superblock for a given journal, performing initial
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 6522cac6057c..6a10812711c1 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -676,17 +676,13 @@ static const struct super_operations nilfs_sops = {
676 .alloc_inode = nilfs_alloc_inode, 676 .alloc_inode = nilfs_alloc_inode,
677 .destroy_inode = nilfs_destroy_inode, 677 .destroy_inode = nilfs_destroy_inode,
678 .dirty_inode = nilfs_dirty_inode, 678 .dirty_inode = nilfs_dirty_inode,
679 /* .write_inode = nilfs_write_inode, */
680 /* .drop_inode = nilfs_drop_inode, */
681 .evict_inode = nilfs_evict_inode, 679 .evict_inode = nilfs_evict_inode,
682 .put_super = nilfs_put_super, 680 .put_super = nilfs_put_super,
683 /* .write_super = nilfs_write_super, */
684 .sync_fs = nilfs_sync_fs, 681 .sync_fs = nilfs_sync_fs,
685 .freeze_fs = nilfs_freeze, 682 .freeze_fs = nilfs_freeze,
686 .unfreeze_fs = nilfs_unfreeze, 683 .unfreeze_fs = nilfs_unfreeze,
687 .statfs = nilfs_statfs, 684 .statfs = nilfs_statfs,
688 .remount_fs = nilfs_remount, 685 .remount_fs = nilfs_remount,
689 /* .umount_begin */
690 .show_options = nilfs_show_options 686 .show_options = nilfs_show_options
691}; 687};
692 688
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index 6eee4177807b..be1267a34cea 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -107,8 +107,6 @@ struct the_nilfs {
107 * used for 107 * used for
108 * - loading the latest checkpoint exclusively. 108 * - loading the latest checkpoint exclusively.
109 * - allocating a new full segment. 109 * - allocating a new full segment.
110 * - protecting s_dirt in the super_block struct
111 * (see nilfs_write_super) and the following fields.
112 */ 110 */
113 struct buffer_head *ns_sbh[2]; 111 struct buffer_head *ns_sbh[2];
114 struct nilfs_super_block *ns_sbp[2]; 112 struct nilfs_super_block *ns_sbp[2];
diff --git a/fs/open.c b/fs/open.c
index f3d96e7e7b19..bc132e167d2d 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -717,7 +717,7 @@ cleanup_all:
717 * here, so just reset the state. 717 * here, so just reset the state.
718 */ 718 */
719 file_reset_write(f); 719 file_reset_write(f);
720 mnt_drop_write(f->f_path.mnt); 720 __mnt_drop_write(f->f_path.mnt);
721 } 721 }
722 } 722 }
723cleanup_file: 723cleanup_file:
diff --git a/fs/super.c b/fs/super.c
index b05cf47463d0..0902cfa6a12e 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -537,46 +537,6 @@ void drop_super(struct super_block *sb)
537EXPORT_SYMBOL(drop_super); 537EXPORT_SYMBOL(drop_super);
538 538
539/** 539/**
540 * sync_supers - helper for periodic superblock writeback
541 *
542 * Call the write_super method if present on all dirty superblocks in
543 * the system. This is for the periodic writeback used by most older
544 * filesystems. For data integrity superblock writeback use
545 * sync_filesystems() instead.
546 *
547 * Note: check the dirty flag before waiting, so we don't
548 * hold up the sync while mounting a device. (The newly
549 * mounted device won't need syncing.)
550 */
551void sync_supers(void)
552{
553 struct super_block *sb, *p = NULL;
554
555 spin_lock(&sb_lock);
556 list_for_each_entry(sb, &super_blocks, s_list) {
557 if (hlist_unhashed(&sb->s_instances))
558 continue;
559 if (sb->s_op->write_super && sb->s_dirt) {
560 sb->s_count++;
561 spin_unlock(&sb_lock);
562
563 down_read(&sb->s_umount);
564 if (sb->s_root && sb->s_dirt && (sb->s_flags & MS_BORN))
565 sb->s_op->write_super(sb);
566 up_read(&sb->s_umount);
567
568 spin_lock(&sb_lock);
569 if (p)
570 __put_super(p);
571 p = sb;
572 }
573 }
574 if (p)
575 __put_super(p);
576 spin_unlock(&sb_lock);
577}
578
579/**
580 * iterate_supers - call function for all active superblocks 540 * iterate_supers - call function for all active superblocks
581 * @f: function to call 541 * @f: function to call
582 * @arg: argument to pass to it 542 * @arg: argument to pass to it
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 35389ca2d267..7bd6e72afd11 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -37,11 +37,11 @@
37 * 37 *
38 * A thing to keep in mind: inode @i_mutex is locked in most VFS operations we 38 * A thing to keep in mind: inode @i_mutex is locked in most VFS operations we
39 * implement. However, this is not true for 'ubifs_writepage()', which may be 39 * implement. However, this is not true for 'ubifs_writepage()', which may be
40 * called with @i_mutex unlocked. For example, when pdflush is doing background 40 * called with @i_mutex unlocked. For example, when flusher thread is doing
41 * write-back, it calls 'ubifs_writepage()' with unlocked @i_mutex. At "normal" 41 * background write-back, it calls 'ubifs_writepage()' with unlocked @i_mutex.
42 * work-paths the @i_mutex is locked in 'ubifs_writepage()', e.g. in the 42 * At "normal" work-paths the @i_mutex is locked in 'ubifs_writepage()', e.g.
43 * "sys_write -> alloc_pages -> direct reclaim path". So, in 'ubifs_writepage()' 43 * in the "sys_write -> alloc_pages -> direct reclaim path". So, in
44 * we are only guaranteed that the page is locked. 44 * 'ubifs_writepage()' we are only guaranteed that the page is locked.
45 * 45 *
46 * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the 46 * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the
47 * read-ahead path does not lock it ("sys_read -> generic_file_aio_read -> 47 * read-ahead path does not lock it ("sys_read -> generic_file_aio_read ->
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 1c766c39c038..c3fa6c5327a3 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -303,7 +303,7 @@ static int ubifs_write_inode(struct inode *inode, struct writeback_control *wbc)
303 mutex_lock(&ui->ui_mutex); 303 mutex_lock(&ui->ui_mutex);
304 /* 304 /*
305 * Due to races between write-back forced by budgeting 305 * Due to races between write-back forced by budgeting
306 * (see 'sync_some_inodes()') and pdflush write-back, the inode may 306 * (see 'sync_some_inodes()') and background write-back, the inode may
307 * have already been synchronized, do not do this again. This might 307 * have already been synchronized, do not do this again. This might
308 * also happen if it was synchronized in an VFS operation, e.g. 308 * also happen if it was synchronized in an VFS operation, e.g.
309 * 'ubifs_link()'. 309 * 'ubifs_link()'.
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 2c744c7a5b3d..26a92fc28a59 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -491,11 +491,11 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
491 491
492acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); 492acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
493 493
494acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state, u8 flags); 494acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state);
495 495
496ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)) 496ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void))
497 497
498acpi_status acpi_leave_sleep_state_prep(u8 sleep_state, u8 flags); 498acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
499 499
500acpi_status acpi_leave_sleep_state(u8 sleep_state); 500acpi_status acpi_leave_sleep_state(u8 sleep_state);
501 501
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3af87de6a68c..3d00bd5bd7e3 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -803,7 +803,7 @@ typedef u8 acpi_adr_space_type;
803 803
804/* Sleep function dispatch */ 804/* Sleep function dispatch */
805 805
806typedef acpi_status(*ACPI_SLEEP_FUNCTION) (u8 sleep_state, u8 flags); 806typedef acpi_status(*ACPI_SLEEP_FUNCTION) (u8 sleep_state);
807 807
808struct acpi_sleep_functions { 808struct acpi_sleep_functions {
809 ACPI_SLEEP_FUNCTION legacy_function; 809 ACPI_SLEEP_FUNCTION legacy_function;
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 7ff5c99b1638..c78bb997e2c6 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -213,9 +213,12 @@
213 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 213 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
214 {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 214 {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
215 {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 215 {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
216 {0x1002, 0x6806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
216 {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 217 {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
217 {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 218 {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
218 {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 219 {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
220 {0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
221 {0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
219 {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 222 {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
220 {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 223 {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
221 {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 224 {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 58056865b8e9..dc3a8cd7db8a 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -964,6 +964,8 @@ struct drm_radeon_cs {
964#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f 964#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
965/* max pipes - needed for compute shaders */ 965/* max pipes - needed for compute shaders */
966#define RADEON_INFO_MAX_PIPES 0x10 966#define RADEON_INFO_MAX_PIPES 0x10
967/* timestamp for GL_ARB_timer_query (OpenGL), returns the current GPU clock */
968#define RADEON_INFO_TIMESTAMP 0x11
967 969
968struct drm_radeon_info { 970struct drm_radeon_info {
969 uint32_t request; 971 uint32_t request;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index d9a754474878..fa217607c582 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -391,6 +391,7 @@ header-y += v4l2-dv-timings.h
391header-y += v4l2-mediabus.h 391header-y += v4l2-mediabus.h
392header-y += v4l2-subdev.h 392header-y += v4l2-subdev.h
393header-y += veth.h 393header-y += veth.h
394header-y += vfio.h
394header-y += vhost.h 395header-y += vhost.h
395header-y += videodev2.h 396header-y += videodev2.h
396header-y += virtio_9p.h 397header-y += virtio_9p.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3ad510b25283..4f2a76224509 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -96,7 +96,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
96void acpi_numa_slit_init (struct acpi_table_slit *slit); 96void acpi_numa_slit_init (struct acpi_table_slit *slit);
97void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); 97void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
98void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); 98void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
99void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); 99int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
100void acpi_numa_arch_fixup(void); 100void acpi_numa_arch_fixup(void);
101 101
102#ifdef CONFIG_ACPI_HOTPLUG_CPU 102#ifdef CONFIG_ACPI_HOTPLUG_CPU
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index c97c6b9cd38e..2a9a9abc9126 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -124,7 +124,6 @@ void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
124void bdi_start_background_writeback(struct backing_dev_info *bdi); 124void bdi_start_background_writeback(struct backing_dev_info *bdi);
125int bdi_writeback_thread(void *data); 125int bdi_writeback_thread(void *data);
126int bdi_has_dirty_io(struct backing_dev_info *bdi); 126int bdi_has_dirty_io(struct backing_dev_info *bdi);
127void bdi_arm_supers_timer(void);
128void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 127void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
129void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2); 128void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
130 129
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 3c80885fa829..d323a4b4143c 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -89,6 +89,12 @@
89#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2 89#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2
90#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2 90#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2
91#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4 91#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4
92#define BCMA_CC_CHIPST_43228_ILP_DIV_EN 0x00000001
93#define BCMA_CC_CHIPST_43228_OTP_PRESENT 0x00000002
94#define BCMA_CC_CHIPST_43228_SERDES_REFCLK_PADSEL 0x00000004
95#define BCMA_CC_CHIPST_43228_SDIO_MODE 0x00000008
96#define BCMA_CC_CHIPST_43228_SDIO_OTP_PRESENT 0x00000010
97#define BCMA_CC_CHIPST_43228_SDIO_RESET 0x00000020
92#define BCMA_CC_CHIPST_4706_PKG_OPTION BIT(0) /* 0: full-featured package 1: low-cost package */ 98#define BCMA_CC_CHIPST_4706_PKG_OPTION BIT(0) /* 0: full-featured package 1: low-cost package */
93#define BCMA_CC_CHIPST_4706_SFLASH_PRESENT BIT(1) /* 0: parallel, 1: serial flash is present */ 99#define BCMA_CC_CHIPST_4706_SFLASH_PRESENT BIT(1) /* 0: parallel, 1: serial flash is present */
94#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */ 100#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */
diff --git a/include/linux/can.h b/include/linux/can.h
index 018055efc034..e52958d7c2d1 100644
--- a/include/linux/can.h
+++ b/include/linux/can.h
@@ -74,20 +74,21 @@ struct can_frame {
74/* 74/*
75 * defined bits for canfd_frame.flags 75 * defined bits for canfd_frame.flags
76 * 76 *
77 * As the default for CAN FD should be to support the high data rate in the 77 * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to
78 * payload section of the frame (HDR) and to support up to 64 byte in the 78 * be set in the CAN frame bitstream on the wire. The EDL bit switch turns
79 * data section (EDL) the bits are only set in the non-default case. 79 * the CAN controllers bitstream processor into the CAN FD mode which creates
80 * Btw. as long as there's no real implementation for CAN FD network driver 80 * two new options within the CAN FD frame specification:
81 * these bits are only preliminary.
82 * 81 *
83 * RX: NOHDR/NOEDL - info about received CAN FD frame 82 * Bit Rate Switch - to indicate a second bitrate is/was used for the payload
84 * ESI - bit from originating CAN controller 83 * Error State Indicator - represents the error state of the transmitting node
85 * TX: NOHDR/NOEDL - control per-frame settings if supported by CAN controller 84 *
86 * ESI - bit is set by local CAN controller 85 * As the CANFD_ESI bit is internally generated by the transmitting CAN
86 * controller only the CANFD_BRS bit is relevant for real CAN controllers when
87 * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make
88 * sense for virtual CAN interfaces to test applications with echoed frames.
87 */ 89 */
88#define CANFD_NOHDR 0x01 /* frame without high data rate */ 90#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
89#define CANFD_NOEDL 0x02 /* frame without extended data length */ 91#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
90#define CANFD_ESI 0x04 /* error state indicator */
91 92
92/** 93/**
93 * struct canfd_frame - CAN flexible data rate frame structure 94 * struct canfd_frame - CAN flexible data rate frame structure
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 38dba16c4176..aa110476a95b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1491,7 +1491,6 @@ struct sb_writers {
1491struct super_block { 1491struct super_block {
1492 struct list_head s_list; /* Keep this first */ 1492 struct list_head s_list; /* Keep this first */
1493 dev_t s_dev; /* search index; _not_ kdev_t */ 1493 dev_t s_dev; /* search index; _not_ kdev_t */
1494 unsigned char s_dirt;
1495 unsigned char s_blocksize_bits; 1494 unsigned char s_blocksize_bits;
1496 unsigned long s_blocksize; 1495 unsigned long s_blocksize;
1497 loff_t s_maxbytes; /* Max file size */ 1496 loff_t s_maxbytes; /* Max file size */
@@ -1861,7 +1860,6 @@ struct super_operations {
1861 int (*drop_inode) (struct inode *); 1860 int (*drop_inode) (struct inode *);
1862 void (*evict_inode) (struct inode *); 1861 void (*evict_inode) (struct inode *);
1863 void (*put_super) (struct super_block *); 1862 void (*put_super) (struct super_block *);
1864 void (*write_super) (struct super_block *);
1865 int (*sync_fs)(struct super_block *sb, int wait); 1863 int (*sync_fs)(struct super_block *sb, int wait);
1866 int (*freeze_fs) (struct super_block *); 1864 int (*freeze_fs) (struct super_block *);
1867 int (*unfreeze_fs) (struct super_block *); 1865 int (*unfreeze_fs) (struct super_block *);
@@ -2397,7 +2395,6 @@ extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2397 int datasync); 2395 int datasync);
2398extern int vfs_fsync(struct file *file, int datasync); 2396extern int vfs_fsync(struct file *file, int datasync);
2399extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2397extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2400extern void sync_supers(void);
2401extern void emergency_sync(void); 2398extern void emergency_sync(void);
2402extern void emergency_remount(void); 2399extern void emergency_remount(void);
2403#ifdef CONFIG_BLOCK 2400#ifdef CONFIG_BLOCK
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index af961d6f7ab1..642928cf57b4 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -306,9 +306,10 @@ extern void *perf_trace_buf_prepare(int size, unsigned short type,
306 306
307static inline void 307static inline void
308perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, 308perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
309 u64 count, struct pt_regs *regs, void *head) 309 u64 count, struct pt_regs *regs, void *head,
310 struct task_struct *task)
310{ 311{
311 perf_tp_event(addr, count, raw_data, size, regs, head, rctx); 312 perf_tp_event(addr, count, raw_data, size, regs, head, rctx, task);
312} 313}
313#endif 314#endif
314 315
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 9303348965fb..d8c713e148e3 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -57,6 +57,9 @@
57 * 57 *
58 * 7.19 58 * 7.19
59 * - add FUSE_FALLOCATE 59 * - add FUSE_FALLOCATE
60 *
61 * 7.20
62 * - add FUSE_AUTO_INVAL_DATA
60 */ 63 */
61 64
62#ifndef _LINUX_FUSE_H 65#ifndef _LINUX_FUSE_H
@@ -88,7 +91,7 @@
88#define FUSE_KERNEL_VERSION 7 91#define FUSE_KERNEL_VERSION 7
89 92
90/** Minor version number of this interface */ 93/** Minor version number of this interface */
91#define FUSE_KERNEL_MINOR_VERSION 19 94#define FUSE_KERNEL_MINOR_VERSION 20
92 95
93/** The node ID of the root inode */ 96/** The node ID of the root inode */
94#define FUSE_ROOT_ID 1 97#define FUSE_ROOT_ID 1
@@ -163,10 +166,19 @@ struct fuse_file_lock {
163/** 166/**
164 * INIT request/reply flags 167 * INIT request/reply flags
165 * 168 *
169 * FUSE_ASYNC_READ: asynchronous read requests
166 * FUSE_POSIX_LOCKS: remote locking for POSIX file locks 170 * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
171 * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
172 * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
167 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 173 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
174 * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
168 * FUSE_DONT_MASK: don't apply umask to file mode on create operations 175 * FUSE_DONT_MASK: don't apply umask to file mode on create operations
176 * FUSE_SPLICE_WRITE: kernel supports splice write on the device
177 * FUSE_SPLICE_MOVE: kernel supports splice move on the device
178 * FUSE_SPLICE_READ: kernel supports splice read on the device
169 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks 179 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
180 * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
181 * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
170 */ 182 */
171#define FUSE_ASYNC_READ (1 << 0) 183#define FUSE_ASYNC_READ (1 << 0)
172#define FUSE_POSIX_LOCKS (1 << 1) 184#define FUSE_POSIX_LOCKS (1 << 1)
@@ -175,7 +187,12 @@ struct fuse_file_lock {
175#define FUSE_EXPORT_SUPPORT (1 << 4) 187#define FUSE_EXPORT_SUPPORT (1 << 4)
176#define FUSE_BIG_WRITES (1 << 5) 188#define FUSE_BIG_WRITES (1 << 5)
177#define FUSE_DONT_MASK (1 << 6) 189#define FUSE_DONT_MASK (1 << 6)
190#define FUSE_SPLICE_WRITE (1 << 7)
191#define FUSE_SPLICE_MOVE (1 << 8)
192#define FUSE_SPLICE_READ (1 << 9)
178#define FUSE_FLOCK_LOCKS (1 << 10) 193#define FUSE_FLOCK_LOCKS (1 << 10)
194#define FUSE_HAS_IOCTL_DIR (1 << 11)
195#define FUSE_AUTO_INVAL_DATA (1 << 12)
179 196
180/** 197/**
181 * CUSE INIT request/reply flags 198 * CUSE INIT request/reply flags
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index bb7f30971858..305f23cd7cff 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -22,7 +22,7 @@
22 * 22 *
23 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024) 23 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
24 * - bit 26 is the NMI_MASK 24 * - bit 26 is the NMI_MASK
25 * - bit 28 is the PREEMPT_ACTIVE flag 25 * - bit 27 is the PREEMPT_ACTIVE flag
26 * 26 *
27 * PREEMPT_MASK: 0x000000ff 27 * PREEMPT_MASK: 0x000000ff
28 * SOFTIRQ_MASK: 0x0000ff00 28 * SOFTIRQ_MASK: 0x0000ff00
diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h
index b76b4a87065e..be91f344d5fc 100644
--- a/include/linux/iio/frequency/adf4350.h
+++ b/include/linux/iio/frequency/adf4350.h
@@ -87,6 +87,8 @@
87#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */ 87#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */
88#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */ 88#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */
89#define ADF4350_MAX_MODULUS 4095 89#define ADF4350_MAX_MODULUS 4095
90#define ADF4350_MAX_R_CNT 1023
91
90 92
91/** 93/**
92 * struct adf4350_platform_data - platform specific information 94 * struct adf4350_platform_data - platform specific information
diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h
index f875b316249d..16625d799b6f 100644
--- a/include/linux/input/eeti_ts.h
+++ b/include/linux/input/eeti_ts.h
@@ -2,6 +2,7 @@
2#define LINUX_INPUT_EETI_TS_H 2#define LINUX_INPUT_EETI_TS_H
3 3
4struct eeti_ts_platform_data { 4struct eeti_ts_platform_data {
5 int irq_gpio;
5 unsigned int irq_active_high; 6 unsigned int irq_active_high;
6}; 7};
7 8
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 54d6d690073c..7e83370e6fd2 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -20,6 +20,7 @@
20#define __LINUX_IOMMU_H 20#define __LINUX_IOMMU_H
21 21
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/types.h>
23 24
24#define IOMMU_READ (1) 25#define IOMMU_READ (1)
25#define IOMMU_WRITE (2) 26#define IOMMU_WRITE (2)
@@ -30,6 +31,7 @@ struct iommu_group;
30struct bus_type; 31struct bus_type;
31struct device; 32struct device;
32struct iommu_domain; 33struct iommu_domain;
34struct notifier_block;
33 35
34/* iommu fault flags */ 36/* iommu fault flags */
35#define IOMMU_FAULT_READ 0x0 37#define IOMMU_FAULT_READ 0x0
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 379e433e15e0..879db26ec401 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -369,6 +369,7 @@ struct ipv6_pinfo {
369 __u8 rcv_tclass; 369 __u8 rcv_tclass;
370 370
371 __u32 dst_cookie; 371 __u32 dst_cookie;
372 __u32 rx_dst_cookie;
372 373
373 struct ipv6_mc_socklist __rcu *ipv6_mc_list; 374 struct ipv6_mc_socklist __rcu *ipv6_mc_list;
374 struct ipv6_ac_socklist *ipv6_ac_list; 375 struct ipv6_ac_socklist *ipv6_ac_list;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 553fb66da130..216b0ba109d7 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -349,6 +349,7 @@ enum {
349 IRQCHIP_MASK_ON_SUSPEND = (1 << 2), 349 IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
350 IRQCHIP_ONOFFLINE_ENABLED = (1 << 3), 350 IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
351 IRQCHIP_SKIP_SET_WAKE = (1 << 4), 351 IRQCHIP_SKIP_SET_WAKE = (1 << 4),
352 IRQCHIP_ONESHOT_SAFE = (1 << 5),
352}; 353};
353 354
354/* This include will go away once we isolated irq_desc usage to core code */ 355/* This include will go away once we isolated irq_desc usage to core code */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index f334c7fab967..3efc43f3f162 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1125,6 +1125,7 @@ extern int jbd2_journal_destroy (journal_t *);
1125extern int jbd2_journal_recover (journal_t *journal); 1125extern int jbd2_journal_recover (journal_t *journal);
1126extern int jbd2_journal_wipe (journal_t *, int); 1126extern int jbd2_journal_wipe (journal_t *, int);
1127extern int jbd2_journal_skip_recovery (journal_t *); 1127extern int jbd2_journal_skip_recovery (journal_t *);
1128extern void jbd2_journal_update_sb_errno(journal_t *);
1128extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, 1129extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t,
1129 unsigned long, int); 1130 unsigned long, int);
1130extern void __jbd2_journal_abort_hard (journal_t *); 1131extern void __jbd2_journal_abort_hard (journal_t *);
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 265e2c3cbd1c..82680541576d 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -39,9 +39,6 @@
39# error Invalid value of HZ. 39# error Invalid value of HZ.
40#endif 40#endif
41 41
42/* LATCH is used in the interval timer and ftape setup. */
43#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
44
45/* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can 42/* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can
46 * improve accuracy by shifting LSH bits, hence calculating: 43 * improve accuracy by shifting LSH bits, hence calculating:
47 * (NOM << LSH) / DEN 44 * (NOM << LSH) / DEN
@@ -54,18 +51,30 @@
54#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \ 51#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \
55 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) 52 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
56 53
57/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 54#ifdef CLOCK_TICK_RATE
58#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 55/* LATCH is used in the interval timer and ftape setup. */
56# define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
57
58/*
59 * HZ is the requested value. However the CLOCK_TICK_RATE may not allow
60 * for exactly HZ. So SHIFTED_HZ is high res HZ ("<< 8" is for accuracy)
61 */
62# define SHIFTED_HZ (SH_DIV(CLOCK_TICK_RATE, LATCH, 8))
63#else
64# define SHIFTED_HZ (HZ << 8)
65#endif
59 66
60/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ 67/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
61#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) 68#define TICK_NSEC (SH_DIV(1000000UL * 1000, SHIFTED_HZ, 8))
62 69
63/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 70/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
64#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 71#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
65 72
66/* TICK_USEC_TO_NSEC is the time between ticks in nsec assuming real ACTHZ and */ 73/*
67/* a value TUSEC for TICK_USEC (can be set bij adjtimex) */ 74 * TICK_USEC_TO_NSEC is the time between ticks in nsec assuming SHIFTED_HZ and
68#define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV (TUSEC * USER_HZ * 1000, ACTHZ, 8)) 75 * a value TUSEC for TICK_USEC (can be set bij adjtimex)
76 */
77#define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV(TUSEC * USER_HZ * 1000, SHIFTED_HZ, 8))
69 78
70/* some arch's have a small-data section that can be accessed register-relative 79/* some arch's have a small-data section that can be accessed register-relative
71 * but that can only take up to, say, 4-byte variables. jiffies being part of 80 * but that can only take up to, say, 4-byte variables. jiffies being part of
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 064725854db8..42d9e863a313 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -75,8 +75,6 @@ extern const char *kdb_diemsg;
75#define KDB_FLAG_CATASTROPHIC (1 << 1) /* A catastrophic event has occurred */ 75#define KDB_FLAG_CATASTROPHIC (1 << 1) /* A catastrophic event has occurred */
76#define KDB_FLAG_CMD_INTERRUPT (1 << 2) /* Previous command was interrupted */ 76#define KDB_FLAG_CMD_INTERRUPT (1 << 2) /* Previous command was interrupted */
77#define KDB_FLAG_NOIPI (1 << 3) /* Do not send IPIs */ 77#define KDB_FLAG_NOIPI (1 << 3) /* Do not send IPIs */
78#define KDB_FLAG_ONLY_DO_DUMP (1 << 4) /* Only do a dump, used when
79 * kdb is off */
80#define KDB_FLAG_NO_CONSOLE (1 << 5) /* No console is available, 78#define KDB_FLAG_NO_CONSOLE (1 << 5) /* No console is available,
81 * kdb is disabled */ 79 * kdb is disabled */
82#define KDB_FLAG_NO_VT_CONSOLE (1 << 6) /* No VT console is available, do 80#define KDB_FLAG_NO_VT_CONSOLE (1 << 6) /* No VT console is available, do
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index 40c372165f3e..32a1b5cfeba1 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -16,6 +16,7 @@ struct pcap_subdev {
16struct pcap_platform_data { 16struct pcap_platform_data {
17 unsigned int irq_base; 17 unsigned int irq_base;
18 unsigned int config; 18 unsigned int config;
19 int gpio;
19 void (*init) (void *); /* board specific init */ 20 void (*init) (void *); /* board specific init */
20 int num_subdevs; 21 int num_subdevs;
21 struct pcap_subdev *subdevs; 22 struct pcap_subdev *subdevs;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index eb06e58bed0b..a9db4f33407f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1300,6 +1300,8 @@ struct net_device {
1300 /* for setting kernel sock attribute on TCP connection setup */ 1300 /* for setting kernel sock attribute on TCP connection setup */
1301#define GSO_MAX_SIZE 65536 1301#define GSO_MAX_SIZE 65536
1302 unsigned int gso_max_size; 1302 unsigned int gso_max_size;
1303#define GSO_MAX_SEGS 65535
1304 u16 gso_max_segs;
1303 1305
1304#ifdef CONFIG_DCB 1306#ifdef CONFIG_DCB
1305 /* Data Center Bridging netlink ops */ 1307 /* Data Center Bridging netlink ops */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 76c5c8b724a7..7602ccb3f40e 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1272,7 +1272,8 @@ static inline bool perf_paranoid_kernel(void)
1272extern void perf_event_init(void); 1272extern void perf_event_init(void);
1273extern void perf_tp_event(u64 addr, u64 count, void *record, 1273extern void perf_tp_event(u64 addr, u64 count, void *record,
1274 int entry_size, struct pt_regs *regs, 1274 int entry_size, struct pt_regs *regs,
1275 struct hlist_head *head, int rctx); 1275 struct hlist_head *head, int rctx,
1276 struct task_struct *task);
1276extern void perf_bp_event(struct perf_event *event, void *data); 1277extern void perf_bp_event(struct perf_event *event, void *data);
1277 1278
1278#ifndef perf_misc_flags 1279#ifndef perf_misc_flags
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c147e7024f11..b8c86648a2f9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -334,14 +334,6 @@ static inline void lockup_detector_init(void)
334} 334}
335#endif 335#endif
336 336
337#if defined(CONFIG_LOCKUP_DETECTOR) && defined(CONFIG_SUSPEND)
338void lockup_detector_bootcpu_resume(void);
339#else
340static inline void lockup_detector_bootcpu_resume(void)
341{
342}
343#endif
344
345#ifdef CONFIG_DETECT_HUNG_TASK 337#ifdef CONFIG_DETECT_HUNG_TASK
346extern unsigned int sysctl_hung_task_panic; 338extern unsigned int sysctl_hung_task_panic;
347extern unsigned long sysctl_hung_task_check_count; 339extern unsigned long sysctl_hung_task_check_count;
diff --git a/include/linux/security.h b/include/linux/security.h
index 4e5a73cdbbef..3dea6a9d568f 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1242,8 +1242,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1242 * Check that the @parent process has sufficient permission to trace the 1242 * Check that the @parent process has sufficient permission to trace the
1243 * current process before allowing the current process to present itself 1243 * current process before allowing the current process to present itself
1244 * to the @parent process for tracing. 1244 * to the @parent process for tracing.
1245 * The parent process will still have to undergo the ptrace_access_check
1246 * checks before it is allowed to trace this one.
1247 * @parent contains the task_struct structure for debugger process. 1245 * @parent contains the task_struct structure for debugger process.
1248 * Return 0 if permission is granted. 1246 * Return 0 if permission is granted.
1249 * @capget: 1247 * @capget:
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 99bc88b1fc02..7c5ceb20e03a 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -232,7 +232,7 @@ struct timex {
232 * estimated error = NTP dispersion. 232 * estimated error = NTP dispersion.
233 */ 233 */
234extern unsigned long tick_usec; /* USER_HZ period (usec) */ 234extern unsigned long tick_usec; /* USER_HZ period (usec) */
235extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ 235extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */
236 236
237extern void ntp_init(void); 237extern void ntp_init(void);
238extern void ntp_clear(void); 238extern void ntp_clear(void);
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e91cd43394df..fec12d667211 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -164,6 +164,7 @@ int arch_update_cpu_topology(void);
164 | 0*SD_SHARE_CPUPOWER \ 164 | 0*SD_SHARE_CPUPOWER \
165 | 0*SD_SHARE_PKG_RESOURCES \ 165 | 0*SD_SHARE_PKG_RESOURCES \
166 | 0*SD_SERIALIZE \ 166 | 0*SD_SERIALIZE \
167 | 1*SD_PREFER_SIBLING \
167 , \ 168 , \
168 .last_balance = jiffies, \ 169 .last_balance = jiffies, \
169 .balance_interval = 1, \ 170 .balance_interval = 1, \
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index c66fe3332d83..50c3e8fa06a8 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -104,7 +104,6 @@ static inline void wait_on_inode(struct inode *inode)
104 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); 104 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE);
105} 105}
106 106
107
108/* 107/*
109 * mm/page-writeback.c 108 * mm/page-writeback.c
110 */ 109 */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 493fa0c79005..3d254e10ff30 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -96,6 +96,7 @@ enum ieee80211_band {
96 * is not permitted. 96 * is not permitted.
97 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 97 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
98 * is not permitted. 98 * is not permitted.
99 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
99 */ 100 */
100enum ieee80211_channel_flags { 101enum ieee80211_channel_flags {
101 IEEE80211_CHAN_DISABLED = 1<<0, 102 IEEE80211_CHAN_DISABLED = 1<<0,
@@ -104,6 +105,7 @@ enum ieee80211_channel_flags {
104 IEEE80211_CHAN_RADAR = 1<<3, 105 IEEE80211_CHAN_RADAR = 1<<3,
105 IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 106 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
106 IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 107 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
108 IEEE80211_CHAN_NO_OFDM = 1<<6,
107}; 109};
108 110
109#define IEEE80211_CHAN_NO_HT40 \ 111#define IEEE80211_CHAN_NO_HT40 \
diff --git a/include/net/codel.h b/include/net/codel.h
index 550debfc2403..389cf621161d 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -305,6 +305,8 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
305 } 305 }
306 } 306 }
307 } else if (drop) { 307 } else if (drop) {
308 u32 delta;
309
308 if (params->ecn && INET_ECN_set_ce(skb)) { 310 if (params->ecn && INET_ECN_set_ce(skb)) {
309 stats->ecn_mark++; 311 stats->ecn_mark++;
310 } else { 312 } else {
@@ -320,9 +322,11 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
320 * assume that the drop rate that controlled the queue on the 322 * assume that the drop rate that controlled the queue on the
321 * last cycle is a good starting point to control it now. 323 * last cycle is a good starting point to control it now.
322 */ 324 */
323 if (codel_time_before(now - vars->drop_next, 325 delta = vars->count - vars->lastcount;
326 if (delta > 1 &&
327 codel_time_before(now - vars->drop_next,
324 16 * params->interval)) { 328 16 * params->interval)) {
325 vars->count = (vars->count - vars->lastcount) | 1; 329 vars->count = delta;
326 /* we dont care if rec_inv_sqrt approximation 330 /* we dont care if rec_inv_sqrt approximation
327 * is not very precise : 331 * is not very precise :
328 * Next Newton steps will correct it quadratically. 332 * Next Newton steps will correct it quadratically.
diff --git a/include/net/dst.h b/include/net/dst.h
index baf597890064..621e3513ef5e 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -110,7 +110,7 @@ struct dst_entry {
110}; 110};
111 111
112extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 112extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
113extern const u32 dst_default_metrics[RTAX_MAX]; 113extern const u32 dst_default_metrics[];
114 114
115#define DST_METRICS_READ_ONLY 0x1UL 115#define DST_METRICS_READ_ONLY 0x1UL
116#define __DST_METRICS_PTR(Y) \ 116#define __DST_METRICS_PTR(Y) \
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 5ee66f517b4f..ba1d3615acbb 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -39,6 +39,7 @@ struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, struct flowi *fl); 39 int (*queue_xmit)(struct sk_buff *skb, struct flowi *fl);
40 void (*send_check)(struct sock *sk, struct sk_buff *skb); 40 void (*send_check)(struct sock *sk, struct sk_buff *skb);
41 int (*rebuild_header)(struct sock *sk); 41 int (*rebuild_header)(struct sock *sk);
42 void (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb);
42 int (*conn_request)(struct sock *sk, struct sk_buff *skb); 43 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, 44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
44 struct request_sock *req, 45 struct request_sock *req,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 83b567fe1941..613cfa401672 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -249,13 +249,4 @@ static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
249 return flags; 249 return flags;
250} 250}
251 251
252static inline void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
253{
254 struct dst_entry *dst = skb_dst(skb);
255
256 dst_hold(dst);
257 sk->sk_rx_dst = dst;
258 inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
259}
260
261#endif /* _INET_SOCK_H */ 252#endif /* _INET_SOCK_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index bd5e444a19ce..5a5d84d3d2c6 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -120,7 +120,7 @@ extern struct sk_buff *__ip_make_skb(struct sock *sk,
120 struct flowi4 *fl4, 120 struct flowi4 *fl4,
121 struct sk_buff_head *queue, 121 struct sk_buff_head *queue,
122 struct inet_cork *cork); 122 struct inet_cork *cork);
123extern int ip_send_skb(struct sk_buff *skb); 123extern int ip_send_skb(struct net *net, struct sk_buff *skb);
124extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4); 124extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
125extern void ip_flush_pending_frames(struct sock *sk); 125extern void ip_flush_pending_frames(struct sock *sk);
126extern struct sk_buff *ip_make_skb(struct sock *sk, 126extern struct sk_buff *ip_make_skb(struct sock *sk,
diff --git a/include/net/sock.h b/include/net/sock.h
index b3730239bf18..72132aef53fc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -218,6 +218,7 @@ struct cg_proto;
218 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) 218 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
219 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 219 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
220 * @sk_gso_max_size: Maximum GSO segment size to build 220 * @sk_gso_max_size: Maximum GSO segment size to build
221 * @sk_gso_max_segs: Maximum number of GSO segments
221 * @sk_lingertime: %SO_LINGER l_linger setting 222 * @sk_lingertime: %SO_LINGER l_linger setting
222 * @sk_backlog: always used with the per-socket spinlock held 223 * @sk_backlog: always used with the per-socket spinlock held
223 * @sk_callback_lock: used with the callbacks in the end of this struct 224 * @sk_callback_lock: used with the callbacks in the end of this struct
@@ -338,6 +339,7 @@ struct sock {
338 netdev_features_t sk_route_nocaps; 339 netdev_features_t sk_route_nocaps;
339 int sk_gso_type; 340 int sk_gso_type;
340 unsigned int sk_gso_max_size; 341 unsigned int sk_gso_max_size;
342 u16 sk_gso_max_segs;
341 int sk_rcvlowat; 343 int sk_rcvlowat;
342 unsigned long sk_lingertime; 344 unsigned long sk_lingertime;
343 struct sk_buff_head sk_error_queue; 345 struct sk_buff_head sk_error_queue;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e19124b84cd2..1f000ffe7075 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -464,6 +464,7 @@ extern int tcp_disconnect(struct sock *sk, int flags);
464void tcp_connect_init(struct sock *sk); 464void tcp_connect_init(struct sock *sk);
465void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); 465void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
466int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size); 466int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
467void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
467 468
468/* From syncookies.c */ 469/* From syncookies.c */
469extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 470extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d9509eb29b80..62b619e82a90 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -213,6 +213,9 @@ struct xfrm_state {
213 struct xfrm_lifetime_cur curlft; 213 struct xfrm_lifetime_cur curlft;
214 struct tasklet_hrtimer mtimer; 214 struct tasklet_hrtimer mtimer;
215 215
216 /* used to fix curlft->add_time when changing date */
217 long saved_tmo;
218
216 /* Last used time */ 219 /* Last used time */
217 unsigned long lastused; 220 unsigned long lastused;
218 221
@@ -238,6 +241,7 @@ static inline struct net *xs_net(struct xfrm_state *x)
238 241
239/* xflags - make enum if more show up */ 242/* xflags - make enum if more show up */
240#define XFRM_TIME_DEFER 1 243#define XFRM_TIME_DEFER 1
244#define XFRM_SOFT_EXPIRE 2
241 245
242enum { 246enum {
243 XFRM_STATE_VOID, 247 XFRM_STATE_VOID,
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index ea7a2035456d..5a8671e8a67f 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -73,6 +73,9 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
73 __entry->prio = p->prio; 73 __entry->prio = p->prio;
74 __entry->success = success; 74 __entry->success = success;
75 __entry->target_cpu = task_cpu(p); 75 __entry->target_cpu = task_cpu(p);
76 )
77 TP_perf_assign(
78 __perf_task(p);
76 ), 79 ),
77 80
78 TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d", 81 TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
@@ -325,6 +328,7 @@ DECLARE_EVENT_CLASS(sched_stat_template,
325 ) 328 )
326 TP_perf_assign( 329 TP_perf_assign(
327 __perf_count(delay); 330 __perf_count(delay);
331 __perf_task(tsk);
328 ), 332 ),
329 333
330 TP_printk("comm=%s pid=%d delay=%Lu [ns]", 334 TP_printk("comm=%s pid=%d delay=%Lu [ns]",
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index c6bc2faaf261..a763888a36f9 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -712,6 +712,9 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
712#undef __perf_count 712#undef __perf_count
713#define __perf_count(c) __count = (c) 713#define __perf_count(c) __count = (c)
714 714
715#undef __perf_task
716#define __perf_task(t) __task = (t)
717
715#undef TP_perf_assign 718#undef TP_perf_assign
716#define TP_perf_assign(args...) args 719#define TP_perf_assign(args...) args
717 720
@@ -725,6 +728,7 @@ perf_trace_##call(void *__data, proto) \
725 struct ftrace_raw_##call *entry; \ 728 struct ftrace_raw_##call *entry; \
726 struct pt_regs __regs; \ 729 struct pt_regs __regs; \
727 u64 __addr = 0, __count = 1; \ 730 u64 __addr = 0, __count = 1; \
731 struct task_struct *__task = NULL; \
728 struct hlist_head *head; \ 732 struct hlist_head *head; \
729 int __entry_size; \ 733 int __entry_size; \
730 int __data_size; \ 734 int __data_size; \
@@ -752,7 +756,7 @@ perf_trace_##call(void *__data, proto) \
752 \ 756 \
753 head = this_cpu_ptr(event_call->perf_events); \ 757 head = this_cpu_ptr(event_call->perf_events); \
754 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ 758 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
755 __count, &__regs, head); \ 759 __count, &__regs, head, __task); \
756} 760}
757 761
758/* 762/*
diff --git a/kernel/debug/kdb/kdb_debugger.c b/kernel/debug/kdb/kdb_debugger.c
index 8b68ce78ff17..be7b33b73d30 100644
--- a/kernel/debug/kdb/kdb_debugger.c
+++ b/kernel/debug/kdb/kdb_debugger.c
@@ -12,6 +12,7 @@
12#include <linux/kdb.h> 12#include <linux/kdb.h>
13#include <linux/kdebug.h> 13#include <linux/kdebug.h>
14#include <linux/export.h> 14#include <linux/export.h>
15#include <linux/hardirq.h>
15#include "kdb_private.h" 16#include "kdb_private.h"
16#include "../debug_core.h" 17#include "../debug_core.h"
17 18
@@ -52,6 +53,9 @@ int kdb_stub(struct kgdb_state *ks)
52 if (atomic_read(&kgdb_setting_breakpoint)) 53 if (atomic_read(&kgdb_setting_breakpoint))
53 reason = KDB_REASON_KEYBOARD; 54 reason = KDB_REASON_KEYBOARD;
54 55
56 if (in_nmi())
57 reason = KDB_REASON_NMI;
58
55 for (i = 0, bp = kdb_breakpoints; i < KDB_MAXBPT; i++, bp++) { 59 for (i = 0, bp = kdb_breakpoints; i < KDB_MAXBPT; i++, bp++) {
56 if ((bp->bp_enabled) && (bp->bp_addr == addr)) { 60 if ((bp->bp_enabled) && (bp->bp_addr == addr)) {
57 reason = KDB_REASON_BREAK; 61 reason = KDB_REASON_BREAK;
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c
index bb9520f0f6ff..0a69d2adc4f3 100644
--- a/kernel/debug/kdb/kdb_io.c
+++ b/kernel/debug/kdb/kdb_io.c
@@ -715,9 +715,6 @@ kdb_printit:
715 /* check for having reached the LINES number of printed lines */ 715 /* check for having reached the LINES number of printed lines */
716 if (kdb_nextline == linecount) { 716 if (kdb_nextline == linecount) {
717 char buf1[16] = ""; 717 char buf1[16] = "";
718#if defined(CONFIG_SMP)
719 char buf2[32];
720#endif
721 718
722 /* Watch out for recursion here. Any routine that calls 719 /* Watch out for recursion here. Any routine that calls
723 * kdb_printf will come back through here. And kdb_read 720 * kdb_printf will come back through here. And kdb_read
@@ -732,14 +729,6 @@ kdb_printit:
732 if (moreprompt == NULL) 729 if (moreprompt == NULL)
733 moreprompt = "more> "; 730 moreprompt = "more> ";
734 731
735#if defined(CONFIG_SMP)
736 if (strchr(moreprompt, '%')) {
737 sprintf(buf2, moreprompt, get_cpu());
738 put_cpu();
739 moreprompt = buf2;
740 }
741#endif
742
743 kdb_input_flush(); 732 kdb_input_flush();
744 c = console_drivers; 733 c = console_drivers;
745 734
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 1f91413edb87..31df1706b9a9 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -139,11 +139,10 @@ static const int __nkdb_err = sizeof(kdbmsgs) / sizeof(kdbmsg_t);
139static char *__env[] = { 139static char *__env[] = {
140#if defined(CONFIG_SMP) 140#if defined(CONFIG_SMP)
141 "PROMPT=[%d]kdb> ", 141 "PROMPT=[%d]kdb> ",
142 "MOREPROMPT=[%d]more> ",
143#else 142#else
144 "PROMPT=kdb> ", 143 "PROMPT=kdb> ",
145 "MOREPROMPT=more> ",
146#endif 144#endif
145 "MOREPROMPT=more> ",
147 "RADIX=16", 146 "RADIX=16",
148 "MDCOUNT=8", /* lines of md output */ 147 "MDCOUNT=8", /* lines of md output */
149 KDB_PLATFORM_ENV, 148 KDB_PLATFORM_ENV,
@@ -1236,18 +1235,6 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
1236 *cmdbuf = '\0'; 1235 *cmdbuf = '\0';
1237 *(cmd_hist[cmd_head]) = '\0'; 1236 *(cmd_hist[cmd_head]) = '\0';
1238 1237
1239 if (KDB_FLAG(ONLY_DO_DUMP)) {
1240 /* kdb is off but a catastrophic error requires a dump.
1241 * Take the dump and reboot.
1242 * Turn on logging so the kdb output appears in the log
1243 * buffer in the dump.
1244 */
1245 const char *setargs[] = { "set", "LOGGING", "1" };
1246 kdb_set(2, setargs);
1247 kdb_reboot(0, NULL);
1248 /*NOTREACHED*/
1249 }
1250
1251do_full_getstr: 1238do_full_getstr:
1252#if defined(CONFIG_SMP) 1239#if defined(CONFIG_SMP)
1253 snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"), 1240 snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"),
diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c
index 6581a040f399..98d4597f43d6 100644
--- a/kernel/events/callchain.c
+++ b/kernel/events/callchain.c
@@ -153,7 +153,8 @@ put_callchain_entry(int rctx)
153 put_recursion_context(__get_cpu_var(callchain_recursion), rctx); 153 put_recursion_context(__get_cpu_var(callchain_recursion), rctx);
154} 154}
155 155
156struct perf_callchain_entry *perf_callchain(struct pt_regs *regs) 156struct perf_callchain_entry *
157perf_callchain(struct perf_event *event, struct pt_regs *regs)
157{ 158{
158 int rctx; 159 int rctx;
159 struct perf_callchain_entry *entry; 160 struct perf_callchain_entry *entry;
@@ -178,6 +179,12 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
178 } 179 }
179 180
180 if (regs) { 181 if (regs) {
182 /*
183 * Disallow cross-task user callchains.
184 */
185 if (event->ctx->task && event->ctx->task != current)
186 goto exit_put;
187
181 perf_callchain_store(entry, PERF_CONTEXT_USER); 188 perf_callchain_store(entry, PERF_CONTEXT_USER);
182 perf_callchain_user(entry, regs); 189 perf_callchain_user(entry, regs);
183 } 190 }
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f1cf0edeb39a..b7935fcec7d9 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4039,7 +4039,7 @@ void perf_prepare_sample(struct perf_event_header *header,
4039 if (sample_type & PERF_SAMPLE_CALLCHAIN) { 4039 if (sample_type & PERF_SAMPLE_CALLCHAIN) {
4040 int size = 1; 4040 int size = 1;
4041 4041
4042 data->callchain = perf_callchain(regs); 4042 data->callchain = perf_callchain(event, regs);
4043 4043
4044 if (data->callchain) 4044 if (data->callchain)
4045 size += data->callchain->nr; 4045 size += data->callchain->nr;
@@ -5209,7 +5209,8 @@ static int perf_tp_event_match(struct perf_event *event,
5209} 5209}
5210 5210
5211void perf_tp_event(u64 addr, u64 count, void *record, int entry_size, 5211void perf_tp_event(u64 addr, u64 count, void *record, int entry_size,
5212 struct pt_regs *regs, struct hlist_head *head, int rctx) 5212 struct pt_regs *regs, struct hlist_head *head, int rctx,
5213 struct task_struct *task)
5213{ 5214{
5214 struct perf_sample_data data; 5215 struct perf_sample_data data;
5215 struct perf_event *event; 5216 struct perf_event *event;
@@ -5228,6 +5229,31 @@ void perf_tp_event(u64 addr, u64 count, void *record, int entry_size,
5228 perf_swevent_event(event, count, &data, regs); 5229 perf_swevent_event(event, count, &data, regs);
5229 } 5230 }
5230 5231
5232 /*
5233 * If we got specified a target task, also iterate its context and
5234 * deliver this event there too.
5235 */
5236 if (task && task != current) {
5237 struct perf_event_context *ctx;
5238 struct trace_entry *entry = record;
5239
5240 rcu_read_lock();
5241 ctx = rcu_dereference(task->perf_event_ctxp[perf_sw_context]);
5242 if (!ctx)
5243 goto unlock;
5244
5245 list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
5246 if (event->attr.type != PERF_TYPE_TRACEPOINT)
5247 continue;
5248 if (event->attr.config != entry->type)
5249 continue;
5250 if (perf_tp_event_match(event, &data, regs))
5251 perf_swevent_event(event, count, &data, regs);
5252 }
5253unlock:
5254 rcu_read_unlock();
5255 }
5256
5231 perf_swevent_put_recursion_context(rctx); 5257 perf_swevent_put_recursion_context(rctx);
5232} 5258}
5233EXPORT_SYMBOL_GPL(perf_tp_event); 5259EXPORT_SYMBOL_GPL(perf_tp_event);
diff --git a/kernel/events/internal.h b/kernel/events/internal.h
index b0b107f90afc..a096c19f2c2a 100644
--- a/kernel/events/internal.h
+++ b/kernel/events/internal.h
@@ -101,7 +101,8 @@ __output_copy(struct perf_output_handle *handle,
101} 101}
102 102
103/* Callchain handling */ 103/* Callchain handling */
104extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs); 104extern struct perf_callchain_entry *
105perf_callchain(struct perf_event *event, struct pt_regs *regs);
105extern int get_callchain_buffers(void); 106extern int get_callchain_buffers(void);
106extern void put_callchain_buffers(void); 107extern void put_callchain_buffers(void);
107 108
diff --git a/kernel/futex.c b/kernel/futex.c
index e2b0fb9a0b3b..3717e7b306e0 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2231,11 +2231,11 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
2231 * @uaddr2: the pi futex we will take prior to returning to user-space 2231 * @uaddr2: the pi futex we will take prior to returning to user-space
2232 * 2232 *
2233 * The caller will wait on uaddr and will be requeued by futex_requeue() to 2233 * The caller will wait on uaddr and will be requeued by futex_requeue() to
2234 * uaddr2 which must be PI aware. Normal wakeup will wake on uaddr2 and 2234 * uaddr2 which must be PI aware and unique from uaddr. Normal wakeup will wake
2235 * complete the acquisition of the rt_mutex prior to returning to userspace. 2235 * on uaddr2 and complete the acquisition of the rt_mutex prior to returning to
2236 * This ensures the rt_mutex maintains an owner when it has waiters; without 2236 * userspace. This ensures the rt_mutex maintains an owner when it has waiters;
2237 * one, the pi logic wouldn't know which task to boost/deboost, if there was a 2237 * without one, the pi logic would not know which task to boost/deboost, if
2238 * need to. 2238 * there was a need to.
2239 * 2239 *
2240 * We call schedule in futex_wait_queue_me() when we enqueue and return there 2240 * We call schedule in futex_wait_queue_me() when we enqueue and return there
2241 * via the following: 2241 * via the following:
@@ -2272,6 +2272,9 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
2272 struct futex_q q = futex_q_init; 2272 struct futex_q q = futex_q_init;
2273 int res, ret; 2273 int res, ret;
2274 2274
2275 if (uaddr == uaddr2)
2276 return -EINVAL;
2277
2275 if (!bitset) 2278 if (!bitset)
2276 return -EINVAL; 2279 return -EINVAL;
2277 2280
@@ -2343,7 +2346,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
2343 * signal. futex_unlock_pi() will not destroy the lock_ptr nor 2346 * signal. futex_unlock_pi() will not destroy the lock_ptr nor
2344 * the pi_state. 2347 * the pi_state.
2345 */ 2348 */
2346 WARN_ON(!&q.pi_state); 2349 WARN_ON(!q.pi_state);
2347 pi_mutex = &q.pi_state->pi_mutex; 2350 pi_mutex = &q.pi_state->pi_mutex;
2348 ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1); 2351 ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1);
2349 debug_rt_mutex_free_waiter(&rt_waiter); 2352 debug_rt_mutex_free_waiter(&rt_waiter);
@@ -2370,7 +2373,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
2370 * fault, unlock the rt_mutex and return the fault to userspace. 2373 * fault, unlock the rt_mutex and return the fault to userspace.
2371 */ 2374 */
2372 if (ret == -EFAULT) { 2375 if (ret == -EFAULT) {
2373 if (rt_mutex_owner(pi_mutex) == current) 2376 if (pi_mutex && rt_mutex_owner(pi_mutex) == current)
2374 rt_mutex_unlock(pi_mutex); 2377 rt_mutex_unlock(pi_mutex);
2375 } else if (ret == -EINTR) { 2378 } else if (ret == -EINTR) {
2376 /* 2379 /*
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 0a8e8f059627..4c69326aa773 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -944,6 +944,18 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
944 } 944 }
945 945
946 /* 946 /*
947 * Drivers are often written to work w/o knowledge about the
948 * underlying irq chip implementation, so a request for a
949 * threaded irq without a primary hard irq context handler
950 * requires the ONESHOT flag to be set. Some irq chips like
951 * MSI based interrupts are per se one shot safe. Check the
952 * chip flags, so we can avoid the unmask dance at the end of
953 * the threaded handler for those.
954 */
955 if (desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)
956 new->flags &= ~IRQF_ONESHOT;
957
958 /*
947 * The following block of code has to be executed atomically 959 * The following block of code has to be executed atomically
948 */ 960 */
949 raw_spin_lock_irqsave(&desc->lock, flags); 961 raw_spin_lock_irqsave(&desc->lock, flags);
@@ -1017,7 +1029,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1017 */ 1029 */
1018 new->thread_mask = 1 << ffz(thread_mask); 1030 new->thread_mask = 1 << ffz(thread_mask);
1019 1031
1020 } else if (new->handler == irq_default_primary_handler) { 1032 } else if (new->handler == irq_default_primary_handler &&
1033 !(desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)) {
1021 /* 1034 /*
1022 * The interrupt was requested with handler = NULL, so 1035 * The interrupt was requested with handler = NULL, so
1023 * we use the default primary handler for it. But it 1036 * we use the default primary handler for it. But it
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 1da39ea248fd..c8b7446b27df 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -178,9 +178,6 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
178 arch_suspend_enable_irqs(); 178 arch_suspend_enable_irqs();
179 BUG_ON(irqs_disabled()); 179 BUG_ON(irqs_disabled());
180 180
181 /* Kick the lockup detector */
182 lockup_detector_bootcpu_resume();
183
184 Enable_cpus: 181 Enable_cpus:
185 enable_nonboot_cpus(); 182 enable_nonboot_cpus();
186 183
diff --git a/kernel/printk.c b/kernel/printk.c
index 6a76ab9d4476..66a2ea37b576 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1034,6 +1034,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
1034 struct log *msg = log_from_idx(idx); 1034 struct log *msg = log_from_idx(idx);
1035 1035
1036 len += msg_print_text(msg, prev, true, NULL, 0); 1036 len += msg_print_text(msg, prev, true, NULL, 0);
1037 prev = msg->flags;
1037 idx = log_next(idx); 1038 idx = log_next(idx);
1038 seq++; 1039 seq++;
1039 } 1040 }
@@ -1046,6 +1047,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
1046 struct log *msg = log_from_idx(idx); 1047 struct log *msg = log_from_idx(idx);
1047 1048
1048 len -= msg_print_text(msg, prev, true, NULL, 0); 1049 len -= msg_print_text(msg, prev, true, NULL, 0);
1050 prev = msg->flags;
1049 idx = log_next(idx); 1051 idx = log_next(idx);
1050 seq++; 1052 seq++;
1051 } 1053 }
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d325c4b2dcbb..82ad284f823b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4340,9 +4340,7 @@ recheck:
4340 */ 4340 */
4341 if (unlikely(policy == p->policy && (!rt_policy(policy) || 4341 if (unlikely(policy == p->policy && (!rt_policy(policy) ||
4342 param->sched_priority == p->rt_priority))) { 4342 param->sched_priority == p->rt_priority))) {
4343 4343 task_rq_unlock(rq, p, &flags);
4344 __task_rq_unlock(rq);
4345 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
4346 return 0; 4344 return 0;
4347 } 4345 }
4348 4346
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index d72586fdf660..23aa789c53ee 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -65,8 +65,8 @@ static int convert_prio(int prio)
65int cpupri_find(struct cpupri *cp, struct task_struct *p, 65int cpupri_find(struct cpupri *cp, struct task_struct *p,
66 struct cpumask *lowest_mask) 66 struct cpumask *lowest_mask)
67{ 67{
68 int idx = 0; 68 int idx = 0;
69 int task_pri = convert_prio(p->prio); 69 int task_pri = convert_prio(p->prio);
70 70
71 if (task_pri >= MAX_RT_PRIO) 71 if (task_pri >= MAX_RT_PRIO)
72 return 0; 72 return 0;
@@ -137,9 +137,9 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p,
137 */ 137 */
138void cpupri_set(struct cpupri *cp, int cpu, int newpri) 138void cpupri_set(struct cpupri *cp, int cpu, int newpri)
139{ 139{
140 int *currpri = &cp->cpu_to_pri[cpu]; 140 int *currpri = &cp->cpu_to_pri[cpu];
141 int oldpri = *currpri; 141 int oldpri = *currpri;
142 int do_mb = 0; 142 int do_mb = 0;
143 143
144 newpri = convert_prio(newpri); 144 newpri = convert_prio(newpri);
145 145
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 22321db64952..d0cc03b3e70b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3069,6 +3069,9 @@ struct lb_env {
3069 int new_dst_cpu; 3069 int new_dst_cpu;
3070 enum cpu_idle_type idle; 3070 enum cpu_idle_type idle;
3071 long imbalance; 3071 long imbalance;
3072 /* The set of CPUs under consideration for load-balancing */
3073 struct cpumask *cpus;
3074
3072 unsigned int flags; 3075 unsigned int flags;
3073 3076
3074 unsigned int loop; 3077 unsigned int loop;
@@ -3653,8 +3656,7 @@ fix_small_capacity(struct sched_domain *sd, struct sched_group *group)
3653 */ 3656 */
3654static inline void update_sg_lb_stats(struct lb_env *env, 3657static inline void update_sg_lb_stats(struct lb_env *env,
3655 struct sched_group *group, int load_idx, 3658 struct sched_group *group, int load_idx,
3656 int local_group, const struct cpumask *cpus, 3659 int local_group, int *balance, struct sg_lb_stats *sgs)
3657 int *balance, struct sg_lb_stats *sgs)
3658{ 3660{
3659 unsigned long nr_running, max_nr_running, min_nr_running; 3661 unsigned long nr_running, max_nr_running, min_nr_running;
3660 unsigned long load, max_cpu_load, min_cpu_load; 3662 unsigned long load, max_cpu_load, min_cpu_load;
@@ -3671,7 +3673,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
3671 max_nr_running = 0; 3673 max_nr_running = 0;
3672 min_nr_running = ~0UL; 3674 min_nr_running = ~0UL;
3673 3675
3674 for_each_cpu_and(i, sched_group_cpus(group), cpus) { 3676 for_each_cpu_and(i, sched_group_cpus(group), env->cpus) {
3675 struct rq *rq = cpu_rq(i); 3677 struct rq *rq = cpu_rq(i);
3676 3678
3677 nr_running = rq->nr_running; 3679 nr_running = rq->nr_running;
@@ -3800,8 +3802,7 @@ static bool update_sd_pick_busiest(struct lb_env *env,
3800 * @sds: variable to hold the statistics for this sched_domain. 3802 * @sds: variable to hold the statistics for this sched_domain.
3801 */ 3803 */
3802static inline void update_sd_lb_stats(struct lb_env *env, 3804static inline void update_sd_lb_stats(struct lb_env *env,
3803 const struct cpumask *cpus, 3805 int *balance, struct sd_lb_stats *sds)
3804 int *balance, struct sd_lb_stats *sds)
3805{ 3806{
3806 struct sched_domain *child = env->sd->child; 3807 struct sched_domain *child = env->sd->child;
3807 struct sched_group *sg = env->sd->groups; 3808 struct sched_group *sg = env->sd->groups;
@@ -3818,8 +3819,7 @@ static inline void update_sd_lb_stats(struct lb_env *env,
3818 3819
3819 local_group = cpumask_test_cpu(env->dst_cpu, sched_group_cpus(sg)); 3820 local_group = cpumask_test_cpu(env->dst_cpu, sched_group_cpus(sg));
3820 memset(&sgs, 0, sizeof(sgs)); 3821 memset(&sgs, 0, sizeof(sgs));
3821 update_sg_lb_stats(env, sg, load_idx, local_group, 3822 update_sg_lb_stats(env, sg, load_idx, local_group, balance, &sgs);
3822 cpus, balance, &sgs);
3823 3823
3824 if (local_group && !(*balance)) 3824 if (local_group && !(*balance))
3825 return; 3825 return;
@@ -4055,7 +4055,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
4055 * to restore balance. 4055 * to restore balance.
4056 * 4056 *
4057 * @env: The load balancing environment. 4057 * @env: The load balancing environment.
4058 * @cpus: The set of CPUs under consideration for load-balancing.
4059 * @balance: Pointer to a variable indicating if this_cpu 4058 * @balance: Pointer to a variable indicating if this_cpu
4060 * is the appropriate cpu to perform load balancing at this_level. 4059 * is the appropriate cpu to perform load balancing at this_level.
4061 * 4060 *
@@ -4065,7 +4064,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
4065 * put to idle by rebalancing its tasks onto our group. 4064 * put to idle by rebalancing its tasks onto our group.
4066 */ 4065 */
4067static struct sched_group * 4066static struct sched_group *
4068find_busiest_group(struct lb_env *env, const struct cpumask *cpus, int *balance) 4067find_busiest_group(struct lb_env *env, int *balance)
4069{ 4068{
4070 struct sd_lb_stats sds; 4069 struct sd_lb_stats sds;
4071 4070
@@ -4075,7 +4074,7 @@ find_busiest_group(struct lb_env *env, const struct cpumask *cpus, int *balance)
4075 * Compute the various statistics relavent for load balancing at 4074 * Compute the various statistics relavent for load balancing at
4076 * this level. 4075 * this level.
4077 */ 4076 */
4078 update_sd_lb_stats(env, cpus, balance, &sds); 4077 update_sd_lb_stats(env, balance, &sds);
4079 4078
4080 /* 4079 /*
4081 * this_cpu is not the appropriate cpu to perform load balancing at 4080 * this_cpu is not the appropriate cpu to perform load balancing at
@@ -4155,8 +4154,7 @@ ret:
4155 * find_busiest_queue - find the busiest runqueue among the cpus in group. 4154 * find_busiest_queue - find the busiest runqueue among the cpus in group.
4156 */ 4155 */
4157static struct rq *find_busiest_queue(struct lb_env *env, 4156static struct rq *find_busiest_queue(struct lb_env *env,
4158 struct sched_group *group, 4157 struct sched_group *group)
4159 const struct cpumask *cpus)
4160{ 4158{
4161 struct rq *busiest = NULL, *rq; 4159 struct rq *busiest = NULL, *rq;
4162 unsigned long max_load = 0; 4160 unsigned long max_load = 0;
@@ -4171,7 +4169,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,
4171 if (!capacity) 4169 if (!capacity)
4172 capacity = fix_small_capacity(env->sd, group); 4170 capacity = fix_small_capacity(env->sd, group);
4173 4171
4174 if (!cpumask_test_cpu(i, cpus)) 4172 if (!cpumask_test_cpu(i, env->cpus))
4175 continue; 4173 continue;
4176 4174
4177 rq = cpu_rq(i); 4175 rq = cpu_rq(i);
@@ -4252,6 +4250,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
4252 .dst_grpmask = sched_group_cpus(sd->groups), 4250 .dst_grpmask = sched_group_cpus(sd->groups),
4253 .idle = idle, 4251 .idle = idle,
4254 .loop_break = sched_nr_migrate_break, 4252 .loop_break = sched_nr_migrate_break,
4253 .cpus = cpus,
4255 }; 4254 };
4256 4255
4257 cpumask_copy(cpus, cpu_active_mask); 4256 cpumask_copy(cpus, cpu_active_mask);
@@ -4260,7 +4259,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
4260 schedstat_inc(sd, lb_count[idle]); 4259 schedstat_inc(sd, lb_count[idle]);
4261 4260
4262redo: 4261redo:
4263 group = find_busiest_group(&env, cpus, balance); 4262 group = find_busiest_group(&env, balance);
4264 4263
4265 if (*balance == 0) 4264 if (*balance == 0)
4266 goto out_balanced; 4265 goto out_balanced;
@@ -4270,7 +4269,7 @@ redo:
4270 goto out_balanced; 4269 goto out_balanced;
4271 } 4270 }
4272 4271
4273 busiest = find_busiest_queue(&env, group, cpus); 4272 busiest = find_busiest_queue(&env, group);
4274 if (!busiest) { 4273 if (!busiest) {
4275 schedstat_inc(sd, lb_nobusyq[idle]); 4274 schedstat_inc(sd, lb_nobusyq[idle]);
4276 goto out_balanced; 4275 goto out_balanced;
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index a470154e0408..46da0537c10b 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -37,7 +37,7 @@
37 * requested HZ value. It is also not recommended 37 * requested HZ value. It is also not recommended
38 * for "tick-less" systems. 38 * for "tick-less" systems.
39 */ 39 */
40#define NSEC_PER_JIFFY ((u32)((((u64)NSEC_PER_SEC)<<8)/ACTHZ)) 40#define NSEC_PER_JIFFY ((u32)((((u64)NSEC_PER_SEC)<<8)/SHIFTED_HZ))
41 41
42/* Since jiffies uses a simple NSEC_PER_JIFFY multiplier 42/* Since jiffies uses a simple NSEC_PER_JIFFY multiplier
43 * conversion, the .shift value could be zero. However 43 * conversion, the .shift value could be zero. However
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index b7fbadc5c973..24174b4d669b 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -28,7 +28,7 @@ DEFINE_SPINLOCK(ntp_lock);
28/* USER_HZ period (usecs): */ 28/* USER_HZ period (usecs): */
29unsigned long tick_usec = TICK_USEC; 29unsigned long tick_usec = TICK_USEC;
30 30
31/* ACTHZ period (nsecs): */ 31/* SHIFTED_HZ period (nsecs): */
32unsigned long tick_nsec; 32unsigned long tick_nsec;
33 33
34static u64 tick_length; 34static u64 tick_length;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index f045cc50832d..e16af197a2bc 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -65,14 +65,14 @@ struct timekeeper {
65 * used instead. 65 * used instead.
66 */ 66 */
67 struct timespec wall_to_monotonic; 67 struct timespec wall_to_monotonic;
68 /* time spent in suspend */
69 struct timespec total_sleep_time;
70 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
71 struct timespec raw_time;
72 /* Offset clock monotonic -> clock realtime */ 68 /* Offset clock monotonic -> clock realtime */
73 ktime_t offs_real; 69 ktime_t offs_real;
70 /* time spent in suspend */
71 struct timespec total_sleep_time;
74 /* Offset clock monotonic -> clock boottime */ 72 /* Offset clock monotonic -> clock boottime */
75 ktime_t offs_boot; 73 ktime_t offs_boot;
74 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
75 struct timespec raw_time;
76 /* Seqlock for all timekeeper values */ 76 /* Seqlock for all timekeeper values */
77 seqlock_t lock; 77 seqlock_t lock;
78}; 78};
@@ -108,13 +108,38 @@ static struct timespec tk_xtime(struct timekeeper *tk)
108static void tk_set_xtime(struct timekeeper *tk, const struct timespec *ts) 108static void tk_set_xtime(struct timekeeper *tk, const struct timespec *ts)
109{ 109{
110 tk->xtime_sec = ts->tv_sec; 110 tk->xtime_sec = ts->tv_sec;
111 tk->xtime_nsec = ts->tv_nsec << tk->shift; 111 tk->xtime_nsec = (u64)ts->tv_nsec << tk->shift;
112} 112}
113 113
114static void tk_xtime_add(struct timekeeper *tk, const struct timespec *ts) 114static void tk_xtime_add(struct timekeeper *tk, const struct timespec *ts)
115{ 115{
116 tk->xtime_sec += ts->tv_sec; 116 tk->xtime_sec += ts->tv_sec;
117 tk->xtime_nsec += ts->tv_nsec << tk->shift; 117 tk->xtime_nsec += (u64)ts->tv_nsec << tk->shift;
118}
119
120static void tk_set_wall_to_mono(struct timekeeper *tk, struct timespec wtm)
121{
122 struct timespec tmp;
123
124 /*
125 * Verify consistency of: offset_real = -wall_to_monotonic
126 * before modifying anything
127 */
128 set_normalized_timespec(&tmp, -tk->wall_to_monotonic.tv_sec,
129 -tk->wall_to_monotonic.tv_nsec);
130 WARN_ON_ONCE(tk->offs_real.tv64 != timespec_to_ktime(tmp).tv64);
131 tk->wall_to_monotonic = wtm;
132 set_normalized_timespec(&tmp, -wtm.tv_sec, -wtm.tv_nsec);
133 tk->offs_real = timespec_to_ktime(tmp);
134}
135
136static void tk_set_sleep_time(struct timekeeper *tk, struct timespec t)
137{
138 /* Verify consistency before modifying */
139 WARN_ON_ONCE(tk->offs_boot.tv64 != timespec_to_ktime(tk->total_sleep_time).tv64);
140
141 tk->total_sleep_time = t;
142 tk->offs_boot = timespec_to_ktime(t);
118} 143}
119 144
120/** 145/**
@@ -217,14 +242,6 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
217 return nsec + arch_gettimeoffset(); 242 return nsec + arch_gettimeoffset();
218} 243}
219 244
220static void update_rt_offset(struct timekeeper *tk)
221{
222 struct timespec tmp, *wtm = &tk->wall_to_monotonic;
223
224 set_normalized_timespec(&tmp, -wtm->tv_sec, -wtm->tv_nsec);
225 tk->offs_real = timespec_to_ktime(tmp);
226}
227
228/* must hold write on timekeeper.lock */ 245/* must hold write on timekeeper.lock */
229static void timekeeping_update(struct timekeeper *tk, bool clearntp) 246static void timekeeping_update(struct timekeeper *tk, bool clearntp)
230{ 247{
@@ -234,12 +251,10 @@ static void timekeeping_update(struct timekeeper *tk, bool clearntp)
234 tk->ntp_error = 0; 251 tk->ntp_error = 0;
235 ntp_clear(); 252 ntp_clear();
236 } 253 }
237 update_rt_offset(tk);
238 xt = tk_xtime(tk); 254 xt = tk_xtime(tk);
239 update_vsyscall(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult); 255 update_vsyscall(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
240} 256}
241 257
242
243/** 258/**
244 * timekeeping_forward_now - update clock to the current time 259 * timekeeping_forward_now - update clock to the current time
245 * 260 *
@@ -277,18 +292,19 @@ static void timekeeping_forward_now(struct timekeeper *tk)
277 */ 292 */
278void getnstimeofday(struct timespec *ts) 293void getnstimeofday(struct timespec *ts)
279{ 294{
295 struct timekeeper *tk = &timekeeper;
280 unsigned long seq; 296 unsigned long seq;
281 s64 nsecs = 0; 297 s64 nsecs = 0;
282 298
283 WARN_ON(timekeeping_suspended); 299 WARN_ON(timekeeping_suspended);
284 300
285 do { 301 do {
286 seq = read_seqbegin(&timekeeper.lock); 302 seq = read_seqbegin(&tk->lock);
287 303
288 ts->tv_sec = timekeeper.xtime_sec; 304 ts->tv_sec = tk->xtime_sec;
289 ts->tv_nsec = timekeeping_get_ns(&timekeeper); 305 ts->tv_nsec = timekeeping_get_ns(tk);
290 306
291 } while (read_seqretry(&timekeeper.lock, seq)); 307 } while (read_seqretry(&tk->lock, seq));
292 308
293 timespec_add_ns(ts, nsecs); 309 timespec_add_ns(ts, nsecs);
294} 310}
@@ -296,19 +312,18 @@ EXPORT_SYMBOL(getnstimeofday);
296 312
297ktime_t ktime_get(void) 313ktime_t ktime_get(void)
298{ 314{
315 struct timekeeper *tk = &timekeeper;
299 unsigned int seq; 316 unsigned int seq;
300 s64 secs, nsecs; 317 s64 secs, nsecs;
301 318
302 WARN_ON(timekeeping_suspended); 319 WARN_ON(timekeeping_suspended);
303 320
304 do { 321 do {
305 seq = read_seqbegin(&timekeeper.lock); 322 seq = read_seqbegin(&tk->lock);
306 secs = timekeeper.xtime_sec + 323 secs = tk->xtime_sec + tk->wall_to_monotonic.tv_sec;
307 timekeeper.wall_to_monotonic.tv_sec; 324 nsecs = timekeeping_get_ns(tk) + tk->wall_to_monotonic.tv_nsec;
308 nsecs = timekeeping_get_ns(&timekeeper) +
309 timekeeper.wall_to_monotonic.tv_nsec;
310 325
311 } while (read_seqretry(&timekeeper.lock, seq)); 326 } while (read_seqretry(&tk->lock, seq));
312 /* 327 /*
313 * Use ktime_set/ktime_add_ns to create a proper ktime on 328 * Use ktime_set/ktime_add_ns to create a proper ktime on
314 * 32-bit architectures without CONFIG_KTIME_SCALAR. 329 * 32-bit architectures without CONFIG_KTIME_SCALAR.
@@ -327,18 +342,19 @@ EXPORT_SYMBOL_GPL(ktime_get);
327 */ 342 */
328void ktime_get_ts(struct timespec *ts) 343void ktime_get_ts(struct timespec *ts)
329{ 344{
345 struct timekeeper *tk = &timekeeper;
330 struct timespec tomono; 346 struct timespec tomono;
331 unsigned int seq; 347 unsigned int seq;
332 348
333 WARN_ON(timekeeping_suspended); 349 WARN_ON(timekeeping_suspended);
334 350
335 do { 351 do {
336 seq = read_seqbegin(&timekeeper.lock); 352 seq = read_seqbegin(&tk->lock);
337 ts->tv_sec = timekeeper.xtime_sec; 353 ts->tv_sec = tk->xtime_sec;
338 ts->tv_nsec = timekeeping_get_ns(&timekeeper); 354 ts->tv_nsec = timekeeping_get_ns(tk);
339 tomono = timekeeper.wall_to_monotonic; 355 tomono = tk->wall_to_monotonic;
340 356
341 } while (read_seqretry(&timekeeper.lock, seq)); 357 } while (read_seqretry(&tk->lock, seq));
342 358
343 set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, 359 set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
344 ts->tv_nsec + tomono.tv_nsec); 360 ts->tv_nsec + tomono.tv_nsec);
@@ -358,22 +374,23 @@ EXPORT_SYMBOL_GPL(ktime_get_ts);
358 */ 374 */
359void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real) 375void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real)
360{ 376{
377 struct timekeeper *tk = &timekeeper;
361 unsigned long seq; 378 unsigned long seq;
362 s64 nsecs_raw, nsecs_real; 379 s64 nsecs_raw, nsecs_real;
363 380
364 WARN_ON_ONCE(timekeeping_suspended); 381 WARN_ON_ONCE(timekeeping_suspended);
365 382
366 do { 383 do {
367 seq = read_seqbegin(&timekeeper.lock); 384 seq = read_seqbegin(&tk->lock);
368 385
369 *ts_raw = timekeeper.raw_time; 386 *ts_raw = tk->raw_time;
370 ts_real->tv_sec = timekeeper.xtime_sec; 387 ts_real->tv_sec = tk->xtime_sec;
371 ts_real->tv_nsec = 0; 388 ts_real->tv_nsec = 0;
372 389
373 nsecs_raw = timekeeping_get_ns_raw(&timekeeper); 390 nsecs_raw = timekeeping_get_ns_raw(tk);
374 nsecs_real = timekeeping_get_ns(&timekeeper); 391 nsecs_real = timekeeping_get_ns(tk);
375 392
376 } while (read_seqretry(&timekeeper.lock, seq)); 393 } while (read_seqretry(&tk->lock, seq));
377 394
378 timespec_add_ns(ts_raw, nsecs_raw); 395 timespec_add_ns(ts_raw, nsecs_raw);
379 timespec_add_ns(ts_real, nsecs_real); 396 timespec_add_ns(ts_real, nsecs_real);
@@ -406,28 +423,28 @@ EXPORT_SYMBOL(do_gettimeofday);
406 */ 423 */
407int do_settimeofday(const struct timespec *tv) 424int do_settimeofday(const struct timespec *tv)
408{ 425{
426 struct timekeeper *tk = &timekeeper;
409 struct timespec ts_delta, xt; 427 struct timespec ts_delta, xt;
410 unsigned long flags; 428 unsigned long flags;
411 429
412 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) 430 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
413 return -EINVAL; 431 return -EINVAL;
414 432
415 write_seqlock_irqsave(&timekeeper.lock, flags); 433 write_seqlock_irqsave(&tk->lock, flags);
416 434
417 timekeeping_forward_now(&timekeeper); 435 timekeeping_forward_now(tk);
418 436
419 xt = tk_xtime(&timekeeper); 437 xt = tk_xtime(tk);
420 ts_delta.tv_sec = tv->tv_sec - xt.tv_sec; 438 ts_delta.tv_sec = tv->tv_sec - xt.tv_sec;
421 ts_delta.tv_nsec = tv->tv_nsec - xt.tv_nsec; 439 ts_delta.tv_nsec = tv->tv_nsec - xt.tv_nsec;
422 440
423 timekeeper.wall_to_monotonic = 441 tk_set_wall_to_mono(tk, timespec_sub(tk->wall_to_monotonic, ts_delta));
424 timespec_sub(timekeeper.wall_to_monotonic, ts_delta);
425 442
426 tk_set_xtime(&timekeeper, tv); 443 tk_set_xtime(tk, tv);
427 444
428 timekeeping_update(&timekeeper, true); 445 timekeeping_update(tk, true);
429 446
430 write_sequnlock_irqrestore(&timekeeper.lock, flags); 447 write_sequnlock_irqrestore(&tk->lock, flags);
431 448
432 /* signal hrtimers about time change */ 449 /* signal hrtimers about time change */
433 clock_was_set(); 450 clock_was_set();
@@ -436,7 +453,6 @@ int do_settimeofday(const struct timespec *tv)
436} 453}
437EXPORT_SYMBOL(do_settimeofday); 454EXPORT_SYMBOL(do_settimeofday);
438 455
439
440/** 456/**
441 * timekeeping_inject_offset - Adds or subtracts from the current time. 457 * timekeeping_inject_offset - Adds or subtracts from the current time.
442 * @tv: pointer to the timespec variable containing the offset 458 * @tv: pointer to the timespec variable containing the offset
@@ -445,23 +461,23 @@ EXPORT_SYMBOL(do_settimeofday);
445 */ 461 */
446int timekeeping_inject_offset(struct timespec *ts) 462int timekeeping_inject_offset(struct timespec *ts)
447{ 463{
464 struct timekeeper *tk = &timekeeper;
448 unsigned long flags; 465 unsigned long flags;
449 466
450 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) 467 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
451 return -EINVAL; 468 return -EINVAL;
452 469
453 write_seqlock_irqsave(&timekeeper.lock, flags); 470 write_seqlock_irqsave(&tk->lock, flags);
454 471
455 timekeeping_forward_now(&timekeeper); 472 timekeeping_forward_now(tk);
456 473
457 474
458 tk_xtime_add(&timekeeper, ts); 475 tk_xtime_add(tk, ts);
459 timekeeper.wall_to_monotonic = 476 tk_set_wall_to_mono(tk, timespec_sub(tk->wall_to_monotonic, *ts));
460 timespec_sub(timekeeper.wall_to_monotonic, *ts);
461 477
462 timekeeping_update(&timekeeper, true); 478 timekeeping_update(tk, true);
463 479
464 write_sequnlock_irqrestore(&timekeeper.lock, flags); 480 write_sequnlock_irqrestore(&tk->lock, flags);
465 481
466 /* signal hrtimers about time change */ 482 /* signal hrtimers about time change */
467 clock_was_set(); 483 clock_was_set();
@@ -477,23 +493,24 @@ EXPORT_SYMBOL(timekeeping_inject_offset);
477 */ 493 */
478static int change_clocksource(void *data) 494static int change_clocksource(void *data)
479{ 495{
496 struct timekeeper *tk = &timekeeper;
480 struct clocksource *new, *old; 497 struct clocksource *new, *old;
481 unsigned long flags; 498 unsigned long flags;
482 499
483 new = (struct clocksource *) data; 500 new = (struct clocksource *) data;
484 501
485 write_seqlock_irqsave(&timekeeper.lock, flags); 502 write_seqlock_irqsave(&tk->lock, flags);
486 503
487 timekeeping_forward_now(&timekeeper); 504 timekeeping_forward_now(tk);
488 if (!new->enable || new->enable(new) == 0) { 505 if (!new->enable || new->enable(new) == 0) {
489 old = timekeeper.clock; 506 old = tk->clock;
490 tk_setup_internals(&timekeeper, new); 507 tk_setup_internals(tk, new);
491 if (old->disable) 508 if (old->disable)
492 old->disable(old); 509 old->disable(old);
493 } 510 }
494 timekeeping_update(&timekeeper, true); 511 timekeeping_update(tk, true);
495 512
496 write_sequnlock_irqrestore(&timekeeper.lock, flags); 513 write_sequnlock_irqrestore(&tk->lock, flags);
497 514
498 return 0; 515 return 0;
499} 516}
@@ -507,7 +524,9 @@ static int change_clocksource(void *data)
507 */ 524 */
508void timekeeping_notify(struct clocksource *clock) 525void timekeeping_notify(struct clocksource *clock)
509{ 526{
510 if (timekeeper.clock == clock) 527 struct timekeeper *tk = &timekeeper;
528
529 if (tk->clock == clock)
511 return; 530 return;
512 stop_machine(change_clocksource, clock, NULL); 531 stop_machine(change_clocksource, clock, NULL);
513 tick_clock_notify(); 532 tick_clock_notify();
@@ -536,35 +555,36 @@ EXPORT_SYMBOL_GPL(ktime_get_real);
536 */ 555 */
537void getrawmonotonic(struct timespec *ts) 556void getrawmonotonic(struct timespec *ts)
538{ 557{
558 struct timekeeper *tk = &timekeeper;
539 unsigned long seq; 559 unsigned long seq;
540 s64 nsecs; 560 s64 nsecs;
541 561
542 do { 562 do {
543 seq = read_seqbegin(&timekeeper.lock); 563 seq = read_seqbegin(&tk->lock);
544 nsecs = timekeeping_get_ns_raw(&timekeeper); 564 nsecs = timekeeping_get_ns_raw(tk);
545 *ts = timekeeper.raw_time; 565 *ts = tk->raw_time;
546 566
547 } while (read_seqretry(&timekeeper.lock, seq)); 567 } while (read_seqretry(&tk->lock, seq));
548 568
549 timespec_add_ns(ts, nsecs); 569 timespec_add_ns(ts, nsecs);
550} 570}
551EXPORT_SYMBOL(getrawmonotonic); 571EXPORT_SYMBOL(getrawmonotonic);
552 572
553
554/** 573/**
555 * timekeeping_valid_for_hres - Check if timekeeping is suitable for hres 574 * timekeeping_valid_for_hres - Check if timekeeping is suitable for hres
556 */ 575 */
557int timekeeping_valid_for_hres(void) 576int timekeeping_valid_for_hres(void)
558{ 577{
578 struct timekeeper *tk = &timekeeper;
559 unsigned long seq; 579 unsigned long seq;
560 int ret; 580 int ret;
561 581
562 do { 582 do {
563 seq = read_seqbegin(&timekeeper.lock); 583 seq = read_seqbegin(&tk->lock);
564 584
565 ret = timekeeper.clock->flags & CLOCK_SOURCE_VALID_FOR_HRES; 585 ret = tk->clock->flags & CLOCK_SOURCE_VALID_FOR_HRES;
566 586
567 } while (read_seqretry(&timekeeper.lock, seq)); 587 } while (read_seqretry(&tk->lock, seq));
568 588
569 return ret; 589 return ret;
570} 590}
@@ -574,15 +594,16 @@ int timekeeping_valid_for_hres(void)
574 */ 594 */
575u64 timekeeping_max_deferment(void) 595u64 timekeeping_max_deferment(void)
576{ 596{
597 struct timekeeper *tk = &timekeeper;
577 unsigned long seq; 598 unsigned long seq;
578 u64 ret; 599 u64 ret;
579 600
580 do { 601 do {
581 seq = read_seqbegin(&timekeeper.lock); 602 seq = read_seqbegin(&tk->lock);
582 603
583 ret = timekeeper.clock->max_idle_ns; 604 ret = tk->clock->max_idle_ns;
584 605
585 } while (read_seqretry(&timekeeper.lock, seq)); 606 } while (read_seqretry(&tk->lock, seq));
586 607
587 return ret; 608 return ret;
588} 609}
@@ -622,46 +643,43 @@ void __attribute__((weak)) read_boot_clock(struct timespec *ts)
622 */ 643 */
623void __init timekeeping_init(void) 644void __init timekeeping_init(void)
624{ 645{
646 struct timekeeper *tk = &timekeeper;
625 struct clocksource *clock; 647 struct clocksource *clock;
626 unsigned long flags; 648 unsigned long flags;
627 struct timespec now, boot; 649 struct timespec now, boot, tmp;
628 650
629 read_persistent_clock(&now); 651 read_persistent_clock(&now);
630 read_boot_clock(&boot); 652 read_boot_clock(&boot);
631 653
632 seqlock_init(&timekeeper.lock); 654 seqlock_init(&tk->lock);
633 655
634 ntp_init(); 656 ntp_init();
635 657
636 write_seqlock_irqsave(&timekeeper.lock, flags); 658 write_seqlock_irqsave(&tk->lock, flags);
637 clock = clocksource_default_clock(); 659 clock = clocksource_default_clock();
638 if (clock->enable) 660 if (clock->enable)
639 clock->enable(clock); 661 clock->enable(clock);
640 tk_setup_internals(&timekeeper, clock); 662 tk_setup_internals(tk, clock);
641 663
642 tk_set_xtime(&timekeeper, &now); 664 tk_set_xtime(tk, &now);
643 timekeeper.raw_time.tv_sec = 0; 665 tk->raw_time.tv_sec = 0;
644 timekeeper.raw_time.tv_nsec = 0; 666 tk->raw_time.tv_nsec = 0;
645 if (boot.tv_sec == 0 && boot.tv_nsec == 0) 667 if (boot.tv_sec == 0 && boot.tv_nsec == 0)
646 boot = tk_xtime(&timekeeper); 668 boot = tk_xtime(tk);
647 669
648 set_normalized_timespec(&timekeeper.wall_to_monotonic, 670 set_normalized_timespec(&tmp, -boot.tv_sec, -boot.tv_nsec);
649 -boot.tv_sec, -boot.tv_nsec); 671 tk_set_wall_to_mono(tk, tmp);
650 update_rt_offset(&timekeeper); 672
651 timekeeper.total_sleep_time.tv_sec = 0; 673 tmp.tv_sec = 0;
652 timekeeper.total_sleep_time.tv_nsec = 0; 674 tmp.tv_nsec = 0;
653 write_sequnlock_irqrestore(&timekeeper.lock, flags); 675 tk_set_sleep_time(tk, tmp);
676
677 write_sequnlock_irqrestore(&tk->lock, flags);
654} 678}
655 679
656/* time in seconds when suspend began */ 680/* time in seconds when suspend began */
657static struct timespec timekeeping_suspend_time; 681static struct timespec timekeeping_suspend_time;
658 682
659static void update_sleep_time(struct timespec t)
660{
661 timekeeper.total_sleep_time = t;
662 timekeeper.offs_boot = timespec_to_ktime(t);
663}
664
665/** 683/**
666 * __timekeeping_inject_sleeptime - Internal function to add sleep interval 684 * __timekeeping_inject_sleeptime - Internal function to add sleep interval
667 * @delta: pointer to a timespec delta value 685 * @delta: pointer to a timespec delta value
@@ -677,13 +695,11 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk,
677 "sleep delta value!\n"); 695 "sleep delta value!\n");
678 return; 696 return;
679 } 697 }
680
681 tk_xtime_add(tk, delta); 698 tk_xtime_add(tk, delta);
682 tk->wall_to_monotonic = timespec_sub(tk->wall_to_monotonic, *delta); 699 tk_set_wall_to_mono(tk, timespec_sub(tk->wall_to_monotonic, *delta));
683 update_sleep_time(timespec_add(tk->total_sleep_time, *delta)); 700 tk_set_sleep_time(tk, timespec_add(tk->total_sleep_time, *delta));
684} 701}
685 702
686
687/** 703/**
688 * timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values 704 * timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values
689 * @delta: pointer to a timespec delta value 705 * @delta: pointer to a timespec delta value
@@ -696,6 +712,7 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk,
696 */ 712 */
697void timekeeping_inject_sleeptime(struct timespec *delta) 713void timekeeping_inject_sleeptime(struct timespec *delta)
698{ 714{
715 struct timekeeper *tk = &timekeeper;
699 unsigned long flags; 716 unsigned long flags;
700 struct timespec ts; 717 struct timespec ts;
701 718
@@ -704,21 +721,20 @@ void timekeeping_inject_sleeptime(struct timespec *delta)
704 if (!(ts.tv_sec == 0 && ts.tv_nsec == 0)) 721 if (!(ts.tv_sec == 0 && ts.tv_nsec == 0))
705 return; 722 return;
706 723
707 write_seqlock_irqsave(&timekeeper.lock, flags); 724 write_seqlock_irqsave(&tk->lock, flags);
708 725
709 timekeeping_forward_now(&timekeeper); 726 timekeeping_forward_now(tk);
710 727
711 __timekeeping_inject_sleeptime(&timekeeper, delta); 728 __timekeeping_inject_sleeptime(tk, delta);
712 729
713 timekeeping_update(&timekeeper, true); 730 timekeeping_update(tk, true);
714 731
715 write_sequnlock_irqrestore(&timekeeper.lock, flags); 732 write_sequnlock_irqrestore(&tk->lock, flags);
716 733
717 /* signal hrtimers about time change */ 734 /* signal hrtimers about time change */
718 clock_was_set(); 735 clock_was_set();
719} 736}
720 737
721
722/** 738/**
723 * timekeeping_resume - Resumes the generic timekeeping subsystem. 739 * timekeeping_resume - Resumes the generic timekeeping subsystem.
724 * 740 *
@@ -728,6 +744,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta)
728 */ 744 */
729static void timekeeping_resume(void) 745static void timekeeping_resume(void)
730{ 746{
747 struct timekeeper *tk = &timekeeper;
731 unsigned long flags; 748 unsigned long flags;
732 struct timespec ts; 749 struct timespec ts;
733 750
@@ -735,18 +752,18 @@ static void timekeeping_resume(void)
735 752
736 clocksource_resume(); 753 clocksource_resume();
737 754
738 write_seqlock_irqsave(&timekeeper.lock, flags); 755 write_seqlock_irqsave(&tk->lock, flags);
739 756
740 if (timespec_compare(&ts, &timekeeping_suspend_time) > 0) { 757 if (timespec_compare(&ts, &timekeeping_suspend_time) > 0) {
741 ts = timespec_sub(ts, timekeeping_suspend_time); 758 ts = timespec_sub(ts, timekeeping_suspend_time);
742 __timekeeping_inject_sleeptime(&timekeeper, &ts); 759 __timekeeping_inject_sleeptime(tk, &ts);
743 } 760 }
744 /* re-base the last cycle value */ 761 /* re-base the last cycle value */
745 timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock); 762 tk->clock->cycle_last = tk->clock->read(tk->clock);
746 timekeeper.ntp_error = 0; 763 tk->ntp_error = 0;
747 timekeeping_suspended = 0; 764 timekeeping_suspended = 0;
748 timekeeping_update(&timekeeper, false); 765 timekeeping_update(tk, false);
749 write_sequnlock_irqrestore(&timekeeper.lock, flags); 766 write_sequnlock_irqrestore(&tk->lock, flags);
750 767
751 touch_softlockup_watchdog(); 768 touch_softlockup_watchdog();
752 769
@@ -758,14 +775,15 @@ static void timekeeping_resume(void)
758 775
759static int timekeeping_suspend(void) 776static int timekeeping_suspend(void)
760{ 777{
778 struct timekeeper *tk = &timekeeper;
761 unsigned long flags; 779 unsigned long flags;
762 struct timespec delta, delta_delta; 780 struct timespec delta, delta_delta;
763 static struct timespec old_delta; 781 static struct timespec old_delta;
764 782
765 read_persistent_clock(&timekeeping_suspend_time); 783 read_persistent_clock(&timekeeping_suspend_time);
766 784
767 write_seqlock_irqsave(&timekeeper.lock, flags); 785 write_seqlock_irqsave(&tk->lock, flags);
768 timekeeping_forward_now(&timekeeper); 786 timekeeping_forward_now(tk);
769 timekeeping_suspended = 1; 787 timekeeping_suspended = 1;
770 788
771 /* 789 /*
@@ -774,7 +792,7 @@ static int timekeeping_suspend(void)
774 * try to compensate so the difference in system time 792 * try to compensate so the difference in system time
775 * and persistent_clock time stays close to constant. 793 * and persistent_clock time stays close to constant.
776 */ 794 */
777 delta = timespec_sub(tk_xtime(&timekeeper), timekeeping_suspend_time); 795 delta = timespec_sub(tk_xtime(tk), timekeeping_suspend_time);
778 delta_delta = timespec_sub(delta, old_delta); 796 delta_delta = timespec_sub(delta, old_delta);
779 if (abs(delta_delta.tv_sec) >= 2) { 797 if (abs(delta_delta.tv_sec) >= 2) {
780 /* 798 /*
@@ -787,7 +805,7 @@ static int timekeeping_suspend(void)
787 timekeeping_suspend_time = 805 timekeeping_suspend_time =
788 timespec_add(timekeeping_suspend_time, delta_delta); 806 timespec_add(timekeeping_suspend_time, delta_delta);
789 } 807 }
790 write_sequnlock_irqrestore(&timekeeper.lock, flags); 808 write_sequnlock_irqrestore(&tk->lock, flags);
791 809
792 clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); 810 clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
793 clocksource_suspend(); 811 clocksource_suspend();
@@ -898,27 +916,29 @@ static void timekeeping_adjust(struct timekeeper *tk, s64 offset)
898 * the error. This causes the likely below to be unlikely. 916 * the error. This causes the likely below to be unlikely.
899 * 917 *
900 * The proper fix is to avoid rounding up by using 918 * The proper fix is to avoid rounding up by using
901 * the high precision timekeeper.xtime_nsec instead of 919 * the high precision tk->xtime_nsec instead of
902 * xtime.tv_nsec everywhere. Fixing this will take some 920 * xtime.tv_nsec everywhere. Fixing this will take some
903 * time. 921 * time.
904 */ 922 */
905 if (likely(error <= interval)) 923 if (likely(error <= interval))
906 adj = 1; 924 adj = 1;
907 else 925 else
908 adj = timekeeping_bigadjust(tk, error, &interval, 926 adj = timekeeping_bigadjust(tk, error, &interval, &offset);
909 &offset); 927 } else {
910 } else if (error < -interval) { 928 if (error < -interval) {
911 /* See comment above, this is just switched for the negative */ 929 /* See comment above, this is just switched for the negative */
912 error >>= 2; 930 error >>= 2;
913 if (likely(error >= -interval)) { 931 if (likely(error >= -interval)) {
914 adj = -1; 932 adj = -1;
915 interval = -interval; 933 interval = -interval;
916 offset = -offset; 934 offset = -offset;
917 } else 935 } else {
918 adj = timekeeping_bigadjust(tk, error, &interval, 936 adj = timekeeping_bigadjust(tk, error, &interval, &offset);
919 &offset); 937 }
920 } else 938 } else {
921 return; 939 goto out_adjust;
940 }
941 }
922 942
923 if (unlikely(tk->clock->maxadj && 943 if (unlikely(tk->clock->maxadj &&
924 (tk->mult + adj > tk->clock->mult + tk->clock->maxadj))) { 944 (tk->mult + adj > tk->clock->mult + tk->clock->maxadj))) {
@@ -981,6 +1001,7 @@ static void timekeeping_adjust(struct timekeeper *tk, s64 offset)
981 tk->xtime_nsec -= offset; 1001 tk->xtime_nsec -= offset;
982 tk->ntp_error -= (interval - offset) << tk->ntp_error_shift; 1002 tk->ntp_error -= (interval - offset) << tk->ntp_error_shift;
983 1003
1004out_adjust:
984 /* 1005 /*
985 * It may be possible that when we entered this function, xtime_nsec 1006 * It may be possible that when we entered this function, xtime_nsec
986 * was very small. Further, if we're slightly speeding the clocksource 1007 * was very small. Further, if we're slightly speeding the clocksource
@@ -1003,7 +1024,6 @@ static void timekeeping_adjust(struct timekeeper *tk, s64 offset)
1003 1024
1004} 1025}
1005 1026
1006
1007/** 1027/**
1008 * accumulate_nsecs_to_secs - Accumulates nsecs into secs 1028 * accumulate_nsecs_to_secs - Accumulates nsecs into secs
1009 * 1029 *
@@ -1024,15 +1044,21 @@ static inline void accumulate_nsecs_to_secs(struct timekeeper *tk)
1024 1044
1025 /* Figure out if its a leap sec and apply if needed */ 1045 /* Figure out if its a leap sec and apply if needed */
1026 leap = second_overflow(tk->xtime_sec); 1046 leap = second_overflow(tk->xtime_sec);
1027 tk->xtime_sec += leap; 1047 if (unlikely(leap)) {
1028 tk->wall_to_monotonic.tv_sec -= leap; 1048 struct timespec ts;
1029 if (leap) 1049
1030 clock_was_set_delayed(); 1050 tk->xtime_sec += leap;
1051
1052 ts.tv_sec = leap;
1053 ts.tv_nsec = 0;
1054 tk_set_wall_to_mono(tk,
1055 timespec_sub(tk->wall_to_monotonic, ts));
1031 1056
1057 clock_was_set_delayed();
1058 }
1032 } 1059 }
1033} 1060}
1034 1061
1035
1036/** 1062/**
1037 * logarithmic_accumulation - shifted accumulation of cycles 1063 * logarithmic_accumulation - shifted accumulation of cycles
1038 * 1064 *
@@ -1076,7 +1102,6 @@ static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset,
1076 return offset; 1102 return offset;
1077} 1103}
1078 1104
1079
1080/** 1105/**
1081 * update_wall_time - Uses the current clocksource to increment the wall time 1106 * update_wall_time - Uses the current clocksource to increment the wall time
1082 * 1107 *
@@ -1084,21 +1109,22 @@ static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset,
1084static void update_wall_time(void) 1109static void update_wall_time(void)
1085{ 1110{
1086 struct clocksource *clock; 1111 struct clocksource *clock;
1112 struct timekeeper *tk = &timekeeper;
1087 cycle_t offset; 1113 cycle_t offset;
1088 int shift = 0, maxshift; 1114 int shift = 0, maxshift;
1089 unsigned long flags; 1115 unsigned long flags;
1090 s64 remainder; 1116 s64 remainder;
1091 1117
1092 write_seqlock_irqsave(&timekeeper.lock, flags); 1118 write_seqlock_irqsave(&tk->lock, flags);
1093 1119
1094 /* Make sure we're fully resumed: */ 1120 /* Make sure we're fully resumed: */
1095 if (unlikely(timekeeping_suspended)) 1121 if (unlikely(timekeeping_suspended))
1096 goto out; 1122 goto out;
1097 1123
1098 clock = timekeeper.clock; 1124 clock = tk->clock;
1099 1125
1100#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET 1126#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
1101 offset = timekeeper.cycle_interval; 1127 offset = tk->cycle_interval;
1102#else 1128#else
1103 offset = (clock->read(clock) - clock->cycle_last) & clock->mask; 1129 offset = (clock->read(clock) - clock->cycle_last) & clock->mask;
1104#endif 1130#endif
@@ -1111,19 +1137,19 @@ static void update_wall_time(void)
1111 * chunk in one go, and then try to consume the next smaller 1137 * chunk in one go, and then try to consume the next smaller
1112 * doubled multiple. 1138 * doubled multiple.
1113 */ 1139 */
1114 shift = ilog2(offset) - ilog2(timekeeper.cycle_interval); 1140 shift = ilog2(offset) - ilog2(tk->cycle_interval);
1115 shift = max(0, shift); 1141 shift = max(0, shift);
1116 /* Bound shift to one less than what overflows tick_length */ 1142 /* Bound shift to one less than what overflows tick_length */
1117 maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1; 1143 maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1;
1118 shift = min(shift, maxshift); 1144 shift = min(shift, maxshift);
1119 while (offset >= timekeeper.cycle_interval) { 1145 while (offset >= tk->cycle_interval) {
1120 offset = logarithmic_accumulation(&timekeeper, offset, shift); 1146 offset = logarithmic_accumulation(tk, offset, shift);
1121 if(offset < timekeeper.cycle_interval<<shift) 1147 if (offset < tk->cycle_interval<<shift)
1122 shift--; 1148 shift--;
1123 } 1149 }
1124 1150
1125 /* correct the clock when NTP error is too big */ 1151 /* correct the clock when NTP error is too big */
1126 timekeeping_adjust(&timekeeper, offset); 1152 timekeeping_adjust(tk, offset);
1127 1153
1128 1154
1129 /* 1155 /*
@@ -1135,21 +1161,21 @@ static void update_wall_time(void)
1135 * the vsyscall implementations are converted to use xtime_nsec 1161 * the vsyscall implementations are converted to use xtime_nsec
1136 * (shifted nanoseconds), this can be killed. 1162 * (shifted nanoseconds), this can be killed.
1137 */ 1163 */
1138 remainder = timekeeper.xtime_nsec & ((1 << timekeeper.shift) - 1); 1164 remainder = tk->xtime_nsec & ((1 << tk->shift) - 1);
1139 timekeeper.xtime_nsec -= remainder; 1165 tk->xtime_nsec -= remainder;
1140 timekeeper.xtime_nsec += 1 << timekeeper.shift; 1166 tk->xtime_nsec += 1 << tk->shift;
1141 timekeeper.ntp_error += remainder << timekeeper.ntp_error_shift; 1167 tk->ntp_error += remainder << tk->ntp_error_shift;
1142 1168
1143 /* 1169 /*
1144 * Finally, make sure that after the rounding 1170 * Finally, make sure that after the rounding
1145 * xtime_nsec isn't larger than NSEC_PER_SEC 1171 * xtime_nsec isn't larger than NSEC_PER_SEC
1146 */ 1172 */
1147 accumulate_nsecs_to_secs(&timekeeper); 1173 accumulate_nsecs_to_secs(tk);
1148 1174
1149 timekeeping_update(&timekeeper, false); 1175 timekeeping_update(tk, false);
1150 1176
1151out: 1177out:
1152 write_sequnlock_irqrestore(&timekeeper.lock, flags); 1178 write_sequnlock_irqrestore(&tk->lock, flags);
1153 1179
1154} 1180}
1155 1181
@@ -1166,18 +1192,18 @@ out:
1166 */ 1192 */
1167void getboottime(struct timespec *ts) 1193void getboottime(struct timespec *ts)
1168{ 1194{
1195 struct timekeeper *tk = &timekeeper;
1169 struct timespec boottime = { 1196 struct timespec boottime = {
1170 .tv_sec = timekeeper.wall_to_monotonic.tv_sec + 1197 .tv_sec = tk->wall_to_monotonic.tv_sec +
1171 timekeeper.total_sleep_time.tv_sec, 1198 tk->total_sleep_time.tv_sec,
1172 .tv_nsec = timekeeper.wall_to_monotonic.tv_nsec + 1199 .tv_nsec = tk->wall_to_monotonic.tv_nsec +
1173 timekeeper.total_sleep_time.tv_nsec 1200 tk->total_sleep_time.tv_nsec
1174 }; 1201 };
1175 1202
1176 set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); 1203 set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
1177} 1204}
1178EXPORT_SYMBOL_GPL(getboottime); 1205EXPORT_SYMBOL_GPL(getboottime);
1179 1206
1180
1181/** 1207/**
1182 * get_monotonic_boottime - Returns monotonic time since boot 1208 * get_monotonic_boottime - Returns monotonic time since boot
1183 * @ts: pointer to the timespec to be set 1209 * @ts: pointer to the timespec to be set
@@ -1189,19 +1215,20 @@ EXPORT_SYMBOL_GPL(getboottime);
1189 */ 1215 */
1190void get_monotonic_boottime(struct timespec *ts) 1216void get_monotonic_boottime(struct timespec *ts)
1191{ 1217{
1218 struct timekeeper *tk = &timekeeper;
1192 struct timespec tomono, sleep; 1219 struct timespec tomono, sleep;
1193 unsigned int seq; 1220 unsigned int seq;
1194 1221
1195 WARN_ON(timekeeping_suspended); 1222 WARN_ON(timekeeping_suspended);
1196 1223
1197 do { 1224 do {
1198 seq = read_seqbegin(&timekeeper.lock); 1225 seq = read_seqbegin(&tk->lock);
1199 ts->tv_sec = timekeeper.xtime_sec; 1226 ts->tv_sec = tk->xtime_sec;
1200 ts->tv_nsec = timekeeping_get_ns(&timekeeper); 1227 ts->tv_nsec = timekeeping_get_ns(tk);
1201 tomono = timekeeper.wall_to_monotonic; 1228 tomono = tk->wall_to_monotonic;
1202 sleep = timekeeper.total_sleep_time; 1229 sleep = tk->total_sleep_time;
1203 1230
1204 } while (read_seqretry(&timekeeper.lock, seq)); 1231 } while (read_seqretry(&tk->lock, seq));
1205 1232
1206 set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec, 1233 set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec,
1207 ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec); 1234 ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec);
@@ -1231,31 +1258,38 @@ EXPORT_SYMBOL_GPL(ktime_get_boottime);
1231 */ 1258 */
1232void monotonic_to_bootbased(struct timespec *ts) 1259void monotonic_to_bootbased(struct timespec *ts)
1233{ 1260{
1234 *ts = timespec_add(*ts, timekeeper.total_sleep_time); 1261 struct timekeeper *tk = &timekeeper;
1262
1263 *ts = timespec_add(*ts, tk->total_sleep_time);
1235} 1264}
1236EXPORT_SYMBOL_GPL(monotonic_to_bootbased); 1265EXPORT_SYMBOL_GPL(monotonic_to_bootbased);
1237 1266
1238unsigned long get_seconds(void) 1267unsigned long get_seconds(void)
1239{ 1268{
1240 return timekeeper.xtime_sec; 1269 struct timekeeper *tk = &timekeeper;
1270
1271 return tk->xtime_sec;
1241} 1272}
1242EXPORT_SYMBOL(get_seconds); 1273EXPORT_SYMBOL(get_seconds);
1243 1274
1244struct timespec __current_kernel_time(void) 1275struct timespec __current_kernel_time(void)
1245{ 1276{
1246 return tk_xtime(&timekeeper); 1277 struct timekeeper *tk = &timekeeper;
1278
1279 return tk_xtime(tk);
1247} 1280}
1248 1281
1249struct timespec current_kernel_time(void) 1282struct timespec current_kernel_time(void)
1250{ 1283{
1284 struct timekeeper *tk = &timekeeper;
1251 struct timespec now; 1285 struct timespec now;
1252 unsigned long seq; 1286 unsigned long seq;
1253 1287
1254 do { 1288 do {
1255 seq = read_seqbegin(&timekeeper.lock); 1289 seq = read_seqbegin(&tk->lock);
1256 1290
1257 now = tk_xtime(&timekeeper); 1291 now = tk_xtime(tk);
1258 } while (read_seqretry(&timekeeper.lock, seq)); 1292 } while (read_seqretry(&tk->lock, seq));
1259 1293
1260 return now; 1294 return now;
1261} 1295}
@@ -1263,15 +1297,16 @@ EXPORT_SYMBOL(current_kernel_time);
1263 1297
1264struct timespec get_monotonic_coarse(void) 1298struct timespec get_monotonic_coarse(void)
1265{ 1299{
1300 struct timekeeper *tk = &timekeeper;
1266 struct timespec now, mono; 1301 struct timespec now, mono;
1267 unsigned long seq; 1302 unsigned long seq;
1268 1303
1269 do { 1304 do {
1270 seq = read_seqbegin(&timekeeper.lock); 1305 seq = read_seqbegin(&tk->lock);
1271 1306
1272 now = tk_xtime(&timekeeper); 1307 now = tk_xtime(tk);
1273 mono = timekeeper.wall_to_monotonic; 1308 mono = tk->wall_to_monotonic;
1274 } while (read_seqretry(&timekeeper.lock, seq)); 1309 } while (read_seqretry(&tk->lock, seq));
1275 1310
1276 set_normalized_timespec(&now, now.tv_sec + mono.tv_sec, 1311 set_normalized_timespec(&now, now.tv_sec + mono.tv_sec,
1277 now.tv_nsec + mono.tv_nsec); 1312 now.tv_nsec + mono.tv_nsec);
@@ -1300,14 +1335,15 @@ void do_timer(unsigned long ticks)
1300void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, 1335void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
1301 struct timespec *wtom, struct timespec *sleep) 1336 struct timespec *wtom, struct timespec *sleep)
1302{ 1337{
1338 struct timekeeper *tk = &timekeeper;
1303 unsigned long seq; 1339 unsigned long seq;
1304 1340
1305 do { 1341 do {
1306 seq = read_seqbegin(&timekeeper.lock); 1342 seq = read_seqbegin(&tk->lock);
1307 *xtim = tk_xtime(&timekeeper); 1343 *xtim = tk_xtime(tk);
1308 *wtom = timekeeper.wall_to_monotonic; 1344 *wtom = tk->wall_to_monotonic;
1309 *sleep = timekeeper.total_sleep_time; 1345 *sleep = tk->total_sleep_time;
1310 } while (read_seqretry(&timekeeper.lock, seq)); 1346 } while (read_seqretry(&tk->lock, seq));
1311} 1347}
1312 1348
1313#ifdef CONFIG_HIGH_RES_TIMERS 1349#ifdef CONFIG_HIGH_RES_TIMERS
@@ -1321,19 +1357,20 @@ void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
1321 */ 1357 */
1322ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot) 1358ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot)
1323{ 1359{
1360 struct timekeeper *tk = &timekeeper;
1324 ktime_t now; 1361 ktime_t now;
1325 unsigned int seq; 1362 unsigned int seq;
1326 u64 secs, nsecs; 1363 u64 secs, nsecs;
1327 1364
1328 do { 1365 do {
1329 seq = read_seqbegin(&timekeeper.lock); 1366 seq = read_seqbegin(&tk->lock);
1330 1367
1331 secs = timekeeper.xtime_sec; 1368 secs = tk->xtime_sec;
1332 nsecs = timekeeping_get_ns(&timekeeper); 1369 nsecs = timekeeping_get_ns(tk);
1333 1370
1334 *offs_real = timekeeper.offs_real; 1371 *offs_real = tk->offs_real;
1335 *offs_boot = timekeeper.offs_boot; 1372 *offs_boot = tk->offs_boot;
1336 } while (read_seqretry(&timekeeper.lock, seq)); 1373 } while (read_seqretry(&tk->lock, seq));
1337 1374
1338 now = ktime_add_ns(ktime_set(secs, 0), nsecs); 1375 now = ktime_add_ns(ktime_set(secs, 0), nsecs);
1339 now = ktime_sub(now, *offs_real); 1376 now = ktime_sub(now, *offs_real);
@@ -1346,19 +1383,19 @@ ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot)
1346 */ 1383 */
1347ktime_t ktime_get_monotonic_offset(void) 1384ktime_t ktime_get_monotonic_offset(void)
1348{ 1385{
1386 struct timekeeper *tk = &timekeeper;
1349 unsigned long seq; 1387 unsigned long seq;
1350 struct timespec wtom; 1388 struct timespec wtom;
1351 1389
1352 do { 1390 do {
1353 seq = read_seqbegin(&timekeeper.lock); 1391 seq = read_seqbegin(&tk->lock);
1354 wtom = timekeeper.wall_to_monotonic; 1392 wtom = tk->wall_to_monotonic;
1355 } while (read_seqretry(&timekeeper.lock, seq)); 1393 } while (read_seqretry(&tk->lock, seq));
1356 1394
1357 return timespec_to_ktime(wtom); 1395 return timespec_to_ktime(wtom);
1358} 1396}
1359EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset); 1397EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
1360 1398
1361
1362/** 1399/**
1363 * xtime_update() - advances the timekeeping infrastructure 1400 * xtime_update() - advances the timekeeping infrastructure
1364 * @ticks: number of ticks, that have elapsed since the last call. 1401 * @ticks: number of ticks, that have elapsed since the last call.
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index fee3752ae8f6..8a6d2ee2086c 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -281,7 +281,7 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip)
281 281
282 head = this_cpu_ptr(event_function.perf_events); 282 head = this_cpu_ptr(event_function.perf_events);
283 perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, 0, 283 perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, 0,
284 1, &regs, head); 284 1, &regs, head, NULL);
285 285
286#undef ENTRY_SIZE 286#undef ENTRY_SIZE
287} 287}
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index b31d3d5699fe..1a2117043bb1 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1002,7 +1002,8 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
1002 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize); 1002 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize);
1003 1003
1004 head = this_cpu_ptr(call->perf_events); 1004 head = this_cpu_ptr(call->perf_events);
1005 perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, head); 1005 perf_trace_buf_submit(entry, size, rctx,
1006 entry->ip, 1, regs, head, NULL);
1006} 1007}
1007 1008
1008/* Kretprobe profile handler */ 1009/* Kretprobe profile handler */
@@ -1033,7 +1034,8 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
1033 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize); 1034 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize);
1034 1035
1035 head = this_cpu_ptr(call->perf_events); 1036 head = this_cpu_ptr(call->perf_events);
1036 perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1, regs, head); 1037 perf_trace_buf_submit(entry, size, rctx,
1038 entry->ret_ip, 1, regs, head, NULL);
1037} 1039}
1038#endif /* CONFIG_PERF_EVENTS */ 1040#endif /* CONFIG_PERF_EVENTS */
1039 1041
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 96fc73369099..60e4d7875672 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -532,7 +532,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
532 (unsigned long *)&rec->args); 532 (unsigned long *)&rec->args);
533 533
534 head = this_cpu_ptr(sys_data->enter_event->perf_events); 534 head = this_cpu_ptr(sys_data->enter_event->perf_events);
535 perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head); 535 perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL);
536} 536}
537 537
538int perf_sysenter_enable(struct ftrace_event_call *call) 538int perf_sysenter_enable(struct ftrace_event_call *call)
@@ -608,7 +608,7 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
608 rec->ret = syscall_get_return_value(current, regs); 608 rec->ret = syscall_get_return_value(current, regs);
609 609
610 head = this_cpu_ptr(sys_data->exit_event->perf_events); 610 head = this_cpu_ptr(sys_data->exit_event->perf_events);
611 perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head); 611 perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL);
612} 612}
613 613
614int perf_sysexit_enable(struct ftrace_event_call *call) 614int perf_sysexit_enable(struct ftrace_event_call *call)
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 2b36ac68549e..03003cd7dd96 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -670,7 +670,7 @@ static void uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs)
670 call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset); 670 call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset);
671 671
672 head = this_cpu_ptr(call->perf_events); 672 head = this_cpu_ptr(call->perf_events);
673 perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, head); 673 perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, regs, head, NULL);
674 674
675 out: 675 out:
676 preempt_enable(); 676 preempt_enable();
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 69add8a9da68..4b1dfba70f7c 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -575,7 +575,7 @@ out:
575/* 575/*
576 * Create/destroy watchdog threads as CPUs come and go: 576 * Create/destroy watchdog threads as CPUs come and go:
577 */ 577 */
578static int 578static int __cpuinit
579cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 579cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
580{ 580{
581 int hotcpu = (unsigned long)hcpu; 581 int hotcpu = (unsigned long)hcpu;
@@ -610,27 +610,10 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
610 return NOTIFY_OK; 610 return NOTIFY_OK;
611} 611}
612 612
613static struct notifier_block cpu_nfb = { 613static struct notifier_block __cpuinitdata cpu_nfb = {
614 .notifier_call = cpu_callback 614 .notifier_call = cpu_callback
615}; 615};
616 616
617#ifdef CONFIG_SUSPEND
618/*
619 * On exit from suspend we force an offline->online transition on the boot CPU
620 * so that the PMU state that was lost while in suspended state gets set up
621 * properly for the boot CPU. This information is required for restarting the
622 * NMI watchdog.
623 */
624void lockup_detector_bootcpu_resume(void)
625{
626 void *cpu = (void *)(long)smp_processor_id();
627
628 cpu_callback(&cpu_nfb, CPU_DEAD_FROZEN, cpu);
629 cpu_callback(&cpu_nfb, CPU_UP_PREPARE_FROZEN, cpu);
630 cpu_callback(&cpu_nfb, CPU_ONLINE_FROZEN, cpu);
631}
632#endif
633
634void __init lockup_detector_init(void) 617void __init lockup_detector_init(void)
635{ 618{
636 void *cpu = (void *)(long)smp_processor_id(); 619 void *cpu = (void *)(long)smp_processor_id();
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 6b4718e2ee34..b41823cc05e6 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -39,12 +39,6 @@ DEFINE_SPINLOCK(bdi_lock);
39LIST_HEAD(bdi_list); 39LIST_HEAD(bdi_list);
40LIST_HEAD(bdi_pending_list); 40LIST_HEAD(bdi_pending_list);
41 41
42static struct task_struct *sync_supers_tsk;
43static struct timer_list sync_supers_timer;
44
45static int bdi_sync_supers(void *);
46static void sync_supers_timer_fn(unsigned long);
47
48void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2) 42void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2)
49{ 43{
50 if (wb1 < wb2) { 44 if (wb1 < wb2) {
@@ -250,12 +244,6 @@ static int __init default_bdi_init(void)
250{ 244{
251 int err; 245 int err;
252 246
253 sync_supers_tsk = kthread_run(bdi_sync_supers, NULL, "sync_supers");
254 BUG_ON(IS_ERR(sync_supers_tsk));
255
256 setup_timer(&sync_supers_timer, sync_supers_timer_fn, 0);
257 bdi_arm_supers_timer();
258
259 err = bdi_init(&default_backing_dev_info); 247 err = bdi_init(&default_backing_dev_info);
260 if (!err) 248 if (!err)
261 bdi_register(&default_backing_dev_info, NULL, "default"); 249 bdi_register(&default_backing_dev_info, NULL, "default");
@@ -270,46 +258,6 @@ int bdi_has_dirty_io(struct backing_dev_info *bdi)
270 return wb_has_dirty_io(&bdi->wb); 258 return wb_has_dirty_io(&bdi->wb);
271} 259}
272 260
273/*
274 * kupdated() used to do this. We cannot do it from the bdi_forker_thread()
275 * or we risk deadlocking on ->s_umount. The longer term solution would be
276 * to implement sync_supers_bdi() or similar and simply do it from the
277 * bdi writeback thread individually.
278 */
279static int bdi_sync_supers(void *unused)
280{
281 set_user_nice(current, 0);
282
283 while (!kthread_should_stop()) {
284 set_current_state(TASK_INTERRUPTIBLE);
285 schedule();
286
287 /*
288 * Do this periodically, like kupdated() did before.
289 */
290 sync_supers();
291 }
292
293 return 0;
294}
295
296void bdi_arm_supers_timer(void)
297{
298 unsigned long next;
299
300 if (!dirty_writeback_interval)
301 return;
302
303 next = msecs_to_jiffies(dirty_writeback_interval * 10) + jiffies;
304 mod_timer(&sync_supers_timer, round_jiffies_up(next));
305}
306
307static void sync_supers_timer_fn(unsigned long unused)
308{
309 wake_up_process(sync_supers_tsk);
310 bdi_arm_supers_timer();
311}
312
313static void wakeup_timer_fn(unsigned long data) 261static void wakeup_timer_fn(unsigned long data)
314{ 262{
315 struct backing_dev_info *bdi = (struct backing_dev_info *)data; 263 struct backing_dev_info *bdi = (struct backing_dev_info *)data;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index e5363f34e025..5ad5ce23c1e0 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1532,7 +1532,6 @@ int dirty_writeback_centisecs_handler(ctl_table *table, int write,
1532 void __user *buffer, size_t *length, loff_t *ppos) 1532 void __user *buffer, size_t *length, loff_t *ppos)
1533{ 1533{
1534 proc_dointvec(table, write, buffer, length, ppos); 1534 proc_dointvec(table, write, buffer, length, ppos);
1535 bdi_arm_supers_timer();
1536 return 0; 1535 return 0;
1537} 1536}
1538 1537
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index b421cc49d2cd..fc866f2e4528 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -200,11 +200,11 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
200 if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT) 200 if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT)
201 goto out; 201 goto out;
202 202
203 if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect))
204 goto out;
205
206 curr_gw = batadv_gw_get_selected_gw_node(bat_priv); 203 curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
207 204
205 if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect) && curr_gw)
206 goto out;
207
208 next_gw = batadv_gw_get_best_gw_node(bat_priv); 208 next_gw = batadv_gw_get_best_gw_node(bat_priv);
209 209
210 if (curr_gw == next_gw) 210 if (curr_gw == next_gw)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index a438f4b582fc..99dd8f75b3ff 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -197,6 +197,7 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
197del: 197del:
198 list_del(&entry->list); 198 list_del(&entry->list);
199 kfree(entry); 199 kfree(entry);
200 kfree(tt_change_node);
200 event_removed = true; 201 event_removed = true;
201 goto unlock; 202 goto unlock;
202 } 203 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 0cb3fe8d8e72..a39354ee1432 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1055,6 +1055,8 @@ rollback:
1055 */ 1055 */
1056int dev_set_alias(struct net_device *dev, const char *alias, size_t len) 1056int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
1057{ 1057{
1058 char *new_ifalias;
1059
1058 ASSERT_RTNL(); 1060 ASSERT_RTNL();
1059 1061
1060 if (len >= IFALIASZ) 1062 if (len >= IFALIASZ)
@@ -1068,9 +1070,10 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
1068 return 0; 1070 return 0;
1069 } 1071 }
1070 1072
1071 dev->ifalias = krealloc(dev->ifalias, len + 1, GFP_KERNEL); 1073 new_ifalias = krealloc(dev->ifalias, len + 1, GFP_KERNEL);
1072 if (!dev->ifalias) 1074 if (!new_ifalias)
1073 return -ENOMEM; 1075 return -ENOMEM;
1076 dev->ifalias = new_ifalias;
1074 1077
1075 strlcpy(dev->ifalias, alias, len+1); 1078 strlcpy(dev->ifalias, alias, len+1);
1076 return len; 1079 return len;
@@ -2134,6 +2137,9 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2134 __be16 protocol = skb->protocol; 2137 __be16 protocol = skb->protocol;
2135 netdev_features_t features = skb->dev->features; 2138 netdev_features_t features = skb->dev->features;
2136 2139
2140 if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)
2141 features &= ~NETIF_F_GSO_MASK;
2142
2137 if (protocol == htons(ETH_P_8021Q)) { 2143 if (protocol == htons(ETH_P_8021Q)) {
2138 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 2144 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
2139 protocol = veh->h_vlan_encapsulated_proto; 2145 protocol = veh->h_vlan_encapsulated_proto;
@@ -5986,6 +5992,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
5986 dev_net_set(dev, &init_net); 5992 dev_net_set(dev, &init_net);
5987 5993
5988 dev->gso_max_size = GSO_MAX_SIZE; 5994 dev->gso_max_size = GSO_MAX_SIZE;
5995 dev->gso_max_segs = GSO_MAX_SEGS;
5989 5996
5990 INIT_LIST_HEAD(&dev->napi_list); 5997 INIT_LIST_HEAD(&dev->napi_list);
5991 INIT_LIST_HEAD(&dev->unreg_list); 5998 INIT_LIST_HEAD(&dev->unreg_list);
diff --git a/net/core/dst.c b/net/core/dst.c
index 069d51d29414..56d63612e1e4 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -149,7 +149,15 @@ int dst_discard(struct sk_buff *skb)
149} 149}
150EXPORT_SYMBOL(dst_discard); 150EXPORT_SYMBOL(dst_discard);
151 151
152const u32 dst_default_metrics[RTAX_MAX]; 152const u32 dst_default_metrics[RTAX_MAX + 1] = {
153 /* This initializer is needed to force linker to place this variable
154 * into const section. Otherwise it might end into bss section.
155 * We really want to avoid false sharing on this variable, and catch
156 * any writes on it.
157 */
158 [RTAX_MAX] = 0xdeadbeef,
159};
160
153 161
154void *dst_alloc(struct dst_ops *ops, struct net_device *dev, 162void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
155 int initial_ref, int initial_obsolete, unsigned short flags) 163 int initial_ref, int initial_obsolete, unsigned short flags)
diff --git a/net/core/sock.c b/net/core/sock.c
index 6b654b3ddfda..8f67ced8d6a8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1458,6 +1458,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1458 } else { 1458 } else {
1459 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; 1459 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1460 sk->sk_gso_max_size = dst->dev->gso_max_size; 1460 sk->sk_gso_max_size = dst->dev->gso_max_size;
1461 sk->sk_gso_max_segs = dst->dev->gso_max_segs;
1461 } 1462 }
1462 } 1463 }
1463} 1464}
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index f0cdb30921c0..57bd978483e1 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -367,7 +367,7 @@ static void __leaf_free_rcu(struct rcu_head *head)
367 367
368static inline void free_leaf(struct leaf *l) 368static inline void free_leaf(struct leaf *l)
369{ 369{
370 call_rcu_bh(&l->rcu, __leaf_free_rcu); 370 call_rcu(&l->rcu, __leaf_free_rcu);
371} 371}
372 372
373static inline void free_leaf_info(struct leaf_info *leaf) 373static inline void free_leaf_info(struct leaf_info *leaf)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ba39a52d18c1..147ccc3e93db 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -197,7 +197,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
197 neigh = __ipv4_neigh_lookup_noref(dev, nexthop); 197 neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
198 if (unlikely(!neigh)) 198 if (unlikely(!neigh))
199 neigh = __neigh_create(&arp_tbl, &nexthop, dev, false); 199 neigh = __neigh_create(&arp_tbl, &nexthop, dev, false);
200 if (neigh) { 200 if (!IS_ERR(neigh)) {
201 int res = dst_neigh_output(dst, neigh, skb); 201 int res = dst_neigh_output(dst, neigh, skb);
202 202
203 rcu_read_unlock_bh(); 203 rcu_read_unlock_bh();
@@ -1366,9 +1366,8 @@ out:
1366 return skb; 1366 return skb;
1367} 1367}
1368 1368
1369int ip_send_skb(struct sk_buff *skb) 1369int ip_send_skb(struct net *net, struct sk_buff *skb)
1370{ 1370{
1371 struct net *net = sock_net(skb->sk);
1372 int err; 1371 int err;
1373 1372
1374 err = ip_local_out(skb); 1373 err = ip_local_out(skb);
@@ -1391,7 +1390,7 @@ int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4)
1391 return 0; 1390 return 0;
1392 1391
1393 /* Netfilter gets whole the not fragmented skb. */ 1392 /* Netfilter gets whole the not fragmented skb. */
1394 return ip_send_skb(skb); 1393 return ip_send_skb(sock_net(sk), skb);
1395} 1394}
1396 1395
1397/* 1396/*
@@ -1536,6 +1535,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
1536 arg->csumoffset) = csum_fold(csum_add(nskb->csum, 1535 arg->csumoffset) = csum_fold(csum_add(nskb->csum,
1537 arg->csum)); 1536 arg->csum));
1538 nskb->ip_summed = CHECKSUM_NONE; 1537 nskb->ip_summed = CHECKSUM_NONE;
1538 skb_orphan(nskb);
1539 skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb)); 1539 skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb));
1540 ip_push_pending_frames(sk, &fl4); 1540 ip_push_pending_frames(sk, &fl4);
1541 } 1541 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index c035251beb07..e4ba974f143c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -70,7 +70,6 @@
70#include <linux/types.h> 70#include <linux/types.h>
71#include <linux/kernel.h> 71#include <linux/kernel.h>
72#include <linux/mm.h> 72#include <linux/mm.h>
73#include <linux/bootmem.h>
74#include <linux/string.h> 73#include <linux/string.h>
75#include <linux/socket.h> 74#include <linux/socket.h>
76#include <linux/sockios.h> 75#include <linux/sockios.h>
@@ -80,7 +79,6 @@
80#include <linux/netdevice.h> 79#include <linux/netdevice.h>
81#include <linux/proc_fs.h> 80#include <linux/proc_fs.h>
82#include <linux/init.h> 81#include <linux/init.h>
83#include <linux/workqueue.h>
84#include <linux/skbuff.h> 82#include <linux/skbuff.h>
85#include <linux/inetdevice.h> 83#include <linux/inetdevice.h>
86#include <linux/igmp.h> 84#include <linux/igmp.h>
@@ -88,11 +86,9 @@
88#include <linux/mroute.h> 86#include <linux/mroute.h>
89#include <linux/netfilter_ipv4.h> 87#include <linux/netfilter_ipv4.h>
90#include <linux/random.h> 88#include <linux/random.h>
91#include <linux/jhash.h>
92#include <linux/rcupdate.h> 89#include <linux/rcupdate.h>
93#include <linux/times.h> 90#include <linux/times.h>
94#include <linux/slab.h> 91#include <linux/slab.h>
95#include <linux/prefetch.h>
96#include <net/dst.h> 92#include <net/dst.h>
97#include <net/net_namespace.h> 93#include <net/net_namespace.h>
98#include <net/protocol.h> 94#include <net/protocol.h>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e7e6eeae49c0..2109ff4a1daf 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -811,7 +811,9 @@ static unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now,
811 old_size_goal + mss_now > xmit_size_goal)) { 811 old_size_goal + mss_now > xmit_size_goal)) {
812 xmit_size_goal = old_size_goal; 812 xmit_size_goal = old_size_goal;
813 } else { 813 } else {
814 tp->xmit_size_goal_segs = xmit_size_goal / mss_now; 814 tp->xmit_size_goal_segs =
815 min_t(u16, xmit_size_goal / mss_now,
816 sk->sk_gso_max_segs);
815 xmit_size_goal = tp->xmit_size_goal_segs * mss_now; 817 xmit_size_goal = tp->xmit_size_goal_segs * mss_now;
816 } 818 }
817 } 819 }
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 4d4db16e336e..1432cdb0644c 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -291,7 +291,8 @@ bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
291 left = tp->snd_cwnd - in_flight; 291 left = tp->snd_cwnd - in_flight;
292 if (sk_can_gso(sk) && 292 if (sk_can_gso(sk) &&
293 left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd && 293 left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd &&
294 left * tp->mss_cache < sk->sk_gso_max_size) 294 left * tp->mss_cache < sk->sk_gso_max_size &&
295 left < sk->sk_gso_max_segs)
295 return true; 296 return true;
296 return left <= tcp_max_tso_deferred_mss(tp); 297 return left <= tcp_max_tso_deferred_mss(tp);
297} 298}
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2fd2bc9e3c64..85308b90df80 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5392,6 +5392,8 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
5392{ 5392{
5393 struct tcp_sock *tp = tcp_sk(sk); 5393 struct tcp_sock *tp = tcp_sk(sk);
5394 5394
5395 if (unlikely(sk->sk_rx_dst == NULL))
5396 inet_csk(sk)->icsk_af_ops->sk_rx_dst_set(sk, skb);
5395 /* 5397 /*
5396 * Header prediction. 5398 * Header prediction.
5397 * The code loosely follows the one in the famous 5399 * The code loosely follows the one in the famous
@@ -5605,7 +5607,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
5605 tcp_set_state(sk, TCP_ESTABLISHED); 5607 tcp_set_state(sk, TCP_ESTABLISHED);
5606 5608
5607 if (skb != NULL) { 5609 if (skb != NULL) {
5608 inet_sk_rx_dst_set(sk, skb); 5610 icsk->icsk_af_ops->sk_rx_dst_set(sk, skb);
5609 security_inet_conn_established(sk, skb); 5611 security_inet_conn_established(sk, skb);
5610 } 5612 }
5611 5613
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 42b2a6a73092..767823764016 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1627,9 +1627,6 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
1627 sk->sk_rx_dst = NULL; 1627 sk->sk_rx_dst = NULL;
1628 } 1628 }
1629 } 1629 }
1630 if (unlikely(sk->sk_rx_dst == NULL))
1631 inet_sk_rx_dst_set(sk, skb);
1632
1633 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { 1630 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) {
1634 rsk = sk; 1631 rsk = sk;
1635 goto reset; 1632 goto reset;
@@ -1872,10 +1869,21 @@ static struct timewait_sock_ops tcp_timewait_sock_ops = {
1872 .twsk_destructor= tcp_twsk_destructor, 1869 .twsk_destructor= tcp_twsk_destructor,
1873}; 1870};
1874 1871
1872void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
1873{
1874 struct dst_entry *dst = skb_dst(skb);
1875
1876 dst_hold(dst);
1877 sk->sk_rx_dst = dst;
1878 inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
1879}
1880EXPORT_SYMBOL(inet_sk_rx_dst_set);
1881
1875const struct inet_connection_sock_af_ops ipv4_specific = { 1882const struct inet_connection_sock_af_ops ipv4_specific = {
1876 .queue_xmit = ip_queue_xmit, 1883 .queue_xmit = ip_queue_xmit,
1877 .send_check = tcp_v4_send_check, 1884 .send_check = tcp_v4_send_check,
1878 .rebuild_header = inet_sk_rebuild_header, 1885 .rebuild_header = inet_sk_rebuild_header,
1886 .sk_rx_dst_set = inet_sk_rx_dst_set,
1879 .conn_request = tcp_v4_conn_request, 1887 .conn_request = tcp_v4_conn_request,
1880 .syn_recv_sock = tcp_v4_syn_recv_sock, 1888 .syn_recv_sock = tcp_v4_syn_recv_sock,
1881 .net_header_len = sizeof(struct iphdr), 1889 .net_header_len = sizeof(struct iphdr),
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 2288a6399e1e..0abe67bb4d3a 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -731,6 +731,18 @@ static int __net_init tcp_net_metrics_init(struct net *net)
731 731
732static void __net_exit tcp_net_metrics_exit(struct net *net) 732static void __net_exit tcp_net_metrics_exit(struct net *net)
733{ 733{
734 unsigned int i;
735
736 for (i = 0; i < (1U << net->ipv4.tcp_metrics_hash_log) ; i++) {
737 struct tcp_metrics_block *tm, *next;
738
739 tm = rcu_dereference_protected(net->ipv4.tcp_metrics_hash[i].chain, 1);
740 while (tm) {
741 next = rcu_dereference_protected(tm->tcpm_next, 1);
742 kfree(tm);
743 tm = next;
744 }
745 }
734 kfree(net->ipv4.tcp_metrics_hash); 746 kfree(net->ipv4.tcp_metrics_hash);
735} 747}
736 748
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 232a90c3ec86..d9c9dcef2de3 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -387,7 +387,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
387 struct tcp_sock *oldtp = tcp_sk(sk); 387 struct tcp_sock *oldtp = tcp_sk(sk);
388 struct tcp_cookie_values *oldcvp = oldtp->cookie_values; 388 struct tcp_cookie_values *oldcvp = oldtp->cookie_values;
389 389
390 inet_sk_rx_dst_set(newsk, skb); 390 newicsk->icsk_af_ops->sk_rx_dst_set(newsk, skb);
391 391
392 /* TCP Cookie Transactions require space for the cookie pair, 392 /* TCP Cookie Transactions require space for the cookie pair,
393 * as it differs for each connection. There is no need to 393 * as it differs for each connection. There is no need to
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 3f1bcff0b10b..20dfd892c86f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -940,7 +940,7 @@ void __init tcp_tasklet_init(void)
940 * We cant xmit new skbs from this context, as we might already 940 * We cant xmit new skbs from this context, as we might already
941 * hold qdisc lock. 941 * hold qdisc lock.
942 */ 942 */
943void tcp_wfree(struct sk_buff *skb) 943static void tcp_wfree(struct sk_buff *skb)
944{ 944{
945 struct sock *sk = skb->sk; 945 struct sock *sk = skb->sk;
946 struct tcp_sock *tp = tcp_sk(sk); 946 struct tcp_sock *tp = tcp_sk(sk);
@@ -1522,21 +1522,21 @@ static void tcp_cwnd_validate(struct sock *sk)
1522 * when we would be allowed to send the split-due-to-Nagle skb fully. 1522 * when we would be allowed to send the split-due-to-Nagle skb fully.
1523 */ 1523 */
1524static unsigned int tcp_mss_split_point(const struct sock *sk, const struct sk_buff *skb, 1524static unsigned int tcp_mss_split_point(const struct sock *sk, const struct sk_buff *skb,
1525 unsigned int mss_now, unsigned int cwnd) 1525 unsigned int mss_now, unsigned int max_segs)
1526{ 1526{
1527 const struct tcp_sock *tp = tcp_sk(sk); 1527 const struct tcp_sock *tp = tcp_sk(sk);
1528 u32 needed, window, cwnd_len; 1528 u32 needed, window, max_len;
1529 1529
1530 window = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq; 1530 window = tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq;
1531 cwnd_len = mss_now * cwnd; 1531 max_len = mss_now * max_segs;
1532 1532
1533 if (likely(cwnd_len <= window && skb != tcp_write_queue_tail(sk))) 1533 if (likely(max_len <= window && skb != tcp_write_queue_tail(sk)))
1534 return cwnd_len; 1534 return max_len;
1535 1535
1536 needed = min(skb->len, window); 1536 needed = min(skb->len, window);
1537 1537
1538 if (cwnd_len <= needed) 1538 if (max_len <= needed)
1539 return cwnd_len; 1539 return max_len;
1540 1540
1541 return needed - needed % mss_now; 1541 return needed - needed % mss_now;
1542} 1542}
@@ -1765,7 +1765,8 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
1765 limit = min(send_win, cong_win); 1765 limit = min(send_win, cong_win);
1766 1766
1767 /* If a full-sized TSO skb can be sent, do it. */ 1767 /* If a full-sized TSO skb can be sent, do it. */
1768 if (limit >= sk->sk_gso_max_size) 1768 if (limit >= min_t(unsigned int, sk->sk_gso_max_size,
1769 sk->sk_gso_max_segs * tp->mss_cache))
1769 goto send_now; 1770 goto send_now;
1770 1771
1771 /* Middle in queue won't get any more data, full sendable already? */ 1772 /* Middle in queue won't get any more data, full sendable already? */
@@ -1999,7 +2000,9 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
1999 limit = mss_now; 2000 limit = mss_now;
2000 if (tso_segs > 1 && !tcp_urg_mode(tp)) 2001 if (tso_segs > 1 && !tcp_urg_mode(tp))
2001 limit = tcp_mss_split_point(sk, skb, mss_now, 2002 limit = tcp_mss_split_point(sk, skb, mss_now,
2002 cwnd_quota); 2003 min_t(unsigned int,
2004 cwnd_quota,
2005 sk->sk_gso_max_segs));
2003 2006
2004 if (skb->len > limit && 2007 if (skb->len > limit &&
2005 unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) 2008 unlikely(tso_fragment(sk, skb, limit, mss_now, gfp)))
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b4c3582a991f..6f6d1aca3c3d 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -758,7 +758,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4)
758 uh->check = CSUM_MANGLED_0; 758 uh->check = CSUM_MANGLED_0;
759 759
760send: 760send:
761 err = ip_send_skb(skb); 761 err = ip_send_skb(sock_net(sk), skb);
762 if (err) { 762 if (err) {
763 if (err == -ENOBUFS && !inet->recverr) { 763 if (err == -ENOBUFS && !inet->recverr) {
764 UDP_INC_STATS_USER(sock_net(sk), 764 UDP_INC_STATS_USER(sock_net(sk),
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index c66b90f71c9b..bb9ce2b2f377 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1447,7 +1447,17 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
1447 opt_skb = skb_clone(skb, sk_gfp_atomic(sk, GFP_ATOMIC)); 1447 opt_skb = skb_clone(skb, sk_gfp_atomic(sk, GFP_ATOMIC));
1448 1448
1449 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ 1449 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
1450 struct dst_entry *dst = sk->sk_rx_dst;
1451
1450 sock_rps_save_rxhash(sk, skb); 1452 sock_rps_save_rxhash(sk, skb);
1453 if (dst) {
1454 if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
1455 dst->ops->check(dst, np->rx_dst_cookie) == NULL) {
1456 dst_release(dst);
1457 sk->sk_rx_dst = NULL;
1458 }
1459 }
1460
1451 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) 1461 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len))
1452 goto reset; 1462 goto reset;
1453 if (opt_skb) 1463 if (opt_skb)
@@ -1705,9 +1715,9 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
1705 struct dst_entry *dst = sk->sk_rx_dst; 1715 struct dst_entry *dst = sk->sk_rx_dst;
1706 struct inet_sock *icsk = inet_sk(sk); 1716 struct inet_sock *icsk = inet_sk(sk);
1707 if (dst) 1717 if (dst)
1708 dst = dst_check(dst, 0); 1718 dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
1709 if (dst && 1719 if (dst &&
1710 icsk->rx_dst_ifindex == inet6_iif(skb)) 1720 icsk->rx_dst_ifindex == skb->skb_iif)
1711 skb_dst_set_noref(skb, dst); 1721 skb_dst_set_noref(skb, dst);
1712 } 1722 }
1713 } 1723 }
@@ -1719,10 +1729,23 @@ static struct timewait_sock_ops tcp6_timewait_sock_ops = {
1719 .twsk_destructor= tcp_twsk_destructor, 1729 .twsk_destructor= tcp_twsk_destructor,
1720}; 1730};
1721 1731
1732static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
1733{
1734 struct dst_entry *dst = skb_dst(skb);
1735 const struct rt6_info *rt = (const struct rt6_info *)dst;
1736
1737 dst_hold(dst);
1738 sk->sk_rx_dst = dst;
1739 inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
1740 if (rt->rt6i_node)
1741 inet6_sk(sk)->rx_dst_cookie = rt->rt6i_node->fn_sernum;
1742}
1743
1722static const struct inet_connection_sock_af_ops ipv6_specific = { 1744static const struct inet_connection_sock_af_ops ipv6_specific = {
1723 .queue_xmit = inet6_csk_xmit, 1745 .queue_xmit = inet6_csk_xmit,
1724 .send_check = tcp_v6_send_check, 1746 .send_check = tcp_v6_send_check,
1725 .rebuild_header = inet6_sk_rebuild_header, 1747 .rebuild_header = inet6_sk_rebuild_header,
1748 .sk_rx_dst_set = inet6_sk_rx_dst_set,
1726 .conn_request = tcp_v6_conn_request, 1749 .conn_request = tcp_v6_conn_request,
1727 .syn_recv_sock = tcp_v6_syn_recv_sock, 1750 .syn_recv_sock = tcp_v6_syn_recv_sock,
1728 .net_header_len = sizeof(struct ipv6hdr), 1751 .net_header_len = sizeof(struct ipv6hdr),
@@ -1754,6 +1777,7 @@ static const struct inet_connection_sock_af_ops ipv6_mapped = {
1754 .queue_xmit = ip_queue_xmit, 1777 .queue_xmit = ip_queue_xmit,
1755 .send_check = tcp_v4_send_check, 1778 .send_check = tcp_v4_send_check,
1756 .rebuild_header = inet_sk_rebuild_header, 1779 .rebuild_header = inet_sk_rebuild_header,
1780 .sk_rx_dst_set = inet_sk_rx_dst_set,
1757 .conn_request = tcp_v6_conn_request, 1781 .conn_request = tcp_v6_conn_request,
1758 .syn_recv_sock = tcp_v6_syn_recv_sock, 1782 .syn_recv_sock = tcp_v6_syn_recv_sock,
1759 .net_header_len = sizeof(struct iphdr), 1783 .net_header_len = sizeof(struct iphdr),
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c
index 39a8d8924b9c..6828e39ec2ec 100644
--- a/net/llc/llc_station.c
+++ b/net/llc/llc_station.c
@@ -268,7 +268,7 @@ static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb)
268out: 268out:
269 return rc; 269 return rc;
270free: 270free:
271 kfree_skb(skb); 271 kfree_skb(nskb);
272 goto out; 272 goto out;
273} 273}
274 274
@@ -293,7 +293,7 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb)
293out: 293out:
294 return rc; 294 return rc;
295free: 295free:
296 kfree_skb(skb); 296 kfree_skb(nskb);
297 goto out; 297 goto out;
298} 298}
299 299
@@ -322,7 +322,7 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb)
322out: 322out:
323 return rc; 323 return rc;
324free: 324free:
325 kfree_skb(skb); 325 kfree_skb(nskb);
326 goto out; 326 goto out;
327} 327}
328 328
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 6fac18c0423f..85572353a7e3 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -622,6 +622,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
622 622
623 del_timer_sync(&sdata->u.mesh.housekeeping_timer); 623 del_timer_sync(&sdata->u.mesh.housekeeping_timer);
624 del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); 624 del_timer_sync(&sdata->u.mesh.mesh_path_root_timer);
625 del_timer_sync(&sdata->u.mesh.mesh_path_timer);
625 /* 626 /*
626 * If the timer fired while we waited for it, it will have 627 * If the timer fired while we waited for it, it will have
627 * requeued the work. Now the work will be running again 628 * requeued the work. Now the work will be running again
@@ -634,6 +635,8 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
634 local->fif_other_bss--; 635 local->fif_other_bss--;
635 atomic_dec(&local->iff_allmultis); 636 atomic_dec(&local->iff_allmultis);
636 ieee80211_configure_filter(local); 637 ieee80211_configure_filter(local);
638
639 sdata->u.mesh.timers_running = 0;
637} 640}
638 641
639static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, 642static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index cef0c9e79aba..a4a5acdbaa4d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1430,6 +1430,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1430 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); 1430 del_timer_sync(&sdata->u.mgd.bcn_mon_timer);
1431 del_timer_sync(&sdata->u.mgd.timer); 1431 del_timer_sync(&sdata->u.mgd.timer);
1432 del_timer_sync(&sdata->u.mgd.chswitch_timer); 1432 del_timer_sync(&sdata->u.mgd.chswitch_timer);
1433
1434 sdata->u.mgd.timers_running = 0;
1433} 1435}
1434 1436
1435void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, 1437void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index bcaee5d12839..839dd9737989 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -299,7 +299,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
299 if (local->scan_req != local->int_scan_req) 299 if (local->scan_req != local->int_scan_req)
300 cfg80211_scan_done(local->scan_req, aborted); 300 cfg80211_scan_done(local->scan_req, aborted);
301 local->scan_req = NULL; 301 local->scan_req = NULL;
302 local->scan_sdata = NULL; 302 rcu_assign_pointer(local->scan_sdata, NULL);
303 303
304 local->scanning = 0; 304 local->scanning = 0;
305 local->scan_channel = NULL; 305 local->scan_channel = NULL;
@@ -984,7 +984,6 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata)
984 kfree(local->sched_scan_ies.ie[i]); 984 kfree(local->sched_scan_ies.ie[i]);
985 985
986 drv_sched_scan_stop(local, sdata); 986 drv_sched_scan_stop(local, sdata);
987 rcu_assign_pointer(local->sched_scan_sdata, NULL);
988 } 987 }
989out: 988out:
990 mutex_unlock(&local->mtx); 989 mutex_unlock(&local->mtx);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ceaca7c134a0..8ac890a1a4c0 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1079,7 +1079,7 @@ static void *packet_current_rx_frame(struct packet_sock *po,
1079 default: 1079 default:
1080 WARN(1, "TPACKET version not supported\n"); 1080 WARN(1, "TPACKET version not supported\n");
1081 BUG(); 1081 BUG();
1082 return 0; 1082 return NULL;
1083 } 1083 }
1084} 1084}
1085 1085
@@ -1936,7 +1936,6 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
1936 1936
1937 if (likely(po->tx_ring.pg_vec)) { 1937 if (likely(po->tx_ring.pg_vec)) {
1938 ph = skb_shinfo(skb)->destructor_arg; 1938 ph = skb_shinfo(skb)->destructor_arg;
1939 BUG_ON(__packet_get_status(po, ph) != TP_STATUS_SENDING);
1940 BUG_ON(atomic_read(&po->tx_ring.pending) == 0); 1939 BUG_ON(atomic_read(&po->tx_ring.pending) == 0);
1941 atomic_dec(&po->tx_ring.pending); 1940 atomic_dec(&po->tx_ring.pending);
1942 __packet_set_status(po, ph, TP_STATUS_AVAILABLE); 1941 __packet_set_status(po, ph, TP_STATUS_AVAILABLE);
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index f10fb8256442..05d60859d8e3 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -67,6 +67,9 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
67 struct tcf_common *pc; 67 struct tcf_common *pc;
68 int ret = 0; 68 int ret = 0;
69 int err; 69 int err;
70#ifdef CONFIG_GACT_PROB
71 struct tc_gact_p *p_parm = NULL;
72#endif
70 73
71 if (nla == NULL) 74 if (nla == NULL)
72 return -EINVAL; 75 return -EINVAL;
@@ -82,6 +85,12 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
82#ifndef CONFIG_GACT_PROB 85#ifndef CONFIG_GACT_PROB
83 if (tb[TCA_GACT_PROB] != NULL) 86 if (tb[TCA_GACT_PROB] != NULL)
84 return -EOPNOTSUPP; 87 return -EOPNOTSUPP;
88#else
89 if (tb[TCA_GACT_PROB]) {
90 p_parm = nla_data(tb[TCA_GACT_PROB]);
91 if (p_parm->ptype >= MAX_RAND)
92 return -EINVAL;
93 }
85#endif 94#endif
86 95
87 pc = tcf_hash_check(parm->index, a, bind, &gact_hash_info); 96 pc = tcf_hash_check(parm->index, a, bind, &gact_hash_info);
@@ -103,8 +112,7 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
103 spin_lock_bh(&gact->tcf_lock); 112 spin_lock_bh(&gact->tcf_lock);
104 gact->tcf_action = parm->action; 113 gact->tcf_action = parm->action;
105#ifdef CONFIG_GACT_PROB 114#ifdef CONFIG_GACT_PROB
106 if (tb[TCA_GACT_PROB] != NULL) { 115 if (p_parm) {
107 struct tc_gact_p *p_parm = nla_data(tb[TCA_GACT_PROB]);
108 gact->tcfg_paction = p_parm->paction; 116 gact->tcfg_paction = p_parm->paction;
109 gact->tcfg_pval = p_parm->pval; 117 gact->tcfg_pval = p_parm->pval;
110 gact->tcfg_ptype = p_parm->ptype; 118 gact->tcfg_ptype = p_parm->ptype;
@@ -133,7 +141,7 @@ static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
133 141
134 spin_lock(&gact->tcf_lock); 142 spin_lock(&gact->tcf_lock);
135#ifdef CONFIG_GACT_PROB 143#ifdef CONFIG_GACT_PROB
136 if (gact->tcfg_ptype && gact_rand[gact->tcfg_ptype] != NULL) 144 if (gact->tcfg_ptype)
137 action = gact_rand[gact->tcfg_ptype](gact); 145 action = gact_rand[gact->tcfg_ptype](gact);
138 else 146 else
139 action = gact->tcf_action; 147 action = gact->tcf_action;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 60e281ad0f07..58fb3c7aab9e 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -185,7 +185,12 @@ err3:
185err2: 185err2:
186 kfree(tname); 186 kfree(tname);
187err1: 187err1:
188 kfree(pc); 188 if (ret == ACT_P_CREATED) {
189 if (est)
190 gen_kill_estimator(&pc->tcfc_bstats,
191 &pc->tcfc_rate_est);
192 kfree_rcu(pc, tcfc_rcu);
193 }
189 return err; 194 return err;
190} 195}
191 196
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 26aa2f6ce257..45c53ab067a6 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -74,7 +74,10 @@ static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est,
74 p = to_pedit(pc); 74 p = to_pedit(pc);
75 keys = kmalloc(ksize, GFP_KERNEL); 75 keys = kmalloc(ksize, GFP_KERNEL);
76 if (keys == NULL) { 76 if (keys == NULL) {
77 kfree(pc); 77 if (est)
78 gen_kill_estimator(&pc->tcfc_bstats,
79 &pc->tcfc_rate_est);
80 kfree_rcu(pc, tcfc_rcu);
78 return -ENOMEM; 81 return -ENOMEM;
79 } 82 }
80 ret = ACT_P_CREATED; 83 ret = ACT_P_CREATED;
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 3922f2a2821b..3714f60f0b3c 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -131,7 +131,10 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
131 d = to_defact(pc); 131 d = to_defact(pc);
132 ret = alloc_defdata(d, defdata); 132 ret = alloc_defdata(d, defdata);
133 if (ret < 0) { 133 if (ret < 0) {
134 kfree(pc); 134 if (est)
135 gen_kill_estimator(&pc->tcfc_bstats,
136 &pc->tcfc_rate_est);
137 kfree_rcu(pc, tcfc_rcu);
135 return ret; 138 return ret;
136 } 139 }
137 d->tcf_action = parm->action; 140 d->tcf_action = parm->action;
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index 9af01f3df18c..e4723d31fdd5 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -203,6 +203,34 @@ out:
203 return index; 203 return index;
204} 204}
205 205
206/* Length of the next packet (0 if the queue is empty). */
207static unsigned int qdisc_peek_len(struct Qdisc *sch)
208{
209 struct sk_buff *skb;
210
211 skb = sch->ops->peek(sch);
212 return skb ? qdisc_pkt_len(skb) : 0;
213}
214
215static void qfq_deactivate_class(struct qfq_sched *, struct qfq_class *);
216static void qfq_activate_class(struct qfq_sched *q, struct qfq_class *cl,
217 unsigned int len);
218
219static void qfq_update_class_params(struct qfq_sched *q, struct qfq_class *cl,
220 u32 lmax, u32 inv_w, int delta_w)
221{
222 int i;
223
224 /* update qfq-specific data */
225 cl->lmax = lmax;
226 cl->inv_w = inv_w;
227 i = qfq_calc_index(cl->inv_w, cl->lmax);
228
229 cl->grp = &q->groups[i];
230
231 q->wsum += delta_w;
232}
233
206static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, 234static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
207 struct nlattr **tca, unsigned long *arg) 235 struct nlattr **tca, unsigned long *arg)
208{ 236{
@@ -250,6 +278,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
250 lmax = 1UL << QFQ_MTU_SHIFT; 278 lmax = 1UL << QFQ_MTU_SHIFT;
251 279
252 if (cl != NULL) { 280 if (cl != NULL) {
281 bool need_reactivation = false;
282
253 if (tca[TCA_RATE]) { 283 if (tca[TCA_RATE]) {
254 err = gen_replace_estimator(&cl->bstats, &cl->rate_est, 284 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
255 qdisc_root_sleeping_lock(sch), 285 qdisc_root_sleeping_lock(sch),
@@ -258,12 +288,29 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
258 return err; 288 return err;
259 } 289 }
260 290
261 if (inv_w != cl->inv_w) { 291 if (lmax == cl->lmax && inv_w == cl->inv_w)
262 sch_tree_lock(sch); 292 return 0; /* nothing to update */
263 q->wsum += delta_w; 293
264 cl->inv_w = inv_w; 294 i = qfq_calc_index(inv_w, lmax);
265 sch_tree_unlock(sch); 295 sch_tree_lock(sch);
296 if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {
297 /*
298 * shift cl->F back, to not charge the
299 * class for the not-yet-served head
300 * packet
301 */
302 cl->F = cl->S;
303 /* remove class from its slot in the old group */
304 qfq_deactivate_class(q, cl);
305 need_reactivation = true;
266 } 306 }
307
308 qfq_update_class_params(q, cl, lmax, inv_w, delta_w);
309
310 if (need_reactivation) /* activate in new group */
311 qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));
312 sch_tree_unlock(sch);
313
267 return 0; 314 return 0;
268 } 315 }
269 316
@@ -273,11 +320,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
273 320
274 cl->refcnt = 1; 321 cl->refcnt = 1;
275 cl->common.classid = classid; 322 cl->common.classid = classid;
276 cl->lmax = lmax;
277 cl->inv_w = inv_w;
278 i = qfq_calc_index(cl->inv_w, cl->lmax);
279 323
280 cl->grp = &q->groups[i]; 324 qfq_update_class_params(q, cl, lmax, inv_w, delta_w);
281 325
282 cl->qdisc = qdisc_create_dflt(sch->dev_queue, 326 cl->qdisc = qdisc_create_dflt(sch->dev_queue,
283 &pfifo_qdisc_ops, classid); 327 &pfifo_qdisc_ops, classid);
@@ -294,7 +338,6 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
294 return err; 338 return err;
295 } 339 }
296 } 340 }
297 q->wsum += weight;
298 341
299 sch_tree_lock(sch); 342 sch_tree_lock(sch);
300 qdisc_class_hash_insert(&q->clhash, &cl->common); 343 qdisc_class_hash_insert(&q->clhash, &cl->common);
@@ -711,15 +754,6 @@ static void qfq_update_eligible(struct qfq_sched *q, u64 old_V)
711 } 754 }
712} 755}
713 756
714/* What is length of next packet in queue (0 if queue is empty) */
715static unsigned int qdisc_peek_len(struct Qdisc *sch)
716{
717 struct sk_buff *skb;
718
719 skb = sch->ops->peek(sch);
720 return skb ? qdisc_pkt_len(skb) : 0;
721}
722
723/* 757/*
724 * Updates the class, returns true if also the group needs to be updated. 758 * Updates the class, returns true if also the group needs to be updated.
725 */ 759 */
@@ -843,11 +877,8 @@ static void qfq_update_start(struct qfq_sched *q, struct qfq_class *cl)
843static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) 877static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
844{ 878{
845 struct qfq_sched *q = qdisc_priv(sch); 879 struct qfq_sched *q = qdisc_priv(sch);
846 struct qfq_group *grp;
847 struct qfq_class *cl; 880 struct qfq_class *cl;
848 int err; 881 int err;
849 u64 roundedS;
850 int s;
851 882
852 cl = qfq_classify(skb, sch, &err); 883 cl = qfq_classify(skb, sch, &err);
853 if (cl == NULL) { 884 if (cl == NULL) {
@@ -876,11 +907,25 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
876 return err; 907 return err;
877 908
878 /* If reach this point, queue q was idle */ 909 /* If reach this point, queue q was idle */
879 grp = cl->grp; 910 qfq_activate_class(q, cl, qdisc_pkt_len(skb));
911
912 return err;
913}
914
915/*
916 * Handle class switch from idle to backlogged.
917 */
918static void qfq_activate_class(struct qfq_sched *q, struct qfq_class *cl,
919 unsigned int pkt_len)
920{
921 struct qfq_group *grp = cl->grp;
922 u64 roundedS;
923 int s;
924
880 qfq_update_start(q, cl); 925 qfq_update_start(q, cl);
881 926
882 /* compute new finish time and rounded start. */ 927 /* compute new finish time and rounded start. */
883 cl->F = cl->S + (u64)qdisc_pkt_len(skb) * cl->inv_w; 928 cl->F = cl->S + (u64)pkt_len * cl->inv_w;
884 roundedS = qfq_round_down(cl->S, grp->slot_shift); 929 roundedS = qfq_round_down(cl->S, grp->slot_shift);
885 930
886 /* 931 /*
@@ -917,8 +962,6 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
917 962
918skip_update: 963skip_update:
919 qfq_slot_insert(grp, cl, roundedS); 964 qfq_slot_insert(grp, cl, roundedS);
920
921 return err;
922} 965}
923 966
924 967
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 31b40cc4a9c3..dcd64d5b07aa 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -952,6 +952,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
952 */ 952 */
953 synchronize_rcu(); 953 synchronize_rcu();
954 INIT_LIST_HEAD(&wdev->list); 954 INIT_LIST_HEAD(&wdev->list);
955 /*
956 * Ensure that all events have been processed and
957 * freed.
958 */
959 cfg80211_process_wdev_events(wdev);
955 break; 960 break;
956 case NETDEV_PRE_UP: 961 case NETDEV_PRE_UP:
957 if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) 962 if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 5206c6844fd7..bc7430b54771 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -426,6 +426,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
426 struct net_device *dev, enum nl80211_iftype ntype, 426 struct net_device *dev, enum nl80211_iftype ntype,
427 u32 *flags, struct vif_params *params); 427 u32 *flags, struct vif_params *params);
428void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev); 428void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev);
429void cfg80211_process_wdev_events(struct wireless_dev *wdev);
429 430
430int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev, 431int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
431 struct wireless_dev *wdev, 432 struct wireless_dev *wdev,
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2303ee73b50a..2ded3c7fad06 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -680,6 +680,8 @@ static u32 map_regdom_flags(u32 rd_flags)
680 channel_flags |= IEEE80211_CHAN_NO_IBSS; 680 channel_flags |= IEEE80211_CHAN_NO_IBSS;
681 if (rd_flags & NL80211_RRF_DFS) 681 if (rd_flags & NL80211_RRF_DFS)
682 channel_flags |= IEEE80211_CHAN_RADAR; 682 channel_flags |= IEEE80211_CHAN_RADAR;
683 if (rd_flags & NL80211_RRF_NO_OFDM)
684 channel_flags |= IEEE80211_CHAN_NO_OFDM;
683 return channel_flags; 685 return channel_flags;
684} 686}
685 687
@@ -901,7 +903,21 @@ static void handle_channel(struct wiphy *wiphy,
901 chan->max_antenna_gain = min(chan->orig_mag, 903 chan->max_antenna_gain = min(chan->orig_mag,
902 (int) MBI_TO_DBI(power_rule->max_antenna_gain)); 904 (int) MBI_TO_DBI(power_rule->max_antenna_gain));
903 chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); 905 chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
904 chan->max_power = min(chan->max_power, chan->max_reg_power); 906 if (chan->orig_mpwr) {
907 /*
908 * Devices that have their own custom regulatory domain
909 * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
910 * passed country IE power settings.
911 */
912 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
913 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
914 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
915 chan->max_power = chan->max_reg_power;
916 else
917 chan->max_power = min(chan->orig_mpwr,
918 chan->max_reg_power);
919 } else
920 chan->max_power = chan->max_reg_power;
905} 921}
906 922
907static void handle_band(struct wiphy *wiphy, 923static void handle_band(struct wiphy *wiphy,
@@ -1885,6 +1901,7 @@ static void restore_custom_reg_settings(struct wiphy *wiphy)
1885 chan->flags = chan->orig_flags; 1901 chan->flags = chan->orig_flags;
1886 chan->max_antenna_gain = chan->orig_mag; 1902 chan->max_antenna_gain = chan->orig_mag;
1887 chan->max_power = chan->orig_mpwr; 1903 chan->max_power = chan->orig_mpwr;
1904 chan->beacon_found = false;
1888 } 1905 }
1889 } 1906 }
1890} 1907}
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 26f8cd30f712..994e2f0cc7a8 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -735,7 +735,7 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
735 wdev->connect_keys = NULL; 735 wdev->connect_keys = NULL;
736} 736}
737 737
738static void cfg80211_process_wdev_events(struct wireless_dev *wdev) 738void cfg80211_process_wdev_events(struct wireless_dev *wdev)
739{ 739{
740 struct cfg80211_event *ev; 740 struct cfg80211_event *ev;
741 unsigned long flags; 741 unsigned long flags;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 5b228f97d4b3..87cd0e4d4282 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -415,8 +415,17 @@ static enum hrtimer_restart xfrm_timer_handler(struct hrtimer * me)
415 if (x->lft.hard_add_expires_seconds) { 415 if (x->lft.hard_add_expires_seconds) {
416 long tmo = x->lft.hard_add_expires_seconds + 416 long tmo = x->lft.hard_add_expires_seconds +
417 x->curlft.add_time - now; 417 x->curlft.add_time - now;
418 if (tmo <= 0) 418 if (tmo <= 0) {
419 goto expired; 419 if (x->xflags & XFRM_SOFT_EXPIRE) {
420 /* enter hard expire without soft expire first?!
421 * setting a new date could trigger this.
422 * workarbound: fix x->curflt.add_time by below:
423 */
424 x->curlft.add_time = now - x->saved_tmo - 1;
425 tmo = x->lft.hard_add_expires_seconds - x->saved_tmo;
426 } else
427 goto expired;
428 }
420 if (tmo < next) 429 if (tmo < next)
421 next = tmo; 430 next = tmo;
422 } 431 }
@@ -433,10 +442,14 @@ static enum hrtimer_restart xfrm_timer_handler(struct hrtimer * me)
433 if (x->lft.soft_add_expires_seconds) { 442 if (x->lft.soft_add_expires_seconds) {
434 long tmo = x->lft.soft_add_expires_seconds + 443 long tmo = x->lft.soft_add_expires_seconds +
435 x->curlft.add_time - now; 444 x->curlft.add_time - now;
436 if (tmo <= 0) 445 if (tmo <= 0) {
437 warn = 1; 446 warn = 1;
438 else if (tmo < next) 447 x->xflags &= ~XFRM_SOFT_EXPIRE;
448 } else if (tmo < next) {
439 next = tmo; 449 next = tmo;
450 x->xflags |= XFRM_SOFT_EXPIRE;
451 x->saved_tmo = tmo;
452 }
440 } 453 }
441 if (x->lft.soft_use_expires_seconds) { 454 if (x->lft.soft_use_expires_seconds) {
442 long tmo = x->lft.soft_use_expires_seconds + 455 long tmo = x->lft.soft_use_expires_seconds +
diff --git a/scripts/decodecode b/scripts/decodecode
index 18ba881c3415..4f8248d5a11f 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -89,7 +89,7 @@ echo $code >> $T.s
89disas $T 89disas $T
90cat $T.dis >> $T.aa 90cat $T.dis >> $T.aa
91 91
92faultline=`cat $T.dis | head -1 | cut -d":" -f2` 92faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
93faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` 93faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
94 94
95cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" 95cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g"
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 9b0c0b8b4ab4..8fd107a3fac4 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1786,6 +1786,7 @@ sub dump_function($$) {
1786 $prototype =~ s/__init +//; 1786 $prototype =~ s/__init +//;
1787 $prototype =~ s/__init_or_module +//; 1787 $prototype =~ s/__init_or_module +//;
1788 $prototype =~ s/__must_check +//; 1788 $prototype =~ s/__must_check +//;
1789 $prototype =~ s/__weak +//;
1789 $prototype =~ s/^#\s*define\s+//; #ak added 1790 $prototype =~ s/^#\s*define\s+//; #ak added
1790 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; 1791 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
1791 1792
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index 83554ee8a587..0cc99a3ea42d 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -279,12 +279,46 @@ static int yama_ptrace_access_check(struct task_struct *child,
279 } 279 }
280 280
281 if (rc) { 281 if (rc) {
282 char name[sizeof(current->comm)];
283 printk_ratelimited(KERN_NOTICE 282 printk_ratelimited(KERN_NOTICE
284 "ptrace of pid %d was attempted by: %s (pid %d)\n", 283 "ptrace of pid %d was attempted by: %s (pid %d)\n",
285 child->pid, 284 child->pid, current->comm, current->pid);
286 get_task_comm(name, current), 285 }
287 current->pid); 286
287 return rc;
288}
289
290/**
291 * yama_ptrace_traceme - validate PTRACE_TRACEME calls
292 * @parent: task that will become the ptracer of the current task
293 *
294 * Returns 0 if following the ptrace is allowed, -ve on error.
295 */
296static int yama_ptrace_traceme(struct task_struct *parent)
297{
298 int rc;
299
300 /* If standard caps disallows it, so does Yama. We should
301 * only tighten restrictions further.
302 */
303 rc = cap_ptrace_traceme(parent);
304 if (rc)
305 return rc;
306
307 /* Only disallow PTRACE_TRACEME on more aggressive settings. */
308 switch (ptrace_scope) {
309 case YAMA_SCOPE_CAPABILITY:
310 if (!ns_capable(task_user_ns(parent), CAP_SYS_PTRACE))
311 rc = -EPERM;
312 break;
313 case YAMA_SCOPE_NO_ATTACH:
314 rc = -EPERM;
315 break;
316 }
317
318 if (rc) {
319 printk_ratelimited(KERN_NOTICE
320 "ptraceme of pid %d was attempted by: %s (pid %d)\n",
321 current->pid, parent->comm, parent->pid);
288 } 322 }
289 323
290 return rc; 324 return rc;
@@ -294,6 +328,7 @@ static struct security_operations yama_ops = {
294 .name = "yama", 328 .name = "yama",
295 329
296 .ptrace_access_check = yama_ptrace_access_check, 330 .ptrace_access_check = yama_ptrace_access_check,
331 .ptrace_traceme = yama_ptrace_traceme,
297 .task_prctl = yama_task_prctl, 332 .task_prctl = yama_task_prctl,
298 .task_free = yama_task_free, 333 .task_free = yama_task_free,
299}; 334};
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index 4e7ec2b49873..d0f00356fc11 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -101,7 +101,7 @@ void *snd_malloc_sgbuf_pages(struct device *device,
101 if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, device, 101 if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, device,
102 chunk, &tmpb) < 0) { 102 chunk, &tmpb) < 0) {
103 if (!sgbuf->pages) 103 if (!sgbuf->pages)
104 return NULL; 104 goto _failed;
105 if (!res_size) 105 if (!res_size)
106 goto _failed; 106 goto _failed;
107 size = sgbuf->pages * PAGE_SIZE; 107 size = sgbuf->pages * PAGE_SIZE;
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c
index 4f502a2bdc3c..0a436626182b 100644
--- a/sound/pci/emu10k1/memory.c
+++ b/sound/pci/emu10k1/memory.c
@@ -326,7 +326,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
326 for (page = blk->first_page; page <= blk->last_page; page++, idx++) { 326 for (page = blk->first_page; page <= blk->last_page; page++, idx++) {
327 unsigned long ofs = idx << PAGE_SHIFT; 327 unsigned long ofs = idx << PAGE_SHIFT;
328 dma_addr_t addr; 328 dma_addr_t addr;
329 addr = snd_pcm_sgbuf_get_addr(substream, ofs); 329 if (ofs >= runtime->dma_bytes)
330 addr = emu->silent_page.addr;
331 else
332 addr = snd_pcm_sgbuf_get_addr(substream, ofs);
330 if (! is_valid_page(emu, addr)) { 333 if (! is_valid_page(emu, addr)) {
331 printk(KERN_ERR "emu: failure page = %d\n", idx); 334 printk(KERN_ERR "emu: failure page = %d\n", idx);
332 mutex_unlock(&hdr->block_mutex); 335 mutex_unlock(&hdr->block_mutex);
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 647218d69f68..4f7d2dfcef7b 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -332,13 +332,12 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
332 if (cfg->dig_outs) 332 if (cfg->dig_outs)
333 snd_printd(" dig-out=0x%x/0x%x\n", 333 snd_printd(" dig-out=0x%x/0x%x\n",
334 cfg->dig_out_pins[0], cfg->dig_out_pins[1]); 334 cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
335 snd_printd(" inputs:"); 335 snd_printd(" inputs:\n");
336 for (i = 0; i < cfg->num_inputs; i++) { 336 for (i = 0; i < cfg->num_inputs; i++) {
337 snd_printd(" %s=0x%x", 337 snd_printd(" %s=0x%x\n",
338 hda_get_autocfg_input_label(codec, cfg, i), 338 hda_get_autocfg_input_label(codec, cfg, i),
339 cfg->inputs[i].pin); 339 cfg->inputs[i].pin);
340 } 340 }
341 snd_printd("\n");
342 if (cfg->dig_in_pin) 341 if (cfg->dig_in_pin)
343 snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin); 342 snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin);
344 343
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 14361184ae1e..5e22a8f43d2e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -2967,12 +2967,10 @@ static const char * const cxt5066_models[CXT5066_MODELS] = {
2967}; 2967};
2968 2968
2969static const struct snd_pci_quirk cxt5066_cfg_tbl[] = { 2969static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
2970 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT5066_AUTO),
2971 SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD), 2970 SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD),
2972 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO), 2971 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO),
2973 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD), 2972 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD),
2974 SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), 2973 SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO),
2975 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
2976 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), 2974 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
2977 SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD), 2975 SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD),
2978 SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD), 2976 SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD),
@@ -2988,14 +2986,10 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
2988 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), 2986 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD),
2989 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), 2987 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
2990 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), 2988 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
2991 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T510", CXT5066_AUTO),
2992 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520 & W520", CXT5066_AUTO),
2993 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD), 2989 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD),
2994 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD), 2990 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD),
2995 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo U350", CXT5066_ASUS), 2991 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo U350", CXT5066_ASUS),
2996 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), 2992 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS),
2997 SND_PCI_QUIRK(0x17aa, 0x3938, "Lenovo G565", CXT5066_AUTO),
2998 SND_PCI_QUIRK(0x1b0a, 0x2092, "CyberpowerPC Gamer Xplorer N57001", CXT5066_AUTO),
2999 {} 2993 {}
3000}; 2994};
3001 2995
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 69b928449789..8f23374fa642 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -877,8 +877,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
877 struct hdmi_eld *eld; 877 struct hdmi_eld *eld;
878 struct hdmi_spec_per_cvt *per_cvt = NULL; 878 struct hdmi_spec_per_cvt *per_cvt = NULL;
879 879
880 hinfo->nid = 0; /* clear the leftover value */
881
882 /* Validate hinfo */ 880 /* Validate hinfo */
883 pin_idx = hinfo_to_pin_index(spec, hinfo); 881 pin_idx = hinfo_to_pin_index(spec, hinfo);
884 if (snd_BUG_ON(pin_idx < 0)) 882 if (snd_BUG_ON(pin_idx < 0))
@@ -1163,6 +1161,14 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1163 return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); 1161 return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
1164} 1162}
1165 1163
1164static int generic_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
1165 struct hda_codec *codec,
1166 struct snd_pcm_substream *substream)
1167{
1168 snd_hda_codec_cleanup_stream(codec, hinfo->nid);
1169 return 0;
1170}
1171
1166static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, 1172static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1167 struct hda_codec *codec, 1173 struct hda_codec *codec,
1168 struct snd_pcm_substream *substream) 1174 struct snd_pcm_substream *substream)
@@ -1202,6 +1208,7 @@ static const struct hda_pcm_ops generic_ops = {
1202 .open = hdmi_pcm_open, 1208 .open = hdmi_pcm_open,
1203 .close = hdmi_pcm_close, 1209 .close = hdmi_pcm_close,
1204 .prepare = generic_hdmi_playback_pcm_prepare, 1210 .prepare = generic_hdmi_playback_pcm_prepare,
1211 .cleanup = generic_hdmi_playback_pcm_cleanup,
1205}; 1212};
1206 1213
1207static int generic_hdmi_build_pcms(struct hda_codec *codec) 1214static int generic_hdmi_build_pcms(struct hda_codec *codec)
@@ -1220,7 +1227,6 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
1220 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; 1227 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK];
1221 pstr->substreams = 1; 1228 pstr->substreams = 1;
1222 pstr->ops = generic_ops; 1229 pstr->ops = generic_ops;
1223 pstr->nid = 1; /* FIXME: just for avoiding a debug WARNING */
1224 /* other pstr fields are set in open */ 1230 /* other pstr fields are set in open */
1225 } 1231 }
1226 1232
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 344b221d2102..4f81dd44c837 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6099,6 +6099,8 @@ static const struct alc_fixup alc269_fixups[] = {
6099 [ALC269_FIXUP_PCM_44K] = { 6099 [ALC269_FIXUP_PCM_44K] = {
6100 .type = ALC_FIXUP_FUNC, 6100 .type = ALC_FIXUP_FUNC,
6101 .v.func = alc269_fixup_pcm_44k, 6101 .v.func = alc269_fixup_pcm_44k,
6102 .chained = true,
6103 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6102 }, 6104 },
6103 [ALC269_FIXUP_STEREO_DMIC] = { 6105 [ALC269_FIXUP_STEREO_DMIC] = {
6104 .type = ALC_FIXUP_FUNC, 6106 .type = ALC_FIXUP_FUNC,
@@ -6206,9 +6208,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6206 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), 6208 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6207 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), 6209 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6208 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), 6210 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
6211 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
6212 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
6213 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
6209 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), 6214 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
6210 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_QUANTA_MUTE), 6215 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
6211 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K),
6212 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 6216 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
6213 6217
6214#if 0 6218#if 0
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index 3c795921c5f6..23b40186f9b8 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2406,6 +2406,10 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
2406 2406
2407 /* Setup AB8500 according to board-settings */ 2407 /* Setup AB8500 according to board-settings */
2408 pdata = (struct ab8500_platform_data *)dev_get_platdata(dev->parent); 2408 pdata = (struct ab8500_platform_data *)dev_get_platdata(dev->parent);
2409
2410 /* Inform SoC Core that we have our own I/O arrangements. */
2411 codec->control_data = (void *)true;
2412
2409 status = ab8500_audio_setup_mics(codec, &pdata->codec->amics); 2413 status = ab8500_audio_setup_mics(codec, &pdata->codec->amics);
2410 if (status < 0) { 2414 if (status < 0) {
2411 pr_err("%s: Failed to setup mics (%d)!\n", __func__, status); 2415 pr_err("%s: Failed to setup mics (%d)!\n", __func__, status);
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
index 8c39dddd7d00..11b1b714b8b5 100644
--- a/sound/soc/codecs/ad1980.c
+++ b/sound/soc/codecs/ad1980.c
@@ -186,6 +186,7 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec)
186 186
187 printk(KERN_INFO "AD1980 SoC Audio Codec\n"); 187 printk(KERN_INFO "AD1980 SoC Audio Codec\n");
188 188
189 codec->control_data = codec; /* we don't use regmap! */
189 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); 190 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
190 if (ret < 0) { 191 if (ret < 0) {
191 printk(KERN_ERR "ad1980: failed to register AC97 codec\n"); 192 printk(KERN_ERR "ad1980: failed to register AC97 codec\n");
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 6276e352125f..8f726c063f42 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -581,6 +581,8 @@ static int mc13783_probe(struct snd_soc_codec *codec)
581{ 581{
582 struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); 582 struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec);
583 583
584 codec->control_data = priv->mc13xxx;
585
584 mc13xxx_lock(priv->mc13xxx); 586 mc13xxx_lock(priv->mc13xxx);
585 587
586 /* these are the reset values */ 588 /* these are the reset values */
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 8af6a5245b18..df2f99d1d428 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -239,6 +239,7 @@ static const struct snd_soc_dapm_route sgtl5000_dapm_routes[] = {
239 {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ 239 {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */
240 {"LO", NULL, "DAC"}, /* dac --> line_out */ 240 {"LO", NULL, "DAC"}, /* dac --> line_out */
241 241
242 {"LINE_IN", NULL, "VAG_POWER"},
242 {"Headphone Mux", "LINE_IN", "LINE_IN"},/* line_in --> hp_mux */ 243 {"Headphone Mux", "LINE_IN", "LINE_IN"},/* line_in --> hp_mux */
243 {"HP", NULL, "Headphone Mux"}, /* hp_mux --> hp */ 244 {"HP", NULL, "Headphone Mux"}, /* hp_mux --> hp */
244 245
@@ -1357,8 +1358,6 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1357 if (ret) 1358 if (ret)
1358 goto err; 1359 goto err;
1359 1360
1360 snd_soc_dapm_new_widgets(&codec->dapm);
1361
1362 return 0; 1361 return 0;
1363 1362
1364err: 1363err:
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 982e437799a8..33c0f3d39c87 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -340,6 +340,7 @@ static int stac9766_codec_probe(struct snd_soc_codec *codec)
340 340
341 printk(KERN_INFO "STAC9766 SoC Audio Codec %s\n", STAC9766_VERSION); 341 printk(KERN_INFO "STAC9766 SoC Audio Codec %s\n", STAC9766_VERSION);
342 342
343 codec->control_data = codec; /* we don't use regmap! */
343 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); 344 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
344 if (ret < 0) 345 if (ret < 0)
345 goto codec_err; 346 goto codec_err;
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index eaf65863ec21..aa9ce9dd7d8a 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2501,6 +2501,9 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
2501 /* VMID 2*250k */ 2501 /* VMID 2*250k */
2502 snd_soc_update_bits(codec, WM8962_PWR_MGMT_1, 2502 snd_soc_update_bits(codec, WM8962_PWR_MGMT_1,
2503 WM8962_VMID_SEL_MASK, 0x100); 2503 WM8962_VMID_SEL_MASK, 0x100);
2504
2505 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
2506 msleep(100);
2504 break; 2507 break;
2505 2508
2506 case SND_SOC_BIAS_OFF: 2509 case SND_SOC_BIAS_OFF:
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index bb62f4b3d563..04ef03175c51 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -2649,7 +2649,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
2649 return -EINVAL; 2649 return -EINVAL;
2650 } 2650 }
2651 2651
2652 bclk_rate = params_rate(params) * 2; 2652 bclk_rate = params_rate(params) * 4;
2653 switch (params_format(params)) { 2653 switch (params_format(params)) {
2654 case SNDRV_PCM_FORMAT_S16_LE: 2654 case SNDRV_PCM_FORMAT_S16_LE:
2655 bclk_rate *= 16; 2655 bclk_rate *= 16;
@@ -3253,10 +3253,13 @@ static void wm8994_mic_work(struct work_struct *work)
3253 int ret; 3253 int ret;
3254 int report; 3254 int report;
3255 3255
3256 pm_runtime_get_sync(dev);
3257
3256 ret = regmap_read(regmap, WM8994_INTERRUPT_RAW_STATUS_2, &reg); 3258 ret = regmap_read(regmap, WM8994_INTERRUPT_RAW_STATUS_2, &reg);
3257 if (ret < 0) { 3259 if (ret < 0) {
3258 dev_err(dev, "Failed to read microphone status: %d\n", 3260 dev_err(dev, "Failed to read microphone status: %d\n",
3259 ret); 3261 ret);
3262 pm_runtime_put(dev);
3260 return; 3263 return;
3261 } 3264 }
3262 3265
@@ -3299,6 +3302,8 @@ static void wm8994_mic_work(struct work_struct *work)
3299 3302
3300 snd_soc_jack_report(priv->micdet[1].jack, report, 3303 snd_soc_jack_report(priv->micdet[1].jack, report,
3301 SND_JACK_HEADSET | SND_JACK_BTN_0); 3304 SND_JACK_HEADSET | SND_JACK_BTN_0);
3305
3306 pm_runtime_put(dev);
3302} 3307}
3303 3308
3304static irqreturn_t wm8994_mic_irq(int irq, void *data) 3309static irqreturn_t wm8994_mic_irq(int irq, void *data)
@@ -3421,12 +3426,15 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3421 int reg; 3426 int reg;
3422 bool present; 3427 bool present;
3423 3428
3429 pm_runtime_get_sync(codec->dev);
3430
3424 mutex_lock(&wm8994->accdet_lock); 3431 mutex_lock(&wm8994->accdet_lock);
3425 3432
3426 reg = snd_soc_read(codec, WM1811_JACKDET_CTRL); 3433 reg = snd_soc_read(codec, WM1811_JACKDET_CTRL);
3427 if (reg < 0) { 3434 if (reg < 0) {
3428 dev_err(codec->dev, "Failed to read jack status: %d\n", reg); 3435 dev_err(codec->dev, "Failed to read jack status: %d\n", reg);
3429 mutex_unlock(&wm8994->accdet_lock); 3436 mutex_unlock(&wm8994->accdet_lock);
3437 pm_runtime_put(codec->dev);
3430 return IRQ_NONE; 3438 return IRQ_NONE;
3431 } 3439 }
3432 3440
@@ -3491,6 +3499,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3491 SND_JACK_MECHANICAL | SND_JACK_HEADSET | 3499 SND_JACK_MECHANICAL | SND_JACK_HEADSET |
3492 wm8994->btn_mask); 3500 wm8994->btn_mask);
3493 3501
3502 pm_runtime_put(codec->dev);
3494 return IRQ_HANDLED; 3503 return IRQ_HANDLED;
3495} 3504}
3496 3505
@@ -3602,6 +3611,8 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3602 if (!(snd_soc_read(codec, WM8958_MIC_DETECT_1) & WM8958_MICD_ENA)) 3611 if (!(snd_soc_read(codec, WM8958_MIC_DETECT_1) & WM8958_MICD_ENA))
3603 return IRQ_HANDLED; 3612 return IRQ_HANDLED;
3604 3613
3614 pm_runtime_get_sync(codec->dev);
3615
3605 /* We may occasionally read a detection without an impedence 3616 /* We may occasionally read a detection without an impedence
3606 * range being provided - if that happens loop again. 3617 * range being provided - if that happens loop again.
3607 */ 3618 */
@@ -3612,6 +3623,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3612 dev_err(codec->dev, 3623 dev_err(codec->dev,
3613 "Failed to read mic detect status: %d\n", 3624 "Failed to read mic detect status: %d\n",
3614 reg); 3625 reg);
3626 pm_runtime_put(codec->dev);
3615 return IRQ_NONE; 3627 return IRQ_NONE;
3616 } 3628 }
3617 3629
@@ -3639,6 +3651,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3639 dev_warn(codec->dev, "Accessory detection with no callback\n"); 3651 dev_warn(codec->dev, "Accessory detection with no callback\n");
3640 3652
3641out: 3653out:
3654 pm_runtime_put(codec->dev);
3642 return IRQ_HANDLED; 3655 return IRQ_HANDLED;
3643} 3656}
3644 3657
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 099e6ec32125..f16fb361a4eb 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -619,6 +619,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec)
619{ 619{
620 int ret = 0; 620 int ret = 0;
621 621
622 codec->control_data = codec; /* we don't use regmap! */
622 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); 623 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
623 if (ret < 0) { 624 if (ret < 0) {
624 printk(KERN_ERR "wm9712: failed to register AC97 codec\n"); 625 printk(KERN_ERR "wm9712: failed to register AC97 codec\n");
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 3eb19fb71d17..d0b8a3287a85 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1196,6 +1196,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
1196 if (wm9713 == NULL) 1196 if (wm9713 == NULL)
1197 return -ENOMEM; 1197 return -ENOMEM;
1198 snd_soc_codec_set_drvdata(codec, wm9713); 1198 snd_soc_codec_set_drvdata(codec, wm9713);
1199 codec->control_data = wm9713; /* we don't use regmap! */
1199 1200
1200 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); 1201 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
1201 if (ret < 0) 1202 if (ret < 0)
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index aba71bfa33b1..b3030718c228 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -394,9 +394,14 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
394 struct snd_soc_dai *cpu_dai) 394 struct snd_soc_dai *cpu_dai)
395{ 395{
396 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); 396 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
397 struct mxs_saif *master_saif;
397 u32 scr, stat; 398 u32 scr, stat;
398 int ret; 399 int ret;
399 400
401 master_saif = mxs_saif_get_master(saif);
402 if (!master_saif)
403 return -EINVAL;
404
400 /* mclk should already be set */ 405 /* mclk should already be set */
401 if (!saif->mclk && saif->mclk_in_use) { 406 if (!saif->mclk && saif->mclk_in_use) {
402 dev_err(cpu_dai->dev, "set mclk first\n"); 407 dev_err(cpu_dai->dev, "set mclk first\n");
@@ -420,6 +425,25 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
420 return ret; 425 return ret;
421 } 426 }
422 427
428 /* prepare clk in hw_param, enable in trigger */
429 clk_prepare(saif->clk);
430 if (saif != master_saif) {
431 /*
432 * Set an initial clock rate for the saif internal logic to work
433 * properly. This is important when working in EXTMASTER mode
434 * that uses the other saif's BITCLK&LRCLK but it still needs a
435 * basic clock which should be fast enough for the internal
436 * logic.
437 */
438 clk_enable(saif->clk);
439 ret = clk_set_rate(saif->clk, 24000000);
440 clk_disable(saif->clk);
441 if (ret)
442 return ret;
443
444 clk_prepare(master_saif->clk);
445 }
446
423 scr = __raw_readl(saif->base + SAIF_CTRL); 447 scr = __raw_readl(saif->base + SAIF_CTRL);
424 448
425 scr &= ~BM_SAIF_CTRL_WORD_LENGTH; 449 scr &= ~BM_SAIF_CTRL_WORD_LENGTH;
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 1046083e90a0..acdd3ef14e08 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -820,3 +820,4 @@ module_platform_driver(asoc_mcbsp_driver);
820MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); 820MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>");
821MODULE_DESCRIPTION("OMAP I2S SoC Interface"); 821MODULE_DESCRIPTION("OMAP I2S SoC Interface");
822MODULE_LICENSE("GPL"); 822MODULE_LICENSE("GPL");
823MODULE_ALIAS("platform:omap-mcbsp");
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 5a649da9122a..f0feb06615f8 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -441,3 +441,4 @@ module_platform_driver(omap_pcm_driver);
441MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); 441MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>");
442MODULE_DESCRIPTION("OMAP PCM DMA module"); 442MODULE_DESCRIPTION("OMAP PCM DMA module");
443MODULE_LICENSE("GPL"); 443MODULE_LICENSE("GPL");
444MODULE_ALIAS("platform:omap-pcm-audio");
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f219b2f7ee68..f81c5976b961 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1096,7 +1096,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
1096 } 1096 }
1097 1097
1098 /* If the driver didn't set I/O up try regmap */ 1098 /* If the driver didn't set I/O up try regmap */
1099 if (!codec->control_data) 1099 if (!codec->write && dev_get_regmap(codec->dev, NULL))
1100 snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); 1100 snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
1101 1101
1102 if (driver->controls) 1102 if (driver->controls)
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c
index d684df294c0c..e463529b38bb 100644
--- a/sound/soc/tegra/tegra_alc5632.c
+++ b/sound/soc/tegra/tegra_alc5632.c
@@ -177,7 +177,7 @@ static __devinit int tegra_alc5632_probe(struct platform_device *pdev)
177 } 177 }
178 178
179 alc5632->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); 179 alc5632->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0);
180 if (alc5632->gpio_hp_det == -ENODEV) 180 if (alc5632->gpio_hp_det == -EPROBE_DEFER)
181 return -EPROBE_DEFER; 181 return -EPROBE_DEFER;
182 182
183 ret = snd_soc_of_parse_card_name(card, "nvidia,model"); 183 ret = snd_soc_of_parse_card_name(card, "nvidia,model");
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 0c5bb33d258e..d4f14e492341 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -284,27 +284,27 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
284 } else if (np) { 284 } else if (np) {
285 pdata->gpio_spkr_en = of_get_named_gpio(np, 285 pdata->gpio_spkr_en = of_get_named_gpio(np,
286 "nvidia,spkr-en-gpios", 0); 286 "nvidia,spkr-en-gpios", 0);
287 if (pdata->gpio_spkr_en == -ENODEV) 287 if (pdata->gpio_spkr_en == -EPROBE_DEFER)
288 return -EPROBE_DEFER; 288 return -EPROBE_DEFER;
289 289
290 pdata->gpio_hp_mute = of_get_named_gpio(np, 290 pdata->gpio_hp_mute = of_get_named_gpio(np,
291 "nvidia,hp-mute-gpios", 0); 291 "nvidia,hp-mute-gpios", 0);
292 if (pdata->gpio_hp_mute == -ENODEV) 292 if (pdata->gpio_hp_mute == -EPROBE_DEFER)
293 return -EPROBE_DEFER; 293 return -EPROBE_DEFER;
294 294
295 pdata->gpio_hp_det = of_get_named_gpio(np, 295 pdata->gpio_hp_det = of_get_named_gpio(np,
296 "nvidia,hp-det-gpios", 0); 296 "nvidia,hp-det-gpios", 0);
297 if (pdata->gpio_hp_det == -ENODEV) 297 if (pdata->gpio_hp_det == -EPROBE_DEFER)
298 return -EPROBE_DEFER; 298 return -EPROBE_DEFER;
299 299
300 pdata->gpio_int_mic_en = of_get_named_gpio(np, 300 pdata->gpio_int_mic_en = of_get_named_gpio(np,
301 "nvidia,int-mic-en-gpios", 0); 301 "nvidia,int-mic-en-gpios", 0);
302 if (pdata->gpio_int_mic_en == -ENODEV) 302 if (pdata->gpio_int_mic_en == -EPROBE_DEFER)
303 return -EPROBE_DEFER; 303 return -EPROBE_DEFER;
304 304
305 pdata->gpio_ext_mic_en = of_get_named_gpio(np, 305 pdata->gpio_ext_mic_en = of_get_named_gpio(np,
306 "nvidia,ext-mic-en-gpios", 0); 306 "nvidia,ext-mic-en-gpios", 0);
307 if (pdata->gpio_ext_mic_en == -ENODEV) 307 if (pdata->gpio_ext_mic_en == -EPROBE_DEFER)
308 return -EPROBE_DEFER; 308 return -EPROBE_DEFER;
309 } 309 }
310 310
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 62ac0285bfaf..057e28ef770e 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -21,7 +21,7 @@
21#include <linux/mfd/dbx500-prcmu.h> 21#include <linux/mfd/dbx500-prcmu.h>
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/board-mop500-msp.h> 24#include <mach/msp.h>
25 25
26#include <sound/soc.h> 26#include <sound/soc.h>
27#include <sound/soc-dai.h> 27#include <sound/soc-dai.h>
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index ee14d2dac2f5..5c472f335a64 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -19,7 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20 20
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/board-mop500-msp.h> 22#include <mach/msp.h>
23 23
24#include <sound/soc.h> 24#include <sound/soc.h>
25 25
diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h
index 7f71b4a0d4bc..2d9136da9865 100644
--- a/sound/soc/ux500/ux500_msp_i2s.h
+++ b/sound/soc/ux500/ux500_msp_i2s.h
@@ -17,7 +17,7 @@
17 17
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <mach/board-mop500-msp.h> 20#include <mach/msp.h>
21 21
22#define MSP_INPUT_FREQ_APB 48000000 22#define MSP_INPUT_FREQ_APB 48000000
23 23
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 77f124fe57ad..35655c3a7b7a 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -319,6 +319,8 @@ LIB_H += $(ARCH_INCLUDE)
319LIB_H += util/cgroup.h 319LIB_H += util/cgroup.h
320LIB_H += $(TRACE_EVENT_DIR)event-parse.h 320LIB_H += $(TRACE_EVENT_DIR)event-parse.h
321LIB_H += util/target.h 321LIB_H += util/target.h
322LIB_H += util/rblist.h
323LIB_H += util/intlist.h
322 324
323LIB_OBJS += $(OUTPUT)util/abspath.o 325LIB_OBJS += $(OUTPUT)util/abspath.o
324LIB_OBJS += $(OUTPUT)util/alias.o 326LIB_OBJS += $(OUTPUT)util/alias.o
@@ -383,6 +385,8 @@ LIB_OBJS += $(OUTPUT)util/xyarray.o
383LIB_OBJS += $(OUTPUT)util/cpumap.o 385LIB_OBJS += $(OUTPUT)util/cpumap.o
384LIB_OBJS += $(OUTPUT)util/cgroup.o 386LIB_OBJS += $(OUTPUT)util/cgroup.o
385LIB_OBJS += $(OUTPUT)util/target.o 387LIB_OBJS += $(OUTPUT)util/target.o
388LIB_OBJS += $(OUTPUT)util/rblist.o
389LIB_OBJS += $(OUTPUT)util/intlist.o
386 390
387BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o 391BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
388 392
@@ -983,7 +987,8 @@ clean:
983 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* 987 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
984 $(MAKE) -C Documentation/ clean 988 $(MAKE) -C Documentation/ clean
985 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS 989 $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
986 $(RM) $(OUTPUT)util/*-{bison,flex}* 990 $(RM) $(OUTPUT)util/*-bison*
991 $(RM) $(OUTPUT)util/*-flex*
987 $(python-clean) 992 $(python-clean)
988 993
989.PHONY: all install clean strip $(LIBTRACEEVENT) 994.PHONY: all install clean strip $(LIBTRACEEVENT)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f5a6452931e6..4db6e1ba54e3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -313,7 +313,7 @@ try_again:
313 } 313 }
314 } 314 }
315 315
316 perf_session__update_sample_type(session); 316 perf_session__set_id_hdr_size(session);
317} 317}
318 318
319static int process_buildids(struct perf_record *rec) 319static int process_buildids(struct perf_record *rec)
@@ -844,8 +844,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
844 struct perf_record *rec = &record; 844 struct perf_record *rec = &record;
845 char errbuf[BUFSIZ]; 845 char errbuf[BUFSIZ];
846 846
847 perf_header__set_cmdline(argc, argv);
848
849 evsel_list = perf_evlist__new(NULL, NULL); 847 evsel_list = perf_evlist__new(NULL, NULL);
850 if (evsel_list == NULL) 848 if (evsel_list == NULL)
851 return -ENOMEM; 849 return -ENOMEM;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 69b1c1185159..7c88a243b5db 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -249,8 +249,9 @@ static int process_read_event(struct perf_tool *tool,
249static int perf_report__setup_sample_type(struct perf_report *rep) 249static int perf_report__setup_sample_type(struct perf_report *rep)
250{ 250{
251 struct perf_session *self = rep->session; 251 struct perf_session *self = rep->session;
252 u64 sample_type = perf_evlist__sample_type(self->evlist);
252 253
253 if (!self->fd_pipe && !(self->sample_type & PERF_SAMPLE_CALLCHAIN)) { 254 if (!self->fd_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
254 if (sort__has_parent) { 255 if (sort__has_parent) {
255 ui__error("Selected --sort parent, but no " 256 ui__error("Selected --sort parent, but no "
256 "callchain data. Did you call " 257 "callchain data. Did you call "
@@ -274,7 +275,7 @@ static int perf_report__setup_sample_type(struct perf_report *rep)
274 275
275 if (sort__branch_mode == 1) { 276 if (sort__branch_mode == 1) {
276 if (!self->fd_pipe && 277 if (!self->fd_pipe &&
277 !(self->sample_type & PERF_SAMPLE_BRANCH_STACK)) { 278 !(sample_type & PERF_SAMPLE_BRANCH_STACK)) {
278 ui__error("Selected -b but no branch data. " 279 ui__error("Selected -b but no branch data. "
279 "Did you call perf record without -b?\n"); 280 "Did you call perf record without -b?\n");
280 return -1; 281 return -1;
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index d909eb74a0eb..1d592f5cbea9 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -478,7 +478,6 @@ static int test__basic_mmap(void)
478 unsigned int nr_events[nsyscalls], 478 unsigned int nr_events[nsyscalls],
479 expected_nr_events[nsyscalls], i, j; 479 expected_nr_events[nsyscalls], i, j;
480 struct perf_evsel *evsels[nsyscalls], *evsel; 480 struct perf_evsel *evsels[nsyscalls], *evsel;
481 int sample_size = __perf_evsel__sample_size(attr.sample_type);
482 481
483 for (i = 0; i < nsyscalls; ++i) { 482 for (i = 0; i < nsyscalls; ++i) {
484 char name[64]; 483 char name[64];
@@ -563,8 +562,7 @@ static int test__basic_mmap(void)
563 goto out_munmap; 562 goto out_munmap;
564 } 563 }
565 564
566 err = perf_event__parse_sample(event, attr.sample_type, sample_size, 565 err = perf_evlist__parse_sample(evlist, event, &sample, false);
567 false, &sample, false);
568 if (err) { 566 if (err) {
569 pr_err("Can't parse sample, err = %d\n", err); 567 pr_err("Can't parse sample, err = %d\n", err);
570 goto out_munmap; 568 goto out_munmap;
@@ -661,12 +659,12 @@ static int test__PERF_RECORD(void)
661 const char *cmd = "sleep"; 659 const char *cmd = "sleep";
662 const char *argv[] = { cmd, "1", NULL, }; 660 const char *argv[] = { cmd, "1", NULL, };
663 char *bname; 661 char *bname;
664 u64 sample_type, prev_time = 0; 662 u64 prev_time = 0;
665 bool found_cmd_mmap = false, 663 bool found_cmd_mmap = false,
666 found_libc_mmap = false, 664 found_libc_mmap = false,
667 found_vdso_mmap = false, 665 found_vdso_mmap = false,
668 found_ld_mmap = false; 666 found_ld_mmap = false;
669 int err = -1, errs = 0, i, wakeups = 0, sample_size; 667 int err = -1, errs = 0, i, wakeups = 0;
670 u32 cpu; 668 u32 cpu;
671 int total_events = 0, nr_events[PERF_RECORD_MAX] = { 0, }; 669 int total_events = 0, nr_events[PERF_RECORD_MAX] = { 0, };
672 670
@@ -757,13 +755,6 @@ static int test__PERF_RECORD(void)
757 } 755 }
758 756
759 /* 757 /*
760 * We'll need these two to parse the PERF_SAMPLE_* fields in each
761 * event.
762 */
763 sample_type = perf_evlist__sample_type(evlist);
764 sample_size = __perf_evsel__sample_size(sample_type);
765
766 /*
767 * Now that all is properly set up, enable the events, they will 758 * Now that all is properly set up, enable the events, they will
768 * count just on workload.pid, which will start... 759 * count just on workload.pid, which will start...
769 */ 760 */
@@ -788,9 +779,7 @@ static int test__PERF_RECORD(void)
788 if (type < PERF_RECORD_MAX) 779 if (type < PERF_RECORD_MAX)
789 nr_events[type]++; 780 nr_events[type]++;
790 781
791 err = perf_event__parse_sample(event, sample_type, 782 err = perf_evlist__parse_sample(evlist, event, &sample, false);
792 sample_size, true,
793 &sample, false);
794 if (err < 0) { 783 if (err < 0) {
795 if (verbose) 784 if (verbose)
796 perf_event__fprintf(event, stderr); 785 perf_event__fprintf(event, stderr);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 35e86c6df713..68cd61ef6ac5 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -38,6 +38,7 @@
38#include "util/cpumap.h" 38#include "util/cpumap.h"
39#include "util/xyarray.h" 39#include "util/xyarray.h"
40#include "util/sort.h" 40#include "util/sort.h"
41#include "util/intlist.h"
41 42
42#include "util/debug.h" 43#include "util/debug.h"
43 44
@@ -706,8 +707,16 @@ static void perf_event__process_sample(struct perf_tool *tool,
706 int err; 707 int err;
707 708
708 if (!machine && perf_guest) { 709 if (!machine && perf_guest) {
709 pr_err("Can't find guest [%d]'s kernel information\n", 710 static struct intlist *seen;
710 event->ip.pid); 711
712 if (!seen)
713 seen = intlist__new();
714
715 if (!intlist__has_entry(seen, event->ip.pid)) {
716 pr_err("Can't find guest [%d]'s kernel information\n",
717 event->ip.pid);
718 intlist__add(seen, event->ip.pid);
719 }
711 return; 720 return;
712 } 721 }
713 722
@@ -811,7 +820,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
811 int ret; 820 int ret;
812 821
813 while ((event = perf_evlist__mmap_read(top->evlist, idx)) != NULL) { 822 while ((event = perf_evlist__mmap_read(top->evlist, idx)) != NULL) {
814 ret = perf_session__parse_sample(session, event, &sample); 823 ret = perf_evlist__parse_sample(top->evlist, event, &sample, false);
815 if (ret) { 824 if (ret) {
816 pr_err("Can't parse sample, err = %d\n", ret); 825 pr_err("Can't parse sample, err = %d\n", ret);
817 continue; 826 continue;
@@ -943,8 +952,10 @@ try_again:
943 * based cpu-clock-tick sw counter, which 952 * based cpu-clock-tick sw counter, which
944 * is always available even if no PMU support: 953 * is always available even if no PMU support:
945 */ 954 */
946 if (attr->type == PERF_TYPE_HARDWARE && 955 if ((err == ENOENT || err == ENXIO) &&
947 attr->config == PERF_COUNT_HW_CPU_CYCLES) { 956 (attr->type == PERF_TYPE_HARDWARE) &&
957 (attr->config == PERF_COUNT_HW_CPU_CYCLES)) {
958
948 if (verbose) 959 if (verbose)
949 ui__warning("Cycles event not supported,\n" 960 ui__warning("Cycles event not supported,\n"
950 "trying to fall back to cpu-clock-ticks\n"); 961 "trying to fall back to cpu-clock-ticks\n");
@@ -1032,7 +1043,7 @@ static int __cmd_top(struct perf_top *top)
1032 &top->session->host_machine); 1043 &top->session->host_machine);
1033 perf_top__start_counters(top); 1044 perf_top__start_counters(top);
1034 top->session->evlist = top->evlist; 1045 top->session->evlist = top->evlist;
1035 perf_session__update_sample_type(top->session); 1046 perf_session__set_id_hdr_size(top->session);
1036 1047
1037 /* Wait for a minimal set of events before starting the snapshot */ 1048 /* Wait for a minimal set of events before starting the snapshot */
1038 poll(top->evlist->pollfd, top->evlist->nr_fds, 100); 1049 poll(top->evlist->pollfd, top->evlist->nr_fds, 100);
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 1b197280c621..d84870b06426 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -197,9 +197,6 @@ int perf_event__preprocess_sample(const union perf_event *self,
197 197
198const char *perf_event__name(unsigned int id); 198const char *perf_event__name(unsigned int id);
199 199
200int perf_event__parse_sample(const union perf_event *event, u64 type,
201 int sample_size, bool sample_id_all,
202 struct perf_sample *sample, bool swapped);
203int perf_event__synthesize_sample(union perf_event *event, u64 type, 200int perf_event__synthesize_sample(union perf_event *event, u64 type,
204 const struct perf_sample *sample, 201 const struct perf_sample *sample,
205 bool swapped); 202 bool swapped);
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 3edfd3483816..9b38681add9e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -881,3 +881,10 @@ int perf_evlist__start_workload(struct perf_evlist *evlist)
881 881
882 return 0; 882 return 0;
883} 883}
884
885int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event,
886 struct perf_sample *sample, bool swapped)
887{
888 struct perf_evsel *e = list_entry(evlist->entries.next, struct perf_evsel, node);
889 return perf_evsel__parse_sample(e, event, sample, swapped);
890}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 40d4d3cdced0..528c1acd9298 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -122,6 +122,9 @@ u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
122bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist); 122bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
123u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist); 123u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist);
124 124
125int perf_evlist__parse_sample(struct perf_evlist *evlist, union perf_event *event,
126 struct perf_sample *sample, bool swapped);
127
125bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist); 128bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
126bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist); 129bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
127 130
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e81771364867..2eaae140def2 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -20,7 +20,7 @@
20#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) 20#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
21#define GROUP_FD(group_fd, cpu) (*(int *)xyarray__entry(group_fd, cpu, 0)) 21#define GROUP_FD(group_fd, cpu) (*(int *)xyarray__entry(group_fd, cpu, 0))
22 22
23int __perf_evsel__sample_size(u64 sample_type) 23static int __perf_evsel__sample_size(u64 sample_type)
24{ 24{
25 u64 mask = sample_type & PERF_SAMPLE_MASK; 25 u64 mask = sample_type & PERF_SAMPLE_MASK;
26 int size = 0; 26 int size = 0;
@@ -53,6 +53,7 @@ void perf_evsel__init(struct perf_evsel *evsel,
53 evsel->attr = *attr; 53 evsel->attr = *attr;
54 INIT_LIST_HEAD(&evsel->node); 54 INIT_LIST_HEAD(&evsel->node);
55 hists__init(&evsel->hists); 55 hists__init(&evsel->hists);
56 evsel->sample_size = __perf_evsel__sample_size(attr->sample_type);
56} 57}
57 58
58struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx) 59struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx)
@@ -728,10 +729,10 @@ static bool sample_overlap(const union perf_event *event,
728 return false; 729 return false;
729} 730}
730 731
731int perf_event__parse_sample(const union perf_event *event, u64 type, 732int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
732 int sample_size, bool sample_id_all,
733 struct perf_sample *data, bool swapped) 733 struct perf_sample *data, bool swapped)
734{ 734{
735 u64 type = evsel->attr.sample_type;
735 const u64 *array; 736 const u64 *array;
736 737
737 /* 738 /*
@@ -746,14 +747,14 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
746 data->period = 1; 747 data->period = 1;
747 748
748 if (event->header.type != PERF_RECORD_SAMPLE) { 749 if (event->header.type != PERF_RECORD_SAMPLE) {
749 if (!sample_id_all) 750 if (!evsel->attr.sample_id_all)
750 return 0; 751 return 0;
751 return perf_event__parse_id_sample(event, type, data, swapped); 752 return perf_event__parse_id_sample(event, type, data, swapped);
752 } 753 }
753 754
754 array = event->sample.array; 755 array = event->sample.array;
755 756
756 if (sample_size + sizeof(event->header) > event->header.size) 757 if (evsel->sample_size + sizeof(event->header) > event->header.size)
757 return -EFAULT; 758 return -EFAULT;
758 759
759 if (type & PERF_SAMPLE_IP) { 760 if (type & PERF_SAMPLE_IP) {
@@ -895,7 +896,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
895 u.val32[1] = sample->tid; 896 u.val32[1] = sample->tid;
896 if (swapped) { 897 if (swapped) {
897 /* 898 /*
898 * Inverse of what is done in perf_event__parse_sample 899 * Inverse of what is done in perf_evsel__parse_sample
899 */ 900 */
900 u.val32[0] = bswap_32(u.val32[0]); 901 u.val32[0] = bswap_32(u.val32[0]);
901 u.val32[1] = bswap_32(u.val32[1]); 902 u.val32[1] = bswap_32(u.val32[1]);
@@ -930,7 +931,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
930 u.val32[0] = sample->cpu; 931 u.val32[0] = sample->cpu;
931 if (swapped) { 932 if (swapped) {
932 /* 933 /*
933 * Inverse of what is done in perf_event__parse_sample 934 * Inverse of what is done in perf_evsel__parse_sample
934 */ 935 */
935 u.val32[0] = bswap_32(u.val32[0]); 936 u.val32[0] = bswap_32(u.val32[0]);
936 u.val64 = bswap_64(u.val64); 937 u.val64 = bswap_64(u.val64);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 67cc5033d192..b559929983bb 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -65,6 +65,7 @@ struct perf_evsel {
65 void *func; 65 void *func;
66 void *data; 66 void *data;
67 } handler; 67 } handler;
68 unsigned int sample_size;
68 bool supported; 69 bool supported;
69}; 70};
70 71
@@ -177,13 +178,8 @@ static inline int perf_evsel__read_scaled(struct perf_evsel *evsel,
177 return __perf_evsel__read(evsel, ncpus, nthreads, true); 178 return __perf_evsel__read(evsel, ncpus, nthreads, true);
178} 179}
179 180
180int __perf_evsel__sample_size(u64 sample_type);
181
182static inline int perf_evsel__sample_size(struct perf_evsel *evsel)
183{
184 return __perf_evsel__sample_size(evsel->attr.sample_type);
185}
186
187void hists__init(struct hists *hists); 181void hists__init(struct hists *hists);
188 182
183int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
184 struct perf_sample *sample, bool swapped);
189#endif /* __PERF_EVSEL_H */ 185#endif /* __PERF_EVSEL_H */
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 3a6d20443330..74ea3c2f8138 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -174,6 +174,15 @@ perf_header__set_cmdline(int argc, const char **argv)
174{ 174{
175 int i; 175 int i;
176 176
177 /*
178 * If header_argv has already been set, do not override it.
179 * This allows a command to set the cmdline, parse args and
180 * then call another builtin function that implements a
181 * command -- e.g, cmd_kvm calling cmd_record.
182 */
183 if (header_argv)
184 return 0;
185
177 header_argc = (u32)argc; 186 header_argc = (u32)argc;
178 187
179 /* do not include NULL termination */ 188 /* do not include NULL termination */
diff --git a/tools/perf/util/intlist.c b/tools/perf/util/intlist.c
new file mode 100644
index 000000000000..fd530dced9cb
--- /dev/null
+++ b/tools/perf/util/intlist.c
@@ -0,0 +1,101 @@
1/*
2 * Based on intlist.c by:
3 * (c) 2009 Arnaldo Carvalho de Melo <acme@redhat.com>
4 *
5 * Licensed under the GPLv2.
6 */
7
8#include <errno.h>
9#include <stdlib.h>
10#include <linux/compiler.h>
11
12#include "intlist.h"
13
14static struct rb_node *intlist__node_new(struct rblist *rblist __used,
15 const void *entry)
16{
17 int i = (int)((long)entry);
18 struct rb_node *rc = NULL;
19 struct int_node *node = malloc(sizeof(*node));
20
21 if (node != NULL) {
22 node->i = i;
23 rc = &node->rb_node;
24 }
25
26 return rc;
27}
28
29static void int_node__delete(struct int_node *ilist)
30{
31 free(ilist);
32}
33
34static void intlist__node_delete(struct rblist *rblist __used,
35 struct rb_node *rb_node)
36{
37 struct int_node *node = container_of(rb_node, struct int_node, rb_node);
38
39 int_node__delete(node);
40}
41
42static int intlist__node_cmp(struct rb_node *rb_node, const void *entry)
43{
44 int i = (int)((long)entry);
45 struct int_node *node = container_of(rb_node, struct int_node, rb_node);
46
47 return node->i - i;
48}
49
50int intlist__add(struct intlist *ilist, int i)
51{
52 return rblist__add_node(&ilist->rblist, (void *)((long)i));
53}
54
55void intlist__remove(struct intlist *ilist __used, struct int_node *node)
56{
57 int_node__delete(node);
58}
59
60struct int_node *intlist__find(struct intlist *ilist, int i)
61{
62 struct int_node *node = NULL;
63 struct rb_node *rb_node = rblist__find(&ilist->rblist, (void *)((long)i));
64
65 if (rb_node)
66 node = container_of(rb_node, struct int_node, rb_node);
67
68 return node;
69}
70
71struct intlist *intlist__new(void)
72{
73 struct intlist *ilist = malloc(sizeof(*ilist));
74
75 if (ilist != NULL) {
76 rblist__init(&ilist->rblist);
77 ilist->rblist.node_cmp = intlist__node_cmp;
78 ilist->rblist.node_new = intlist__node_new;
79 ilist->rblist.node_delete = intlist__node_delete;
80 }
81
82 return ilist;
83}
84
85void intlist__delete(struct intlist *ilist)
86{
87 if (ilist != NULL)
88 rblist__delete(&ilist->rblist);
89}
90
91struct int_node *intlist__entry(const struct intlist *ilist, unsigned int idx)
92{
93 struct int_node *node = NULL;
94 struct rb_node *rb_node;
95
96 rb_node = rblist__entry(&ilist->rblist, idx);
97 if (rb_node)
98 node = container_of(rb_node, struct int_node, rb_node);
99
100 return node;
101}
diff --git a/tools/perf/util/intlist.h b/tools/perf/util/intlist.h
new file mode 100644
index 000000000000..6d63ab90db50
--- /dev/null
+++ b/tools/perf/util/intlist.h
@@ -0,0 +1,75 @@
1#ifndef __PERF_INTLIST_H
2#define __PERF_INTLIST_H
3
4#include <linux/rbtree.h>
5#include <stdbool.h>
6
7#include "rblist.h"
8
9struct int_node {
10 struct rb_node rb_node;
11 int i;
12};
13
14struct intlist {
15 struct rblist rblist;
16};
17
18struct intlist *intlist__new(void);
19void intlist__delete(struct intlist *ilist);
20
21void intlist__remove(struct intlist *ilist, struct int_node *in);
22int intlist__add(struct intlist *ilist, int i);
23
24struct int_node *intlist__entry(const struct intlist *ilist, unsigned int idx);
25struct int_node *intlist__find(struct intlist *ilist, int i);
26
27static inline bool intlist__has_entry(struct intlist *ilist, int i)
28{
29 return intlist__find(ilist, i) != NULL;
30}
31
32static inline bool intlist__empty(const struct intlist *ilist)
33{
34 return rblist__empty(&ilist->rblist);
35}
36
37static inline unsigned int intlist__nr_entries(const struct intlist *ilist)
38{
39 return rblist__nr_entries(&ilist->rblist);
40}
41
42/* For intlist iteration */
43static inline struct int_node *intlist__first(struct intlist *ilist)
44{
45 struct rb_node *rn = rb_first(&ilist->rblist.entries);
46 return rn ? rb_entry(rn, struct int_node, rb_node) : NULL;
47}
48static inline struct int_node *intlist__next(struct int_node *in)
49{
50 struct rb_node *rn;
51 if (!in)
52 return NULL;
53 rn = rb_next(&in->rb_node);
54 return rn ? rb_entry(rn, struct int_node, rb_node) : NULL;
55}
56
57/**
58 * intlist_for_each - iterate over a intlist
59 * @pos: the &struct int_node to use as a loop cursor.
60 * @ilist: the &struct intlist for loop.
61 */
62#define intlist__for_each(pos, ilist) \
63 for (pos = intlist__first(ilist); pos; pos = intlist__next(pos))
64
65/**
66 * intlist_for_each_safe - iterate over a intlist safe against removal of
67 * int_node
68 * @pos: the &struct int_node to use as a loop cursor.
69 * @n: another &struct int_node to use as temporary storage.
70 * @ilist: the &struct intlist for loop.
71 */
72#define intlist__for_each_safe(pos, n, ilist) \
73 for (pos = intlist__first(ilist), n = intlist__next(pos); pos;\
74 pos = n, n = intlist__next(n))
75#endif /* __PERF_INTLIST_H */
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c
index 1b997d2b89ce..127d648cc548 100644
--- a/tools/perf/util/parse-events-test.c
+++ b/tools/perf/util/parse-events-test.c
@@ -13,6 +13,9 @@ do { \
13 } \ 13 } \
14} while (0) 14} while (0)
15 15
16#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
17 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
18
16static int test__checkevent_tracepoint(struct perf_evlist *evlist) 19static int test__checkevent_tracepoint(struct perf_evlist *evlist)
17{ 20{
18 struct perf_evsel *evsel = list_entry(evlist->entries.next, 21 struct perf_evsel *evsel = list_entry(evlist->entries.next,
@@ -21,8 +24,7 @@ static int test__checkevent_tracepoint(struct perf_evlist *evlist)
21 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 24 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
22 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); 25 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type);
23 TEST_ASSERT_VAL("wrong sample_type", 26 TEST_ASSERT_VAL("wrong sample_type",
24 (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU) == 27 PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
25 evsel->attr.sample_type);
26 TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period); 28 TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period);
27 return 0; 29 return 0;
28} 30}
@@ -37,8 +39,7 @@ static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist)
37 TEST_ASSERT_VAL("wrong type", 39 TEST_ASSERT_VAL("wrong type",
38 PERF_TYPE_TRACEPOINT == evsel->attr.type); 40 PERF_TYPE_TRACEPOINT == evsel->attr.type);
39 TEST_ASSERT_VAL("wrong sample_type", 41 TEST_ASSERT_VAL("wrong sample_type",
40 (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU) 42 PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
41 == evsel->attr.sample_type);
42 TEST_ASSERT_VAL("wrong sample_period", 43 TEST_ASSERT_VAL("wrong sample_period",
43 1 == evsel->attr.sample_period); 44 1 == evsel->attr.sample_period);
44 } 45 }
@@ -428,8 +429,7 @@ static int test__checkevent_list(struct perf_evlist *evlist)
428 evsel = list_entry(evsel->node.next, struct perf_evsel, node); 429 evsel = list_entry(evsel->node.next, struct perf_evsel, node);
429 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); 430 TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type);
430 TEST_ASSERT_VAL("wrong sample_type", 431 TEST_ASSERT_VAL("wrong sample_type",
431 (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | PERF_SAMPLE_CPU) == 432 PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type);
432 evsel->attr.sample_type);
433 TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period); 433 TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->attr.sample_period);
434 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); 434 TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user);
435 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); 435 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 99d02aa57dbf..594f8fad5ecd 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -1,6 +1,7 @@
1#include "util.h" 1#include "util.h"
2#include "parse-options.h" 2#include "parse-options.h"
3#include "cache.h" 3#include "cache.h"
4#include "header.h"
4 5
5#define OPT_SHORT 1 6#define OPT_SHORT 1
6#define OPT_UNSET 2 7#define OPT_UNSET 2
@@ -413,6 +414,8 @@ int parse_options(int argc, const char **argv, const struct option *options,
413{ 414{
414 struct parse_opt_ctx_t ctx; 415 struct parse_opt_ctx_t ctx;
415 416
417 perf_header__set_cmdline(argc, argv);
418
416 parse_options_start(&ctx, argc, argv, flags); 419 parse_options_start(&ctx, argc, argv, flags);
417 switch (parse_options_step(&ctx, options, usagestr)) { 420 switch (parse_options_step(&ctx, options, usagestr)) {
418 case PARSE_OPT_HELP: 421 case PARSE_OPT_HELP:
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index e03b58a48424..0688bfb6d280 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -797,17 +797,13 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
797 797
798 event = perf_evlist__mmap_read(evlist, cpu); 798 event = perf_evlist__mmap_read(evlist, cpu);
799 if (event != NULL) { 799 if (event != NULL) {
800 struct perf_evsel *first;
801 PyObject *pyevent = pyrf_event__new(event); 800 PyObject *pyevent = pyrf_event__new(event);
802 struct pyrf_event *pevent = (struct pyrf_event *)pyevent; 801 struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
803 802
804 if (pyevent == NULL) 803 if (pyevent == NULL)
805 return PyErr_NoMemory(); 804 return PyErr_NoMemory();
806 805
807 first = list_entry(evlist->entries.next, struct perf_evsel, node); 806 err = perf_evlist__parse_sample(evlist, event, &pevent->sample, false);
808 err = perf_event__parse_sample(event, first->attr.sample_type,
809 perf_evsel__sample_size(first),
810 sample_id_all, &pevent->sample, false);
811 if (err) 807 if (err)
812 return PyErr_Format(PyExc_OSError, 808 return PyErr_Format(PyExc_OSError,
813 "perf: can't parse sample, err=%d", err); 809 "perf: can't parse sample, err=%d", err);
diff --git a/tools/perf/util/rblist.c b/tools/perf/util/rblist.c
new file mode 100644
index 000000000000..0171fb611004
--- /dev/null
+++ b/tools/perf/util/rblist.c
@@ -0,0 +1,107 @@
1/*
2 * Based on strlist.c by:
3 * (c) 2009 Arnaldo Carvalho de Melo <acme@redhat.com>
4 *
5 * Licensed under the GPLv2.
6 */
7
8#include <errno.h>
9#include <stdio.h>
10#include <stdlib.h>
11
12#include "rblist.h"
13
14int rblist__add_node(struct rblist *rblist, const void *new_entry)
15{
16 struct rb_node **p = &rblist->entries.rb_node;
17 struct rb_node *parent = NULL, *new_node;
18
19 while (*p != NULL) {
20 int rc;
21
22 parent = *p;
23
24 rc = rblist->node_cmp(parent, new_entry);
25 if (rc > 0)
26 p = &(*p)->rb_left;
27 else if (rc < 0)
28 p = &(*p)->rb_right;
29 else
30 return -EEXIST;
31 }
32
33 new_node = rblist->node_new(rblist, new_entry);
34 if (new_node == NULL)
35 return -ENOMEM;
36
37 rb_link_node(new_node, parent, p);
38 rb_insert_color(new_node, &rblist->entries);
39 ++rblist->nr_entries;
40
41 return 0;
42}
43
44void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node)
45{
46 rb_erase(rb_node, &rblist->entries);
47 rblist->node_delete(rblist, rb_node);
48}
49
50struct rb_node *rblist__find(struct rblist *rblist, const void *entry)
51{
52 struct rb_node **p = &rblist->entries.rb_node;
53 struct rb_node *parent = NULL;
54
55 while (*p != NULL) {
56 int rc;
57
58 parent = *p;
59
60 rc = rblist->node_cmp(parent, entry);
61 if (rc > 0)
62 p = &(*p)->rb_left;
63 else if (rc < 0)
64 p = &(*p)->rb_right;
65 else
66 return parent;
67 }
68
69 return NULL;
70}
71
72void rblist__init(struct rblist *rblist)
73{
74 if (rblist != NULL) {
75 rblist->entries = RB_ROOT;
76 rblist->nr_entries = 0;
77 }
78
79 return;
80}
81
82void rblist__delete(struct rblist *rblist)
83{
84 if (rblist != NULL) {
85 struct rb_node *pos, *next = rb_first(&rblist->entries);
86
87 while (next) {
88 pos = next;
89 next = rb_next(pos);
90 rb_erase(pos, &rblist->entries);
91 rblist->node_delete(rblist, pos);
92 }
93 free(rblist);
94 }
95}
96
97struct rb_node *rblist__entry(const struct rblist *rblist, unsigned int idx)
98{
99 struct rb_node *node;
100
101 for (node = rb_first(&rblist->entries); node; node = rb_next(node)) {
102 if (!idx--)
103 return node;
104 }
105
106 return NULL;
107}
diff --git a/tools/perf/util/rblist.h b/tools/perf/util/rblist.h
new file mode 100644
index 000000000000..6d0cae5ae83d
--- /dev/null
+++ b/tools/perf/util/rblist.h
@@ -0,0 +1,47 @@
1#ifndef __PERF_RBLIST_H
2#define __PERF_RBLIST_H
3
4#include <linux/rbtree.h>
5#include <stdbool.h>
6
7/*
8 * create node structs of the form:
9 * struct my_node {
10 * struct rb_node rb_node;
11 * ... my data ...
12 * };
13 *
14 * create list structs of the form:
15 * struct mylist {
16 * struct rblist rblist;
17 * ... my data ...
18 * };
19 */
20
21struct rblist {
22 struct rb_root entries;
23 unsigned int nr_entries;
24
25 int (*node_cmp)(struct rb_node *rbn, const void *entry);
26 struct rb_node *(*node_new)(struct rblist *rlist, const void *new_entry);
27 void (*node_delete)(struct rblist *rblist, struct rb_node *rb_node);
28};
29
30void rblist__init(struct rblist *rblist);
31void rblist__delete(struct rblist *rblist);
32int rblist__add_node(struct rblist *rblist, const void *new_entry);
33void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node);
34struct rb_node *rblist__find(struct rblist *rblist, const void *entry);
35struct rb_node *rblist__entry(const struct rblist *rblist, unsigned int idx);
36
37static inline bool rblist__empty(const struct rblist *rblist)
38{
39 return rblist->nr_entries == 0;
40}
41
42static inline unsigned int rblist__nr_entries(const struct rblist *rblist)
43{
44 return rblist->nr_entries;
45}
46
47#endif /* __PERF_RBLIST_H */
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8e4f0755d2aa..2437fb0b463a 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -80,14 +80,12 @@ out_close:
80 return -1; 80 return -1;
81} 81}
82 82
83void perf_session__update_sample_type(struct perf_session *self) 83void perf_session__set_id_hdr_size(struct perf_session *session)
84{ 84{
85 self->sample_type = perf_evlist__sample_type(self->evlist); 85 u16 id_hdr_size = perf_evlist__id_hdr_size(session->evlist);
86 self->sample_size = __perf_evsel__sample_size(self->sample_type); 86
87 self->sample_id_all = perf_evlist__sample_id_all(self->evlist); 87 session->host_machine.id_hdr_size = id_hdr_size;
88 self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist); 88 machines__set_id_hdr_size(&session->machines, id_hdr_size);
89 self->host_machine.id_hdr_size = self->id_hdr_size;
90 machines__set_id_hdr_size(&self->machines, self->id_hdr_size);
91} 89}
92 90
93int perf_session__create_kernel_maps(struct perf_session *self) 91int perf_session__create_kernel_maps(struct perf_session *self)
@@ -147,7 +145,7 @@ struct perf_session *perf_session__new(const char *filename, int mode,
147 if (mode == O_RDONLY) { 145 if (mode == O_RDONLY) {
148 if (perf_session__open(self, force) < 0) 146 if (perf_session__open(self, force) < 0)
149 goto out_delete; 147 goto out_delete;
150 perf_session__update_sample_type(self); 148 perf_session__set_id_hdr_size(self);
151 } else if (mode == O_WRONLY) { 149 } else if (mode == O_WRONLY) {
152 /* 150 /*
153 * In O_RDONLY mode this will be performed when reading the 151 * In O_RDONLY mode this will be performed when reading the
@@ -158,7 +156,7 @@ struct perf_session *perf_session__new(const char *filename, int mode,
158 } 156 }
159 157
160 if (tool && tool->ordering_requires_timestamps && 158 if (tool && tool->ordering_requires_timestamps &&
161 tool->ordered_samples && !self->sample_id_all) { 159 tool->ordered_samples && !perf_evlist__sample_id_all(self->evlist)) {
162 dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n"); 160 dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
163 tool->ordered_samples = false; 161 tool->ordered_samples = false;
164 } 162 }
@@ -673,7 +671,8 @@ static void flush_sample_queue(struct perf_session *s,
673 if (iter->timestamp > limit) 671 if (iter->timestamp > limit)
674 break; 672 break;
675 673
676 ret = perf_session__parse_sample(s, iter->event, &sample); 674 ret = perf_evlist__parse_sample(s->evlist, iter->event, &sample,
675 s->header.needs_swap);
677 if (ret) 676 if (ret)
678 pr_err("Can't parse sample, err = %d\n", ret); 677 pr_err("Can't parse sample, err = %d\n", ret);
679 else 678 else
@@ -865,16 +864,18 @@ static void perf_session__print_tstamp(struct perf_session *session,
865 union perf_event *event, 864 union perf_event *event,
866 struct perf_sample *sample) 865 struct perf_sample *sample)
867{ 866{
867 u64 sample_type = perf_evlist__sample_type(session->evlist);
868
868 if (event->header.type != PERF_RECORD_SAMPLE && 869 if (event->header.type != PERF_RECORD_SAMPLE &&
869 !session->sample_id_all) { 870 !perf_evlist__sample_id_all(session->evlist)) {
870 fputs("-1 -1 ", stdout); 871 fputs("-1 -1 ", stdout);
871 return; 872 return;
872 } 873 }
873 874
874 if ((session->sample_type & PERF_SAMPLE_CPU)) 875 if ((sample_type & PERF_SAMPLE_CPU))
875 printf("%u ", sample->cpu); 876 printf("%u ", sample->cpu);
876 877
877 if (session->sample_type & PERF_SAMPLE_TIME) 878 if (sample_type & PERF_SAMPLE_TIME)
878 printf("%" PRIu64 " ", sample->time); 879 printf("%" PRIu64 " ", sample->time);
879} 880}
880 881
@@ -899,6 +900,8 @@ static void dump_event(struct perf_session *session, union perf_event *event,
899static void dump_sample(struct perf_session *session, union perf_event *event, 900static void dump_sample(struct perf_session *session, union perf_event *event,
900 struct perf_sample *sample) 901 struct perf_sample *sample)
901{ 902{
903 u64 sample_type;
904
902 if (!dump_trace) 905 if (!dump_trace)
903 return; 906 return;
904 907
@@ -906,10 +909,12 @@ static void dump_sample(struct perf_session *session, union perf_event *event,
906 event->header.misc, sample->pid, sample->tid, sample->ip, 909 event->header.misc, sample->pid, sample->tid, sample->ip,
907 sample->period, sample->addr); 910 sample->period, sample->addr);
908 911
909 if (session->sample_type & PERF_SAMPLE_CALLCHAIN) 912 sample_type = perf_evlist__sample_type(session->evlist);
913
914 if (sample_type & PERF_SAMPLE_CALLCHAIN)
910 callchain__printf(sample); 915 callchain__printf(sample);
911 916
912 if (session->sample_type & PERF_SAMPLE_BRANCH_STACK) 917 if (sample_type & PERF_SAMPLE_BRANCH_STACK)
913 branch_stack__printf(sample); 918 branch_stack__printf(sample);
914} 919}
915 920
@@ -1006,7 +1011,7 @@ static int perf_session__preprocess_sample(struct perf_session *session,
1006 union perf_event *event, struct perf_sample *sample) 1011 union perf_event *event, struct perf_sample *sample)
1007{ 1012{
1008 if (event->header.type != PERF_RECORD_SAMPLE || 1013 if (event->header.type != PERF_RECORD_SAMPLE ||
1009 !(session->sample_type & PERF_SAMPLE_CALLCHAIN)) 1014 !(perf_evlist__sample_type(session->evlist) & PERF_SAMPLE_CALLCHAIN))
1010 return 0; 1015 return 0;
1011 1016
1012 if (!ip_callchain__valid(sample->callchain, event)) { 1017 if (!ip_callchain__valid(sample->callchain, event)) {
@@ -1030,7 +1035,7 @@ static int perf_session__process_user_event(struct perf_session *session, union
1030 case PERF_RECORD_HEADER_ATTR: 1035 case PERF_RECORD_HEADER_ATTR:
1031 err = tool->attr(event, &session->evlist); 1036 err = tool->attr(event, &session->evlist);
1032 if (err == 0) 1037 if (err == 0)
1033 perf_session__update_sample_type(session); 1038 perf_session__set_id_hdr_size(session);
1034 return err; 1039 return err;
1035 case PERF_RECORD_HEADER_EVENT_TYPE: 1040 case PERF_RECORD_HEADER_EVENT_TYPE:
1036 return tool->event_type(tool, event); 1041 return tool->event_type(tool, event);
@@ -1065,7 +1070,7 @@ static int perf_session__process_event(struct perf_session *session,
1065 int ret; 1070 int ret;
1066 1071
1067 if (session->header.needs_swap) 1072 if (session->header.needs_swap)
1068 event_swap(event, session->sample_id_all); 1073 event_swap(event, perf_evlist__sample_id_all(session->evlist));
1069 1074
1070 if (event->header.type >= PERF_RECORD_HEADER_MAX) 1075 if (event->header.type >= PERF_RECORD_HEADER_MAX)
1071 return -EINVAL; 1076 return -EINVAL;
@@ -1078,7 +1083,8 @@ static int perf_session__process_event(struct perf_session *session,
1078 /* 1083 /*
1079 * For all kernel events we get the sample data 1084 * For all kernel events we get the sample data
1080 */ 1085 */
1081 ret = perf_session__parse_sample(session, event, &sample); 1086 ret = perf_evlist__parse_sample(session->evlist, event, &sample,
1087 session->header.needs_swap);
1082 if (ret) 1088 if (ret)
1083 return ret; 1089 return ret;
1084 1090
@@ -1389,9 +1395,9 @@ int perf_session__process_events(struct perf_session *self,
1389 return err; 1395 return err;
1390} 1396}
1391 1397
1392bool perf_session__has_traces(struct perf_session *self, const char *msg) 1398bool perf_session__has_traces(struct perf_session *session, const char *msg)
1393{ 1399{
1394 if (!(self->sample_type & PERF_SAMPLE_RAW)) { 1400 if (!(perf_evlist__sample_type(session->evlist) & PERF_SAMPLE_RAW)) {
1395 pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg); 1401 pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg);
1396 return false; 1402 return false;
1397 } 1403 }
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 7c435bde6eb0..1f7ec87db7d7 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -41,13 +41,9 @@ struct perf_session {
41 * perf.data file. 41 * perf.data file.
42 */ 42 */
43 struct hists hists; 43 struct hists hists;
44 u64 sample_type;
45 int sample_size;
46 int fd; 44 int fd;
47 bool fd_pipe; 45 bool fd_pipe;
48 bool repipe; 46 bool repipe;
49 bool sample_id_all;
50 u16 id_hdr_size;
51 int cwdlen; 47 int cwdlen;
52 char *cwd; 48 char *cwd;
53 struct ordered_samples ordered_samples; 49 struct ordered_samples ordered_samples;
@@ -86,7 +82,7 @@ void perf_event__attr_swap(struct perf_event_attr *attr);
86 82
87int perf_session__create_kernel_maps(struct perf_session *self); 83int perf_session__create_kernel_maps(struct perf_session *self);
88 84
89void perf_session__update_sample_type(struct perf_session *self); 85void perf_session__set_id_hdr_size(struct perf_session *session);
90void perf_session__remove_thread(struct perf_session *self, struct thread *th); 86void perf_session__remove_thread(struct perf_session *self, struct thread *th);
91 87
92static inline 88static inline
@@ -130,24 +126,6 @@ size_t perf_session__fprintf_dsos_buildid(struct perf_session *self,
130 126
131size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp); 127size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
132 128
133static inline int perf_session__parse_sample(struct perf_session *session,
134 const union perf_event *event,
135 struct perf_sample *sample)
136{
137 return perf_event__parse_sample(event, session->sample_type,
138 session->sample_size,
139 session->sample_id_all, sample,
140 session->header.needs_swap);
141}
142
143static inline int perf_session__synthesize_sample(struct perf_session *session,
144 union perf_event *event,
145 const struct perf_sample *sample)
146{
147 return perf_event__synthesize_sample(event, session->sample_type,
148 sample, session->header.needs_swap);
149}
150
151struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session, 129struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
152 unsigned int type); 130 unsigned int type);
153 131
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
index 6783a2043555..95856ff3dda4 100644
--- a/tools/perf/util/strlist.c
+++ b/tools/perf/util/strlist.c
@@ -10,23 +10,28 @@
10#include <stdlib.h> 10#include <stdlib.h>
11#include <string.h> 11#include <string.h>
12 12
13static struct str_node *str_node__new(const char *s, bool dupstr) 13static
14struct rb_node *strlist__node_new(struct rblist *rblist, const void *entry)
14{ 15{
15 struct str_node *self = malloc(sizeof(*self)); 16 const char *s = entry;
17 struct rb_node *rc = NULL;
18 struct strlist *strlist = container_of(rblist, struct strlist, rblist);
19 struct str_node *snode = malloc(sizeof(*snode));
16 20
17 if (self != NULL) { 21 if (snode != NULL) {
18 if (dupstr) { 22 if (strlist->dupstr) {
19 s = strdup(s); 23 s = strdup(s);
20 if (s == NULL) 24 if (s == NULL)
21 goto out_delete; 25 goto out_delete;
22 } 26 }
23 self->s = s; 27 snode->s = s;
28 rc = &snode->rb_node;
24 } 29 }
25 30
26 return self; 31 return rc;
27 32
28out_delete: 33out_delete:
29 free(self); 34 free(snode);
30 return NULL; 35 return NULL;
31} 36}
32 37
@@ -37,36 +42,26 @@ static void str_node__delete(struct str_node *self, bool dupstr)
37 free(self); 42 free(self);
38} 43}
39 44
40int strlist__add(struct strlist *self, const char *new_entry) 45static
46void strlist__node_delete(struct rblist *rblist, struct rb_node *rb_node)
41{ 47{
42 struct rb_node **p = &self->entries.rb_node; 48 struct strlist *slist = container_of(rblist, struct strlist, rblist);
43 struct rb_node *parent = NULL; 49 struct str_node *snode = container_of(rb_node, struct str_node, rb_node);
44 struct str_node *sn;
45
46 while (*p != NULL) {
47 int rc;
48
49 parent = *p;
50 sn = rb_entry(parent, struct str_node, rb_node);
51 rc = strcmp(sn->s, new_entry);
52
53 if (rc > 0)
54 p = &(*p)->rb_left;
55 else if (rc < 0)
56 p = &(*p)->rb_right;
57 else
58 return -EEXIST;
59 }
60 50
61 sn = str_node__new(new_entry, self->dupstr); 51 str_node__delete(snode, slist->dupstr);
62 if (sn == NULL) 52}
63 return -ENOMEM;
64 53
65 rb_link_node(&sn->rb_node, parent, p); 54static int strlist__node_cmp(struct rb_node *rb_node, const void *entry)
66 rb_insert_color(&sn->rb_node, &self->entries); 55{
67 ++self->nr_entries; 56 const char *str = entry;
57 struct str_node *snode = container_of(rb_node, struct str_node, rb_node);
58
59 return strcmp(snode->s, str);
60}
68 61
69 return 0; 62int strlist__add(struct strlist *self, const char *new_entry)
63{
64 return rblist__add_node(&self->rblist, new_entry);
70} 65}
71 66
72int strlist__load(struct strlist *self, const char *filename) 67int strlist__load(struct strlist *self, const char *filename)
@@ -96,34 +91,20 @@ out:
96 return err; 91 return err;
97} 92}
98 93
99void strlist__remove(struct strlist *self, struct str_node *sn) 94void strlist__remove(struct strlist *slist, struct str_node *snode)
100{ 95{
101 rb_erase(&sn->rb_node, &self->entries); 96 str_node__delete(snode, slist->dupstr);
102 str_node__delete(sn, self->dupstr);
103} 97}
104 98
105struct str_node *strlist__find(struct strlist *self, const char *entry) 99struct str_node *strlist__find(struct strlist *slist, const char *entry)
106{ 100{
107 struct rb_node **p = &self->entries.rb_node; 101 struct str_node *snode = NULL;
108 struct rb_node *parent = NULL; 102 struct rb_node *rb_node = rblist__find(&slist->rblist, entry);
109
110 while (*p != NULL) {
111 struct str_node *sn;
112 int rc;
113
114 parent = *p;
115 sn = rb_entry(parent, struct str_node, rb_node);
116 rc = strcmp(sn->s, entry);
117
118 if (rc > 0)
119 p = &(*p)->rb_left;
120 else if (rc < 0)
121 p = &(*p)->rb_right;
122 else
123 return sn;
124 }
125 103
126 return NULL; 104 if (rb_node)
105 snode = container_of(rb_node, struct str_node, rb_node);
106
107 return snode;
127} 108}
128 109
129static int strlist__parse_list_entry(struct strlist *self, const char *s) 110static int strlist__parse_list_entry(struct strlist *self, const char *s)
@@ -156,9 +137,12 @@ struct strlist *strlist__new(bool dupstr, const char *slist)
156 struct strlist *self = malloc(sizeof(*self)); 137 struct strlist *self = malloc(sizeof(*self));
157 138
158 if (self != NULL) { 139 if (self != NULL) {
159 self->entries = RB_ROOT; 140 rblist__init(&self->rblist);
141 self->rblist.node_cmp = strlist__node_cmp;
142 self->rblist.node_new = strlist__node_new;
143 self->rblist.node_delete = strlist__node_delete;
144
160 self->dupstr = dupstr; 145 self->dupstr = dupstr;
161 self->nr_entries = 0;
162 if (slist && strlist__parse_list(self, slist) != 0) 146 if (slist && strlist__parse_list(self, slist) != 0)
163 goto out_error; 147 goto out_error;
164 } 148 }
@@ -171,30 +155,18 @@ out_error:
171 155
172void strlist__delete(struct strlist *self) 156void strlist__delete(struct strlist *self)
173{ 157{
174 if (self != NULL) { 158 if (self != NULL)
175 struct str_node *pos; 159 rblist__delete(&self->rblist);
176 struct rb_node *next = rb_first(&self->entries);
177
178 while (next) {
179 pos = rb_entry(next, struct str_node, rb_node);
180 next = rb_next(&pos->rb_node);
181 strlist__remove(self, pos);
182 }
183 self->entries = RB_ROOT;
184 free(self);
185 }
186} 160}
187 161
188struct str_node *strlist__entry(const struct strlist *self, unsigned int idx) 162struct str_node *strlist__entry(const struct strlist *slist, unsigned int idx)
189{ 163{
190 struct rb_node *nd; 164 struct str_node *snode = NULL;
165 struct rb_node *rb_node;
191 166
192 for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { 167 rb_node = rblist__entry(&slist->rblist, idx);
193 struct str_node *pos = rb_entry(nd, struct str_node, rb_node); 168 if (rb_node)
169 snode = container_of(rb_node, struct str_node, rb_node);
194 170
195 if (!idx--) 171 return snode;
196 return pos;
197 }
198
199 return NULL;
200} 172}
diff --git a/tools/perf/util/strlist.h b/tools/perf/util/strlist.h
index 3ba839007d2c..dd9f922ec67c 100644
--- a/tools/perf/util/strlist.h
+++ b/tools/perf/util/strlist.h
@@ -4,14 +4,15 @@
4#include <linux/rbtree.h> 4#include <linux/rbtree.h>
5#include <stdbool.h> 5#include <stdbool.h>
6 6
7#include "rblist.h"
8
7struct str_node { 9struct str_node {
8 struct rb_node rb_node; 10 struct rb_node rb_node;
9 const char *s; 11 const char *s;
10}; 12};
11 13
12struct strlist { 14struct strlist {
13 struct rb_root entries; 15 struct rblist rblist;
14 unsigned int nr_entries;
15 bool dupstr; 16 bool dupstr;
16}; 17};
17 18
@@ -32,18 +33,18 @@ static inline bool strlist__has_entry(struct strlist *self, const char *entry)
32 33
33static inline bool strlist__empty(const struct strlist *self) 34static inline bool strlist__empty(const struct strlist *self)
34{ 35{
35 return self->nr_entries == 0; 36 return rblist__empty(&self->rblist);
36} 37}
37 38
38static inline unsigned int strlist__nr_entries(const struct strlist *self) 39static inline unsigned int strlist__nr_entries(const struct strlist *self)
39{ 40{
40 return self->nr_entries; 41 return rblist__nr_entries(&self->rblist);
41} 42}
42 43
43/* For strlist iteration */ 44/* For strlist iteration */
44static inline struct str_node *strlist__first(struct strlist *self) 45static inline struct str_node *strlist__first(struct strlist *self)
45{ 46{
46 struct rb_node *rn = rb_first(&self->entries); 47 struct rb_node *rn = rb_first(&self->rblist.entries);
47 return rn ? rb_entry(rn, struct str_node, rb_node) : NULL; 48 return rn ? rb_entry(rn, struct str_node, rb_node) : NULL;
48} 49}
49static inline struct str_node *strlist__next(struct str_node *sn) 50static inline struct str_node *strlist__next(struct str_node *sn)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index fdad4eeeb429..8b63b678e127 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -64,7 +64,7 @@ static enum dso_binary_type binary_type_symtab[] = {
64 DSO_BINARY_TYPE__NOT_FOUND, 64 DSO_BINARY_TYPE__NOT_FOUND,
65}; 65};
66 66
67#define DSO_BINARY_TYPE__SYMTAB_CNT sizeof(binary_type_symtab) 67#define DSO_BINARY_TYPE__SYMTAB_CNT ARRAY_SIZE(binary_type_symtab)
68 68
69static enum dso_binary_type binary_type_data[] = { 69static enum dso_binary_type binary_type_data[] = {
70 DSO_BINARY_TYPE__BUILD_ID_CACHE, 70 DSO_BINARY_TYPE__BUILD_ID_CACHE,
@@ -72,7 +72,7 @@ static enum dso_binary_type binary_type_data[] = {
72 DSO_BINARY_TYPE__NOT_FOUND, 72 DSO_BINARY_TYPE__NOT_FOUND,
73}; 73};
74 74
75#define DSO_BINARY_TYPE__DATA_CNT sizeof(binary_type_data) 75#define DSO_BINARY_TYPE__DATA_CNT ARRAY_SIZE(binary_type_data)
76 76
77int dso__name_len(const struct dso *dso) 77int dso__name_len(const struct dso *dso)
78{ 78{
@@ -2875,6 +2875,7 @@ int machines__create_guest_kernel_maps(struct rb_root *machines)
2875 int i, items = 0; 2875 int i, items = 0;
2876 char path[PATH_MAX]; 2876 char path[PATH_MAX];
2877 pid_t pid; 2877 pid_t pid;
2878 char *endp;
2878 2879
2879 if (symbol_conf.default_guest_vmlinux_name || 2880 if (symbol_conf.default_guest_vmlinux_name ||
2880 symbol_conf.default_guest_modules || 2881 symbol_conf.default_guest_modules ||
@@ -2891,7 +2892,14 @@ int machines__create_guest_kernel_maps(struct rb_root *machines)
2891 /* Filter out . and .. */ 2892 /* Filter out . and .. */
2892 continue; 2893 continue;
2893 } 2894 }
2894 pid = atoi(namelist[i]->d_name); 2895 pid = (pid_t)strtol(namelist[i]->d_name, &endp, 10);
2896 if ((*endp != '\0') ||
2897 (endp == namelist[i]->d_name) ||
2898 (errno == ERANGE)) {
2899 pr_debug("invalid directory (%s). Skipping.\n",
2900 namelist[i]->d_name);
2901 continue;
2902 }
2895 sprintf(path, "%s/%s/proc/kallsyms", 2903 sprintf(path, "%s/%s/proc/kallsyms",
2896 symbol_conf.guestmount, 2904 symbol_conf.guestmount,
2897 namelist[i]->d_name); 2905 namelist[i]->d_name);
diff --git a/tools/perf/util/target.c b/tools/perf/util/target.c
index 3f59c496e64c..051eaa68095e 100644
--- a/tools/perf/util/target.c
+++ b/tools/perf/util/target.c
@@ -110,7 +110,7 @@ int perf_target__strerror(struct perf_target *target, int errnum,
110 int idx; 110 int idx;
111 const char *msg; 111 const char *msg;
112 112
113 BUG_ON(buflen > 0); 113 BUG_ON(buflen == 0);
114 114
115 if (errnum >= 0) { 115 if (errnum >= 0) {
116 const char *err = strerror_r(errnum, buf, buflen); 116 const char *err = strerror_r(errnum, buf, buflen);