aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-11-14 01:01:12 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-14 01:01:12 -0500
commit076ce4482569ea1a2c27b4ca71a309adaf91d398 (patch)
tree2ae9e42612f35be897f190983fc292d7af781cd2
parentd649a7a81f3b5bacb1d60abd7529894d8234a666 (diff)
parentb23dc5a7cc6ebc9a0d57351da7a0e8454c9ffea3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/chelsio/cxgb4vf/sge.c drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c sge.c was overlapping two changes, one to use the new __dev_alloc_page() in net-next, and one to use s->fl_pg_order in net. ixgbe_phy.c was a set of overlapping whitespace changes. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/devicetree/bindings/thermal/rcar-thermal.txt5
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--Documentation/video4linux/vivid.txt12
-rw-r--r--MAINTAINERS22
-rw-r--r--Makefile4
-rw-r--r--arch/arm/Kconfig.debug2
-rw-r--r--arch/arm/boot/dts/vf610-cosmic.dts19
-rw-r--r--arch/arm/boot/dts/zynq-parallella.dts4
-rw-r--r--arch/arm/common/edma.c9
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig1
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig1
-rw-r--r--arch/arm/configs/multi_v7_defconfig2
-rw-r--r--arch/arm/configs/omap2plus_defconfig4
-rw-r--r--arch/arm/configs/socfpga_defconfig71
-rw-r--r--arch/arm/include/uapi/asm/unistd.h1
-rw-r--r--arch/arm/kernel/calls.S1
-rw-r--r--arch/arm/mach-imx/clk-vf610.c134
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h4
-rw-r--r--arch/arm/mach-omap2/omap_device.c4
-rw-r--r--arch/arm/mach-pxa/include/mach/addr-map.h5
-rw-r--r--arch/arm/mm/cache-l2x0.c26
-rw-r--r--arch/arm/mm/dma-mapping.c1
-rw-r--r--arch/arm/mm/highmem.c3
-rw-r--r--arch/arm64/configs/defconfig26
-rw-r--r--arch/arm64/include/asm/unistd32.h2
-rw-r--r--arch/arm64/kernel/psci.c2
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/include/uapi/asm/unistd.h1
-rw-r--r--arch/m68k/kernel/syscalltable.S1
-rw-r--r--arch/mips/Makefile9
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c2
-rw-r--r--arch/mips/include/asm/asmmacro-32.h6
-rw-r--r--arch/mips/include/asm/asmmacro.h18
-rw-r--r--arch/mips/include/asm/fpregdef.h14
-rw-r--r--arch/mips/include/asm/fpu.h4
-rw-r--r--arch/mips/include/asm/mipsregs.h11
-rw-r--r--arch/mips/include/uapi/asm/unistd.h15
-rw-r--r--arch/mips/kernel/branch.c8
-rw-r--r--arch/mips/kernel/genex.S1
-rw-r--r--arch/mips/kernel/r2300_fpu.S6
-rw-r--r--arch/mips/kernel/r2300_switch.S5
-rw-r--r--arch/mips/kernel/r4k_fpu.S27
-rw-r--r--arch/mips/kernel/r4k_switch.S15
-rw-r--r--arch/mips/kernel/r6000_fpu.S5
-rw-r--r--arch/mips/kernel/scall32-o32.S1
-rw-r--r--arch/mips/kernel/scall64-64.S1
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/scall64-o32.S1
-rw-r--r--arch/mips/kernel/setup.c3
-rw-r--r--arch/mips/lib/r3k_dump_tlb.c4
-rw-r--r--arch/mips/lib/strnlen_user.S6
-rw-r--r--arch/mips/math-emu/cp1emu.c6
-rw-r--r--arch/mips/pci/msi-xlp.c4
-rw-r--r--arch/powerpc/include/asm/fadump.h52
-rw-r--r--arch/powerpc/kernel/entry_64.S6
-rw-r--r--arch/powerpc/kernel/fadump.c114
-rw-r--r--arch/powerpc/mm/init_32.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-lpc.c59
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c4
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c14
-rw-r--r--arch/s390/configs/default_defconfig36
-rw-r--r--arch/s390/configs/gcov_defconfig25
-rw-r--r--arch/s390/configs/performance_defconfig30
-rw-r--r--arch/s390/configs/zfcpdump_defconfig10
-rw-r--r--arch/s390/defconfig5
-rw-r--r--arch/s390/kernel/ftrace.c2
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S12
-rw-r--r--arch/s390/kernel/vdso32/gettimeofday.S14
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S13
-rw-r--r--arch/s390/kernel/vdso64/gettimeofday.S6
-rw-r--r--arch/s390/kernel/vtime.c4
-rw-r--r--arch/x86/kvm/emulate.c63
-rw-r--r--arch/x86/kvm/vmx.c6
-rw-r--r--arch/xtensa/Kconfig4
-rw-r--r--arch/xtensa/boot/dts/lx200mx.dts16
-rw-r--r--arch/xtensa/configs/generic_kc705_defconfig131
-rw-r--r--arch/xtensa/configs/smp_lx200_defconfig135
-rw-r--r--arch/xtensa/include/asm/pgtable.h2
-rw-r--r--arch/xtensa/include/uapi/asm/unistd.h12
-rw-r--r--drivers/base/Kconfig19
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/block/rbd.c35
-rw-r--r--drivers/block/zram/zram_drv.c3
-rw-r--r--drivers/char/hw_random/pseries-rng.c11
-rw-r--r--drivers/char/raw.c2
-rw-r--r--drivers/char/virtio_console.c4
-rw-r--r--drivers/crypto/caam/key_gen.c29
-rw-r--r--drivers/crypto/qat/qat_common/adf_accel_devices.h3
-rw-r--r--drivers/crypto/qat/qat_common/adf_transport.c12
-rw-r--r--drivers/crypto/qat/qat_common/qat_algs.c7
-rw-r--r--drivers/crypto/qat/qat_common/qat_crypto.c8
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_admin.c2
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_drv.c32
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_isr.c2
-rw-r--r--drivers/dma/edma.c40
-rw-r--r--drivers/gpu/drm/armada/armada_crtc.c21
-rw-r--r--drivers/gpu/drm/armada/armada_drv.c3
-rw-r--r--drivers/gpu/drm/exynos/exynos_dp_core.c5
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c5
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dpi.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c43
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dsi.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_vidi.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c6
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c10
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c16
-rw-r--r--drivers/gpu/drm/i915/intel_display.c5
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c24
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c17
-rw-r--r--drivers/gpu/drm/radeon/cik.c7
-rw-r--r--drivers/gpu/drm/radeon/cik_sdma.c21
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c8
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c19
-rw-r--r--drivers/gpu/drm/radeon/r100.c3
-rw-r--r--drivers/gpu/drm/radeon/r600_dma.c20
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_vm.c4
-rw-r--r--drivers/gpu/drm/radeon/rs600.c3
-rw-r--r--drivers/gpu/drm/radeon/rs690.c3
-rw-r--r--drivers/gpu/drm/radeon/rv515.c3
-rw-r--r--drivers/gpu/drm/radeon/si.c3
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c24
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hwmon/fam15h_power.c2
-rw-r--r--drivers/hwmon/ibmpowernv.c6
-rw-r--r--drivers/hwmon/pwm-fan.c13
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c5
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c5
-rw-r--r--drivers/i2c/algos/i2c-algo-pcf.c5
-rw-r--r--drivers/i2c/algos/i2c-algo-pcf.h7
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c4
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c4
-rw-r--r--drivers/i2c/busses/i2c-amd756-s4882.c4
-rw-r--r--drivers/i2c/busses/i2c-amd756.c4
-rw-r--r--drivers/i2c/busses/i2c-at91.c2
-rw-r--r--drivers/i2c/busses/i2c-au1550.c4
-rw-r--r--drivers/i2c/busses/i2c-cpm.c4
-rw-r--r--drivers/i2c/busses/i2c-davinci.c4
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c4
-rw-r--r--drivers/i2c/busses/i2c-designware-core.h4
-rw-r--r--drivers/i2c/busses/i2c-designware-pcidrv.c4
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c4
-rw-r--r--drivers/i2c/busses/i2c-eg20t.c4
-rw-r--r--drivers/i2c/busses/i2c-elektor.c6
-rw-r--r--drivers/i2c/busses/i2c-hydra.c4
-rw-r--r--drivers/i2c/busses/i2c-i801.c4
-rw-r--r--drivers/i2c/busses/i2c-imx.c5
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.h6
-rw-r--r--drivers/i2c/busses/i2c-isch.c4
-rw-r--r--drivers/i2c/busses/i2c-ismt.c4
-rw-r--r--drivers/i2c/busses/i2c-nforce2-s4985.c4
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c4
-rw-r--r--drivers/i2c/busses/i2c-omap.c4
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c4
-rw-r--r--drivers/i2c/busses/i2c-parport.c4
-rw-r--r--drivers/i2c/busses/i2c-parport.h4
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c4
-rw-r--r--drivers/i2c/busses/i2c-pca-isa.c4
-rw-r--r--drivers/i2c/busses/i2c-piix4.c4
-rw-r--r--drivers/i2c/busses/i2c-pmcmsp.c4
-rw-r--r--drivers/i2c/busses/i2c-powermac.c4
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c4
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c4
-rw-r--r--drivers/i2c/busses/i2c-sibyte.c4
-rw-r--r--drivers/i2c/busses/i2c-simtec.c4
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c4
-rw-r--r--drivers/i2c/busses/i2c-sis630.c4
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c4
-rw-r--r--drivers/i2c/busses/i2c-taos-evm.c4
-rw-r--r--drivers/i2c/busses/i2c-via.c4
-rw-r--r--drivers/i2c/busses/i2c-viapro.c4
-rw-r--r--drivers/i2c/busses/i2c-xiic.c4
-rw-r--r--drivers/i2c/busses/scx200_acb.c4
-rw-r--r--drivers/i2c/i2c-boardinfo.c5
-rw-r--r--drivers/i2c/i2c-core.c10
-rw-r--r--drivers/i2c/i2c-core.h5
-rw-r--r--drivers/i2c/i2c-dev.c5
-rw-r--r--drivers/i2c/i2c-smbus.c5
-rw-r--r--drivers/i2c/i2c-stub.c4
-rw-r--r--drivers/iio/accel/kxcjk-1013.c2
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_buffer.c2
-rw-r--r--drivers/iio/light/tsl4531.c7
-rw-r--r--drivers/iio/proximity/as3935.c2
-rw-r--r--drivers/irqchip/irq-armada-370-xp.c23
-rw-r--r--drivers/md/dm-bufio.c12
-rw-r--r--drivers/md/dm-raid.c17
-rw-r--r--drivers/md/dm-stripe.c4
-rw-r--r--drivers/md/dm-thin.c16
-rw-r--r--drivers/md/persistent-data/dm-btree-internal.h6
-rw-r--r--drivers/md/persistent-data/dm-btree-spine.c2
-rw-r--r--drivers/md/persistent-data/dm-btree.c24
-rw-r--r--drivers/media/dvb-core/dvb_frontend.c6
-rw-r--r--drivers/media/dvb-frontends/ds3000.c7
-rw-r--r--drivers/media/dvb-frontends/sp2.c4
-rw-r--r--drivers/media/dvb-frontends/tc90522.c18
-rw-r--r--drivers/media/platform/vivid/vivid-core.c11
-rw-r--r--drivers/media/rc/imon.c3
-rw-r--r--drivers/media/rc/ir-hix5hd2.c2
-rw-r--r--drivers/media/rc/ir-rc5-decoder.c2
-rw-r--r--drivers/media/rc/rc-ir-raw.c1
-rw-r--r--drivers/media/rc/rc-main.c2
-rw-r--r--drivers/mfd/max77693.c14
-rw-r--r--drivers/mfd/rtsx_pcr.c2
-rw-r--r--drivers/mfd/stmpe.h2
-rw-r--r--drivers/mfd/twl4030-power.c52
-rw-r--r--drivers/mfd/viperboard.c5
-rw-r--r--drivers/mmc/core/host.c21
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c2
-rw-r--r--drivers/mtd/devices/m25p80.c64
-rw-r--r--drivers/mtd/nand/omap_elm.c2
-rw-r--r--drivers/mtd/spi-nor/fsl-quadspi.c7
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c16
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c11
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.h3
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmmii.c9
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c31
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c30
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c51
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_regs.h10
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/adapter.h8
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/sge.c136
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c28
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c23
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c22
-rw-r--r--drivers/net/ethernet/qualcomm/Kconfig3
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c61
-rw-r--r--drivers/net/ethernet/ti/cpts.c2
-rw-r--r--drivers/net/phy/dp83640.c4
-rw-r--r--drivers/net/phy/phy.c36
-rw-r--r--drivers/net/ppp/ppp_generic.c40
-rw-r--r--drivers/net/usb/asix_devices.c14
-rw-r--r--drivers/net/vxlan.c31
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c10
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c12
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c4
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c4
-rw-r--r--drivers/of/base.c88
-rw-r--r--drivers/of/selftest.c66
-rw-r--r--drivers/of/testcase-data/tests-phandle.dtsi2
-rw-r--r--drivers/phy/phy-omap-usb2.c6
-rw-r--r--drivers/pinctrl/pinctrl-baytrail.c8
-rw-r--r--drivers/platform/x86/acer-wmi.c11
-rw-r--r--drivers/platform/x86/asus-nb-wmi.c9
-rw-r--r--drivers/platform/x86/ideapad-laptop.c7
-rw-r--r--drivers/platform/x86/samsung-laptop.c10
-rw-r--r--drivers/platform/x86/toshiba_acpi.c6
-rw-r--r--drivers/regulator/max1586.c2
-rw-r--r--drivers/regulator/max77686.c2
-rw-r--r--drivers/regulator/max77693.c2
-rw-r--r--drivers/regulator/max77802.c2
-rw-r--r--drivers/regulator/max8660.c2
-rw-r--r--drivers/regulator/of_regulator.c3
-rw-r--r--drivers/regulator/s2mpa01.c2
-rw-r--r--drivers/s390/kvm/virtio_ccw.c1
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c42
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h5
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/soc/versatile/soc-realview.c1
-rw-r--r--drivers/spi/spi-fsl-dspi.c4
-rw-r--r--drivers/spi/spi-pxa2xx.c7
-rw-r--r--drivers/staging/android/logger.c13
-rw-r--r--drivers/staging/comedi/Kconfig2
-rw-r--r--drivers/staging/comedi/comedi_fops.c26
-rw-r--r--drivers/staging/iio/adc/mxs-lradc.c12
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c15
-rw-r--r--drivers/staging/iio/meter/ade7758.h1
-rw-r--r--drivers/staging/iio/meter/ade7758_core.c57
-rw-r--r--drivers/staging/iio/meter/ade7758_ring.c5
-rw-r--r--drivers/staging/rtl8723au/include/rtw_eeprom.h2
-rw-r--r--drivers/thermal/imx_thermal.c45
-rw-r--r--drivers/thermal/int340x_thermal/int3403_thermal.c8
-rw-r--r--drivers/thermal/of-thermal.c40
-rw-r--r--drivers/thermal/samsung/exynos_thermal_common.h2
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c170
-rw-r--r--drivers/thermal/samsung/exynos_tmu.h89
-rw-r--r--drivers/thermal/samsung/exynos_tmu_data.c105
-rw-r--r--drivers/thermal/samsung/exynos_tmu_data.h55
-rw-r--r--drivers/thermal/thermal_core.c3
-rw-r--r--drivers/tty/n_tty.c9
-rw-r--r--drivers/tty/serial/8250/8250_mtk.c2
-rw-r--r--drivers/tty/serial/of_serial.c2
-rw-r--r--drivers/tty/serial/serial_core.c2
-rw-r--r--drivers/tty/tty_io.c15
-rw-r--r--drivers/tty/vt/consolemap.c7
-rw-r--r--drivers/usb/chipidea/core.c1
-rw-r--r--drivers/usb/class/cdc-acm.c25
-rw-r--r--drivers/usb/class/cdc-acm.h2
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/core/hub.c10
-rw-r--r--drivers/usb/core/quirks.c6
-rw-r--r--drivers/usb/dwc2/core.h2
-rw-r--r--drivers/usb/dwc2/gadget.c16
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c15
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c2
-rw-r--r--drivers/usb/dwc3/ep0.c48
-rw-r--r--drivers/usb/dwc3/gadget.c39
-rw-r--r--drivers/usb/dwc3/gadget.h3
-rw-r--r--drivers/usb/dwc3/trace.h53
-rw-r--r--drivers/usb/gadget/composite.c2
-rw-r--r--drivers/usb/gadget/function/f_acm.c8
-rw-r--r--drivers/usb/gadget/function/f_eem.c1
-rw-r--r--drivers/usb/gadget/function/f_fs.c42
-rw-r--r--drivers/usb/gadget/function/f_hid.c5
-rw-r--r--drivers/usb/gadget/function/f_loopback.c87
-rw-r--r--drivers/usb/gadget/function/f_ncm.c1
-rw-r--r--drivers/usb/gadget/function/f_obex.c9
-rw-r--r--drivers/usb/gadget/function/f_phonet.c2
-rw-r--r--drivers/usb/gadget/function/f_rndis.c9
-rw-r--r--drivers/usb/gadget/function/f_subset.c1
-rw-r--r--drivers/usb/gadget/function/f_uac2.c23
-rw-r--r--drivers/usb/gadget/function/f_uvc.c54
-rw-r--r--drivers/usb/gadget/function/uvc_video.c3
-rw-r--r--drivers/usb/gadget/udc/Kconfig1
-rw-r--r--drivers/usb/gadget/udc/udc-core.c5
-rw-r--r--drivers/usb/host/Kconfig4
-rw-r--r--drivers/usb/host/hwa-hc.c2
-rw-r--r--drivers/usb/host/xhci-pci.c18
-rw-r--r--drivers/usb/musb/musb_cppi41.c3
-rw-r--r--drivers/usb/musb/musb_dsps.c18
-rw-r--r--drivers/usb/serial/cp210x.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h12
-rw-r--r--drivers/usb/serial/kobil_sct.c20
-rw-r--r--drivers/usb/serial/opticon.c2
-rw-r--r--drivers/usb/serial/option.c10
-rw-r--r--drivers/usb/storage/initializers.c4
-rw-r--r--drivers/usb/storage/realtek_cr.c2
-rw-r--r--drivers/usb/storage/transport.c26
-rw-r--r--drivers/usb/storage/unusual_uas.h28
-rw-r--r--fs/block_dev.c3
-rw-r--r--fs/btrfs/ctree.h2
-rw-r--r--fs/btrfs/disk-io.c43
-rw-r--r--fs/btrfs/extent-tree.c18
-rw-r--r--fs/btrfs/file-item.c2
-rw-r--r--fs/btrfs/super.c1
-rw-r--r--fs/btrfs/tree-log.c2
-rw-r--r--fs/ceph/caps.c2
-rw-r--r--fs/isofs/inode.c24
-rw-r--r--fs/isofs/namei.c22
-rw-r--r--fs/namei.c2
-rw-r--r--fs/notify/fsnotify.c36
-rw-r--r--fs/notify/fsnotify.h4
-rw-r--r--fs/notify/inode_mark.c8
-rw-r--r--fs/notify/mark.c36
-rw-r--r--fs/notify/vfsmount_mark.c8
-rw-r--r--fs/ocfs2/cluster/tcp.c2
-rw-r--r--fs/overlayfs/readdir.c19
-rw-r--r--fs/xfs/xfs_bmap_util.c72
-rw-r--r--fs/xfs/xfs_itable.c250
-rw-r--r--fs/xfs/xfs_itable.h16
-rw-r--r--include/drm/drm_pciids.h1
-rw-r--r--include/dt-bindings/clock/vf610-clock.h39
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/cma.h8
-rw-r--r--include/linux/fs.h10
-rw-r--r--include/linux/mfd/max77693-private.h7
-rw-r--r--include/linux/mmzone.h9
-rw-r--r--include/linux/mtd/spi-nor.h21
-rw-r--r--include/linux/of.h84
-rw-r--r--include/linux/page-isolation.h8
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/rcupdate.h15
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/net/udp_tunnel.h9
-rw-r--r--include/scsi/scsi_tcq.h8
-rw-r--r--init/main.c2
-rw-r--r--kernel/audit.c2
-rw-r--r--kernel/audit_tree.c1
-rw-r--r--kernel/panic.c1
-rw-r--r--kernel/trace/ring_buffer.c81
-rw-r--r--kernel/trace/trace.c33
-rw-r--r--lib/rhashtable.c10
-rw-r--r--mm/bootmem.c9
-rw-r--r--mm/cma.c68
-rw-r--r--mm/compaction.c18
-rw-r--r--mm/internal.h25
-rw-r--r--mm/memory_hotplug.c26
-rw-r--r--mm/nobootmem.c8
-rw-r--r--mm/page_alloc.c68
-rw-r--r--mm/page_isolation.c43
-rw-r--r--mm/slab_common.c4
-rw-r--r--mm/truncate.c6
-rw-r--r--net/ceph/auth_x.c25
-rw-r--r--net/ceph/crypto.c169
-rw-r--r--net/ceph/messenger.c10
-rw-r--r--net/ceph/osd_client.c7
-rw-r--r--net/ipv4/fou.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/mac80211/ibss.c2
-rw-r--r--net/mac80211/ieee80211_i.h3
-rw-r--r--net/mac80211/iface.c18
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mlme.c5
-rw-r--r--net/mac80211/rx.c14
-rw-r--r--net/mac80211/spectmgmt.c18
-rw-r--r--net/netlink/af_netlink.c5
-rw-r--r--net/sctp/auth.c2
-rw-r--r--net/sctp/sm_make_chunk.c3
-rw-r--r--security/selinux/hooks.c7
-rw-r--r--sound/pci/hda/hda_intel.c4
-rw-r--r--sound/pci/hda/patch_conexant.c31
-rw-r--r--sound/pci/hda/patch_realtek.c217
-rw-r--r--sound/usb/card.c9
-rw-r--r--sound/usb/mixer_quirks.c6
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest2
-rw-r--r--tools/testing/selftests/net/psock_fanout.c2
419 files changed, 3955 insertions, 2476 deletions
diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
index 0ef00be44b01..43404b197933 100644
--- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
@@ -7,7 +7,10 @@ Required properties:
7 - "renesas,thermal-r8a73a4" (R-Mobile AP6) 7 - "renesas,thermal-r8a73a4" (R-Mobile AP6)
8 - "renesas,thermal-r8a7779" (R-Car H1) 8 - "renesas,thermal-r8a7779" (R-Car H1)
9 - "renesas,thermal-r8a7790" (R-Car H2) 9 - "renesas,thermal-r8a7790" (R-Car H2)
10 - "renesas,thermal-r8a7791" (R-Car M2) 10 - "renesas,thermal-r8a7791" (R-Car M2-W)
11 - "renesas,thermal-r8a7792" (R-Car V2H)
12 - "renesas,thermal-r8a7793" (R-Car M2-N)
13 - "renesas,thermal-r8a7794" (R-Car E2)
11- reg : Address range of the thermal registers. 14- reg : Address range of the thermal registers.
12 The 1st reg will be recognized as common register 15 The 1st reg will be recognized as common register
13 if it has "interrupts". 16 if it has "interrupts".
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4c81a860cc2b..479f33204a37 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -3621,7 +3621,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
3621 3621
3622 usb-storage.delay_use= 3622 usb-storage.delay_use=
3623 [UMS] The delay in seconds before a new device is 3623 [UMS] The delay in seconds before a new device is
3624 scanned for Logical Units (default 5). 3624 scanned for Logical Units (default 1).
3625 3625
3626 usb-storage.quirks= 3626 usb-storage.quirks=
3627 [UMS] A list of quirks entries to supplement or 3627 [UMS] A list of quirks entries to supplement or
diff --git a/Documentation/video4linux/vivid.txt b/Documentation/video4linux/vivid.txt
index eeb11a28e4fc..e5a940e3d304 100644
--- a/Documentation/video4linux/vivid.txt
+++ b/Documentation/video4linux/vivid.txt
@@ -221,12 +221,11 @@ ccs_out_mode: specify the allowed video output crop/compose/scaling combination
221 key, not quality. 221 key, not quality.
222 222
223multiplanar: select whether each device instance supports multi-planar formats, 223multiplanar: select whether each device instance supports multi-planar formats,
224 and thus the V4L2 multi-planar API. By default the first device instance 224 and thus the V4L2 multi-planar API. By default device instances are
225 is single-planar, the second multi-planar, and it keeps alternating. 225 single-planar.
226 226
227 This module option can override that for each instance. Values are: 227 This module option can override that for each instance. Values are:
228 228
229 0: use alternating single and multi-planar devices.
230 1: this is a single-planar instance. 229 1: this is a single-planar instance.
231 2: this is a multi-planar instance. 230 2: this is a multi-planar instance.
232 231
@@ -975,9 +974,8 @@ is set, then the alpha component is only used for the color red and set to
9750 otherwise. 9740 otherwise.
976 975
977The driver has to be configured to support the multiplanar formats. By default 976The driver has to be configured to support the multiplanar formats. By default
978the first driver instance is single-planar, the second is multi-planar, and it 977the driver instances are single-planar. This can be changed by setting the
979keeps alternating. This can be changed by setting the multiplanar module option, 978multiplanar module option, see section 1 for more details on that option.
980see section 1 for more details on that option.
981 979
982If the driver instance is using the multiplanar formats/API, then the first 980If the driver instance is using the multiplanar formats/API, then the first
983single planar format (YUYV) and the multiplanar NV16M and NV61M formats the 981single planar format (YUYV) and the multiplanar NV16M and NV61M formats the
@@ -1021,7 +1019,7 @@ the output overlay for the video output, turn on video looping and capture
1021to see the blended framebuffer overlay that's being written to by the second 1019to see the blended framebuffer overlay that's being written to by the second
1022instance. This setup would require the following commands: 1020instance. This setup would require the following commands:
1023 1021
1024 $ sudo modprobe vivid n_devs=2 node_types=0x10101,0x1 multiplanar=1,1 1022 $ sudo modprobe vivid n_devs=2 node_types=0x10101,0x1
1025 $ v4l2-ctl -d1 --find-fb 1023 $ v4l2-ctl -d1 --find-fb
1026 /dev/fb1 is the framebuffer associated with base address 0x12800000 1024 /dev/fb1 is the framebuffer associated with base address 0x12800000
1027 $ sudo v4l2-ctl -d2 --set-fbuf fb=1 1025 $ sudo v4l2-ctl -d2 --set-fbuf fb=1
diff --git a/MAINTAINERS b/MAINTAINERS
index 5bf11c706651..064d24191506 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1543,6 +1543,7 @@ F: arch/arm/mach-pxa/include/mach/z2.h
1543 1543
1544ARM/ZYNQ ARCHITECTURE 1544ARM/ZYNQ ARCHITECTURE
1545M: Michal Simek <michal.simek@xilinx.com> 1545M: Michal Simek <michal.simek@xilinx.com>
1546R: Sören Brinkmann <soren.brinkmann@xilinx.com>
1546L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1547L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1547W: http://wiki.xilinx.com 1548W: http://wiki.xilinx.com
1548T: git git://git.xilinx.com/linux-xlnx.git 1549T: git git://git.xilinx.com/linux-xlnx.git
@@ -2071,8 +2072,9 @@ F: drivers/clocksource/bcm_kona_timer.c
2071 2072
2072BROADCOM BCM2835 ARM ARCHITECTURE 2073BROADCOM BCM2835 ARM ARCHITECTURE
2073M: Stephen Warren <swarren@wwwdotorg.org> 2074M: Stephen Warren <swarren@wwwdotorg.org>
2075M: Lee Jones <lee@kernel.org>
2074L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) 2076L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers)
2075T: git git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git 2077T: git git://git.kernel.org/pub/scm/linux/kernel/git/rpi/linux-rpi.git
2076S: Maintained 2078S: Maintained
2077N: bcm2835 2079N: bcm2835
2078 2080
@@ -4320,8 +4322,10 @@ F: Documentation/blockdev/cpqarray.txt
4320F: drivers/block/cpqarray.* 4322F: drivers/block/cpqarray.*
4321 4323
4322HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa) 4324HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa)
4323M: "Stephen M. Cameron" <scameron@beardog.cce.hp.com> 4325M: Don Brace <don.brace@pmcs.com>
4324L: iss_storagedev@hp.com 4326L: iss_storagedev@hp.com
4327L: storagedev@pmcs.com
4328L: linux-scsi@vger.kernel.org
4325S: Supported 4329S: Supported
4326F: Documentation/scsi/hpsa.txt 4330F: Documentation/scsi/hpsa.txt
4327F: drivers/scsi/hpsa*.[ch] 4331F: drivers/scsi/hpsa*.[ch]
@@ -4329,8 +4333,10 @@ F: include/linux/cciss*.h
4329F: include/uapi/linux/cciss*.h 4333F: include/uapi/linux/cciss*.h
4330 4334
4331HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss) 4335HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss)
4332M: Mike Miller <mike.miller@hp.com> 4336M: Don Brace <don.brace@pmcs.com>
4333L: iss_storagedev@hp.com 4337L: iss_storagedev@hp.com
4338L: storagedev@pmcs.com
4339L: linux-scsi@vger.kernel.org
4334S: Supported 4340S: Supported
4335F: Documentation/blockdev/cciss.txt 4341F: Documentation/blockdev/cciss.txt
4336F: drivers/block/cciss* 4342F: drivers/block/cciss*
@@ -4725,6 +4731,7 @@ L: linux-iio@vger.kernel.org
4725S: Maintained 4731S: Maintained
4726F: drivers/iio/ 4732F: drivers/iio/
4727F: drivers/staging/iio/ 4733F: drivers/staging/iio/
4734F: include/linux/iio/
4728 4735
4729IKANOS/ADI EAGLE ADSL USB DRIVER 4736IKANOS/ADI EAGLE ADSL USB DRIVER
4730M: Matthieu Castet <castet.matthieu@free.fr> 4737M: Matthieu Castet <castet.matthieu@free.fr>
@@ -7195,6 +7202,7 @@ F: drivers/crypto/picoxcell*
7195 7202
7196PIN CONTROL SUBSYSTEM 7203PIN CONTROL SUBSYSTEM
7197M: Linus Walleij <linus.walleij@linaro.org> 7204M: Linus Walleij <linus.walleij@linaro.org>
7205L: linux-gpio@vger.kernel.org
7198S: Maintained 7206S: Maintained
7199F: drivers/pinctrl/ 7207F: drivers/pinctrl/
7200F: include/linux/pinctrl/ 7208F: include/linux/pinctrl/
@@ -8499,7 +8507,6 @@ F: arch/arm/mach-s3c24xx/bast-irq.c
8499TI DAVINCI MACHINE SUPPORT 8507TI DAVINCI MACHINE SUPPORT
8500M: Sekhar Nori <nsekhar@ti.com> 8508M: Sekhar Nori <nsekhar@ti.com>
8501M: Kevin Hilman <khilman@deeprootsystems.com> 8509M: Kevin Hilman <khilman@deeprootsystems.com>
8502L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers)
8503T: git git://gitorious.org/linux-davinci/linux-davinci.git 8510T: git git://gitorious.org/linux-davinci/linux-davinci.git
8504Q: http://patchwork.kernel.org/project/linux-davinci/list/ 8511Q: http://patchwork.kernel.org/project/linux-davinci/list/
8505S: Supported 8512S: Supported
@@ -8509,7 +8516,6 @@ F: drivers/i2c/busses/i2c-davinci.c
8509TI DAVINCI SERIES MEDIA DRIVER 8516TI DAVINCI SERIES MEDIA DRIVER
8510M: Lad, Prabhakar <prabhakar.csengg@gmail.com> 8517M: Lad, Prabhakar <prabhakar.csengg@gmail.com>
8511L: linux-media@vger.kernel.org 8518L: linux-media@vger.kernel.org
8512L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers)
8513W: http://linuxtv.org/ 8519W: http://linuxtv.org/
8514Q: http://patchwork.linuxtv.org/project/linux-media/list/ 8520Q: http://patchwork.linuxtv.org/project/linux-media/list/
8515T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git 8521T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
@@ -9626,7 +9632,6 @@ F: drivers/staging/unisys/
9626 9632
9627UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER 9633UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER
9628M: Vinayak Holikatti <vinholikatti@gmail.com> 9634M: Vinayak Holikatti <vinholikatti@gmail.com>
9629M: Santosh Y <santoshsy@gmail.com>
9630L: linux-scsi@vger.kernel.org 9635L: linux-scsi@vger.kernel.org
9631S: Supported 9636S: Supported
9632F: Documentation/scsi/ufs.txt 9637F: Documentation/scsi/ufs.txt
@@ -9720,11 +9725,6 @@ S: Maintained
9720F: Documentation/hid/hiddev.txt 9725F: Documentation/hid/hiddev.txt
9721F: drivers/hid/usbhid/ 9726F: drivers/hid/usbhid/
9722 9727
9723USB/IP DRIVERS
9724L: linux-usb@vger.kernel.org
9725S: Orphan
9726F: drivers/staging/usbip/
9727
9728USB ISP116X DRIVER 9728USB ISP116X DRIVER
9729M: Olav Kongas <ok@artecdesign.ee> 9729M: Olav Kongas <ok@artecdesign.ee>
9730L: linux-usb@vger.kernel.org 9730L: linux-usb@vger.kernel.org
diff --git a/Makefile b/Makefile
index 52c129725270..bc7eb6ada966 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 18 2PATCHLEVEL = 18
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc4
5NAME = Shuffling Zombie Juror 5NAME = Diseased Newt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 03dc4c1a8736..d8f6a2ec3d4e 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1187,7 +1187,7 @@ config DEBUG_UART_VIRT
1187 default 0xf1c28000 if DEBUG_SUNXI_UART0 1187 default 0xf1c28000 if DEBUG_SUNXI_UART0
1188 default 0xf1c28400 if DEBUG_SUNXI_UART1 1188 default 0xf1c28400 if DEBUG_SUNXI_UART1
1189 default 0xf1f02800 if DEBUG_SUNXI_R_UART 1189 default 0xf1f02800 if DEBUG_SUNXI_R_UART
1190 default 0xf2100000 if DEBUG_PXA_UART1 1190 default 0xf6200000 if DEBUG_PXA_UART1
1191 default 0xf4090000 if ARCH_LPC32XX 1191 default 0xf4090000 if ARCH_LPC32XX
1192 default 0xf4200000 if ARCH_GEMINI 1192 default 0xf4200000 if ARCH_GEMINI
1193 default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ 1193 default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
diff --git a/arch/arm/boot/dts/vf610-cosmic.dts b/arch/arm/boot/dts/vf610-cosmic.dts
index 3fd1b74e1216..de1b453c2932 100644
--- a/arch/arm/boot/dts/vf610-cosmic.dts
+++ b/arch/arm/boot/dts/vf610-cosmic.dts
@@ -33,6 +33,13 @@
33 33
34}; 34};
35 35
36&esdhc1 {
37 pinctrl-names = "default";
38 pinctrl-0 = <&pinctrl_esdhc1>;
39 bus-width = <4>;
40 status = "okay";
41};
42
36&fec1 { 43&fec1 {
37 phy-mode = "rmii"; 44 phy-mode = "rmii";
38 pinctrl-names = "default"; 45 pinctrl-names = "default";
@@ -42,6 +49,18 @@
42 49
43&iomuxc { 50&iomuxc {
44 vf610-cosmic { 51 vf610-cosmic {
52 pinctrl_esdhc1: esdhc1grp {
53 fsl,pins = <
54 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
55 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef
56 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef
57 VF610_PAD_PTA27__ESDHC1_DAT1 0x31ef
58 VF610_PAD_PTA28__ESDHC1_DATA2 0x31ef
59 VF610_PAD_PTA29__ESDHC1_DAT3 0x31ef
60 VF610_PAD_PTB28__GPIO_98 0x219d
61 >;
62 };
63
45 pinctrl_fec1: fec1grp { 64 pinctrl_fec1: fec1grp {
46 fsl,pins = < 65 fsl,pins = <
47 VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2 66 VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2
diff --git a/arch/arm/boot/dts/zynq-parallella.dts b/arch/arm/boot/dts/zynq-parallella.dts
index e1f51ca127fe..0429bbd89fba 100644
--- a/arch/arm/boot/dts/zynq-parallella.dts
+++ b/arch/arm/boot/dts/zynq-parallella.dts
@@ -34,6 +34,10 @@
34 }; 34 };
35}; 35};
36 36
37&clkc {
38 fclk-enable = <0xf>;
39};
40
37&gem0 { 41&gem0 {
38 status = "okay"; 42 status = "okay";
39 phy-mode = "rgmii-id"; 43 phy-mode = "rgmii-id";
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index d86771abbf57..72041f002b7e 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -26,6 +26,7 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/edma.h> 28#include <linux/edma.h>
29#include <linux/dma-mapping.h>
29#include <linux/of_address.h> 30#include <linux/of_address.h>
30#include <linux/of_device.h> 31#include <linux/of_device.h>
31#include <linux/of_dma.h> 32#include <linux/of_dma.h>
@@ -1623,6 +1624,11 @@ static int edma_probe(struct platform_device *pdev)
1623 struct device_node *node = pdev->dev.of_node; 1624 struct device_node *node = pdev->dev.of_node;
1624 struct device *dev = &pdev->dev; 1625 struct device *dev = &pdev->dev;
1625 int ret; 1626 int ret;
1627 struct platform_device_info edma_dev_info = {
1628 .name = "edma-dma-engine",
1629 .dma_mask = DMA_BIT_MASK(32),
1630 .parent = &pdev->dev,
1631 };
1626 1632
1627 if (node) { 1633 if (node) {
1628 /* Check if this is a second instance registered */ 1634 /* Check if this is a second instance registered */
@@ -1793,6 +1799,9 @@ static int edma_probe(struct platform_device *pdev)
1793 edma_write_array(j, EDMA_QRAE, i, 0x0); 1799 edma_write_array(j, EDMA_QRAE, i, 0x0);
1794 } 1800 }
1795 arch_num_cc++; 1801 arch_num_cc++;
1802
1803 edma_dev_info.id = j;
1804 platform_device_register_full(&edma_dev_info);
1796 } 1805 }
1797 1806
1798 return 0; 1807 return 0;
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index e688741c89aa..e6b0007355f8 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -97,6 +97,7 @@ CONFIG_SERIAL_IMX_CONSOLE=y
97# CONFIG_HW_RANDOM is not set 97# CONFIG_HW_RANDOM is not set
98CONFIG_I2C_CHARDEV=y 98CONFIG_I2C_CHARDEV=y
99CONFIG_I2C_IMX=y 99CONFIG_I2C_IMX=y
100CONFIG_SPI=y
100CONFIG_SPI_IMX=y 101CONFIG_SPI_IMX=y
101CONFIG_SPI_SPIDEV=y 102CONFIG_SPI_SPIDEV=y
102CONFIG_GPIO_SYSFS=y 103CONFIG_GPIO_SYSFS=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 8fca6e276b69..6790f1b3f3a1 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -158,6 +158,7 @@ CONFIG_I2C_CHARDEV=y
158CONFIG_I2C_ALGOPCF=m 158CONFIG_I2C_ALGOPCF=m
159CONFIG_I2C_ALGOPCA=m 159CONFIG_I2C_ALGOPCA=m
160CONFIG_I2C_IMX=y 160CONFIG_I2C_IMX=y
161CONFIG_SPI=y
161CONFIG_SPI_IMX=y 162CONFIG_SPI_IMX=y
162CONFIG_GPIO_SYSFS=y 163CONFIG_GPIO_SYSFS=y
163CONFIG_GPIO_MC9S08DZ60=y 164CONFIG_GPIO_MC9S08DZ60=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index f1dc7fc668f3..3487046d8a78 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -235,6 +235,7 @@ CONFIG_SPI_TEGRA20_SLINK=y
235CONFIG_SPI_XILINX=y 235CONFIG_SPI_XILINX=y
236CONFIG_PINCTRL_AS3722=y 236CONFIG_PINCTRL_AS3722=y
237CONFIG_PINCTRL_PALMAS=y 237CONFIG_PINCTRL_PALMAS=y
238CONFIG_PINCTRL_APQ8084=y
238CONFIG_GPIO_SYSFS=y 239CONFIG_GPIO_SYSFS=y
239CONFIG_GPIO_GENERIC_PLATFORM=y 240CONFIG_GPIO_GENERIC_PLATFORM=y
240CONFIG_GPIO_DWAPB=y 241CONFIG_GPIO_DWAPB=y
@@ -411,6 +412,7 @@ CONFIG_NVEC_POWER=y
411CONFIG_NVEC_PAZ00=y 412CONFIG_NVEC_PAZ00=y
412CONFIG_QCOM_GSBI=y 413CONFIG_QCOM_GSBI=y
413CONFIG_COMMON_CLK_QCOM=y 414CONFIG_COMMON_CLK_QCOM=y
415CONFIG_APQ_MMCC_8084=y
414CONFIG_MSM_GCC_8660=y 416CONFIG_MSM_GCC_8660=y
415CONFIG_MSM_MMCC_8960=y 417CONFIG_MSM_MMCC_8960=y
416CONFIG_MSM_MMCC_8974=y 418CONFIG_MSM_MMCC_8974=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 16e719c268dd..b3f86670d2eb 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -86,7 +86,6 @@ CONFIG_IP_PNP_DHCP=y
86CONFIG_IP_PNP_BOOTP=y 86CONFIG_IP_PNP_BOOTP=y
87CONFIG_IP_PNP_RARP=y 87CONFIG_IP_PNP_RARP=y
88# CONFIG_INET_LRO is not set 88# CONFIG_INET_LRO is not set
89CONFIG_IPV6=y
90CONFIG_NETFILTER=y 89CONFIG_NETFILTER=y
91CONFIG_CAN=m 90CONFIG_CAN=m
92CONFIG_CAN_C_CAN=m 91CONFIG_CAN_C_CAN=m
@@ -112,6 +111,7 @@ CONFIG_MTD_OOPS=y
112CONFIG_MTD_CFI=y 111CONFIG_MTD_CFI=y
113CONFIG_MTD_CFI_INTELEXT=y 112CONFIG_MTD_CFI_INTELEXT=y
114CONFIG_MTD_NAND=y 113CONFIG_MTD_NAND=y
114CONFIG_MTD_NAND_ECC_BCH=y
115CONFIG_MTD_NAND_OMAP2=y 115CONFIG_MTD_NAND_OMAP2=y
116CONFIG_MTD_ONENAND=y 116CONFIG_MTD_ONENAND=y
117CONFIG_MTD_ONENAND_VERIFY_WRITE=y 117CONFIG_MTD_ONENAND_VERIFY_WRITE=y
@@ -317,7 +317,7 @@ CONFIG_EXT4_FS=y
317CONFIG_FANOTIFY=y 317CONFIG_FANOTIFY=y
318CONFIG_QUOTA=y 318CONFIG_QUOTA=y
319CONFIG_QFMT_V2=y 319CONFIG_QFMT_V2=y
320CONFIG_AUTOFS4_FS=y 320CONFIG_AUTOFS4_FS=m
321CONFIG_MSDOS_FS=y 321CONFIG_MSDOS_FS=y
322CONFIG_VFAT_FS=y 322CONFIG_VFAT_FS=y
323CONFIG_TMPFS=y 323CONFIG_TMPFS=y
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig
index d7a5855a5db8..a2956c3112f1 100644
--- a/arch/arm/configs/socfpga_defconfig
+++ b/arch/arm/configs/socfpga_defconfig
@@ -1,5 +1,6 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
2CONFIG_FHANDLE=y
3CONFIG_HIGH_RES_TIMERS=y
3CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
@@ -11,23 +12,17 @@ CONFIG_PROFILING=y
11CONFIG_OPROFILE=y 12CONFIG_OPROFILE=y
12CONFIG_MODULES=y 13CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y 14CONFIG_MODULE_UNLOAD=y
14CONFIG_HOTPLUG=y
15# CONFIG_LBDAF is not set 15# CONFIG_LBDAF is not set
16# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 17# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 18# CONFIG_IOSCHED_CFQ is not set
19CONFIG_ARCH_SOCFPGA=y 19CONFIG_ARCH_SOCFPGA=y
20CONFIG_MACH_SOCFPGA_CYCLONE5=y
21CONFIG_ARM_THUMBEE=y 20CONFIG_ARM_THUMBEE=y
22# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set
23# CONFIG_CACHE_L2X0 is not set
24CONFIG_HIGH_RES_TIMERS=y
25CONFIG_SMP=y 21CONFIG_SMP=y
26CONFIG_NR_CPUS=2 22CONFIG_NR_CPUS=2
27CONFIG_AEABI=y 23CONFIG_AEABI=y
28CONFIG_ZBOOT_ROM_TEXT=0x0 24CONFIG_ZBOOT_ROM_TEXT=0x0
29CONFIG_ZBOOT_ROM_BSS=0x0 25CONFIG_ZBOOT_ROM_BSS=0x0
30CONFIG_CMDLINE=""
31CONFIG_VFP=y 26CONFIG_VFP=y
32CONFIG_NEON=y 27CONFIG_NEON=y
33CONFIG_NET=y 28CONFIG_NET=y
@@ -41,38 +36,30 @@ CONFIG_IP_PNP=y
41CONFIG_IP_PNP_DHCP=y 36CONFIG_IP_PNP_DHCP=y
42CONFIG_IP_PNP_BOOTP=y 37CONFIG_IP_PNP_BOOTP=y
43CONFIG_IP_PNP_RARP=y 38CONFIG_IP_PNP_RARP=y
39CONFIG_IPV6=y
40CONFIG_NETWORK_PHY_TIMESTAMPING=y
41CONFIG_VLAN_8021Q=y
42CONFIG_VLAN_8021Q_GVRP=y
44CONFIG_CAN=y 43CONFIG_CAN=y
45CONFIG_CAN_RAW=y
46CONFIG_CAN_BCM=y
47CONFIG_CAN_GW=y
48CONFIG_CAN_DEV=y
49CONFIG_CAN_CALC_BITTIMING=y
50CONFIG_CAN_C_CAN=y 44CONFIG_CAN_C_CAN=y
51CONFIG_CAN_C_CAN_PLATFORM=y 45CONFIG_CAN_C_CAN_PLATFORM=y
52CONFIG_CAN_DEBUG_DEVICES=y 46CONFIG_CAN_DEBUG_DEVICES=y
53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 47CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
54CONFIG_DEVTMPFS=y 48CONFIG_DEVTMPFS=y
55CONFIG_PROC_DEVICETREE=y 49CONFIG_DEVTMPFS_MOUNT=y
56CONFIG_BLK_DEV_RAM=y 50CONFIG_BLK_DEV_RAM=y
57CONFIG_BLK_DEV_RAM_COUNT=2 51CONFIG_BLK_DEV_RAM_COUNT=2
58CONFIG_BLK_DEV_RAM_SIZE=8192 52CONFIG_BLK_DEV_RAM_SIZE=8192
53CONFIG_SRAM=y
59CONFIG_SCSI=y 54CONFIG_SCSI=y
60# CONFIG_SCSI_PROC_FS is not set 55# CONFIG_SCSI_PROC_FS is not set
61CONFIG_BLK_DEV_SD=y 56CONFIG_BLK_DEV_SD=y
62# CONFIG_SCSI_LOWLEVEL is not set 57# CONFIG_SCSI_LOWLEVEL is not set
63CONFIG_NETDEVICES=y 58CONFIG_NETDEVICES=y
64CONFIG_STMMAC_ETH=y 59CONFIG_STMMAC_ETH=y
60CONFIG_DWMAC_SOCFPGA=y
65CONFIG_MICREL_PHY=y 61CONFIG_MICREL_PHY=y
66# CONFIG_STMMAC_PHY_ID_ZERO_WORKAROUND is not set
67CONFIG_INPUT_EVDEV=y 62CONFIG_INPUT_EVDEV=y
68CONFIG_DWMAC_SOCFPGA=y
69CONFIG_PPS=y
70CONFIG_NETWORK_PHY_TIMESTAMPING=y
71CONFIG_PTP_1588_CLOCK=y
72CONFIG_VLAN_8021Q=y
73CONFIG_VLAN_8021Q_GVRP=y
74CONFIG_GARP=y
75CONFIG_IPV6=y
76# CONFIG_SERIO_SERPORT is not set 63# CONFIG_SERIO_SERPORT is not set
77CONFIG_SERIO_AMBAKMI=y 64CONFIG_SERIO_AMBAKMI=y
78CONFIG_LEGACY_PTY_COUNT=16 65CONFIG_LEGACY_PTY_COUNT=16
@@ -81,45 +68,43 @@ CONFIG_SERIAL_8250_CONSOLE=y
81CONFIG_SERIAL_8250_NR_UARTS=2 68CONFIG_SERIAL_8250_NR_UARTS=2
82CONFIG_SERIAL_8250_RUNTIME_UARTS=2 69CONFIG_SERIAL_8250_RUNTIME_UARTS=2
83CONFIG_SERIAL_8250_DW=y 70CONFIG_SERIAL_8250_DW=y
71CONFIG_I2C=y
72CONFIG_I2C_CHARDEV=y
73CONFIG_I2C_DESIGNWARE_PLATFORM=y
84CONFIG_GPIOLIB=y 74CONFIG_GPIOLIB=y
85CONFIG_GPIO_SYSFS=y 75CONFIG_GPIO_SYSFS=y
86CONFIG_GPIO_DWAPB=y 76CONFIG_GPIO_DWAPB=y
87# CONFIG_RTC_HCTOSYS is not set 77CONFIG_PMBUS=y
78CONFIG_SENSORS_LTC2978=y
79CONFIG_SENSORS_LTC2978_REGULATOR=y
88CONFIG_WATCHDOG=y 80CONFIG_WATCHDOG=y
89CONFIG_DW_WATCHDOG=y 81CONFIG_DW_WATCHDOG=y
82CONFIG_REGULATOR=y
83CONFIG_REGULATOR_FIXED_VOLTAGE=y
84CONFIG_USB=y
85CONFIG_USB_DWC2=y
86CONFIG_USB_DWC2_HOST=y
87CONFIG_MMC=y
88CONFIG_MMC_DW=y
90CONFIG_EXT2_FS=y 89CONFIG_EXT2_FS=y
91CONFIG_EXT2_FS_XATTR=y 90CONFIG_EXT2_FS_XATTR=y
92CONFIG_EXT2_FS_POSIX_ACL=y 91CONFIG_EXT2_FS_POSIX_ACL=y
93CONFIG_EXT3_FS=y 92CONFIG_EXT3_FS=y
94CONFIG_NFS_FS=y 93CONFIG_EXT4_FS=y
95CONFIG_ROOT_NFS=y
96# CONFIG_DNOTIFY is not set
97# CONFIG_INOTIFY_USER is not set
98CONFIG_FHANDLE=y
99CONFIG_VFAT_FS=y 94CONFIG_VFAT_FS=y
100CONFIG_NTFS_FS=y 95CONFIG_NTFS_FS=y
101CONFIG_NTFS_RW=y 96CONFIG_NTFS_RW=y
102CONFIG_TMPFS=y 97CONFIG_TMPFS=y
103CONFIG_JFFS2_FS=y 98CONFIG_CONFIGFS_FS=y
99CONFIG_NFS_FS=y
100CONFIG_ROOT_NFS=y
104CONFIG_NLS_CODEPAGE_437=y 101CONFIG_NLS_CODEPAGE_437=y
105CONFIG_NLS_ISO8859_1=y 102CONFIG_NLS_ISO8859_1=y
103CONFIG_PRINTK_TIME=y
104CONFIG_DEBUG_INFO=y
106CONFIG_MAGIC_SYSRQ=y 105CONFIG_MAGIC_SYSRQ=y
107CONFIG_DETECT_HUNG_TASK=y 106CONFIG_DETECT_HUNG_TASK=y
108# CONFIG_SCHED_DEBUG is not set 107# CONFIG_SCHED_DEBUG is not set
109CONFIG_DEBUG_INFO=y
110CONFIG_ENABLE_DEFAULT_TRACERS=y 108CONFIG_ENABLE_DEFAULT_TRACERS=y
111CONFIG_DEBUG_USER=y 109CONFIG_DEBUG_USER=y
112CONFIG_XZ_DEC=y 110CONFIG_XZ_DEC=y
113CONFIG_I2C=y
114CONFIG_I2C_DESIGNWARE_CORE=y
115CONFIG_I2C_DESIGNWARE_PLATFORM=y
116CONFIG_I2C_CHARDEV=y
117CONFIG_MMC=y
118CONFIG_MMC_DW=y
119CONFIG_PM=y
120CONFIG_SUSPEND=y
121CONFIG_MMC_UNSAFE_RESUME=y
122CONFIG_USB=y
123CONFIG_USB_DWC2=y
124CONFIG_USB_DWC2_HOST=y
125CONFIG_USB_DWC2_PLATFORM=y
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index 3aaa75cae90c..705bb7620673 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -412,6 +412,7 @@
412#define __NR_seccomp (__NR_SYSCALL_BASE+383) 412#define __NR_seccomp (__NR_SYSCALL_BASE+383)
413#define __NR_getrandom (__NR_SYSCALL_BASE+384) 413#define __NR_getrandom (__NR_SYSCALL_BASE+384)
414#define __NR_memfd_create (__NR_SYSCALL_BASE+385) 414#define __NR_memfd_create (__NR_SYSCALL_BASE+385)
415#define __NR_bpf (__NR_SYSCALL_BASE+386)
415 416
416/* 417/*
417 * The following SWIs are ARM private. 418 * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 9f899d8fdcca..e51833f8cc38 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -395,6 +395,7 @@
395 CALL(sys_seccomp) 395 CALL(sys_seccomp)
396 CALL(sys_getrandom) 396 CALL(sys_getrandom)
397/* 385 */ CALL(sys_memfd_create) 397/* 385 */ CALL(sys_memfd_create)
398 CALL(sys_bpf)
398#ifndef syscalls_counted 399#ifndef syscalls_counted
399.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 400.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
400#define syscalls_counted 401#define syscalls_counted
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index a17818475050..409637254594 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -58,8 +58,14 @@
58#define PFD_PLL1_BASE (anatop_base + 0x2b0) 58#define PFD_PLL1_BASE (anatop_base + 0x2b0)
59#define PFD_PLL2_BASE (anatop_base + 0x100) 59#define PFD_PLL2_BASE (anatop_base + 0x100)
60#define PFD_PLL3_BASE (anatop_base + 0xf0) 60#define PFD_PLL3_BASE (anatop_base + 0xf0)
61#define PLL1_CTRL (anatop_base + 0x270)
62#define PLL2_CTRL (anatop_base + 0x30)
61#define PLL3_CTRL (anatop_base + 0x10) 63#define PLL3_CTRL (anatop_base + 0x10)
64#define PLL4_CTRL (anatop_base + 0x70)
65#define PLL5_CTRL (anatop_base + 0xe0)
66#define PLL6_CTRL (anatop_base + 0xa0)
62#define PLL7_CTRL (anatop_base + 0x20) 67#define PLL7_CTRL (anatop_base + 0x20)
68#define ANA_MISC1 (anatop_base + 0x160)
63 69
64static void __iomem *anatop_base; 70static void __iomem *anatop_base;
65static void __iomem *ccm_base; 71static void __iomem *ccm_base;
@@ -67,25 +73,34 @@ static void __iomem *ccm_base;
67/* sources for multiplexer clocks, this is used multiple times */ 73/* sources for multiplexer clocks, this is used multiple times */
68static const char *fast_sels[] = { "firc", "fxosc", }; 74static const char *fast_sels[] = { "firc", "fxosc", };
69static const char *slow_sels[] = { "sirc_32k", "sxosc", }; 75static const char *slow_sels[] = { "sirc_32k", "sxosc", };
70static const char *pll1_sels[] = { "pll1_main", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", }; 76static const char *pll1_sels[] = { "pll1_sys", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", };
71static const char *pll2_sels[] = { "pll2_main", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", }; 77static const char *pll2_sels[] = { "pll2_bus", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", };
72static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_main", "pll1_pfd_sel", "pll3_main", }; 78static const char *pll_bypass_src_sels[] = { "fast_clk_sel", "lvds1_in", };
79static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", };
80static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", };
81static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
82static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", };
83static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", };
84static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", };
85static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", };
86static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_bus", "pll1_pfd_sel", "pll3_usb_otg", };
73static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", }; 87static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", };
74static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", }; 88static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", };
75static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", }; 89static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", };
76static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; 90static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_audio_div", };
77static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; 91static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_audio_div", };
78static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", }; 92static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", };
79static const char *qspi_sels[] = { "pll3_main", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", }; 93static const char *qspi_sels[] = { "pll3_usb_otg", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", };
80static const char *esdhc_sels[] = { "pll3_main", "pll3_pfd3", "pll1_pfd3", "platform_bus", }; 94static const char *esdhc_sels[] = { "pll3_usb_otg", "pll3_pfd3", "pll1_pfd3", "platform_bus", };
81static const char *dcu_sels[] = { "pll1_pfd2", "pll3_main", }; 95static const char *dcu_sels[] = { "pll1_pfd2", "pll3_usb_otg", };
82static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", }; 96static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", };
83static const char *vadc_sels[] = { "pll6_main_div", "pll3_main_div", "pll3_main", }; 97static const char *vadc_sels[] = { "pll6_video_div", "pll3_usb_otg_div", "pll3_usb_otg", };
84/* FTM counter clock source, not module clock */ 98/* FTM counter clock source, not module clock */
85static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", }; 99static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", };
86static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", }; 100static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", };
87 101
88static struct clk_div_table pll4_main_div_table[] = { 102
103static struct clk_div_table pll4_audio_div_table[] = {
89 { .val = 0, .div = 1 }, 104 { .val = 0, .div = 1 },
90 { .val = 1, .div = 2 }, 105 { .val = 1, .div = 2 },
91 { .val = 2, .div = 6 }, 106 { .val = 2, .div = 6 },
@@ -120,6 +135,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
120 clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0); 135 clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0);
121 clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0); 136 clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0);
122 137
138 /* Clock source from external clock via LVDs PAD */
139 clk[VF610_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0);
140
123 clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2); 141 clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2);
124 142
125 np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop"); 143 np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop");
@@ -133,31 +151,63 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
133 clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels)); 151 clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels));
134 clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels)); 152 clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels));
135 153
136 clk[VF610_CLK_PLL1_MAIN] = imx_clk_fixed_factor("pll1_main", "fast_clk_sel", 22, 1); 154 clk[VF610_CLK_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", PLL1_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
137 clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_main", PFD_PLL1_BASE, 0); 155 clk[VF610_CLK_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", PLL2_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
138 clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_main", PFD_PLL1_BASE, 1); 156 clk[VF610_CLK_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", PLL3_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
139 clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_main", PFD_PLL1_BASE, 2); 157 clk[VF610_CLK_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", PLL4_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
140 clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_main", PFD_PLL1_BASE, 3); 158 clk[VF610_CLK_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", PLL5_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
141 159 clk[VF610_CLK_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", PLL6_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
142 clk[VF610_CLK_PLL2_MAIN] = imx_clk_fixed_factor("pll2_main", "fast_clk_sel", 22, 1); 160 clk[VF610_CLK_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", PLL7_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
143 clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_main", PFD_PLL2_BASE, 0); 161
144 clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_main", PFD_PLL2_BASE, 1); 162 clk[VF610_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1);
145 clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_main", PFD_PLL2_BASE, 2); 163 clk[VF610_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1);
146 clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_main", PFD_PLL2_BASE, 3); 164 clk[VF610_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", PLL3_CTRL, 0x1);
147 165 clk[VF610_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", PLL4_CTRL, 0x7f);
148 clk[VF610_CLK_PLL3_MAIN] = imx_clk_fixed_factor("pll3_main", "fast_clk_sel", 20, 1); 166 clk[VF610_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll5", "pll5_bypass_src", PLL5_CTRL, 0x3);
149 clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_main", PFD_PLL3_BASE, 0); 167 clk[VF610_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_AV, "pll6", "pll6_bypass_src", PLL6_CTRL, 0x7f);
150 clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_main", PFD_PLL3_BASE, 1); 168 clk[VF610_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", PLL7_CTRL, 0x1);
151 clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_main", PFD_PLL3_BASE, 2); 169
152 clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_main", PFD_PLL3_BASE, 3); 170 clk[VF610_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", PLL1_CTRL, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT);
153 171 clk[VF610_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", PLL2_CTRL, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT);
154 clk[VF610_CLK_PLL4_MAIN] = imx_clk_fixed_factor("pll4_main", "fast_clk_sel", 25, 1); 172 clk[VF610_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", PLL3_CTRL, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT);
155 /* Enet pll: fixed 50Mhz */ 173 clk[VF610_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", PLL4_CTRL, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT);
156 clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6); 174 clk[VF610_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", PLL5_CTRL, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT);
157 /* pll6: default 960Mhz */ 175 clk[VF610_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", PLL6_CTRL, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT);
158 clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1); 176 clk[VF610_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", PLL7_CTRL, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT);
159 /* pll7: USB1 PLL at 480MHz */ 177
160 clk[VF610_CLK_PLL7_MAIN] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_main", "fast_clk_sel", PLL7_CTRL, 0x2); 178 /* Do not bypass PLLs initially */
179 clk_set_parent(clk[VF610_PLL1_BYPASS], clk[VF610_CLK_PLL1]);
180 clk_set_parent(clk[VF610_PLL2_BYPASS], clk[VF610_CLK_PLL2]);
181 clk_set_parent(clk[VF610_PLL3_BYPASS], clk[VF610_CLK_PLL3]);
182 clk_set_parent(clk[VF610_PLL4_BYPASS], clk[VF610_CLK_PLL4]);
183 clk_set_parent(clk[VF610_PLL5_BYPASS], clk[VF610_CLK_PLL5]);
184 clk_set_parent(clk[VF610_PLL6_BYPASS], clk[VF610_CLK_PLL6]);
185 clk_set_parent(clk[VF610_PLL7_BYPASS], clk[VF610_CLK_PLL7]);
186
187 clk[VF610_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", PLL1_CTRL, 13);
188 clk[VF610_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", PLL2_CTRL, 13);
189 clk[VF610_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", PLL3_CTRL, 13);
190 clk[VF610_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", PLL4_CTRL, 13);
191 clk[VF610_CLK_PLL5_ENET] = imx_clk_gate("pll5_enet", "pll5_bypass", PLL5_CTRL, 13);
192 clk[VF610_CLK_PLL6_VIDEO] = imx_clk_gate("pll6_video", "pll6_bypass", PLL6_CTRL, 13);
193 clk[VF610_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", PLL7_CTRL, 13);
194
195 clk[VF610_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", ANA_MISC1, 12, BIT(10));
196
197 clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_sys", PFD_PLL1_BASE, 0);
198 clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_sys", PFD_PLL1_BASE, 1);
199 clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_sys", PFD_PLL1_BASE, 2);
200 clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_sys", PFD_PLL1_BASE, 3);
201
202 clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_bus", PFD_PLL2_BASE, 0);
203 clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_bus", PFD_PLL2_BASE, 1);
204 clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_bus", PFD_PLL2_BASE, 2);
205 clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_bus", PFD_PLL2_BASE, 3);
206
207 clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_usb_otg", PFD_PLL3_BASE, 0);
208 clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_usb_otg", PFD_PLL3_BASE, 1);
209 clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_usb_otg", PFD_PLL3_BASE, 2);
210 clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_usb_otg", PFD_PLL3_BASE, 3);
161 211
162 clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5); 212 clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5);
163 clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5); 213 clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5);
@@ -167,12 +217,12 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
167 clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3); 217 clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3);
168 clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2); 218 clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2);
169 219
170 clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_main_div", "pll3_main", CCM_CACRR, 20, 1); 220 clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_usb_otg_div", "pll3_usb_otg", CCM_CACRR, 20, 1);
171 clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock); 221 clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_audio_div", "pll4_audio", 0, CCM_CACRR, 6, 3, 0, pll4_audio_div_table, &imx_ccm_lock);
172 clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1); 222 clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_video_div", "pll6_video", CCM_CACRR, 21, 1);
173 223
174 clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_main", PLL3_CTRL, 6); 224 clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_usb_otg", PLL3_CTRL, 6);
175 clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_main", PLL7_CTRL, 6); 225 clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_usb_host", PLL7_CTRL, 6);
176 226
177 clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4)); 227 clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4));
178 clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4)); 228 clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4));
@@ -191,8 +241,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
191 clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1); 241 clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1);
192 clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4)); 242 clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4));
193 243
194 clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_main", 1, 10); 244 clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_enet", 1, 10);
195 clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_main", 1, 20); 245 clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_enet", 1, 20);
196 clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4); 246 clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4);
197 clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7); 247 clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7);
198 clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24); 248 clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24);
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 559c69a47731..7d11979da030 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -76,7 +76,7 @@ static inline void __indirect_writeb(u8 value, volatile void __iomem *p)
76 u32 n, byte_enables, data; 76 u32 n, byte_enables, data;
77 77
78 if (!is_pci_memory(addr)) { 78 if (!is_pci_memory(addr)) {
79 __raw_writeb(value, addr); 79 __raw_writeb(value, p);
80 return; 80 return;
81 } 81 }
82 82
@@ -141,7 +141,7 @@ static inline unsigned char __indirect_readb(const volatile void __iomem *p)
141 u32 n, byte_enables, data; 141 u32 n, byte_enables, data;
142 142
143 if (!is_pci_memory(addr)) 143 if (!is_pci_memory(addr))
144 return __raw_readb(addr); 144 return __raw_readb(p);
145 145
146 n = addr % 4; 146 n = addr % 4;
147 byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; 147 byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index d22c30d3ccfa..8c58b71c2727 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -917,6 +917,10 @@ static int __init omap_device_late_idle(struct device *dev, void *data)
917static int __init omap_device_late_init(void) 917static int __init omap_device_late_init(void)
918{ 918{
919 bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle); 919 bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle);
920
921 WARN(!of_have_populated_dt(),
922 "legacy booting deprecated, please update to boot with .dts\n");
923
920 return 0; 924 return 0;
921} 925}
922omap_late_initcall_sync(omap_device_late_init); 926omap_late_initcall_sync(omap_device_late_init);
diff --git a/arch/arm/mach-pxa/include/mach/addr-map.h b/arch/arm/mach-pxa/include/mach/addr-map.h
index bbf9df37ad4b..d28fe291233a 100644
--- a/arch/arm/mach-pxa/include/mach/addr-map.h
+++ b/arch/arm/mach-pxa/include/mach/addr-map.h
@@ -39,6 +39,11 @@
39#define DMEMC_SIZE 0x00100000 39#define DMEMC_SIZE 0x00100000
40 40
41/* 41/*
42 * Reserved space for low level debug virtual addresses within
43 * 0xf6200000..0xf6201000
44 */
45
46/*
42 * Internal Memory Controller (PXA27x and later) 47 * Internal Memory Controller (PXA27x and later)
43 */ 48 */
44#define IMEMC_PHYS 0x58000000 49#define IMEMC_PHYS 0x58000000
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 55f9d6e0cc88..5e65ca8dea62 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -956,7 +956,7 @@ static u32 cache_id_part_number_from_dt;
956 * @associativity: variable to return the calculated associativity in 956 * @associativity: variable to return the calculated associativity in
957 * @max_way_size: the maximum size in bytes for the cache ways 957 * @max_way_size: the maximum size in bytes for the cache ways
958 */ 958 */
959static void __init l2x0_cache_size_of_parse(const struct device_node *np, 959static int __init l2x0_cache_size_of_parse(const struct device_node *np,
960 u32 *aux_val, u32 *aux_mask, 960 u32 *aux_val, u32 *aux_mask,
961 u32 *associativity, 961 u32 *associativity,
962 u32 max_way_size) 962 u32 max_way_size)
@@ -974,7 +974,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np,
974 of_property_read_u32(np, "cache-line-size", &line_size); 974 of_property_read_u32(np, "cache-line-size", &line_size);
975 975
976 if (!cache_size || !sets) 976 if (!cache_size || !sets)
977 return; 977 return -ENODEV;
978 978
979 /* All these l2 caches have the same line = block size actually */ 979 /* All these l2 caches have the same line = block size actually */
980 if (!line_size) { 980 if (!line_size) {
@@ -1009,7 +1009,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np,
1009 1009
1010 if (way_size > max_way_size) { 1010 if (way_size > max_way_size) {
1011 pr_err("L2C OF: set size %dKB is too large\n", way_size); 1011 pr_err("L2C OF: set size %dKB is too large\n", way_size);
1012 return; 1012 return -EINVAL;
1013 } 1013 }
1014 1014
1015 pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", 1015 pr_info("L2C OF: override cache size: %d bytes (%dKB)\n",
@@ -1027,7 +1027,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np,
1027 if (way_size_bits < 1 || way_size_bits > 6) { 1027 if (way_size_bits < 1 || way_size_bits > 6) {
1028 pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", 1028 pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n",
1029 way_size); 1029 way_size);
1030 return; 1030 return -EINVAL;
1031 } 1031 }
1032 1032
1033 mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; 1033 mask |= L2C_AUX_CTRL_WAY_SIZE_MASK;
@@ -1036,6 +1036,8 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np,
1036 *aux_val &= ~mask; 1036 *aux_val &= ~mask;
1037 *aux_val |= val; 1037 *aux_val |= val;
1038 *aux_mask &= ~mask; 1038 *aux_mask &= ~mask;
1039
1040 return 0;
1039} 1041}
1040 1042
1041static void __init l2x0_of_parse(const struct device_node *np, 1043static void __init l2x0_of_parse(const struct device_node *np,
@@ -1046,6 +1048,7 @@ static void __init l2x0_of_parse(const struct device_node *np,
1046 u32 dirty = 0; 1048 u32 dirty = 0;
1047 u32 val = 0, mask = 0; 1049 u32 val = 0, mask = 0;
1048 u32 assoc; 1050 u32 assoc;
1051 int ret;
1049 1052
1050 of_property_read_u32(np, "arm,tag-latency", &tag); 1053 of_property_read_u32(np, "arm,tag-latency", &tag);
1051 if (tag) { 1054 if (tag) {
@@ -1068,7 +1071,10 @@ static void __init l2x0_of_parse(const struct device_node *np,
1068 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; 1071 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
1069 } 1072 }
1070 1073
1071 l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); 1074 ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K);
1075 if (ret)
1076 return;
1077
1072 if (assoc > 8) { 1078 if (assoc > 8) {
1073 pr_err("l2x0 of: cache setting yield too high associativity\n"); 1079 pr_err("l2x0 of: cache setting yield too high associativity\n");
1074 pr_err("l2x0 of: %d calculated, max 8\n", assoc); 1080 pr_err("l2x0 of: %d calculated, max 8\n", assoc);
@@ -1125,6 +1131,7 @@ static void __init l2c310_of_parse(const struct device_node *np,
1125 u32 tag[3] = { 0, 0, 0 }; 1131 u32 tag[3] = { 0, 0, 0 };
1126 u32 filter[2] = { 0, 0 }; 1132 u32 filter[2] = { 0, 0 };
1127 u32 assoc; 1133 u32 assoc;
1134 int ret;
1128 1135
1129 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); 1136 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
1130 if (tag[0] && tag[1] && tag[2]) 1137 if (tag[0] && tag[1] && tag[2])
@@ -1152,7 +1159,10 @@ static void __init l2c310_of_parse(const struct device_node *np,
1152 l2x0_base + L310_ADDR_FILTER_START); 1159 l2x0_base + L310_ADDR_FILTER_START);
1153 } 1160 }
1154 1161
1155 l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); 1162 ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K);
1163 if (ret)
1164 return;
1165
1156 switch (assoc) { 1166 switch (assoc) {
1157 case 16: 1167 case 16:
1158 *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; 1168 *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
@@ -1164,8 +1174,8 @@ static void __init l2c310_of_parse(const struct device_node *np,
1164 *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; 1174 *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
1165 break; 1175 break;
1166 default: 1176 default:
1167 pr_err("PL310 OF: cache setting yield illegal associativity\n"); 1177 pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n",
1168 pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc); 1178 assoc);
1169 break; 1179 break;
1170 } 1180 }
1171} 1181}
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c245d903927f..e8907117861e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1198,7 +1198,6 @@ __iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot,
1198{ 1198{
1199 return dma_common_pages_remap(pages, size, 1199 return dma_common_pages_remap(pages, size,
1200 VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller); 1200 VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller);
1201 return NULL;
1202} 1201}
1203 1202
1204/* 1203/*
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index 45aeaaca9052..e17ed00828d7 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -127,8 +127,11 @@ void *kmap_atomic_pfn(unsigned long pfn)
127{ 127{
128 unsigned long vaddr; 128 unsigned long vaddr;
129 int idx, type; 129 int idx, type;
130 struct page *page = pfn_to_page(pfn);
130 131
131 pagefault_disable(); 132 pagefault_disable();
133 if (!PageHighMem(page))
134 return page_address(page);
132 135
133 type = kmap_atomic_idx_push(); 136 type = kmap_atomic_idx_push();
134 idx = type + KM_TYPE_NR * smp_processor_id(); 137 idx = type + KM_TYPE_NR * smp_processor_id();
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 4ce602c2c6de..dd301be89ecc 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -35,6 +35,9 @@ CONFIG_MODULE_UNLOAD=y
35CONFIG_ARCH_THUNDER=y 35CONFIG_ARCH_THUNDER=y
36CONFIG_ARCH_VEXPRESS=y 36CONFIG_ARCH_VEXPRESS=y
37CONFIG_ARCH_XGENE=y 37CONFIG_ARCH_XGENE=y
38CONFIG_PCI=y
39CONFIG_PCI_MSI=y
40CONFIG_PCI_XGENE=y
38CONFIG_SMP=y 41CONFIG_SMP=y
39CONFIG_PREEMPT=y 42CONFIG_PREEMPT=y
40CONFIG_KSM=y 43CONFIG_KSM=y
@@ -52,6 +55,7 @@ CONFIG_IP_PNP_DHCP=y
52CONFIG_IP_PNP_BOOTP=y 55CONFIG_IP_PNP_BOOTP=y
53# CONFIG_INET_LRO is not set 56# CONFIG_INET_LRO is not set
54# CONFIG_IPV6 is not set 57# CONFIG_IPV6 is not set
58CONFIG_BPF_JIT=y
55# CONFIG_WIRELESS is not set 59# CONFIG_WIRELESS is not set
56CONFIG_NET_9P=y 60CONFIG_NET_9P=y
57CONFIG_NET_9P_VIRTIO=y 61CONFIG_NET_9P_VIRTIO=y
@@ -65,16 +69,17 @@ CONFIG_VIRTIO_BLK=y
65CONFIG_BLK_DEV_SD=y 69CONFIG_BLK_DEV_SD=y
66# CONFIG_SCSI_LOWLEVEL is not set 70# CONFIG_SCSI_LOWLEVEL is not set
67CONFIG_ATA=y 71CONFIG_ATA=y
72CONFIG_SATA_AHCI=y
73CONFIG_SATA_AHCI_PLATFORM=y
68CONFIG_AHCI_XGENE=y 74CONFIG_AHCI_XGENE=y
69CONFIG_PHY_XGENE=y
70CONFIG_PATA_PLATFORM=y 75CONFIG_PATA_PLATFORM=y
71CONFIG_PATA_OF_PLATFORM=y 76CONFIG_PATA_OF_PLATFORM=y
72CONFIG_NETDEVICES=y 77CONFIG_NETDEVICES=y
73CONFIG_TUN=y 78CONFIG_TUN=y
74CONFIG_VIRTIO_NET=y 79CONFIG_VIRTIO_NET=y
80CONFIG_NET_XGENE=y
75CONFIG_SMC91X=y 81CONFIG_SMC91X=y
76CONFIG_SMSC911X=y 82CONFIG_SMSC911X=y
77CONFIG_NET_XGENE=y
78# CONFIG_WLAN is not set 83# CONFIG_WLAN is not set
79CONFIG_INPUT_EVDEV=y 84CONFIG_INPUT_EVDEV=y
80# CONFIG_SERIO_SERPORT is not set 85# CONFIG_SERIO_SERPORT is not set
@@ -87,6 +92,11 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
87CONFIG_SERIAL_OF_PLATFORM=y 92CONFIG_SERIAL_OF_PLATFORM=y
88CONFIG_VIRTIO_CONSOLE=y 93CONFIG_VIRTIO_CONSOLE=y
89# CONFIG_HW_RANDOM is not set 94# CONFIG_HW_RANDOM is not set
95# CONFIG_HMC_DRV is not set
96CONFIG_SPI=y
97CONFIG_SPI_PL022=y
98CONFIG_GPIO_PL061=y
99CONFIG_GPIO_XGENE=y
90# CONFIG_HWMON is not set 100# CONFIG_HWMON is not set
91CONFIG_REGULATOR=y 101CONFIG_REGULATOR=y
92CONFIG_REGULATOR_FIXED_VOLTAGE=y 102CONFIG_REGULATOR_FIXED_VOLTAGE=y
@@ -97,13 +107,25 @@ CONFIG_LOGO=y
97# CONFIG_LOGO_LINUX_MONO is not set 107# CONFIG_LOGO_LINUX_MONO is not set
98# CONFIG_LOGO_LINUX_VGA16 is not set 108# CONFIG_LOGO_LINUX_VGA16 is not set
99CONFIG_USB=y 109CONFIG_USB=y
110CONFIG_USB_EHCI_HCD=y
111CONFIG_USB_EHCI_HCD_PLATFORM=y
100CONFIG_USB_ISP1760_HCD=y 112CONFIG_USB_ISP1760_HCD=y
113CONFIG_USB_OHCI_HCD=y
114CONFIG_USB_OHCI_HCD_PLATFORM=y
101CONFIG_USB_STORAGE=y 115CONFIG_USB_STORAGE=y
116CONFIG_USB_ULPI=y
102CONFIG_MMC=y 117CONFIG_MMC=y
103CONFIG_MMC_ARMMMCI=y 118CONFIG_MMC_ARMMMCI=y
119CONFIG_MMC_SDHCI=y
120CONFIG_MMC_SDHCI_PLTFM=y
121CONFIG_MMC_SPI=y
122CONFIG_RTC_CLASS=y
123CONFIG_RTC_DRV_EFI=y
124CONFIG_RTC_DRV_XGENE=y
104CONFIG_VIRTIO_BALLOON=y 125CONFIG_VIRTIO_BALLOON=y
105CONFIG_VIRTIO_MMIO=y 126CONFIG_VIRTIO_MMIO=y
106# CONFIG_IOMMU_SUPPORT is not set 127# CONFIG_IOMMU_SUPPORT is not set
128CONFIG_PHY_XGENE=y
107CONFIG_EXT2_FS=y 129CONFIG_EXT2_FS=y
108CONFIG_EXT3_FS=y 130CONFIG_EXT3_FS=y
109# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 131# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index da1f06b535e3..9dfdac4a74a1 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -792,3 +792,5 @@ __SYSCALL(__NR_renameat2, sys_renameat2)
792__SYSCALL(__NR_getrandom, sys_getrandom) 792__SYSCALL(__NR_getrandom, sys_getrandom)
793#define __NR_memfd_create 385 793#define __NR_memfd_create 385
794__SYSCALL(__NR_memfd_create, sys_memfd_create) 794__SYSCALL(__NR_memfd_create, sys_memfd_create)
795#define __NR_bpf 386
796__SYSCALL(__NR_bpf, sys_bpf)
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 866c1c821860..663da771580a 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -528,7 +528,7 @@ static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
528 if (WARN_ON_ONCE(!index)) 528 if (WARN_ON_ONCE(!index))
529 return -EINVAL; 529 return -EINVAL;
530 530
531 if (state->type == PSCI_POWER_STATE_TYPE_STANDBY) 531 if (state[index - 1].type == PSCI_POWER_STATE_TYPE_STANDBY)
532 ret = psci_ops.cpu_suspend(state[index - 1], 0); 532 ret = psci_ops.cpu_suspend(state[index - 1], 0);
533 else 533 else
534 ret = __cpu_suspend(index, psci_suspend_finisher); 534 ret = __cpu_suspend(index, psci_suspend_finisher);
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 4ef7a54813e6..75e75d7b1702 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -4,7 +4,7 @@
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 354 7#define NR_syscalls 355
8 8
9#define __ARCH_WANT_OLD_READDIR 9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT 10#define __ARCH_WANT_OLD_STAT
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h
index b419c6b7ac37..2c1bec9a14b6 100644
--- a/arch/m68k/include/uapi/asm/unistd.h
+++ b/arch/m68k/include/uapi/asm/unistd.h
@@ -359,5 +359,6 @@
359#define __NR_renameat2 351 359#define __NR_renameat2 351
360#define __NR_getrandom 352 360#define __NR_getrandom 352
361#define __NR_memfd_create 353 361#define __NR_memfd_create 353
362#define __NR_bpf 354
362 363
363#endif /* _UAPI_ASM_M68K_UNISTD_H_ */ 364#endif /* _UAPI_ASM_M68K_UNISTD_H_ */
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index 05b46c2b08b8..2ca219e184cd 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -374,4 +374,5 @@ ENTRY(sys_call_table)
374 .long sys_renameat2 374 .long sys_renameat2
375 .long sys_getrandom 375 .long sys_getrandom
376 .long sys_memfd_create 376 .long sys_memfd_create
377 .long sys_bpf
377 378
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 23cb94806fbc..58076472bdd8 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -93,6 +93,15 @@ LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
93KBUILD_AFLAGS_MODULE += -mlong-calls 93KBUILD_AFLAGS_MODULE += -mlong-calls
94KBUILD_CFLAGS_MODULE += -mlong-calls 94KBUILD_CFLAGS_MODULE += -mlong-calls
95 95
96#
97# pass -msoft-float to GAS if it supports it. However on newer binutils
98# (specifically newer than 2.24.51.20140728) we then also need to explicitly
99# set ".set hardfloat" in all files which manipulate floating point registers.
100#
101ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
102 cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
103endif
104
96cflags-y += -ffreestanding 105cflags-y += -ffreestanding
97 106
98# 107#
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 741734049675..2bc4aa95944e 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -809,6 +809,7 @@ static struct irq_chip octeon_irq_chip_ciu_gpio_v2 = {
809 .irq_set_type = octeon_irq_ciu_gpio_set_type, 809 .irq_set_type = octeon_irq_ciu_gpio_set_type,
810#ifdef CONFIG_SMP 810#ifdef CONFIG_SMP
811 .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, 811 .irq_set_affinity = octeon_irq_ciu_set_affinity_v2,
812 .irq_cpu_offline = octeon_irq_cpu_offline_ciu,
812#endif 813#endif
813 .flags = IRQCHIP_SET_TYPE_MASKED, 814 .flags = IRQCHIP_SET_TYPE_MASKED,
814}; 815};
@@ -823,6 +824,7 @@ static struct irq_chip octeon_irq_chip_ciu_gpio = {
823 .irq_set_type = octeon_irq_ciu_gpio_set_type, 824 .irq_set_type = octeon_irq_ciu_gpio_set_type,
824#ifdef CONFIG_SMP 825#ifdef CONFIG_SMP
825 .irq_set_affinity = octeon_irq_ciu_set_affinity, 826 .irq_set_affinity = octeon_irq_ciu_set_affinity,
827 .irq_cpu_offline = octeon_irq_cpu_offline_ciu,
826#endif 828#endif
827 .flags = IRQCHIP_SET_TYPE_MASKED, 829 .flags = IRQCHIP_SET_TYPE_MASKED,
828}; 830};
diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h
index e38c2811d4e2..cdac7b3eeaf7 100644
--- a/arch/mips/include/asm/asmmacro-32.h
+++ b/arch/mips/include/asm/asmmacro-32.h
@@ -13,6 +13,8 @@
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14 14
15 .macro fpu_save_single thread tmp=t0 15 .macro fpu_save_single thread tmp=t0
16 .set push
17 SET_HARDFLOAT
16 cfc1 \tmp, fcr31 18 cfc1 \tmp, fcr31
17 swc1 $f0, THREAD_FPR0_LS64(\thread) 19 swc1 $f0, THREAD_FPR0_LS64(\thread)
18 swc1 $f1, THREAD_FPR1_LS64(\thread) 20 swc1 $f1, THREAD_FPR1_LS64(\thread)
@@ -47,9 +49,12 @@
47 swc1 $f30, THREAD_FPR30_LS64(\thread) 49 swc1 $f30, THREAD_FPR30_LS64(\thread)
48 swc1 $f31, THREAD_FPR31_LS64(\thread) 50 swc1 $f31, THREAD_FPR31_LS64(\thread)
49 sw \tmp, THREAD_FCR31(\thread) 51 sw \tmp, THREAD_FCR31(\thread)
52 .set pop
50 .endm 53 .endm
51 54
52 .macro fpu_restore_single thread tmp=t0 55 .macro fpu_restore_single thread tmp=t0
56 .set push
57 SET_HARDFLOAT
53 lw \tmp, THREAD_FCR31(\thread) 58 lw \tmp, THREAD_FCR31(\thread)
54 lwc1 $f0, THREAD_FPR0_LS64(\thread) 59 lwc1 $f0, THREAD_FPR0_LS64(\thread)
55 lwc1 $f1, THREAD_FPR1_LS64(\thread) 60 lwc1 $f1, THREAD_FPR1_LS64(\thread)
@@ -84,6 +89,7 @@
84 lwc1 $f30, THREAD_FPR30_LS64(\thread) 89 lwc1 $f30, THREAD_FPR30_LS64(\thread)
85 lwc1 $f31, THREAD_FPR31_LS64(\thread) 90 lwc1 $f31, THREAD_FPR31_LS64(\thread)
86 ctc1 \tmp, fcr31 91 ctc1 \tmp, fcr31
92 .set pop
87 .endm 93 .endm
88 94
89 .macro cpu_save_nonscratch thread 95 .macro cpu_save_nonscratch thread
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index cd9a98bc8f60..6caf8766b80f 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -57,6 +57,8 @@
57#endif /* CONFIG_CPU_MIPSR2 */ 57#endif /* CONFIG_CPU_MIPSR2 */
58 58
59 .macro fpu_save_16even thread tmp=t0 59 .macro fpu_save_16even thread tmp=t0
60 .set push
61 SET_HARDFLOAT
60 cfc1 \tmp, fcr31 62 cfc1 \tmp, fcr31
61 sdc1 $f0, THREAD_FPR0_LS64(\thread) 63 sdc1 $f0, THREAD_FPR0_LS64(\thread)
62 sdc1 $f2, THREAD_FPR2_LS64(\thread) 64 sdc1 $f2, THREAD_FPR2_LS64(\thread)
@@ -75,11 +77,13 @@
75 sdc1 $f28, THREAD_FPR28_LS64(\thread) 77 sdc1 $f28, THREAD_FPR28_LS64(\thread)
76 sdc1 $f30, THREAD_FPR30_LS64(\thread) 78 sdc1 $f30, THREAD_FPR30_LS64(\thread)
77 sw \tmp, THREAD_FCR31(\thread) 79 sw \tmp, THREAD_FCR31(\thread)
80 .set pop
78 .endm 81 .endm
79 82
80 .macro fpu_save_16odd thread 83 .macro fpu_save_16odd thread
81 .set push 84 .set push
82 .set mips64r2 85 .set mips64r2
86 SET_HARDFLOAT
83 sdc1 $f1, THREAD_FPR1_LS64(\thread) 87 sdc1 $f1, THREAD_FPR1_LS64(\thread)
84 sdc1 $f3, THREAD_FPR3_LS64(\thread) 88 sdc1 $f3, THREAD_FPR3_LS64(\thread)
85 sdc1 $f5, THREAD_FPR5_LS64(\thread) 89 sdc1 $f5, THREAD_FPR5_LS64(\thread)
@@ -110,6 +114,8 @@
110 .endm 114 .endm
111 115
112 .macro fpu_restore_16even thread tmp=t0 116 .macro fpu_restore_16even thread tmp=t0
117 .set push
118 SET_HARDFLOAT
113 lw \tmp, THREAD_FCR31(\thread) 119 lw \tmp, THREAD_FCR31(\thread)
114 ldc1 $f0, THREAD_FPR0_LS64(\thread) 120 ldc1 $f0, THREAD_FPR0_LS64(\thread)
115 ldc1 $f2, THREAD_FPR2_LS64(\thread) 121 ldc1 $f2, THREAD_FPR2_LS64(\thread)
@@ -133,6 +139,7 @@
133 .macro fpu_restore_16odd thread 139 .macro fpu_restore_16odd thread
134 .set push 140 .set push
135 .set mips64r2 141 .set mips64r2
142 SET_HARDFLOAT
136 ldc1 $f1, THREAD_FPR1_LS64(\thread) 143 ldc1 $f1, THREAD_FPR1_LS64(\thread)
137 ldc1 $f3, THREAD_FPR3_LS64(\thread) 144 ldc1 $f3, THREAD_FPR3_LS64(\thread)
138 ldc1 $f5, THREAD_FPR5_LS64(\thread) 145 ldc1 $f5, THREAD_FPR5_LS64(\thread)
@@ -277,6 +284,7 @@
277 .macro cfcmsa rd, cs 284 .macro cfcmsa rd, cs
278 .set push 285 .set push
279 .set noat 286 .set noat
287 SET_HARDFLOAT
280 .insn 288 .insn
281 .word CFC_MSA_INSN | (\cs << 11) 289 .word CFC_MSA_INSN | (\cs << 11)
282 move \rd, $1 290 move \rd, $1
@@ -286,6 +294,7 @@
286 .macro ctcmsa cd, rs 294 .macro ctcmsa cd, rs
287 .set push 295 .set push
288 .set noat 296 .set noat
297 SET_HARDFLOAT
289 move $1, \rs 298 move $1, \rs
290 .word CTC_MSA_INSN | (\cd << 6) 299 .word CTC_MSA_INSN | (\cd << 6)
291 .set pop 300 .set pop
@@ -294,6 +303,7 @@
294 .macro ld_d wd, off, base 303 .macro ld_d wd, off, base
295 .set push 304 .set push
296 .set noat 305 .set noat
306 SET_HARDFLOAT
297 add $1, \base, \off 307 add $1, \base, \off
298 .word LDD_MSA_INSN | (\wd << 6) 308 .word LDD_MSA_INSN | (\wd << 6)
299 .set pop 309 .set pop
@@ -302,6 +312,7 @@
302 .macro st_d wd, off, base 312 .macro st_d wd, off, base
303 .set push 313 .set push
304 .set noat 314 .set noat
315 SET_HARDFLOAT
305 add $1, \base, \off 316 add $1, \base, \off
306 .word STD_MSA_INSN | (\wd << 6) 317 .word STD_MSA_INSN | (\wd << 6)
307 .set pop 318 .set pop
@@ -310,6 +321,7 @@
310 .macro copy_u_w rd, ws, n 321 .macro copy_u_w rd, ws, n
311 .set push 322 .set push
312 .set noat 323 .set noat
324 SET_HARDFLOAT
313 .insn 325 .insn
314 .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) 326 .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11)
315 /* move triggers an assembler bug... */ 327 /* move triggers an assembler bug... */
@@ -320,6 +332,7 @@
320 .macro copy_u_d rd, ws, n 332 .macro copy_u_d rd, ws, n
321 .set push 333 .set push
322 .set noat 334 .set noat
335 SET_HARDFLOAT
323 .insn 336 .insn
324 .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) 337 .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11)
325 /* move triggers an assembler bug... */ 338 /* move triggers an assembler bug... */
@@ -330,6 +343,7 @@
330 .macro insert_w wd, n, rs 343 .macro insert_w wd, n, rs
331 .set push 344 .set push
332 .set noat 345 .set noat
346 SET_HARDFLOAT
333 /* move triggers an assembler bug... */ 347 /* move triggers an assembler bug... */
334 or $1, \rs, zero 348 or $1, \rs, zero
335 .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) 349 .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6)
@@ -339,6 +353,7 @@
339 .macro insert_d wd, n, rs 353 .macro insert_d wd, n, rs
340 .set push 354 .set push
341 .set noat 355 .set noat
356 SET_HARDFLOAT
342 /* move triggers an assembler bug... */ 357 /* move triggers an assembler bug... */
343 or $1, \rs, zero 358 or $1, \rs, zero
344 .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) 359 .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6)
@@ -381,6 +396,7 @@
381 st_d 31, THREAD_FPR31, \thread 396 st_d 31, THREAD_FPR31, \thread
382 .set push 397 .set push
383 .set noat 398 .set noat
399 SET_HARDFLOAT
384 cfcmsa $1, MSA_CSR 400 cfcmsa $1, MSA_CSR
385 sw $1, THREAD_MSA_CSR(\thread) 401 sw $1, THREAD_MSA_CSR(\thread)
386 .set pop 402 .set pop
@@ -389,6 +405,7 @@
389 .macro msa_restore_all thread 405 .macro msa_restore_all thread
390 .set push 406 .set push
391 .set noat 407 .set noat
408 SET_HARDFLOAT
392 lw $1, THREAD_MSA_CSR(\thread) 409 lw $1, THREAD_MSA_CSR(\thread)
393 ctcmsa MSA_CSR, $1 410 ctcmsa MSA_CSR, $1
394 .set pop 411 .set pop
@@ -441,6 +458,7 @@
441 .macro msa_init_all_upper 458 .macro msa_init_all_upper
442 .set push 459 .set push
443 .set noat 460 .set noat
461 SET_HARDFLOAT
444 not $1, zero 462 not $1, zero
445 msa_init_upper 0 463 msa_init_upper 0
446 .set pop 464 .set pop
diff --git a/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h
index 429481f9028d..f184ba088532 100644
--- a/arch/mips/include/asm/fpregdef.h
+++ b/arch/mips/include/asm/fpregdef.h
@@ -14,6 +14,20 @@
14 14
15#include <asm/sgidefs.h> 15#include <asm/sgidefs.h>
16 16
17/*
18 * starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing
19 * hardfloat and softfloat object files. The kernel build uses soft-float by
20 * default, so we also need to pass -msoft-float along to GAS if it supports it.
21 * But this in turn causes assembler errors in files which access hardfloat
22 * registers. We detect if GAS supports "-msoft-float" in the Makefile and
23 * explicitly put ".set hardfloat" where floating point registers are touched.
24 */
25#ifdef GAS_HAS_SET_HARDFLOAT
26#define SET_HARDFLOAT .set hardfloat
27#else
28#define SET_HARDFLOAT
29#endif
30
17#if _MIPS_SIM == _MIPS_SIM_ABI32 31#if _MIPS_SIM == _MIPS_SIM_ABI32
18 32
19/* 33/*
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 4d0aeda68397..dd562414cd5e 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -145,8 +145,8 @@ static inline void lose_fpu(int save)
145 if (is_msa_enabled()) { 145 if (is_msa_enabled()) {
146 if (save) { 146 if (save) {
147 save_msa(current); 147 save_msa(current);
148 asm volatile("cfc1 %0, $31" 148 current->thread.fpu.fcr31 =
149 : "=r"(current->thread.fpu.fcr31)); 149 read_32bit_cp1_register(CP1_STATUS);
150 } 150 }
151 disable_msa(); 151 disable_msa();
152 clear_thread_flag(TIF_USEDMSA); 152 clear_thread_flag(TIF_USEDMSA);
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index cf3b580c3df6..b46cd220a018 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -1324,7 +1324,7 @@ do { \
1324/* 1324/*
1325 * Macros to access the floating point coprocessor control registers 1325 * Macros to access the floating point coprocessor control registers
1326 */ 1326 */
1327#define read_32bit_cp1_register(source) \ 1327#define _read_32bit_cp1_register(source, gas_hardfloat) \
1328({ \ 1328({ \
1329 int __res; \ 1329 int __res; \
1330 \ 1330 \
@@ -1334,12 +1334,21 @@ do { \
1334 " # gas fails to assemble cfc1 for some archs, \n" \ 1334 " # gas fails to assemble cfc1 for some archs, \n" \
1335 " # like Octeon. \n" \ 1335 " # like Octeon. \n" \
1336 " .set mips1 \n" \ 1336 " .set mips1 \n" \
1337 " "STR(gas_hardfloat)" \n" \
1337 " cfc1 %0,"STR(source)" \n" \ 1338 " cfc1 %0,"STR(source)" \n" \
1338 " .set pop \n" \ 1339 " .set pop \n" \
1339 : "=r" (__res)); \ 1340 : "=r" (__res)); \
1340 __res; \ 1341 __res; \
1341}) 1342})
1342 1343
1344#ifdef GAS_HAS_SET_HARDFLOAT
1345#define read_32bit_cp1_register(source) \
1346 _read_32bit_cp1_register(source, .set hardfloat)
1347#else
1348#define read_32bit_cp1_register(source) \
1349 _read_32bit_cp1_register(source, )
1350#endif
1351
1343#ifdef HAVE_AS_DSP 1352#ifdef HAVE_AS_DSP
1344#define rddsp(mask) \ 1353#define rddsp(mask) \
1345({ \ 1354({ \
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index fdb4923777d1..9dc58568f230 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -375,16 +375,17 @@
375#define __NR_seccomp (__NR_Linux + 352) 375#define __NR_seccomp (__NR_Linux + 352)
376#define __NR_getrandom (__NR_Linux + 353) 376#define __NR_getrandom (__NR_Linux + 353)
377#define __NR_memfd_create (__NR_Linux + 354) 377#define __NR_memfd_create (__NR_Linux + 354)
378#define __NR_bpf (__NR_Linux + 355)
378 379
379/* 380/*
380 * Offset of the last Linux o32 flavoured syscall 381 * Offset of the last Linux o32 flavoured syscall
381 */ 382 */
382#define __NR_Linux_syscalls 354 383#define __NR_Linux_syscalls 355
383 384
384#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 385#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
385 386
386#define __NR_O32_Linux 4000 387#define __NR_O32_Linux 4000
387#define __NR_O32_Linux_syscalls 354 388#define __NR_O32_Linux_syscalls 355
388 389
389#if _MIPS_SIM == _MIPS_SIM_ABI64 390#if _MIPS_SIM == _MIPS_SIM_ABI64
390 391
@@ -707,16 +708,17 @@
707#define __NR_seccomp (__NR_Linux + 312) 708#define __NR_seccomp (__NR_Linux + 312)
708#define __NR_getrandom (__NR_Linux + 313) 709#define __NR_getrandom (__NR_Linux + 313)
709#define __NR_memfd_create (__NR_Linux + 314) 710#define __NR_memfd_create (__NR_Linux + 314)
711#define __NR_bpf (__NR_Linux + 315)
710 712
711/* 713/*
712 * Offset of the last Linux 64-bit flavoured syscall 714 * Offset of the last Linux 64-bit flavoured syscall
713 */ 715 */
714#define __NR_Linux_syscalls 314 716#define __NR_Linux_syscalls 315
715 717
716#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 718#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
717 719
718#define __NR_64_Linux 5000 720#define __NR_64_Linux 5000
719#define __NR_64_Linux_syscalls 314 721#define __NR_64_Linux_syscalls 315
720 722
721#if _MIPS_SIM == _MIPS_SIM_NABI32 723#if _MIPS_SIM == _MIPS_SIM_NABI32
722 724
@@ -1043,15 +1045,16 @@
1043#define __NR_seccomp (__NR_Linux + 316) 1045#define __NR_seccomp (__NR_Linux + 316)
1044#define __NR_getrandom (__NR_Linux + 317) 1046#define __NR_getrandom (__NR_Linux + 317)
1045#define __NR_memfd_create (__NR_Linux + 318) 1047#define __NR_memfd_create (__NR_Linux + 318)
1048#define __NR_memfd_create (__NR_Linux + 319)
1046 1049
1047/* 1050/*
1048 * Offset of the last N32 flavoured syscall 1051 * Offset of the last N32 flavoured syscall
1049 */ 1052 */
1050#define __NR_Linux_syscalls 318 1053#define __NR_Linux_syscalls 319
1051 1054
1052#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1055#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1053 1056
1054#define __NR_N32_Linux 6000 1057#define __NR_N32_Linux 6000
1055#define __NR_N32_Linux_syscalls 318 1058#define __NR_N32_Linux_syscalls 319
1056 1059
1057#endif /* _UAPI_ASM_UNISTD_H */ 1060#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 7b2df224f041..4d7d99d601cc 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -144,7 +144,7 @@ int __mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
144 case mm_bc1t_op: 144 case mm_bc1t_op:
145 preempt_disable(); 145 preempt_disable();
146 if (is_fpu_owner()) 146 if (is_fpu_owner())
147 asm volatile("cfc1\t%0,$31" : "=r" (fcr31)); 147 fcr31 = read_32bit_cp1_register(CP1_STATUS);
148 else 148 else
149 fcr31 = current->thread.fpu.fcr31; 149 fcr31 = current->thread.fpu.fcr31;
150 preempt_enable(); 150 preempt_enable();
@@ -562,11 +562,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
562 case cop1_op: 562 case cop1_op:
563 preempt_disable(); 563 preempt_disable();
564 if (is_fpu_owner()) 564 if (is_fpu_owner())
565 asm volatile( 565 fcr31 = read_32bit_cp1_register(CP1_STATUS);
566 ".set push\n"
567 "\t.set mips1\n"
568 "\tcfc1\t%0,$31\n"
569 "\t.set pop" : "=r" (fcr31));
570 else 566 else
571 fcr31 = current->thread.fpu.fcr31; 567 fcr31 = current->thread.fpu.fcr31;
572 preempt_enable(); 568 preempt_enable();
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index ac35e12cb1f3..a5e26dd90592 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -358,6 +358,7 @@ NESTED(nmi_handler, PT_SIZE, sp)
358 .set push 358 .set push
359 /* gas fails to assemble cfc1 for some archs (octeon).*/ \ 359 /* gas fails to assemble cfc1 for some archs (octeon).*/ \
360 .set mips1 360 .set mips1
361 SET_HARDFLOAT
361 cfc1 a1, fcr31 362 cfc1 a1, fcr31
362 li a2, ~(0x3f << 12) 363 li a2, ~(0x3f << 12)
363 and a2, a1 364 and a2, a1
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
index f31063dbdaeb..5ce3b746cedc 100644
--- a/arch/mips/kernel/r2300_fpu.S
+++ b/arch/mips/kernel/r2300_fpu.S
@@ -28,6 +28,8 @@
28 .set mips1 28 .set mips1
29 /* Save floating point context */ 29 /* Save floating point context */
30LEAF(_save_fp_context) 30LEAF(_save_fp_context)
31 .set push
32 SET_HARDFLOAT
31 li v0, 0 # assume success 33 li v0, 0 # assume success
32 cfc1 t1,fcr31 34 cfc1 t1,fcr31
33 EX(swc1 $f0,(SC_FPREGS+0)(a0)) 35 EX(swc1 $f0,(SC_FPREGS+0)(a0))
@@ -65,6 +67,7 @@ LEAF(_save_fp_context)
65 EX(sw t1,(SC_FPC_CSR)(a0)) 67 EX(sw t1,(SC_FPC_CSR)(a0))
66 cfc1 t0,$0 # implementation/version 68 cfc1 t0,$0 # implementation/version
67 jr ra 69 jr ra
70 .set pop
68 .set nomacro 71 .set nomacro
69 EX(sw t0,(SC_FPC_EIR)(a0)) 72 EX(sw t0,(SC_FPC_EIR)(a0))
70 .set macro 73 .set macro
@@ -80,6 +83,8 @@ LEAF(_save_fp_context)
80 * stack frame which might have been changed by the user. 83 * stack frame which might have been changed by the user.
81 */ 84 */
82LEAF(_restore_fp_context) 85LEAF(_restore_fp_context)
86 .set push
87 SET_HARDFLOAT
83 li v0, 0 # assume success 88 li v0, 0 # assume success
84 EX(lw t0,(SC_FPC_CSR)(a0)) 89 EX(lw t0,(SC_FPC_CSR)(a0))
85 EX(lwc1 $f0,(SC_FPREGS+0)(a0)) 90 EX(lwc1 $f0,(SC_FPREGS+0)(a0))
@@ -116,6 +121,7 @@ LEAF(_restore_fp_context)
116 EX(lwc1 $f31,(SC_FPREGS+248)(a0)) 121 EX(lwc1 $f31,(SC_FPREGS+248)(a0))
117 jr ra 122 jr ra
118 ctc1 t0,fcr31 123 ctc1 t0,fcr31
124 .set pop
119 END(_restore_fp_context) 125 END(_restore_fp_context)
120 .set reorder 126 .set reorder
121 127
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 20b7b040e76f..435ea652f5fa 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -120,6 +120,9 @@ LEAF(_restore_fp)
120 120
121#define FPU_DEFAULT 0x00000000 121#define FPU_DEFAULT 0x00000000
122 122
123 .set push
124 SET_HARDFLOAT
125
123LEAF(_init_fpu) 126LEAF(_init_fpu)
124 mfc0 t0, CP0_STATUS 127 mfc0 t0, CP0_STATUS
125 li t1, ST0_CU1 128 li t1, ST0_CU1
@@ -165,3 +168,5 @@ LEAF(_init_fpu)
165 mtc1 t0, $f31 168 mtc1 t0, $f31
166 jr ra 169 jr ra
167 END(_init_fpu) 170 END(_init_fpu)
171
172 .set pop
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 8352523568e6..6c160c67984c 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -19,8 +19,12 @@
19#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/regdef.h> 20#include <asm/regdef.h>
21 21
22/* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */
23#undef fp
24
22 .macro EX insn, reg, src 25 .macro EX insn, reg, src
23 .set push 26 .set push
27 SET_HARDFLOAT
24 .set nomacro 28 .set nomacro
25.ex\@: \insn \reg, \src 29.ex\@: \insn \reg, \src
26 .set pop 30 .set pop
@@ -33,12 +37,17 @@
33 .set arch=r4000 37 .set arch=r4000
34 38
35LEAF(_save_fp_context) 39LEAF(_save_fp_context)
40 .set push
41 SET_HARDFLOAT
36 cfc1 t1, fcr31 42 cfc1 t1, fcr31
43 .set pop
37 44
38#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) 45#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
39 .set push 46 .set push
47 SET_HARDFLOAT
40#ifdef CONFIG_CPU_MIPS32_R2 48#ifdef CONFIG_CPU_MIPS32_R2
41 .set mips64r2 49 .set mips32r2
50 .set fp=64
42 mfc0 t0, CP0_STATUS 51 mfc0 t0, CP0_STATUS
43 sll t0, t0, 5 52 sll t0, t0, 5
44 bgez t0, 1f # skip storing odd if FR=0 53 bgez t0, 1f # skip storing odd if FR=0
@@ -64,6 +73,8 @@ LEAF(_save_fp_context)
641: .set pop 731: .set pop
65#endif 74#endif
66 75
76 .set push
77 SET_HARDFLOAT
67 /* Store the 16 even double precision registers */ 78 /* Store the 16 even double precision registers */
68 EX sdc1 $f0, SC_FPREGS+0(a0) 79 EX sdc1 $f0, SC_FPREGS+0(a0)
69 EX sdc1 $f2, SC_FPREGS+16(a0) 80 EX sdc1 $f2, SC_FPREGS+16(a0)
@@ -84,11 +95,14 @@ LEAF(_save_fp_context)
84 EX sw t1, SC_FPC_CSR(a0) 95 EX sw t1, SC_FPC_CSR(a0)
85 jr ra 96 jr ra
86 li v0, 0 # success 97 li v0, 0 # success
98 .set pop
87 END(_save_fp_context) 99 END(_save_fp_context)
88 100
89#ifdef CONFIG_MIPS32_COMPAT 101#ifdef CONFIG_MIPS32_COMPAT
90 /* Save 32-bit process floating point context */ 102 /* Save 32-bit process floating point context */
91LEAF(_save_fp_context32) 103LEAF(_save_fp_context32)
104 .set push
105 SET_HARDFLOAT
92 cfc1 t1, fcr31 106 cfc1 t1, fcr31
93 107
94 mfc0 t0, CP0_STATUS 108 mfc0 t0, CP0_STATUS
@@ -134,6 +148,7 @@ LEAF(_save_fp_context32)
134 EX sw t1, SC32_FPC_CSR(a0) 148 EX sw t1, SC32_FPC_CSR(a0)
135 cfc1 t0, $0 # implementation/version 149 cfc1 t0, $0 # implementation/version
136 EX sw t0, SC32_FPC_EIR(a0) 150 EX sw t0, SC32_FPC_EIR(a0)
151 .set pop
137 152
138 jr ra 153 jr ra
139 li v0, 0 # success 154 li v0, 0 # success
@@ -150,8 +165,10 @@ LEAF(_restore_fp_context)
150 165
151#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) 166#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
152 .set push 167 .set push
168 SET_HARDFLOAT
153#ifdef CONFIG_CPU_MIPS32_R2 169#ifdef CONFIG_CPU_MIPS32_R2
154 .set mips64r2 170 .set mips32r2
171 .set fp=64
155 mfc0 t0, CP0_STATUS 172 mfc0 t0, CP0_STATUS
156 sll t0, t0, 5 173 sll t0, t0, 5
157 bgez t0, 1f # skip loading odd if FR=0 174 bgez t0, 1f # skip loading odd if FR=0
@@ -175,6 +192,8 @@ LEAF(_restore_fp_context)
175 EX ldc1 $f31, SC_FPREGS+248(a0) 192 EX ldc1 $f31, SC_FPREGS+248(a0)
1761: .set pop 1931: .set pop
177#endif 194#endif
195 .set push
196 SET_HARDFLOAT
178 EX ldc1 $f0, SC_FPREGS+0(a0) 197 EX ldc1 $f0, SC_FPREGS+0(a0)
179 EX ldc1 $f2, SC_FPREGS+16(a0) 198 EX ldc1 $f2, SC_FPREGS+16(a0)
180 EX ldc1 $f4, SC_FPREGS+32(a0) 199 EX ldc1 $f4, SC_FPREGS+32(a0)
@@ -192,6 +211,7 @@ LEAF(_restore_fp_context)
192 EX ldc1 $f28, SC_FPREGS+224(a0) 211 EX ldc1 $f28, SC_FPREGS+224(a0)
193 EX ldc1 $f30, SC_FPREGS+240(a0) 212 EX ldc1 $f30, SC_FPREGS+240(a0)
194 ctc1 t1, fcr31 213 ctc1 t1, fcr31
214 .set pop
195 jr ra 215 jr ra
196 li v0, 0 # success 216 li v0, 0 # success
197 END(_restore_fp_context) 217 END(_restore_fp_context)
@@ -199,6 +219,8 @@ LEAF(_restore_fp_context)
199#ifdef CONFIG_MIPS32_COMPAT 219#ifdef CONFIG_MIPS32_COMPAT
200LEAF(_restore_fp_context32) 220LEAF(_restore_fp_context32)
201 /* Restore an o32 sigcontext. */ 221 /* Restore an o32 sigcontext. */
222 .set push
223 SET_HARDFLOAT
202 EX lw t1, SC32_FPC_CSR(a0) 224 EX lw t1, SC32_FPC_CSR(a0)
203 225
204 mfc0 t0, CP0_STATUS 226 mfc0 t0, CP0_STATUS
@@ -242,6 +264,7 @@ LEAF(_restore_fp_context32)
242 ctc1 t1, fcr31 264 ctc1 t1, fcr31
243 jr ra 265 jr ra
244 li v0, 0 # success 266 li v0, 0 # success
267 .set pop
245 END(_restore_fp_context32) 268 END(_restore_fp_context32)
246#endif 269#endif
247 270
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 4c4ec1812420..64591e671878 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -22,6 +22,9 @@
22 22
23#include <asm/asmmacro.h> 23#include <asm/asmmacro.h>
24 24
25/* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */
26#undef fp
27
25/* 28/*
26 * Offset to the current process status flags, the first 32 bytes of the 29 * Offset to the current process status flags, the first 32 bytes of the
27 * stack are not used. 30 * stack are not used.
@@ -65,8 +68,12 @@
65 bgtz a3, 1f 68 bgtz a3, 1f
66 69
67 /* Save 128b MSA vector context + scalar FP control & status. */ 70 /* Save 128b MSA vector context + scalar FP control & status. */
71 .set push
72 SET_HARDFLOAT
68 cfc1 t1, fcr31 73 cfc1 t1, fcr31
69 msa_save_all a0 74 msa_save_all a0
75 .set pop /* SET_HARDFLOAT */
76
70 sw t1, THREAD_FCR31(a0) 77 sw t1, THREAD_FCR31(a0)
71 b 2f 78 b 2f
72 79
@@ -161,6 +168,9 @@ LEAF(_init_msa_upper)
161 168
162#define FPU_DEFAULT 0x00000000 169#define FPU_DEFAULT 0x00000000
163 170
171 .set push
172 SET_HARDFLOAT
173
164LEAF(_init_fpu) 174LEAF(_init_fpu)
165 mfc0 t0, CP0_STATUS 175 mfc0 t0, CP0_STATUS
166 li t1, ST0_CU1 176 li t1, ST0_CU1
@@ -232,7 +242,8 @@ LEAF(_init_fpu)
232 242
233#ifdef CONFIG_CPU_MIPS32_R2 243#ifdef CONFIG_CPU_MIPS32_R2
234 .set push 244 .set push
235 .set mips64r2 245 .set mips32r2
246 .set fp=64
236 sll t0, t0, 5 # is Status.FR set? 247 sll t0, t0, 5 # is Status.FR set?
237 bgez t0, 1f # no: skip setting upper 32b 248 bgez t0, 1f # no: skip setting upper 32b
238 249
@@ -291,3 +302,5 @@ LEAF(_init_fpu)
291#endif 302#endif
292 jr ra 303 jr ra
293 END(_init_fpu) 304 END(_init_fpu)
305
306 .set pop /* SET_HARDFLOAT */
diff --git a/arch/mips/kernel/r6000_fpu.S b/arch/mips/kernel/r6000_fpu.S
index da0fbe46d83b..47077380c15c 100644
--- a/arch/mips/kernel/r6000_fpu.S
+++ b/arch/mips/kernel/r6000_fpu.S
@@ -18,6 +18,9 @@
18 18
19 .set noreorder 19 .set noreorder
20 .set mips2 20 .set mips2
21 .set push
22 SET_HARDFLOAT
23
21 /* Save floating point context */ 24 /* Save floating point context */
22 LEAF(_save_fp_context) 25 LEAF(_save_fp_context)
23 mfc0 t0,CP0_STATUS 26 mfc0 t0,CP0_STATUS
@@ -85,3 +88,5 @@
851: jr ra 881: jr ra
86 nop 89 nop
87 END(_restore_fp_context) 90 END(_restore_fp_context)
91
92 .set pop /* SET_HARDFLOAT */
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 744cd10ba599..00cad1005a16 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -579,3 +579,4 @@ EXPORT(sys_call_table)
579 PTR sys_seccomp 579 PTR sys_seccomp
580 PTR sys_getrandom 580 PTR sys_getrandom
581 PTR sys_memfd_create 581 PTR sys_memfd_create
582 PTR sys_bpf /* 4355 */
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 002b1bc09c38..5251565e344b 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -434,4 +434,5 @@ EXPORT(sys_call_table)
434 PTR sys_seccomp 434 PTR sys_seccomp
435 PTR sys_getrandom 435 PTR sys_getrandom
436 PTR sys_memfd_create 436 PTR sys_memfd_create
437 PTR sys_bpf /* 5315 */
437 .size sys_call_table,.-sys_call_table 438 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index ca6cbbe9805b..77e74398b828 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -427,4 +427,5 @@ EXPORT(sysn32_call_table)
427 PTR sys_seccomp 427 PTR sys_seccomp
428 PTR sys_getrandom 428 PTR sys_getrandom
429 PTR sys_memfd_create 429 PTR sys_memfd_create
430 PTR sys_bpf
430 .size sysn32_call_table,.-sysn32_call_table 431 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 9e10d11fbb84..6f8db9f728e8 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -564,4 +564,5 @@ EXPORT(sys32_call_table)
564 PTR sys_seccomp 564 PTR sys_seccomp
565 PTR sys_getrandom 565 PTR sys_getrandom
566 PTR sys_memfd_create 566 PTR sys_memfd_create
567 PTR sys_bpf /* 4355 */
567 .size sys32_call_table,.-sys32_call_table 568 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index b3b8f0d9d4a7..d21ec57b6e95 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -683,7 +683,8 @@ static void __init arch_mem_init(char **cmdline_p)
683 dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); 683 dma_contiguous_reserve(PFN_PHYS(max_low_pfn));
684 /* Tell bootmem about cma reserved memblock section */ 684 /* Tell bootmem about cma reserved memblock section */
685 for_each_memblock(reserved, reg) 685 for_each_memblock(reserved, reg)
686 reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); 686 if (reg->size != 0)
687 reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
687} 688}
688 689
689static void __init resource_init(void) 690static void __init resource_init(void)
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index 91615c2ef0cf..1ef365ab3cd3 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -34,7 +34,7 @@ static void dump_tlb(int first, int last)
34 entrylo0 = read_c0_entrylo0(); 34 entrylo0 = read_c0_entrylo0();
35 35
36 /* Unused entries have a virtual address of KSEG0. */ 36 /* Unused entries have a virtual address of KSEG0. */
37 if ((entryhi & 0xffffe000) != 0x80000000 37 if ((entryhi & 0xfffff000) != 0x80000000
38 && (entryhi & 0xfc0) == asid) { 38 && (entryhi & 0xfc0) == asid) {
39 /* 39 /*
40 * Only print entries in use 40 * Only print entries in use
@@ -43,7 +43,7 @@ static void dump_tlb(int first, int last)
43 43
44 printk("va=%08lx asid=%08lx" 44 printk("va=%08lx asid=%08lx"
45 " [pa=%06lx n=%d d=%d v=%d g=%d]", 45 " [pa=%06lx n=%d d=%d v=%d g=%d]",
46 (entryhi & 0xffffe000), 46 (entryhi & 0xfffff000),
47 entryhi & 0xfc0, 47 entryhi & 0xfc0,
48 entrylo0 & PAGE_MASK, 48 entrylo0 & PAGE_MASK,
49 (entrylo0 & (1 << 11)) ? 1 : 0, 49 (entrylo0 & (1 << 11)) ? 1 : 0,
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S
index f3af6995e2a6..7d12c0dded3d 100644
--- a/arch/mips/lib/strnlen_user.S
+++ b/arch/mips/lib/strnlen_user.S
@@ -40,9 +40,11 @@ FEXPORT(__strnlen_\func\()_nocheck_asm)
40.else 40.else
41 EX(lbe, t0, (v0), .Lfault\@) 41 EX(lbe, t0, (v0), .Lfault\@)
42.endif 42.endif
43 PTR_ADDIU v0, 1 43 .set noreorder
44 bnez t0, 1b 44 bnez t0, 1b
451: PTR_SUBU v0, a0 451: PTR_ADDIU v0, 1
46 .set reorder
47 PTR_SUBU v0, a0
46 jr ra 48 jr ra
47 END(__strnlen_\func\()_asm) 49 END(__strnlen_\func\()_asm)
48 50
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 51a0fde4bec1..cac529a405b8 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -584,11 +584,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
584 if (insn.i_format.rs == bc_op) { 584 if (insn.i_format.rs == bc_op) {
585 preempt_disable(); 585 preempt_disable();
586 if (is_fpu_owner()) 586 if (is_fpu_owner())
587 asm volatile( 587 fcr31 = read_32bit_cp1_register(CP1_STATUS);
588 ".set push\n"
589 "\t.set mips1\n"
590 "\tcfc1\t%0,$31\n"
591 "\t.set pop" : "=r" (fcr31));
592 else 588 else
593 fcr31 = current->thread.fpu.fcr31; 589 fcr31 = current->thread.fpu.fcr31;
594 preempt_enable(); 590 preempt_enable();
diff --git a/arch/mips/pci/msi-xlp.c b/arch/mips/pci/msi-xlp.c
index fa374fe3746b..f7ac3edda1b2 100644
--- a/arch/mips/pci/msi-xlp.c
+++ b/arch/mips/pci/msi-xlp.c
@@ -443,10 +443,8 @@ static int xlp_setup_msix(uint64_t lnkbase, int node, int link,
443 msg.data = 0xc00 | msixvec; 443 msg.data = 0xc00 | msixvec;
444 444
445 ret = irq_set_msi_desc(xirq, desc); 445 ret = irq_set_msi_desc(xirq, desc);
446 if (ret < 0) { 446 if (ret < 0)
447 destroy_irq(xirq);
448 return ret; 447 return ret;
449 }
450 448
451 write_msi_msg(xirq, &msg); 449 write_msi_msg(xirq, &msg);
452 return 0; 450 return 0;
diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h
index a6774560afe3..493e72f64b35 100644
--- a/arch/powerpc/include/asm/fadump.h
+++ b/arch/powerpc/include/asm/fadump.h
@@ -70,39 +70,39 @@
70#define CPU_UNKNOWN (~((u32)0)) 70#define CPU_UNKNOWN (~((u32)0))
71 71
72/* Utility macros */ 72/* Utility macros */
73#define SKIP_TO_NEXT_CPU(reg_entry) \ 73#define SKIP_TO_NEXT_CPU(reg_entry) \
74({ \ 74({ \
75 while (reg_entry->reg_id != REG_ID("CPUEND")) \ 75 while (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUEND")) \
76 reg_entry++; \ 76 reg_entry++; \
77 reg_entry++; \ 77 reg_entry++; \
78}) 78})
79 79
80/* Kernel Dump section info */ 80/* Kernel Dump section info */
81struct fadump_section { 81struct fadump_section {
82 u32 request_flag; 82 __be32 request_flag;
83 u16 source_data_type; 83 __be16 source_data_type;
84 u16 error_flags; 84 __be16 error_flags;
85 u64 source_address; 85 __be64 source_address;
86 u64 source_len; 86 __be64 source_len;
87 u64 bytes_dumped; 87 __be64 bytes_dumped;
88 u64 destination_address; 88 __be64 destination_address;
89}; 89};
90 90
91/* ibm,configure-kernel-dump header. */ 91/* ibm,configure-kernel-dump header. */
92struct fadump_section_header { 92struct fadump_section_header {
93 u32 dump_format_version; 93 __be32 dump_format_version;
94 u16 dump_num_sections; 94 __be16 dump_num_sections;
95 u16 dump_status_flag; 95 __be16 dump_status_flag;
96 u32 offset_first_dump_section; 96 __be32 offset_first_dump_section;
97 97
98 /* Fields for disk dump option. */ 98 /* Fields for disk dump option. */
99 u32 dd_block_size; 99 __be32 dd_block_size;
100 u64 dd_block_offset; 100 __be64 dd_block_offset;
101 u64 dd_num_blocks; 101 __be64 dd_num_blocks;
102 u32 dd_offset_disk_path; 102 __be32 dd_offset_disk_path;
103 103
104 /* Maximum time allowed to prevent an automatic dump-reboot. */ 104 /* Maximum time allowed to prevent an automatic dump-reboot. */
105 u32 max_time_auto; 105 __be32 max_time_auto;
106}; 106};
107 107
108/* 108/*
@@ -174,15 +174,15 @@ static inline u64 str_to_u64(const char *str)
174 174
175/* Register save area header. */ 175/* Register save area header. */
176struct fadump_reg_save_area_header { 176struct fadump_reg_save_area_header {
177 u64 magic_number; 177 __be64 magic_number;
178 u32 version; 178 __be32 version;
179 u32 num_cpu_offset; 179 __be32 num_cpu_offset;
180}; 180};
181 181
182/* Register entry. */ 182/* Register entry. */
183struct fadump_reg_entry { 183struct fadump_reg_entry {
184 u64 reg_id; 184 __be64 reg_id;
185 u64 reg_value; 185 __be64 reg_value;
186}; 186};
187 187
188/* fadump crash info structure */ 188/* fadump crash info structure */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 5bbd1bc8c3b0..0905c8da90f1 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -659,7 +659,13 @@ _GLOBAL(ret_from_except_lite)
6593: 6593:
660#endif 660#endif
661 bl save_nvgprs 661 bl save_nvgprs
662 /*
663 * Use a non volatile GPR to save and restore our thread_info flags
664 * across the call to restore_interrupts.
665 */
666 mr r30,r4
662 bl restore_interrupts 667 bl restore_interrupts
668 mr r4,r30
663 addi r3,r1,STACK_FRAME_OVERHEAD 669 addi r3,r1,STACK_FRAME_OVERHEAD
664 bl do_notify_resume 670 bl do_notify_resume
665 b ret_from_except 671 b ret_from_except
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 742694c1d852..26d091a1a54c 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -58,7 +58,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,
58 const __be32 *sections; 58 const __be32 *sections;
59 int i, num_sections; 59 int i, num_sections;
60 int size; 60 int size;
61 const int *token; 61 const __be32 *token;
62 62
63 if (depth != 1 || strcmp(uname, "rtas") != 0) 63 if (depth != 1 || strcmp(uname, "rtas") != 0)
64 return 0; 64 return 0;
@@ -72,7 +72,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node,
72 return 1; 72 return 1;
73 73
74 fw_dump.fadump_supported = 1; 74 fw_dump.fadump_supported = 1;
75 fw_dump.ibm_configure_kernel_dump = *token; 75 fw_dump.ibm_configure_kernel_dump = be32_to_cpu(*token);
76 76
77 /* 77 /*
78 * The 'ibm,kernel-dump' rtas node is present only if there is 78 * The 'ibm,kernel-dump' rtas node is present only if there is
@@ -147,11 +147,11 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm,
147 memset(fdm, 0, sizeof(struct fadump_mem_struct)); 147 memset(fdm, 0, sizeof(struct fadump_mem_struct));
148 addr = addr & PAGE_MASK; 148 addr = addr & PAGE_MASK;
149 149
150 fdm->header.dump_format_version = 0x00000001; 150 fdm->header.dump_format_version = cpu_to_be32(0x00000001);
151 fdm->header.dump_num_sections = 3; 151 fdm->header.dump_num_sections = cpu_to_be16(3);
152 fdm->header.dump_status_flag = 0; 152 fdm->header.dump_status_flag = 0;
153 fdm->header.offset_first_dump_section = 153 fdm->header.offset_first_dump_section =
154 (u32)offsetof(struct fadump_mem_struct, cpu_state_data); 154 cpu_to_be32((u32)offsetof(struct fadump_mem_struct, cpu_state_data));
155 155
156 /* 156 /*
157 * Fields for disk dump option. 157 * Fields for disk dump option.
@@ -167,27 +167,27 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm,
167 167
168 /* Kernel dump sections */ 168 /* Kernel dump sections */
169 /* cpu state data section. */ 169 /* cpu state data section. */
170 fdm->cpu_state_data.request_flag = FADUMP_REQUEST_FLAG; 170 fdm->cpu_state_data.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG);
171 fdm->cpu_state_data.source_data_type = FADUMP_CPU_STATE_DATA; 171 fdm->cpu_state_data.source_data_type = cpu_to_be16(FADUMP_CPU_STATE_DATA);
172 fdm->cpu_state_data.source_address = 0; 172 fdm->cpu_state_data.source_address = 0;
173 fdm->cpu_state_data.source_len = fw_dump.cpu_state_data_size; 173 fdm->cpu_state_data.source_len = cpu_to_be64(fw_dump.cpu_state_data_size);
174 fdm->cpu_state_data.destination_address = addr; 174 fdm->cpu_state_data.destination_address = cpu_to_be64(addr);
175 addr += fw_dump.cpu_state_data_size; 175 addr += fw_dump.cpu_state_data_size;
176 176
177 /* hpte region section */ 177 /* hpte region section */
178 fdm->hpte_region.request_flag = FADUMP_REQUEST_FLAG; 178 fdm->hpte_region.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG);
179 fdm->hpte_region.source_data_type = FADUMP_HPTE_REGION; 179 fdm->hpte_region.source_data_type = cpu_to_be16(FADUMP_HPTE_REGION);
180 fdm->hpte_region.source_address = 0; 180 fdm->hpte_region.source_address = 0;
181 fdm->hpte_region.source_len = fw_dump.hpte_region_size; 181 fdm->hpte_region.source_len = cpu_to_be64(fw_dump.hpte_region_size);
182 fdm->hpte_region.destination_address = addr; 182 fdm->hpte_region.destination_address = cpu_to_be64(addr);
183 addr += fw_dump.hpte_region_size; 183 addr += fw_dump.hpte_region_size;
184 184
185 /* RMA region section */ 185 /* RMA region section */
186 fdm->rmr_region.request_flag = FADUMP_REQUEST_FLAG; 186 fdm->rmr_region.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG);
187 fdm->rmr_region.source_data_type = FADUMP_REAL_MODE_REGION; 187 fdm->rmr_region.source_data_type = cpu_to_be16(FADUMP_REAL_MODE_REGION);
188 fdm->rmr_region.source_address = RMA_START; 188 fdm->rmr_region.source_address = cpu_to_be64(RMA_START);
189 fdm->rmr_region.source_len = fw_dump.boot_memory_size; 189 fdm->rmr_region.source_len = cpu_to_be64(fw_dump.boot_memory_size);
190 fdm->rmr_region.destination_address = addr; 190 fdm->rmr_region.destination_address = cpu_to_be64(addr);
191 addr += fw_dump.boot_memory_size; 191 addr += fw_dump.boot_memory_size;
192 192
193 return addr; 193 return addr;
@@ -272,7 +272,7 @@ int __init fadump_reserve_mem(void)
272 * first kernel. 272 * first kernel.
273 */ 273 */
274 if (fdm_active) 274 if (fdm_active)
275 fw_dump.boot_memory_size = fdm_active->rmr_region.source_len; 275 fw_dump.boot_memory_size = be64_to_cpu(fdm_active->rmr_region.source_len);
276 else 276 else
277 fw_dump.boot_memory_size = fadump_calculate_reserve_size(); 277 fw_dump.boot_memory_size = fadump_calculate_reserve_size();
278 278
@@ -314,8 +314,8 @@ int __init fadump_reserve_mem(void)
314 (unsigned long)(base >> 20)); 314 (unsigned long)(base >> 20));
315 315
316 fw_dump.fadumphdr_addr = 316 fw_dump.fadumphdr_addr =
317 fdm_active->rmr_region.destination_address + 317 be64_to_cpu(fdm_active->rmr_region.destination_address) +
318 fdm_active->rmr_region.source_len; 318 be64_to_cpu(fdm_active->rmr_region.source_len);
319 pr_debug("fadumphdr_addr = %p\n", 319 pr_debug("fadumphdr_addr = %p\n",
320 (void *) fw_dump.fadumphdr_addr); 320 (void *) fw_dump.fadumphdr_addr);
321 } else { 321 } else {
@@ -472,9 +472,9 @@ fadump_read_registers(struct fadump_reg_entry *reg_entry, struct pt_regs *regs)
472{ 472{
473 memset(regs, 0, sizeof(struct pt_regs)); 473 memset(regs, 0, sizeof(struct pt_regs));
474 474
475 while (reg_entry->reg_id != REG_ID("CPUEND")) { 475 while (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUEND")) {
476 fadump_set_regval(regs, reg_entry->reg_id, 476 fadump_set_regval(regs, be64_to_cpu(reg_entry->reg_id),
477 reg_entry->reg_value); 477 be64_to_cpu(reg_entry->reg_value));
478 reg_entry++; 478 reg_entry++;
479 } 479 }
480 reg_entry++; 480 reg_entry++;
@@ -603,20 +603,20 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm)
603 if (!fdm->cpu_state_data.bytes_dumped) 603 if (!fdm->cpu_state_data.bytes_dumped)
604 return -EINVAL; 604 return -EINVAL;
605 605
606 addr = fdm->cpu_state_data.destination_address; 606 addr = be64_to_cpu(fdm->cpu_state_data.destination_address);
607 vaddr = __va(addr); 607 vaddr = __va(addr);
608 608
609 reg_header = vaddr; 609 reg_header = vaddr;
610 if (reg_header->magic_number != REGSAVE_AREA_MAGIC) { 610 if (be64_to_cpu(reg_header->magic_number) != REGSAVE_AREA_MAGIC) {
611 printk(KERN_ERR "Unable to read register save area.\n"); 611 printk(KERN_ERR "Unable to read register save area.\n");
612 return -ENOENT; 612 return -ENOENT;
613 } 613 }
614 pr_debug("--------CPU State Data------------\n"); 614 pr_debug("--------CPU State Data------------\n");
615 pr_debug("Magic Number: %llx\n", reg_header->magic_number); 615 pr_debug("Magic Number: %llx\n", be64_to_cpu(reg_header->magic_number));
616 pr_debug("NumCpuOffset: %x\n", reg_header->num_cpu_offset); 616 pr_debug("NumCpuOffset: %x\n", be32_to_cpu(reg_header->num_cpu_offset));
617 617
618 vaddr += reg_header->num_cpu_offset; 618 vaddr += be32_to_cpu(reg_header->num_cpu_offset);
619 num_cpus = *((u32 *)(vaddr)); 619 num_cpus = be32_to_cpu(*((__be32 *)(vaddr)));
620 pr_debug("NumCpus : %u\n", num_cpus); 620 pr_debug("NumCpus : %u\n", num_cpus);
621 vaddr += sizeof(u32); 621 vaddr += sizeof(u32);
622 reg_entry = (struct fadump_reg_entry *)vaddr; 622 reg_entry = (struct fadump_reg_entry *)vaddr;
@@ -639,13 +639,13 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm)
639 fdh = __va(fw_dump.fadumphdr_addr); 639 fdh = __va(fw_dump.fadumphdr_addr);
640 640
641 for (i = 0; i < num_cpus; i++) { 641 for (i = 0; i < num_cpus; i++) {
642 if (reg_entry->reg_id != REG_ID("CPUSTRT")) { 642 if (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUSTRT")) {
643 printk(KERN_ERR "Unable to read CPU state data\n"); 643 printk(KERN_ERR "Unable to read CPU state data\n");
644 rc = -ENOENT; 644 rc = -ENOENT;
645 goto error_out; 645 goto error_out;
646 } 646 }
647 /* Lower 4 bytes of reg_value contains logical cpu id */ 647 /* Lower 4 bytes of reg_value contains logical cpu id */
648 cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK; 648 cpu = be64_to_cpu(reg_entry->reg_value) & FADUMP_CPU_ID_MASK;
649 if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { 649 if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) {
650 SKIP_TO_NEXT_CPU(reg_entry); 650 SKIP_TO_NEXT_CPU(reg_entry);
651 continue; 651 continue;
@@ -692,7 +692,7 @@ static int __init process_fadump(const struct fadump_mem_struct *fdm_active)
692 return -EINVAL; 692 return -EINVAL;
693 693
694 /* Check if the dump data is valid. */ 694 /* Check if the dump data is valid. */
695 if ((fdm_active->header.dump_status_flag == FADUMP_ERROR_FLAG) || 695 if ((be16_to_cpu(fdm_active->header.dump_status_flag) == FADUMP_ERROR_FLAG) ||
696 (fdm_active->cpu_state_data.error_flags != 0) || 696 (fdm_active->cpu_state_data.error_flags != 0) ||
697 (fdm_active->rmr_region.error_flags != 0)) { 697 (fdm_active->rmr_region.error_flags != 0)) {
698 printk(KERN_ERR "Dump taken by platform is not valid\n"); 698 printk(KERN_ERR "Dump taken by platform is not valid\n");
@@ -828,7 +828,7 @@ static void fadump_setup_crash_memory_ranges(void)
828static inline unsigned long fadump_relocate(unsigned long paddr) 828static inline unsigned long fadump_relocate(unsigned long paddr)
829{ 829{
830 if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) 830 if (paddr > RMA_START && paddr < fw_dump.boot_memory_size)
831 return fdm.rmr_region.destination_address + paddr; 831 return be64_to_cpu(fdm.rmr_region.destination_address) + paddr;
832 else 832 else
833 return paddr; 833 return paddr;
834} 834}
@@ -902,7 +902,7 @@ static int fadump_create_elfcore_headers(char *bufp)
902 * to the specified destination_address. Hence set 902 * to the specified destination_address. Hence set
903 * the correct offset. 903 * the correct offset.
904 */ 904 */
905 phdr->p_offset = fdm.rmr_region.destination_address; 905 phdr->p_offset = be64_to_cpu(fdm.rmr_region.destination_address);
906 } 906 }
907 907
908 phdr->p_paddr = mbase; 908 phdr->p_paddr = mbase;
@@ -951,7 +951,7 @@ static void register_fadump(void)
951 951
952 fadump_setup_crash_memory_ranges(); 952 fadump_setup_crash_memory_ranges();
953 953
954 addr = fdm.rmr_region.destination_address + fdm.rmr_region.source_len; 954 addr = be64_to_cpu(fdm.rmr_region.destination_address) + be64_to_cpu(fdm.rmr_region.source_len);
955 /* Initialize fadump crash info header. */ 955 /* Initialize fadump crash info header. */
956 addr = init_fadump_header(addr); 956 addr = init_fadump_header(addr);
957 vaddr = __va(addr); 957 vaddr = __va(addr);
@@ -1023,7 +1023,7 @@ void fadump_cleanup(void)
1023 /* Invalidate the registration only if dump is active. */ 1023 /* Invalidate the registration only if dump is active. */
1024 if (fw_dump.dump_active) { 1024 if (fw_dump.dump_active) {
1025 init_fadump_mem_struct(&fdm, 1025 init_fadump_mem_struct(&fdm,
1026 fdm_active->cpu_state_data.destination_address); 1026 be64_to_cpu(fdm_active->cpu_state_data.destination_address));
1027 fadump_invalidate_dump(&fdm); 1027 fadump_invalidate_dump(&fdm);
1028 } 1028 }
1029} 1029}
@@ -1063,7 +1063,7 @@ static void fadump_invalidate_release_mem(void)
1063 return; 1063 return;
1064 } 1064 }
1065 1065
1066 destination_address = fdm_active->cpu_state_data.destination_address; 1066 destination_address = be64_to_cpu(fdm_active->cpu_state_data.destination_address);
1067 fadump_cleanup(); 1067 fadump_cleanup();
1068 mutex_unlock(&fadump_mutex); 1068 mutex_unlock(&fadump_mutex);
1069 1069
@@ -1183,31 +1183,31 @@ static int fadump_region_show(struct seq_file *m, void *private)
1183 seq_printf(m, 1183 seq_printf(m,
1184 "CPU : [%#016llx-%#016llx] %#llx bytes, " 1184 "CPU : [%#016llx-%#016llx] %#llx bytes, "
1185 "Dumped: %#llx\n", 1185 "Dumped: %#llx\n",
1186 fdm_ptr->cpu_state_data.destination_address, 1186 be64_to_cpu(fdm_ptr->cpu_state_data.destination_address),
1187 fdm_ptr->cpu_state_data.destination_address + 1187 be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) +
1188 fdm_ptr->cpu_state_data.source_len - 1, 1188 be64_to_cpu(fdm_ptr->cpu_state_data.source_len) - 1,
1189 fdm_ptr->cpu_state_data.source_len, 1189 be64_to_cpu(fdm_ptr->cpu_state_data.source_len),
1190 fdm_ptr->cpu_state_data.bytes_dumped); 1190 be64_to_cpu(fdm_ptr->cpu_state_data.bytes_dumped));
1191 seq_printf(m, 1191 seq_printf(m,
1192 "HPTE: [%#016llx-%#016llx] %#llx bytes, " 1192 "HPTE: [%#016llx-%#016llx] %#llx bytes, "
1193 "Dumped: %#llx\n", 1193 "Dumped: %#llx\n",
1194 fdm_ptr->hpte_region.destination_address, 1194 be64_to_cpu(fdm_ptr->hpte_region.destination_address),
1195 fdm_ptr->hpte_region.destination_address + 1195 be64_to_cpu(fdm_ptr->hpte_region.destination_address) +
1196 fdm_ptr->hpte_region.source_len - 1, 1196 be64_to_cpu(fdm_ptr->hpte_region.source_len) - 1,
1197 fdm_ptr->hpte_region.source_len, 1197 be64_to_cpu(fdm_ptr->hpte_region.source_len),
1198 fdm_ptr->hpte_region.bytes_dumped); 1198 be64_to_cpu(fdm_ptr->hpte_region.bytes_dumped));
1199 seq_printf(m, 1199 seq_printf(m,
1200 "DUMP: [%#016llx-%#016llx] %#llx bytes, " 1200 "DUMP: [%#016llx-%#016llx] %#llx bytes, "
1201 "Dumped: %#llx\n", 1201 "Dumped: %#llx\n",
1202 fdm_ptr->rmr_region.destination_address, 1202 be64_to_cpu(fdm_ptr->rmr_region.destination_address),
1203 fdm_ptr->rmr_region.destination_address + 1203 be64_to_cpu(fdm_ptr->rmr_region.destination_address) +
1204 fdm_ptr->rmr_region.source_len - 1, 1204 be64_to_cpu(fdm_ptr->rmr_region.source_len) - 1,
1205 fdm_ptr->rmr_region.source_len, 1205 be64_to_cpu(fdm_ptr->rmr_region.source_len),
1206 fdm_ptr->rmr_region.bytes_dumped); 1206 be64_to_cpu(fdm_ptr->rmr_region.bytes_dumped));
1207 1207
1208 if (!fdm_active || 1208 if (!fdm_active ||
1209 (fw_dump.reserve_dump_area_start == 1209 (fw_dump.reserve_dump_area_start ==
1210 fdm_ptr->cpu_state_data.destination_address)) 1210 be64_to_cpu(fdm_ptr->cpu_state_data.destination_address)))
1211 goto out; 1211 goto out;
1212 1212
1213 /* Dump is active. Show reserved memory region. */ 1213 /* Dump is active. Show reserved memory region. */
@@ -1215,10 +1215,10 @@ static int fadump_region_show(struct seq_file *m, void *private)
1215 " : [%#016llx-%#016llx] %#llx bytes, " 1215 " : [%#016llx-%#016llx] %#llx bytes, "
1216 "Dumped: %#llx\n", 1216 "Dumped: %#llx\n",
1217 (unsigned long long)fw_dump.reserve_dump_area_start, 1217 (unsigned long long)fw_dump.reserve_dump_area_start,
1218 fdm_ptr->cpu_state_data.destination_address - 1, 1218 be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - 1,
1219 fdm_ptr->cpu_state_data.destination_address - 1219 be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) -
1220 fw_dump.reserve_dump_area_start, 1220 fw_dump.reserve_dump_area_start,
1221 fdm_ptr->cpu_state_data.destination_address - 1221 be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) -
1222 fw_dump.reserve_dump_area_start); 1222 fw_dump.reserve_dump_area_start);
1223out: 1223out:
1224 if (fdm_active) 1224 if (fdm_active)
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index cad68ff8eca5..415a51b028b9 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -103,7 +103,7 @@ unsigned long __max_low_memory = MAX_LOW_MEM;
103/* 103/*
104 * Check for command-line options that affect what MMU_init will do. 104 * Check for command-line options that affect what MMU_init will do.
105 */ 105 */
106void MMU_setup(void) 106void __init MMU_setup(void)
107{ 107{
108 /* Check for nobats option (used in mapin_ram). */ 108 /* Check for nobats option (used in mapin_ram). */
109 if (strstr(boot_command_line, "nobats")) { 109 if (strstr(boot_command_line, "nobats")) {
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index ad4b31df779a..e4169d68cb32 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -216,14 +216,54 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
216 &data, len); 216 &data, len);
217 if (rc) 217 if (rc)
218 return -ENXIO; 218 return -ENXIO;
219
220 /*
221 * Now there is some trickery with the data returned by OPAL
222 * as it's the desired data right justified in a 32-bit BE
223 * word.
224 *
225 * This is a very bad interface and I'm to blame for it :-(
226 *
227 * So we can't just apply a 32-bit swap to what comes from OPAL,
228 * because user space expects the *bytes* to be in their proper
229 * respective positions (ie, LPC position).
230 *
231 * So what we really want to do here is to shift data right
232 * appropriately on a LE kernel.
233 *
234 * IE. If the LPC transaction has bytes B0, B1, B2 and B3 in that
235 * order, we have in memory written to by OPAL at the "data"
236 * pointer:
237 *
238 * Bytes: OPAL "data" LE "data"
239 * 32-bit: B0 B1 B2 B3 B0B1B2B3 B3B2B1B0
240 * 16-bit: B0 B1 0000B0B1 B1B00000
241 * 8-bit: B0 000000B0 B0000000
242 *
243 * So a BE kernel will have the leftmost of the above in the MSB
244 * and rightmost in the LSB and can just then "cast" the u32 "data"
245 * down to the appropriate quantity and write it.
246 *
247 * However, an LE kernel can't. It doesn't need to swap because a
248 * load from data followed by a store to user are going to preserve
249 * the byte ordering which is the wire byte order which is what the
250 * user wants, but in order to "crop" to the right size, we need to
251 * shift right first.
252 */
219 switch(len) { 253 switch(len) {
220 case 4: 254 case 4:
221 rc = __put_user((u32)data, (u32 __user *)ubuf); 255 rc = __put_user((u32)data, (u32 __user *)ubuf);
222 break; 256 break;
223 case 2: 257 case 2:
258#ifdef __LITTLE_ENDIAN__
259 data >>= 16;
260#endif
224 rc = __put_user((u16)data, (u16 __user *)ubuf); 261 rc = __put_user((u16)data, (u16 __user *)ubuf);
225 break; 262 break;
226 default: 263 default:
264#ifdef __LITTLE_ENDIAN__
265 data >>= 24;
266#endif
227 rc = __put_user((u8)data, (u8 __user *)ubuf); 267 rc = __put_user((u8)data, (u8 __user *)ubuf);
228 break; 268 break;
229 } 269 }
@@ -263,12 +303,31 @@ static ssize_t lpc_debug_write(struct file *filp, const char __user *ubuf,
263 else if (todo > 1 && (pos & 1) == 0) 303 else if (todo > 1 && (pos & 1) == 0)
264 len = 2; 304 len = 2;
265 } 305 }
306
307 /*
308 * Similarly to the read case, we have some trickery here but
309 * it's different to handle. We need to pass the value to OPAL in
310 * a register whose layout depends on the access size. We want
311 * to reproduce the memory layout of the user, however we aren't
312 * doing a load from user and a store to another memory location
313 * which would achieve that. Here we pass the value to OPAL via
314 * a register which is expected to contain the "BE" interpretation
315 * of the byte sequence. IE: for a 32-bit access, byte 0 should be
316 * in the MSB. So here we *do* need to byteswap on LE.
317 *
318 * User bytes: LE "data" OPAL "data"
319 * 32-bit: B0 B1 B2 B3 B3B2B1B0 B0B1B2B3
320 * 16-bit: B0 B1 0000B1B0 0000B0B1
321 * 8-bit: B0 000000B0 000000B0
322 */
266 switch(len) { 323 switch(len) {
267 case 4: 324 case 4:
268 rc = __get_user(data, (u32 __user *)ubuf); 325 rc = __get_user(data, (u32 __user *)ubuf);
326 data = cpu_to_be32(data);
269 break; 327 break;
270 case 2: 328 case 2:
271 rc = __get_user(data, (u16 __user *)ubuf); 329 rc = __get_user(data, (u16 __user *)ubuf);
330 data = cpu_to_be16(data);
272 break; 331 break;
273 default: 332 default:
274 rc = __get_user(data, (u8 __user *)ubuf); 333 rc = __get_user(data, (u8 __user *)ubuf);
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 6ad83bd11fe2..c22bb1b4beb8 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -382,7 +382,7 @@ static int dlpar_online_cpu(struct device_node *dn)
382 BUG_ON(get_cpu_current_state(cpu) 382 BUG_ON(get_cpu_current_state(cpu)
383 != CPU_STATE_OFFLINE); 383 != CPU_STATE_OFFLINE);
384 cpu_maps_update_done(); 384 cpu_maps_update_done();
385 rc = cpu_up(cpu); 385 rc = device_online(get_cpu_device(cpu));
386 if (rc) 386 if (rc)
387 goto out; 387 goto out;
388 cpu_maps_update_begin(); 388 cpu_maps_update_begin();
@@ -467,7 +467,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
467 if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { 467 if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
468 set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); 468 set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
469 cpu_maps_update_done(); 469 cpu_maps_update_done();
470 rc = cpu_down(cpu); 470 rc = device_offline(get_cpu_device(cpu));
471 if (rc) 471 if (rc)
472 goto out; 472 goto out;
473 cpu_maps_update_begin(); 473 cpu_maps_update_begin();
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 8c509d5397c6..f6880d2a40fb 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -43,6 +43,7 @@
43#include <asm/trace.h> 43#include <asm/trace.h>
44#include <asm/firmware.h> 44#include <asm/firmware.h>
45#include <asm/plpar_wrappers.h> 45#include <asm/plpar_wrappers.h>
46#include <asm/fadump.h>
46 47
47#include "pseries.h" 48#include "pseries.h"
48 49
@@ -247,8 +248,17 @@ static void pSeries_lpar_hptab_clear(void)
247 } 248 }
248 249
249#ifdef __LITTLE_ENDIAN__ 250#ifdef __LITTLE_ENDIAN__
250 /* Reset exceptions to big endian */ 251 /*
251 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 252 * Reset exceptions to big endian.
253 *
254 * FIXME this is a hack for kexec, we need to reset the exception
255 * endian before starting the new kernel and this is a convenient place
256 * to do it.
257 *
258 * This is also called on boot when a fadump happens. In that case we
259 * must not change the exception endian mode.
260 */
261 if (firmware_has_feature(FW_FEATURE_SET_MODE) && !is_fadump_active()) {
252 long rc; 262 long rc;
253 263
254 rc = pseries_big_endian_exceptions(); 264 rc = pseries_big_endian_exceptions();
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 9d94fdd9f525..9432d0f202ef 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -35,7 +35,6 @@ CONFIG_MODULE_UNLOAD=y
35CONFIG_MODULE_FORCE_UNLOAD=y 35CONFIG_MODULE_FORCE_UNLOAD=y
36CONFIG_MODVERSIONS=y 36CONFIG_MODVERSIONS=y
37CONFIG_MODULE_SRCVERSION_ALL=y 37CONFIG_MODULE_SRCVERSION_ALL=y
38CONFIG_BLK_DEV_INTEGRITY=y
39CONFIG_BLK_DEV_THROTTLING=y 38CONFIG_BLK_DEV_THROTTLING=y
40CONFIG_PARTITION_ADVANCED=y 39CONFIG_PARTITION_ADVANCED=y
41CONFIG_IBM_PARTITION=y 40CONFIG_IBM_PARTITION=y
@@ -245,6 +244,7 @@ CONFIG_NF_TABLES_IPV4=m
245CONFIG_NFT_CHAIN_ROUTE_IPV4=m 244CONFIG_NFT_CHAIN_ROUTE_IPV4=m
246CONFIG_NFT_CHAIN_NAT_IPV4=m 245CONFIG_NFT_CHAIN_NAT_IPV4=m
247CONFIG_NF_TABLES_ARP=m 246CONFIG_NF_TABLES_ARP=m
247CONFIG_NF_NAT_IPV4=m
248CONFIG_IP_NF_IPTABLES=m 248CONFIG_IP_NF_IPTABLES=m
249CONFIG_IP_NF_MATCH_AH=m 249CONFIG_IP_NF_MATCH_AH=m
250CONFIG_IP_NF_MATCH_ECN=m 250CONFIG_IP_NF_MATCH_ECN=m
@@ -252,11 +252,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m
252CONFIG_IP_NF_MATCH_TTL=m 252CONFIG_IP_NF_MATCH_TTL=m
253CONFIG_IP_NF_FILTER=m 253CONFIG_IP_NF_FILTER=m
254CONFIG_IP_NF_TARGET_REJECT=m 254CONFIG_IP_NF_TARGET_REJECT=m
255CONFIG_IP_NF_TARGET_ULOG=m
256CONFIG_NF_NAT_IPV4=m
257CONFIG_IP_NF_TARGET_MASQUERADE=m
258CONFIG_IP_NF_TARGET_NETMAP=m
259CONFIG_IP_NF_TARGET_REDIRECT=m
260CONFIG_IP_NF_MANGLE=m 255CONFIG_IP_NF_MANGLE=m
261CONFIG_IP_NF_TARGET_CLUSTERIP=m 256CONFIG_IP_NF_TARGET_CLUSTERIP=m
262CONFIG_IP_NF_TARGET_ECN=m 257CONFIG_IP_NF_TARGET_ECN=m
@@ -270,6 +265,7 @@ CONFIG_NF_CONNTRACK_IPV6=m
270CONFIG_NF_TABLES_IPV6=m 265CONFIG_NF_TABLES_IPV6=m
271CONFIG_NFT_CHAIN_ROUTE_IPV6=m 266CONFIG_NFT_CHAIN_ROUTE_IPV6=m
272CONFIG_NFT_CHAIN_NAT_IPV6=m 267CONFIG_NFT_CHAIN_NAT_IPV6=m
268CONFIG_NF_NAT_IPV6=m
273CONFIG_IP6_NF_IPTABLES=m 269CONFIG_IP6_NF_IPTABLES=m
274CONFIG_IP6_NF_MATCH_AH=m 270CONFIG_IP6_NF_MATCH_AH=m
275CONFIG_IP6_NF_MATCH_EUI64=m 271CONFIG_IP6_NF_MATCH_EUI64=m
@@ -286,9 +282,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m
286CONFIG_IP6_NF_MANGLE=m 282CONFIG_IP6_NF_MANGLE=m
287CONFIG_IP6_NF_RAW=m 283CONFIG_IP6_NF_RAW=m
288CONFIG_IP6_NF_SECURITY=m 284CONFIG_IP6_NF_SECURITY=m
289CONFIG_NF_NAT_IPV6=m
290CONFIG_IP6_NF_TARGET_MASQUERADE=m
291CONFIG_IP6_NF_TARGET_NPT=m
292CONFIG_NF_TABLES_BRIDGE=m 285CONFIG_NF_TABLES_BRIDGE=m
293CONFIG_NET_SCTPPROBE=m 286CONFIG_NET_SCTPPROBE=m
294CONFIG_RDS=m 287CONFIG_RDS=m
@@ -374,14 +367,13 @@ CONFIG_BLK_DEV_SR=m
374CONFIG_CHR_DEV_SG=y 367CONFIG_CHR_DEV_SG=y
375CONFIG_CHR_DEV_SCH=m 368CONFIG_CHR_DEV_SCH=m
376CONFIG_SCSI_ENCLOSURE=m 369CONFIG_SCSI_ENCLOSURE=m
377CONFIG_SCSI_MULTI_LUN=y
378CONFIG_SCSI_CONSTANTS=y 370CONFIG_SCSI_CONSTANTS=y
379CONFIG_SCSI_LOGGING=y 371CONFIG_SCSI_LOGGING=y
380CONFIG_SCSI_SPI_ATTRS=m 372CONFIG_SCSI_SPI_ATTRS=m
373CONFIG_SCSI_FC_ATTRS=y
381CONFIG_SCSI_SAS_LIBSAS=m 374CONFIG_SCSI_SAS_LIBSAS=m
382CONFIG_SCSI_SRP_ATTRS=m 375CONFIG_SCSI_SRP_ATTRS=m
383CONFIG_ISCSI_TCP=m 376CONFIG_ISCSI_TCP=m
384CONFIG_LIBFCOE=m
385CONFIG_SCSI_DEBUG=m 377CONFIG_SCSI_DEBUG=m
386CONFIG_ZFCP=y 378CONFIG_ZFCP=y
387CONFIG_SCSI_VIRTIO=m 379CONFIG_SCSI_VIRTIO=m
@@ -427,7 +419,6 @@ CONFIG_VIRTIO_NET=m
427CONFIG_NLMON=m 419CONFIG_NLMON=m
428CONFIG_VHOST_NET=m 420CONFIG_VHOST_NET=m
429# CONFIG_NET_VENDOR_ARC is not set 421# CONFIG_NET_VENDOR_ARC is not set
430# CONFIG_NET_CADENCE is not set
431# CONFIG_NET_VENDOR_CHELSIO is not set 422# CONFIG_NET_VENDOR_CHELSIO is not set
432# CONFIG_NET_VENDOR_INTEL is not set 423# CONFIG_NET_VENDOR_INTEL is not set
433# CONFIG_NET_VENDOR_MARVELL is not set 424# CONFIG_NET_VENDOR_MARVELL is not set
@@ -481,14 +472,14 @@ CONFIG_JFS_FS=m
481CONFIG_JFS_POSIX_ACL=y 472CONFIG_JFS_POSIX_ACL=y
482CONFIG_JFS_SECURITY=y 473CONFIG_JFS_SECURITY=y
483CONFIG_JFS_STATISTICS=y 474CONFIG_JFS_STATISTICS=y
484CONFIG_XFS_FS=m 475CONFIG_XFS_FS=y
485CONFIG_XFS_QUOTA=y 476CONFIG_XFS_QUOTA=y
486CONFIG_XFS_POSIX_ACL=y 477CONFIG_XFS_POSIX_ACL=y
487CONFIG_XFS_RT=y 478CONFIG_XFS_RT=y
488CONFIG_XFS_DEBUG=y 479CONFIG_XFS_DEBUG=y
489CONFIG_GFS2_FS=m 480CONFIG_GFS2_FS=m
490CONFIG_OCFS2_FS=m 481CONFIG_OCFS2_FS=m
491CONFIG_BTRFS_FS=m 482CONFIG_BTRFS_FS=y
492CONFIG_BTRFS_FS_POSIX_ACL=y 483CONFIG_BTRFS_FS_POSIX_ACL=y
493CONFIG_NILFS2_FS=m 484CONFIG_NILFS2_FS=m
494CONFIG_FANOTIFY=y 485CONFIG_FANOTIFY=y
@@ -574,7 +565,6 @@ CONFIG_DEBUG_SHIRQ=y
574CONFIG_DETECT_HUNG_TASK=y 565CONFIG_DETECT_HUNG_TASK=y
575CONFIG_TIMER_STATS=y 566CONFIG_TIMER_STATS=y
576CONFIG_DEBUG_RT_MUTEXES=y 567CONFIG_DEBUG_RT_MUTEXES=y
577CONFIG_RT_MUTEX_TESTER=y
578CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y 568CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
579CONFIG_PROVE_LOCKING=y 569CONFIG_PROVE_LOCKING=y
580CONFIG_LOCK_STAT=y 570CONFIG_LOCK_STAT=y
@@ -600,8 +590,13 @@ CONFIG_FAULT_INJECTION_DEBUG_FS=y
600CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y 590CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
601CONFIG_LATENCYTOP=y 591CONFIG_LATENCYTOP=y
602CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y 592CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y
593CONFIG_IRQSOFF_TRACER=y
594CONFIG_PREEMPT_TRACER=y
595CONFIG_SCHED_TRACER=y
596CONFIG_FTRACE_SYSCALLS=y
597CONFIG_STACK_TRACER=y
603CONFIG_BLK_DEV_IO_TRACE=y 598CONFIG_BLK_DEV_IO_TRACE=y
604# CONFIG_KPROBE_EVENT is not set 599CONFIG_UPROBE_EVENT=y
605CONFIG_LKDTM=m 600CONFIG_LKDTM=m
606CONFIG_TEST_LIST_SORT=y 601CONFIG_TEST_LIST_SORT=y
607CONFIG_KPROBES_SANITY_TEST=y 602CONFIG_KPROBES_SANITY_TEST=y
@@ -609,7 +604,10 @@ CONFIG_RBTREE_TEST=y
609CONFIG_INTERVAL_TREE_TEST=m 604CONFIG_INTERVAL_TREE_TEST=m
610CONFIG_PERCPU_TEST=m 605CONFIG_PERCPU_TEST=m
611CONFIG_ATOMIC64_SELFTEST=y 606CONFIG_ATOMIC64_SELFTEST=y
607CONFIG_TEST_STRING_HELPERS=y
608CONFIG_TEST_KSTRTOX=y
612CONFIG_DMA_API_DEBUG=y 609CONFIG_DMA_API_DEBUG=y
610CONFIG_TEST_BPF=m
613# CONFIG_STRICT_DEVMEM is not set 611# CONFIG_STRICT_DEVMEM is not set
614CONFIG_S390_PTDUMP=y 612CONFIG_S390_PTDUMP=y
615CONFIG_ENCRYPTED_KEYS=m 613CONFIG_ENCRYPTED_KEYS=m
@@ -673,12 +671,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
673CONFIG_X509_CERTIFICATE_PARSER=m 671CONFIG_X509_CERTIFICATE_PARSER=m
674CONFIG_CRC7=m 672CONFIG_CRC7=m
675CONFIG_CRC8=m 673CONFIG_CRC8=m
676CONFIG_XZ_DEC_X86=y
677CONFIG_XZ_DEC_POWERPC=y
678CONFIG_XZ_DEC_IA64=y
679CONFIG_XZ_DEC_ARM=y
680CONFIG_XZ_DEC_ARMTHUMB=y
681CONFIG_XZ_DEC_SPARC=y
682CONFIG_CORDIC=m 674CONFIG_CORDIC=m
683CONFIG_CMM=m 675CONFIG_CMM=m
684CONFIG_APPLDATA_BASE=y 676CONFIG_APPLDATA_BASE=y
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index 90f514baa37d..219dca6ea926 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -35,7 +35,6 @@ CONFIG_MODULE_UNLOAD=y
35CONFIG_MODULE_FORCE_UNLOAD=y 35CONFIG_MODULE_FORCE_UNLOAD=y
36CONFIG_MODVERSIONS=y 36CONFIG_MODVERSIONS=y
37CONFIG_MODULE_SRCVERSION_ALL=y 37CONFIG_MODULE_SRCVERSION_ALL=y
38CONFIG_BLK_DEV_INTEGRITY=y
39CONFIG_BLK_DEV_THROTTLING=y 38CONFIG_BLK_DEV_THROTTLING=y
40CONFIG_PARTITION_ADVANCED=y 39CONFIG_PARTITION_ADVANCED=y
41CONFIG_IBM_PARTITION=y 40CONFIG_IBM_PARTITION=y
@@ -243,6 +242,7 @@ CONFIG_NF_TABLES_IPV4=m
243CONFIG_NFT_CHAIN_ROUTE_IPV4=m 242CONFIG_NFT_CHAIN_ROUTE_IPV4=m
244CONFIG_NFT_CHAIN_NAT_IPV4=m 243CONFIG_NFT_CHAIN_NAT_IPV4=m
245CONFIG_NF_TABLES_ARP=m 244CONFIG_NF_TABLES_ARP=m
245CONFIG_NF_NAT_IPV4=m
246CONFIG_IP_NF_IPTABLES=m 246CONFIG_IP_NF_IPTABLES=m
247CONFIG_IP_NF_MATCH_AH=m 247CONFIG_IP_NF_MATCH_AH=m
248CONFIG_IP_NF_MATCH_ECN=m 248CONFIG_IP_NF_MATCH_ECN=m
@@ -250,11 +250,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m
250CONFIG_IP_NF_MATCH_TTL=m 250CONFIG_IP_NF_MATCH_TTL=m
251CONFIG_IP_NF_FILTER=m 251CONFIG_IP_NF_FILTER=m
252CONFIG_IP_NF_TARGET_REJECT=m 252CONFIG_IP_NF_TARGET_REJECT=m
253CONFIG_IP_NF_TARGET_ULOG=m
254CONFIG_NF_NAT_IPV4=m
255CONFIG_IP_NF_TARGET_MASQUERADE=m
256CONFIG_IP_NF_TARGET_NETMAP=m
257CONFIG_IP_NF_TARGET_REDIRECT=m
258CONFIG_IP_NF_MANGLE=m 253CONFIG_IP_NF_MANGLE=m
259CONFIG_IP_NF_TARGET_CLUSTERIP=m 254CONFIG_IP_NF_TARGET_CLUSTERIP=m
260CONFIG_IP_NF_TARGET_ECN=m 255CONFIG_IP_NF_TARGET_ECN=m
@@ -268,6 +263,7 @@ CONFIG_NF_CONNTRACK_IPV6=m
268CONFIG_NF_TABLES_IPV6=m 263CONFIG_NF_TABLES_IPV6=m
269CONFIG_NFT_CHAIN_ROUTE_IPV6=m 264CONFIG_NFT_CHAIN_ROUTE_IPV6=m
270CONFIG_NFT_CHAIN_NAT_IPV6=m 265CONFIG_NFT_CHAIN_NAT_IPV6=m
266CONFIG_NF_NAT_IPV6=m
271CONFIG_IP6_NF_IPTABLES=m 267CONFIG_IP6_NF_IPTABLES=m
272CONFIG_IP6_NF_MATCH_AH=m 268CONFIG_IP6_NF_MATCH_AH=m
273CONFIG_IP6_NF_MATCH_EUI64=m 269CONFIG_IP6_NF_MATCH_EUI64=m
@@ -284,9 +280,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m
284CONFIG_IP6_NF_MANGLE=m 280CONFIG_IP6_NF_MANGLE=m
285CONFIG_IP6_NF_RAW=m 281CONFIG_IP6_NF_RAW=m
286CONFIG_IP6_NF_SECURITY=m 282CONFIG_IP6_NF_SECURITY=m
287CONFIG_NF_NAT_IPV6=m
288CONFIG_IP6_NF_TARGET_MASQUERADE=m
289CONFIG_IP6_NF_TARGET_NPT=m
290CONFIG_NF_TABLES_BRIDGE=m 283CONFIG_NF_TABLES_BRIDGE=m
291CONFIG_NET_SCTPPROBE=m 284CONFIG_NET_SCTPPROBE=m
292CONFIG_RDS=m 285CONFIG_RDS=m
@@ -371,14 +364,13 @@ CONFIG_BLK_DEV_SR=m
371CONFIG_CHR_DEV_SG=y 364CONFIG_CHR_DEV_SG=y
372CONFIG_CHR_DEV_SCH=m 365CONFIG_CHR_DEV_SCH=m
373CONFIG_SCSI_ENCLOSURE=m 366CONFIG_SCSI_ENCLOSURE=m
374CONFIG_SCSI_MULTI_LUN=y
375CONFIG_SCSI_CONSTANTS=y 367CONFIG_SCSI_CONSTANTS=y
376CONFIG_SCSI_LOGGING=y 368CONFIG_SCSI_LOGGING=y
377CONFIG_SCSI_SPI_ATTRS=m 369CONFIG_SCSI_SPI_ATTRS=m
370CONFIG_SCSI_FC_ATTRS=y
378CONFIG_SCSI_SAS_LIBSAS=m 371CONFIG_SCSI_SAS_LIBSAS=m
379CONFIG_SCSI_SRP_ATTRS=m 372CONFIG_SCSI_SRP_ATTRS=m
380CONFIG_ISCSI_TCP=m 373CONFIG_ISCSI_TCP=m
381CONFIG_LIBFCOE=m
382CONFIG_SCSI_DEBUG=m 374CONFIG_SCSI_DEBUG=m
383CONFIG_ZFCP=y 375CONFIG_ZFCP=y
384CONFIG_SCSI_VIRTIO=m 376CONFIG_SCSI_VIRTIO=m
@@ -424,7 +416,6 @@ CONFIG_VIRTIO_NET=m
424CONFIG_NLMON=m 416CONFIG_NLMON=m
425CONFIG_VHOST_NET=m 417CONFIG_VHOST_NET=m
426# CONFIG_NET_VENDOR_ARC is not set 418# CONFIG_NET_VENDOR_ARC is not set
427# CONFIG_NET_CADENCE is not set
428# CONFIG_NET_VENDOR_CHELSIO is not set 419# CONFIG_NET_VENDOR_CHELSIO is not set
429# CONFIG_NET_VENDOR_INTEL is not set 420# CONFIG_NET_VENDOR_INTEL is not set
430# CONFIG_NET_VENDOR_MARVELL is not set 421# CONFIG_NET_VENDOR_MARVELL is not set
@@ -478,13 +469,13 @@ CONFIG_JFS_FS=m
478CONFIG_JFS_POSIX_ACL=y 469CONFIG_JFS_POSIX_ACL=y
479CONFIG_JFS_SECURITY=y 470CONFIG_JFS_SECURITY=y
480CONFIG_JFS_STATISTICS=y 471CONFIG_JFS_STATISTICS=y
481CONFIG_XFS_FS=m 472CONFIG_XFS_FS=y
482CONFIG_XFS_QUOTA=y 473CONFIG_XFS_QUOTA=y
483CONFIG_XFS_POSIX_ACL=y 474CONFIG_XFS_POSIX_ACL=y
484CONFIG_XFS_RT=y 475CONFIG_XFS_RT=y
485CONFIG_GFS2_FS=m 476CONFIG_GFS2_FS=m
486CONFIG_OCFS2_FS=m 477CONFIG_OCFS2_FS=m
487CONFIG_BTRFS_FS=m 478CONFIG_BTRFS_FS=y
488CONFIG_BTRFS_FS_POSIX_ACL=y 479CONFIG_BTRFS_FS_POSIX_ACL=y
489CONFIG_NILFS2_FS=m 480CONFIG_NILFS2_FS=m
490CONFIG_FANOTIFY=y 481CONFIG_FANOTIFY=y
@@ -626,12 +617,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
626CONFIG_X509_CERTIFICATE_PARSER=m 617CONFIG_X509_CERTIFICATE_PARSER=m
627CONFIG_CRC7=m 618CONFIG_CRC7=m
628CONFIG_CRC8=m 619CONFIG_CRC8=m
629CONFIG_XZ_DEC_X86=y
630CONFIG_XZ_DEC_POWERPC=y
631CONFIG_XZ_DEC_IA64=y
632CONFIG_XZ_DEC_ARM=y
633CONFIG_XZ_DEC_ARMTHUMB=y
634CONFIG_XZ_DEC_SPARC=y
635CONFIG_CORDIC=m 620CONFIG_CORDIC=m
636CONFIG_CMM=m 621CONFIG_CMM=m
637CONFIG_APPLDATA_BASE=y 622CONFIG_APPLDATA_BASE=y
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index 13559d32af69..822c2f2e0c25 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -33,7 +33,6 @@ CONFIG_MODULE_UNLOAD=y
33CONFIG_MODULE_FORCE_UNLOAD=y 33CONFIG_MODULE_FORCE_UNLOAD=y
34CONFIG_MODVERSIONS=y 34CONFIG_MODVERSIONS=y
35CONFIG_MODULE_SRCVERSION_ALL=y 35CONFIG_MODULE_SRCVERSION_ALL=y
36CONFIG_BLK_DEV_INTEGRITY=y
37CONFIG_BLK_DEV_THROTTLING=y 36CONFIG_BLK_DEV_THROTTLING=y
38CONFIG_PARTITION_ADVANCED=y 37CONFIG_PARTITION_ADVANCED=y
39CONFIG_IBM_PARTITION=y 38CONFIG_IBM_PARTITION=y
@@ -241,6 +240,7 @@ CONFIG_NF_TABLES_IPV4=m
241CONFIG_NFT_CHAIN_ROUTE_IPV4=m 240CONFIG_NFT_CHAIN_ROUTE_IPV4=m
242CONFIG_NFT_CHAIN_NAT_IPV4=m 241CONFIG_NFT_CHAIN_NAT_IPV4=m
243CONFIG_NF_TABLES_ARP=m 242CONFIG_NF_TABLES_ARP=m
243CONFIG_NF_NAT_IPV4=m
244CONFIG_IP_NF_IPTABLES=m 244CONFIG_IP_NF_IPTABLES=m
245CONFIG_IP_NF_MATCH_AH=m 245CONFIG_IP_NF_MATCH_AH=m
246CONFIG_IP_NF_MATCH_ECN=m 246CONFIG_IP_NF_MATCH_ECN=m
@@ -248,11 +248,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m
248CONFIG_IP_NF_MATCH_TTL=m 248CONFIG_IP_NF_MATCH_TTL=m
249CONFIG_IP_NF_FILTER=m 249CONFIG_IP_NF_FILTER=m
250CONFIG_IP_NF_TARGET_REJECT=m 250CONFIG_IP_NF_TARGET_REJECT=m
251CONFIG_IP_NF_TARGET_ULOG=m
252CONFIG_NF_NAT_IPV4=m
253CONFIG_IP_NF_TARGET_MASQUERADE=m
254CONFIG_IP_NF_TARGET_NETMAP=m
255CONFIG_IP_NF_TARGET_REDIRECT=m
256CONFIG_IP_NF_MANGLE=m 251CONFIG_IP_NF_MANGLE=m
257CONFIG_IP_NF_TARGET_CLUSTERIP=m 252CONFIG_IP_NF_TARGET_CLUSTERIP=m
258CONFIG_IP_NF_TARGET_ECN=m 253CONFIG_IP_NF_TARGET_ECN=m
@@ -266,6 +261,7 @@ CONFIG_NF_CONNTRACK_IPV6=m
266CONFIG_NF_TABLES_IPV6=m 261CONFIG_NF_TABLES_IPV6=m
267CONFIG_NFT_CHAIN_ROUTE_IPV6=m 262CONFIG_NFT_CHAIN_ROUTE_IPV6=m
268CONFIG_NFT_CHAIN_NAT_IPV6=m 263CONFIG_NFT_CHAIN_NAT_IPV6=m
264CONFIG_NF_NAT_IPV6=m
269CONFIG_IP6_NF_IPTABLES=m 265CONFIG_IP6_NF_IPTABLES=m
270CONFIG_IP6_NF_MATCH_AH=m 266CONFIG_IP6_NF_MATCH_AH=m
271CONFIG_IP6_NF_MATCH_EUI64=m 267CONFIG_IP6_NF_MATCH_EUI64=m
@@ -282,9 +278,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m
282CONFIG_IP6_NF_MANGLE=m 278CONFIG_IP6_NF_MANGLE=m
283CONFIG_IP6_NF_RAW=m 279CONFIG_IP6_NF_RAW=m
284CONFIG_IP6_NF_SECURITY=m 280CONFIG_IP6_NF_SECURITY=m
285CONFIG_NF_NAT_IPV6=m
286CONFIG_IP6_NF_TARGET_MASQUERADE=m
287CONFIG_IP6_NF_TARGET_NPT=m
288CONFIG_NF_TABLES_BRIDGE=m 281CONFIG_NF_TABLES_BRIDGE=m
289CONFIG_NET_SCTPPROBE=m 282CONFIG_NET_SCTPPROBE=m
290CONFIG_RDS=m 283CONFIG_RDS=m
@@ -369,14 +362,13 @@ CONFIG_BLK_DEV_SR=m
369CONFIG_CHR_DEV_SG=y 362CONFIG_CHR_DEV_SG=y
370CONFIG_CHR_DEV_SCH=m 363CONFIG_CHR_DEV_SCH=m
371CONFIG_SCSI_ENCLOSURE=m 364CONFIG_SCSI_ENCLOSURE=m
372CONFIG_SCSI_MULTI_LUN=y
373CONFIG_SCSI_CONSTANTS=y 365CONFIG_SCSI_CONSTANTS=y
374CONFIG_SCSI_LOGGING=y 366CONFIG_SCSI_LOGGING=y
375CONFIG_SCSI_SPI_ATTRS=m 367CONFIG_SCSI_SPI_ATTRS=m
368CONFIG_SCSI_FC_ATTRS=y
376CONFIG_SCSI_SAS_LIBSAS=m 369CONFIG_SCSI_SAS_LIBSAS=m
377CONFIG_SCSI_SRP_ATTRS=m 370CONFIG_SCSI_SRP_ATTRS=m
378CONFIG_ISCSI_TCP=m 371CONFIG_ISCSI_TCP=m
379CONFIG_LIBFCOE=m
380CONFIG_SCSI_DEBUG=m 372CONFIG_SCSI_DEBUG=m
381CONFIG_ZFCP=y 373CONFIG_ZFCP=y
382CONFIG_SCSI_VIRTIO=m 374CONFIG_SCSI_VIRTIO=m
@@ -422,7 +414,6 @@ CONFIG_VIRTIO_NET=m
422CONFIG_NLMON=m 414CONFIG_NLMON=m
423CONFIG_VHOST_NET=m 415CONFIG_VHOST_NET=m
424# CONFIG_NET_VENDOR_ARC is not set 416# CONFIG_NET_VENDOR_ARC is not set
425# CONFIG_NET_CADENCE is not set
426# CONFIG_NET_VENDOR_CHELSIO is not set 417# CONFIG_NET_VENDOR_CHELSIO is not set
427# CONFIG_NET_VENDOR_INTEL is not set 418# CONFIG_NET_VENDOR_INTEL is not set
428# CONFIG_NET_VENDOR_MARVELL is not set 419# CONFIG_NET_VENDOR_MARVELL is not set
@@ -476,13 +467,13 @@ CONFIG_JFS_FS=m
476CONFIG_JFS_POSIX_ACL=y 467CONFIG_JFS_POSIX_ACL=y
477CONFIG_JFS_SECURITY=y 468CONFIG_JFS_SECURITY=y
478CONFIG_JFS_STATISTICS=y 469CONFIG_JFS_STATISTICS=y
479CONFIG_XFS_FS=m 470CONFIG_XFS_FS=y
480CONFIG_XFS_QUOTA=y 471CONFIG_XFS_QUOTA=y
481CONFIG_XFS_POSIX_ACL=y 472CONFIG_XFS_POSIX_ACL=y
482CONFIG_XFS_RT=y 473CONFIG_XFS_RT=y
483CONFIG_GFS2_FS=m 474CONFIG_GFS2_FS=m
484CONFIG_OCFS2_FS=m 475CONFIG_OCFS2_FS=m
485CONFIG_BTRFS_FS=m 476CONFIG_BTRFS_FS=y
486CONFIG_BTRFS_FS_POSIX_ACL=y 477CONFIG_BTRFS_FS_POSIX_ACL=y
487CONFIG_NILFS2_FS=m 478CONFIG_NILFS2_FS=m
488CONFIG_FANOTIFY=y 479CONFIG_FANOTIFY=y
@@ -550,8 +541,11 @@ CONFIG_TIMER_STATS=y
550CONFIG_RCU_TORTURE_TEST=m 541CONFIG_RCU_TORTURE_TEST=m
551CONFIG_RCU_CPU_STALL_TIMEOUT=60 542CONFIG_RCU_CPU_STALL_TIMEOUT=60
552CONFIG_LATENCYTOP=y 543CONFIG_LATENCYTOP=y
544CONFIG_SCHED_TRACER=y
545CONFIG_FTRACE_SYSCALLS=y
546CONFIG_STACK_TRACER=y
553CONFIG_BLK_DEV_IO_TRACE=y 547CONFIG_BLK_DEV_IO_TRACE=y
554# CONFIG_KPROBE_EVENT is not set 548CONFIG_UPROBE_EVENT=y
555CONFIG_LKDTM=m 549CONFIG_LKDTM=m
556CONFIG_PERCPU_TEST=m 550CONFIG_PERCPU_TEST=m
557CONFIG_ATOMIC64_SELFTEST=y 551CONFIG_ATOMIC64_SELFTEST=y
@@ -618,12 +612,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
618CONFIG_X509_CERTIFICATE_PARSER=m 612CONFIG_X509_CERTIFICATE_PARSER=m
619CONFIG_CRC7=m 613CONFIG_CRC7=m
620CONFIG_CRC8=m 614CONFIG_CRC8=m
621CONFIG_XZ_DEC_X86=y
622CONFIG_XZ_DEC_POWERPC=y
623CONFIG_XZ_DEC_IA64=y
624CONFIG_XZ_DEC_ARM=y
625CONFIG_XZ_DEC_ARMTHUMB=y
626CONFIG_XZ_DEC_SPARC=y
627CONFIG_CORDIC=m 615CONFIG_CORDIC=m
628CONFIG_CMM=m 616CONFIG_CMM=m
629CONFIG_APPLDATA_BASE=y 617CONFIG_APPLDATA_BASE=y
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig
index e376789f2d8d..9d63051ebec4 100644
--- a/arch/s390/configs/zfcpdump_defconfig
+++ b/arch/s390/configs/zfcpdump_defconfig
@@ -22,8 +22,8 @@ CONFIG_HZ_100=y
22CONFIG_CRASH_DUMP=y 22CONFIG_CRASH_DUMP=y
23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
24# CONFIG_SECCOMP is not set 24# CONFIG_SECCOMP is not set
25# CONFIG_IUCV is not set
26CONFIG_NET=y 25CONFIG_NET=y
26# CONFIG_IUCV is not set
27CONFIG_ATM=y 27CONFIG_ATM=y
28CONFIG_ATM_LANE=y 28CONFIG_ATM_LANE=y
29CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 29CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
@@ -36,9 +36,9 @@ CONFIG_ENCLOSURE_SERVICES=y
36CONFIG_SCSI=y 36CONFIG_SCSI=y
37CONFIG_BLK_DEV_SD=y 37CONFIG_BLK_DEV_SD=y
38CONFIG_SCSI_ENCLOSURE=y 38CONFIG_SCSI_ENCLOSURE=y
39CONFIG_SCSI_MULTI_LUN=y
40CONFIG_SCSI_CONSTANTS=y 39CONFIG_SCSI_CONSTANTS=y
41CONFIG_SCSI_LOGGING=y 40CONFIG_SCSI_LOGGING=y
41CONFIG_SCSI_FC_ATTRS=y
42CONFIG_SCSI_SRP_ATTRS=y 42CONFIG_SCSI_SRP_ATTRS=y
43CONFIG_ZFCP=y 43CONFIG_ZFCP=y
44# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 44# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
@@ -75,12 +75,6 @@ CONFIG_DEBUG_KERNEL=y
75CONFIG_RCU_CPU_STALL_TIMEOUT=60 75CONFIG_RCU_CPU_STALL_TIMEOUT=60
76# CONFIG_FTRACE is not set 76# CONFIG_FTRACE is not set
77# CONFIG_STRICT_DEVMEM is not set 77# CONFIG_STRICT_DEVMEM is not set
78CONFIG_XZ_DEC_X86=y
79CONFIG_XZ_DEC_POWERPC=y
80CONFIG_XZ_DEC_IA64=y
81CONFIG_XZ_DEC_ARM=y
82CONFIG_XZ_DEC_ARMTHUMB=y
83CONFIG_XZ_DEC_SPARC=y
84# CONFIG_PFAULT is not set 78# CONFIG_PFAULT is not set
85# CONFIG_S390_HYPFS_FS is not set 79# CONFIG_S390_HYPFS_FS is not set
86# CONFIG_VIRTUALIZATION is not set 80# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index fab35a8efa4f..785c5f24d6f9 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -92,10 +92,10 @@ CONFIG_CHR_DEV_ST=y
92CONFIG_BLK_DEV_SR=y 92CONFIG_BLK_DEV_SR=y
93CONFIG_BLK_DEV_SR_VENDOR=y 93CONFIG_BLK_DEV_SR_VENDOR=y
94CONFIG_CHR_DEV_SG=y 94CONFIG_CHR_DEV_SG=y
95CONFIG_SCSI_MULTI_LUN=y
96CONFIG_SCSI_CONSTANTS=y 95CONFIG_SCSI_CONSTANTS=y
97CONFIG_SCSI_LOGGING=y 96CONFIG_SCSI_LOGGING=y
98CONFIG_SCSI_SCAN_ASYNC=y 97CONFIG_SCSI_SCAN_ASYNC=y
98CONFIG_SCSI_FC_ATTRS=y
99CONFIG_ZFCP=y 99CONFIG_ZFCP=y
100CONFIG_SCSI_VIRTIO=y 100CONFIG_SCSI_VIRTIO=y
101CONFIG_NETDEVICES=y 101CONFIG_NETDEVICES=y
@@ -164,14 +164,13 @@ CONFIG_CRYPTO_CMAC=m
164CONFIG_CRYPTO_XCBC=m 164CONFIG_CRYPTO_XCBC=m
165CONFIG_CRYPTO_VMAC=m 165CONFIG_CRYPTO_VMAC=m
166CONFIG_CRYPTO_CRC32=m 166CONFIG_CRYPTO_CRC32=m
167CONFIG_CRYPTO_CRCT10DIF=m
168CONFIG_CRYPTO_MD4=m 167CONFIG_CRYPTO_MD4=m
169CONFIG_CRYPTO_MICHAEL_MIC=m 168CONFIG_CRYPTO_MICHAEL_MIC=m
170CONFIG_CRYPTO_RMD128=m 169CONFIG_CRYPTO_RMD128=m
171CONFIG_CRYPTO_RMD160=m 170CONFIG_CRYPTO_RMD160=m
172CONFIG_CRYPTO_RMD256=m 171CONFIG_CRYPTO_RMD256=m
173CONFIG_CRYPTO_RMD320=m 172CONFIG_CRYPTO_RMD320=m
174CONFIG_CRYPTO_SHA256=m 173CONFIG_CRYPTO_SHA256=y
175CONFIG_CRYPTO_SHA512=m 174CONFIG_CRYPTO_SHA512=m
176CONFIG_CRYPTO_TGR192=m 175CONFIG_CRYPTO_TGR192=m
177CONFIG_CRYPTO_WP512=m 176CONFIG_CRYPTO_WP512=m
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index 51d14fe5eb9a..ca1cabb3a96c 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -121,6 +121,8 @@ unsigned long __kprobes prepare_ftrace_return(unsigned long parent,
121{ 121{
122 struct ftrace_graph_ent trace; 122 struct ftrace_graph_ent trace;
123 123
124 if (unlikely(ftrace_graph_is_dead()))
125 goto out;
124 if (unlikely(atomic_read(&current->tracing_graph_pause))) 126 if (unlikely(atomic_read(&current->tracing_graph_pause)))
125 goto out; 127 goto out;
126 ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE; 128 ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE;
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 48c2206a3956..5eec9afbb5b5 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -19,6 +19,7 @@
19 .type __kernel_clock_gettime,@function 19 .type __kernel_clock_gettime,@function
20__kernel_clock_gettime: 20__kernel_clock_gettime:
21 .cfi_startproc 21 .cfi_startproc
22 ahi %r15,-16
22 basr %r5,0 23 basr %r5,0
230: al %r5,21f-0b(%r5) /* get &_vdso_data */ 240: al %r5,21f-0b(%r5) /* get &_vdso_data */
24 chi %r2,__CLOCK_REALTIME_COARSE 25 chi %r2,__CLOCK_REALTIME_COARSE
@@ -34,8 +35,8 @@ __kernel_clock_gettime:
341: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ 351: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
35 tml %r4,0x0001 /* pending update ? loop */ 36 tml %r4,0x0001 /* pending update ? loop */
36 jnz 1b 37 jnz 1b
37 stcke 24(%r15) /* Store TOD clock */ 38 stcke 0(%r15) /* Store TOD clock */
38 lm %r0,%r1,25(%r15) 39 lm %r0,%r1,1(%r15)
39 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 40 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
40 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 41 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
41 brc 3,2f 42 brc 3,2f
@@ -70,6 +71,7 @@ __kernel_clock_gettime:
708: st %r2,0(%r3) /* store tp->tv_sec */ 718: st %r2,0(%r3) /* store tp->tv_sec */
71 st %r1,4(%r3) /* store tp->tv_nsec */ 72 st %r1,4(%r3) /* store tp->tv_nsec */
72 lhi %r2,0 73 lhi %r2,0
74 ahi %r15,16
73 br %r14 75 br %r14
74 76
75 /* CLOCK_MONOTONIC_COARSE */ 77 /* CLOCK_MONOTONIC_COARSE */
@@ -96,8 +98,8 @@ __kernel_clock_gettime:
9611: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ 9811: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
97 tml %r4,0x0001 /* pending update ? loop */ 99 tml %r4,0x0001 /* pending update ? loop */
98 jnz 11b 100 jnz 11b
99 stcke 24(%r15) /* Store TOD clock */ 101 stcke 0(%r15) /* Store TOD clock */
100 lm %r0,%r1,25(%r15) 102 lm %r0,%r1,1(%r15)
101 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 103 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
102 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 104 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
103 brc 3,12f 105 brc 3,12f
@@ -132,11 +134,13 @@ __kernel_clock_gettime:
13217: st %r2,0(%r3) /* store tp->tv_sec */ 13417: st %r2,0(%r3) /* store tp->tv_sec */
133 st %r1,4(%r3) /* store tp->tv_nsec */ 135 st %r1,4(%r3) /* store tp->tv_nsec */
134 lhi %r2,0 136 lhi %r2,0
137 ahi %r15,16
135 br %r14 138 br %r14
136 139
137 /* Fallback to system call */ 140 /* Fallback to system call */
13819: lhi %r1,__NR_clock_gettime 14119: lhi %r1,__NR_clock_gettime
139 svc 0 142 svc 0
143 ahi %r15,16
140 br %r14 144 br %r14
141 145
14220: .long 1000000000 14620: .long 1000000000
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S
index 60def5f562db..719de6186b20 100644
--- a/arch/s390/kernel/vdso32/gettimeofday.S
+++ b/arch/s390/kernel/vdso32/gettimeofday.S
@@ -19,6 +19,7 @@
19 .type __kernel_gettimeofday,@function 19 .type __kernel_gettimeofday,@function
20__kernel_gettimeofday: 20__kernel_gettimeofday:
21 .cfi_startproc 21 .cfi_startproc
22 ahi %r15,-16
22 basr %r5,0 23 basr %r5,0
230: al %r5,13f-0b(%r5) /* get &_vdso_data */ 240: al %r5,13f-0b(%r5) /* get &_vdso_data */
241: ltr %r3,%r3 /* check if tz is NULL */ 251: ltr %r3,%r3 /* check if tz is NULL */
@@ -29,30 +30,30 @@ __kernel_gettimeofday:
29 l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ 30 l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */
30 tml %r4,0x0001 /* pending update ? loop */ 31 tml %r4,0x0001 /* pending update ? loop */
31 jnz 1b 32 jnz 1b
32 stcke 24(%r15) /* Store TOD clock */ 33 stcke 0(%r15) /* Store TOD clock */
33 lm %r0,%r1,25(%r15) 34 lm %r0,%r1,1(%r15)
34 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 35 s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
35 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 36 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
36 brc 3,3f 37 brc 3,3f
37 ahi %r0,-1 38 ahi %r0,-1
383: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ 393: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */
39 st %r0,24(%r15) 40 st %r0,0(%r15)
40 l %r0,__VDSO_TK_MULT(%r5) 41 l %r0,__VDSO_TK_MULT(%r5)
41 ltr %r1,%r1 42 ltr %r1,%r1
42 mr %r0,%r0 43 mr %r0,%r0
43 jnm 4f 44 jnm 4f
44 a %r0,__VDSO_TK_MULT(%r5) 45 a %r0,__VDSO_TK_MULT(%r5)
454: al %r0,24(%r15) 464: al %r0,0(%r15)
46 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
47 al %r1,__VDSO_XTIME_NSEC+4(%r5) 48 al %r1,__VDSO_XTIME_NSEC+4(%r5)
48 brc 12,5f 49 brc 12,5f
49 ahi %r0,1 50 ahi %r0,1
505: mvc 24(4,%r15),__VDSO_XTIME_SEC+4(%r5) 515: mvc 0(4,%r15),__VDSO_XTIME_SEC+4(%r5)
51 cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ 52 cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */
52 jne 1b 53 jne 1b
53 l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ 54 l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */
54 srdl %r0,0(%r4) /* >> tk->shift */ 55 srdl %r0,0(%r4) /* >> tk->shift */
55 l %r4,24(%r15) /* get tv_sec from stack */ 56 l %r4,0(%r15) /* get tv_sec from stack */
56 basr %r5,0 57 basr %r5,0
576: ltr %r0,%r0 586: ltr %r0,%r0
58 jnz 7f 59 jnz 7f
@@ -71,6 +72,7 @@ __kernel_gettimeofday:
719: srl %r0,6 729: srl %r0,6
72 st %r0,4(%r2) /* store tv->tv_usec */ 73 st %r0,4(%r2) /* store tv->tv_usec */
7310: slr %r2,%r2 7410: slr %r2,%r2
75 ahi %r15,16
74 br %r14 76 br %r14
7511: .long 1000000000 7711: .long 1000000000
7612: .long 274877907 7812: .long 274877907
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index 9d9761f8e110..7699e735ae28 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -19,6 +19,7 @@
19 .type __kernel_clock_gettime,@function 19 .type __kernel_clock_gettime,@function
20__kernel_clock_gettime: 20__kernel_clock_gettime:
21 .cfi_startproc 21 .cfi_startproc
22 aghi %r15,-16
22 larl %r5,_vdso_data 23 larl %r5,_vdso_data
23 cghi %r2,__CLOCK_REALTIME_COARSE 24 cghi %r2,__CLOCK_REALTIME_COARSE
24 je 4f 25 je 4f
@@ -37,10 +38,10 @@ __kernel_clock_gettime:
370: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ 380: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
38 tmll %r4,0x0001 /* pending update ? loop */ 39 tmll %r4,0x0001 /* pending update ? loop */
39 jnz 0b 40 jnz 0b
40 stcke 48(%r15) /* Store TOD clock */ 41 stcke 0(%r15) /* Store TOD clock */
41 lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ 42 lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */
42 lg %r0,__VDSO_WTOM_SEC(%r5) 43 lg %r0,__VDSO_WTOM_SEC(%r5)
43 lg %r1,49(%r15) 44 lg %r1,1(%r15)
44 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 45 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
45 msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ 46 msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */
46 alg %r1,__VDSO_WTOM_NSEC(%r5) 47 alg %r1,__VDSO_WTOM_NSEC(%r5)
@@ -56,6 +57,7 @@ __kernel_clock_gettime:
562: stg %r0,0(%r3) /* store tp->tv_sec */ 572: stg %r0,0(%r3) /* store tp->tv_sec */
57 stg %r1,8(%r3) /* store tp->tv_nsec */ 58 stg %r1,8(%r3) /* store tp->tv_nsec */
58 lghi %r2,0 59 lghi %r2,0
60 aghi %r15,16
59 br %r14 61 br %r14
60 62
61 /* CLOCK_MONOTONIC_COARSE */ 63 /* CLOCK_MONOTONIC_COARSE */
@@ -82,9 +84,9 @@ __kernel_clock_gettime:
825: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ 845: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
83 tmll %r4,0x0001 /* pending update ? loop */ 85 tmll %r4,0x0001 /* pending update ? loop */
84 jnz 5b 86 jnz 5b
85 stcke 48(%r15) /* Store TOD clock */ 87 stcke 0(%r15) /* Store TOD clock */
86 lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ 88 lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */
87 lg %r1,49(%r15) 89 lg %r1,1(%r15)
88 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 90 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
89 msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ 91 msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */
90 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ 92 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */
@@ -101,6 +103,7 @@ __kernel_clock_gettime:
1017: stg %r0,0(%r3) /* store tp->tv_sec */ 1037: stg %r0,0(%r3) /* store tp->tv_sec */
102 stg %r1,8(%r3) /* store tp->tv_nsec */ 104 stg %r1,8(%r3) /* store tp->tv_nsec */
103 lghi %r2,0 105 lghi %r2,0
106 aghi %r15,16
104 br %r14 107 br %r14
105 108
106 /* CLOCK_THREAD_CPUTIME_ID for this thread */ 109 /* CLOCK_THREAD_CPUTIME_ID for this thread */
@@ -134,11 +137,13 @@ __kernel_clock_gettime:
134 slgr %r4,%r0 /* r4 = tv_nsec */ 137 slgr %r4,%r0 /* r4 = tv_nsec */
135 stg %r4,8(%r3) 138 stg %r4,8(%r3)
136 lghi %r2,0 139 lghi %r2,0
140 aghi %r15,16
137 br %r14 141 br %r14
138 142
139 /* Fallback to system call */ 143 /* Fallback to system call */
14012: lghi %r1,__NR_clock_gettime 14412: lghi %r1,__NR_clock_gettime
141 svc 0 145 svc 0
146 aghi %r15,16
142 br %r14 147 br %r14
143 148
14413: .quad 1000000000 14913: .quad 1000000000
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S
index 7a344995a97f..6ce46707663c 100644
--- a/arch/s390/kernel/vdso64/gettimeofday.S
+++ b/arch/s390/kernel/vdso64/gettimeofday.S
@@ -19,6 +19,7 @@
19 .type __kernel_gettimeofday,@function 19 .type __kernel_gettimeofday,@function
20__kernel_gettimeofday: 20__kernel_gettimeofday:
21 .cfi_startproc 21 .cfi_startproc
22 aghi %r15,-16
22 larl %r5,_vdso_data 23 larl %r5,_vdso_data
230: ltgr %r3,%r3 /* check if tz is NULL */ 240: ltgr %r3,%r3 /* check if tz is NULL */
24 je 1f 25 je 1f
@@ -28,8 +29,8 @@ __kernel_gettimeofday:
28 lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ 29 lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */
29 tmll %r4,0x0001 /* pending update ? loop */ 30 tmll %r4,0x0001 /* pending update ? loop */
30 jnz 0b 31 jnz 0b
31 stcke 48(%r15) /* Store TOD clock */ 32 stcke 0(%r15) /* Store TOD clock */
32 lg %r1,49(%r15) 33 lg %r1,1(%r15)
33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 34 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
34 msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ 35 msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */
35 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ 36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */
@@ -50,6 +51,7 @@ __kernel_gettimeofday:
50 srlg %r0,%r0,6 51 srlg %r0,%r0,6
51 stg %r0,8(%r2) /* store tv->tv_usec */ 52 stg %r0,8(%r2) /* store tv->tv_usec */
524: lghi %r2,0 534: lghi %r2,0
54 aghi %r15,16
53 br %r14 55 br %r14
545: .quad 1000000000 565: .quad 1000000000
55 .long 274877907 57 .long 274877907
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 416f2a323ba5..7f0089d9a4aa 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -66,7 +66,11 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
66 clock = S390_lowcore.last_update_clock; 66 clock = S390_lowcore.last_update_clock;
67 asm volatile( 67 asm volatile(
68 " stpt %0\n" /* Store current cpu timer value */ 68 " stpt %0\n" /* Store current cpu timer value */
69#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
70 " stckf %1" /* Store current tod clock value */
71#else
69 " stck %1" /* Store current tod clock value */ 72 " stck %1" /* Store current tod clock value */
73#endif
70 : "=m" (S390_lowcore.last_update_timer), 74 : "=m" (S390_lowcore.last_update_timer),
71 "=m" (S390_lowcore.last_update_clock)); 75 "=m" (S390_lowcore.last_update_clock));
72 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 76 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 749f9fa38254..9f8a2faf5040 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -574,12 +574,14 @@ static inline int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst,
574 case 4: 574 case 4:
575 ctxt->_eip = (u32)dst; 575 ctxt->_eip = (u32)dst;
576 break; 576 break;
577#ifdef CONFIG_X86_64
577 case 8: 578 case 8:
578 if ((cs_l && is_noncanonical_address(dst)) || 579 if ((cs_l && is_noncanonical_address(dst)) ||
579 (!cs_l && (dst & ~(u32)-1))) 580 (!cs_l && (dst >> 32) != 0))
580 return emulate_gp(ctxt, 0); 581 return emulate_gp(ctxt, 0);
581 ctxt->_eip = dst; 582 ctxt->_eip = dst;
582 break; 583 break;
584#endif
583 default: 585 default:
584 WARN(1, "unsupported eip assignment size\n"); 586 WARN(1, "unsupported eip assignment size\n");
585 } 587 }
@@ -641,7 +643,8 @@ static bool insn_aligned(struct x86_emulate_ctxt *ctxt, unsigned size)
641 643
642static int __linearize(struct x86_emulate_ctxt *ctxt, 644static int __linearize(struct x86_emulate_ctxt *ctxt,
643 struct segmented_address addr, 645 struct segmented_address addr,
644 unsigned size, bool write, bool fetch, 646 unsigned *max_size, unsigned size,
647 bool write, bool fetch,
645 ulong *linear) 648 ulong *linear)
646{ 649{
647 struct desc_struct desc; 650 struct desc_struct desc;
@@ -652,10 +655,15 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
652 unsigned cpl; 655 unsigned cpl;
653 656
654 la = seg_base(ctxt, addr.seg) + addr.ea; 657 la = seg_base(ctxt, addr.seg) + addr.ea;
658 *max_size = 0;
655 switch (ctxt->mode) { 659 switch (ctxt->mode) {
656 case X86EMUL_MODE_PROT64: 660 case X86EMUL_MODE_PROT64:
657 if (((signed long)la << 16) >> 16 != la) 661 if (((signed long)la << 16) >> 16 != la)
658 return emulate_gp(ctxt, 0); 662 return emulate_gp(ctxt, 0);
663
664 *max_size = min_t(u64, ~0u, (1ull << 48) - la);
665 if (size > *max_size)
666 goto bad;
659 break; 667 break;
660 default: 668 default:
661 usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, 669 usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL,
@@ -673,20 +681,25 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
673 if ((ctxt->mode == X86EMUL_MODE_REAL) && !fetch && 681 if ((ctxt->mode == X86EMUL_MODE_REAL) && !fetch &&
674 (ctxt->d & NoBigReal)) { 682 (ctxt->d & NoBigReal)) {
675 /* la is between zero and 0xffff */ 683 /* la is between zero and 0xffff */
676 if (la > 0xffff || (u32)(la + size - 1) > 0xffff) 684 if (la > 0xffff)
677 goto bad; 685 goto bad;
686 *max_size = 0x10000 - la;
678 } else if ((desc.type & 8) || !(desc.type & 4)) { 687 } else if ((desc.type & 8) || !(desc.type & 4)) {
679 /* expand-up segment */ 688 /* expand-up segment */
680 if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) 689 if (addr.ea > lim)
681 goto bad; 690 goto bad;
691 *max_size = min_t(u64, ~0u, (u64)lim + 1 - addr.ea);
682 } else { 692 } else {
683 /* expand-down segment */ 693 /* expand-down segment */
684 if (addr.ea <= lim || (u32)(addr.ea + size - 1) <= lim) 694 if (addr.ea <= lim)
685 goto bad; 695 goto bad;
686 lim = desc.d ? 0xffffffff : 0xffff; 696 lim = desc.d ? 0xffffffff : 0xffff;
687 if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) 697 if (addr.ea > lim)
688 goto bad; 698 goto bad;
699 *max_size = min_t(u64, ~0u, (u64)lim + 1 - addr.ea);
689 } 700 }
701 if (size > *max_size)
702 goto bad;
690 cpl = ctxt->ops->cpl(ctxt); 703 cpl = ctxt->ops->cpl(ctxt);
691 if (!(desc.type & 8)) { 704 if (!(desc.type & 8)) {
692 /* data segment */ 705 /* data segment */
@@ -711,9 +724,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
711 return X86EMUL_CONTINUE; 724 return X86EMUL_CONTINUE;
712bad: 725bad:
713 if (addr.seg == VCPU_SREG_SS) 726 if (addr.seg == VCPU_SREG_SS)
714 return emulate_ss(ctxt, sel); 727 return emulate_ss(ctxt, 0);
715 else 728 else
716 return emulate_gp(ctxt, sel); 729 return emulate_gp(ctxt, 0);
717} 730}
718 731
719static int linearize(struct x86_emulate_ctxt *ctxt, 732static int linearize(struct x86_emulate_ctxt *ctxt,
@@ -721,7 +734,8 @@ static int linearize(struct x86_emulate_ctxt *ctxt,
721 unsigned size, bool write, 734 unsigned size, bool write,
722 ulong *linear) 735 ulong *linear)
723{ 736{
724 return __linearize(ctxt, addr, size, write, false, linear); 737 unsigned max_size;
738 return __linearize(ctxt, addr, &max_size, size, write, false, linear);
725} 739}
726 740
727 741
@@ -746,17 +760,27 @@ static int segmented_read_std(struct x86_emulate_ctxt *ctxt,
746static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) 760static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size)
747{ 761{
748 int rc; 762 int rc;
749 unsigned size; 763 unsigned size, max_size;
750 unsigned long linear; 764 unsigned long linear;
751 int cur_size = ctxt->fetch.end - ctxt->fetch.data; 765 int cur_size = ctxt->fetch.end - ctxt->fetch.data;
752 struct segmented_address addr = { .seg = VCPU_SREG_CS, 766 struct segmented_address addr = { .seg = VCPU_SREG_CS,
753 .ea = ctxt->eip + cur_size }; 767 .ea = ctxt->eip + cur_size };
754 768
755 size = 15UL ^ cur_size; 769 /*
756 rc = __linearize(ctxt, addr, size, false, true, &linear); 770 * We do not know exactly how many bytes will be needed, and
771 * __linearize is expensive, so fetch as much as possible. We
772 * just have to avoid going beyond the 15 byte limit, the end
773 * of the segment, or the end of the page.
774 *
775 * __linearize is called with size 0 so that it does not do any
776 * boundary check itself. Instead, we use max_size to check
777 * against op_size.
778 */
779 rc = __linearize(ctxt, addr, &max_size, 0, false, true, &linear);
757 if (unlikely(rc != X86EMUL_CONTINUE)) 780 if (unlikely(rc != X86EMUL_CONTINUE))
758 return rc; 781 return rc;
759 782
783 size = min_t(unsigned, 15UL ^ cur_size, max_size);
760 size = min_t(unsigned, size, PAGE_SIZE - offset_in_page(linear)); 784 size = min_t(unsigned, size, PAGE_SIZE - offset_in_page(linear));
761 785
762 /* 786 /*
@@ -766,7 +790,8 @@ static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size)
766 * still, we must have hit the 15-byte boundary. 790 * still, we must have hit the 15-byte boundary.
767 */ 791 */
768 if (unlikely(size < op_size)) 792 if (unlikely(size < op_size))
769 return X86EMUL_UNHANDLEABLE; 793 return emulate_gp(ctxt, 0);
794
770 rc = ctxt->ops->fetch(ctxt, linear, ctxt->fetch.end, 795 rc = ctxt->ops->fetch(ctxt, linear, ctxt->fetch.end,
771 size, &ctxt->exception); 796 size, &ctxt->exception);
772 if (unlikely(rc != X86EMUL_CONTINUE)) 797 if (unlikely(rc != X86EMUL_CONTINUE))
@@ -2012,7 +2037,7 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
2012 2037
2013 rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l); 2038 rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l);
2014 if (rc != X86EMUL_CONTINUE) { 2039 if (rc != X86EMUL_CONTINUE) {
2015 WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); 2040 WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64);
2016 /* assigning eip failed; restore the old cs */ 2041 /* assigning eip failed; restore the old cs */
2017 ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); 2042 ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS);
2018 return rc; 2043 return rc;
@@ -2109,7 +2134,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
2109 return rc; 2134 return rc;
2110 rc = assign_eip_far(ctxt, eip, new_desc.l); 2135 rc = assign_eip_far(ctxt, eip, new_desc.l);
2111 if (rc != X86EMUL_CONTINUE) { 2136 if (rc != X86EMUL_CONTINUE) {
2112 WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); 2137 WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64);
2113 ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); 2138 ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS);
2114 } 2139 }
2115 return rc; 2140 return rc;
@@ -4262,6 +4287,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4262 fetch_register_operand(op); 4287 fetch_register_operand(op);
4263 break; 4288 break;
4264 case OpCL: 4289 case OpCL:
4290 op->type = OP_IMM;
4265 op->bytes = 1; 4291 op->bytes = 1;
4266 op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; 4292 op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff;
4267 break; 4293 break;
@@ -4269,6 +4295,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4269 rc = decode_imm(ctxt, op, 1, true); 4295 rc = decode_imm(ctxt, op, 1, true);
4270 break; 4296 break;
4271 case OpOne: 4297 case OpOne:
4298 op->type = OP_IMM;
4272 op->bytes = 1; 4299 op->bytes = 1;
4273 op->val = 1; 4300 op->val = 1;
4274 break; 4301 break;
@@ -4327,21 +4354,27 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4327 ctxt->memop.bytes = ctxt->op_bytes + 2; 4354 ctxt->memop.bytes = ctxt->op_bytes + 2;
4328 goto mem_common; 4355 goto mem_common;
4329 case OpES: 4356 case OpES:
4357 op->type = OP_IMM;
4330 op->val = VCPU_SREG_ES; 4358 op->val = VCPU_SREG_ES;
4331 break; 4359 break;
4332 case OpCS: 4360 case OpCS:
4361 op->type = OP_IMM;
4333 op->val = VCPU_SREG_CS; 4362 op->val = VCPU_SREG_CS;
4334 break; 4363 break;
4335 case OpSS: 4364 case OpSS:
4365 op->type = OP_IMM;
4336 op->val = VCPU_SREG_SS; 4366 op->val = VCPU_SREG_SS;
4337 break; 4367 break;
4338 case OpDS: 4368 case OpDS:
4369 op->type = OP_IMM;
4339 op->val = VCPU_SREG_DS; 4370 op->val = VCPU_SREG_DS;
4340 break; 4371 break;
4341 case OpFS: 4372 case OpFS:
4373 op->type = OP_IMM;
4342 op->val = VCPU_SREG_FS; 4374 op->val = VCPU_SREG_FS;
4343 break; 4375 break;
4344 case OpGS: 4376 case OpGS:
4377 op->type = OP_IMM;
4345 op->val = VCPU_SREG_GS; 4378 op->val = VCPU_SREG_GS;
4346 break; 4379 break;
4347 case OpImplicit: 4380 case OpImplicit:
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index a8b76c4c95e2..3e556c68351b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4579,7 +4579,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4579 vmcs_write32(TPR_THRESHOLD, 0); 4579 vmcs_write32(TPR_THRESHOLD, 0);
4580 } 4580 }
4581 4581
4582 kvm_vcpu_reload_apic_access_page(vcpu); 4582 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
4583 4583
4584 if (vmx_vm_has_apicv(vcpu->kvm)) 4584 if (vmx_vm_has_apicv(vcpu->kvm))
4585 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc)); 4585 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
@@ -6426,6 +6426,8 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx)
6426 const unsigned long *fields = shadow_read_write_fields; 6426 const unsigned long *fields = shadow_read_write_fields;
6427 const int num_fields = max_shadow_read_write_fields; 6427 const int num_fields = max_shadow_read_write_fields;
6428 6428
6429 preempt_disable();
6430
6429 vmcs_load(shadow_vmcs); 6431 vmcs_load(shadow_vmcs);
6430 6432
6431 for (i = 0; i < num_fields; i++) { 6433 for (i = 0; i < num_fields; i++) {
@@ -6449,6 +6451,8 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx)
6449 6451
6450 vmcs_clear(shadow_vmcs); 6452 vmcs_clear(shadow_vmcs);
6451 vmcs_load(vmx->loaded_vmcs->vmcs); 6453 vmcs_load(vmx->loaded_vmcs->vmcs);
6454
6455 preempt_enable();
6452} 6456}
6453 6457
6454static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) 6458static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 49c6c3d94449..81f57e8c8f1b 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -319,8 +319,8 @@ config XTENSA_PLATFORM_S6105
319 319
320config XTENSA_PLATFORM_XTFPGA 320config XTENSA_PLATFORM_XTFPGA
321 bool "XTFPGA" 321 bool "XTFPGA"
322 select ETHOC if ETHERNET
322 select SERIAL_CONSOLE 323 select SERIAL_CONSOLE
323 select ETHOC
324 select XTENSA_CALIBRATE_CCOUNT 324 select XTENSA_CALIBRATE_CCOUNT
325 help 325 help
326 XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605). 326 XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605).
@@ -367,7 +367,7 @@ config BUILTIN_DTB
367config BLK_DEV_SIMDISK 367config BLK_DEV_SIMDISK
368 tristate "Host file-based simulated block device support" 368 tristate "Host file-based simulated block device support"
369 default n 369 default n
370 depends on XTENSA_PLATFORM_ISS 370 depends on XTENSA_PLATFORM_ISS && BLOCK
371 help 371 help
372 Create block devices that map to files in the host file system. 372 Create block devices that map to files in the host file system.
373 Device binding to host file may be changed at runtime via proc 373 Device binding to host file may be changed at runtime via proc
diff --git a/arch/xtensa/boot/dts/lx200mx.dts b/arch/xtensa/boot/dts/lx200mx.dts
new file mode 100644
index 000000000000..249822b99bd6
--- /dev/null
+++ b/arch/xtensa/boot/dts/lx200mx.dts
@@ -0,0 +1,16 @@
1/dts-v1/;
2/include/ "xtfpga.dtsi"
3/include/ "xtfpga-flash-16m.dtsi"
4
5/ {
6 compatible = "cdns,xtensa-lx200";
7 memory@0 {
8 device_type = "memory";
9 reg = <0x00000000 0x06000000>;
10 };
11 pic: pic {
12 compatible = "cdns,xtensa-mx";
13 #interrupt-cells = <2>;
14 interrupt-controller;
15 };
16};
diff --git a/arch/xtensa/configs/generic_kc705_defconfig b/arch/xtensa/configs/generic_kc705_defconfig
new file mode 100644
index 000000000000..f4b7b3888da8
--- /dev/null
+++ b/arch/xtensa/configs/generic_kc705_defconfig
@@ -0,0 +1,131 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_IRQ_DOMAIN_DEBUG=y
5CONFIG_NO_HZ_IDLE=y
6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_IRQ_TIME_ACCOUNTING=y
8CONFIG_BSD_PROCESS_ACCT=y
9CONFIG_CGROUP_DEBUG=y
10CONFIG_CGROUP_FREEZER=y
11CONFIG_CGROUP_DEVICE=y
12CONFIG_CPUSETS=y
13CONFIG_CGROUP_CPUACCT=y
14CONFIG_RESOURCE_COUNTERS=y
15CONFIG_MEMCG=y
16CONFIG_NAMESPACES=y
17CONFIG_SCHED_AUTOGROUP=y
18CONFIG_RELAY=y
19CONFIG_BLK_DEV_INITRD=y
20CONFIG_EXPERT=y
21CONFIG_SYSCTL_SYSCALL=y
22CONFIG_KALLSYMS_ALL=y
23CONFIG_PROFILING=y
24CONFIG_OPROFILE=y
25CONFIG_MODULES=y
26CONFIG_MODULE_UNLOAD=y
27# CONFIG_IOSCHED_DEADLINE is not set
28# CONFIG_IOSCHED_CFQ is not set
29CONFIG_XTENSA_VARIANT_DC233C=y
30CONFIG_XTENSA_UNALIGNED_USER=y
31CONFIG_PREEMPT=y
32CONFIG_HIGHMEM=y
33# CONFIG_PCI is not set
34CONFIG_XTENSA_PLATFORM_XTFPGA=y
35CONFIG_CMDLINE_BOOL=y
36CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug"
37CONFIG_USE_OF=y
38CONFIG_BUILTIN_DTB="kc705"
39# CONFIG_COMPACTION is not set
40# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
41CONFIG_NET=y
42CONFIG_PACKET=y
43CONFIG_UNIX=y
44CONFIG_INET=y
45CONFIG_IP_MULTICAST=y
46CONFIG_IP_PNP=y
47CONFIG_IP_PNP_DHCP=y
48CONFIG_IP_PNP_BOOTP=y
49CONFIG_IP_PNP_RARP=y
50# CONFIG_IPV6 is not set
51CONFIG_NETFILTER=y
52# CONFIG_WIRELESS is not set
53CONFIG_DEVTMPFS=y
54CONFIG_DEVTMPFS_MOUNT=y
55# CONFIG_STANDALONE is not set
56CONFIG_MTD=y
57CONFIG_MTD_CFI=y
58CONFIG_MTD_JEDECPROBE=y
59CONFIG_MTD_CFI_INTELEXT=y
60CONFIG_MTD_CFI_AMDSTD=y
61CONFIG_MTD_CFI_STAA=y
62CONFIG_MTD_PHYSMAP_OF=y
63CONFIG_MTD_UBI=y
64CONFIG_BLK_DEV_LOOP=y
65CONFIG_BLK_DEV_RAM=y
66CONFIG_SCSI=y
67CONFIG_BLK_DEV_SD=y
68CONFIG_NETDEVICES=y
69# CONFIG_NET_VENDOR_ARC is not set
70# CONFIG_NET_VENDOR_BROADCOM is not set
71# CONFIG_NET_VENDOR_INTEL is not set
72# CONFIG_NET_VENDOR_MARVELL is not set
73# CONFIG_NET_VENDOR_MICREL is not set
74# CONFIG_NET_VENDOR_NATSEMI is not set
75# CONFIG_NET_VENDOR_SAMSUNG is not set
76# CONFIG_NET_VENDOR_SEEQ is not set
77# CONFIG_NET_VENDOR_SMSC is not set
78# CONFIG_NET_VENDOR_STMICRO is not set
79# CONFIG_NET_VENDOR_VIA is not set
80# CONFIG_NET_VENDOR_WIZNET is not set
81CONFIG_MARVELL_PHY=y
82# CONFIG_WLAN is not set
83# CONFIG_INPUT_MOUSEDEV is not set
84# CONFIG_INPUT_KEYBOARD is not set
85# CONFIG_INPUT_MOUSE is not set
86# CONFIG_SERIO is not set
87CONFIG_SERIAL_8250=y
88# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
89CONFIG_SERIAL_8250_CONSOLE=y
90CONFIG_SERIAL_OF_PLATFORM=y
91CONFIG_HW_RANDOM=y
92# CONFIG_HWMON is not set
93CONFIG_WATCHDOG=y
94CONFIG_WATCHDOG_NOWAYOUT=y
95CONFIG_SOFT_WATCHDOG=y
96# CONFIG_VGA_CONSOLE is not set
97# CONFIG_USB_SUPPORT is not set
98# CONFIG_IOMMU_SUPPORT is not set
99CONFIG_EXT3_FS=y
100CONFIG_EXT4_FS=y
101CONFIG_FANOTIFY=y
102CONFIG_VFAT_FS=y
103CONFIG_PROC_KCORE=y
104CONFIG_TMPFS=y
105CONFIG_TMPFS_POSIX_ACL=y
106CONFIG_UBIFS_FS=y
107CONFIG_NFS_FS=y
108CONFIG_NFS_V4=y
109CONFIG_NFS_SWAP=y
110CONFIG_ROOT_NFS=y
111CONFIG_SUNRPC_DEBUG=y
112CONFIG_NLS_CODEPAGE_437=y
113CONFIG_NLS_ISO8859_1=y
114CONFIG_PRINTK_TIME=y
115CONFIG_DYNAMIC_DEBUG=y
116CONFIG_DEBUG_INFO=y
117CONFIG_MAGIC_SYSRQ=y
118CONFIG_LOCKUP_DETECTOR=y
119# CONFIG_SCHED_DEBUG is not set
120CONFIG_SCHEDSTATS=y
121CONFIG_TIMER_STATS=y
122CONFIG_DEBUG_RT_MUTEXES=y
123CONFIG_DEBUG_SPINLOCK=y
124CONFIG_DEBUG_MUTEXES=y
125CONFIG_DEBUG_ATOMIC_SLEEP=y
126CONFIG_STACKTRACE=y
127CONFIG_RCU_TRACE=y
128# CONFIG_FTRACE is not set
129CONFIG_LD_NO_RELAX=y
130# CONFIG_S32C1I_SELFTEST is not set
131CONFIG_CRYPTO_ANSI_CPRNG=y
diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig
new file mode 100644
index 000000000000..22eeacba37cc
--- /dev/null
+++ b/arch/xtensa/configs/smp_lx200_defconfig
@@ -0,0 +1,135 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_FHANDLE=y
4CONFIG_IRQ_DOMAIN_DEBUG=y
5CONFIG_NO_HZ_IDLE=y
6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_IRQ_TIME_ACCOUNTING=y
8CONFIG_BSD_PROCESS_ACCT=y
9CONFIG_CGROUP_DEBUG=y
10CONFIG_CGROUP_FREEZER=y
11CONFIG_CGROUP_DEVICE=y
12CONFIG_CPUSETS=y
13CONFIG_CGROUP_CPUACCT=y
14CONFIG_RESOURCE_COUNTERS=y
15CONFIG_MEMCG=y
16CONFIG_NAMESPACES=y
17CONFIG_SCHED_AUTOGROUP=y
18CONFIG_RELAY=y
19CONFIG_BLK_DEV_INITRD=y
20CONFIG_EXPERT=y
21CONFIG_SYSCTL_SYSCALL=y
22CONFIG_KALLSYMS_ALL=y
23CONFIG_PROFILING=y
24CONFIG_OPROFILE=y
25CONFIG_MODULES=y
26CONFIG_MODULE_UNLOAD=y
27# CONFIG_IOSCHED_DEADLINE is not set
28# CONFIG_IOSCHED_CFQ is not set
29CONFIG_XTENSA_VARIANT_CUSTOM=y
30CONFIG_XTENSA_VARIANT_CUSTOM_NAME="test_mmuhifi_c3"
31CONFIG_XTENSA_UNALIGNED_USER=y
32CONFIG_PREEMPT=y
33CONFIG_HAVE_SMP=y
34CONFIG_SMP=y
35CONFIG_HOTPLUG_CPU=y
36# CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set
37# CONFIG_PCI is not set
38CONFIG_XTENSA_PLATFORM_XTFPGA=y
39CONFIG_CMDLINE_BOOL=y
40CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug"
41CONFIG_USE_OF=y
42CONFIG_BUILTIN_DTB="lx200mx"
43# CONFIG_COMPACTION is not set
44# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
45CONFIG_NET=y
46CONFIG_PACKET=y
47CONFIG_UNIX=y
48CONFIG_INET=y
49CONFIG_IP_MULTICAST=y
50CONFIG_IP_PNP=y
51CONFIG_IP_PNP_DHCP=y
52CONFIG_IP_PNP_BOOTP=y
53CONFIG_IP_PNP_RARP=y
54# CONFIG_IPV6 is not set
55CONFIG_NETFILTER=y
56# CONFIG_WIRELESS is not set
57CONFIG_DEVTMPFS=y
58CONFIG_DEVTMPFS_MOUNT=y
59# CONFIG_STANDALONE is not set
60CONFIG_MTD=y
61CONFIG_MTD_CFI=y
62CONFIG_MTD_JEDECPROBE=y
63CONFIG_MTD_CFI_INTELEXT=y
64CONFIG_MTD_CFI_AMDSTD=y
65CONFIG_MTD_CFI_STAA=y
66CONFIG_MTD_PHYSMAP_OF=y
67CONFIG_MTD_UBI=y
68CONFIG_BLK_DEV_LOOP=y
69CONFIG_BLK_DEV_RAM=y
70CONFIG_SCSI=y
71CONFIG_BLK_DEV_SD=y
72CONFIG_NETDEVICES=y
73# CONFIG_NET_VENDOR_ARC is not set
74# CONFIG_NET_VENDOR_BROADCOM is not set
75# CONFIG_NET_VENDOR_INTEL is not set
76# CONFIG_NET_VENDOR_MARVELL is not set
77# CONFIG_NET_VENDOR_MICREL is not set
78# CONFIG_NET_VENDOR_NATSEMI is not set
79# CONFIG_NET_VENDOR_SAMSUNG is not set
80# CONFIG_NET_VENDOR_SEEQ is not set
81# CONFIG_NET_VENDOR_SMSC is not set
82# CONFIG_NET_VENDOR_STMICRO is not set
83# CONFIG_NET_VENDOR_VIA is not set
84# CONFIG_NET_VENDOR_WIZNET is not set
85CONFIG_MARVELL_PHY=y
86# CONFIG_WLAN is not set
87# CONFIG_INPUT_MOUSEDEV is not set
88# CONFIG_INPUT_KEYBOARD is not set
89# CONFIG_INPUT_MOUSE is not set
90# CONFIG_SERIO is not set
91CONFIG_SERIAL_8250=y
92# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
93CONFIG_SERIAL_8250_CONSOLE=y
94CONFIG_SERIAL_OF_PLATFORM=y
95CONFIG_HW_RANDOM=y
96# CONFIG_HWMON is not set
97CONFIG_WATCHDOG=y
98CONFIG_WATCHDOG_NOWAYOUT=y
99CONFIG_SOFT_WATCHDOG=y
100# CONFIG_VGA_CONSOLE is not set
101# CONFIG_USB_SUPPORT is not set
102# CONFIG_IOMMU_SUPPORT is not set
103CONFIG_EXT3_FS=y
104CONFIG_EXT4_FS=y
105CONFIG_FANOTIFY=y
106CONFIG_VFAT_FS=y
107CONFIG_PROC_KCORE=y
108CONFIG_TMPFS=y
109CONFIG_TMPFS_POSIX_ACL=y
110CONFIG_UBIFS_FS=y
111CONFIG_NFS_FS=y
112CONFIG_NFS_V4=y
113CONFIG_NFS_SWAP=y
114CONFIG_ROOT_NFS=y
115CONFIG_SUNRPC_DEBUG=y
116CONFIG_NLS_CODEPAGE_437=y
117CONFIG_NLS_ISO8859_1=y
118CONFIG_PRINTK_TIME=y
119CONFIG_DYNAMIC_DEBUG=y
120CONFIG_DEBUG_INFO=y
121CONFIG_MAGIC_SYSRQ=y
122CONFIG_DEBUG_VM=y
123CONFIG_LOCKUP_DETECTOR=y
124CONFIG_SCHEDSTATS=y
125CONFIG_TIMER_STATS=y
126CONFIG_DEBUG_RT_MUTEXES=y
127CONFIG_DEBUG_SPINLOCK=y
128CONFIG_DEBUG_MUTEXES=y
129CONFIG_DEBUG_ATOMIC_SLEEP=y
130CONFIG_STACKTRACE=y
131CONFIG_RCU_TRACE=y
132# CONFIG_FTRACE is not set
133CONFIG_LD_NO_RELAX=y
134# CONFIG_S32C1I_SELFTEST is not set
135CONFIG_CRYPTO_ANSI_CPRNG=y
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index b2173e5da601..0383aed59121 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -277,6 +277,8 @@ static inline pte_t pte_mkwrite(pte_t pte)
277static inline pte_t pte_mkspecial(pte_t pte) 277static inline pte_t pte_mkspecial(pte_t pte)
278 { return pte; } 278 { return pte; }
279 279
280#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) & ~_PAGE_CA_MASK))
281
280/* 282/*
281 * Conversion functions: convert a page and protection to a page entry, 283 * Conversion functions: convert a page and protection to a page entry,
282 * and a page entry and page directory to the page they refer to. 284 * and a page entry and page directory to the page they refer to.
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
index 8883fc877c5c..db5bb72e2f4e 100644
--- a/arch/xtensa/include/uapi/asm/unistd.h
+++ b/arch/xtensa/include/uapi/asm/unistd.h
@@ -384,7 +384,8 @@ __SYSCALL(174, sys_chroot, 1)
384#define __NR_pivot_root 175 384#define __NR_pivot_root 175
385__SYSCALL(175, sys_pivot_root, 2) 385__SYSCALL(175, sys_pivot_root, 2)
386#define __NR_umount 176 386#define __NR_umount 176
387__SYSCALL(176, sys_umount, 2) 387__SYSCALL(176, sys_oldumount, 1)
388#define __ARCH_WANT_SYS_OLDUMOUNT
388#define __NR_swapoff 177 389#define __NR_swapoff 177
389__SYSCALL(177, sys_swapoff, 1) 390__SYSCALL(177, sys_swapoff, 1)
390#define __NR_sync 178 391#define __NR_sync 178
@@ -742,7 +743,14 @@ __SYSCALL(335, sys_sched_getattr, 3)
742#define __NR_renameat2 336 743#define __NR_renameat2 336
743__SYSCALL(336, sys_renameat2, 5) 744__SYSCALL(336, sys_renameat2, 5)
744 745
745#define __NR_syscall_count 337 746#define __NR_seccomp 337
747__SYSCALL(337, sys_seccomp, 3)
748#define __NR_getrandom 338
749__SYSCALL(338, sys_getrandom, 3)
750#define __NR_memfd_create 339
751__SYSCALL(339, sys_memfd_create, 2)
752
753#define __NR_syscall_count 340
746 754
747/* 755/*
748 * sysxtensa syscall handler 756 * sysxtensa syscall handler
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 61a33f4ba608..df04227d00cf 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -171,20 +171,23 @@ config WANT_DEV_COREDUMP
171 Drivers should "select" this option if they desire to use the 171 Drivers should "select" this option if they desire to use the
172 device coredump mechanism. 172 device coredump mechanism.
173 173
174config DISABLE_DEV_COREDUMP 174config ALLOW_DEV_COREDUMP
175 bool "Disable device coredump" if EXPERT 175 bool "Allow device coredump" if EXPERT
176 default y
176 help 177 help
177 Disable the device coredump mechanism despite drivers wanting to 178 This option controls if the device coredump mechanism is available or
178 use it; this allows for more sensitive systems or systems that 179 not; if disabled, the mechanism will be omitted even if drivers that
179 don't want to ever access the information to not have the code, 180 can use it are enabled.
180 nor keep any data. 181 Say 'N' for more sensitive systems or systems that don't want
182 to ever access the information to not have the code, nor keep any
183 data.
181 184
182 If unsure, say N. 185 If unsure, say Y.
183 186
184config DEV_COREDUMP 187config DEV_COREDUMP
185 bool 188 bool
186 default y if WANT_DEV_COREDUMP 189 default y if WANT_DEV_COREDUMP
187 depends on !DISABLE_DEV_COREDUMP 190 depends on ALLOW_DEV_COREDUMP
188 191
189config DEBUG_DRIVER 192config DEBUG_DRIVER
190 bool "Driver Core verbose debug messages" 193 bool "Driver Core verbose debug messages"
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 14d162952c3b..842d04707de6 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -724,12 +724,12 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
724 return &dir->kobj; 724 return &dir->kobj;
725} 725}
726 726
727static DEFINE_MUTEX(gdp_mutex);
727 728
728static struct kobject *get_device_parent(struct device *dev, 729static struct kobject *get_device_parent(struct device *dev,
729 struct device *parent) 730 struct device *parent)
730{ 731{
731 if (dev->class) { 732 if (dev->class) {
732 static DEFINE_MUTEX(gdp_mutex);
733 struct kobject *kobj = NULL; 733 struct kobject *kobj = NULL;
734 struct kobject *parent_kobj; 734 struct kobject *parent_kobj;
735 struct kobject *k; 735 struct kobject *k;
@@ -793,7 +793,9 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
793 glue_dir->kset != &dev->class->p->glue_dirs) 793 glue_dir->kset != &dev->class->p->glue_dirs)
794 return; 794 return;
795 795
796 mutex_lock(&gdp_mutex);
796 kobject_put(glue_dir); 797 kobject_put(glue_dir);
798 mutex_unlock(&gdp_mutex);
797} 799}
798 800
799static void cleanup_device_parent(struct device *dev) 801static void cleanup_device_parent(struct device *dev)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 0a54c588e433..27b71a0b72d0 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -342,7 +342,6 @@ struct rbd_device {
342 342
343 struct list_head rq_queue; /* incoming rq queue */ 343 struct list_head rq_queue; /* incoming rq queue */
344 spinlock_t lock; /* queue, flags, open_count */ 344 spinlock_t lock; /* queue, flags, open_count */
345 struct workqueue_struct *rq_wq;
346 struct work_struct rq_work; 345 struct work_struct rq_work;
347 346
348 struct rbd_image_header header; 347 struct rbd_image_header header;
@@ -402,6 +401,8 @@ static struct kmem_cache *rbd_segment_name_cache;
402static int rbd_major; 401static int rbd_major;
403static DEFINE_IDA(rbd_dev_id_ida); 402static DEFINE_IDA(rbd_dev_id_ida);
404 403
404static struct workqueue_struct *rbd_wq;
405
405/* 406/*
406 * Default to false for now, as single-major requires >= 0.75 version of 407 * Default to false for now, as single-major requires >= 0.75 version of
407 * userspace rbd utility. 408 * userspace rbd utility.
@@ -3452,7 +3453,7 @@ static void rbd_request_fn(struct request_queue *q)
3452 } 3453 }
3453 3454
3454 if (queued) 3455 if (queued)
3455 queue_work(rbd_dev->rq_wq, &rbd_dev->rq_work); 3456 queue_work(rbd_wq, &rbd_dev->rq_work);
3456} 3457}
3457 3458
3458/* 3459/*
@@ -3532,7 +3533,7 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev,
3532 page_count = (u32) calc_pages_for(offset, length); 3533 page_count = (u32) calc_pages_for(offset, length);
3533 pages = ceph_alloc_page_vector(page_count, GFP_KERNEL); 3534 pages = ceph_alloc_page_vector(page_count, GFP_KERNEL);
3534 if (IS_ERR(pages)) 3535 if (IS_ERR(pages))
3535 ret = PTR_ERR(pages); 3536 return PTR_ERR(pages);
3536 3537
3537 ret = -ENOMEM; 3538 ret = -ENOMEM;
3538 obj_request = rbd_obj_request_create(object_name, offset, length, 3539 obj_request = rbd_obj_request_create(object_name, offset, length,
@@ -5242,16 +5243,9 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
5242 set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); 5243 set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE);
5243 set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); 5244 set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only);
5244 5245
5245 rbd_dev->rq_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,
5246 rbd_dev->disk->disk_name);
5247 if (!rbd_dev->rq_wq) {
5248 ret = -ENOMEM;
5249 goto err_out_mapping;
5250 }
5251
5252 ret = rbd_bus_add_dev(rbd_dev); 5246 ret = rbd_bus_add_dev(rbd_dev);
5253 if (ret) 5247 if (ret)
5254 goto err_out_workqueue; 5248 goto err_out_mapping;
5255 5249
5256 /* Everything's ready. Announce the disk to the world. */ 5250 /* Everything's ready. Announce the disk to the world. */
5257 5251
@@ -5263,9 +5257,6 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
5263 5257
5264 return ret; 5258 return ret;
5265 5259
5266err_out_workqueue:
5267 destroy_workqueue(rbd_dev->rq_wq);
5268 rbd_dev->rq_wq = NULL;
5269err_out_mapping: 5260err_out_mapping:
5270 rbd_dev_mapping_clear(rbd_dev); 5261 rbd_dev_mapping_clear(rbd_dev);
5271err_out_disk: 5262err_out_disk:
@@ -5512,7 +5503,6 @@ static void rbd_dev_device_release(struct device *dev)
5512{ 5503{
5513 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); 5504 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
5514 5505
5515 destroy_workqueue(rbd_dev->rq_wq);
5516 rbd_free_disk(rbd_dev); 5506 rbd_free_disk(rbd_dev);
5517 clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); 5507 clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags);
5518 rbd_dev_mapping_clear(rbd_dev); 5508 rbd_dev_mapping_clear(rbd_dev);
@@ -5716,11 +5706,21 @@ static int __init rbd_init(void)
5716 if (rc) 5706 if (rc)
5717 return rc; 5707 return rc;
5718 5708
5709 /*
5710 * The number of active work items is limited by the number of
5711 * rbd devices, so leave @max_active at default.
5712 */
5713 rbd_wq = alloc_workqueue(RBD_DRV_NAME, WQ_MEM_RECLAIM, 0);
5714 if (!rbd_wq) {
5715 rc = -ENOMEM;
5716 goto err_out_slab;
5717 }
5718
5719 if (single_major) { 5719 if (single_major) {
5720 rbd_major = register_blkdev(0, RBD_DRV_NAME); 5720 rbd_major = register_blkdev(0, RBD_DRV_NAME);
5721 if (rbd_major < 0) { 5721 if (rbd_major < 0) {
5722 rc = rbd_major; 5722 rc = rbd_major;
5723 goto err_out_slab; 5723 goto err_out_wq;
5724 } 5724 }
5725 } 5725 }
5726 5726
@@ -5738,6 +5738,8 @@ static int __init rbd_init(void)
5738err_out_blkdev: 5738err_out_blkdev:
5739 if (single_major) 5739 if (single_major)
5740 unregister_blkdev(rbd_major, RBD_DRV_NAME); 5740 unregister_blkdev(rbd_major, RBD_DRV_NAME);
5741err_out_wq:
5742 destroy_workqueue(rbd_wq);
5741err_out_slab: 5743err_out_slab:
5742 rbd_slab_exit(); 5744 rbd_slab_exit();
5743 return rc; 5745 return rc;
@@ -5749,6 +5751,7 @@ static void __exit rbd_exit(void)
5749 rbd_sysfs_cleanup(); 5751 rbd_sysfs_cleanup();
5750 if (single_major) 5752 if (single_major)
5751 unregister_blkdev(rbd_major, RBD_DRV_NAME); 5753 unregister_blkdev(rbd_major, RBD_DRV_NAME);
5754 destroy_workqueue(rbd_wq);
5752 rbd_slab_exit(); 5755 rbd_slab_exit();
5753} 5756}
5754 5757
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 2ad0b5bce44b..3920ee45aa59 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -560,7 +560,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
560 } 560 }
561 561
562 if (page_zero_filled(uncmem)) { 562 if (page_zero_filled(uncmem)) {
563 kunmap_atomic(user_mem); 563 if (user_mem)
564 kunmap_atomic(user_mem);
564 /* Free memory associated with this sector now. */ 565 /* Free memory associated with this sector now. */
565 bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); 566 bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value);
566 zram_free_page(zram, index); 567 zram_free_page(zram, index);
diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c
index 6226aa08c36a..bcf86f91800a 100644
--- a/drivers/char/hw_random/pseries-rng.c
+++ b/drivers/char/hw_random/pseries-rng.c
@@ -25,18 +25,21 @@
25#include <asm/vio.h> 25#include <asm/vio.h>
26 26
27 27
28static int pseries_rng_data_read(struct hwrng *rng, u32 *data) 28static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
29{ 29{
30 u64 buffer[PLPAR_HCALL_BUFSIZE];
31 size_t size = max < 8 ? max : 8;
30 int rc; 32 int rc;
31 33
32 rc = plpar_hcall(H_RANDOM, (unsigned long *)data); 34 rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer);
33 if (rc != H_SUCCESS) { 35 if (rc != H_SUCCESS) {
34 pr_err_ratelimited("H_RANDOM call failed %d\n", rc); 36 pr_err_ratelimited("H_RANDOM call failed %d\n", rc);
35 return -EIO; 37 return -EIO;
36 } 38 }
39 memcpy(data, buffer, size);
37 40
38 /* The hypervisor interface returns 64 bits */ 41 /* The hypervisor interface returns 64 bits */
39 return 8; 42 return size;
40} 43}
41 44
42/** 45/**
@@ -55,7 +58,7 @@ static unsigned long pseries_rng_get_desired_dma(struct vio_dev *vdev)
55 58
56static struct hwrng pseries_rng = { 59static struct hwrng pseries_rng = {
57 .name = KBUILD_MODNAME, 60 .name = KBUILD_MODNAME,
58 .data_read = pseries_rng_data_read, 61 .read = pseries_rng_read,
59}; 62};
60 63
61static int __init pseries_rng_probe(struct vio_dev *dev, 64static int __init pseries_rng_probe(struct vio_dev *dev,
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 0102dc788608..a24891b97547 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -285,7 +285,7 @@ static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd,
285 285
286static const struct file_operations raw_fops = { 286static const struct file_operations raw_fops = {
287 .read = new_sync_read, 287 .read = new_sync_read,
288 .read_iter = generic_file_read_iter, 288 .read_iter = blkdev_read_iter,
289 .write = new_sync_write, 289 .write = new_sync_write,
290 .write_iter = blkdev_write_iter, 290 .write_iter = blkdev_write_iter,
291 .fsync = blkdev_fsync, 291 .fsync = blkdev_fsync,
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index bfa640023e64..cf7a561fad7c 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1449,8 +1449,6 @@ static int add_port(struct ports_device *portdev, u32 id)
1449 spin_lock_init(&port->outvq_lock); 1449 spin_lock_init(&port->outvq_lock);
1450 init_waitqueue_head(&port->waitqueue); 1450 init_waitqueue_head(&port->waitqueue);
1451 1451
1452 virtio_device_ready(portdev->vdev);
1453
1454 /* Fill the in_vq with buffers so the host can send us data. */ 1452 /* Fill the in_vq with buffers so the host can send us data. */
1455 nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); 1453 nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock);
1456 if (!nr_added_bufs) { 1454 if (!nr_added_bufs) {
@@ -2026,6 +2024,8 @@ static int virtcons_probe(struct virtio_device *vdev)
2026 spin_lock_init(&portdev->ports_lock); 2024 spin_lock_init(&portdev->ports_lock);
2027 INIT_LIST_HEAD(&portdev->ports); 2025 INIT_LIST_HEAD(&portdev->ports);
2028 2026
2027 virtio_device_ready(portdev->vdev);
2028
2029 if (multiport) { 2029 if (multiport) {
2030 unsigned int nr_added_bufs; 2030 unsigned int nr_added_bufs;
2031 2031
diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c
index 871703c49d2c..e1eaf4ff9762 100644
--- a/drivers/crypto/caam/key_gen.c
+++ b/drivers/crypto/caam/key_gen.c
@@ -48,23 +48,29 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len,
48 u32 *desc; 48 u32 *desc;
49 struct split_key_result result; 49 struct split_key_result result;
50 dma_addr_t dma_addr_in, dma_addr_out; 50 dma_addr_t dma_addr_in, dma_addr_out;
51 int ret = 0; 51 int ret = -ENOMEM;
52 52
53 desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); 53 desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA);
54 if (!desc) { 54 if (!desc) {
55 dev_err(jrdev, "unable to allocate key input memory\n"); 55 dev_err(jrdev, "unable to allocate key input memory\n");
56 return -ENOMEM; 56 return ret;
57 } 57 }
58 58
59 init_job_desc(desc, 0);
60
61 dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, 59 dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen,
62 DMA_TO_DEVICE); 60 DMA_TO_DEVICE);
63 if (dma_mapping_error(jrdev, dma_addr_in)) { 61 if (dma_mapping_error(jrdev, dma_addr_in)) {
64 dev_err(jrdev, "unable to map key input memory\n"); 62 dev_err(jrdev, "unable to map key input memory\n");
65 kfree(desc); 63 goto out_free;
66 return -ENOMEM;
67 } 64 }
65
66 dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len,
67 DMA_FROM_DEVICE);
68 if (dma_mapping_error(jrdev, dma_addr_out)) {
69 dev_err(jrdev, "unable to map key output memory\n");
70 goto out_unmap_in;
71 }
72
73 init_job_desc(desc, 0);
68 append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); 74 append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG);
69 75
70 /* Sets MDHA up into an HMAC-INIT */ 76 /* Sets MDHA up into an HMAC-INIT */
@@ -81,13 +87,6 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len,
81 * FIFO_STORE with the explicit split-key content store 87 * FIFO_STORE with the explicit split-key content store
82 * (0x26 output type) 88 * (0x26 output type)
83 */ 89 */
84 dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len,
85 DMA_FROM_DEVICE);
86 if (dma_mapping_error(jrdev, dma_addr_out)) {
87 dev_err(jrdev, "unable to map key output memory\n");
88 kfree(desc);
89 return -ENOMEM;
90 }
91 append_fifo_store(desc, dma_addr_out, split_key_len, 90 append_fifo_store(desc, dma_addr_out, split_key_len,
92 LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); 91 LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK);
93 92
@@ -115,10 +114,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len,
115 114
116 dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, 115 dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len,
117 DMA_FROM_DEVICE); 116 DMA_FROM_DEVICE);
117out_unmap_in:
118 dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); 118 dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE);
119 119out_free:
120 kfree(desc); 120 kfree(desc);
121
122 return ret; 121 return ret;
123} 122}
124EXPORT_SYMBOL(gen_split_key); 123EXPORT_SYMBOL(gen_split_key);
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h
index 9282381b03ce..fe7b3f06f6e6 100644
--- a/drivers/crypto/qat/qat_common/adf_accel_devices.h
+++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h
@@ -198,8 +198,7 @@ struct adf_accel_dev {
198 struct dentry *debugfs_dir; 198 struct dentry *debugfs_dir;
199 struct list_head list; 199 struct list_head list;
200 struct module *owner; 200 struct module *owner;
201 uint8_t accel_id;
202 uint8_t numa_node;
203 struct adf_accel_pci accel_pci_dev; 201 struct adf_accel_pci accel_pci_dev;
202 uint8_t accel_id;
204} __packed; 203} __packed;
205#endif 204#endif
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
index 5f3fa45348b4..9dd2cb72a4e8 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -419,9 +419,10 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev,
419 WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0); 419 WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0);
420 ring = &bank->rings[i]; 420 ring = &bank->rings[i];
421 if (hw_data->tx_rings_mask & (1 << i)) { 421 if (hw_data->tx_rings_mask & (1 << i)) {
422 ring->inflights = kzalloc_node(sizeof(atomic_t), 422 ring->inflights =
423 GFP_KERNEL, 423 kzalloc_node(sizeof(atomic_t),
424 accel_dev->numa_node); 424 GFP_KERNEL,
425 dev_to_node(&GET_DEV(accel_dev)));
425 if (!ring->inflights) 426 if (!ring->inflights)
426 goto err; 427 goto err;
427 } else { 428 } else {
@@ -469,13 +470,14 @@ int adf_init_etr_data(struct adf_accel_dev *accel_dev)
469 int i, ret; 470 int i, ret;
470 471
471 etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL, 472 etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL,
472 accel_dev->numa_node); 473 dev_to_node(&GET_DEV(accel_dev)));
473 if (!etr_data) 474 if (!etr_data)
474 return -ENOMEM; 475 return -ENOMEM;
475 476
476 num_banks = GET_MAX_BANKS(accel_dev); 477 num_banks = GET_MAX_BANKS(accel_dev);
477 size = num_banks * sizeof(struct adf_etr_bank_data); 478 size = num_banks * sizeof(struct adf_etr_bank_data);
478 etr_data->banks = kzalloc_node(size, GFP_KERNEL, accel_dev->numa_node); 479 etr_data->banks = kzalloc_node(size, GFP_KERNEL,
480 dev_to_node(&GET_DEV(accel_dev)));
479 if (!etr_data->banks) { 481 if (!etr_data->banks) {
480 ret = -ENOMEM; 482 ret = -ENOMEM;
481 goto err_bank; 483 goto err_bank;
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c
index f2e2f158cfbe..9e9619cd4a79 100644
--- a/drivers/crypto/qat/qat_common/qat_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_algs.c
@@ -596,7 +596,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
596 if (unlikely(!n)) 596 if (unlikely(!n))
597 return -EINVAL; 597 return -EINVAL;
598 598
599 bufl = kmalloc_node(sz, GFP_ATOMIC, inst->accel_dev->numa_node); 599 bufl = kmalloc_node(sz, GFP_ATOMIC,
600 dev_to_node(&GET_DEV(inst->accel_dev)));
600 if (unlikely(!bufl)) 601 if (unlikely(!bufl))
601 return -ENOMEM; 602 return -ENOMEM;
602 603
@@ -605,6 +606,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
605 goto err; 606 goto err;
606 607
607 for_each_sg(assoc, sg, assoc_n, i) { 608 for_each_sg(assoc, sg, assoc_n, i) {
609 if (!sg->length)
610 continue;
608 bufl->bufers[bufs].addr = dma_map_single(dev, 611 bufl->bufers[bufs].addr = dma_map_single(dev,
609 sg_virt(sg), 612 sg_virt(sg),
610 sg->length, 613 sg->length,
@@ -640,7 +643,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
640 struct qat_alg_buf *bufers; 643 struct qat_alg_buf *bufers;
641 644
642 buflout = kmalloc_node(sz, GFP_ATOMIC, 645 buflout = kmalloc_node(sz, GFP_ATOMIC,
643 inst->accel_dev->numa_node); 646 dev_to_node(&GET_DEV(inst->accel_dev)));
644 if (unlikely(!buflout)) 647 if (unlikely(!buflout))
645 goto err; 648 goto err;
646 bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE); 649 bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE);
diff --git a/drivers/crypto/qat/qat_common/qat_crypto.c b/drivers/crypto/qat/qat_common/qat_crypto.c
index 0d59bcb50de1..828f2a686aab 100644
--- a/drivers/crypto/qat/qat_common/qat_crypto.c
+++ b/drivers/crypto/qat/qat_common/qat_crypto.c
@@ -109,12 +109,14 @@ struct qat_crypto_instance *qat_crypto_get_instance_node(int node)
109 109
110 list_for_each(itr, adf_devmgr_get_head()) { 110 list_for_each(itr, adf_devmgr_get_head()) {
111 accel_dev = list_entry(itr, struct adf_accel_dev, list); 111 accel_dev = list_entry(itr, struct adf_accel_dev, list);
112 if (accel_dev->numa_node == node && adf_dev_started(accel_dev)) 112 if ((node == dev_to_node(&GET_DEV(accel_dev)) ||
113 dev_to_node(&GET_DEV(accel_dev)) < 0)
114 && adf_dev_started(accel_dev))
113 break; 115 break;
114 accel_dev = NULL; 116 accel_dev = NULL;
115 } 117 }
116 if (!accel_dev) { 118 if (!accel_dev) {
117 pr_err("QAT: Could not find device on give node\n"); 119 pr_err("QAT: Could not find device on node %d\n", node);
118 accel_dev = adf_devmgr_get_first(); 120 accel_dev = adf_devmgr_get_first();
119 } 121 }
120 if (!accel_dev || !adf_dev_started(accel_dev)) 122 if (!accel_dev || !adf_dev_started(accel_dev))
@@ -164,7 +166,7 @@ static int qat_crypto_create_instances(struct adf_accel_dev *accel_dev)
164 166
165 for (i = 0; i < num_inst; i++) { 167 for (i = 0; i < num_inst; i++) {
166 inst = kzalloc_node(sizeof(*inst), GFP_KERNEL, 168 inst = kzalloc_node(sizeof(*inst), GFP_KERNEL,
167 accel_dev->numa_node); 169 dev_to_node(&GET_DEV(accel_dev)));
168 if (!inst) 170 if (!inst)
169 goto err; 171 goto err;
170 172
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c
index 978d6c56639d..53c491b59f07 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c
@@ -108,7 +108,7 @@ int adf_init_admin_comms(struct adf_accel_dev *accel_dev)
108 uint64_t reg_val; 108 uint64_t reg_val;
109 109
110 admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL, 110 admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL,
111 accel_dev->numa_node); 111 dev_to_node(&GET_DEV(accel_dev)));
112 if (!admin) 112 if (!admin)
113 return -ENOMEM; 113 return -ENOMEM;
114 admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, 114 admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
index 0d0435a41be9..948f66be262b 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
@@ -119,21 +119,6 @@ static void adf_cleanup_accel(struct adf_accel_dev *accel_dev)
119 kfree(accel_dev); 119 kfree(accel_dev);
120} 120}
121 121
122static uint8_t adf_get_dev_node_id(struct pci_dev *pdev)
123{
124 unsigned int bus_per_cpu = 0;
125 struct cpuinfo_x86 *c = &cpu_data(num_online_cpus() - 1);
126
127 if (!c->phys_proc_id)
128 return 0;
129
130 bus_per_cpu = 256 / (c->phys_proc_id + 1);
131
132 if (bus_per_cpu != 0)
133 return pdev->bus->number / bus_per_cpu;
134 return 0;
135}
136
137static int qat_dev_start(struct adf_accel_dev *accel_dev) 122static int qat_dev_start(struct adf_accel_dev *accel_dev)
138{ 123{
139 int cpus = num_online_cpus(); 124 int cpus = num_online_cpus();
@@ -235,7 +220,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
235 void __iomem *pmisc_bar_addr = NULL; 220 void __iomem *pmisc_bar_addr = NULL;
236 char name[ADF_DEVICE_NAME_LENGTH]; 221 char name[ADF_DEVICE_NAME_LENGTH];
237 unsigned int i, bar_nr; 222 unsigned int i, bar_nr;
238 uint8_t node;
239 int ret; 223 int ret;
240 224
241 switch (ent->device) { 225 switch (ent->device) {
@@ -246,12 +230,19 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
246 return -ENODEV; 230 return -ENODEV;
247 } 231 }
248 232
249 node = adf_get_dev_node_id(pdev); 233 if (num_possible_nodes() > 1 && dev_to_node(&pdev->dev) < 0) {
250 accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, node); 234 /* If the accelerator is connected to a node with no memory
235 * there is no point in using the accelerator since the remote
236 * memory transaction will be very slow. */
237 dev_err(&pdev->dev, "Invalid NUMA configuration.\n");
238 return -EINVAL;
239 }
240
241 accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL,
242 dev_to_node(&pdev->dev));
251 if (!accel_dev) 243 if (!accel_dev)
252 return -ENOMEM; 244 return -ENOMEM;
253 245
254 accel_dev->numa_node = node;
255 INIT_LIST_HEAD(&accel_dev->crypto_list); 246 INIT_LIST_HEAD(&accel_dev->crypto_list);
256 247
257 /* Add accel device to accel table. 248 /* Add accel device to accel table.
@@ -264,7 +255,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
264 255
265 accel_dev->owner = THIS_MODULE; 256 accel_dev->owner = THIS_MODULE;
266 /* Allocate and configure device configuration structure */ 257 /* Allocate and configure device configuration structure */
267 hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, node); 258 hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL,
259 dev_to_node(&pdev->dev));
268 if (!hw_data) { 260 if (!hw_data) {
269 ret = -ENOMEM; 261 ret = -ENOMEM;
270 goto out_err; 262 goto out_err;
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
index 67ec61e51185..d96ee21b9b77 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
@@ -168,7 +168,7 @@ static int adf_isr_alloc_msix_entry_table(struct adf_accel_dev *accel_dev)
168 uint32_t msix_num_entries = hw_data->num_banks + 1; 168 uint32_t msix_num_entries = hw_data->num_banks + 1;
169 169
170 entries = kzalloc_node(msix_num_entries * sizeof(*entries), 170 entries = kzalloc_node(msix_num_entries * sizeof(*entries),
171 GFP_KERNEL, accel_dev->numa_node); 171 GFP_KERNEL, dev_to_node(&GET_DEV(accel_dev)));
172 if (!entries) 172 if (!entries)
173 return -ENOMEM; 173 return -ENOMEM;
174 174
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 123f578d6dd3..4cfaaa5a49be 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -1107,52 +1107,14 @@ bool edma_filter_fn(struct dma_chan *chan, void *param)
1107} 1107}
1108EXPORT_SYMBOL(edma_filter_fn); 1108EXPORT_SYMBOL(edma_filter_fn);
1109 1109
1110static struct platform_device *pdev0, *pdev1;
1111
1112static const struct platform_device_info edma_dev_info0 = {
1113 .name = "edma-dma-engine",
1114 .id = 0,
1115 .dma_mask = DMA_BIT_MASK(32),
1116};
1117
1118static const struct platform_device_info edma_dev_info1 = {
1119 .name = "edma-dma-engine",
1120 .id = 1,
1121 .dma_mask = DMA_BIT_MASK(32),
1122};
1123
1124static int edma_init(void) 1110static int edma_init(void)
1125{ 1111{
1126 int ret = platform_driver_register(&edma_driver); 1112 return platform_driver_register(&edma_driver);
1127
1128 if (ret == 0) {
1129 pdev0 = platform_device_register_full(&edma_dev_info0);
1130 if (IS_ERR(pdev0)) {
1131 platform_driver_unregister(&edma_driver);
1132 ret = PTR_ERR(pdev0);
1133 goto out;
1134 }
1135 }
1136
1137 if (!of_have_populated_dt() && EDMA_CTLRS == 2) {
1138 pdev1 = platform_device_register_full(&edma_dev_info1);
1139 if (IS_ERR(pdev1)) {
1140 platform_driver_unregister(&edma_driver);
1141 platform_device_unregister(pdev0);
1142 ret = PTR_ERR(pdev1);
1143 }
1144 }
1145
1146out:
1147 return ret;
1148} 1113}
1149subsys_initcall(edma_init); 1114subsys_initcall(edma_init);
1150 1115
1151static void __exit edma_exit(void) 1116static void __exit edma_exit(void)
1152{ 1117{
1153 platform_device_unregister(pdev0);
1154 if (pdev1)
1155 platform_device_unregister(pdev1);
1156 platform_driver_unregister(&edma_driver); 1118 platform_driver_unregister(&edma_driver);
1157} 1119}
1158module_exit(edma_exit); 1120module_exit(edma_exit);
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 9a0cc09e6653..e4a1490b42c2 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -260,7 +260,7 @@ static void armada_drm_vblank_off(struct armada_crtc *dcrtc)
260 * Tell the DRM core that vblank IRQs aren't going to happen for 260 * Tell the DRM core that vblank IRQs aren't going to happen for
261 * a while. This cleans up any pending vblank events for us. 261 * a while. This cleans up any pending vblank events for us.
262 */ 262 */
263 drm_vblank_off(dev, dcrtc->num); 263 drm_crtc_vblank_off(&dcrtc->crtc);
264 264
265 /* Handle any pending flip event. */ 265 /* Handle any pending flip event. */
266 spin_lock_irq(&dev->event_lock); 266 spin_lock_irq(&dev->event_lock);
@@ -289,6 +289,8 @@ static void armada_drm_crtc_dpms(struct drm_crtc *crtc, int dpms)
289 armada_drm_crtc_update(dcrtc); 289 armada_drm_crtc_update(dcrtc);
290 if (dpms_blanked(dpms)) 290 if (dpms_blanked(dpms))
291 armada_drm_vblank_off(dcrtc); 291 armada_drm_vblank_off(dcrtc);
292 else
293 drm_crtc_vblank_on(&dcrtc->crtc);
292 } 294 }
293} 295}
294 296
@@ -526,7 +528,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
526 /* Wait for pending flips to complete */ 528 /* Wait for pending flips to complete */
527 wait_event(dcrtc->frame_wait, !dcrtc->frame_work); 529 wait_event(dcrtc->frame_wait, !dcrtc->frame_work);
528 530
529 drm_vblank_pre_modeset(crtc->dev, dcrtc->num); 531 drm_crtc_vblank_off(crtc);
530 532
531 crtc->mode = *adj; 533 crtc->mode = *adj;
532 534
@@ -617,7 +619,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
617 619
618 armada_drm_crtc_update(dcrtc); 620 armada_drm_crtc_update(dcrtc);
619 621
620 drm_vblank_post_modeset(crtc->dev, dcrtc->num); 622 drm_crtc_vblank_on(crtc);
621 armada_drm_crtc_finish_fb(dcrtc, old_fb, dpms_blanked(dcrtc->dpms)); 623 armada_drm_crtc_finish_fb(dcrtc, old_fb, dpms_blanked(dcrtc->dpms));
622 624
623 return 0; 625 return 0;
@@ -945,18 +947,15 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
945 armada_reg_queue_end(work->regs, i); 947 armada_reg_queue_end(work->regs, i);
946 948
947 /* 949 /*
948 * Hold the old framebuffer for the work - DRM appears to drop our 950 * Ensure that we hold a reference on the new framebuffer.
949 * reference to the old framebuffer in drm_mode_page_flip_ioctl(). 951 * This has to match the behaviour in mode_set.
950 */ 952 */
951 drm_framebuffer_reference(work->old_fb); 953 drm_framebuffer_reference(fb);
952 954
953 ret = armada_drm_crtc_queue_frame_work(dcrtc, work); 955 ret = armada_drm_crtc_queue_frame_work(dcrtc, work);
954 if (ret) { 956 if (ret) {
955 /* 957 /* Undo our reference above */
956 * Undo our reference above; DRM does not drop the reference 958 drm_framebuffer_unreference(fb);
957 * to this object on error, so that's okay.
958 */
959 drm_framebuffer_unreference(work->old_fb);
960 kfree(work); 959 kfree(work);
961 return ret; 960 return ret;
962 } 961 }
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index f672e6ad8afa..908e5316eac4 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -190,6 +190,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
190 if (ret) 190 if (ret)
191 goto err_comp; 191 goto err_comp;
192 192
193 dev->irq_enabled = true;
193 dev->vblank_disable_allowed = 1; 194 dev->vblank_disable_allowed = 1;
194 195
195 ret = armada_fbdev_init(dev); 196 ret = armada_fbdev_init(dev);
@@ -331,7 +332,7 @@ static struct drm_driver armada_drm_driver = {
331 .desc = "Armada SoC DRM", 332 .desc = "Armada SoC DRM",
332 .date = "20120730", 333 .date = "20120730",
333 .driver_features = DRIVER_GEM | DRIVER_MODESET | 334 .driver_features = DRIVER_GEM | DRIVER_MODESET |
334 DRIVER_PRIME, 335 DRIVER_HAVE_IRQ | DRIVER_PRIME,
335 .ioctls = armada_ioctls, 336 .ioctls = armada_ioctls,
336 .fops = &armada_drm_fops, 337 .fops = &armada_drm_fops,
337}; 338};
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index cd50ece31601..6adb1e5cfb08 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1355,13 +1355,8 @@ static void exynos_dp_unbind(struct device *dev, struct device *master,
1355 void *data) 1355 void *data)
1356{ 1356{
1357 struct exynos_drm_display *display = dev_get_drvdata(dev); 1357 struct exynos_drm_display *display = dev_get_drvdata(dev);
1358 struct exynos_dp_device *dp = display->ctx;
1359 struct drm_encoder *encoder = dp->encoder;
1360 1358
1361 exynos_dp_dpms(display, DRM_MODE_DPMS_OFF); 1359 exynos_dp_dpms(display, DRM_MODE_DPMS_OFF);
1362
1363 exynos_dp_connector_destroy(&dp->connector);
1364 encoder->funcs->destroy(encoder);
1365} 1360}
1366 1361
1367static const struct component_ops exynos_dp_ops = { 1362static const struct component_ops exynos_dp_ops = {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 8e38e9f8e542..45026e693225 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -71,13 +71,16 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
71 !atomic_read(&exynos_crtc->pending_flip), 71 !atomic_read(&exynos_crtc->pending_flip),
72 HZ/20)) 72 HZ/20))
73 atomic_set(&exynos_crtc->pending_flip, 0); 73 atomic_set(&exynos_crtc->pending_flip, 0);
74 drm_vblank_off(crtc->dev, exynos_crtc->pipe); 74 drm_crtc_vblank_off(crtc);
75 } 75 }
76 76
77 if (manager->ops->dpms) 77 if (manager->ops->dpms)
78 manager->ops->dpms(manager, mode); 78 manager->ops->dpms(manager, mode);
79 79
80 exynos_crtc->dpms = mode; 80 exynos_crtc->dpms = mode;
81
82 if (mode == DRM_MODE_DPMS_ON)
83 drm_crtc_vblank_on(crtc);
81} 84}
82 85
83static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) 86static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 96c87db388fb..3dc678ed9949 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -338,14 +338,10 @@ err_del_component:
338 338
339int exynos_dpi_remove(struct device *dev) 339int exynos_dpi_remove(struct device *dev)
340{ 340{
341 struct drm_encoder *encoder = exynos_dpi_display.encoder;
342 struct exynos_dpi *ctx = exynos_dpi_display.ctx; 341 struct exynos_dpi *ctx = exynos_dpi_display.ctx;
343 342
344 exynos_dpi_dpms(&exynos_dpi_display, DRM_MODE_DPMS_OFF); 343 exynos_dpi_dpms(&exynos_dpi_display, DRM_MODE_DPMS_OFF);
345 344
346 exynos_dpi_connector_destroy(&ctx->connector);
347 encoder->funcs->destroy(encoder);
348
349 if (ctx->panel) 345 if (ctx->panel)
350 drm_panel_detach(ctx->panel); 346 drm_panel_detach(ctx->panel);
351 347
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 443a2069858a..c57466edf45b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -87,16 +87,12 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
87 87
88 plane = exynos_plane_init(dev, possible_crtcs, 88 plane = exynos_plane_init(dev, possible_crtcs,
89 DRM_PLANE_TYPE_OVERLAY); 89 DRM_PLANE_TYPE_OVERLAY);
90 if (IS_ERR(plane)) 90 if (!IS_ERR(plane))
91 goto err_mode_config_cleanup; 91 continue;
92 }
93
94 /* init kms poll for handling hpd */
95 drm_kms_helper_poll_init(dev);
96 92
97 ret = drm_vblank_init(dev, MAX_CRTC); 93 ret = PTR_ERR(plane);
98 if (ret)
99 goto err_mode_config_cleanup; 94 goto err_mode_config_cleanup;
95 }
100 96
101 /* setup possible_clones. */ 97 /* setup possible_clones. */
102 exynos_drm_encoder_setup(dev); 98 exynos_drm_encoder_setup(dev);
@@ -106,15 +102,16 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
106 /* Try to bind all sub drivers. */ 102 /* Try to bind all sub drivers. */
107 ret = component_bind_all(dev->dev, dev); 103 ret = component_bind_all(dev->dev, dev);
108 if (ret) 104 if (ret)
109 goto err_cleanup_vblank; 105 goto err_mode_config_cleanup;
110 106
111 /* Probe non kms sub drivers and virtual display driver. */ 107 ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
112 ret = exynos_drm_device_subdrv_probe(dev);
113 if (ret) 108 if (ret)
114 goto err_unbind_all; 109 goto err_unbind_all;
115 110
116 /* force connectors detection */ 111 /* Probe non kms sub drivers and virtual display driver. */
117 drm_helper_hpd_irq_event(dev); 112 ret = exynos_drm_device_subdrv_probe(dev);
113 if (ret)
114 goto err_cleanup_vblank;
118 115
119 /* 116 /*
120 * enable drm irq mode. 117 * enable drm irq mode.
@@ -133,12 +130,18 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
133 */ 130 */
134 dev->vblank_disable_allowed = true; 131 dev->vblank_disable_allowed = true;
135 132
133 /* init kms poll for handling hpd */
134 drm_kms_helper_poll_init(dev);
135
136 /* force connectors detection */
137 drm_helper_hpd_irq_event(dev);
138
136 return 0; 139 return 0;
137 140
138err_unbind_all:
139 component_unbind_all(dev->dev, dev);
140err_cleanup_vblank: 141err_cleanup_vblank:
141 drm_vblank_cleanup(dev); 142 drm_vblank_cleanup(dev);
143err_unbind_all:
144 component_unbind_all(dev->dev, dev);
142err_mode_config_cleanup: 145err_mode_config_cleanup:
143 drm_mode_config_cleanup(dev); 146 drm_mode_config_cleanup(dev);
144 drm_release_iommu_mapping(dev); 147 drm_release_iommu_mapping(dev);
@@ -155,8 +158,8 @@ static int exynos_drm_unload(struct drm_device *dev)
155 exynos_drm_fbdev_fini(dev); 158 exynos_drm_fbdev_fini(dev);
156 drm_kms_helper_poll_fini(dev); 159 drm_kms_helper_poll_fini(dev);
157 160
158 component_unbind_all(dev->dev, dev);
159 drm_vblank_cleanup(dev); 161 drm_vblank_cleanup(dev);
162 component_unbind_all(dev->dev, dev);
160 drm_mode_config_cleanup(dev); 163 drm_mode_config_cleanup(dev);
161 drm_release_iommu_mapping(dev); 164 drm_release_iommu_mapping(dev);
162 165
@@ -191,8 +194,12 @@ static int exynos_drm_resume(struct drm_device *dev)
191 194
192 drm_modeset_lock_all(dev); 195 drm_modeset_lock_all(dev);
193 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 196 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
194 if (connector->funcs->dpms) 197 if (connector->funcs->dpms) {
195 connector->funcs->dpms(connector, connector->dpms); 198 int dpms = connector->dpms;
199
200 connector->dpms = DRM_MODE_DPMS_OFF;
201 connector->funcs->dpms(connector, dpms);
202 }
196 } 203 }
197 drm_modeset_unlock_all(dev); 204 drm_modeset_unlock_all(dev);
198 205
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 24741d8758e8..acf7e9e39dcd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1660,13 +1660,9 @@ static void exynos_dsi_unbind(struct device *dev, struct device *master,
1660 void *data) 1660 void *data)
1661{ 1661{
1662 struct exynos_dsi *dsi = exynos_dsi_display.ctx; 1662 struct exynos_dsi *dsi = exynos_dsi_display.ctx;
1663 struct drm_encoder *encoder = dsi->encoder;
1664 1663
1665 exynos_dsi_dpms(&exynos_dsi_display, DRM_MODE_DPMS_OFF); 1664 exynos_dsi_dpms(&exynos_dsi_display, DRM_MODE_DPMS_OFF);
1666 1665
1667 exynos_dsi_connector_destroy(&dsi->connector);
1668 encoder->funcs->destroy(encoder);
1669
1670 mipi_dsi_host_unregister(&dsi->dsi_host); 1666 mipi_dsi_host_unregister(&dsi->dsi_host);
1671} 1667}
1672 1668
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index d565207040a2..50faf913e574 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -630,7 +630,6 @@ static int vidi_remove(struct platform_device *pdev)
630{ 630{
631 struct exynos_drm_manager *mgr = platform_get_drvdata(pdev); 631 struct exynos_drm_manager *mgr = platform_get_drvdata(pdev);
632 struct vidi_context *ctx = mgr->ctx; 632 struct vidi_context *ctx = mgr->ctx;
633 struct drm_encoder *encoder = ctx->encoder;
634 633
635 if (ctx->raw_edid != (struct edid *)fake_edid_info) { 634 if (ctx->raw_edid != (struct edid *)fake_edid_info) {
636 kfree(ctx->raw_edid); 635 kfree(ctx->raw_edid);
@@ -639,9 +638,6 @@ static int vidi_remove(struct platform_device *pdev)
639 return -EINVAL; 638 return -EINVAL;
640 } 639 }
641 640
642 encoder->funcs->destroy(encoder);
643 drm_connector_cleanup(&ctx->connector);
644
645 return 0; 641 return 0;
646} 642}
647 643
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 7910fb37d9bb..563a19e62eb2 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2312,12 +2312,6 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
2312 2312
2313static void hdmi_unbind(struct device *dev, struct device *master, void *data) 2313static void hdmi_unbind(struct device *dev, struct device *master, void *data)
2314{ 2314{
2315 struct exynos_drm_display *display = get_hdmi_display(dev);
2316 struct drm_encoder *encoder = display->encoder;
2317 struct hdmi_context *hdata = display->ctx;
2318
2319 hdmi_connector_destroy(&hdata->connector);
2320 encoder->funcs->destroy(encoder);
2321} 2315}
2322 2316
2323static const struct component_ops hdmi_component_ops = { 2317static const struct component_ops hdmi_component_ops = {
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 055d5e7fbf12..2318b4c7a8f8 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -986,6 +986,15 @@ static int i915_pm_freeze(struct device *dev)
986 return i915_drm_freeze(drm_dev); 986 return i915_drm_freeze(drm_dev);
987} 987}
988 988
989static int i915_pm_freeze_late(struct device *dev)
990{
991 struct pci_dev *pdev = to_pci_dev(dev);
992 struct drm_device *drm_dev = pci_get_drvdata(pdev);
993 struct drm_i915_private *dev_priv = drm_dev->dev_private;
994
995 return intel_suspend_complete(dev_priv);
996}
997
989static int i915_pm_thaw_early(struct device *dev) 998static int i915_pm_thaw_early(struct device *dev)
990{ 999{
991 struct pci_dev *pdev = to_pci_dev(dev); 1000 struct pci_dev *pdev = to_pci_dev(dev);
@@ -1570,6 +1579,7 @@ static const struct dev_pm_ops i915_pm_ops = {
1570 .resume_early = i915_pm_resume_early, 1579 .resume_early = i915_pm_resume_early,
1571 .resume = i915_pm_resume, 1580 .resume = i915_pm_resume,
1572 .freeze = i915_pm_freeze, 1581 .freeze = i915_pm_freeze,
1582 .freeze_late = i915_pm_freeze_late,
1573 .thaw_early = i915_pm_thaw_early, 1583 .thaw_early = i915_pm_thaw_early,
1574 .thaw = i915_pm_thaw, 1584 .thaw = i915_pm_thaw,
1575 .poweroff = i915_pm_poweroff, 1585 .poweroff = i915_pm_poweroff,
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index b672b843fd5e..728938f02341 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1902,6 +1902,22 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv)
1902 GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | 1902 GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) |
1903 GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); 1903 GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3));
1904 1904
1905 if (!USES_PPGTT(dev_priv->dev))
1906 /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry,
1907 * so RTL will always use the value corresponding to
1908 * pat_sel = 000".
1909 * So let's disable cache for GGTT to avoid screen corruptions.
1910 * MOCS still can be used though.
1911 * - System agent ggtt writes (i.e. cpu gtt mmaps) already work
1912 * before this patch, i.e. the same uncached + snooping access
1913 * like on gen6/7 seems to be in effect.
1914 * - So this just fixes blitter/render access. Again it looks
1915 * like it's not just uncached access, but uncached + snooping.
1916 * So we can still hold onto all our assumptions wrt cpu
1917 * clflushing on LLC machines.
1918 */
1919 pat = GEN8_PPAT(0, GEN8_PPAT_UC);
1920
1905 /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b 1921 /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b
1906 * write would work. */ 1922 * write would work. */
1907 I915_WRITE(GEN8_PRIVATE_PAT, pat); 1923 I915_WRITE(GEN8_PRIVATE_PAT, pat);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c9e220963a78..f0a1a56406eb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4585,7 +4585,7 @@ static void vlv_update_cdclk(struct drm_device *dev)
4585 * BSpec erroneously claims we should aim for 4MHz, but 4585 * BSpec erroneously claims we should aim for 4MHz, but
4586 * in fact 1MHz is the correct frequency. 4586 * in fact 1MHz is the correct frequency.
4587 */ 4587 */
4588 I915_WRITE(GMBUSFREQ_VLV, dev_priv->vlv_cdclk_freq); 4588 I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->vlv_cdclk_freq, 1000));
4589} 4589}
4590 4590
4591/* Adjust CDclk dividers to allow high res or save power if possible */ 4591/* Adjust CDclk dividers to allow high res or save power if possible */
@@ -12885,6 +12885,9 @@ static struct intel_quirk intel_quirks[] = {
12885 /* Acer C720 Chromebook (Core i3 4005U) */ 12885 /* Acer C720 Chromebook (Core i3 4005U) */
12886 { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present }, 12886 { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present },
12887 12887
12888 /* Apple Macbook 2,1 (Core 2 T7400) */
12889 { 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
12890
12888 /* Toshiba CB35 Chromebook (Celeron 2955U) */ 12891 /* Toshiba CB35 Chromebook (Celeron 2955U) */
12889 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, 12892 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
12890 12893
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f6a3fdd5589e..5ad45bfff3fe 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2806,6 +2806,13 @@ intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset,
2806 ssize_t ret; 2806 ssize_t ret;
2807 int i; 2807 int i;
2808 2808
2809 /*
2810 * Sometime we just get the same incorrect byte repeated
2811 * over the entire buffer. Doing just one throw away read
2812 * initially seems to "solve" it.
2813 */
2814 drm_dp_dpcd_read(aux, DP_DPCD_REV, buffer, 1);
2815
2809 for (i = 0; i < 3; i++) { 2816 for (i = 0; i < 3; i++) {
2810 ret = drm_dp_dpcd_read(aux, offset, buffer, size); 2817 ret = drm_dp_dpcd_read(aux, offset, buffer, size);
2811 if (ret == size) 2818 if (ret == size)
@@ -3724,9 +3731,10 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
3724 } 3731 }
3725 } 3732 }
3726 3733
3727 /* Training Pattern 3 support */ 3734 /* Training Pattern 3 support, both source and sink */
3728 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 && 3735 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 &&
3729 intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED) { 3736 intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED &&
3737 (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)) {
3730 intel_dp->use_tps3 = true; 3738 intel_dp->use_tps3 = true;
3731 DRM_DEBUG_KMS("Displayport TPS3 supported\n"); 3739 DRM_DEBUG_KMS("Displayport TPS3 supported\n");
3732 } else 3740 } else
@@ -4491,6 +4499,18 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
4491 if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) 4499 if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
4492 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; 4500 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
4493 4501
4502 if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) {
4503 /*
4504 * vdd off can generate a long pulse on eDP which
4505 * would require vdd on to handle it, and thus we
4506 * would end up in an endless cycle of
4507 * "vdd off -> long hpd -> vdd on -> detect -> vdd off -> ..."
4508 */
4509 DRM_DEBUG_KMS("ignoring long hpd on eDP port %c\n",
4510 port_name(intel_dig_port->port));
4511 return false;
4512 }
4513
4494 DRM_DEBUG_KMS("got hpd irq on port %c - %s\n", 4514 DRM_DEBUG_KMS("got hpd irq on port %c - %s\n",
4495 port_name(intel_dig_port->port), 4515 port_name(intel_dig_port->port),
4496 long_hpd ? "long" : "short"); 4516 long_hpd ? "long" : "short");
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 0e018cb49147..41b3be217493 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1098,12 +1098,25 @@ static u32 get_backlight_min_vbt(struct intel_connector *connector)
1098 struct drm_device *dev = connector->base.dev; 1098 struct drm_device *dev = connector->base.dev;
1099 struct drm_i915_private *dev_priv = dev->dev_private; 1099 struct drm_i915_private *dev_priv = dev->dev_private;
1100 struct intel_panel *panel = &connector->panel; 1100 struct intel_panel *panel = &connector->panel;
1101 int min;
1101 1102
1102 WARN_ON(panel->backlight.max == 0); 1103 WARN_ON(panel->backlight.max == 0);
1103 1104
1105 /*
1106 * XXX: If the vbt value is 255, it makes min equal to max, which leads
1107 * to problems. There are such machines out there. Either our
1108 * interpretation is wrong or the vbt has bogus data. Or both. Safeguard
1109 * against this by letting the minimum be at most (arbitrarily chosen)
1110 * 25% of the max.
1111 */
1112 min = clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64);
1113 if (min != dev_priv->vbt.backlight.min_brightness) {
1114 DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n",
1115 dev_priv->vbt.backlight.min_brightness, min);
1116 }
1117
1104 /* vbt value is a coefficient in range [0..255] */ 1118 /* vbt value is a coefficient in range [0..255] */
1105 return scale(dev_priv->vbt.backlight.min_brightness, 0, 255, 1119 return scale(min, 0, 255, 0, panel->backlight.max);
1106 0, panel->backlight.max);
1107} 1120}
1108 1121
1109static int bdw_setup_backlight(struct intel_connector *connector) 1122static int bdw_setup_backlight(struct intel_connector *connector)
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 377afa504d2b..89c01fa6dd8e 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -4313,8 +4313,8 @@ static int cik_cp_gfx_start(struct radeon_device *rdev)
4313 /* init the CE partitions. CE only used for gfx on CIK */ 4313 /* init the CE partitions. CE only used for gfx on CIK */
4314 radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); 4314 radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2));
4315 radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); 4315 radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE));
4316 radeon_ring_write(ring, 0xc000); 4316 radeon_ring_write(ring, 0x8000);
4317 radeon_ring_write(ring, 0xc000); 4317 radeon_ring_write(ring, 0x8000);
4318 4318
4319 /* setup clear context state */ 4319 /* setup clear context state */
4320 radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); 4320 radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0));
@@ -9447,6 +9447,9 @@ void dce8_bandwidth_update(struct radeon_device *rdev)
9447 u32 num_heads = 0, lb_size; 9447 u32 num_heads = 0, lb_size;
9448 int i; 9448 int i;
9449 9449
9450 if (!rdev->mode_info.mode_config_initialized)
9451 return;
9452
9450 radeon_update_display_priority(rdev); 9453 radeon_update_display_priority(rdev);
9451 9454
9452 for (i = 0; i < rdev->num_crtc; i++) { 9455 for (i = 0; i < rdev->num_crtc; i++) {
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index 4e8432d07f15..d748963af08b 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -667,17 +667,20 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
667{ 667{
668 struct radeon_ib ib; 668 struct radeon_ib ib;
669 unsigned i; 669 unsigned i;
670 unsigned index;
670 int r; 671 int r;
671 void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
672 u32 tmp = 0; 672 u32 tmp = 0;
673 u64 gpu_addr;
673 674
674 if (!ptr) { 675 if (ring->idx == R600_RING_TYPE_DMA_INDEX)
675 DRM_ERROR("invalid vram scratch pointer\n"); 676 index = R600_WB_DMA_RING_TEST_OFFSET;
676 return -EINVAL; 677 else
677 } 678 index = CAYMAN_WB_DMA1_RING_TEST_OFFSET;
679
680 gpu_addr = rdev->wb.gpu_addr + index;
678 681
679 tmp = 0xCAFEDEAD; 682 tmp = 0xCAFEDEAD;
680 writel(tmp, ptr); 683 rdev->wb.wb[index/4] = cpu_to_le32(tmp);
681 684
682 r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); 685 r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256);
683 if (r) { 686 if (r) {
@@ -686,8 +689,8 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
686 } 689 }
687 690
688 ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0); 691 ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0);
689 ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; 692 ib.ptr[1] = lower_32_bits(gpu_addr);
690 ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr); 693 ib.ptr[2] = upper_32_bits(gpu_addr);
691 ib.ptr[3] = 1; 694 ib.ptr[3] = 1;
692 ib.ptr[4] = 0xDEADBEEF; 695 ib.ptr[4] = 0xDEADBEEF;
693 ib.length_dw = 5; 696 ib.length_dw = 5;
@@ -704,7 +707,7 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
704 return r; 707 return r;
705 } 708 }
706 for (i = 0; i < rdev->usec_timeout; i++) { 709 for (i = 0; i < rdev->usec_timeout; i++) {
707 tmp = readl(ptr); 710 tmp = le32_to_cpu(rdev->wb.wb[index/4]);
708 if (tmp == 0xDEADBEEF) 711 if (tmp == 0xDEADBEEF)
709 break; 712 break;
710 DRM_UDELAY(1); 713 DRM_UDELAY(1);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index a31f1ca40c6a..85995b4e3338 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2345,6 +2345,9 @@ void evergreen_bandwidth_update(struct radeon_device *rdev)
2345 u32 num_heads = 0, lb_size; 2345 u32 num_heads = 0, lb_size;
2346 int i; 2346 int i;
2347 2347
2348 if (!rdev->mode_info.mode_config_initialized)
2349 return;
2350
2348 radeon_update_display_priority(rdev); 2351 radeon_update_display_priority(rdev);
2349 2352
2350 for (i = 0; i < rdev->num_crtc; i++) { 2353 for (i = 0; i < rdev->num_crtc; i++) {
@@ -2552,6 +2555,7 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav
2552 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); 2555 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1);
2553 tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; 2556 tmp |= EVERGREEN_CRTC_BLANK_DATA_EN;
2554 WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); 2557 WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp);
2558 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0);
2555 } 2559 }
2556 } else { 2560 } else {
2557 tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); 2561 tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]);
@@ -3005,7 +3009,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
3005 u32 vgt_cache_invalidation; 3009 u32 vgt_cache_invalidation;
3006 u32 hdp_host_path_cntl, tmp; 3010 u32 hdp_host_path_cntl, tmp;
3007 u32 disabled_rb_mask; 3011 u32 disabled_rb_mask;
3008 int i, j, num_shader_engines, ps_thread_count; 3012 int i, j, ps_thread_count;
3009 3013
3010 switch (rdev->family) { 3014 switch (rdev->family) {
3011 case CHIP_CYPRESS: 3015 case CHIP_CYPRESS:
@@ -3303,8 +3307,6 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
3303 rdev->config.evergreen.tile_config |= 3307 rdev->config.evergreen.tile_config |=
3304 ((gb_addr_config & 0x30000000) >> 28) << 12; 3308 ((gb_addr_config & 0x30000000) >> 28) << 12;
3305 3309
3306 num_shader_engines = (gb_addr_config & NUM_SHADER_ENGINES(3) >> 12) + 1;
3307
3308 if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) { 3310 if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) {
3309 u32 efuse_straps_4; 3311 u32 efuse_straps_4;
3310 u32 efuse_straps_3; 3312 u32 efuse_straps_3;
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 1dd976f447fa..9b42001295ba 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2725,7 +2725,11 @@ int kv_dpm_init(struct radeon_device *rdev)
2725 2725
2726 pi->sram_end = SMC_RAM_END; 2726 pi->sram_end = SMC_RAM_END;
2727 2727
2728 pi->enable_nb_dpm = true; 2728 /* Enabling nb dpm on an asrock system prevents dpm from working */
2729 if (rdev->pdev->subsystem_vendor == 0x1849)
2730 pi->enable_nb_dpm = false;
2731 else
2732 pi->enable_nb_dpm = true;
2729 2733
2730 pi->caps_power_containment = true; 2734 pi->caps_power_containment = true;
2731 pi->caps_cac = true; 2735 pi->caps_cac = true;
@@ -2740,10 +2744,19 @@ int kv_dpm_init(struct radeon_device *rdev)
2740 pi->caps_sclk_ds = true; 2744 pi->caps_sclk_ds = true;
2741 pi->enable_auto_thermal_throttling = true; 2745 pi->enable_auto_thermal_throttling = true;
2742 pi->disable_nb_ps3_in_battery = false; 2746 pi->disable_nb_ps3_in_battery = false;
2743 if (radeon_bapm == 0) 2747 if (radeon_bapm == -1) {
2748 /* There are stability issues reported on with
2749 * bapm enabled on an asrock system.
2750 */
2751 if (rdev->pdev->subsystem_vendor == 0x1849)
2752 pi->bapm_enable = false;
2753 else
2754 pi->bapm_enable = true;
2755 } else if (radeon_bapm == 0) {
2744 pi->bapm_enable = false; 2756 pi->bapm_enable = false;
2745 else 2757 } else {
2746 pi->bapm_enable = true; 2758 pi->bapm_enable = true;
2759 }
2747 pi->voltage_drop_t = 0; 2760 pi->voltage_drop_t = 0;
2748 pi->caps_sclk_throttle_low_notification = false; 2761 pi->caps_sclk_throttle_low_notification = false;
2749 pi->caps_fps = false; /* true? */ 2762 pi->caps_fps = false; /* true? */
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 10f8be0ee173..b53b31a7b76f 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3207,6 +3207,9 @@ void r100_bandwidth_update(struct radeon_device *rdev)
3207 uint32_t pixel_bytes1 = 0; 3207 uint32_t pixel_bytes1 = 0;
3208 uint32_t pixel_bytes2 = 0; 3208 uint32_t pixel_bytes2 = 0;
3209 3209
3210 if (!rdev->mode_info.mode_config_initialized)
3211 return;
3212
3210 radeon_update_display_priority(rdev); 3213 radeon_update_display_priority(rdev);
3211 3214
3212 if (rdev->mode_info.crtcs[0]->base.enabled) { 3215 if (rdev->mode_info.crtcs[0]->base.enabled) {
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
index aabc343b9a8f..cf0df45d455e 100644
--- a/drivers/gpu/drm/radeon/r600_dma.c
+++ b/drivers/gpu/drm/radeon/r600_dma.c
@@ -338,17 +338,17 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
338{ 338{
339 struct radeon_ib ib; 339 struct radeon_ib ib;
340 unsigned i; 340 unsigned i;
341 unsigned index;
341 int r; 342 int r;
342 void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
343 u32 tmp = 0; 343 u32 tmp = 0;
344 u64 gpu_addr;
344 345
345 if (!ptr) { 346 if (ring->idx == R600_RING_TYPE_DMA_INDEX)
346 DRM_ERROR("invalid vram scratch pointer\n"); 347 index = R600_WB_DMA_RING_TEST_OFFSET;
347 return -EINVAL; 348 else
348 } 349 index = CAYMAN_WB_DMA1_RING_TEST_OFFSET;
349 350
350 tmp = 0xCAFEDEAD; 351 gpu_addr = rdev->wb.gpu_addr + index;
351 writel(tmp, ptr);
352 352
353 r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); 353 r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256);
354 if (r) { 354 if (r) {
@@ -357,8 +357,8 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
357 } 357 }
358 358
359 ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1); 359 ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1);
360 ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; 360 ib.ptr[1] = lower_32_bits(gpu_addr);
361 ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff; 361 ib.ptr[2] = upper_32_bits(gpu_addr) & 0xff;
362 ib.ptr[3] = 0xDEADBEEF; 362 ib.ptr[3] = 0xDEADBEEF;
363 ib.length_dw = 4; 363 ib.length_dw = 4;
364 364
@@ -374,7 +374,7 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
374 return r; 374 return r;
375 } 375 }
376 for (i = 0; i < rdev->usec_timeout; i++) { 376 for (i = 0; i < rdev->usec_timeout; i++) {
377 tmp = readl(ptr); 377 tmp = le32_to_cpu(rdev->wb.wb[index/4]);
378 if (tmp == 0xDEADBEEF) 378 if (tmp == 0xDEADBEEF)
379 break; 379 break;
380 DRM_UDELAY(1); 380 DRM_UDELAY(1);
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 6a03624fadaa..63ccb8fa799c 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -658,12 +658,10 @@ bool radeon_get_bios(struct radeon_device *rdev)
658 r = igp_read_bios_from_vram(rdev); 658 r = igp_read_bios_from_vram(rdev);
659 if (r == false) 659 if (r == false)
660 r = radeon_read_bios(rdev); 660 r = radeon_read_bios(rdev);
661 if (r == false) { 661 if (r == false)
662 r = radeon_read_disabled_bios(rdev); 662 r = radeon_read_disabled_bios(rdev);
663 } 663 if (r == false)
664 if (r == false) {
665 r = radeon_read_platform_bios(rdev); 664 r = radeon_read_platform_bios(rdev);
666 }
667 if (r == false || rdev->bios == NULL) { 665 if (r == false || rdev->bios == NULL) {
668 DRM_ERROR("Unable to locate a BIOS ROM\n"); 666 DRM_ERROR("Unable to locate a BIOS ROM\n");
669 rdev->bios = NULL; 667 rdev->bios = NULL;
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 1c893447d7cd..a3e7aed7e680 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -450,7 +450,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
450 kfree(parser->track); 450 kfree(parser->track);
451 kfree(parser->relocs); 451 kfree(parser->relocs);
452 kfree(parser->relocs_ptr); 452 kfree(parser->relocs_ptr);
453 kfree(parser->vm_bos); 453 drm_free_large(parser->vm_bos);
454 for (i = 0; i < parser->nchunks; i++) 454 for (i = 0; i < parser->nchunks; i++)
455 drm_free_large(parser->chunks[i].kdata); 455 drm_free_large(parser->chunks[i].kdata);
456 kfree(parser->chunks); 456 kfree(parser->chunks);
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 3d17af34afa7..2456f69efd23 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -314,7 +314,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring
314 } 314 }
315 315
316 /* and then save the content of the ring */ 316 /* and then save the content of the ring */
317 *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); 317 *data = drm_malloc_ab(size, sizeof(uint32_t));
318 if (!*data) { 318 if (!*data) {
319 mutex_unlock(&rdev->ring_lock); 319 mutex_unlock(&rdev->ring_lock);
320 return 0; 320 return 0;
@@ -356,7 +356,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,
356 } 356 }
357 357
358 radeon_ring_unlock_commit(rdev, ring, false); 358 radeon_ring_unlock_commit(rdev, ring, false);
359 kfree(data); 359 drm_free_large(data);
360 return 0; 360 return 0;
361} 361}
362 362
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
index 4532cc76a0a6..dfde266529e2 100644
--- a/drivers/gpu/drm/radeon/radeon_vm.c
+++ b/drivers/gpu/drm/radeon/radeon_vm.c
@@ -132,8 +132,8 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev,
132 struct radeon_cs_reloc *list; 132 struct radeon_cs_reloc *list;
133 unsigned i, idx; 133 unsigned i, idx;
134 134
135 list = kmalloc_array(vm->max_pde_used + 2, 135 list = drm_malloc_ab(vm->max_pde_used + 2,
136 sizeof(struct radeon_cs_reloc), GFP_KERNEL); 136 sizeof(struct radeon_cs_reloc));
137 if (!list) 137 if (!list)
138 return NULL; 138 return NULL;
139 139
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 5f6db4629aaa..9acb1c3c005b 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -879,6 +879,9 @@ void rs600_bandwidth_update(struct radeon_device *rdev)
879 u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; 879 u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt;
880 /* FIXME: implement full support */ 880 /* FIXME: implement full support */
881 881
882 if (!rdev->mode_info.mode_config_initialized)
883 return;
884
882 radeon_update_display_priority(rdev); 885 radeon_update_display_priority(rdev);
883 886
884 if (rdev->mode_info.crtcs[0]->base.enabled) 887 if (rdev->mode_info.crtcs[0]->base.enabled)
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 3462b64369bf..0a2d36e81108 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -579,6 +579,9 @@ void rs690_bandwidth_update(struct radeon_device *rdev)
579 u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; 579 u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt;
580 u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; 580 u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt;
581 581
582 if (!rdev->mode_info.mode_config_initialized)
583 return;
584
582 radeon_update_display_priority(rdev); 585 radeon_update_display_priority(rdev);
583 586
584 if (rdev->mode_info.crtcs[0]->base.enabled) 587 if (rdev->mode_info.crtcs[0]->base.enabled)
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 8a477bf1fdb3..c55d653aaf5f 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -1277,6 +1277,9 @@ void rv515_bandwidth_update(struct radeon_device *rdev)
1277 struct drm_display_mode *mode0 = NULL; 1277 struct drm_display_mode *mode0 = NULL;
1278 struct drm_display_mode *mode1 = NULL; 1278 struct drm_display_mode *mode1 = NULL;
1279 1279
1280 if (!rdev->mode_info.mode_config_initialized)
1281 return;
1282
1280 radeon_update_display_priority(rdev); 1283 radeon_update_display_priority(rdev);
1281 1284
1282 if (rdev->mode_info.crtcs[0]->base.enabled) 1285 if (rdev->mode_info.crtcs[0]->base.enabled)
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index eeea5b6a1775..7d5083dc4acb 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2384,6 +2384,9 @@ void dce6_bandwidth_update(struct radeon_device *rdev)
2384 u32 num_heads = 0, lb_size; 2384 u32 num_heads = 0, lb_size;
2385 int i; 2385 int i;
2386 2386
2387 if (!rdev->mode_info.mode_config_initialized)
2388 return;
2389
2387 radeon_update_display_priority(rdev); 2390 radeon_update_display_priority(rdev);
2388 2391
2389 for (i = 0; i < rdev->num_crtc; i++) { 2392 for (i = 0; i < rdev->num_crtc; i++) {
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index a53c2e79d9cb..676e6c2ba90a 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -6256,7 +6256,7 @@ static void si_parse_pplib_clock_info(struct radeon_device *rdev,
6256 if ((rps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) && 6256 if ((rps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) &&
6257 index == 0) { 6257 index == 0) {
6258 /* XXX disable for A0 tahiti */ 6258 /* XXX disable for A0 tahiti */
6259 si_pi->ulv.supported = true; 6259 si_pi->ulv.supported = false;
6260 si_pi->ulv.pl = *pl; 6260 si_pi->ulv.pl = *pl;
6261 si_pi->ulv.one_pcie_lane_in_ulv = false; 6261 si_pi->ulv.one_pcie_lane_in_ulv = false;
6262 si_pi->ulv.volt_change_delay = SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT; 6262 si_pi->ulv.volt_change_delay = SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
index bfeb4b1f2acf..21e9b7f8dad0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
@@ -246,7 +246,8 @@ int vmw_cmdbuf_res_remove(struct vmw_cmdbuf_res_manager *man,
246 struct drm_hash_item *hash; 246 struct drm_hash_item *hash;
247 int ret; 247 int ret;
248 248
249 ret = drm_ht_find_item(&man->resources, user_key, &hash); 249 ret = drm_ht_find_item(&man->resources, user_key | (res_type << 24),
250 &hash);
250 if (likely(ret != 0)) 251 if (likely(ret != 0))
251 return -EINVAL; 252 return -EINVAL;
252 253
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 7197af157313..25f3c250fd98 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -688,7 +688,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
688 goto out_err0; 688 goto out_err0;
689 } 689 }
690 690
691 if (unlikely(dev_priv->prim_bb_mem < dev_priv->vram_size)) 691 /*
692 * Limit back buffer size to VRAM size. Remove this once
693 * screen targets are implemented.
694 */
695 if (dev_priv->prim_bb_mem > dev_priv->vram_size)
692 dev_priv->prim_bb_mem = dev_priv->vram_size; 696 dev_priv->prim_bb_mem = dev_priv->vram_size;
693 697
694 mutex_unlock(&dev_priv->hw_mutex); 698 mutex_unlock(&dev_priv->hw_mutex);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index d2bc2b03d4c6..941a7bc0b791 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -187,7 +187,7 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
187 * can do this since the caller in the drm core doesn't check anything 187 * can do this since the caller in the drm core doesn't check anything
188 * which is protected by any looks. 188 * which is protected by any looks.
189 */ 189 */
190 drm_modeset_unlock(&crtc->mutex); 190 drm_modeset_unlock_crtc(crtc);
191 drm_modeset_lock_all(dev_priv->dev); 191 drm_modeset_lock_all(dev_priv->dev);
192 192
193 /* A lot of the code assumes this */ 193 /* A lot of the code assumes this */
@@ -252,7 +252,7 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
252 ret = 0; 252 ret = 0;
253out: 253out:
254 drm_modeset_unlock_all(dev_priv->dev); 254 drm_modeset_unlock_all(dev_priv->dev);
255 drm_modeset_lock(&crtc->mutex, NULL); 255 drm_modeset_lock_crtc(crtc);
256 256
257 return ret; 257 return ret;
258} 258}
@@ -273,7 +273,7 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
273 * can do this since the caller in the drm core doesn't check anything 273 * can do this since the caller in the drm core doesn't check anything
274 * which is protected by any looks. 274 * which is protected by any looks.
275 */ 275 */
276 drm_modeset_unlock(&crtc->mutex); 276 drm_modeset_unlock_crtc(crtc);
277 drm_modeset_lock_all(dev_priv->dev); 277 drm_modeset_lock_all(dev_priv->dev);
278 278
279 vmw_cursor_update_position(dev_priv, shown, 279 vmw_cursor_update_position(dev_priv, shown,
@@ -281,7 +281,7 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
281 du->cursor_y + du->hotspot_y); 281 du->cursor_y + du->hotspot_y);
282 282
283 drm_modeset_unlock_all(dev_priv->dev); 283 drm_modeset_unlock_all(dev_priv->dev);
284 drm_modeset_lock(&crtc->mutex, NULL); 284 drm_modeset_lock_crtc(crtc);
285 285
286 return 0; 286 return 0;
287} 287}
@@ -1950,6 +1950,14 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
1950 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) 1950 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
1951 }; 1951 };
1952 int i; 1952 int i;
1953 u32 assumed_bpp = 2;
1954
1955 /*
1956 * If using screen objects, then assume 32-bpp because that's what the
1957 * SVGA device is assuming
1958 */
1959 if (dev_priv->sou_priv)
1960 assumed_bpp = 4;
1953 1961
1954 /* Add preferred mode */ 1962 /* Add preferred mode */
1955 { 1963 {
@@ -1960,8 +1968,9 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
1960 mode->vdisplay = du->pref_height; 1968 mode->vdisplay = du->pref_height;
1961 vmw_guess_mode_timing(mode); 1969 vmw_guess_mode_timing(mode);
1962 1970
1963 if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2, 1971 if (vmw_kms_validate_mode_vram(dev_priv,
1964 mode->vdisplay)) { 1972 mode->hdisplay * assumed_bpp,
1973 mode->vdisplay)) {
1965 drm_mode_probed_add(connector, mode); 1974 drm_mode_probed_add(connector, mode);
1966 } else { 1975 } else {
1967 drm_mode_destroy(dev, mode); 1976 drm_mode_destroy(dev, mode);
@@ -1983,7 +1992,8 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
1983 bmode->vdisplay > max_height) 1992 bmode->vdisplay > max_height)
1984 continue; 1993 continue;
1985 1994
1986 if (!vmw_kms_validate_mode_vram(dev_priv, bmode->hdisplay * 2, 1995 if (!vmw_kms_validate_mode_vram(dev_priv,
1996 bmode->hdisplay * assumed_bpp,
1987 bmode->vdisplay)) 1997 bmode->vdisplay))
1988 continue; 1998 continue;
1989 1999
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 73bd9e2e42bc..3402033fa52a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1659,6 +1659,7 @@ void hid_disconnect(struct hid_device *hdev)
1659 hdev->hiddev_disconnect(hdev); 1659 hdev->hiddev_disconnect(hdev);
1660 if (hdev->claimed & HID_CLAIMED_HIDRAW) 1660 if (hdev->claimed & HID_CLAIMED_HIDRAW)
1661 hidraw_disconnect(hdev); 1661 hidraw_disconnect(hdev);
1662 hdev->claimed = 0;
1662} 1663}
1663EXPORT_SYMBOL_GPL(hid_disconnect); 1664EXPORT_SYMBOL_GPL(hid_disconnect);
1664 1665
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e23ab8b30626..7c863738e419 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -299,6 +299,7 @@
299#define USB_VENDOR_ID_ELAN 0x04f3 299#define USB_VENDOR_ID_ELAN 0x04f3
300#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 300#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089
301#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b 301#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b
302#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103
302#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f 303#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f
303 304
304#define USB_VENDOR_ID_ELECOM 0x056e 305#define USB_VENDOR_ID_ELECOM 0x056e
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 5014bb567b29..552671ee7c5d 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -72,6 +72,7 @@ static const struct hid_blacklist {
72 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 72 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
73 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, 73 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
74 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, 74 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
75 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
75 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, 76 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
76 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 77 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
77 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, 78 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index fcdbde4ec692..3057dfc7e3bc 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -234,7 +234,7 @@ static const struct pci_device_id fam15h_power_id_table[] = {
234 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 234 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
235 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, 235 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) },
236 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, 236 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) },
237 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, 237 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) },
238 {} 238 {}
239}; 239};
240MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); 240MODULE_DEVICE_TABLE(pci, fam15h_power_id_table);
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index d2bf2c97ae70..6a30eeea94be 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -181,7 +181,7 @@ static int __init populate_attr_groups(struct platform_device *pdev)
181 181
182 opal = of_find_node_by_path("/ibm,opal/sensors"); 182 opal = of_find_node_by_path("/ibm,opal/sensors");
183 if (!opal) { 183 if (!opal) {
184 dev_err(&pdev->dev, "Opal node 'sensors' not found\n"); 184 dev_dbg(&pdev->dev, "Opal node 'sensors' not found\n");
185 return -ENODEV; 185 return -ENODEV;
186 } 186 }
187 187
@@ -335,7 +335,9 @@ static int __init ibmpowernv_init(void)
335 335
336 err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe); 336 err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe);
337 if (err) { 337 if (err) {
338 pr_err("Platfrom driver probe failed\n"); 338 if (err != -ENODEV)
339 pr_err("Platform driver probe failed (%d)\n", err);
340
339 goto exit_device_del; 341 goto exit_device_del;
340 } 342 }
341 343
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 823c877a1ec0..1991d9032c38 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -161,10 +161,17 @@ static int pwm_fan_suspend(struct device *dev)
161static int pwm_fan_resume(struct device *dev) 161static int pwm_fan_resume(struct device *dev)
162{ 162{
163 struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); 163 struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
164 unsigned long duty;
165 int ret;
164 166
165 if (ctx->pwm_value) 167 if (ctx->pwm_value == 0)
166 return pwm_enable(ctx->pwm); 168 return 0;
167 return 0; 169
170 duty = DIV_ROUND_UP(ctx->pwm_value * (ctx->pwm->period - 1), MAX_PWM);
171 ret = pwm_config(ctx->pwm, duty, ctx->pwm->period);
172 if (ret)
173 return ret;
174 return pwm_enable(ctx->pwm);
168} 175}
169#endif 176#endif
170 177
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 65ef9664d5da..899bede81b31 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -12,11 +12,6 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301 USA.
20 * ------------------------------------------------------------------------- */ 15 * ------------------------------------------------------------------------- */
21 16
22/* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki 17/* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 8b10f88b13d9..580dbf05c148 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -12,11 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA.
20 */ 15 */
21 16
22#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index 34370090b753..270d84bfc2c6 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.c
+++ b/drivers/i2c/algos/i2c-algo-pcf.c
@@ -14,11 +14,6 @@
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301 USA.
21 *
22 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 17 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
23 * Frodo Looijaard <frodol@dds.nl>, and also from Martin Bailey 18 * Frodo Looijaard <frodol@dds.nl>, and also from Martin Bailey
24 * <mbailey@littlefeet-inc.com> 19 * <mbailey@littlefeet-inc.com>
diff --git a/drivers/i2c/algos/i2c-algo-pcf.h b/drivers/i2c/algos/i2c-algo-pcf.h
index 1ec703ee788d..262ee801975b 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.h
+++ b/drivers/i2c/algos/i2c-algo-pcf.h
@@ -12,12 +12,7 @@
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details. */
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA. */
21/* -------------------------------------------------------------------- */ 16/* -------------------------------------------------------------------- */
22 17
23/* With some changes from Frodo Looijaard <frodol@dds.nl> */ 18/* With some changes from Frodo Looijaard <frodol@dds.nl> */
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 451e305f7971..4f2d78868281 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/ 17*/
22 18
23/* 19/*
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index 2fa21ce9682b..45c5c4883022 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -12,10 +12,6 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/ 15*/
20 16
21/* 17/*
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
index 41fc6837fb8b..65e324054970 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 15 */
20 16
21/* 17/*
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index a16f72891358..6c7113d990f8 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -15,10 +15,6 @@
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/ 18*/
23 19
24/* 20/*
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 917d54588d95..e05a672db3e5 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -434,7 +434,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
434 } 434 }
435 } 435 }
436 436
437 ret = wait_for_completion_io_timeout(&dev->cmd_complete, 437 ret = wait_for_completion_timeout(&dev->cmd_complete,
438 dev->adapter.timeout); 438 dev->adapter.timeout);
439 if (ret == 0) { 439 if (ret == 0) {
440 dev_err(dev->dev, "controller timed out\n"); 440 dev_err(dev->dev, "controller timed out\n");
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index 8762458ca7da..6f8c0756e350 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -21,10 +21,6 @@
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details. 23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 */ 24 */
29 25
30#include <linux/delay.h> 26#include <linux/delay.h>
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index f3b89a4698b6..5bdbc71698d0 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -23,10 +23,6 @@
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details. 25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 */ 26 */
31 27
32#include <linux/kernel.h> 28#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 4d9614719128..d15b7c9b9219 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -17,10 +17,6 @@
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * ---------------------------------------------------------------------------- 20 * ----------------------------------------------------------------------------
25 * 21 *
26 */ 22 */
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 3c20e4bd6dd1..edca99dbba23 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -18,10 +18,6 @@
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * ---------------------------------------------------------------------------- 21 * ----------------------------------------------------------------------------
26 * 22 *
27 */ 23 */
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index d66b6cbc9edc..5a410ef17abd 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -18,10 +18,6 @@
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * ---------------------------------------------------------------------------- 21 * ----------------------------------------------------------------------------
26 * 22 *
27 */ 23 */
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index d31d313ab4f7..acb40f95db78 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -19,10 +19,6 @@
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details. 21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 * ---------------------------------------------------------------------------- 22 * ----------------------------------------------------------------------------
27 * 23 *
28 */ 24 */
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index a7431150acf7..373dd4d47765 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -18,10 +18,6 @@
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * ---------------------------------------------------------------------------- 21 * ----------------------------------------------------------------------------
26 * 22 *
27 */ 23 */
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index a44ea13d1434..76e699f9ed97 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -9,10 +9,6 @@
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 */ 12 */
17 13
18#include <linux/module.h> 14#include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 485497066ed7..92e8c0ce1625 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -12,11 +12,7 @@
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details. */
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20/* ------------------------------------------------------------------------- */ 16/* ------------------------------------------------------------------------- */
21 17
22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 18/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c
index 14d2b76de25f..b7864cf42a72 100644
--- a/drivers/i2c/busses/i2c-hydra.c
+++ b/drivers/i2c/busses/i2c-hydra.c
@@ -15,10 +15,6 @@
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/ 18*/
23 19
24#include <linux/kernel.h> 20#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 7cfc183b3d63..6ab4f1cb21f3 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -15,10 +15,6 @@
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/ 18*/
23 19
24/* 20/*
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index c48e46af670a..e9fb7cf78612 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -11,11 +11,6 @@
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA.
18 *
19 * Author: 14 * Author:
20 * Darius Augulis, Teltonika Inc. 15 * Darius Augulis, Teltonika Inc.
21 * 16 *
diff --git a/drivers/i2c/busses/i2c-iop3xx.h b/drivers/i2c/busses/i2c-iop3xx.h
index 097e270955d0..2d6929c2bd92 100644
--- a/drivers/i2c/busses/i2c-iop3xx.h
+++ b/drivers/i2c/busses/i2c-iop3xx.h
@@ -11,11 +11,7 @@
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details. */
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19/* ------------------------------------------------------------------------- */ 15/* ------------------------------------------------------------------------- */
20 16
21 17
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index cf99dbf21fd1..113293d275f6 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -14,10 +14,6 @@
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/ 17*/
22 18
23/* 19/*
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
index 3f6ecbfb9a56..f2b0ff011631 100644
--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -14,10 +14,6 @@
14 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details. 16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution 17 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL. 18 * in the file called LICENSE.GPL.
23 * 19 *
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c
index b170bdffb5de..88eda09e73c0 100644
--- a/drivers/i2c/busses/i2c-nforce2-s4985.c
+++ b/drivers/i2c/busses/i2c-nforce2-s4985.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 15 */
20 16
21/* 17/*
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index ee3a76c7ae97..70b3c9158509 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -17,10 +17,6 @@
17 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details. 19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24*/ 20*/
25 21
26/* 22/*
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 0dffb0e62c3b..26942c159de1 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -22,10 +22,6 @@
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details. 24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 25 */
30 26
31#include <linux/module.h> 27#include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 62f55fe624cb..d1f625f923c7 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -18,10 +18,6 @@
18 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details. 20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * ------------------------------------------------------------------------ */ 21 * ------------------------------------------------------------------------ */
26 22
27#include <linux/kernel.h> 23#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index a27aae2d6757..a1fac5aa9bae 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -18,10 +18,6 @@
18 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details. 20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * ------------------------------------------------------------------------ */ 21 * ------------------------------------------------------------------------ */
26 22
27#include <linux/kernel.h> 23#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h
index e572f3aac0f7..4e1294536805 100644
--- a/drivers/i2c/busses/i2c-parport.h
+++ b/drivers/i2c/busses/i2c-parport.h
@@ -12,10 +12,6 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * ------------------------------------------------------------------------ */ 15 * ------------------------------------------------------------------------ */
20 16
21#define PORT_DATA 0 17#define PORT_DATA 0
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index 7a9dce43e115..df1dbc92a024 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 14 */
19 15
20#include <linux/module.h> 16#include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
index 323f061a3163..e0eb4ca0102e 100644
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 15 */
20 16
21#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index a6f54ba27e2a..67cbec6796a0 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -11,10 +11,6 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/ 14*/
19 15
20/* 16/*
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c
index 8564768fee32..177834e2d841 100644
--- a/drivers/i2c/busses/i2c-pmcmsp.c
+++ b/drivers/i2c/busses/i2c-pmcmsp.c
@@ -18,10 +18,6 @@
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 21 */
26 22
27#include <linux/kernel.h> 23#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 01e967763c2a..60a53c169ed2 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -14,10 +14,6 @@
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21*/ 17*/
22 18
23#include <linux/module.h> 19#include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index e3b0337faeb7..65244774bfa3 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/ 17*/
22 18
23#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 8b5e79cb4468..4855188747c9 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 17 */
22 18
23#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c
index 0fe505d7abe9..2b6219d86b0f 100644
--- a/drivers/i2c/busses/i2c-sibyte.c
+++ b/drivers/i2c/busses/i2c-sibyte.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 15 */
20 16
21#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-simtec.c b/drivers/i2c/busses/i2c-simtec.c
index 964e5c6f84ab..15ac8395dcd3 100644
--- a/drivers/i2c/busses/i2c-simtec.c
+++ b/drivers/i2c/busses/i2c-simtec.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/ 15*/
20 16
21#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index ac9bc33acef4..7d58a40faf2d 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -11,10 +11,6 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/ 14*/
19 15
20/* Note: we assume there can only be one SIS5595 with one SMBus interface */ 16/* Note: we assume there can only be one SIS5595 with one SMBus interface */
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index c6366733008d..1e6805b5cef2 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -10,10 +10,6 @@
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17*/ 13*/
18 14
19/* 15/*
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 8dc2fc5f74ff..44b904426073 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -10,10 +10,6 @@
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17*/ 13*/
18 14
19/* 15/*
diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c
index 10855a0b7e7f..4c7fc2d47014 100644
--- a/drivers/i2c/busses/i2c-taos-evm.c
+++ b/drivers/i2c/busses/i2c-taos-evm.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 16 */
21 17
22#include <linux/delay.h> 18#include <linux/delay.h>
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index f4a1ed757612..59b1d233ca7b 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -12,10 +12,6 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/ 15*/
20 16
21#include <linux/kernel.h> 17#include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 6841200b6e50..0ee2646f3b00 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -13,10 +13,6 @@
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/ 16*/
21 17
22/* 18/*
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index ade9223912d3..cc65ea0b818f 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -12,10 +12,6 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * 15 *
20 * This code was implemented by Mocean Laboratories AB when porting linux 16 * This code was implemented by Mocean Laboratories AB when porting linux
21 * to the automotive development board Russellville. The copyright holder 17 * to the automotive development board Russellville. The copyright holder
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index ff3f5747e43b..5153354b1a6b 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -17,10 +17,6 @@
17 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details. 19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24*/ 20*/
25 21
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c
index f24cc64e2e8c..90e322959303 100644
--- a/drivers/i2c/i2c-boardinfo.c
+++ b/drivers/i2c/i2c-boardinfo.c
@@ -10,11 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA.
18 */ 13 */
19 14
20#include <linux/kernel.h> 15#include <linux/kernel.h>
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 2f90ac6a7f79..f43b4e11647a 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -10,12 +10,7 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details. */
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 MA 02110-1301 USA. */
19/* ------------------------------------------------------------------------- */ 14/* ------------------------------------------------------------------------- */
20 15
21/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>. 16/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>.
@@ -670,6 +665,9 @@ static int i2c_device_remove(struct device *dev)
670 status = driver->remove(client); 665 status = driver->remove(client);
671 } 666 }
672 667
668 if (dev->of_node)
669 irq_dispose_mapping(client->irq);
670
673 dev_pm_domain_detach(&client->dev, true); 671 dev_pm_domain_detach(&client->dev, true);
674 return status; 672 return status;
675} 673}
diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h
index 18a8fd21d2c2..17700bfddcf5 100644
--- a/drivers/i2c/i2c-core.h
+++ b/drivers/i2c/i2c-core.h
@@ -10,11 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA.
18 */ 13 */
19 14
20#include <linux/rwsem.h> 15#include <linux/rwsem.h>
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 80b47e8ce030..71c7a3975b62 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -14,11 +14,6 @@
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 MA 02110-1301 USA.
22*/ 17*/
23 18
24/* Note that this is a complete rewrite of Simon Vogl's i2c-dev module. 19/* Note that this is a complete rewrite of Simon Vogl's i2c-dev module.
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index fc99f0d6b4a5..9ebf9cb4ad7a 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -13,11 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301 USA.
21 */ 16 */
22 17
23#include <linux/kernel.h> 18#include <linux/kernel.h>
diff --git a/drivers/i2c/i2c-stub.c b/drivers/i2c/i2c-stub.c
index d241aa295d96..af2a94e1140b 100644
--- a/drivers/i2c/i2c-stub.c
+++ b/drivers/i2c/i2c-stub.c
@@ -13,10 +13,6 @@
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/ 16*/
21 17
22#define DEBUG 1 18#define DEBUG 1
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 98909a9e284e..a23e58c4ed99 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {
894 894
895static const struct iio_event_spec kxcjk1013_event = { 895static const struct iio_event_spec kxcjk1013_event = {
896 .type = IIO_EV_TYPE_THRESH, 896 .type = IIO_EV_TYPE_THRESH,
897 .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, 897 .dir = IIO_EV_DIR_EITHER,
898 .mask_separate = BIT(IIO_EV_INFO_VALUE) | 898 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
899 BIT(IIO_EV_INFO_ENABLE) | 899 BIT(IIO_EV_INFO_ENABLE) |
900 BIT(IIO_EV_INFO_PERIOD) 900 BIT(IIO_EV_INFO_PERIOD)
diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
index 1665c8e4b62b..e18bc6782256 100644
--- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
+++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
@@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
71 goto st_sensors_free_memory; 71 goto st_sensors_free_memory;
72 } 72 }
73 73
74 for (i = 0; i < n * num_data_channels; i++) { 74 for (i = 0; i < n * byte_for_channel; i++) {
75 if (i < n) 75 if (i < n)
76 buf[i] = rx_array[i]; 76 buf[i] = rx_array[i];
77 else 77 else
diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c
index a15006efa137..0763b8632573 100644
--- a/drivers/iio/light/tsl4531.c
+++ b/drivers/iio/light/tsl4531.c
@@ -230,9 +230,12 @@ static int tsl4531_resume(struct device *dev)
230 return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL, 230 return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL,
231 TSL4531_MODE_NORMAL); 231 TSL4531_MODE_NORMAL);
232} 232}
233#endif
234 233
235static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); 234static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume);
235#define TSL4531_PM_OPS (&tsl4531_pm_ops)
236#else
237#define TSL4531_PM_OPS NULL
238#endif
236 239
237static const struct i2c_device_id tsl4531_id[] = { 240static const struct i2c_device_id tsl4531_id[] = {
238 { "tsl4531", 0 }, 241 { "tsl4531", 0 },
@@ -243,7 +246,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id);
243static struct i2c_driver tsl4531_driver = { 246static struct i2c_driver tsl4531_driver = {
244 .driver = { 247 .driver = {
245 .name = TSL4531_DRV_NAME, 248 .name = TSL4531_DRV_NAME,
246 .pm = &tsl4531_pm_ops, 249 .pm = TSL4531_PM_OPS,
247 .owner = THIS_MODULE, 250 .owner = THIS_MODULE,
248 }, 251 },
249 .probe = tsl4531_probe, 252 .probe = tsl4531_probe,
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index 5e780ef206f3..8349cc0fdf66 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -330,7 +330,7 @@ static int as3935_probe(struct spi_device *spi)
330 return -EINVAL; 330 return -EINVAL;
331 } 331 }
332 332
333 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(st)); 333 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
334 if (!indio_dev) 334 if (!indio_dev)
335 return -ENOMEM; 335 return -ENOMEM;
336 336
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 3e238cd049e6..6a2e168c3ab0 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -43,6 +43,7 @@
43#define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) 43#define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34)
44#define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) 44#define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4)
45#define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF 45#define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF
46#define ARMADA_370_XP_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << cpuid)
46 47
47#define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) 48#define ARMADA_370_XP_CPU_INTACK_OFFS (0x44)
48#define ARMADA_375_PPI_CAUSE (0x10) 49#define ARMADA_375_PPI_CAUSE (0x10)
@@ -406,19 +407,29 @@ static void armada_370_xp_mpic_handle_cascade_irq(unsigned int irq,
406 struct irq_desc *desc) 407 struct irq_desc *desc)
407{ 408{
408 struct irq_chip *chip = irq_get_chip(irq); 409 struct irq_chip *chip = irq_get_chip(irq);
409 unsigned long irqmap, irqn; 410 unsigned long irqmap, irqn, irqsrc, cpuid;
410 unsigned int cascade_irq; 411 unsigned int cascade_irq;
411 412
412 chained_irq_enter(chip, desc); 413 chained_irq_enter(chip, desc);
413 414
414 irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE); 415 irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE);
415 416 cpuid = cpu_logical_map(smp_processor_id());
416 if (irqmap & BIT(0)) {
417 armada_370_xp_handle_msi_irq(NULL, true);
418 irqmap &= ~BIT(0);
419 }
420 417
421 for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) { 418 for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) {
419 irqsrc = readl_relaxed(main_int_base +
420 ARMADA_370_XP_INT_SOURCE_CTL(irqn));
421
422 /* Check if the interrupt is not masked on current CPU.
423 * Test IRQ (0-1) and FIQ (8-9) mask bits.
424 */
425 if (!(irqsrc & ARMADA_370_XP_INT_IRQ_FIQ_MASK(cpuid)))
426 continue;
427
428 if (irqn == 1) {
429 armada_370_xp_handle_msi_irq(NULL, true);
430 continue;
431 }
432
422 cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn); 433 cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn);
423 generic_handle_irq(cascade_irq); 434 generic_handle_irq(cascade_irq);
424 } 435 }
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 825ca1f87639..afe79719ea32 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1434,9 +1434,9 @@ static void drop_buffers(struct dm_bufio_client *c)
1434 1434
1435/* 1435/*
1436 * Test if the buffer is unused and too old, and commit it. 1436 * Test if the buffer is unused and too old, and commit it.
1437 * At if noio is set, we must not do any I/O because we hold 1437 * And if GFP_NOFS is used, we must not do any I/O because we hold
1438 * dm_bufio_clients_lock and we would risk deadlock if the I/O gets rerouted to 1438 * dm_bufio_clients_lock and we would risk deadlock if the I/O gets
1439 * different bufio client. 1439 * rerouted to different bufio client.
1440 */ 1440 */
1441static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, 1441static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp,
1442 unsigned long max_jiffies) 1442 unsigned long max_jiffies)
@@ -1444,7 +1444,7 @@ static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp,
1444 if (jiffies - b->last_accessed < max_jiffies) 1444 if (jiffies - b->last_accessed < max_jiffies)
1445 return 0; 1445 return 0;
1446 1446
1447 if (!(gfp & __GFP_IO)) { 1447 if (!(gfp & __GFP_FS)) {
1448 if (test_bit(B_READING, &b->state) || 1448 if (test_bit(B_READING, &b->state) ||
1449 test_bit(B_WRITING, &b->state) || 1449 test_bit(B_WRITING, &b->state) ||
1450 test_bit(B_DIRTY, &b->state)) 1450 test_bit(B_DIRTY, &b->state))
@@ -1486,7 +1486,7 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1486 unsigned long freed; 1486 unsigned long freed;
1487 1487
1488 c = container_of(shrink, struct dm_bufio_client, shrinker); 1488 c = container_of(shrink, struct dm_bufio_client, shrinker);
1489 if (sc->gfp_mask & __GFP_IO) 1489 if (sc->gfp_mask & __GFP_FS)
1490 dm_bufio_lock(c); 1490 dm_bufio_lock(c);
1491 else if (!dm_bufio_trylock(c)) 1491 else if (!dm_bufio_trylock(c))
1492 return SHRINK_STOP; 1492 return SHRINK_STOP;
@@ -1503,7 +1503,7 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
1503 unsigned long count; 1503 unsigned long count;
1504 1504
1505 c = container_of(shrink, struct dm_bufio_client, shrinker); 1505 c = container_of(shrink, struct dm_bufio_client, shrinker);
1506 if (sc->gfp_mask & __GFP_IO) 1506 if (sc->gfp_mask & __GFP_FS)
1507 dm_bufio_lock(c); 1507 dm_bufio_lock(c);
1508 else if (!dm_bufio_trylock(c)) 1508 else if (!dm_bufio_trylock(c))
1509 return 0; 1509 return 0;
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 4857fa4a5484..07c0fa0fa284 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -789,8 +789,7 @@ struct dm_raid_superblock {
789 __le32 layout; 789 __le32 layout;
790 __le32 stripe_sectors; 790 __le32 stripe_sectors;
791 791
792 __u8 pad[452]; /* Round struct to 512 bytes. */ 792 /* Remainder of a logical block is zero-filled when writing (see super_sync()). */
793 /* Always set to 0 when writing. */
794} __packed; 793} __packed;
795 794
796static int read_disk_sb(struct md_rdev *rdev, int size) 795static int read_disk_sb(struct md_rdev *rdev, int size)
@@ -827,7 +826,7 @@ static void super_sync(struct mddev *mddev, struct md_rdev *rdev)
827 test_bit(Faulty, &(rs->dev[i].rdev.flags))) 826 test_bit(Faulty, &(rs->dev[i].rdev.flags)))
828 failed_devices |= (1ULL << i); 827 failed_devices |= (1ULL << i);
829 828
830 memset(sb, 0, sizeof(*sb)); 829 memset(sb + 1, 0, rdev->sb_size - sizeof(*sb));
831 830
832 sb->magic = cpu_to_le32(DM_RAID_MAGIC); 831 sb->magic = cpu_to_le32(DM_RAID_MAGIC);
833 sb->features = cpu_to_le32(0); /* No features yet */ 832 sb->features = cpu_to_le32(0); /* No features yet */
@@ -862,7 +861,11 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
862 uint64_t events_sb, events_refsb; 861 uint64_t events_sb, events_refsb;
863 862
864 rdev->sb_start = 0; 863 rdev->sb_start = 0;
865 rdev->sb_size = sizeof(*sb); 864 rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev);
865 if (rdev->sb_size < sizeof(*sb) || rdev->sb_size > PAGE_SIZE) {
866 DMERR("superblock size of a logical block is no longer valid");
867 return -EINVAL;
868 }
866 869
867 ret = read_disk_sb(rdev, rdev->sb_size); 870 ret = read_disk_sb(rdev, rdev->sb_size);
868 if (ret) 871 if (ret)
@@ -1169,8 +1172,12 @@ static void configure_discard_support(struct dm_target *ti, struct raid_set *rs)
1169 raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); 1172 raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6);
1170 1173
1171 for (i = 0; i < rs->md.raid_disks; i++) { 1174 for (i = 0; i < rs->md.raid_disks; i++) {
1172 struct request_queue *q = bdev_get_queue(rs->dev[i].rdev.bdev); 1175 struct request_queue *q;
1176
1177 if (!rs->dev[i].rdev.bdev)
1178 continue;
1173 1179
1180 q = bdev_get_queue(rs->dev[i].rdev.bdev);
1174 if (!q || !blk_queue_discard(q)) 1181 if (!q || !blk_queue_discard(q))
1175 return; 1182 return;
1176 1183
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index d1600d2aa2e2..f8b37d4c05d8 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -159,8 +159,10 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
159 sc->stripes_shift = __ffs(stripes); 159 sc->stripes_shift = __ffs(stripes);
160 160
161 r = dm_set_target_max_io_len(ti, chunk_size); 161 r = dm_set_target_max_io_len(ti, chunk_size);
162 if (r) 162 if (r) {
163 kfree(sc);
163 return r; 164 return r;
165 }
164 166
165 ti->num_flush_bios = stripes; 167 ti->num_flush_bios = stripes;
166 ti->num_discard_bios = stripes; 168 ti->num_discard_bios = stripes;
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 4843801173fe..0f86d802b533 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1936,6 +1936,14 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio)
1936 return DM_MAPIO_SUBMITTED; 1936 return DM_MAPIO_SUBMITTED;
1937 } 1937 }
1938 1938
1939 /*
1940 * We must hold the virtual cell before doing the lookup, otherwise
1941 * there's a race with discard.
1942 */
1943 build_virtual_key(tc->td, block, &key);
1944 if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result))
1945 return DM_MAPIO_SUBMITTED;
1946
1939 r = dm_thin_find_block(td, block, 0, &result); 1947 r = dm_thin_find_block(td, block, 0, &result);
1940 1948
1941 /* 1949 /*
@@ -1959,13 +1967,10 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio)
1959 * shared flag will be set in their case. 1967 * shared flag will be set in their case.
1960 */ 1968 */
1961 thin_defer_bio(tc, bio); 1969 thin_defer_bio(tc, bio);
1970 cell_defer_no_holder_no_free(tc, &cell1);
1962 return DM_MAPIO_SUBMITTED; 1971 return DM_MAPIO_SUBMITTED;
1963 } 1972 }
1964 1973
1965 build_virtual_key(tc->td, block, &key);
1966 if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result))
1967 return DM_MAPIO_SUBMITTED;
1968
1969 build_data_key(tc->td, result.block, &key); 1974 build_data_key(tc->td, result.block, &key);
1970 if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { 1975 if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) {
1971 cell_defer_no_holder_no_free(tc, &cell1); 1976 cell_defer_no_holder_no_free(tc, &cell1);
@@ -1986,6 +1991,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio)
1986 * of doing so. 1991 * of doing so.
1987 */ 1992 */
1988 handle_unserviceable_bio(tc->pool, bio); 1993 handle_unserviceable_bio(tc->pool, bio);
1994 cell_defer_no_holder_no_free(tc, &cell1);
1989 return DM_MAPIO_SUBMITTED; 1995 return DM_MAPIO_SUBMITTED;
1990 } 1996 }
1991 /* fall through */ 1997 /* fall through */
@@ -1996,6 +2002,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio)
1996 * provide the hint to load the metadata into cache. 2002 * provide the hint to load the metadata into cache.
1997 */ 2003 */
1998 thin_defer_bio(tc, bio); 2004 thin_defer_bio(tc, bio);
2005 cell_defer_no_holder_no_free(tc, &cell1);
1999 return DM_MAPIO_SUBMITTED; 2006 return DM_MAPIO_SUBMITTED;
2000 2007
2001 default: 2008 default:
@@ -2005,6 +2012,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio)
2005 * pool is switched to fail-io mode. 2012 * pool is switched to fail-io mode.
2006 */ 2013 */
2007 bio_io_error(bio); 2014 bio_io_error(bio);
2015 cell_defer_no_holder_no_free(tc, &cell1);
2008 return DM_MAPIO_SUBMITTED; 2016 return DM_MAPIO_SUBMITTED;
2009 } 2017 }
2010} 2018}
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h
index 37d367bb9aa8..bf2b80d5c470 100644
--- a/drivers/md/persistent-data/dm-btree-internal.h
+++ b/drivers/md/persistent-data/dm-btree-internal.h
@@ -42,6 +42,12 @@ struct btree_node {
42} __packed; 42} __packed;
43 43
44 44
45/*
46 * Locks a block using the btree node validator.
47 */
48int bn_read_lock(struct dm_btree_info *info, dm_block_t b,
49 struct dm_block **result);
50
45void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, 51void inc_children(struct dm_transaction_manager *tm, struct btree_node *n,
46 struct dm_btree_value_type *vt); 52 struct dm_btree_value_type *vt);
47 53
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c
index cf9fd676ae44..1b5e13ec7f96 100644
--- a/drivers/md/persistent-data/dm-btree-spine.c
+++ b/drivers/md/persistent-data/dm-btree-spine.c
@@ -92,7 +92,7 @@ struct dm_block_validator btree_node_validator = {
92 92
93/*----------------------------------------------------------------*/ 93/*----------------------------------------------------------------*/
94 94
95static int bn_read_lock(struct dm_btree_info *info, dm_block_t b, 95int bn_read_lock(struct dm_btree_info *info, dm_block_t b,
96 struct dm_block **result) 96 struct dm_block **result)
97{ 97{
98 return dm_tm_read_lock(info->tm, b, &btree_node_validator, result); 98 return dm_tm_read_lock(info->tm, b, &btree_node_validator, result);
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index 416060c25709..200ac12a1d40 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -847,22 +847,26 @@ EXPORT_SYMBOL_GPL(dm_btree_find_lowest_key);
847 * FIXME: We shouldn't use a recursive algorithm when we have limited stack 847 * FIXME: We shouldn't use a recursive algorithm when we have limited stack
848 * space. Also this only works for single level trees. 848 * space. Also this only works for single level trees.
849 */ 849 */
850static int walk_node(struct ro_spine *s, dm_block_t block, 850static int walk_node(struct dm_btree_info *info, dm_block_t block,
851 int (*fn)(void *context, uint64_t *keys, void *leaf), 851 int (*fn)(void *context, uint64_t *keys, void *leaf),
852 void *context) 852 void *context)
853{ 853{
854 int r; 854 int r;
855 unsigned i, nr; 855 unsigned i, nr;
856 struct dm_block *node;
856 struct btree_node *n; 857 struct btree_node *n;
857 uint64_t keys; 858 uint64_t keys;
858 859
859 r = ro_step(s, block); 860 r = bn_read_lock(info, block, &node);
860 n = ro_node(s); 861 if (r)
862 return r;
863
864 n = dm_block_data(node);
861 865
862 nr = le32_to_cpu(n->header.nr_entries); 866 nr = le32_to_cpu(n->header.nr_entries);
863 for (i = 0; i < nr; i++) { 867 for (i = 0; i < nr; i++) {
864 if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { 868 if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) {
865 r = walk_node(s, value64(n, i), fn, context); 869 r = walk_node(info, value64(n, i), fn, context);
866 if (r) 870 if (r)
867 goto out; 871 goto out;
868 } else { 872 } else {
@@ -874,7 +878,7 @@ static int walk_node(struct ro_spine *s, dm_block_t block,
874 } 878 }
875 879
876out: 880out:
877 ro_pop(s); 881 dm_tm_unlock(info->tm, node);
878 return r; 882 return r;
879} 883}
880 884
@@ -882,15 +886,7 @@ int dm_btree_walk(struct dm_btree_info *info, dm_block_t root,
882 int (*fn)(void *context, uint64_t *keys, void *leaf), 886 int (*fn)(void *context, uint64_t *keys, void *leaf),
883 void *context) 887 void *context)
884{ 888{
885 int r;
886 struct ro_spine spine;
887
888 BUG_ON(info->levels > 1); 889 BUG_ON(info->levels > 1);
889 890 return walk_node(info, root, fn, context);
890 init_ro_spine(&spine, info);
891 r = walk_node(&spine, root, fn, context);
892 exit_ro_spine(&spine);
893
894 return r;
895} 891}
896EXPORT_SYMBOL_GPL(dm_btree_walk); 892EXPORT_SYMBOL_GPL(dm_btree_walk);
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index b8579ee68bd6..2cf30576bf39 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -962,6 +962,11 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
962 case SYS_ATSC: 962 case SYS_ATSC:
963 c->modulation = VSB_8; 963 c->modulation = VSB_8;
964 break; 964 break;
965 case SYS_ISDBS:
966 c->symbol_rate = 28860000;
967 c->rolloff = ROLLOFF_35;
968 c->bandwidth_hz = c->symbol_rate / 100 * 135;
969 break;
965 default: 970 default:
966 c->modulation = QAM_AUTO; 971 c->modulation = QAM_AUTO;
967 break; 972 break;
@@ -2072,6 +2077,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
2072 break; 2077 break;
2073 case SYS_DVBS: 2078 case SYS_DVBS:
2074 case SYS_TURBO: 2079 case SYS_TURBO:
2080 case SYS_ISDBS:
2075 rolloff = 135; 2081 rolloff = 135;
2076 break; 2082 break;
2077 case SYS_DVBS2: 2083 case SYS_DVBS2:
diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c
index 335daeff91b9..9d0d0347758f 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -864,6 +864,13 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config,
864 memcpy(&state->frontend.ops, &ds3000_ops, 864 memcpy(&state->frontend.ops, &ds3000_ops,
865 sizeof(struct dvb_frontend_ops)); 865 sizeof(struct dvb_frontend_ops));
866 state->frontend.demodulator_priv = state; 866 state->frontend.demodulator_priv = state;
867
868 /*
869 * Some devices like T480 starts with voltage on. Be sure
870 * to turn voltage off during init, as this can otherwise
871 * interfere with Unicable SCR systems.
872 */
873 ds3000_set_voltage(&state->frontend, SEC_VOLTAGE_OFF);
867 return &state->frontend; 874 return &state->frontend;
868 875
869error3: 876error3:
diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c
index 9b684d5c8f91..15bf4318cb74 100644
--- a/drivers/media/dvb-frontends/sp2.c
+++ b/drivers/media/dvb-frontends/sp2.c
@@ -266,7 +266,7 @@ int sp2_ci_poll_slot_status(struct dvb_ca_en50221 *en50221,
266 return s->status; 266 return s->status;
267} 267}
268 268
269int sp2_init(struct sp2 *s) 269static int sp2_init(struct sp2 *s)
270{ 270{
271 int ret = 0; 271 int ret = 0;
272 u8 buf; 272 u8 buf;
@@ -348,7 +348,7 @@ err:
348 return ret; 348 return ret;
349} 349}
350 350
351int sp2_exit(struct i2c_client *client) 351static int sp2_exit(struct i2c_client *client)
352{ 352{
353 struct sp2 *s; 353 struct sp2 *s;
354 354
diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c
index d9905fb52f84..b35d65c9cc05 100644
--- a/drivers/media/dvb-frontends/tc90522.c
+++ b/drivers/media/dvb-frontends/tc90522.c
@@ -216,32 +216,30 @@ static int tc90522s_get_frontend(struct dvb_frontend *fe)
216 c->delivery_system = SYS_ISDBS; 216 c->delivery_system = SYS_ISDBS;
217 217
218 layers = 0; 218 layers = 0;
219 ret = reg_read(state, 0xe8, val, 3); 219 ret = reg_read(state, 0xe6, val, 5);
220 if (ret == 0) { 220 if (ret == 0) {
221 int slots;
222 u8 v; 221 u8 v;
223 222
223 c->stream_id = val[0] << 8 | val[1];
224
224 /* high/single layer */ 225 /* high/single layer */
225 v = (val[0] & 0x70) >> 4; 226 v = (val[2] & 0x70) >> 4;
226 c->modulation = (v == 7) ? PSK_8 : QPSK; 227 c->modulation = (v == 7) ? PSK_8 : QPSK;
227 c->fec_inner = fec_conv_sat[v]; 228 c->fec_inner = fec_conv_sat[v];
228 c->layer[0].fec = c->fec_inner; 229 c->layer[0].fec = c->fec_inner;
229 c->layer[0].modulation = c->modulation; 230 c->layer[0].modulation = c->modulation;
230 c->layer[0].segment_count = val[1] & 0x3f; /* slots */ 231 c->layer[0].segment_count = val[3] & 0x3f; /* slots */
231 232
232 /* low layer */ 233 /* low layer */
233 v = (val[0] & 0x07); 234 v = (val[2] & 0x07);
234 c->layer[1].fec = fec_conv_sat[v]; 235 c->layer[1].fec = fec_conv_sat[v];
235 if (v == 0) /* no low layer */ 236 if (v == 0) /* no low layer */
236 c->layer[1].segment_count = 0; 237 c->layer[1].segment_count = 0;
237 else 238 else
238 c->layer[1].segment_count = val[2] & 0x3f; /* slots */ 239 c->layer[1].segment_count = val[4] & 0x3f; /* slots */
239 /* actually, BPSK if v==1, but not defined in fe_modulation_t */ 240 /* actually, BPSK if v==1, but not defined in fe_modulation_t */
240 c->layer[1].modulation = QPSK; 241 c->layer[1].modulation = QPSK;
241 layers = (v > 0) ? 2 : 1; 242 layers = (v > 0) ? 2 : 1;
242
243 slots = c->layer[0].segment_count + c->layer[1].segment_count;
244 c->symbol_rate = 28860000 * slots / 48;
245 } 243 }
246 244
247 /* statistics */ 245 /* statistics */
@@ -363,7 +361,7 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe)
363 u8 v; 361 u8 v;
364 362
365 c->isdbt_partial_reception = val[0] & 0x01; 363 c->isdbt_partial_reception = val[0] & 0x01;
366 c->isdbt_sb_mode = (val[0] & 0xc0) == 0x01; 364 c->isdbt_sb_mode = (val[0] & 0xc0) == 0x40;
367 365
368 /* layer A */ 366 /* layer A */
369 v = (val[2] & 0x78) >> 3; 367 v = (val[2] & 0x78) >> 3;
diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index 2c61a62ab48b..686c3c2ad05b 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -100,11 +100,9 @@ MODULE_PARM_DESC(ccs_out_mode, " output crop/compose/scale mode:\n"
100 "\t\t bit 0=crop, 1=compose, 2=scale,\n" 100 "\t\t bit 0=crop, 1=compose, 2=scale,\n"
101 "\t\t -1=user-controlled (default)"); 101 "\t\t -1=user-controlled (default)");
102 102
103static unsigned multiplanar[VIVID_MAX_DEVS]; 103static unsigned multiplanar[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 1 };
104module_param_array(multiplanar, uint, NULL, 0444); 104module_param_array(multiplanar, uint, NULL, 0444);
105MODULE_PARM_DESC(multiplanar, " 0 (default) is alternating single and multiplanar devices,\n" 105MODULE_PARM_DESC(multiplanar, " 1 (default) creates a single planar device, 2 creates a multiplanar device.");
106 "\t\t 1 is single planar devices,\n"
107 "\t\t 2 is multiplanar devices");
108 106
109/* Default: video + vbi-cap (raw and sliced) + radio rx + radio tx + sdr + vbi-out + vid-out */ 107/* Default: video + vbi-cap (raw and sliced) + radio rx + radio tx + sdr + vbi-out + vid-out */
110static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x1d3d }; 108static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x1d3d };
@@ -669,10 +667,7 @@ static int __init vivid_create_instance(int inst)
669 /* start detecting feature set */ 667 /* start detecting feature set */
670 668
671 /* do we use single- or multi-planar? */ 669 /* do we use single- or multi-planar? */
672 if (multiplanar[inst] == 0) 670 dev->multiplanar = multiplanar[inst] > 1;
673 dev->multiplanar = inst & 1;
674 else
675 dev->multiplanar = multiplanar[inst] > 1;
676 v4l2_info(&dev->v4l2_dev, "using %splanar format API\n", 671 v4l2_info(&dev->v4l2_dev, "using %splanar format API\n",
677 dev->multiplanar ? "multi" : "single "); 672 dev->multiplanar ? "multi" : "single ");
678 673
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index b8837dd39bb2..65f80b8b9f7a 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1678,7 +1678,8 @@ static void imon_incoming_packet(struct imon_context *ictx,
1678 if (press_type == 0) 1678 if (press_type == 0)
1679 rc_keyup(ictx->rdev); 1679 rc_keyup(ictx->rdev);
1680 else { 1680 else {
1681 if (ictx->rc_type == RC_BIT_RC6_MCE) 1681 if (ictx->rc_type == RC_BIT_RC6_MCE ||
1682 ictx->rc_type == RC_BIT_OTHER)
1682 rc_keydown(ictx->rdev, 1683 rc_keydown(ictx->rdev,
1683 ictx->rc_type == RC_BIT_RC6_MCE ? RC_TYPE_RC6_MCE : RC_TYPE_OTHER, 1684 ictx->rc_type == RC_BIT_RC6_MCE ? RC_TYPE_RC6_MCE : RC_TYPE_OTHER,
1684 ictx->rc_scancode, ictx->rc_toggle); 1685 ictx->rc_scancode, ictx->rc_toggle);
diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c
index 08bbd4f508cd..b0df62961c14 100644
--- a/drivers/media/rc/ir-hix5hd2.c
+++ b/drivers/media/rc/ir-hix5hd2.c
@@ -297,7 +297,7 @@ static int hix5hd2_ir_remove(struct platform_device *pdev)
297 return 0; 297 return 0;
298} 298}
299 299
300#ifdef CONFIG_PM 300#ifdef CONFIG_PM_SLEEP
301static int hix5hd2_ir_suspend(struct device *dev) 301static int hix5hd2_ir_suspend(struct device *dev)
302{ 302{
303 struct hix5hd2_ir_priv *priv = dev_get_drvdata(dev); 303 struct hix5hd2_ir_priv *priv = dev_get_drvdata(dev);
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c
index 2ef763928ca4..84fa6e9b59a1 100644
--- a/drivers/media/rc/ir-rc5-decoder.c
+++ b/drivers/media/rc/ir-rc5-decoder.c
@@ -53,7 +53,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
53 u32 scancode; 53 u32 scancode;
54 enum rc_type protocol; 54 enum rc_type protocol;
55 55
56 if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X))) 56 if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ)))
57 return 0; 57 return 0;
58 58
59 if (!is_timing_event(ev)) { 59 if (!is_timing_event(ev)) {
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index e8fff2add265..b732ac6a26d8 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -262,7 +262,6 @@ int ir_raw_event_register(struct rc_dev *dev)
262 return -ENOMEM; 262 return -ENOMEM;
263 263
264 dev->raw->dev = dev; 264 dev->raw->dev = dev;
265 dev->enabled_protocols = ~0;
266 dev->change_protocol = change_protocol; 265 dev->change_protocol = change_protocol;
267 rc = kfifo_alloc(&dev->raw->kfifo, 266 rc = kfifo_alloc(&dev->raw->kfifo,
268 sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE, 267 sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE,
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index a7991c7d010a..8d3b74c5a717 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1421,6 +1421,8 @@ int rc_register_device(struct rc_dev *dev)
1421 1421
1422 if (dev->change_protocol) { 1422 if (dev->change_protocol) {
1423 u64 rc_type = (1 << rc_map->rc_type); 1423 u64 rc_type = (1 << rc_map->rc_type);
1424 if (dev->driver_type == RC_DRIVER_IR_RAW)
1425 rc_type |= RC_BIT_LIRC;
1424 rc = dev->change_protocol(dev, &rc_type); 1426 rc = dev->change_protocol(dev, &rc_type);
1425 if (rc < 0) 1427 if (rc < 0)
1426 goto out_raw; 1428 goto out_raw;
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index cf008f45968c..711773e8e64b 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -240,7 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
240 goto err_irq_charger; 240 goto err_irq_charger;
241 } 241 }
242 242
243 ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, 243 ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq,
244 IRQF_ONESHOT | IRQF_SHARED | 244 IRQF_ONESHOT | IRQF_SHARED |
245 IRQF_TRIGGER_FALLING, 0, 245 IRQF_TRIGGER_FALLING, 0,
246 &max77693_muic_irq_chip, 246 &max77693_muic_irq_chip,
@@ -250,6 +250,17 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
250 goto err_irq_muic; 250 goto err_irq_muic;
251 } 251 }
252 252
253 /* Unmask interrupts from all blocks in interrupt source register */
254 ret = regmap_update_bits(max77693->regmap,
255 MAX77693_PMIC_REG_INTSRC_MASK,
256 SRC_IRQ_ALL, (unsigned int)~SRC_IRQ_ALL);
257 if (ret < 0) {
258 dev_err(max77693->dev,
259 "Could not unmask interrupts in INTSRC: %d\n",
260 ret);
261 goto err_intsrc;
262 }
263
253 pm_runtime_set_active(max77693->dev); 264 pm_runtime_set_active(max77693->dev);
254 265
255 ret = mfd_add_devices(max77693->dev, -1, max77693_devs, 266 ret = mfd_add_devices(max77693->dev, -1, max77693_devs,
@@ -261,6 +272,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
261 272
262err_mfd: 273err_mfd:
263 mfd_remove_devices(max77693->dev); 274 mfd_remove_devices(max77693->dev);
275err_intsrc:
264 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); 276 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
265err_irq_muic: 277err_irq_muic:
266 regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); 278 regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index f2643c221d34..30f7ca89a0e6 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -947,6 +947,7 @@ static void rtsx_pci_idle_work(struct work_struct *work)
947 mutex_unlock(&pcr->pcr_mutex); 947 mutex_unlock(&pcr->pcr_mutex);
948} 948}
949 949
950#ifdef CONFIG_PM
950static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) 951static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state)
951{ 952{
952 if (pcr->ops->turn_off_led) 953 if (pcr->ops->turn_off_led)
@@ -961,6 +962,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state)
961 if (pcr->ops->force_power_down) 962 if (pcr->ops->force_power_down)
962 pcr->ops->force_power_down(pcr, pm_state); 963 pcr->ops->force_power_down(pcr, pm_state);
963} 964}
965#endif
964 966
965static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) 967static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
966{ 968{
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
index 2d045f26f193..bee0abf82040 100644
--- a/drivers/mfd/stmpe.h
+++ b/drivers/mfd/stmpe.h
@@ -269,7 +269,7 @@ int stmpe_remove(struct stmpe *stmpe);
269#define STMPE24XX_REG_CHIP_ID 0x80 269#define STMPE24XX_REG_CHIP_ID 0x80
270#define STMPE24XX_REG_IEGPIOR_LSB 0x18 270#define STMPE24XX_REG_IEGPIOR_LSB 0x18
271#define STMPE24XX_REG_ISGPIOR_MSB 0x19 271#define STMPE24XX_REG_ISGPIOR_MSB 0x19
272#define STMPE24XX_REG_GPMR_LSB 0xA5 272#define STMPE24XX_REG_GPMR_LSB 0xA4
273#define STMPE24XX_REG_GPSR_LSB 0x85 273#define STMPE24XX_REG_GPSR_LSB 0x85
274#define STMPE24XX_REG_GPCR_LSB 0x88 274#define STMPE24XX_REG_GPCR_LSB 0x88
275#define STMPE24XX_REG_GPDR_LSB 0x8B 275#define STMPE24XX_REG_GPDR_LSB 0x8B
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index cf92a6d1c532..50f9091bcd38 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -44,6 +44,15 @@ static u8 twl4030_start_script_address = 0x2b;
44#define PWR_DEVSLP BIT(1) 44#define PWR_DEVSLP BIT(1)
45#define PWR_DEVOFF BIT(0) 45#define PWR_DEVOFF BIT(0)
46 46
47/* Register bits for CFG_P1_TRANSITION (also for P2 and P3) */
48#define STARTON_SWBUG BIT(7) /* Start on watchdog */
49#define STARTON_VBUS BIT(5) /* Start on VBUS */
50#define STARTON_VBAT BIT(4) /* Start on battery insert */
51#define STARTON_RTC BIT(3) /* Start on RTC */
52#define STARTON_USB BIT(2) /* Start on USB host */
53#define STARTON_CHG BIT(1) /* Start on charger */
54#define STARTON_PWON BIT(0) /* Start on PWRON button */
55
47#define SEQ_OFFSYNC (1 << 0) 56#define SEQ_OFFSYNC (1 << 0)
48 57
49#define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) 58#define PHY_TO_OFF_PM_MASTER(p) (p - 0x36)
@@ -606,6 +615,44 @@ twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
606 return 0; 615 return 0;
607} 616}
608 617
618static int twl4030_starton_mask_and_set(u8 bitmask, u8 bitvalues)
619{
620 u8 regs[3] = { TWL4030_PM_MASTER_CFG_P1_TRANSITION,
621 TWL4030_PM_MASTER_CFG_P2_TRANSITION,
622 TWL4030_PM_MASTER_CFG_P3_TRANSITION, };
623 u8 val;
624 int i, err;
625
626 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
627 TWL4030_PM_MASTER_PROTECT_KEY);
628 if (err)
629 goto relock;
630 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
631 TWL4030_PM_MASTER_KEY_CFG2,
632 TWL4030_PM_MASTER_PROTECT_KEY);
633 if (err)
634 goto relock;
635
636 for (i = 0; i < sizeof(regs); i++) {
637 err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER,
638 &val, regs[i]);
639 if (err)
640 break;
641 val = (~bitmask & val) | (bitmask & bitvalues);
642 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
643 val, regs[i]);
644 if (err)
645 break;
646 }
647
648 if (err)
649 pr_err("TWL4030 Register access failed: %i\n", err);
650
651relock:
652 return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0,
653 TWL4030_PM_MASTER_PROTECT_KEY);
654}
655
609/* 656/*
610 * In master mode, start the power off sequence. 657 * In master mode, start the power off sequence.
611 * After a successful execution, TWL shuts down the power to the SoC 658 * After a successful execution, TWL shuts down the power to the SoC
@@ -615,6 +662,11 @@ void twl4030_power_off(void)
615{ 662{
616 int err; 663 int err;
617 664
665 /* Disable start on charger or VBUS as it can break poweroff */
666 err = twl4030_starton_mask_and_set(STARTON_VBUS | STARTON_CHG, 0);
667 if (err)
668 pr_err("TWL4030 Unable to configure start-up\n");
669
618 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, 670 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF,
619 TWL4030_PM_MASTER_P1_SW_EVENTS); 671 TWL4030_PM_MASTER_P1_SW_EVENTS);
620 if (err) 672 if (err)
diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c
index e00f5340ed87..3c2b8f9e3c84 100644
--- a/drivers/mfd/viperboard.c
+++ b/drivers/mfd/viperboard.c
@@ -93,8 +93,9 @@ static int vprbrd_probe(struct usb_interface *interface,
93 version >> 8, version & 0xff, 93 version >> 8, version & 0xff,
94 vb->usb_dev->bus->busnum, vb->usb_dev->devnum); 94 vb->usb_dev->bus->busnum, vb->usb_dev->devnum);
95 95
96 ret = mfd_add_devices(&interface->dev, -1, vprbrd_devs, 96 ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO,
97 ARRAY_SIZE(vprbrd_devs), NULL, 0, NULL); 97 vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0,
98 NULL);
98 if (ret != 0) { 99 if (ret != 0) {
99 dev_err(&interface->dev, "Failed to add mfd devices to core."); 100 dev_err(&interface->dev, "Failed to add mfd devices to core.");
100 goto error; 101 goto error;
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 03c53b72a2d6..270d58a4c43d 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -311,7 +311,8 @@ int mmc_of_parse(struct mmc_host *host)
311 struct device_node *np; 311 struct device_node *np;
312 u32 bus_width; 312 u32 bus_width;
313 int len, ret; 313 int len, ret;
314 bool cap_invert, gpio_invert; 314 bool cd_cap_invert, cd_gpio_invert = false;
315 bool ro_cap_invert, ro_gpio_invert = false;
315 316
316 if (!host->parent || !host->parent->of_node) 317 if (!host->parent || !host->parent->of_node)
317 return 0; 318 return 0;
@@ -359,16 +360,13 @@ int mmc_of_parse(struct mmc_host *host)
359 if (of_find_property(np, "non-removable", &len)) { 360 if (of_find_property(np, "non-removable", &len)) {
360 host->caps |= MMC_CAP_NONREMOVABLE; 361 host->caps |= MMC_CAP_NONREMOVABLE;
361 } else { 362 } else {
362 if (of_property_read_bool(np, "cd-inverted")) 363 cd_cap_invert = of_property_read_bool(np, "cd-inverted");
363 cap_invert = true;
364 else
365 cap_invert = false;
366 364
367 if (of_find_property(np, "broken-cd", &len)) 365 if (of_find_property(np, "broken-cd", &len))
368 host->caps |= MMC_CAP_NEEDS_POLL; 366 host->caps |= MMC_CAP_NEEDS_POLL;
369 367
370 ret = mmc_gpiod_request_cd(host, "cd", 0, true, 368 ret = mmc_gpiod_request_cd(host, "cd", 0, true,
371 0, &gpio_invert); 369 0, &cd_gpio_invert);
372 if (ret) { 370 if (ret) {
373 if (ret == -EPROBE_DEFER) 371 if (ret == -EPROBE_DEFER)
374 return ret; 372 return ret;
@@ -391,17 +389,14 @@ int mmc_of_parse(struct mmc_host *host)
391 * both inverted, the end result is that the CD line is 389 * both inverted, the end result is that the CD line is
392 * not inverted. 390 * not inverted.
393 */ 391 */
394 if (cap_invert ^ gpio_invert) 392 if (cd_cap_invert ^ cd_gpio_invert)
395 host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; 393 host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
396 } 394 }
397 395
398 /* Parse Write Protection */ 396 /* Parse Write Protection */
399 if (of_property_read_bool(np, "wp-inverted")) 397 ro_cap_invert = of_property_read_bool(np, "wp-inverted");
400 cap_invert = true;
401 else
402 cap_invert = false;
403 398
404 ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &gpio_invert); 399 ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert);
405 if (ret) { 400 if (ret) {
406 if (ret == -EPROBE_DEFER) 401 if (ret == -EPROBE_DEFER)
407 goto out; 402 goto out;
@@ -414,7 +409,7 @@ int mmc_of_parse(struct mmc_host *host)
414 dev_info(host->parent, "Got WP GPIO\n"); 409 dev_info(host->parent, "Got WP GPIO\n");
415 410
416 /* See the comment on CD inversion above */ 411 /* See the comment on CD inversion above */
417 if (cap_invert ^ gpio_invert) 412 if (ro_cap_invert ^ ro_gpio_invert)
418 host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; 413 host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
419 414
420 if (of_find_property(np, "cap-sd-highspeed", &len)) 415 if (of_find_property(np, "cap-sd-highspeed", &len))
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index a7543ba3e190..3096f3ded3ad 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -2590,6 +2590,8 @@ static void cfi_intelext_resume(struct mtd_info *mtd)
2590 2590
2591 /* Go to known state. Chip may have been power cycled */ 2591 /* Go to known state. Chip may have been power cycled */
2592 if (chip->state == FL_PM_SUSPENDED) { 2592 if (chip->state == FL_PM_SUSPENDED) {
2593 /* Refresh LH28F640BF Partition Config. Register */
2594 fixup_LH28F640BF(mtd);
2593 map_write(map, CMD(0xFF), cfi->chips[i].start); 2595 map_write(map, CMD(0xFF), cfi->chips[i].start);
2594 chip->oldstate = chip->state = FL_READY; 2596 chip->oldstate = chip->state = FL_READY;
2595 wake_up(&chip->wq); 2597 wake_up(&chip->wq);
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index dcda6287228d..ed827cf894e4 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -193,10 +193,10 @@ static int m25p_probe(struct spi_device *spi)
193{ 193{
194 struct mtd_part_parser_data ppdata; 194 struct mtd_part_parser_data ppdata;
195 struct flash_platform_data *data; 195 struct flash_platform_data *data;
196 const struct spi_device_id *id = NULL;
197 struct m25p *flash; 196 struct m25p *flash;
198 struct spi_nor *nor; 197 struct spi_nor *nor;
199 enum read_mode mode = SPI_NOR_NORMAL; 198 enum read_mode mode = SPI_NOR_NORMAL;
199 char *flash_name = NULL;
200 int ret; 200 int ret;
201 201
202 data = dev_get_platdata(&spi->dev); 202 data = dev_get_platdata(&spi->dev);
@@ -236,13 +236,11 @@ static int m25p_probe(struct spi_device *spi)
236 * If that's the case, respect "type" and ignore a "name". 236 * If that's the case, respect "type" and ignore a "name".
237 */ 237 */
238 if (data && data->type) 238 if (data && data->type)
239 id = spi_nor_match_id(data->type); 239 flash_name = data->type;
240 else
241 flash_name = spi->modalias;
240 242
241 /* If we didn't get name from platform, simply use "modalias". */ 243 ret = spi_nor_scan(nor, flash_name, mode);
242 if (!id)
243 id = spi_get_device_id(spi);
244
245 ret = spi_nor_scan(nor, id, mode);
246 if (ret) 244 if (ret)
247 return ret; 245 return ret;
248 246
@@ -263,12 +261,62 @@ static int m25p_remove(struct spi_device *spi)
263} 261}
264 262
265 263
264/*
265 * XXX This needs to be kept in sync with spi_nor_ids. We can't share
266 * it with spi-nor, because if this is built as a module then modpost
267 * won't be able to read it and add appropriate aliases.
268 */
269static const struct spi_device_id m25p_ids[] = {
270 {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"},
271 {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"},
272 {"at26df321"}, {"at45db081d"},
273 {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"},
274 {"en25q64"}, {"en25qh128"}, {"en25qh256"},
275 {"f25l32pa"},
276 {"mr25h256"}, {"mr25h10"},
277 {"gd25q32"}, {"gd25q64"},
278 {"160s33b"}, {"320s33b"}, {"640s33b"},
279 {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"},
280 {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"},
281 {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"},
282 {"mx66l1g55g"},
283 {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"},
284 {"n25q512a"}, {"n25q512ax3"}, {"n25q00"},
285 {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"},
286 {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"},
287 {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"},
288 {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"},
289 {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"},
290 {"s25fl016k"}, {"s25fl064k"},
291 {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"},
292 {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"},
293 {"sst25wf040"},
294 {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"},
295 {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"},
296 {"m25p128"}, {"n25q032"},
297 {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"},
298 {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"},
299 {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"},
300 {"m45pe10"}, {"m45pe80"}, {"m45pe16"},
301 {"m25pe20"}, {"m25pe80"}, {"m25pe16"},
302 {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"},
303 {"m25px64"},
304 {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"},
305 {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"},
306 {"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"},
307 {"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"},
308 {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"},
309 { },
310};
311MODULE_DEVICE_TABLE(spi, m25p_ids);
312
313
266static struct spi_driver m25p80_driver = { 314static struct spi_driver m25p80_driver = {
267 .driver = { 315 .driver = {
268 .name = "m25p80", 316 .name = "m25p80",
269 .owner = THIS_MODULE, 317 .owner = THIS_MODULE,
270 }, 318 },
271 .id_table = spi_nor_ids, 319 .id_table = m25p_ids,
272 .probe = m25p_probe, 320 .probe = m25p_probe,
273 .remove = m25p_remove, 321 .remove = m25p_remove,
274 322
diff --git a/drivers/mtd/nand/omap_elm.c b/drivers/mtd/nand/omap_elm.c
index b4f61c7fc161..058531044ceb 100644
--- a/drivers/mtd/nand/omap_elm.c
+++ b/drivers/mtd/nand/omap_elm.c
@@ -115,7 +115,7 @@ int elm_config(struct device *dev, enum bch_ecc bch_type,
115 115
116 if (!info) { 116 if (!info) {
117 dev_err(dev, "Unable to configure elm - device not probed?\n"); 117 dev_err(dev, "Unable to configure elm - device not probed?\n");
118 return -ENODEV; 118 return -EPROBE_DEFER;
119 } 119 }
120 /* ELM cannot detect ECC errors for chunks > 1KB */ 120 /* ELM cannot detect ECC errors for chunks > 1KB */
121 if (ecc_step_size > ((ELM_ECC_SIZE + 1) / 2)) { 121 if (ecc_step_size > ((ELM_ECC_SIZE + 1) / 2)) {
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 8d659a2888d5..d5269a26c839 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -881,7 +881,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
881 881
882 /* iterate the subnodes. */ 882 /* iterate the subnodes. */
883 for_each_available_child_of_node(dev->of_node, np) { 883 for_each_available_child_of_node(dev->of_node, np) {
884 const struct spi_device_id *id;
885 char modalias[40]; 884 char modalias[40];
886 885
887 /* skip the holes */ 886 /* skip the holes */
@@ -909,10 +908,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
909 if (of_modalias_node(np, modalias, sizeof(modalias)) < 0) 908 if (of_modalias_node(np, modalias, sizeof(modalias)) < 0)
910 goto map_failed; 909 goto map_failed;
911 910
912 id = spi_nor_match_id(modalias);
913 if (!id)
914 goto map_failed;
915
916 ret = of_property_read_u32(np, "spi-max-frequency", 911 ret = of_property_read_u32(np, "spi-max-frequency",
917 &q->clk_rate); 912 &q->clk_rate);
918 if (ret < 0) 913 if (ret < 0)
@@ -921,7 +916,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
921 /* set the chip address for READID */ 916 /* set the chip address for READID */
922 fsl_qspi_set_base_addr(q, nor); 917 fsl_qspi_set_base_addr(q, nor);
923 918
924 ret = spi_nor_scan(nor, id, SPI_NOR_QUAD); 919 ret = spi_nor_scan(nor, modalias, SPI_NOR_QUAD);
925 if (ret) 920 if (ret)
926 goto map_failed; 921 goto map_failed;
927 922
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index ae16aa2f6885..c51ee52386a7 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -28,6 +28,8 @@
28 28
29#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) 29#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
30 30
31static const struct spi_device_id *spi_nor_match_id(const char *name);
32
31/* 33/*
32 * Read the status register, returning its value in the location 34 * Read the status register, returning its value in the location
33 * Return the status register value. 35 * Return the status register value.
@@ -473,7 +475,7 @@ struct flash_info {
473 * more nor chips. This current list focusses on newer chips, which 475 * more nor chips. This current list focusses on newer chips, which
474 * have been converging on command sets which including JEDEC ID. 476 * have been converging on command sets which including JEDEC ID.
475 */ 477 */
476const struct spi_device_id spi_nor_ids[] = { 478static const struct spi_device_id spi_nor_ids[] = {
477 /* Atmel -- some are (confusingly) marketed as "DataFlash" */ 479 /* Atmel -- some are (confusingly) marketed as "DataFlash" */
478 { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, 480 { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
479 { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, 481 { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
@@ -637,7 +639,6 @@ const struct spi_device_id spi_nor_ids[] = {
637 { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, 639 { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
638 { }, 640 { },
639}; 641};
640EXPORT_SYMBOL_GPL(spi_nor_ids);
641 642
642static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) 643static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
643{ 644{
@@ -911,9 +912,9 @@ static int spi_nor_check(struct spi_nor *nor)
911 return 0; 912 return 0;
912} 913}
913 914
914int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, 915int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
915 enum read_mode mode)
916{ 916{
917 const struct spi_device_id *id = NULL;
917 struct flash_info *info; 918 struct flash_info *info;
918 struct device *dev = nor->dev; 919 struct device *dev = nor->dev;
919 struct mtd_info *mtd = nor->mtd; 920 struct mtd_info *mtd = nor->mtd;
@@ -925,6 +926,10 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
925 if (ret) 926 if (ret)
926 return ret; 927 return ret;
927 928
929 id = spi_nor_match_id(name);
930 if (!id)
931 return -ENOENT;
932
928 info = (void *)id->driver_data; 933 info = (void *)id->driver_data;
929 934
930 if (info->jedec_id) { 935 if (info->jedec_id) {
@@ -1113,7 +1118,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
1113} 1118}
1114EXPORT_SYMBOL_GPL(spi_nor_scan); 1119EXPORT_SYMBOL_GPL(spi_nor_scan);
1115 1120
1116const struct spi_device_id *spi_nor_match_id(char *name) 1121static const struct spi_device_id *spi_nor_match_id(const char *name)
1117{ 1122{
1118 const struct spi_device_id *id = spi_nor_ids; 1123 const struct spi_device_id *id = spi_nor_ids;
1119 1124
@@ -1124,7 +1129,6 @@ const struct spi_device_id *spi_nor_match_id(char *name)
1124 } 1129 }
1125 return NULL; 1130 return NULL;
1126} 1131}
1127EXPORT_SYMBOL_GPL(spi_nor_match_id);
1128 1132
1129MODULE_LICENSE("GPL"); 1133MODULE_LICENSE("GPL");
1130MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>"); 1134MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>");
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index fdc9ec09e453..da1a2500c91c 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2140,6 +2140,12 @@ static int bcmgenet_open(struct net_device *dev)
2140 goto err_irq0; 2140 goto err_irq0;
2141 } 2141 }
2142 2142
2143 /* Re-configure the port multiplexer towards the PHY device */
2144 bcmgenet_mii_config(priv->dev, false);
2145
2146 phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup,
2147 priv->phy_interface);
2148
2143 bcmgenet_netif_start(dev); 2149 bcmgenet_netif_start(dev);
2144 2150
2145 return 0; 2151 return 0;
@@ -2184,6 +2190,9 @@ static int bcmgenet_close(struct net_device *dev)
2184 2190
2185 bcmgenet_netif_stop(dev); 2191 bcmgenet_netif_stop(dev);
2186 2192
2193 /* Really kill the PHY state machine and disconnect from it */
2194 phy_disconnect(priv->phydev);
2195
2187 /* Disable MAC receive */ 2196 /* Disable MAC receive */
2188 umac_enable_set(priv, CMD_RX_EN, false); 2197 umac_enable_set(priv, CMD_RX_EN, false);
2189 2198
@@ -2685,7 +2694,7 @@ static int bcmgenet_resume(struct device *d)
2685 2694
2686 phy_init_hw(priv->phydev); 2695 phy_init_hw(priv->phydev);
2687 /* Speed settings must be restored */ 2696 /* Speed settings must be restored */
2688 bcmgenet_mii_config(priv->dev); 2697 bcmgenet_mii_config(priv->dev, false);
2689 2698
2690 /* disable ethernet MAC while updating its registers */ 2699 /* disable ethernet MAC while updating its registers */
2691 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); 2700 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index dbf524ea3b19..31b2da5f9b82 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -617,9 +617,10 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF);
617 617
618/* MDIO routines */ 618/* MDIO routines */
619int bcmgenet_mii_init(struct net_device *dev); 619int bcmgenet_mii_init(struct net_device *dev);
620int bcmgenet_mii_config(struct net_device *dev); 620int bcmgenet_mii_config(struct net_device *dev, bool init);
621void bcmgenet_mii_exit(struct net_device *dev); 621void bcmgenet_mii_exit(struct net_device *dev);
622void bcmgenet_mii_reset(struct net_device *dev); 622void bcmgenet_mii_reset(struct net_device *dev);
623void bcmgenet_mii_setup(struct net_device *dev);
623 624
624/* Wake-on-LAN routines */ 625/* Wake-on-LAN routines */
625void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol); 626void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol);
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 9ff799a9f801..933cd7e7cd33 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -77,7 +77,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id,
77/* setup netdev link state when PHY link status change and 77/* setup netdev link state when PHY link status change and
78 * update UMAC and RGMII block when link up 78 * update UMAC and RGMII block when link up
79 */ 79 */
80static void bcmgenet_mii_setup(struct net_device *dev) 80void bcmgenet_mii_setup(struct net_device *dev)
81{ 81{
82 struct bcmgenet_priv *priv = netdev_priv(dev); 82 struct bcmgenet_priv *priv = netdev_priv(dev);
83 struct phy_device *phydev = priv->phydev; 83 struct phy_device *phydev = priv->phydev;
@@ -211,7 +211,7 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
211 bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL); 211 bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL);
212} 212}
213 213
214int bcmgenet_mii_config(struct net_device *dev) 214int bcmgenet_mii_config(struct net_device *dev, bool init)
215{ 215{
216 struct bcmgenet_priv *priv = netdev_priv(dev); 216 struct bcmgenet_priv *priv = netdev_priv(dev);
217 struct phy_device *phydev = priv->phydev; 217 struct phy_device *phydev = priv->phydev;
@@ -298,7 +298,8 @@ int bcmgenet_mii_config(struct net_device *dev)
298 return -EINVAL; 298 return -EINVAL;
299 } 299 }
300 300
301 dev_info(kdev, "configuring instance for %s\n", phy_name); 301 if (init)
302 dev_info(kdev, "configuring instance for %s\n", phy_name);
302 303
303 return 0; 304 return 0;
304} 305}
@@ -350,7 +351,7 @@ static int bcmgenet_mii_probe(struct net_device *dev)
350 * PHY speed which is needed for bcmgenet_mii_config() to configure 351 * PHY speed which is needed for bcmgenet_mii_config() to configure
351 * things appropriately. 352 * things appropriately.
352 */ 353 */
353 ret = bcmgenet_mii_config(dev); 354 ret = bcmgenet_mii_config(dev, true);
354 if (ret) { 355 if (ret) {
355 phy_disconnect(priv->phydev); 356 phy_disconnect(priv->phydev);
356 return ret; 357 return ret;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
index 6fe300e316c3..cca604994003 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
@@ -79,8 +79,9 @@ static void cxgb4_dcb_cleanup_apps(struct net_device *dev)
79 app.protocol = dcb->app_priority[i].protocolid; 79 app.protocol = dcb->app_priority[i].protocolid;
80 80
81 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { 81 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) {
82 app.priority = dcb->app_priority[i].user_prio_map;
82 app.selector = dcb->app_priority[i].sel_field + 1; 83 app.selector = dcb->app_priority[i].sel_field + 1;
83 err = dcb_ieee_setapp(dev, &app); 84 err = dcb_ieee_delapp(dev, &app);
84 } else { 85 } else {
85 app.selector = !!(dcb->app_priority[i].sel_field); 86 app.selector = !!(dcb->app_priority[i].sel_field);
86 err = dcb_setapp(dev, &app); 87 err = dcb_setapp(dev, &app);
@@ -122,7 +123,11 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,
122 case CXGB4_DCB_INPUT_FW_ENABLED: { 123 case CXGB4_DCB_INPUT_FW_ENABLED: {
123 /* we're going to use Firmware DCB */ 124 /* we're going to use Firmware DCB */
124 dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; 125 dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE;
125 dcb->supported = CXGB4_DCBX_FW_SUPPORT; 126 dcb->supported = DCB_CAP_DCBX_LLD_MANAGED;
127 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE)
128 dcb->supported |= DCB_CAP_DCBX_VER_IEEE;
129 else
130 dcb->supported |= DCB_CAP_DCBX_VER_CEE;
126 break; 131 break;
127 } 132 }
128 133
@@ -436,14 +441,17 @@ static void cxgb4_getpgtccfg(struct net_device *dev, int tc,
436 *up_tc_map = (1 << tc); 441 *up_tc_map = (1 << tc);
437 442
438 /* prio_type is link strict */ 443 /* prio_type is link strict */
439 *prio_type = 0x2; 444 if (*pgid != 0xF)
445 *prio_type = 0x2;
440} 446}
441 447
442static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc, 448static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc,
443 u8 *prio_type, u8 *pgid, u8 *bw_per, 449 u8 *prio_type, u8 *pgid, u8 *bw_per,
444 u8 *up_tc_map) 450 u8 *up_tc_map)
445{ 451{
446 return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 1); 452 /* tc 0 is written at MSB position */
453 return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per,
454 up_tc_map, 1);
447} 455}
448 456
449 457
@@ -451,7 +459,9 @@ static void cxgb4_getpgtccfg_rx(struct net_device *dev, int tc,
451 u8 *prio_type, u8 *pgid, u8 *bw_per, 459 u8 *prio_type, u8 *pgid, u8 *bw_per,
452 u8 *up_tc_map) 460 u8 *up_tc_map)
453{ 461{
454 return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 0); 462 /* tc 0 is written at MSB position */
463 return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per,
464 up_tc_map, 0);
455} 465}
456 466
457static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, 467static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
@@ -461,6 +471,7 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
461 struct fw_port_cmd pcmd; 471 struct fw_port_cmd pcmd;
462 struct port_info *pi = netdev2pinfo(dev); 472 struct port_info *pi = netdev2pinfo(dev);
463 struct adapter *adap = pi->adapter; 473 struct adapter *adap = pi->adapter;
474 int fw_tc = 7 - tc;
464 u32 _pgid; 475 u32 _pgid;
465 int err; 476 int err;
466 477
@@ -479,8 +490,8 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
479 } 490 }
480 491
481 _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); 492 _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid);
482 _pgid &= ~(0xF << (tc * 4)); 493 _pgid &= ~(0xF << (fw_tc * 4));
483 _pgid |= pgid << (tc * 4); 494 _pgid |= pgid << (fw_tc * 4);
484 pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid); 495 pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid);
485 496
486 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); 497 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id);
@@ -593,7 +604,7 @@ static void cxgb4_getpfccfg(struct net_device *dev, int priority, u8 *pfccfg)
593 priority >= CXGB4_MAX_PRIORITY) 604 priority >= CXGB4_MAX_PRIORITY)
594 *pfccfg = 0; 605 *pfccfg = 0;
595 else 606 else
596 *pfccfg = (pi->dcb.pfcen >> priority) & 1; 607 *pfccfg = (pi->dcb.pfcen >> (7 - priority)) & 1;
597} 608}
598 609
599/* Enable/disable Priority Pause Frames for the specified Traffic Class 610/* Enable/disable Priority Pause Frames for the specified Traffic Class
@@ -618,9 +629,9 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg)
618 pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; 629 pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen;
619 630
620 if (pfccfg) 631 if (pfccfg)
621 pcmd.u.dcb.pfc.pfcen |= (1 << priority); 632 pcmd.u.dcb.pfc.pfcen |= (1 << (7 - priority));
622 else 633 else
623 pcmd.u.dcb.pfc.pfcen &= (~(1 << priority)); 634 pcmd.u.dcb.pfc.pfcen &= (~(1 << (7 - priority)));
624 635
625 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); 636 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
626 if (err != FW_PORT_DCB_CFG_SUCCESS) { 637 if (err != FW_PORT_DCB_CFG_SUCCESS) {
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 91dbf98036cc..5cc5e19286a1 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2914,7 +2914,8 @@ static int t4_sge_init_hard(struct adapter *adap)
2914int t4_sge_init(struct adapter *adap) 2914int t4_sge_init(struct adapter *adap)
2915{ 2915{
2916 struct sge *s = &adap->sge; 2916 struct sge *s = &adap->sge;
2917 u32 sge_control, sge_conm_ctrl; 2917 u32 sge_control, sge_control2, sge_conm_ctrl;
2918 unsigned int ingpadboundary, ingpackboundary;
2918 int ret, egress_threshold; 2919 int ret, egress_threshold;
2919 2920
2920 /* 2921 /*
@@ -2924,8 +2925,31 @@ int t4_sge_init(struct adapter *adap)
2924 sge_control = t4_read_reg(adap, SGE_CONTROL); 2925 sge_control = t4_read_reg(adap, SGE_CONTROL);
2925 s->pktshift = PKTSHIFT_GET(sge_control); 2926 s->pktshift = PKTSHIFT_GET(sge_control);
2926 s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; 2927 s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64;
2927 s->fl_align = 1 << (INGPADBOUNDARY_GET(sge_control) + 2928
2928 X_INGPADBOUNDARY_SHIFT); 2929 /* T4 uses a single control field to specify both the PCIe Padding and
2930 * Packing Boundary. T5 introduced the ability to specify these
2931 * separately. The actual Ingress Packet Data alignment boundary
2932 * within Packed Buffer Mode is the maximum of these two
2933 * specifications.
2934 */
2935 ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_control) +
2936 X_INGPADBOUNDARY_SHIFT);
2937 if (is_t4(adap->params.chip)) {
2938 s->fl_align = ingpadboundary;
2939 } else {
2940 /* T5 has a different interpretation of one of the PCIe Packing
2941 * Boundary values.
2942 */
2943 sge_control2 = t4_read_reg(adap, SGE_CONTROL2_A);
2944 ingpackboundary = INGPACKBOUNDARY_G(sge_control2);
2945 if (ingpackboundary == INGPACKBOUNDARY_16B_X)
2946 ingpackboundary = 16;
2947 else
2948 ingpackboundary = 1 << (ingpackboundary +
2949 INGPACKBOUNDARY_SHIFT_X);
2950
2951 s->fl_align = max(ingpadboundary, ingpackboundary);
2952 }
2929 2953
2930 if (adap->flags & USING_SOFT_PARAMS) 2954 if (adap->flags & USING_SOFT_PARAMS)
2931 ret = t4_sge_init_soft(adap); 2955 ret = t4_sge_init_soft(adap);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 2bb4efa7db98..4d32df5041f6 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -3130,12 +3130,51 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
3130 HOSTPAGESIZEPF6(sge_hps) | 3130 HOSTPAGESIZEPF6(sge_hps) |
3131 HOSTPAGESIZEPF7(sge_hps)); 3131 HOSTPAGESIZEPF7(sge_hps));
3132 3132
3133 t4_set_reg_field(adap, SGE_CONTROL, 3133 if (is_t4(adap->params.chip)) {
3134 INGPADBOUNDARY_MASK | 3134 t4_set_reg_field(adap, SGE_CONTROL,
3135 EGRSTATUSPAGESIZE_MASK, 3135 INGPADBOUNDARY_MASK |
3136 INGPADBOUNDARY(fl_align_log - 5) | 3136 EGRSTATUSPAGESIZE_MASK,
3137 EGRSTATUSPAGESIZE(stat_len != 64)); 3137 INGPADBOUNDARY(fl_align_log - 5) |
3138 3138 EGRSTATUSPAGESIZE(stat_len != 64));
3139 } else {
3140 /* T5 introduced the separation of the Free List Padding and
3141 * Packing Boundaries. Thus, we can select a smaller Padding
3142 * Boundary to avoid uselessly chewing up PCIe Link and Memory
3143 * Bandwidth, and use a Packing Boundary which is large enough
3144 * to avoid false sharing between CPUs, etc.
3145 *
3146 * For the PCI Link, the smaller the Padding Boundary the
3147 * better. For the Memory Controller, a smaller Padding
3148 * Boundary is better until we cross under the Memory Line
3149 * Size (the minimum unit of transfer to/from Memory). If we
3150 * have a Padding Boundary which is smaller than the Memory
3151 * Line Size, that'll involve a Read-Modify-Write cycle on the
3152 * Memory Controller which is never good. For T5 the smallest
3153 * Padding Boundary which we can select is 32 bytes which is
3154 * larger than any known Memory Controller Line Size so we'll
3155 * use that.
3156 *
3157 * T5 has a different interpretation of the "0" value for the
3158 * Packing Boundary. This corresponds to 16 bytes instead of
3159 * the expected 32 bytes. We never have a Packing Boundary
3160 * less than 32 bytes so we can't use that special value but
3161 * on the other hand, if we wanted 32 bytes, the best we can
3162 * really do is 64 bytes.
3163 */
3164 if (fl_align <= 32) {
3165 fl_align = 64;
3166 fl_align_log = 6;
3167 }
3168 t4_set_reg_field(adap, SGE_CONTROL,
3169 INGPADBOUNDARY_MASK |
3170 EGRSTATUSPAGESIZE_MASK,
3171 INGPADBOUNDARY(INGPCIEBOUNDARY_32B_X) |
3172 EGRSTATUSPAGESIZE(stat_len != 64));
3173 t4_set_reg_field(adap, SGE_CONTROL2_A,
3174 INGPACKBOUNDARY_V(INGPACKBOUNDARY_M),
3175 INGPACKBOUNDARY_V(fl_align_log -
3176 INGPACKBOUNDARY_SHIFT_X));
3177 }
3139 /* 3178 /*
3140 * Adjust various SGE Free List Host Buffer Sizes. 3179 * Adjust various SGE Free List Host Buffer Sizes.
3141 * 3180 *
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
index c8eb7ba225e1..ccdf8a7f4916 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
@@ -95,6 +95,7 @@
95#define X_INGPADBOUNDARY_SHIFT 5 95#define X_INGPADBOUNDARY_SHIFT 5
96 96
97#define SGE_CONTROL 0x1008 97#define SGE_CONTROL 0x1008
98#define SGE_CONTROL2_A 0x1124
98#define DCASYSTYPE 0x00080000U 99#define DCASYSTYPE 0x00080000U
99#define RXPKTCPLMODE_MASK 0x00040000U 100#define RXPKTCPLMODE_MASK 0x00040000U
100#define RXPKTCPLMODE_SHIFT 18 101#define RXPKTCPLMODE_SHIFT 18
@@ -106,6 +107,7 @@
106#define PKTSHIFT_SHIFT 10 107#define PKTSHIFT_SHIFT 10
107#define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT) 108#define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT)
108#define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT) 109#define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT)
110#define INGPCIEBOUNDARY_32B_X 0
109#define INGPCIEBOUNDARY_MASK 0x00000380U 111#define INGPCIEBOUNDARY_MASK 0x00000380U
110#define INGPCIEBOUNDARY_SHIFT 7 112#define INGPCIEBOUNDARY_SHIFT 7
111#define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT) 113#define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT)
@@ -114,6 +116,14 @@
114#define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT) 116#define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT)
115#define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \ 117#define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \
116 >> INGPADBOUNDARY_SHIFT) 118 >> INGPADBOUNDARY_SHIFT)
119#define INGPACKBOUNDARY_16B_X 0
120#define INGPACKBOUNDARY_SHIFT_X 5
121
122#define INGPACKBOUNDARY_S 16
123#define INGPACKBOUNDARY_M 0x7U
124#define INGPACKBOUNDARY_V(x) ((x) << INGPACKBOUNDARY_S)
125#define INGPACKBOUNDARY_G(x) (((x) >> INGPACKBOUNDARY_S) \
126 & INGPACKBOUNDARY_M)
117#define EGRPCIEBOUNDARY_MASK 0x0000000eU 127#define EGRPCIEBOUNDARY_MASK 0x0000000eU
118#define EGRPCIEBOUNDARY_SHIFT 1 128#define EGRPCIEBOUNDARY_SHIFT 1
119#define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT) 129#define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT)
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
index 68eaa9c88c7d..3d06e77d7121 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
@@ -299,6 +299,14 @@ struct sge {
299 u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */ 299 u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */
300 u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */ 300 u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */
301 301
302 /* Decoded Adapter Parameters.
303 */
304 u32 fl_pg_order; /* large page allocation size */
305 u32 stat_len; /* length of status page at ring end */
306 u32 pktshift; /* padding between CPL & packet data */
307 u32 fl_align; /* response queue message alignment */
308 u32 fl_starve_thres; /* Free List starvation threshold */
309
302 /* 310 /*
303 * Reverse maps from Absolute Queue IDs to associated queue pointers. 311 * Reverse maps from Absolute Queue IDs to associated queue pointers.
304 * The absolute Queue IDs are in a compact range which start at a 312 * The absolute Queue IDs are in a compact range which start at a
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index aff6d37f2676..50b1b34bde6d 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -51,14 +51,6 @@
51#include "../cxgb4/t4_msg.h" 51#include "../cxgb4/t4_msg.h"
52 52
53/* 53/*
54 * Decoded Adapter Parameters.
55 */
56static u32 FL_PG_ORDER; /* large page allocation size */
57static u32 STAT_LEN; /* length of status page at ring end */
58static u32 PKTSHIFT; /* padding between CPL and packet data */
59static u32 FL_ALIGN; /* response queue message alignment */
60
61/*
62 * Constants ... 54 * Constants ...
63 */ 55 */
64enum { 56enum {
@@ -102,12 +94,6 @@ enum {
102 MAX_TIMER_TX_RECLAIM = 100, 94 MAX_TIMER_TX_RECLAIM = 100,
103 95
104 /* 96 /*
105 * An FL with <= FL_STARVE_THRES buffers is starving and a periodic
106 * timer will attempt to refill it.
107 */
108 FL_STARVE_THRES = 4,
109
110 /*
111 * Suspend an Ethernet TX queue with fewer available descriptors than 97 * Suspend an Ethernet TX queue with fewer available descriptors than
112 * this. We always want to have room for a maximum sized packet: 98 * this. We always want to have room for a maximum sized packet:
113 * inline immediate data + MAX_SKB_FRAGS. This is the same as 99 * inline immediate data + MAX_SKB_FRAGS. This is the same as
@@ -264,15 +250,19 @@ static inline unsigned int fl_cap(const struct sge_fl *fl)
264 250
265/** 251/**
266 * fl_starving - return whether a Free List is starving. 252 * fl_starving - return whether a Free List is starving.
253 * @adapter: pointer to the adapter
267 * @fl: the Free List 254 * @fl: the Free List
268 * 255 *
269 * Tests specified Free List to see whether the number of buffers 256 * Tests specified Free List to see whether the number of buffers
270 * available to the hardware has falled below our "starvation" 257 * available to the hardware has falled below our "starvation"
271 * threshold. 258 * threshold.
272 */ 259 */
273static inline bool fl_starving(const struct sge_fl *fl) 260static inline bool fl_starving(const struct adapter *adapter,
261 const struct sge_fl *fl)
274{ 262{
275 return fl->avail - fl->pend_cred <= FL_STARVE_THRES; 263 const struct sge *s = &adapter->sge;
264
265 return fl->avail - fl->pend_cred <= s->fl_starve_thres;
276} 266}
277 267
278/** 268/**
@@ -457,13 +447,16 @@ static inline void reclaim_completed_tx(struct adapter *adapter,
457 447
458/** 448/**
459 * get_buf_size - return the size of an RX Free List buffer. 449 * get_buf_size - return the size of an RX Free List buffer.
450 * @adapter: pointer to the associated adapter
460 * @sdesc: pointer to the software buffer descriptor 451 * @sdesc: pointer to the software buffer descriptor
461 */ 452 */
462static inline int get_buf_size(const struct rx_sw_desc *sdesc) 453static inline int get_buf_size(const struct adapter *adapter,
454 const struct rx_sw_desc *sdesc)
463{ 455{
464 return FL_PG_ORDER > 0 && (sdesc->dma_addr & RX_LARGE_BUF) 456 const struct sge *s = &adapter->sge;
465 ? (PAGE_SIZE << FL_PG_ORDER) 457
466 : PAGE_SIZE; 458 return (s->fl_pg_order > 0 && (sdesc->dma_addr & RX_LARGE_BUF)
459 ? (PAGE_SIZE << s->fl_pg_order) : PAGE_SIZE);
467} 460}
468 461
469/** 462/**
@@ -483,7 +476,8 @@ static void free_rx_bufs(struct adapter *adapter, struct sge_fl *fl, int n)
483 476
484 if (is_buf_mapped(sdesc)) 477 if (is_buf_mapped(sdesc))
485 dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), 478 dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc),
486 get_buf_size(sdesc), PCI_DMA_FROMDEVICE); 479 get_buf_size(adapter, sdesc),
480 PCI_DMA_FROMDEVICE);
487 put_page(sdesc->page); 481 put_page(sdesc->page);
488 sdesc->page = NULL; 482 sdesc->page = NULL;
489 if (++fl->cidx == fl->size) 483 if (++fl->cidx == fl->size)
@@ -511,7 +505,8 @@ static void unmap_rx_buf(struct adapter *adapter, struct sge_fl *fl)
511 505
512 if (is_buf_mapped(sdesc)) 506 if (is_buf_mapped(sdesc))
513 dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), 507 dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc),
514 get_buf_size(sdesc), PCI_DMA_FROMDEVICE); 508 get_buf_size(adapter, sdesc),
509 PCI_DMA_FROMDEVICE);
515 sdesc->page = NULL; 510 sdesc->page = NULL;
516 if (++fl->cidx == fl->size) 511 if (++fl->cidx == fl->size)
517 fl->cidx = 0; 512 fl->cidx = 0;
@@ -589,6 +584,7 @@ static inline void poison_buf(struct page *page, size_t sz)
589static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, 584static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl,
590 int n, gfp_t gfp) 585 int n, gfp_t gfp)
591{ 586{
587 struct sge *s = &adapter->sge;
592 struct page *page; 588 struct page *page;
593 dma_addr_t dma_addr; 589 dma_addr_t dma_addr;
594 unsigned int cred = fl->avail; 590 unsigned int cred = fl->avail;
@@ -610,11 +606,11 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl,
610 * If we don't support large pages, drop directly into the small page 606 * If we don't support large pages, drop directly into the small page
611 * allocation code. 607 * allocation code.
612 */ 608 */
613 if (FL_PG_ORDER == 0) 609 if (s->fl_pg_order == 0)
614 goto alloc_small_pages; 610 goto alloc_small_pages;
615 611
616 while (n) { 612 while (n) {
617 page = __dev_alloc_pages(gfp, FL_PG_ORDER); 613 page = __dev_alloc_pages(gfp, s->fl_pg_order);
618 if (unlikely(!page)) { 614 if (unlikely(!page)) {
619 /* 615 /*
620 * We've failed inour attempt to allocate a "large 616 * We've failed inour attempt to allocate a "large
@@ -624,10 +620,10 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl,
624 fl->large_alloc_failed++; 620 fl->large_alloc_failed++;
625 break; 621 break;
626 } 622 }
627 poison_buf(page, PAGE_SIZE << FL_PG_ORDER); 623 poison_buf(page, PAGE_SIZE << s->fl_pg_order);
628 624
629 dma_addr = dma_map_page(adapter->pdev_dev, page, 0, 625 dma_addr = dma_map_page(adapter->pdev_dev, page, 0,
630 PAGE_SIZE << FL_PG_ORDER, 626 PAGE_SIZE << s->fl_pg_order,
631 PCI_DMA_FROMDEVICE); 627 PCI_DMA_FROMDEVICE);
632 if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) { 628 if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) {
633 /* 629 /*
@@ -638,7 +634,7 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl,
638 * because DMA mapping resources are typically 634 * because DMA mapping resources are typically
639 * critical resources once they become scarse. 635 * critical resources once they become scarse.
640 */ 636 */
641 __free_pages(page, FL_PG_ORDER); 637 __free_pages(page, s->fl_pg_order);
642 goto out; 638 goto out;
643 } 639 }
644 dma_addr |= RX_LARGE_BUF; 640 dma_addr |= RX_LARGE_BUF;
@@ -694,7 +690,7 @@ out:
694 fl->pend_cred += cred; 690 fl->pend_cred += cred;
695 ring_fl_db(adapter, fl); 691 ring_fl_db(adapter, fl);
696 692
697 if (unlikely(fl_starving(fl))) { 693 if (unlikely(fl_starving(adapter, fl))) {
698 smp_wmb(); 694 smp_wmb();
699 set_bit(fl->cntxt_id, adapter->sge.starving_fl); 695 set_bit(fl->cntxt_id, adapter->sge.starving_fl);
700 } 696 }
@@ -1469,6 +1465,8 @@ static void t4vf_pktgl_free(const struct pkt_gl *gl)
1469static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, 1465static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
1470 const struct cpl_rx_pkt *pkt) 1466 const struct cpl_rx_pkt *pkt)
1471{ 1467{
1468 struct adapter *adapter = rxq->rspq.adapter;
1469 struct sge *s = &adapter->sge;
1472 int ret; 1470 int ret;
1473 struct sk_buff *skb; 1471 struct sk_buff *skb;
1474 1472
@@ -1479,8 +1477,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
1479 return; 1477 return;
1480 } 1478 }
1481 1479
1482 copy_frags(skb, gl, PKTSHIFT); 1480 copy_frags(skb, gl, s->pktshift);
1483 skb->len = gl->tot_len - PKTSHIFT; 1481 skb->len = gl->tot_len - s->pktshift;
1484 skb->data_len = skb->len; 1482 skb->data_len = skb->len;
1485 skb->truesize += skb->data_len; 1483 skb->truesize += skb->data_len;
1486 skb->ip_summed = CHECKSUM_UNNECESSARY; 1484 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -1517,6 +1515,8 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
1517 bool csum_ok = pkt->csum_calc && !pkt->err_vec && 1515 bool csum_ok = pkt->csum_calc && !pkt->err_vec &&
1518 (rspq->netdev->features & NETIF_F_RXCSUM); 1516 (rspq->netdev->features & NETIF_F_RXCSUM);
1519 struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); 1517 struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq);
1518 struct adapter *adapter = rspq->adapter;
1519 struct sge *s = &adapter->sge;
1520 1520
1521 /* 1521 /*
1522 * If this is a good TCP packet and we have Generic Receive Offload 1522 * If this is a good TCP packet and we have Generic Receive Offload
@@ -1538,7 +1538,7 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
1538 rxq->stats.rx_drops++; 1538 rxq->stats.rx_drops++;
1539 return 0; 1539 return 0;
1540 } 1540 }
1541 __skb_pull(skb, PKTSHIFT); 1541 __skb_pull(skb, s->pktshift);
1542 skb->protocol = eth_type_trans(skb, rspq->netdev); 1542 skb->protocol = eth_type_trans(skb, rspq->netdev);
1543 skb_record_rx_queue(skb, rspq->idx); 1543 skb_record_rx_queue(skb, rspq->idx);
1544 rxq->stats.pkts++; 1544 rxq->stats.pkts++;
@@ -1649,6 +1649,8 @@ static inline void rspq_next(struct sge_rspq *rspq)
1649static int process_responses(struct sge_rspq *rspq, int budget) 1649static int process_responses(struct sge_rspq *rspq, int budget)
1650{ 1650{
1651 struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); 1651 struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq);
1652 struct adapter *adapter = rspq->adapter;
1653 struct sge *s = &adapter->sge;
1652 int budget_left = budget; 1654 int budget_left = budget;
1653 1655
1654 while (likely(budget_left)) { 1656 while (likely(budget_left)) {
@@ -1698,7 +1700,7 @@ static int process_responses(struct sge_rspq *rspq, int budget)
1698 BUG_ON(frag >= MAX_SKB_FRAGS); 1700 BUG_ON(frag >= MAX_SKB_FRAGS);
1699 BUG_ON(rxq->fl.avail == 0); 1701 BUG_ON(rxq->fl.avail == 0);
1700 sdesc = &rxq->fl.sdesc[rxq->fl.cidx]; 1702 sdesc = &rxq->fl.sdesc[rxq->fl.cidx];
1701 bufsz = get_buf_size(sdesc); 1703 bufsz = get_buf_size(adapter, sdesc);
1702 fp->page = sdesc->page; 1704 fp->page = sdesc->page;
1703 fp->offset = rspq->offset; 1705 fp->offset = rspq->offset;
1704 fp->size = min(bufsz, len); 1706 fp->size = min(bufsz, len);
@@ -1727,7 +1729,7 @@ static int process_responses(struct sge_rspq *rspq, int budget)
1727 */ 1729 */
1728 ret = rspq->handler(rspq, rspq->cur_desc, &gl); 1730 ret = rspq->handler(rspq, rspq->cur_desc, &gl);
1729 if (likely(ret == 0)) 1731 if (likely(ret == 0))
1730 rspq->offset += ALIGN(fp->size, FL_ALIGN); 1732 rspq->offset += ALIGN(fp->size, s->fl_align);
1731 else 1733 else
1732 restore_rx_bufs(&gl, &rxq->fl, frag); 1734 restore_rx_bufs(&gl, &rxq->fl, frag);
1733 } else if (likely(rsp_type == RSP_TYPE_CPL)) { 1735 } else if (likely(rsp_type == RSP_TYPE_CPL)) {
@@ -1964,7 +1966,7 @@ static void sge_rx_timer_cb(unsigned long data)
1964 * schedule napi but the FL is no longer starving. 1966 * schedule napi but the FL is no longer starving.
1965 * No biggie. 1967 * No biggie.
1966 */ 1968 */
1967 if (fl_starving(fl)) { 1969 if (fl_starving(adapter, fl)) {
1968 struct sge_eth_rxq *rxq; 1970 struct sge_eth_rxq *rxq;
1969 1971
1970 rxq = container_of(fl, struct sge_eth_rxq, fl); 1972 rxq = container_of(fl, struct sge_eth_rxq, fl);
@@ -2048,6 +2050,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
2048 int intr_dest, 2050 int intr_dest,
2049 struct sge_fl *fl, rspq_handler_t hnd) 2051 struct sge_fl *fl, rspq_handler_t hnd)
2050{ 2052{
2053 struct sge *s = &adapter->sge;
2051 struct port_info *pi = netdev_priv(dev); 2054 struct port_info *pi = netdev_priv(dev);
2052 struct fw_iq_cmd cmd, rpl; 2055 struct fw_iq_cmd cmd, rpl;
2053 int ret, iqandst, flsz = 0; 2056 int ret, iqandst, flsz = 0;
@@ -2118,7 +2121,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
2118 fl->size = roundup(fl->size, FL_PER_EQ_UNIT); 2121 fl->size = roundup(fl->size, FL_PER_EQ_UNIT);
2119 fl->desc = alloc_ring(adapter->pdev_dev, fl->size, 2122 fl->desc = alloc_ring(adapter->pdev_dev, fl->size,
2120 sizeof(__be64), sizeof(struct rx_sw_desc), 2123 sizeof(__be64), sizeof(struct rx_sw_desc),
2121 &fl->addr, &fl->sdesc, STAT_LEN); 2124 &fl->addr, &fl->sdesc, s->stat_len);
2122 if (!fl->desc) { 2125 if (!fl->desc) {
2123 ret = -ENOMEM; 2126 ret = -ENOMEM;
2124 goto err; 2127 goto err;
@@ -2130,7 +2133,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq,
2130 * free list ring) in Egress Queue Units. 2133 * free list ring) in Egress Queue Units.
2131 */ 2134 */
2132 flsz = (fl->size / FL_PER_EQ_UNIT + 2135 flsz = (fl->size / FL_PER_EQ_UNIT +
2133 STAT_LEN / EQ_UNIT); 2136 s->stat_len / EQ_UNIT);
2134 2137
2135 /* 2138 /*
2136 * Fill in all the relevant firmware Ingress Queue Command 2139 * Fill in all the relevant firmware Ingress Queue Command
@@ -2218,6 +2221,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq,
2218 struct net_device *dev, struct netdev_queue *devq, 2221 struct net_device *dev, struct netdev_queue *devq,
2219 unsigned int iqid) 2222 unsigned int iqid)
2220{ 2223{
2224 struct sge *s = &adapter->sge;
2221 int ret, nentries; 2225 int ret, nentries;
2222 struct fw_eq_eth_cmd cmd, rpl; 2226 struct fw_eq_eth_cmd cmd, rpl;
2223 struct port_info *pi = netdev_priv(dev); 2227 struct port_info *pi = netdev_priv(dev);
@@ -2226,7 +2230,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq,
2226 * Calculate the size of the hardware TX Queue (including the Status 2230 * Calculate the size of the hardware TX Queue (including the Status
2227 * Page on the end of the TX Queue) in units of TX Descriptors. 2231 * Page on the end of the TX Queue) in units of TX Descriptors.
2228 */ 2232 */
2229 nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc); 2233 nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc);
2230 2234
2231 /* 2235 /*
2232 * Allocate the hardware ring for the TX ring (with space for its 2236 * Allocate the hardware ring for the TX ring (with space for its
@@ -2235,7 +2239,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq,
2235 txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size, 2239 txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size,
2236 sizeof(struct tx_desc), 2240 sizeof(struct tx_desc),
2237 sizeof(struct tx_sw_desc), 2241 sizeof(struct tx_sw_desc),
2238 &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); 2242 &txq->q.phys_addr, &txq->q.sdesc, s->stat_len);
2239 if (!txq->q.desc) 2243 if (!txq->q.desc)
2240 return -ENOMEM; 2244 return -ENOMEM;
2241 2245
@@ -2308,8 +2312,10 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq,
2308 */ 2312 */
2309static void free_txq(struct adapter *adapter, struct sge_txq *tq) 2313static void free_txq(struct adapter *adapter, struct sge_txq *tq)
2310{ 2314{
2315 struct sge *s = &adapter->sge;
2316
2311 dma_free_coherent(adapter->pdev_dev, 2317 dma_free_coherent(adapter->pdev_dev,
2312 tq->size * sizeof(*tq->desc) + STAT_LEN, 2318 tq->size * sizeof(*tq->desc) + s->stat_len,
2313 tq->desc, tq->phys_addr); 2319 tq->desc, tq->phys_addr);
2314 tq->cntxt_id = 0; 2320 tq->cntxt_id = 0;
2315 tq->sdesc = NULL; 2321 tq->sdesc = NULL;
@@ -2323,6 +2329,7 @@ static void free_txq(struct adapter *adapter, struct sge_txq *tq)
2323static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, 2329static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq,
2324 struct sge_fl *fl) 2330 struct sge_fl *fl)
2325{ 2331{
2332 struct sge *s = &adapter->sge;
2326 unsigned int flid = fl ? fl->cntxt_id : 0xffff; 2333 unsigned int flid = fl ? fl->cntxt_id : 0xffff;
2327 2334
2328 t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP, 2335 t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP,
@@ -2338,7 +2345,7 @@ static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq,
2338 if (fl) { 2345 if (fl) {
2339 free_rx_bufs(adapter, fl, fl->avail); 2346 free_rx_bufs(adapter, fl, fl->avail);
2340 dma_free_coherent(adapter->pdev_dev, 2347 dma_free_coherent(adapter->pdev_dev,
2341 fl->size * sizeof(*fl->desc) + STAT_LEN, 2348 fl->size * sizeof(*fl->desc) + s->stat_len,
2342 fl->desc, fl->addr); 2349 fl->desc, fl->addr);
2343 kfree(fl->sdesc); 2350 kfree(fl->sdesc);
2344 fl->sdesc = NULL; 2351 fl->sdesc = NULL;
@@ -2424,6 +2431,7 @@ int t4vf_sge_init(struct adapter *adapter)
2424 u32 fl0 = sge_params->sge_fl_buffer_size[0]; 2431 u32 fl0 = sge_params->sge_fl_buffer_size[0];
2425 u32 fl1 = sge_params->sge_fl_buffer_size[1]; 2432 u32 fl1 = sge_params->sge_fl_buffer_size[1];
2426 struct sge *s = &adapter->sge; 2433 struct sge *s = &adapter->sge;
2434 unsigned int ingpadboundary, ingpackboundary;
2427 2435
2428 /* 2436 /*
2429 * Start by vetting the basic SGE parameters which have been set up by 2437 * Start by vetting the basic SGE parameters which have been set up by
@@ -2444,12 +2452,48 @@ int t4vf_sge_init(struct adapter *adapter)
2444 * Now translate the adapter parameters into our internal forms. 2452 * Now translate the adapter parameters into our internal forms.
2445 */ 2453 */
2446 if (fl1) 2454 if (fl1)
2447 FL_PG_ORDER = ilog2(fl1) - PAGE_SHIFT; 2455 s->fl_pg_order = ilog2(fl1) - PAGE_SHIFT;
2448 STAT_LEN = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) 2456 s->stat_len = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK)
2449 ? 128 : 64); 2457 ? 128 : 64);
2450 PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control); 2458 s->pktshift = PKTSHIFT_GET(sge_params->sge_control);
2451 FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + 2459
2452 SGE_INGPADBOUNDARY_SHIFT); 2460 /* T4 uses a single control field to specify both the PCIe Padding and
2461 * Packing Boundary. T5 introduced the ability to specify these
2462 * separately. The actual Ingress Packet Data alignment boundary
2463 * within Packed Buffer Mode is the maximum of these two
2464 * specifications. (Note that it makes no real practical sense to
2465 * have the Pading Boudary be larger than the Packing Boundary but you
2466 * could set the chip up that way and, in fact, legacy T4 code would
2467 * end doing this because it would initialize the Padding Boundary and
2468 * leave the Packing Boundary initialized to 0 (16 bytes).)
2469 */
2470 ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) +
2471 X_INGPADBOUNDARY_SHIFT);
2472 if (is_t4(adapter->params.chip)) {
2473 s->fl_align = ingpadboundary;
2474 } else {
2475 /* T5 has a different interpretation of one of the PCIe Packing
2476 * Boundary values.
2477 */
2478 ingpackboundary = INGPACKBOUNDARY_G(sge_params->sge_control2);
2479 if (ingpackboundary == INGPACKBOUNDARY_16B_X)
2480 ingpackboundary = 16;
2481 else
2482 ingpackboundary = 1 << (ingpackboundary +
2483 INGPACKBOUNDARY_SHIFT_X);
2484
2485 s->fl_align = max(ingpadboundary, ingpackboundary);
2486 }
2487
2488 /* A FL with <= fl_starve_thres buffers is starving and a periodic
2489 * timer will attempt to refill it. This needs to be larger than the
2490 * SGE's Egress Congestion Threshold. If it isn't, then we can get
2491 * stuck waiting for new packets while the SGE is waiting for us to
2492 * give it more Free List entries. (Note that the SGE's Egress
2493 * Congestion Threshold is in units of 2 Free List pointers.)
2494 */
2495 s->fl_starve_thres
2496 = EGRTHRESHOLD_GET(sge_params->sge_congestion_control)*2 + 1;
2453 2497
2454 /* 2498 /*
2455 * Set up tasklet timers. 2499 * Set up tasklet timers.
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
index 2cfa4396b003..a608c6657d63 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
@@ -134,11 +134,13 @@ struct dev_params {
134 */ 134 */
135struct sge_params { 135struct sge_params {
136 u32 sge_control; /* padding, boundaries, lengths, etc. */ 136 u32 sge_control; /* padding, boundaries, lengths, etc. */
137 u32 sge_control2; /* T5: more of the same */
137 u32 sge_host_page_size; /* RDMA page sizes */ 138 u32 sge_host_page_size; /* RDMA page sizes */
138 u32 sge_queues_per_page; /* RDMA queues/page */ 139 u32 sge_queues_per_page; /* RDMA queues/page */
139 u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */ 140 u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */
140 u32 sge_fl_buffer_size[16]; /* free list buffer sizes */ 141 u32 sge_fl_buffer_size[16]; /* free list buffer sizes */
141 u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */ 142 u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */
143 u32 sge_congestion_control; /* congestion thresholds, etc. */
142 u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */ 144 u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */
143 u32 sge_timer_value_2_and_3; 145 u32 sge_timer_value_2_and_3;
144 u32 sge_timer_value_4_and_5; 146 u32 sge_timer_value_4_and_5;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
index 570b895ae06f..fae0c95e1a6b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
@@ -468,12 +468,38 @@ int t4vf_get_sge_params(struct adapter *adapter)
468 sge_params->sge_timer_value_2_and_3 = vals[5]; 468 sge_params->sge_timer_value_2_and_3 = vals[5];
469 sge_params->sge_timer_value_4_and_5 = vals[6]; 469 sge_params->sge_timer_value_4_and_5 = vals[6];
470 470
471 /* T4 uses a single control field to specify both the PCIe Padding and
472 * Packing Boundary. T5 introduced the ability to specify these
473 * separately with the Padding Boundary in SGE_CONTROL and and Packing
474 * Boundary in SGE_CONTROL2. So for T5 and later we need to grab
475 * SGE_CONTROL in order to determine how ingress packet data will be
476 * laid out in Packed Buffer Mode. Unfortunately, older versions of
477 * the firmware won't let us retrieve SGE_CONTROL2 so if we get a
478 * failure grabbing it we throw an error since we can't figure out the
479 * right value.
480 */
481 if (!is_t4(adapter->params.chip)) {
482 params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) |
483 FW_PARAMS_PARAM_XYZ(SGE_CONTROL2_A));
484 v = t4vf_query_params(adapter, 1, params, vals);
485 if (v != FW_SUCCESS) {
486 dev_err(adapter->pdev_dev,
487 "Unable to get SGE Control2; "
488 "probably old firmware.\n");
489 return v;
490 }
491 sge_params->sge_control2 = vals[0];
492 }
493
471 params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | 494 params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) |
472 FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD)); 495 FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD));
473 v = t4vf_query_params(adapter, 1, params, vals); 496 params[1] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) |
497 FW_PARAMS_PARAM_XYZ(SGE_CONM_CTRL));
498 v = t4vf_query_params(adapter, 2, params, vals);
474 if (v) 499 if (v)
475 return v; 500 return v;
476 sge_params->sge_ingress_rx_threshold = vals[0]; 501 sge_params->sge_ingress_rx_threshold = vals[0];
502 sge_params->sge_congestion_control = vals[1];
477 503
478 return 0; 504 return 0;
479} 505}
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index c27128de8dde..3dca494797bd 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -298,6 +298,16 @@ static void *swap_buffer(void *bufaddr, int len)
298 return bufaddr; 298 return bufaddr;
299} 299}
300 300
301static void swap_buffer2(void *dst_buf, void *src_buf, int len)
302{
303 int i;
304 unsigned int *src = src_buf;
305 unsigned int *dst = dst_buf;
306
307 for (i = 0; i < len; i += 4, src++, dst++)
308 *dst = swab32p(src);
309}
310
301static void fec_dump(struct net_device *ndev) 311static void fec_dump(struct net_device *ndev)
302{ 312{
303 struct fec_enet_private *fep = netdev_priv(ndev); 313 struct fec_enet_private *fep = netdev_priv(ndev);
@@ -1307,7 +1317,7 @@ fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct sk_buff
1307} 1317}
1308 1318
1309static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, 1319static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb,
1310 struct bufdesc *bdp, u32 length) 1320 struct bufdesc *bdp, u32 length, bool swap)
1311{ 1321{
1312 struct fec_enet_private *fep = netdev_priv(ndev); 1322 struct fec_enet_private *fep = netdev_priv(ndev);
1313 struct sk_buff *new_skb; 1323 struct sk_buff *new_skb;
@@ -1322,7 +1332,10 @@ static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb,
1322 dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, 1332 dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr,
1323 FEC_ENET_RX_FRSIZE - fep->rx_align, 1333 FEC_ENET_RX_FRSIZE - fep->rx_align,
1324 DMA_FROM_DEVICE); 1334 DMA_FROM_DEVICE);
1325 memcpy(new_skb->data, (*skb)->data, length); 1335 if (!swap)
1336 memcpy(new_skb->data, (*skb)->data, length);
1337 else
1338 swap_buffer2(new_skb->data, (*skb)->data, length);
1326 *skb = new_skb; 1339 *skb = new_skb;
1327 1340
1328 return true; 1341 return true;
@@ -1352,6 +1365,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
1352 u16 vlan_tag; 1365 u16 vlan_tag;
1353 int index = 0; 1366 int index = 0;
1354 bool is_copybreak; 1367 bool is_copybreak;
1368 bool need_swap = id_entry->driver_data & FEC_QUIRK_SWAP_FRAME;
1355 1369
1356#ifdef CONFIG_M532x 1370#ifdef CONFIG_M532x
1357 flush_cache_all(); 1371 flush_cache_all();
@@ -1415,7 +1429,8 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
1415 * include that when passing upstream as it messes up 1429 * include that when passing upstream as it messes up
1416 * bridging applications. 1430 * bridging applications.
1417 */ 1431 */
1418 is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4); 1432 is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4,
1433 need_swap);
1419 if (!is_copybreak) { 1434 if (!is_copybreak) {
1420 skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE); 1435 skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE);
1421 if (unlikely(!skb_new)) { 1436 if (unlikely(!skb_new)) {
@@ -1430,7 +1445,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
1430 prefetch(skb->data - NET_IP_ALIGN); 1445 prefetch(skb->data - NET_IP_ALIGN);
1431 skb_put(skb, pkt_len - 4); 1446 skb_put(skb, pkt_len - 4);
1432 data = skb->data; 1447 data = skb->data;
1433 if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) 1448 if (!is_copybreak && need_swap)
1434 swap_buffer(data, pkt_len); 1449 swap_buffer(data, pkt_len);
1435 1450
1436 /* Extract the enhanced buffer descriptor */ 1451 /* Extract the enhanced buffer descriptor */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index dc97c03134ec..acafe391f0a3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -706,7 +706,6 @@ s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw)
706 706
707 hw->phy.ops.write_reg(hw, MDIO_CTRL1, 707 hw->phy.ops.write_reg(hw, MDIO_CTRL1,
708 MDIO_MMD_AN, autoneg_reg); 708 MDIO_MMD_AN, autoneg_reg);
709
710 return 0; 709 return 0;
711} 710}
712 711
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index d1eb25dbff56..f3df9b350d87 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2291,8 +2291,16 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work)
2291 ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, 2291 ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
2292 VXLAN_STEER_BY_OUTER_MAC, 1); 2292 VXLAN_STEER_BY_OUTER_MAC, 1);
2293out: 2293out:
2294 if (ret) 2294 if (ret) {
2295 en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); 2295 en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret);
2296 return;
2297 }
2298
2299 /* set offloads */
2300 priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
2301 NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
2302 priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
2303 priv->dev->features |= NETIF_F_GSO_UDP_TUNNEL;
2296} 2304}
2297 2305
2298static void mlx4_en_del_vxlan_offloads(struct work_struct *work) 2306static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
@@ -2300,6 +2308,11 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
2300 int ret; 2308 int ret;
2301 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, 2309 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
2302 vxlan_del_task); 2310 vxlan_del_task);
2311 /* unset offloads */
2312 priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
2313 NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL);
2314 priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
2315 priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL;
2303 2316
2304 ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, 2317 ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
2305 VXLAN_STEER_BY_OUTER_MAC, 0); 2318 VXLAN_STEER_BY_OUTER_MAC, 0);
@@ -2583,13 +2596,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2583 if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) 2596 if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0)
2584 dev->priv_flags |= IFF_UNICAST_FLT; 2597 dev->priv_flags |= IFF_UNICAST_FLT;
2585 2598
2586 if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
2587 dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
2588 NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
2589 dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
2590 dev->features |= NETIF_F_GSO_UDP_TUNNEL;
2591 }
2592
2593 mdev->pndev[port] = dev; 2599 mdev->pndev[port] = dev;
2594 2600
2595 netif_carrier_off(dev); 2601 netif_carrier_off(dev);
diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig
index f3a47147937d..9a49f42ac2ba 100644
--- a/drivers/net/ethernet/qualcomm/Kconfig
+++ b/drivers/net/ethernet/qualcomm/Kconfig
@@ -5,7 +5,6 @@
5config NET_VENDOR_QUALCOMM 5config NET_VENDOR_QUALCOMM
6 bool "Qualcomm devices" 6 bool "Qualcomm devices"
7 default y 7 default y
8 depends on SPI_MASTER && OF_GPIO
9 ---help--- 8 ---help---
10 If you have a network (Ethernet) card belonging to this class, say Y 9 If you have a network (Ethernet) card belonging to this class, say Y
11 and read the Ethernet-HOWTO, available from 10 and read the Ethernet-HOWTO, available from
@@ -20,7 +19,7 @@ if NET_VENDOR_QUALCOMM
20 19
21config QCA7000 20config QCA7000
22 tristate "Qualcomm Atheros QCA7000 support" 21 tristate "Qualcomm Atheros QCA7000 support"
23 depends on SPI_MASTER && OF_GPIO 22 depends on SPI_MASTER && OF
24 ---help--- 23 ---help---
25 This SPI protocol driver supports the Qualcomm Atheros QCA7000. 24 This SPI protocol driver supports the Qualcomm Atheros QCA7000.
26 25
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index affb29da353e..77ed74561e5f 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1342,6 +1342,42 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
1342 spin_unlock(&pdata->mac_lock); 1342 spin_unlock(&pdata->mac_lock);
1343} 1343}
1344 1344
1345static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata)
1346{
1347 int rc = 0;
1348
1349 if (!pdata->phy_dev)
1350 return rc;
1351
1352 /* If the internal PHY is in General Power-Down mode, all, except the
1353 * management interface, is powered-down and stays in that condition as
1354 * long as Phy register bit 0.11 is HIGH.
1355 *
1356 * In that case, clear the bit 0.11, so the PHY powers up and we can
1357 * access to the phy registers.
1358 */
1359 rc = phy_read(pdata->phy_dev, MII_BMCR);
1360 if (rc < 0) {
1361 SMSC_WARN(pdata, drv, "Failed reading PHY control reg");
1362 return rc;
1363 }
1364
1365 /* If the PHY general power-down bit is not set is not necessary to
1366 * disable the general power down-mode.
1367 */
1368 if (rc & BMCR_PDOWN) {
1369 rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN);
1370 if (rc < 0) {
1371 SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
1372 return rc;
1373 }
1374
1375 usleep_range(1000, 1500);
1376 }
1377
1378 return 0;
1379}
1380
1345static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) 1381static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
1346{ 1382{
1347 int rc = 0; 1383 int rc = 0;
@@ -1356,12 +1392,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
1356 return rc; 1392 return rc;
1357 } 1393 }
1358 1394
1359 /* 1395 /* Only disable if energy detect mode is already enabled */
1360 * If energy is detected the PHY is already awake so is not necessary 1396 if (rc & MII_LAN83C185_EDPWRDOWN) {
1361 * to disable the energy detect power-down mode.
1362 */
1363 if ((rc & MII_LAN83C185_EDPWRDOWN) &&
1364 !(rc & MII_LAN83C185_ENERGYON)) {
1365 /* Disable energy detect mode for this SMSC Transceivers */ 1397 /* Disable energy detect mode for this SMSC Transceivers */
1366 rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, 1398 rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS,
1367 rc & (~MII_LAN83C185_EDPWRDOWN)); 1399 rc & (~MII_LAN83C185_EDPWRDOWN));
@@ -1370,8 +1402,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata)
1370 SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); 1402 SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
1371 return rc; 1403 return rc;
1372 } 1404 }
1373 1405 /* Allow PHY to wakeup */
1374 mdelay(1); 1406 mdelay(2);
1375 } 1407 }
1376 1408
1377 return 0; 1409 return 0;
@@ -1393,7 +1425,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata)
1393 1425
1394 /* Only enable if energy detect mode is already disabled */ 1426 /* Only enable if energy detect mode is already disabled */
1395 if (!(rc & MII_LAN83C185_EDPWRDOWN)) { 1427 if (!(rc & MII_LAN83C185_EDPWRDOWN)) {
1396 mdelay(100);
1397 /* Enable energy detect mode for this SMSC Transceivers */ 1428 /* Enable energy detect mode for this SMSC Transceivers */
1398 rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, 1429 rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS,
1399 rc | MII_LAN83C185_EDPWRDOWN); 1430 rc | MII_LAN83C185_EDPWRDOWN);
@@ -1402,8 +1433,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata)
1402 SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); 1433 SMSC_WARN(pdata, drv, "Failed writing PHY control reg");
1403 return rc; 1434 return rc;
1404 } 1435 }
1405
1406 mdelay(1);
1407 } 1436 }
1408 return 0; 1437 return 0;
1409} 1438}
@@ -1415,6 +1444,16 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata)
1415 int ret; 1444 int ret;
1416 1445
1417 /* 1446 /*
1447 * Make sure to power-up the PHY chip before doing a reset, otherwise
1448 * the reset fails.
1449 */
1450 ret = smsc911x_phy_general_power_up(pdata);
1451 if (ret) {
1452 SMSC_WARN(pdata, drv, "Failed to power-up the PHY chip");
1453 return ret;
1454 }
1455
1456 /*
1418 * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that 1457 * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that
1419 * are initialized in a Energy Detect Power-Down mode that prevents 1458 * are initialized in a Energy Detect Power-Down mode that prevents
1420 * the MAC chip to be software reseted. So we have to wakeup the PHY 1459 * the MAC chip to be software reseted. So we have to wakeup the PHY
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index ab92f67da035..4a4388b813ac 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -264,7 +264,7 @@ static int cpts_match(struct sk_buff *skb, unsigned int ptp_class,
264 264
265 switch (ptp_class & PTP_CLASS_PMASK) { 265 switch (ptp_class & PTP_CLASS_PMASK) {
266 case PTP_CLASS_IPV4: 266 case PTP_CLASS_IPV4:
267 offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; 267 offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN;
268 break; 268 break;
269 case PTP_CLASS_IPV6: 269 case PTP_CLASS_IPV6:
270 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; 270 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 2954052706e8..e22e602beef3 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -791,7 +791,7 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts)
791 791
792 switch (type & PTP_CLASS_PMASK) { 792 switch (type & PTP_CLASS_PMASK) {
793 case PTP_CLASS_IPV4: 793 case PTP_CLASS_IPV4:
794 offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; 794 offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN;
795 break; 795 break;
796 case PTP_CLASS_IPV6: 796 case PTP_CLASS_IPV6:
797 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; 797 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
@@ -934,7 +934,7 @@ static int is_sync(struct sk_buff *skb, int type)
934 934
935 switch (type & PTP_CLASS_PMASK) { 935 switch (type & PTP_CLASS_PMASK) {
936 case PTP_CLASS_IPV4: 936 case PTP_CLASS_IPV4:
937 offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; 937 offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN;
938 break; 938 break;
939 case PTP_CLASS_IPV6: 939 case PTP_CLASS_IPV6:
940 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; 940 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1dfffdc9dfc3..767cd110f496 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -352,6 +352,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
352{ 352{
353 struct mii_ioctl_data *mii_data = if_mii(ifr); 353 struct mii_ioctl_data *mii_data = if_mii(ifr);
354 u16 val = mii_data->val_in; 354 u16 val = mii_data->val_in;
355 bool change_autoneg = false;
355 356
356 switch (cmd) { 357 switch (cmd) {
357 case SIOCGMIIPHY: 358 case SIOCGMIIPHY:
@@ -367,22 +368,29 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
367 if (mii_data->phy_id == phydev->addr) { 368 if (mii_data->phy_id == phydev->addr) {
368 switch (mii_data->reg_num) { 369 switch (mii_data->reg_num) {
369 case MII_BMCR: 370 case MII_BMCR:
370 if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) 371 if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) {
372 if (phydev->autoneg == AUTONEG_ENABLE)
373 change_autoneg = true;
371 phydev->autoneg = AUTONEG_DISABLE; 374 phydev->autoneg = AUTONEG_DISABLE;
372 else 375 if (val & BMCR_FULLDPLX)
376 phydev->duplex = DUPLEX_FULL;
377 else
378 phydev->duplex = DUPLEX_HALF;
379 if (val & BMCR_SPEED1000)
380 phydev->speed = SPEED_1000;
381 else if (val & BMCR_SPEED100)
382 phydev->speed = SPEED_100;
383 else phydev->speed = SPEED_10;
384 }
385 else {
386 if (phydev->autoneg == AUTONEG_DISABLE)
387 change_autoneg = true;
373 phydev->autoneg = AUTONEG_ENABLE; 388 phydev->autoneg = AUTONEG_ENABLE;
374 if (!phydev->autoneg && (val & BMCR_FULLDPLX)) 389 }
375 phydev->duplex = DUPLEX_FULL;
376 else
377 phydev->duplex = DUPLEX_HALF;
378 if (!phydev->autoneg && (val & BMCR_SPEED1000))
379 phydev->speed = SPEED_1000;
380 else if (!phydev->autoneg &&
381 (val & BMCR_SPEED100))
382 phydev->speed = SPEED_100;
383 break; 390 break;
384 case MII_ADVERTISE: 391 case MII_ADVERTISE:
385 phydev->advertising = val; 392 phydev->advertising = mii_adv_to_ethtool_adv_t(val);
393 change_autoneg = true;
386 break; 394 break;
387 default: 395 default:
388 /* do nothing */ 396 /* do nothing */
@@ -396,6 +404,10 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
396 if (mii_data->reg_num == MII_BMCR && 404 if (mii_data->reg_num == MII_BMCR &&
397 val & BMCR_RESET) 405 val & BMCR_RESET)
398 return phy_init_hw(phydev); 406 return phy_init_hw(phydev);
407
408 if (change_autoneg)
409 return phy_start_aneg(phydev);
410
399 return 0; 411 return 0;
400 412
401 case SIOCSHWTSTAMP: 413 case SIOCSHWTSTAMP:
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 68c3a3f4e0ab..794a47329368 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -755,23 +755,23 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
755 755
756 err = get_filter(argp, &code); 756 err = get_filter(argp, &code);
757 if (err >= 0) { 757 if (err >= 0) {
758 struct bpf_prog *pass_filter = NULL;
758 struct sock_fprog_kern fprog = { 759 struct sock_fprog_kern fprog = {
759 .len = err, 760 .len = err,
760 .filter = code, 761 .filter = code,
761 }; 762 };
762 763
763 ppp_lock(ppp); 764 err = 0;
764 if (ppp->pass_filter) { 765 if (fprog.filter)
765 bpf_prog_destroy(ppp->pass_filter); 766 err = bpf_prog_create(&pass_filter, &fprog);
766 ppp->pass_filter = NULL; 767 if (!err) {
768 ppp_lock(ppp);
769 if (ppp->pass_filter)
770 bpf_prog_destroy(ppp->pass_filter);
771 ppp->pass_filter = pass_filter;
772 ppp_unlock(ppp);
767 } 773 }
768 if (fprog.filter != NULL)
769 err = bpf_prog_create(&ppp->pass_filter,
770 &fprog);
771 else
772 err = 0;
773 kfree(code); 774 kfree(code);
774 ppp_unlock(ppp);
775 } 775 }
776 break; 776 break;
777 } 777 }
@@ -781,23 +781,23 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
781 781
782 err = get_filter(argp, &code); 782 err = get_filter(argp, &code);
783 if (err >= 0) { 783 if (err >= 0) {
784 struct bpf_prog *active_filter = NULL;
784 struct sock_fprog_kern fprog = { 785 struct sock_fprog_kern fprog = {
785 .len = err, 786 .len = err,
786 .filter = code, 787 .filter = code,
787 }; 788 };
788 789
789 ppp_lock(ppp); 790 err = 0;
790 if (ppp->active_filter) { 791 if (fprog.filter)
791 bpf_prog_destroy(ppp->active_filter); 792 err = bpf_prog_create(&active_filter, &fprog);
792 ppp->active_filter = NULL; 793 if (!err) {
794 ppp_lock(ppp);
795 if (ppp->active_filter)
796 bpf_prog_destroy(ppp->active_filter);
797 ppp->active_filter = active_filter;
798 ppp_unlock(ppp);
793 } 799 }
794 if (fprog.filter != NULL)
795 err = bpf_prog_create(&ppp->active_filter,
796 &fprog);
797 else
798 err = 0;
799 kfree(code); 800 kfree(code);
800 ppp_unlock(ppp);
801 } 801 }
802 break; 802 break;
803 } 803 }
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 2c05f6cdb12f..816d511e34d3 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -465,19 +465,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
465 return ret; 465 return ret;
466 } 466 }
467 467
468 ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL); 468 ax88772_reset(dev);
469 if (ret < 0)
470 return ret;
471
472 msleep(150);
473
474 ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
475 if (ret < 0)
476 return ret;
477
478 msleep(150);
479
480 ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
481 469
482 /* Read PHYID register *AFTER* the PHY was reset properly */ 470 /* Read PHYID register *AFTER* the PHY was reset properly */
483 phyid = asix_get_phyid(dev); 471 phyid = asix_get_phyid(dev);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0ab411461d2e..23b1e8c0d547 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -275,13 +275,15 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb)
275 return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); 275 return list_first_entry(&fdb->remotes, struct vxlan_rdst, list);
276} 276}
277 277
278/* Find VXLAN socket based on network namespace and UDP port */ 278/* Find VXLAN socket based on network namespace, address family and UDP port */
279static struct vxlan_sock *vxlan_find_sock(struct net *net, __be16 port) 279static struct vxlan_sock *vxlan_find_sock(struct net *net,
280 sa_family_t family, __be16 port)
280{ 281{
281 struct vxlan_sock *vs; 282 struct vxlan_sock *vs;
282 283
283 hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { 284 hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) {
284 if (inet_sk(vs->sock->sk)->inet_sport == port) 285 if (inet_sk(vs->sock->sk)->inet_sport == port &&
286 inet_sk(vs->sock->sk)->sk.sk_family == family)
285 return vs; 287 return vs;
286 } 288 }
287 return NULL; 289 return NULL;
@@ -300,11 +302,12 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs, u32 id)
300} 302}
301 303
302/* Look up VNI in a per net namespace table */ 304/* Look up VNI in a per net namespace table */
303static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, __be16 port) 305static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id,
306 sa_family_t family, __be16 port)
304{ 307{
305 struct vxlan_sock *vs; 308 struct vxlan_sock *vs;
306 309
307 vs = vxlan_find_sock(net, port); 310 vs = vxlan_find_sock(net, family, port);
308 if (!vs) 311 if (!vs)
309 return NULL; 312 return NULL;
310 313
@@ -621,6 +624,8 @@ static int vxlan_gro_complete(struct sk_buff *skb, int nhoff)
621 int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); 624 int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr);
622 int err = -ENOSYS; 625 int err = -ENOSYS;
623 626
627 udp_tunnel_gro_complete(skb, nhoff);
628
624 eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); 629 eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr));
625 type = eh->h_proto; 630 type = eh->h_proto;
626 631
@@ -1771,7 +1776,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
1771 struct vxlan_dev *dst_vxlan; 1776 struct vxlan_dev *dst_vxlan;
1772 1777
1773 ip_rt_put(rt); 1778 ip_rt_put(rt);
1774 dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); 1779 dst_vxlan = vxlan_find_vni(vxlan->net, vni,
1780 dst->sa.sa_family, dst_port);
1775 if (!dst_vxlan) 1781 if (!dst_vxlan)
1776 goto tx_error; 1782 goto tx_error;
1777 vxlan_encap_bypass(skb, vxlan, dst_vxlan); 1783 vxlan_encap_bypass(skb, vxlan, dst_vxlan);
@@ -1825,7 +1831,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
1825 struct vxlan_dev *dst_vxlan; 1831 struct vxlan_dev *dst_vxlan;
1826 1832
1827 dst_release(ndst); 1833 dst_release(ndst);
1828 dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); 1834 dst_vxlan = vxlan_find_vni(vxlan->net, vni,
1835 dst->sa.sa_family, dst_port);
1829 if (!dst_vxlan) 1836 if (!dst_vxlan)
1830 goto tx_error; 1837 goto tx_error;
1831 vxlan_encap_bypass(skb, vxlan, dst_vxlan); 1838 vxlan_encap_bypass(skb, vxlan, dst_vxlan);
@@ -1985,13 +1992,15 @@ static int vxlan_init(struct net_device *dev)
1985 struct vxlan_dev *vxlan = netdev_priv(dev); 1992 struct vxlan_dev *vxlan = netdev_priv(dev);
1986 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); 1993 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
1987 struct vxlan_sock *vs; 1994 struct vxlan_sock *vs;
1995 bool ipv6 = vxlan->flags & VXLAN_F_IPV6;
1988 1996
1989 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 1997 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
1990 if (!dev->tstats) 1998 if (!dev->tstats)
1991 return -ENOMEM; 1999 return -ENOMEM;
1992 2000
1993 spin_lock(&vn->sock_lock); 2001 spin_lock(&vn->sock_lock);
1994 vs = vxlan_find_sock(vxlan->net, vxlan->dst_port); 2002 vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET,
2003 vxlan->dst_port);
1995 if (vs) { 2004 if (vs) {
1996 /* If we have a socket with same port already, reuse it */ 2005 /* If we have a socket with same port already, reuse it */
1997 atomic_inc(&vs->refcnt); 2006 atomic_inc(&vs->refcnt);
@@ -2385,6 +2394,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
2385{ 2394{
2386 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 2395 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
2387 struct vxlan_sock *vs; 2396 struct vxlan_sock *vs;
2397 bool ipv6 = flags & VXLAN_F_IPV6;
2388 2398
2389 vs = vxlan_socket_create(net, port, rcv, data, flags); 2399 vs = vxlan_socket_create(net, port, rcv, data, flags);
2390 if (!IS_ERR(vs)) 2400 if (!IS_ERR(vs))
@@ -2394,7 +2404,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
2394 return vs; 2404 return vs;
2395 2405
2396 spin_lock(&vn->sock_lock); 2406 spin_lock(&vn->sock_lock);
2397 vs = vxlan_find_sock(net, port); 2407 vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port);
2398 if (vs) { 2408 if (vs) {
2399 if (vs->rcv == rcv) 2409 if (vs->rcv == rcv)
2400 atomic_inc(&vs->refcnt); 2410 atomic_inc(&vs->refcnt);
@@ -2553,7 +2563,8 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
2553 nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) 2563 nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX]))
2554 vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; 2564 vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX;
2555 2565
2556 if (vxlan_find_vni(net, vni, vxlan->dst_port)) { 2566 if (vxlan_find_vni(net, vni, use_ipv6 ? AF_INET6 : AF_INET,
2567 vxlan->dst_port)) {
2557 pr_info("duplicate VNI %u\n", vni); 2568 pr_info("duplicate VNI %u\n", vni);
2558 return -EEXIST; 2569 return -EEXIST;
2559 } 2570 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index e0d9f19650b0..eb03943f8463 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -284,7 +284,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
284 284
285 lockdep_assert_held(&mvm->mutex); 285 lockdep_assert_held(&mvm->mutex);
286 286
287 if (WARN_ON_ONCE(mvm->init_ucode_complete)) 287 if (WARN_ON_ONCE(mvm->init_ucode_complete || mvm->calibrating))
288 return 0; 288 return 0;
289 289
290 iwl_init_notification_wait(&mvm->notif_wait, 290 iwl_init_notification_wait(&mvm->notif_wait,
@@ -334,6 +334,8 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
334 goto out; 334 goto out;
335 } 335 }
336 336
337 mvm->calibrating = true;
338
337 /* Send TX valid antennas before triggering calibrations */ 339 /* Send TX valid antennas before triggering calibrations */
338 ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant); 340 ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant);
339 if (ret) 341 if (ret)
@@ -358,11 +360,17 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
358 MVM_UCODE_CALIB_TIMEOUT); 360 MVM_UCODE_CALIB_TIMEOUT);
359 if (!ret) 361 if (!ret)
360 mvm->init_ucode_complete = true; 362 mvm->init_ucode_complete = true;
363
364 if (ret && iwl_mvm_is_radio_killed(mvm)) {
365 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
366 ret = 1;
367 }
361 goto out; 368 goto out;
362 369
363error: 370error:
364 iwl_remove_notification(&mvm->notif_wait, &calib_wait); 371 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
365out: 372out:
373 mvm->calibrating = false;
366 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { 374 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) {
367 /* we want to debug INIT and we have no NVM - fake */ 375 /* we want to debug INIT and we have no NVM - fake */
368 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + 376 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index f308e52781f6..57325589ee5b 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -825,6 +825,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
825 825
826 mvm->scan_status = IWL_MVM_SCAN_NONE; 826 mvm->scan_status = IWL_MVM_SCAN_NONE;
827 mvm->ps_disabled = false; 827 mvm->ps_disabled = false;
828 mvm->calibrating = false;
828 829
829 /* just in case one was running */ 830 /* just in case one was running */
830 ieee80211_remain_on_channel_expired(mvm->hw); 831 ieee80211_remain_on_channel_expired(mvm->hw);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 256765accbc6..d015fac06a62 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -548,6 +548,7 @@ struct iwl_mvm {
548 enum iwl_ucode_type cur_ucode; 548 enum iwl_ucode_type cur_ucode;
549 bool ucode_loaded; 549 bool ucode_loaded;
550 bool init_ucode_complete; 550 bool init_ucode_complete;
551 bool calibrating;
551 u32 error_event_table; 552 u32 error_event_table;
552 u32 log_event_table; 553 u32 log_event_table;
553 u32 umac_error_event_table; 554 u32 umac_error_event_table;
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index bd52ecfabedb..7a9578567f4f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -427,6 +427,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
427 } 427 }
428 mvm->sf_state = SF_UNINIT; 428 mvm->sf_state = SF_UNINIT;
429 mvm->low_latency_agg_frame_limit = 6; 429 mvm->low_latency_agg_frame_limit = 6;
430 mvm->cur_ucode = IWL_UCODE_INIT;
430 431
431 mutex_init(&mvm->mutex); 432 mutex_init(&mvm->mutex);
432 mutex_init(&mvm->d0i3_suspend_mutex); 433 mutex_init(&mvm->d0i3_suspend_mutex);
@@ -757,6 +758,7 @@ void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state)
757static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) 758static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
758{ 759{
759 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); 760 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
761 bool calibrating = ACCESS_ONCE(mvm->calibrating);
760 762
761 if (state) 763 if (state)
762 set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); 764 set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
@@ -765,7 +767,15 @@ static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
765 767
766 wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); 768 wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm));
767 769
768 return state && mvm->cur_ucode != IWL_UCODE_INIT; 770 /* iwl_run_init_mvm_ucode is waiting for results, abort it */
771 if (calibrating)
772 iwl_abort_notification_waits(&mvm->notif_wait);
773
774 /*
775 * Stop the device if we run OPERATIONAL firmware or if we are in the
776 * middle of the calibrations.
777 */
778 return state && (mvm->cur_ucode != IWL_UCODE_INIT || calibrating);
769} 779}
770 780
771static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) 781static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 40a290603ead..836725e92687 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -913,7 +913,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
913 * restart. So don't process again if the device is 913 * restart. So don't process again if the device is
914 * already dead. 914 * already dead.
915 */ 915 */
916 if (test_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 916 if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) {
917 IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n");
917 iwl_pcie_tx_stop(trans); 918 iwl_pcie_tx_stop(trans);
918 iwl_pcie_rx_stop(trans); 919 iwl_pcie_rx_stop(trans);
919 920
@@ -943,7 +944,6 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
943 /* clear all status bits */ 944 /* clear all status bits */
944 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); 945 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
945 clear_bit(STATUS_INT_ENABLED, &trans->status); 946 clear_bit(STATUS_INT_ENABLED, &trans->status);
946 clear_bit(STATUS_DEVICE_ENABLED, &trans->status);
947 clear_bit(STATUS_TPOWER_PMI, &trans->status); 947 clear_bit(STATUS_TPOWER_PMI, &trans->status);
948 clear_bit(STATUS_RFKILL, &trans->status); 948 clear_bit(STATUS_RFKILL, &trans->status);
949 949
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 209db62ee627..77fbf3035038 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2191,7 +2191,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
2191 if (err != 0) { 2191 if (err != 0) {
2192 printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", 2192 printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n",
2193 err); 2193 err);
2194 goto failed_hw; 2194 goto failed_bind;
2195 } 2195 }
2196 2196
2197 skb_queue_head_init(&data->pending); 2197 skb_queue_head_init(&data->pending);
@@ -2397,6 +2397,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
2397 return idx; 2397 return idx;
2398 2398
2399failed_hw: 2399failed_hw:
2400 device_release_driver(data->dev);
2401failed_bind:
2400 device_unregister(data->dev); 2402 device_unregister(data->dev);
2401failed_drvdata: 2403failed_drvdata:
2402 ieee80211_free_hw(hw); 2404 ieee80211_free_hw(hw);
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 2305dc0382bc..3823edf2d012 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1280,52 +1280,6 @@ int of_property_read_string(struct device_node *np, const char *propname,
1280EXPORT_SYMBOL_GPL(of_property_read_string); 1280EXPORT_SYMBOL_GPL(of_property_read_string);
1281 1281
1282/** 1282/**
1283 * of_property_read_string_index - Find and read a string from a multiple
1284 * strings property.
1285 * @np: device node from which the property value is to be read.
1286 * @propname: name of the property to be searched.
1287 * @index: index of the string in the list of strings
1288 * @out_string: pointer to null terminated return string, modified only if
1289 * return value is 0.
1290 *
1291 * Search for a property in a device tree node and retrieve a null
1292 * terminated string value (pointer to data, not a copy) in the list of strings
1293 * contained in that property.
1294 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
1295 * property does not have a value, and -EILSEQ if the string is not
1296 * null-terminated within the length of the property data.
1297 *
1298 * The out_string pointer is modified only if a valid string can be decoded.
1299 */
1300int of_property_read_string_index(struct device_node *np, const char *propname,
1301 int index, const char **output)
1302{
1303 struct property *prop = of_find_property(np, propname, NULL);
1304 int i = 0;
1305 size_t l = 0, total = 0;
1306 const char *p;
1307
1308 if (!prop)
1309 return -EINVAL;
1310 if (!prop->value)
1311 return -ENODATA;
1312 if (strnlen(prop->value, prop->length) >= prop->length)
1313 return -EILSEQ;
1314
1315 p = prop->value;
1316
1317 for (i = 0; total < prop->length; total += l, p += l) {
1318 l = strlen(p) + 1;
1319 if (i++ == index) {
1320 *output = p;
1321 return 0;
1322 }
1323 }
1324 return -ENODATA;
1325}
1326EXPORT_SYMBOL_GPL(of_property_read_string_index);
1327
1328/**
1329 * of_property_match_string() - Find string in a list and return index 1283 * of_property_match_string() - Find string in a list and return index
1330 * @np: pointer to node containing string list property 1284 * @np: pointer to node containing string list property
1331 * @propname: string list property name 1285 * @propname: string list property name
@@ -1351,7 +1305,7 @@ int of_property_match_string(struct device_node *np, const char *propname,
1351 end = p + prop->length; 1305 end = p + prop->length;
1352 1306
1353 for (i = 0; p < end; i++, p += l) { 1307 for (i = 0; p < end; i++, p += l) {
1354 l = strlen(p) + 1; 1308 l = strnlen(p, end - p) + 1;
1355 if (p + l > end) 1309 if (p + l > end)
1356 return -EILSEQ; 1310 return -EILSEQ;
1357 pr_debug("comparing %s with %s\n", string, p); 1311 pr_debug("comparing %s with %s\n", string, p);
@@ -1363,39 +1317,41 @@ int of_property_match_string(struct device_node *np, const char *propname,
1363EXPORT_SYMBOL_GPL(of_property_match_string); 1317EXPORT_SYMBOL_GPL(of_property_match_string);
1364 1318
1365/** 1319/**
1366 * of_property_count_strings - Find and return the number of strings from a 1320 * of_property_read_string_util() - Utility helper for parsing string properties
1367 * multiple strings property.
1368 * @np: device node from which the property value is to be read. 1321 * @np: device node from which the property value is to be read.
1369 * @propname: name of the property to be searched. 1322 * @propname: name of the property to be searched.
1323 * @out_strs: output array of string pointers.
1324 * @sz: number of array elements to read.
1325 * @skip: Number of strings to skip over at beginning of list.
1370 * 1326 *
1371 * Search for a property in a device tree node and retrieve the number of null 1327 * Don't call this function directly. It is a utility helper for the
1372 * terminated string contain in it. Returns the number of strings on 1328 * of_property_read_string*() family of functions.
1373 * success, -EINVAL if the property does not exist, -ENODATA if property
1374 * does not have a value, and -EILSEQ if the string is not null-terminated
1375 * within the length of the property data.
1376 */ 1329 */
1377int of_property_count_strings(struct device_node *np, const char *propname) 1330int of_property_read_string_helper(struct device_node *np, const char *propname,
1331 const char **out_strs, size_t sz, int skip)
1378{ 1332{
1379 struct property *prop = of_find_property(np, propname, NULL); 1333 struct property *prop = of_find_property(np, propname, NULL);
1380 int i = 0; 1334 int l = 0, i = 0;
1381 size_t l = 0, total = 0; 1335 const char *p, *end;
1382 const char *p;
1383 1336
1384 if (!prop) 1337 if (!prop)
1385 return -EINVAL; 1338 return -EINVAL;
1386 if (!prop->value) 1339 if (!prop->value)
1387 return -ENODATA; 1340 return -ENODATA;
1388 if (strnlen(prop->value, prop->length) >= prop->length)
1389 return -EILSEQ;
1390
1391 p = prop->value; 1341 p = prop->value;
1342 end = p + prop->length;
1392 1343
1393 for (i = 0; total < prop->length; total += l, p += l, i++) 1344 for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l) {
1394 l = strlen(p) + 1; 1345 l = strnlen(p, end - p) + 1;
1395 1346 if (p + l > end)
1396 return i; 1347 return -EILSEQ;
1348 if (out_strs && i >= skip)
1349 *out_strs++ = p;
1350 }
1351 i -= skip;
1352 return i <= 0 ? -ENODATA : i;
1397} 1353}
1398EXPORT_SYMBOL_GPL(of_property_count_strings); 1354EXPORT_SYMBOL_GPL(of_property_read_string_helper);
1399 1355
1400void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) 1356void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
1401{ 1357{
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
index 78001270a598..11b873c54a77 100644
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -339,8 +339,9 @@ static void __init of_selftest_parse_phandle_with_args(void)
339 selftest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); 339 selftest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
340} 340}
341 341
342static void __init of_selftest_property_match_string(void) 342static void __init of_selftest_property_string(void)
343{ 343{
344 const char *strings[4];
344 struct device_node *np; 345 struct device_node *np;
345 int rc; 346 int rc;
346 347
@@ -357,13 +358,66 @@ static void __init of_selftest_property_match_string(void)
357 rc = of_property_match_string(np, "phandle-list-names", "third"); 358 rc = of_property_match_string(np, "phandle-list-names", "third");
358 selftest(rc == 2, "third expected:0 got:%i\n", rc); 359 selftest(rc == 2, "third expected:0 got:%i\n", rc);
359 rc = of_property_match_string(np, "phandle-list-names", "fourth"); 360 rc = of_property_match_string(np, "phandle-list-names", "fourth");
360 selftest(rc == -ENODATA, "unmatched string; rc=%i", rc); 361 selftest(rc == -ENODATA, "unmatched string; rc=%i\n", rc);
361 rc = of_property_match_string(np, "missing-property", "blah"); 362 rc = of_property_match_string(np, "missing-property", "blah");
362 selftest(rc == -EINVAL, "missing property; rc=%i", rc); 363 selftest(rc == -EINVAL, "missing property; rc=%i\n", rc);
363 rc = of_property_match_string(np, "empty-property", "blah"); 364 rc = of_property_match_string(np, "empty-property", "blah");
364 selftest(rc == -ENODATA, "empty property; rc=%i", rc); 365 selftest(rc == -ENODATA, "empty property; rc=%i\n", rc);
365 rc = of_property_match_string(np, "unterminated-string", "blah"); 366 rc = of_property_match_string(np, "unterminated-string", "blah");
366 selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); 367 selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc);
368
369 /* of_property_count_strings() tests */
370 rc = of_property_count_strings(np, "string-property");
371 selftest(rc == 1, "Incorrect string count; rc=%i\n", rc);
372 rc = of_property_count_strings(np, "phandle-list-names");
373 selftest(rc == 3, "Incorrect string count; rc=%i\n", rc);
374 rc = of_property_count_strings(np, "unterminated-string");
375 selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc);
376 rc = of_property_count_strings(np, "unterminated-string-list");
377 selftest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc);
378
379 /* of_property_read_string_index() tests */
380 rc = of_property_read_string_index(np, "string-property", 0, strings);
381 selftest(rc == 0 && !strcmp(strings[0], "foobar"), "of_property_read_string_index() failure; rc=%i\n", rc);
382 strings[0] = NULL;
383 rc = of_property_read_string_index(np, "string-property", 1, strings);
384 selftest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc);
385 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings);
386 selftest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\n", rc);
387 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings);
388 selftest(rc == 0 && !strcmp(strings[0], "second"), "of_property_read_string_index() failure; rc=%i\n", rc);
389 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings);
390 selftest(rc == 0 && !strcmp(strings[0], "third"), "of_property_read_string_index() failure; rc=%i\n", rc);
391 strings[0] = NULL;
392 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings);
393 selftest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc);
394 strings[0] = NULL;
395 rc = of_property_read_string_index(np, "unterminated-string", 0, strings);
396 selftest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc);
397 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings);
398 selftest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\n", rc);
399 strings[0] = NULL;
400 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */
401 selftest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc);
402 strings[1] = NULL;
403
404 /* of_property_read_string_array() tests */
405 rc = of_property_read_string_array(np, "string-property", strings, 4);
406 selftest(rc == 1, "Incorrect string count; rc=%i\n", rc);
407 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4);
408 selftest(rc == 3, "Incorrect string count; rc=%i\n", rc);
409 rc = of_property_read_string_array(np, "unterminated-string", strings, 4);
410 selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc);
411 /* -- An incorrectly formed string should cause a failure */
412 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4);
413 selftest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc);
414 /* -- parsing the correctly formed strings should still work: */
415 strings[2] = NULL;
416 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2);
417 selftest(rc == 2 && strings[2] == NULL, "of_property_read_string_array() failure; rc=%i\n", rc);
418 strings[1] = NULL;
419 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1);
420 selftest(rc == 1 && strings[1] == NULL, "Overwrote end of string array; rc=%i, str='%s'\n", rc, strings[1]);
367} 421}
368 422
369#define propcmp(p1, p2) (((p1)->length == (p2)->length) && \ 423#define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
@@ -881,7 +935,7 @@ static int __init of_selftest(void)
881 of_selftest_find_node_by_name(); 935 of_selftest_find_node_by_name();
882 of_selftest_dynamic(); 936 of_selftest_dynamic();
883 of_selftest_parse_phandle_with_args(); 937 of_selftest_parse_phandle_with_args();
884 of_selftest_property_match_string(); 938 of_selftest_property_string();
885 of_selftest_property_copy(); 939 of_selftest_property_copy();
886 of_selftest_changeset(); 940 of_selftest_changeset();
887 of_selftest_parse_interrupts(); 941 of_selftest_parse_interrupts();
diff --git a/drivers/of/testcase-data/tests-phandle.dtsi b/drivers/of/testcase-data/tests-phandle.dtsi
index ce0fe083d406..5b1527e8a7fb 100644
--- a/drivers/of/testcase-data/tests-phandle.dtsi
+++ b/drivers/of/testcase-data/tests-phandle.dtsi
@@ -39,7 +39,9 @@
39 phandle-list-bad-args = <&provider2 1 0>, 39 phandle-list-bad-args = <&provider2 1 0>,
40 <&provider3 0>; 40 <&provider3 0>;
41 empty-property; 41 empty-property;
42 string-property = "foobar";
42 unterminated-string = [40 41 42 43]; 43 unterminated-string = [40 41 42 43];
44 unterminated-string-list = "first", "second", [40 41 42 43];
43 }; 45 };
44 }; 46 };
45 }; 47 };
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 8c842980834a..f091576b6449 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -258,14 +258,16 @@ static int omap_usb2_probe(struct platform_device *pdev)
258 otg->phy = &phy->phy; 258 otg->phy = &phy->phy;
259 259
260 platform_set_drvdata(pdev, phy); 260 platform_set_drvdata(pdev, phy);
261 pm_runtime_enable(phy->dev);
261 262
262 generic_phy = devm_phy_create(phy->dev, NULL, &ops, NULL); 263 generic_phy = devm_phy_create(phy->dev, NULL, &ops, NULL);
263 if (IS_ERR(generic_phy)) 264 if (IS_ERR(generic_phy)) {
265 pm_runtime_disable(phy->dev);
264 return PTR_ERR(generic_phy); 266 return PTR_ERR(generic_phy);
267 }
265 268
266 phy_set_drvdata(generic_phy, phy); 269 phy_set_drvdata(generic_phy, phy);
267 270
268 pm_runtime_enable(phy->dev);
269 phy_provider = devm_of_phy_provider_register(phy->dev, 271 phy_provider = devm_of_phy_provider_register(phy->dev,
270 of_phy_simple_xlate); 272 of_phy_simple_xlate);
271 if (IS_ERR(phy_provider)) { 273 if (IS_ERR(phy_provider)) {
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index e12e5b07f6d7..9dc38140194b 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -227,10 +227,14 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
227 spin_lock_irqsave(&vg->lock, flags); 227 spin_lock_irqsave(&vg->lock, flags);
228 value = readl(reg); 228 value = readl(reg);
229 229
230 WARN(value & BYT_DIRECT_IRQ_EN,
231 "Bad pad config for io mode, force direct_irq_en bit clearing");
232
230 /* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits 233 /* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits
231 * are used to indicate high and low level triggering 234 * are used to indicate high and low level triggering
232 */ 235 */
233 value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); 236 value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG |
237 BYT_TRIG_LVL);
234 238
235 switch (type) { 239 switch (type) {
236 case IRQ_TYPE_LEVEL_HIGH: 240 case IRQ_TYPE_LEVEL_HIGH:
@@ -318,7 +322,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
318 "Potential Error: Setting GPIO with direct_irq_en to output"); 322 "Potential Error: Setting GPIO with direct_irq_en to output");
319 323
320 reg_val = readl(reg) | BYT_DIR_MASK; 324 reg_val = readl(reg) | BYT_DIR_MASK;
321 reg_val &= ~BYT_OUTPUT_EN; 325 reg_val &= ~(BYT_OUTPUT_EN | BYT_INPUT_EN);
322 326
323 if (value) 327 if (value)
324 writel(reg_val | BYT_LEVEL, reg); 328 writel(reg_val | BYT_LEVEL, reg);
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 96a0b75c52c9..26c4fd1394da 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -579,6 +579,17 @@ static const struct dmi_system_id video_vendor_dmi_table[] __initconst = {
579 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"), 579 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"),
580 }, 580 },
581 }, 581 },
582 {
583 /*
584 * Note no video_set_backlight_video_vendor, we must use the
585 * acer interface, as there is no native backlight interface.
586 */
587 .ident = "Acer KAV80",
588 .matches = {
589 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
590 DMI_MATCH(DMI_PRODUCT_NAME, "KAV80"),
591 },
592 },
582 {} 593 {}
583}; 594};
584 595
diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 3a4951f46065..c1a6cd66af42 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -182,6 +182,15 @@ static const struct dmi_system_id asus_quirks[] = {
182 }, 182 },
183 { 183 {
184 .callback = dmi_matched, 184 .callback = dmi_matched,
185 .ident = "ASUSTeK COMPUTER INC. X550VB",
186 .matches = {
187 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
188 DMI_MATCH(DMI_PRODUCT_NAME, "X550VB"),
189 },
190 .driver_data = &quirk_asus_wapf4,
191 },
192 {
193 .callback = dmi_matched,
185 .ident = "ASUSTeK COMPUTER INC. X55A", 194 .ident = "ASUSTeK COMPUTER INC. X55A",
186 .matches = { 195 .matches = {
187 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 196 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 02152de135b5..ed494f37c40f 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -837,6 +837,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = {
837 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"), 837 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"),
838 }, 838 },
839 }, 839 },
840 {
841 .ident = "Lenovo Yoga 3 Pro 1370",
842 .matches = {
843 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
844 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 3 Pro-1370"),
845 },
846 },
840 {} 847 {}
841}; 848};
842 849
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 5a5966512277..ff765d8e1a09 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1561,6 +1561,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
1561 }, 1561 },
1562 { 1562 {
1563 .callback = samsung_dmi_matched, 1563 .callback = samsung_dmi_matched,
1564 .ident = "NC210",
1565 .matches = {
1566 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1567 DMI_MATCH(DMI_PRODUCT_NAME, "NC210/NC110"),
1568 DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
1569 },
1570 .driver_data = &samsung_broken_acpi_video,
1571 },
1572 {
1573 .callback = samsung_dmi_matched,
1564 .ident = "730U3E/740U3E", 1574 .ident = "730U3E/740U3E",
1565 .matches = { 1575 .matches = {
1566 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1576 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index ef3a1904e92f..ab6151f05420 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -240,6 +240,12 @@ static const struct dmi_system_id toshiba_alt_keymap_dmi[] = {
240 DMI_MATCH(DMI_PRODUCT_NAME, "Qosmio X75-A"), 240 DMI_MATCH(DMI_PRODUCT_NAME, "Qosmio X75-A"),
241 }, 241 },
242 }, 242 },
243 {
244 .matches = {
245 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
246 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A50-A"),
247 },
248 },
243 {} 249 {}
244}; 250};
245 251
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index 86db310d5304..d2a8c64cae42 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -163,7 +163,7 @@ static int of_get_max1586_platform_data(struct device *dev,
163 struct max1586_platform_data *pdata) 163 struct max1586_platform_data *pdata)
164{ 164{
165 struct max1586_subdev_data *sub; 165 struct max1586_subdev_data *sub;
166 struct of_regulator_match rmatch[ARRAY_SIZE(max1586_reg)]; 166 struct of_regulator_match rmatch[ARRAY_SIZE(max1586_reg)] = { };
167 struct device_node *np = dev->of_node; 167 struct device_node *np = dev->of_node;
168 int i, matched; 168 int i, matched;
169 169
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index ef1af2debbd2..f69320e1738f 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -395,7 +395,7 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev,
395 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); 395 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
396 struct device_node *pmic_np, *regulators_np; 396 struct device_node *pmic_np, *regulators_np;
397 struct max77686_regulator_data *rdata; 397 struct max77686_regulator_data *rdata;
398 struct of_regulator_match rmatch; 398 struct of_regulator_match rmatch = { };
399 unsigned int i; 399 unsigned int i;
400 400
401 pmic_np = iodev->dev->of_node; 401 pmic_np = iodev->dev->of_node;
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index c67ff05fc1dd..d158f71fa128 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -227,7 +227,7 @@ static int max77693_pmic_probe(struct platform_device *pdev)
227 struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent); 227 struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
228 struct max77693_regulator_data *rdata = NULL; 228 struct max77693_regulator_data *rdata = NULL;
229 int num_rdata, i; 229 int num_rdata, i;
230 struct regulator_config config; 230 struct regulator_config config = { };
231 231
232 num_rdata = max77693_pmic_init_rdata(&pdev->dev, &rdata); 232 num_rdata = max77693_pmic_init_rdata(&pdev->dev, &rdata);
233 if (!rdata || num_rdata <= 0) { 233 if (!rdata || num_rdata <= 0) {
diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index d89792b084e9..45fa240fe243 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -454,7 +454,7 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev,
454 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); 454 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
455 struct device_node *pmic_np, *regulators_np; 455 struct device_node *pmic_np, *regulators_np;
456 struct max77686_regulator_data *rdata; 456 struct max77686_regulator_data *rdata;
457 struct of_regulator_match rmatch; 457 struct of_regulator_match rmatch = { };
458 unsigned int i; 458 unsigned int i;
459 459
460 pmic_np = iodev->dev->of_node; 460 pmic_np = iodev->dev->of_node;
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 2fc411188794..7eee2ca18541 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -335,7 +335,7 @@ static int max8660_pdata_from_dt(struct device *dev,
335 int matched, i; 335 int matched, i;
336 struct device_node *np; 336 struct device_node *np;
337 struct max8660_subdev_data *sub; 337 struct max8660_subdev_data *sub;
338 struct of_regulator_match rmatch[ARRAY_SIZE(max8660_reg)]; 338 struct of_regulator_match rmatch[ARRAY_SIZE(max8660_reg)] = { };
339 339
340 np = of_get_child_by_name(dev->of_node, "regulators"); 340 np = of_get_child_by_name(dev->of_node, "regulators");
341 if (!np) { 341 if (!np) {
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 7a51814abdc5..5a1d4afa4776 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -211,7 +211,8 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
211 search = dev->of_node; 211 search = dev->of_node;
212 212
213 if (!search) { 213 if (!search) {
214 dev_err(dev, "Failed to find regulator container node\n"); 214 dev_dbg(dev, "Failed to find regulator container node '%s'\n",
215 desc->regulators_node);
215 return NULL; 216 return NULL;
216 } 217 }
217 218
diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c
index 4acefa6b462e..7633b9bfbe6e 100644
--- a/drivers/regulator/s2mpa01.c
+++ b/drivers/regulator/s2mpa01.c
@@ -341,7 +341,7 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev)
341{ 341{
342 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); 342 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
343 struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); 343 struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);
344 struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX]; 344 struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX] = { };
345 struct device_node *reg_np = NULL; 345 struct device_node *reg_np = NULL;
346 struct regulator_config config = { }; 346 struct regulator_config config = { };
347 struct s2mpa01_info *s2mpa01; 347 struct s2mpa01_info *s2mpa01;
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 6cbe6ef3c889..bda52f18e967 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -888,7 +888,6 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev,
888 struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev); 888 struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev);
889 int i; 889 int i;
890 struct virtqueue *vq; 890 struct virtqueue *vq;
891 struct virtio_driver *drv;
892 891
893 if (!vcdev) 892 if (!vcdev)
894 return; 893 return;
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 54fa6e0bc1bb..674d498b46ab 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -399,6 +399,35 @@ EXPORT_SYMBOL_GPL(cxgbi_hbas_add);
399 * If the source port is outside our allocation range, the caller is 399 * If the source port is outside our allocation range, the caller is
400 * responsible for keeping track of their port usage. 400 * responsible for keeping track of their port usage.
401 */ 401 */
402
403static struct cxgbi_sock *find_sock_on_port(struct cxgbi_device *cdev,
404 unsigned char port_id)
405{
406 struct cxgbi_ports_map *pmap = &cdev->pmap;
407 unsigned int i;
408 unsigned int used;
409
410 if (!pmap->max_connect || !pmap->used)
411 return NULL;
412
413 spin_lock_bh(&pmap->lock);
414 used = pmap->used;
415 for (i = 0; used && i < pmap->max_connect; i++) {
416 struct cxgbi_sock *csk = pmap->port_csk[i];
417
418 if (csk) {
419 if (csk->port_id == port_id) {
420 spin_unlock_bh(&pmap->lock);
421 return csk;
422 }
423 used--;
424 }
425 }
426 spin_unlock_bh(&pmap->lock);
427
428 return NULL;
429}
430
402static int sock_get_port(struct cxgbi_sock *csk) 431static int sock_get_port(struct cxgbi_sock *csk)
403{ 432{
404 struct cxgbi_device *cdev = csk->cdev; 433 struct cxgbi_device *cdev = csk->cdev;
@@ -749,6 +778,7 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
749 csk->daddr6.sin6_addr = daddr6->sin6_addr; 778 csk->daddr6.sin6_addr = daddr6->sin6_addr;
750 csk->daddr6.sin6_port = daddr6->sin6_port; 779 csk->daddr6.sin6_port = daddr6->sin6_port;
751 csk->daddr6.sin6_family = daddr6->sin6_family; 780 csk->daddr6.sin6_family = daddr6->sin6_family;
781 csk->saddr6.sin6_family = daddr6->sin6_family;
752 csk->saddr6.sin6_addr = pref_saddr; 782 csk->saddr6.sin6_addr = pref_saddr;
753 783
754 neigh_release(n); 784 neigh_release(n);
@@ -2647,12 +2677,14 @@ int cxgbi_get_host_param(struct Scsi_Host *shost, enum iscsi_host_param param,
2647 break; 2677 break;
2648 case ISCSI_HOST_PARAM_IPADDRESS: 2678 case ISCSI_HOST_PARAM_IPADDRESS:
2649 { 2679 {
2650 __be32 addr; 2680 struct cxgbi_sock *csk = find_sock_on_port(chba->cdev,
2651 2681 chba->port_id);
2652 addr = cxgbi_get_iscsi_ipv4(chba); 2682 if (csk) {
2653 len = sprintf(buf, "%pI4", &addr); 2683 len = sprintf(buf, "%pIS",
2684 (struct sockaddr *)&csk->saddr);
2685 }
2654 log_debug(1 << CXGBI_DBG_ISCSI, 2686 log_debug(1 << CXGBI_DBG_ISCSI,
2655 "hba %s, ipv4 %pI4.\n", chba->ndev->name, &addr); 2687 "hba %s, addr %s.\n", chba->ndev->name, buf);
2656 break; 2688 break;
2657 } 2689 }
2658 default: 2690 default:
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 1d98fad6a0ab..2c7cb1c0c453 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -700,11 +700,6 @@ static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr)
700 chba->ndev->name); 700 chba->ndev->name);
701} 701}
702 702
703static inline __be32 cxgbi_get_iscsi_ipv4(struct cxgbi_hba *chba)
704{
705 return chba->ipv4addr;
706}
707
708struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int); 703struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int);
709void cxgbi_device_unregister(struct cxgbi_device *); 704void cxgbi_device_unregister(struct cxgbi_device *);
710void cxgbi_device_unregister_all(unsigned int flag); 705void cxgbi_device_unregister_all(unsigned int flag);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 9eff8a375132..50a6e1ac8d9c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1893,6 +1893,11 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req,
1893 blk_mq_start_request(req); 1893 blk_mq_start_request(req);
1894 } 1894 }
1895 1895
1896 if (blk_queue_tagged(q))
1897 req->cmd_flags |= REQ_QUEUED;
1898 else
1899 req->cmd_flags &= ~REQ_QUEUED;
1900
1896 scsi_init_cmd_errh(cmd); 1901 scsi_init_cmd_errh(cmd);
1897 cmd->scsi_done = scsi_mq_done; 1902 cmd->scsi_done = scsi_mq_done;
1898 1903
diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c
index cea8ea3491d2..1a07bf540fec 100644
--- a/drivers/soc/versatile/soc-realview.c
+++ b/drivers/soc/versatile/soc-realview.c
@@ -26,6 +26,7 @@ static const struct of_device_id realview_soc_of_match[] = {
26 { .compatible = "arm,realview-pb11mp-soc", }, 26 { .compatible = "arm,realview-pb11mp-soc", },
27 { .compatible = "arm,realview-pba8-soc", }, 27 { .compatible = "arm,realview-pba8-soc", },
28 { .compatible = "arm,realview-pbx-soc", }, 28 { .compatible = "arm,realview-pbx-soc", },
29 { }
29}; 30};
30 31
31static u32 realview_coreid; 32static u32 realview_coreid;
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 448216025ce8..831ceb4a91f6 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -46,7 +46,7 @@
46 46
47#define SPI_TCR 0x08 47#define SPI_TCR 0x08
48 48
49#define SPI_CTAR(x) (0x0c + (x * 4)) 49#define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4))
50#define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) 50#define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27)
51#define SPI_CTAR_CPOL(x) ((x) << 26) 51#define SPI_CTAR_CPOL(x) ((x) << 26)
52#define SPI_CTAR_CPHA(x) ((x) << 25) 52#define SPI_CTAR_CPHA(x) ((x) << 25)
@@ -70,7 +70,7 @@
70 70
71#define SPI_PUSHR 0x34 71#define SPI_PUSHR 0x34
72#define SPI_PUSHR_CONT (1 << 31) 72#define SPI_PUSHR_CONT (1 << 31)
73#define SPI_PUSHR_CTAS(x) (((x) & 0x00000007) << 28) 73#define SPI_PUSHR_CTAS(x) (((x) & 0x00000003) << 28)
74#define SPI_PUSHR_EOQ (1 << 27) 74#define SPI_PUSHR_EOQ (1 << 27)
75#define SPI_PUSHR_CTCNT (1 << 26) 75#define SPI_PUSHR_CTCNT (1 << 26)
76#define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16) 76#define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16)
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index d8a105f76837..9e9e0f971e6c 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1274,7 +1274,9 @@ static int pxa2xx_spi_suspend(struct device *dev)
1274 if (status != 0) 1274 if (status != 0)
1275 return status; 1275 return status;
1276 write_SSCR0(0, drv_data->ioaddr); 1276 write_SSCR0(0, drv_data->ioaddr);
1277 clk_disable_unprepare(ssp->clk); 1277
1278 if (!pm_runtime_suspended(dev))
1279 clk_disable_unprepare(ssp->clk);
1278 1280
1279 return 0; 1281 return 0;
1280} 1282}
@@ -1288,7 +1290,8 @@ static int pxa2xx_spi_resume(struct device *dev)
1288 pxa2xx_spi_dma_resume(drv_data); 1290 pxa2xx_spi_dma_resume(drv_data);
1289 1291
1290 /* Enable the SSP clock */ 1292 /* Enable the SSP clock */
1291 clk_prepare_enable(ssp->clk); 1293 if (!pm_runtime_suspended(dev))
1294 clk_prepare_enable(ssp->clk);
1292 1295
1293 /* Restore LPSS private register bits */ 1296 /* Restore LPSS private register bits */
1294 lpss_ssp_setup(drv_data); 1297 lpss_ssp_setup(drv_data);
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 28b93d39a94e..a673ffa34aa3 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -420,7 +420,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
420 struct logger_log *log = file_get_log(iocb->ki_filp); 420 struct logger_log *log = file_get_log(iocb->ki_filp);
421 struct logger_entry header; 421 struct logger_entry header;
422 struct timespec now; 422 struct timespec now;
423 size_t len, count; 423 size_t len, count, w_off;
424 424
425 count = min_t(size_t, iocb->ki_nbytes, LOGGER_ENTRY_MAX_PAYLOAD); 425 count = min_t(size_t, iocb->ki_nbytes, LOGGER_ENTRY_MAX_PAYLOAD);
426 426
@@ -452,11 +452,14 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
452 memcpy(log->buffer + log->w_off, &header, len); 452 memcpy(log->buffer + log->w_off, &header, len);
453 memcpy(log->buffer, (char *)&header + len, sizeof(header) - len); 453 memcpy(log->buffer, (char *)&header + len, sizeof(header) - len);
454 454
455 len = min(count, log->size - log->w_off); 455 /* Work with a copy until we are ready to commit the whole entry */
456 w_off = logger_offset(log, log->w_off + sizeof(struct logger_entry));
456 457
457 if (copy_from_iter(log->buffer + log->w_off, len, from) != len) { 458 len = min(count, log->size - w_off);
459
460 if (copy_from_iter(log->buffer + w_off, len, from) != len) {
458 /* 461 /*
459 * Note that by not updating w_off, this abandons the 462 * Note that by not updating log->w_off, this abandons the
460 * portion of the new entry that *was* successfully 463 * portion of the new entry that *was* successfully
461 * copied, just above. This is intentional to avoid 464 * copied, just above. This is intentional to avoid
462 * message corruption from missing fragments. 465 * message corruption from missing fragments.
@@ -470,7 +473,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
470 return -EFAULT; 473 return -EFAULT;
471 } 474 }
472 475
473 log->w_off = logger_offset(log, log->w_off + count); 476 log->w_off = logger_offset(log, w_off + count);
474 mutex_unlock(&log->mutex); 477 mutex_unlock(&log->mutex);
475 478
476 /* wake up any blocked readers */ 479 /* wake up any blocked readers */
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index a8bc2b567789..152f4c12ea43 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -426,6 +426,7 @@ config COMEDI_AIO_IIRO_16
426 426
427config COMEDI_II_PCI20KC 427config COMEDI_II_PCI20KC
428 tristate "Intelligent Instruments PCI-20001C carrier support" 428 tristate "Intelligent Instruments PCI-20001C carrier support"
429 depends on HAS_IOMEM
429 ---help--- 430 ---help---
430 Enable support for Intelligent Instruments PCI-20001C carrier 431 Enable support for Intelligent Instruments PCI-20001C carrier
431 PCI-20001, PCI-20006 and PCI-20341 432 PCI-20001, PCI-20006 and PCI-20341
@@ -667,7 +668,6 @@ config COMEDI_ADDI_APCI_2200
667config COMEDI_ADDI_APCI_3120 668config COMEDI_ADDI_APCI_3120
668 tristate "ADDI-DATA APCI_3120/3001 support" 669 tristate "ADDI-DATA APCI_3120/3001 support"
669 depends on HAS_DMA 670 depends on HAS_DMA
670 depends on VIRT_TO_BUS
671 ---help--- 671 ---help---
672 Enable support for ADDI-DATA APCI_3120/3001 cards 672 Enable support for ADDI-DATA APCI_3120/3001 cards
673 673
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 495969f46e76..9c32f0276009 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1462,10 +1462,7 @@ static int __comedi_get_user_chanlist(struct comedi_device *dev,
1462 unsigned int *chanlist; 1462 unsigned int *chanlist;
1463 int ret; 1463 int ret;
1464 1464
1465 /* user_chanlist could be NULL for do_cmdtest ioctls */ 1465 cmd->chanlist = NULL;
1466 if (!user_chanlist)
1467 return 0;
1468
1469 chanlist = memdup_user(user_chanlist, 1466 chanlist = memdup_user(user_chanlist,
1470 cmd->chanlist_len * sizeof(unsigned int)); 1467 cmd->chanlist_len * sizeof(unsigned int));
1471 if (IS_ERR(chanlist)) 1468 if (IS_ERR(chanlist))
@@ -1609,13 +1606,18 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
1609 1606
1610 s = &dev->subdevices[cmd.subdev]; 1607 s = &dev->subdevices[cmd.subdev];
1611 1608
1612 /* load channel/gain list */ 1609 /* user_chanlist can be NULL for COMEDI_CMDTEST ioctl */
1613 ret = __comedi_get_user_chanlist(dev, s, user_chanlist, &cmd); 1610 if (user_chanlist) {
1614 if (ret) 1611 /* load channel/gain list */
1615 return ret; 1612 ret = __comedi_get_user_chanlist(dev, s, user_chanlist, &cmd);
1613 if (ret)
1614 return ret;
1615 }
1616 1616
1617 ret = s->do_cmdtest(dev, s, &cmd); 1617 ret = s->do_cmdtest(dev, s, &cmd);
1618 1618
1619 kfree(cmd.chanlist); /* free kernel copy of user chanlist */
1620
1619 /* restore chanlist pointer before copying back */ 1621 /* restore chanlist pointer before copying back */
1620 cmd.chanlist = (unsigned int __force *)user_chanlist; 1622 cmd.chanlist = (unsigned int __force *)user_chanlist;
1621 1623
@@ -1642,7 +1644,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
1642 1644
1643*/ 1645*/
1644 1646
1645static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, 1647static int do_lock_ioctl(struct comedi_device *dev, unsigned long arg,
1646 void *file) 1648 void *file)
1647{ 1649{
1648 int ret = 0; 1650 int ret = 0;
@@ -1679,7 +1681,7 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
1679 This function isn't protected by the semaphore, since 1681 This function isn't protected by the semaphore, since
1680 we already own the lock. 1682 we already own the lock.
1681*/ 1683*/
1682static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, 1684static int do_unlock_ioctl(struct comedi_device *dev, unsigned long arg,
1683 void *file) 1685 void *file)
1684{ 1686{
1685 struct comedi_subdevice *s; 1687 struct comedi_subdevice *s;
@@ -1714,7 +1716,7 @@ static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
1714 nothing 1716 nothing
1715 1717
1716*/ 1718*/
1717static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, 1719static int do_cancel_ioctl(struct comedi_device *dev, unsigned long arg,
1718 void *file) 1720 void *file)
1719{ 1721{
1720 struct comedi_subdevice *s; 1722 struct comedi_subdevice *s;
@@ -1751,7 +1753,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
1751 nothing 1753 nothing
1752 1754
1753*/ 1755*/
1754static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg, 1756static int do_poll_ioctl(struct comedi_device *dev, unsigned long arg,
1755 void *file) 1757 void *file)
1756{ 1758{
1757 struct comedi_subdevice *s; 1759 struct comedi_subdevice *s;
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 32a19264a170..2a29b9baec0d 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1559,14 +1559,16 @@ static int mxs_lradc_probe(struct platform_device *pdev)
1559 /* Grab all IRQ sources */ 1559 /* Grab all IRQ sources */
1560 for (i = 0; i < of_cfg->irq_count; i++) { 1560 for (i = 0; i < of_cfg->irq_count; i++) {
1561 lradc->irq[i] = platform_get_irq(pdev, i); 1561 lradc->irq[i] = platform_get_irq(pdev, i);
1562 if (lradc->irq[i] < 0) 1562 if (lradc->irq[i] < 0) {
1563 return lradc->irq[i]; 1563 ret = lradc->irq[i];
1564 goto err_clk;
1565 }
1564 1566
1565 ret = devm_request_irq(dev, lradc->irq[i], 1567 ret = devm_request_irq(dev, lradc->irq[i],
1566 mxs_lradc_handle_irq, 0, 1568 mxs_lradc_handle_irq, 0,
1567 of_cfg->irq_name[i], iio); 1569 of_cfg->irq_name[i], iio);
1568 if (ret) 1570 if (ret)
1569 return ret; 1571 goto err_clk;
1570 } 1572 }
1571 1573
1572 lradc->vref_mv = of_cfg->vref_mv; 1574 lradc->vref_mv = of_cfg->vref_mv;
@@ -1588,7 +1590,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
1588 &mxs_lradc_trigger_handler, 1590 &mxs_lradc_trigger_handler,
1589 &mxs_lradc_buffer_ops); 1591 &mxs_lradc_buffer_ops);
1590 if (ret) 1592 if (ret)
1591 return ret; 1593 goto err_clk;
1592 1594
1593 ret = mxs_lradc_trigger_init(iio); 1595 ret = mxs_lradc_trigger_init(iio);
1594 if (ret) 1596 if (ret)
@@ -1643,6 +1645,8 @@ err_dev:
1643 mxs_lradc_trigger_remove(iio); 1645 mxs_lradc_trigger_remove(iio);
1644err_trig: 1646err_trig:
1645 iio_triggered_buffer_cleanup(iio); 1647 iio_triggered_buffer_cleanup(iio);
1648err_clk:
1649 clk_disable_unprepare(lradc->clk);
1646 return ret; 1650 return ret;
1647} 1651}
1648 1652
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index d0c89d0457de..b6bd609c3655 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -115,6 +115,7 @@ static const struct iio_chan_spec ad5933_channels[] = {
115 .channel = 0, 115 .channel = 0,
116 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), 116 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
117 .address = AD5933_REG_TEMP_DATA, 117 .address = AD5933_REG_TEMP_DATA,
118 .scan_index = -1,
118 .scan_type = { 119 .scan_type = {
119 .sign = 's', 120 .sign = 's',
120 .realbits = 14, 121 .realbits = 14,
@@ -124,9 +125,7 @@ static const struct iio_chan_spec ad5933_channels[] = {
124 .type = IIO_VOLTAGE, 125 .type = IIO_VOLTAGE,
125 .indexed = 1, 126 .indexed = 1,
126 .channel = 0, 127 .channel = 0,
127 .extend_name = "real_raw", 128 .extend_name = "real",
128 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
129 BIT(IIO_CHAN_INFO_SCALE),
130 .address = AD5933_REG_REAL_DATA, 129 .address = AD5933_REG_REAL_DATA,
131 .scan_index = 0, 130 .scan_index = 0,
132 .scan_type = { 131 .scan_type = {
@@ -138,9 +137,7 @@ static const struct iio_chan_spec ad5933_channels[] = {
138 .type = IIO_VOLTAGE, 137 .type = IIO_VOLTAGE,
139 .indexed = 1, 138 .indexed = 1,
140 .channel = 0, 139 .channel = 0,
141 .extend_name = "imag_raw", 140 .extend_name = "imag",
142 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
143 BIT(IIO_CHAN_INFO_SCALE),
144 .address = AD5933_REG_IMAG_DATA, 141 .address = AD5933_REG_IMAG_DATA,
145 .scan_index = 1, 142 .scan_index = 1,
146 .scan_type = { 143 .scan_type = {
@@ -749,14 +746,14 @@ static int ad5933_probe(struct i2c_client *client,
749 indio_dev->name = id->name; 746 indio_dev->name = id->name;
750 indio_dev->modes = INDIO_DIRECT_MODE; 747 indio_dev->modes = INDIO_DIRECT_MODE;
751 indio_dev->channels = ad5933_channels; 748 indio_dev->channels = ad5933_channels;
752 indio_dev->num_channels = 1; /* only register temp0_input */ 749 indio_dev->num_channels = ARRAY_SIZE(ad5933_channels);
753 750
754 ret = ad5933_register_ring_funcs_and_init(indio_dev); 751 ret = ad5933_register_ring_funcs_and_init(indio_dev);
755 if (ret) 752 if (ret)
756 goto error_disable_reg; 753 goto error_disable_reg;
757 754
758 /* skip temp0_input, register in0_(real|imag)_raw */ 755 ret = iio_buffer_register(indio_dev, ad5933_channels,
759 ret = iio_buffer_register(indio_dev, &ad5933_channels[1], 2); 756 ARRAY_SIZE(ad5933_channels));
760 if (ret) 757 if (ret)
761 goto error_unreg_ring; 758 goto error_unreg_ring;
762 759
diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h
index 07318203a836..e8c98cf57070 100644
--- a/drivers/staging/iio/meter/ade7758.h
+++ b/drivers/staging/iio/meter/ade7758.h
@@ -119,7 +119,6 @@ struct ade7758_state {
119 u8 *tx; 119 u8 *tx;
120 u8 *rx; 120 u8 *rx;
121 struct mutex buf_lock; 121 struct mutex buf_lock;
122 const struct iio_chan_spec *ade7758_ring_channels;
123 struct spi_transfer ring_xfer[4]; 122 struct spi_transfer ring_xfer[4];
124 struct spi_message ring_msg; 123 struct spi_message ring_msg;
125 /* 124 /*
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index abc60067cd72..fb373b89dcc2 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -634,9 +634,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
634 .type = IIO_VOLTAGE, 634 .type = IIO_VOLTAGE,
635 .indexed = 1, 635 .indexed = 1,
636 .channel = 0, 636 .channel = 0,
637 .extend_name = "raw",
638 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
639 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
640 .address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE), 637 .address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE),
641 .scan_index = 0, 638 .scan_index = 0,
642 .scan_type = { 639 .scan_type = {
@@ -648,9 +645,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
648 .type = IIO_CURRENT, 645 .type = IIO_CURRENT,
649 .indexed = 1, 646 .indexed = 1,
650 .channel = 0, 647 .channel = 0,
651 .extend_name = "raw",
652 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
653 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
654 .address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT), 648 .address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT),
655 .scan_index = 1, 649 .scan_index = 1,
656 .scan_type = { 650 .scan_type = {
@@ -662,9 +656,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
662 .type = IIO_POWER, 656 .type = IIO_POWER,
663 .indexed = 1, 657 .indexed = 1,
664 .channel = 0, 658 .channel = 0,
665 .extend_name = "apparent_raw", 659 .extend_name = "apparent",
666 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
667 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
668 .address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR), 660 .address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR),
669 .scan_index = 2, 661 .scan_index = 2,
670 .scan_type = { 662 .scan_type = {
@@ -676,9 +668,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
676 .type = IIO_POWER, 668 .type = IIO_POWER,
677 .indexed = 1, 669 .indexed = 1,
678 .channel = 0, 670 .channel = 0,
679 .extend_name = "active_raw", 671 .extend_name = "active",
680 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
681 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
682 .address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR), 672 .address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR),
683 .scan_index = 3, 673 .scan_index = 3,
684 .scan_type = { 674 .scan_type = {
@@ -690,9 +680,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
690 .type = IIO_POWER, 680 .type = IIO_POWER,
691 .indexed = 1, 681 .indexed = 1,
692 .channel = 0, 682 .channel = 0,
693 .extend_name = "reactive_raw", 683 .extend_name = "reactive",
694 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
695 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
696 .address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR), 684 .address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR),
697 .scan_index = 4, 685 .scan_index = 4,
698 .scan_type = { 686 .scan_type = {
@@ -704,9 +692,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
704 .type = IIO_VOLTAGE, 692 .type = IIO_VOLTAGE,
705 .indexed = 1, 693 .indexed = 1,
706 .channel = 1, 694 .channel = 1,
707 .extend_name = "raw",
708 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
709 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
710 .address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE), 695 .address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE),
711 .scan_index = 5, 696 .scan_index = 5,
712 .scan_type = { 697 .scan_type = {
@@ -718,9 +703,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
718 .type = IIO_CURRENT, 703 .type = IIO_CURRENT,
719 .indexed = 1, 704 .indexed = 1,
720 .channel = 1, 705 .channel = 1,
721 .extend_name = "raw",
722 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
723 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
724 .address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT), 706 .address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT),
725 .scan_index = 6, 707 .scan_index = 6,
726 .scan_type = { 708 .scan_type = {
@@ -732,9 +714,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
732 .type = IIO_POWER, 714 .type = IIO_POWER,
733 .indexed = 1, 715 .indexed = 1,
734 .channel = 1, 716 .channel = 1,
735 .extend_name = "apparent_raw", 717 .extend_name = "apparent",
736 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
737 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
738 .address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR), 718 .address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR),
739 .scan_index = 7, 719 .scan_index = 7,
740 .scan_type = { 720 .scan_type = {
@@ -746,9 +726,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
746 .type = IIO_POWER, 726 .type = IIO_POWER,
747 .indexed = 1, 727 .indexed = 1,
748 .channel = 1, 728 .channel = 1,
749 .extend_name = "active_raw", 729 .extend_name = "active",
750 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
751 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
752 .address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR), 730 .address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR),
753 .scan_index = 8, 731 .scan_index = 8,
754 .scan_type = { 732 .scan_type = {
@@ -760,9 +738,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
760 .type = IIO_POWER, 738 .type = IIO_POWER,
761 .indexed = 1, 739 .indexed = 1,
762 .channel = 1, 740 .channel = 1,
763 .extend_name = "reactive_raw", 741 .extend_name = "reactive",
764 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
765 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
766 .address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR), 742 .address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR),
767 .scan_index = 9, 743 .scan_index = 9,
768 .scan_type = { 744 .scan_type = {
@@ -774,9 +750,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
774 .type = IIO_VOLTAGE, 750 .type = IIO_VOLTAGE,
775 .indexed = 1, 751 .indexed = 1,
776 .channel = 2, 752 .channel = 2,
777 .extend_name = "raw",
778 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
779 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
780 .address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE), 753 .address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE),
781 .scan_index = 10, 754 .scan_index = 10,
782 .scan_type = { 755 .scan_type = {
@@ -788,9 +761,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
788 .type = IIO_CURRENT, 761 .type = IIO_CURRENT,
789 .indexed = 1, 762 .indexed = 1,
790 .channel = 2, 763 .channel = 2,
791 .extend_name = "raw",
792 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
793 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
794 .address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT), 764 .address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT),
795 .scan_index = 11, 765 .scan_index = 11,
796 .scan_type = { 766 .scan_type = {
@@ -802,9 +772,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
802 .type = IIO_POWER, 772 .type = IIO_POWER,
803 .indexed = 1, 773 .indexed = 1,
804 .channel = 2, 774 .channel = 2,
805 .extend_name = "apparent_raw", 775 .extend_name = "apparent",
806 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
807 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
808 .address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR), 776 .address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR),
809 .scan_index = 12, 777 .scan_index = 12,
810 .scan_type = { 778 .scan_type = {
@@ -816,9 +784,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
816 .type = IIO_POWER, 784 .type = IIO_POWER,
817 .indexed = 1, 785 .indexed = 1,
818 .channel = 2, 786 .channel = 2,
819 .extend_name = "active_raw", 787 .extend_name = "active",
820 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
821 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
822 .address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR), 788 .address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR),
823 .scan_index = 13, 789 .scan_index = 13,
824 .scan_type = { 790 .scan_type = {
@@ -830,9 +796,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
830 .type = IIO_POWER, 796 .type = IIO_POWER,
831 .indexed = 1, 797 .indexed = 1,
832 .channel = 2, 798 .channel = 2,
833 .extend_name = "reactive_raw", 799 .extend_name = "reactive",
834 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
835 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
836 .address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR), 800 .address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR),
837 .scan_index = 14, 801 .scan_index = 14,
838 .scan_type = { 802 .scan_type = {
@@ -873,13 +837,14 @@ static int ade7758_probe(struct spi_device *spi)
873 goto error_free_rx; 837 goto error_free_rx;
874 } 838 }
875 st->us = spi; 839 st->us = spi;
876 st->ade7758_ring_channels = &ade7758_channels[0];
877 mutex_init(&st->buf_lock); 840 mutex_init(&st->buf_lock);
878 841
879 indio_dev->name = spi->dev.driver->name; 842 indio_dev->name = spi->dev.driver->name;
880 indio_dev->dev.parent = &spi->dev; 843 indio_dev->dev.parent = &spi->dev;
881 indio_dev->info = &ade7758_info; 844 indio_dev->info = &ade7758_info;
882 indio_dev->modes = INDIO_DIRECT_MODE; 845 indio_dev->modes = INDIO_DIRECT_MODE;
846 indio_dev->channels = ade7758_channels;
847 indio_dev->num_channels = ARRAY_SIZE(ade7758_channels);
883 848
884 ret = ade7758_configure_ring(indio_dev); 849 ret = ade7758_configure_ring(indio_dev);
885 if (ret) 850 if (ret)
diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c
index c0accf8cce93..6e9006490742 100644
--- a/drivers/staging/iio/meter/ade7758_ring.c
+++ b/drivers/staging/iio/meter/ade7758_ring.c
@@ -85,17 +85,16 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
85 **/ 85 **/
86static int ade7758_ring_preenable(struct iio_dev *indio_dev) 86static int ade7758_ring_preenable(struct iio_dev *indio_dev)
87{ 87{
88 struct ade7758_state *st = iio_priv(indio_dev);
89 unsigned channel; 88 unsigned channel;
90 89
91 if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) 90 if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
92 return -EINVAL; 91 return -EINVAL;
93 92
94 channel = find_first_bit(indio_dev->active_scan_mask, 93 channel = find_first_bit(indio_dev->active_scan_mask,
95 indio_dev->masklength); 94 indio_dev->masklength);
96 95
97 ade7758_write_waveform_type(&indio_dev->dev, 96 ade7758_write_waveform_type(&indio_dev->dev,
98 st->ade7758_ring_channels[channel].address); 97 indio_dev->channels[channel].address);
99 98
100 return 0; 99 return 0;
101} 100}
diff --git a/drivers/staging/rtl8723au/include/rtw_eeprom.h b/drivers/staging/rtl8723au/include/rtw_eeprom.h
index e5121a2a64b4..a86f36e49dd1 100644
--- a/drivers/staging/rtl8723au/include/rtw_eeprom.h
+++ b/drivers/staging/rtl8723au/include/rtw_eeprom.h
@@ -107,12 +107,12 @@ enum rt_customer_id
107}; 107};
108 108
109struct eeprom_priv { 109struct eeprom_priv {
110 u8 mac_addr[6]; /* PermanentAddress */
110 u8 bautoload_fail_flag; 111 u8 bautoload_fail_flag;
111 u8 bloadfile_fail_flag; 112 u8 bloadfile_fail_flag;
112 u8 bloadmac_fail_flag; 113 u8 bloadmac_fail_flag;
113 /* u8 bempty; */ 114 /* u8 bempty; */
114 /* u8 sys_config; */ 115 /* u8 sys_config; */
115 u8 mac_addr[6]; /* PermanentAddress */
116 /* u8 config0; */ 116 /* u8 config0; */
117 u16 channel_plan; 117 u16 channel_plan;
118 /* u8 country_string[3]; */ 118 /* u8 country_string[3]; */
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 461bf3d033a0..5a1f1070b702 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -459,6 +459,10 @@ static int imx_thermal_probe(struct platform_device *pdev)
459 int measure_freq; 459 int measure_freq;
460 int ret; 460 int ret;
461 461
462 if (!cpufreq_get_current_driver()) {
463 dev_dbg(&pdev->dev, "no cpufreq driver!");
464 return -EPROBE_DEFER;
465 }
462 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 466 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
463 if (!data) 467 if (!data)
464 return -ENOMEM; 468 return -ENOMEM;
@@ -521,6 +525,30 @@ static int imx_thermal_probe(struct platform_device *pdev)
521 return ret; 525 return ret;
522 } 526 }
523 527
528 data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
529 if (IS_ERR(data->thermal_clk)) {
530 ret = PTR_ERR(data->thermal_clk);
531 if (ret != -EPROBE_DEFER)
532 dev_err(&pdev->dev,
533 "failed to get thermal clk: %d\n", ret);
534 cpufreq_cooling_unregister(data->cdev);
535 return ret;
536 }
537
538 /*
539 * Thermal sensor needs clk on to get correct value, normally
540 * we should enable its clk before taking measurement and disable
541 * clk after measurement is done, but if alarm function is enabled,
542 * hardware will auto measure the temperature periodically, so we
543 * need to keep the clk always on for alarm function.
544 */
545 ret = clk_prepare_enable(data->thermal_clk);
546 if (ret) {
547 dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
548 cpufreq_cooling_unregister(data->cdev);
549 return ret;
550 }
551
524 data->tz = thermal_zone_device_register("imx_thermal_zone", 552 data->tz = thermal_zone_device_register("imx_thermal_zone",
525 IMX_TRIP_NUM, 553 IMX_TRIP_NUM,
526 BIT(IMX_TRIP_PASSIVE), data, 554 BIT(IMX_TRIP_PASSIVE), data,
@@ -531,26 +559,11 @@ static int imx_thermal_probe(struct platform_device *pdev)
531 ret = PTR_ERR(data->tz); 559 ret = PTR_ERR(data->tz);
532 dev_err(&pdev->dev, 560 dev_err(&pdev->dev,
533 "failed to register thermal zone device %d\n", ret); 561 "failed to register thermal zone device %d\n", ret);
562 clk_disable_unprepare(data->thermal_clk);
534 cpufreq_cooling_unregister(data->cdev); 563 cpufreq_cooling_unregister(data->cdev);
535 return ret; 564 return ret;
536 } 565 }
537 566
538 data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
539 if (IS_ERR(data->thermal_clk)) {
540 dev_warn(&pdev->dev, "failed to get thermal clk!\n");
541 } else {
542 /*
543 * Thermal sensor needs clk on to get correct value, normally
544 * we should enable its clk before taking measurement and disable
545 * clk after measurement is done, but if alarm function is enabled,
546 * hardware will auto measure the temperature periodically, so we
547 * need to keep the clk always on for alarm function.
548 */
549 ret = clk_prepare_enable(data->thermal_clk);
550 if (ret)
551 dev_warn(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
552 }
553
554 /* Enable measurements at ~ 10 Hz */ 567 /* Enable measurements at ~ 10 Hz */
555 regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ); 568 regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ);
556 measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */ 569 measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */
diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
index d20dba986f0f..6e9fb62eb817 100644
--- a/drivers/thermal/int340x_thermal/int3403_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
@@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
92 if (ACPI_FAILURE(status)) 92 if (ACPI_FAILURE(status))
93 return -EIO; 93 return -EIO;
94 94
95 *temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET); 95 /*
96 * Thermal hysteresis represents a temperature difference.
97 * Kelvin and Celsius have same degree size. So the
98 * conversion here between tenths of degree Kelvin unit
99 * and Milli-Celsius unit is just to multiply 100.
100 */
101 *temp = hyst * 100;
96 102
97 return 0; 103 return 0;
98} 104}
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index f8eb625b8400..62143ba31001 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -387,15 +387,18 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
387 int (*get_trend)(void *, long *)) 387 int (*get_trend)(void *, long *))
388{ 388{
389 struct device_node *np, *child, *sensor_np; 389 struct device_node *np, *child, *sensor_np;
390 struct thermal_zone_device *tzd = ERR_PTR(-ENODEV);
390 391
391 np = of_find_node_by_name(NULL, "thermal-zones"); 392 np = of_find_node_by_name(NULL, "thermal-zones");
392 if (!np) 393 if (!np)
393 return ERR_PTR(-ENODEV); 394 return ERR_PTR(-ENODEV);
394 395
395 if (!dev || !dev->of_node) 396 if (!dev || !dev->of_node) {
397 of_node_put(np);
396 return ERR_PTR(-EINVAL); 398 return ERR_PTR(-EINVAL);
399 }
397 400
398 sensor_np = dev->of_node; 401 sensor_np = of_node_get(dev->of_node);
399 402
400 for_each_child_of_node(np, child) { 403 for_each_child_of_node(np, child) {
401 struct of_phandle_args sensor_specs; 404 struct of_phandle_args sensor_specs;
@@ -422,16 +425,21 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
422 } 425 }
423 426
424 if (sensor_specs.np == sensor_np && id == sensor_id) { 427 if (sensor_specs.np == sensor_np && id == sensor_id) {
425 of_node_put(np); 428 tzd = thermal_zone_of_add_sensor(child, sensor_np,
426 return thermal_zone_of_add_sensor(child, sensor_np, 429 data,
427 data, 430 get_temp,
428 get_temp, 431 get_trend);
429 get_trend); 432 of_node_put(sensor_specs.np);
433 of_node_put(child);
434 goto exit;
430 } 435 }
436 of_node_put(sensor_specs.np);
431 } 437 }
438exit:
439 of_node_put(sensor_np);
432 of_node_put(np); 440 of_node_put(np);
433 441
434 return ERR_PTR(-ENODEV); 442 return tzd;
435} 443}
436EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register); 444EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register);
437 445
@@ -623,6 +631,7 @@ static int thermal_of_populate_trip(struct device_node *np,
623 631
624 /* Required for cooling map matching */ 632 /* Required for cooling map matching */
625 trip->np = np; 633 trip->np = np;
634 of_node_get(np);
626 635
627 return 0; 636 return 0;
628} 637}
@@ -730,9 +739,14 @@ finish:
730 return tz; 739 return tz;
731 740
732free_tbps: 741free_tbps:
742 for (i = 0; i < tz->num_tbps; i++)
743 of_node_put(tz->tbps[i].cooling_device);
733 kfree(tz->tbps); 744 kfree(tz->tbps);
734free_trips: 745free_trips:
746 for (i = 0; i < tz->ntrips; i++)
747 of_node_put(tz->trips[i].np);
735 kfree(tz->trips); 748 kfree(tz->trips);
749 of_node_put(gchild);
736free_tz: 750free_tz:
737 kfree(tz); 751 kfree(tz);
738 of_node_put(child); 752 of_node_put(child);
@@ -742,7 +756,13 @@ free_tz:
742 756
743static inline void of_thermal_free_zone(struct __thermal_zone *tz) 757static inline void of_thermal_free_zone(struct __thermal_zone *tz)
744{ 758{
759 int i;
760
761 for (i = 0; i < tz->num_tbps; i++)
762 of_node_put(tz->tbps[i].cooling_device);
745 kfree(tz->tbps); 763 kfree(tz->tbps);
764 for (i = 0; i < tz->ntrips; i++)
765 of_node_put(tz->trips[i].np);
746 kfree(tz->trips); 766 kfree(tz->trips);
747 kfree(tz); 767 kfree(tz);
748} 768}
@@ -814,10 +834,13 @@ int __init of_parse_thermal_zones(void)
814 /* attempting to build remaining zones still */ 834 /* attempting to build remaining zones still */
815 } 835 }
816 } 836 }
837 of_node_put(np);
817 838
818 return 0; 839 return 0;
819 840
820exit_free: 841exit_free:
842 of_node_put(child);
843 of_node_put(np);
821 of_thermal_free_zone(tz); 844 of_thermal_free_zone(tz);
822 845
823 /* no memory available, so free what we have built */ 846 /* no memory available, so free what we have built */
@@ -859,4 +882,5 @@ void of_thermal_destroy_zones(void)
859 kfree(zone->ops); 882 kfree(zone->ops);
860 of_thermal_free_zone(zone->devdata); 883 of_thermal_free_zone(zone->devdata);
861 } 884 }
885 of_node_put(np);
862} 886}
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h b/drivers/thermal/samsung/exynos_thermal_common.h
index 3eb2ed9ea3a4..158f5aa8dc5d 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.h
+++ b/drivers/thermal/samsung/exynos_thermal_common.h
@@ -27,7 +27,7 @@
27#define SENSOR_NAME_LEN 16 27#define SENSOR_NAME_LEN 16
28#define MAX_TRIP_COUNT 8 28#define MAX_TRIP_COUNT 8
29#define MAX_COOLING_DEVICE 4 29#define MAX_COOLING_DEVICE 4
30#define MAX_THRESHOLD_LEVS 5 30#define MAX_TRIMINFO_CTRL_REG 2
31 31
32#define ACTIVE_INTERVAL 500 32#define ACTIVE_INTERVAL 500
33#define IDLE_INTERVAL 10000 33#define IDLE_INTERVAL 10000
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index acbff14da3a4..49c09243fd38 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -77,16 +77,6 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp)
77 struct exynos_tmu_platform_data *pdata = data->pdata; 77 struct exynos_tmu_platform_data *pdata = data->pdata;
78 int temp_code; 78 int temp_code;
79 79
80 if (pdata->cal_mode == HW_MODE)
81 return temp;
82
83 if (data->soc == SOC_ARCH_EXYNOS4210)
84 /* temp should range between 25 and 125 */
85 if (temp < 25 || temp > 125) {
86 temp_code = -EINVAL;
87 goto out;
88 }
89
90 switch (pdata->cal_type) { 80 switch (pdata->cal_type) {
91 case TYPE_TWO_POINT_TRIMMING: 81 case TYPE_TWO_POINT_TRIMMING:
92 temp_code = (temp - pdata->first_point_trim) * 82 temp_code = (temp - pdata->first_point_trim) *
@@ -101,7 +91,7 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp)
101 temp_code = temp + pdata->default_temp_offset; 91 temp_code = temp + pdata->default_temp_offset;
102 break; 92 break;
103 } 93 }
104out: 94
105 return temp_code; 95 return temp_code;
106} 96}
107 97
@@ -114,16 +104,6 @@ static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code)
114 struct exynos_tmu_platform_data *pdata = data->pdata; 104 struct exynos_tmu_platform_data *pdata = data->pdata;
115 int temp; 105 int temp;
116 106
117 if (pdata->cal_mode == HW_MODE)
118 return temp_code;
119
120 if (data->soc == SOC_ARCH_EXYNOS4210)
121 /* temp_code should range between 75 and 175 */
122 if (temp_code < 75 || temp_code > 175) {
123 temp = -ENODATA;
124 goto out;
125 }
126
127 switch (pdata->cal_type) { 107 switch (pdata->cal_type) {
128 case TYPE_TWO_POINT_TRIMMING: 108 case TYPE_TWO_POINT_TRIMMING:
129 temp = (temp_code - data->temp_error1) * 109 temp = (temp_code - data->temp_error1) *
@@ -138,18 +118,35 @@ static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code)
138 temp = temp_code - pdata->default_temp_offset; 118 temp = temp_code - pdata->default_temp_offset;
139 break; 119 break;
140 } 120 }
141out: 121
142 return temp; 122 return temp;
143} 123}
144 124
125static void exynos_tmu_clear_irqs(struct exynos_tmu_data *data)
126{
127 const struct exynos_tmu_registers *reg = data->pdata->registers;
128 unsigned int val_irq;
129
130 val_irq = readl(data->base + reg->tmu_intstat);
131 /*
132 * Clear the interrupts. Please note that the documentation for
133 * Exynos3250, Exynos4412, Exynos5250 and Exynos5260 incorrectly
134 * states that INTCLEAR register has a different placing of bits
135 * responsible for FALL IRQs than INTSTAT register. Exynos5420
136 * and Exynos5440 documentation is correct (Exynos4210 doesn't
137 * support FALL IRQs at all).
138 */
139 writel(val_irq, data->base + reg->tmu_intclear);
140}
141
145static int exynos_tmu_initialize(struct platform_device *pdev) 142static int exynos_tmu_initialize(struct platform_device *pdev)
146{ 143{
147 struct exynos_tmu_data *data = platform_get_drvdata(pdev); 144 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
148 struct exynos_tmu_platform_data *pdata = data->pdata; 145 struct exynos_tmu_platform_data *pdata = data->pdata;
149 const struct exynos_tmu_registers *reg = pdata->registers; 146 const struct exynos_tmu_registers *reg = pdata->registers;
150 unsigned int status, trim_info = 0, con; 147 unsigned int status, trim_info = 0, con, ctrl;
151 unsigned int rising_threshold = 0, falling_threshold = 0; 148 unsigned int rising_threshold = 0, falling_threshold = 0;
152 int ret = 0, threshold_code, i, trigger_levs = 0; 149 int ret = 0, threshold_code, i;
153 150
154 mutex_lock(&data->lock); 151 mutex_lock(&data->lock);
155 clk_enable(data->clk); 152 clk_enable(data->clk);
@@ -164,11 +161,17 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
164 } 161 }
165 } 162 }
166 163
167 if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) 164 if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) {
168 __raw_writel(1, data->base + reg->triminfo_ctrl); 165 for (i = 0; i < reg->triminfo_ctrl_count; i++) {
169 166 if (pdata->triminfo_reload[i]) {
170 if (pdata->cal_mode == HW_MODE) 167 ctrl = readl(data->base +
171 goto skip_calib_data; 168 reg->triminfo_ctrl[i]);
169 ctrl |= pdata->triminfo_reload[i];
170 writel(ctrl, data->base +
171 reg->triminfo_ctrl[i]);
172 }
173 }
174 }
172 175
173 /* Save trimming info in order to perform calibration */ 176 /* Save trimming info in order to perform calibration */
174 if (data->soc == SOC_ARCH_EXYNOS5440) { 177 if (data->soc == SOC_ARCH_EXYNOS5440) {
@@ -197,7 +200,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
197 trim_info = readl(data->base + reg->triminfo_data); 200 trim_info = readl(data->base + reg->triminfo_data);
198 } 201 }
199 data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; 202 data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
200 data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) & 203 data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) &
201 EXYNOS_TMU_TEMP_MASK); 204 EXYNOS_TMU_TEMP_MASK);
202 205
203 if (!data->temp_error1 || 206 if (!data->temp_error1 ||
@@ -207,67 +210,33 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
207 210
208 if (!data->temp_error2) 211 if (!data->temp_error2)
209 data->temp_error2 = 212 data->temp_error2 =
210 (pdata->efuse_value >> reg->triminfo_85_shift) & 213 (pdata->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) &
211 EXYNOS_TMU_TEMP_MASK; 214 EXYNOS_TMU_TEMP_MASK;
212 215
213skip_calib_data:
214 if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
215 dev_err(&pdev->dev, "Invalid max trigger level\n");
216 ret = -EINVAL;
217 goto out;
218 }
219
220 for (i = 0; i < pdata->max_trigger_level; i++) {
221 if (!pdata->trigger_levels[i])
222 continue;
223
224 if ((pdata->trigger_type[i] == HW_TRIP) &&
225 (!pdata->trigger_levels[pdata->max_trigger_level - 1])) {
226 dev_err(&pdev->dev, "Invalid hw trigger level\n");
227 ret = -EINVAL;
228 goto out;
229 }
230
231 /* Count trigger levels except the HW trip*/
232 if (!(pdata->trigger_type[i] == HW_TRIP))
233 trigger_levs++;
234 }
235
236 rising_threshold = readl(data->base + reg->threshold_th0); 216 rising_threshold = readl(data->base + reg->threshold_th0);
237 217
238 if (data->soc == SOC_ARCH_EXYNOS4210) { 218 if (data->soc == SOC_ARCH_EXYNOS4210) {
239 /* Write temperature code for threshold */ 219 /* Write temperature code for threshold */
240 threshold_code = temp_to_code(data, pdata->threshold); 220 threshold_code = temp_to_code(data, pdata->threshold);
241 if (threshold_code < 0) {
242 ret = threshold_code;
243 goto out;
244 }
245 writeb(threshold_code, 221 writeb(threshold_code,
246 data->base + reg->threshold_temp); 222 data->base + reg->threshold_temp);
247 for (i = 0; i < trigger_levs; i++) 223 for (i = 0; i < pdata->non_hw_trigger_levels; i++)
248 writeb(pdata->trigger_levels[i], data->base + 224 writeb(pdata->trigger_levels[i], data->base +
249 reg->threshold_th0 + i * sizeof(reg->threshold_th0)); 225 reg->threshold_th0 + i * sizeof(reg->threshold_th0));
250 226
251 writel(reg->intclr_rise_mask, data->base + reg->tmu_intclear); 227 exynos_tmu_clear_irqs(data);
252 } else { 228 } else {
253 /* Write temperature code for rising and falling threshold */ 229 /* Write temperature code for rising and falling threshold */
254 for (i = 0; 230 for (i = 0; i < pdata->non_hw_trigger_levels; i++) {
255 i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) {
256 threshold_code = temp_to_code(data, 231 threshold_code = temp_to_code(data,
257 pdata->trigger_levels[i]); 232 pdata->trigger_levels[i]);
258 if (threshold_code < 0) {
259 ret = threshold_code;
260 goto out;
261 }
262 rising_threshold &= ~(0xff << 8 * i); 233 rising_threshold &= ~(0xff << 8 * i);
263 rising_threshold |= threshold_code << 8 * i; 234 rising_threshold |= threshold_code << 8 * i;
264 if (pdata->threshold_falling) { 235 if (pdata->threshold_falling) {
265 threshold_code = temp_to_code(data, 236 threshold_code = temp_to_code(data,
266 pdata->trigger_levels[i] - 237 pdata->trigger_levels[i] -
267 pdata->threshold_falling); 238 pdata->threshold_falling);
268 if (threshold_code > 0) 239 falling_threshold |= threshold_code << 8 * i;
269 falling_threshold |=
270 threshold_code << 8 * i;
271 } 240 }
272 } 241 }
273 242
@@ -276,9 +245,7 @@ skip_calib_data:
276 writel(falling_threshold, 245 writel(falling_threshold,
277 data->base + reg->threshold_th1); 246 data->base + reg->threshold_th1);
278 247
279 writel((reg->intclr_rise_mask << reg->intclr_rise_shift) | 248 exynos_tmu_clear_irqs(data);
280 (reg->intclr_fall_mask << reg->intclr_fall_shift),
281 data->base + reg->tmu_intclear);
282 249
283 /* if last threshold limit is also present */ 250 /* if last threshold limit is also present */
284 i = pdata->max_trigger_level - 1; 251 i = pdata->max_trigger_level - 1;
@@ -286,10 +253,6 @@ skip_calib_data:
286 (pdata->trigger_type[i] == HW_TRIP)) { 253 (pdata->trigger_type[i] == HW_TRIP)) {
287 threshold_code = temp_to_code(data, 254 threshold_code = temp_to_code(data,
288 pdata->trigger_levels[i]); 255 pdata->trigger_levels[i]);
289 if (threshold_code < 0) {
290 ret = threshold_code;
291 goto out;
292 }
293 if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { 256 if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) {
294 /* 1-4 level to be assigned in th0 reg */ 257 /* 1-4 level to be assigned in th0 reg */
295 rising_threshold &= ~(0xff << 8 * i); 258 rising_threshold &= ~(0xff << 8 * i);
@@ -325,7 +288,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
325 struct exynos_tmu_data *data = platform_get_drvdata(pdev); 288 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
326 struct exynos_tmu_platform_data *pdata = data->pdata; 289 struct exynos_tmu_platform_data *pdata = data->pdata;
327 const struct exynos_tmu_registers *reg = pdata->registers; 290 const struct exynos_tmu_registers *reg = pdata->registers;
328 unsigned int con, interrupt_en, cal_val; 291 unsigned int con, interrupt_en;
329 292
330 mutex_lock(&data->lock); 293 mutex_lock(&data->lock);
331 clk_enable(data->clk); 294 clk_enable(data->clk);
@@ -335,15 +298,11 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
335 if (pdata->test_mux) 298 if (pdata->test_mux)
336 con |= (pdata->test_mux << reg->test_mux_addr_shift); 299 con |= (pdata->test_mux << reg->test_mux_addr_shift);
337 300
338 if (pdata->reference_voltage) { 301 con &= ~(EXYNOS_TMU_REF_VOLTAGE_MASK << EXYNOS_TMU_REF_VOLTAGE_SHIFT);
339 con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift); 302 con |= pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT;
340 con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
341 }
342 303
343 if (pdata->gain) { 304 con &= ~(EXYNOS_TMU_BUF_SLOPE_SEL_MASK << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
344 con &= ~(reg->buf_slope_sel_mask << reg->buf_slope_sel_shift); 305 con |= (pdata->gain << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
345 con |= (pdata->gain << reg->buf_slope_sel_shift);
346 }
347 306
348 if (pdata->noise_cancel_mode) { 307 if (pdata->noise_cancel_mode) {
349 con &= ~(reg->therm_trip_mode_mask << 308 con &= ~(reg->therm_trip_mode_mask <<
@@ -351,29 +310,8 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
351 con |= (pdata->noise_cancel_mode << reg->therm_trip_mode_shift); 310 con |= (pdata->noise_cancel_mode << reg->therm_trip_mode_shift);
352 } 311 }
353 312
354 if (pdata->cal_mode == HW_MODE) {
355 con &= ~(reg->calib_mode_mask << reg->calib_mode_shift);
356 cal_val = 0;
357 switch (pdata->cal_type) {
358 case TYPE_TWO_POINT_TRIMMING:
359 cal_val = 3;
360 break;
361 case TYPE_ONE_POINT_TRIMMING_85:
362 cal_val = 2;
363 break;
364 case TYPE_ONE_POINT_TRIMMING_25:
365 cal_val = 1;
366 break;
367 case TYPE_NONE:
368 break;
369 default:
370 dev_err(&pdev->dev, "Invalid calibration type, using none\n");
371 }
372 con |= cal_val << reg->calib_mode_shift;
373 }
374
375 if (on) { 313 if (on) {
376 con |= (1 << reg->core_en_shift); 314 con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
377 interrupt_en = 315 interrupt_en =
378 pdata->trigger_enable[3] << reg->inten_rise3_shift | 316 pdata->trigger_enable[3] << reg->inten_rise3_shift |
379 pdata->trigger_enable[2] << reg->inten_rise2_shift | 317 pdata->trigger_enable[2] << reg->inten_rise2_shift |
@@ -383,7 +321,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
383 interrupt_en |= 321 interrupt_en |=
384 interrupt_en << reg->inten_fall0_shift; 322 interrupt_en << reg->inten_fall0_shift;
385 } else { 323 } else {
386 con &= ~(1 << reg->core_en_shift); 324 con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
387 interrupt_en = 0; /* Disable all interrupts */ 325 interrupt_en = 0; /* Disable all interrupts */
388 } 326 }
389 writel(interrupt_en, data->base + reg->tmu_inten); 327 writel(interrupt_en, data->base + reg->tmu_inten);
@@ -404,8 +342,16 @@ static int exynos_tmu_read(struct exynos_tmu_data *data)
404 clk_enable(data->clk); 342 clk_enable(data->clk);
405 343
406 temp_code = readb(data->base + reg->tmu_cur_temp); 344 temp_code = readb(data->base + reg->tmu_cur_temp);
407 temp = code_to_temp(data, temp_code);
408 345
346 if (data->soc == SOC_ARCH_EXYNOS4210)
347 /* temp_code should range between 75 and 175 */
348 if (temp_code < 75 || temp_code > 175) {
349 temp = -ENODATA;
350 goto out;
351 }
352
353 temp = code_to_temp(data, temp_code);
354out:
409 clk_disable(data->clk); 355 clk_disable(data->clk);
410 mutex_unlock(&data->lock); 356 mutex_unlock(&data->lock);
411 357
@@ -465,7 +411,7 @@ static void exynos_tmu_work(struct work_struct *work)
465 struct exynos_tmu_data, irq_work); 411 struct exynos_tmu_data, irq_work);
466 struct exynos_tmu_platform_data *pdata = data->pdata; 412 struct exynos_tmu_platform_data *pdata = data->pdata;
467 const struct exynos_tmu_registers *reg = pdata->registers; 413 const struct exynos_tmu_registers *reg = pdata->registers;
468 unsigned int val_irq, val_type; 414 unsigned int val_type;
469 415
470 if (!IS_ERR(data->clk_sec)) 416 if (!IS_ERR(data->clk_sec))
471 clk_enable(data->clk_sec); 417 clk_enable(data->clk_sec);
@@ -483,9 +429,7 @@ static void exynos_tmu_work(struct work_struct *work)
483 clk_enable(data->clk); 429 clk_enable(data->clk);
484 430
485 /* TODO: take action based on particular interrupt */ 431 /* TODO: take action based on particular interrupt */
486 val_irq = readl(data->base + reg->tmu_intstat); 432 exynos_tmu_clear_irqs(data);
487 /* clear the interrupts */
488 writel(val_irq, data->base + reg->tmu_intclear);
489 433
490 clk_disable(data->clk); 434 clk_disable(data->clk);
491 mutex_unlock(&data->lock); 435 mutex_unlock(&data->lock);
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
index 1b4a6444ea61..c58c7663a3fe 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -34,11 +34,6 @@ enum calibration_type {
34 TYPE_NONE, 34 TYPE_NONE,
35}; 35};
36 36
37enum calibration_mode {
38 SW_MODE,
39 HW_MODE,
40};
41
42enum soc_type { 37enum soc_type {
43 SOC_ARCH_EXYNOS3250 = 1, 38 SOC_ARCH_EXYNOS3250 = 1,
44 SOC_ARCH_EXYNOS4210, 39 SOC_ARCH_EXYNOS4210,
@@ -82,46 +77,19 @@ enum soc_type {
82 * bitfields. The register validity, offsets and bitfield values may vary 77 * bitfields. The register validity, offsets and bitfield values may vary
83 * slightly across different exynos SOC's. 78 * slightly across different exynos SOC's.
84 * @triminfo_data: register containing 2 pont trimming data 79 * @triminfo_data: register containing 2 pont trimming data
85 * @triminfo_25_shift: shift bit of the 25 C trim value in triminfo_data reg.
86 * @triminfo_85_shift: shift bit of the 85 C trim value in triminfo_data reg.
87 * @triminfo_ctrl: trim info controller register. 80 * @triminfo_ctrl: trim info controller register.
88 * @triminfo_reload_shift: shift of triminfo reload enable bit in triminfo_ctrl 81 * @triminfo_ctrl_count: the number of trim info controller register.
89 reg.
90 * @tmu_ctrl: TMU main controller register. 82 * @tmu_ctrl: TMU main controller register.
91 * @test_mux_addr_shift: shift bits of test mux address. 83 * @test_mux_addr_shift: shift bits of test mux address.
92 * @buf_vref_sel_shift: shift bits of reference voltage in tmu_ctrl register.
93 * @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl register.
94 * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register. 84 * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
95 * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register. 85 * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register.
96 * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register. 86 * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register.
97 * @buf_slope_sel_shift: shift bits of amplifier gain value in tmu_ctrl
98 register.
99 * @buf_slope_sel_mask: mask bits of amplifier gain value in tmu_ctrl register.
100 * @calib_mode_shift: shift bits of calibration mode value in tmu_ctrl
101 register.
102 * @calib_mode_mask: mask bits of calibration mode value in tmu_ctrl
103 register.
104 * @therm_trip_tq_en_shift: shift bits of thermal trip enable by TQ pin in
105 tmu_ctrl register.
106 * @core_en_shift: shift bits of TMU core enable bit in tmu_ctrl register.
107 * @tmu_status: register drescribing the TMU status. 87 * @tmu_status: register drescribing the TMU status.
108 * @tmu_cur_temp: register containing the current temperature of the TMU. 88 * @tmu_cur_temp: register containing the current temperature of the TMU.
109 * @tmu_cur_temp_shift: shift bits of current temp value in tmu_cur_temp
110 register.
111 * @threshold_temp: register containing the base threshold level. 89 * @threshold_temp: register containing the base threshold level.
112 * @threshold_th0: Register containing first set of rising levels. 90 * @threshold_th0: Register containing first set of rising levels.
113 * @threshold_th0_l0_shift: shift bits of level0 threshold temperature.
114 * @threshold_th0_l1_shift: shift bits of level1 threshold temperature.
115 * @threshold_th0_l2_shift: shift bits of level2 threshold temperature.
116 * @threshold_th0_l3_shift: shift bits of level3 threshold temperature.
117 * @threshold_th1: Register containing second set of rising levels. 91 * @threshold_th1: Register containing second set of rising levels.
118 * @threshold_th1_l0_shift: shift bits of level0 threshold temperature.
119 * @threshold_th1_l1_shift: shift bits of level1 threshold temperature.
120 * @threshold_th1_l2_shift: shift bits of level2 threshold temperature.
121 * @threshold_th1_l3_shift: shift bits of level3 threshold temperature.
122 * @threshold_th2: Register containing third set of rising levels. 92 * @threshold_th2: Register containing third set of rising levels.
123 * @threshold_th2_l0_shift: shift bits of level0 threshold temperature.
124 * @threshold_th3: Register containing fourth set of rising levels.
125 * @threshold_th3_l0_shift: shift bits of level0 threshold temperature. 93 * @threshold_th3_l0_shift: shift bits of level0 threshold temperature.
126 * @tmu_inten: register containing the different threshold interrupt 94 * @tmu_inten: register containing the different threshold interrupt
127 enable bits. 95 enable bits.
@@ -130,68 +98,35 @@ enum soc_type {
130 * @inten_rise2_shift: shift bits of rising 2 interrupt bits. 98 * @inten_rise2_shift: shift bits of rising 2 interrupt bits.
131 * @inten_rise3_shift: shift bits of rising 3 interrupt bits. 99 * @inten_rise3_shift: shift bits of rising 3 interrupt bits.
132 * @inten_fall0_shift: shift bits of falling 0 interrupt bits. 100 * @inten_fall0_shift: shift bits of falling 0 interrupt bits.
133 * @inten_fall1_shift: shift bits of falling 1 interrupt bits.
134 * @inten_fall2_shift: shift bits of falling 2 interrupt bits.
135 * @inten_fall3_shift: shift bits of falling 3 interrupt bits.
136 * @tmu_intstat: Register containing the interrupt status values. 101 * @tmu_intstat: Register containing the interrupt status values.
137 * @tmu_intclear: Register for clearing the raised interrupt status. 102 * @tmu_intclear: Register for clearing the raised interrupt status.
138 * @intclr_fall_shift: shift bits for interrupt clear fall 0
139 * @intclr_rise_shift: shift bits of all rising interrupt bits.
140 * @intclr_rise_mask: mask bits of all rising interrupt bits.
141 * @intclr_fall_mask: mask bits of all rising interrupt bits.
142 * @emul_con: TMU emulation controller register. 103 * @emul_con: TMU emulation controller register.
143 * @emul_temp_shift: shift bits of emulation temperature. 104 * @emul_temp_shift: shift bits of emulation temperature.
144 * @emul_time_shift: shift bits of emulation time. 105 * @emul_time_shift: shift bits of emulation time.
145 * @emul_time_mask: mask bits of emulation time.
146 * @tmu_irqstatus: register to find which TMU generated interrupts. 106 * @tmu_irqstatus: register to find which TMU generated interrupts.
147 * @tmu_pmin: register to get/set the Pmin value. 107 * @tmu_pmin: register to get/set the Pmin value.
148 */ 108 */
149struct exynos_tmu_registers { 109struct exynos_tmu_registers {
150 u32 triminfo_data; 110 u32 triminfo_data;
151 u32 triminfo_25_shift;
152 u32 triminfo_85_shift;
153 111
154 u32 triminfo_ctrl; 112 u32 triminfo_ctrl[MAX_TRIMINFO_CTRL_REG];
155 u32 triminfo_ctrl1; 113 u32 triminfo_ctrl_count;
156 u32 triminfo_reload_shift;
157 114
158 u32 tmu_ctrl; 115 u32 tmu_ctrl;
159 u32 test_mux_addr_shift; 116 u32 test_mux_addr_shift;
160 u32 buf_vref_sel_shift;
161 u32 buf_vref_sel_mask;
162 u32 therm_trip_mode_shift; 117 u32 therm_trip_mode_shift;
163 u32 therm_trip_mode_mask; 118 u32 therm_trip_mode_mask;
164 u32 therm_trip_en_shift; 119 u32 therm_trip_en_shift;
165 u32 buf_slope_sel_shift;
166 u32 buf_slope_sel_mask;
167 u32 calib_mode_shift;
168 u32 calib_mode_mask;
169 u32 therm_trip_tq_en_shift;
170 u32 core_en_shift;
171 120
172 u32 tmu_status; 121 u32 tmu_status;
173 122
174 u32 tmu_cur_temp; 123 u32 tmu_cur_temp;
175 u32 tmu_cur_temp_shift;
176 124
177 u32 threshold_temp; 125 u32 threshold_temp;
178 126
179 u32 threshold_th0; 127 u32 threshold_th0;
180 u32 threshold_th0_l0_shift;
181 u32 threshold_th0_l1_shift;
182 u32 threshold_th0_l2_shift;
183 u32 threshold_th0_l3_shift;
184
185 u32 threshold_th1; 128 u32 threshold_th1;
186 u32 threshold_th1_l0_shift;
187 u32 threshold_th1_l1_shift;
188 u32 threshold_th1_l2_shift;
189 u32 threshold_th1_l3_shift;
190
191 u32 threshold_th2; 129 u32 threshold_th2;
192 u32 threshold_th2_l0_shift;
193
194 u32 threshold_th3;
195 u32 threshold_th3_l0_shift; 130 u32 threshold_th3_l0_shift;
196 131
197 u32 tmu_inten; 132 u32 tmu_inten;
@@ -200,22 +135,14 @@ struct exynos_tmu_registers {
200 u32 inten_rise2_shift; 135 u32 inten_rise2_shift;
201 u32 inten_rise3_shift; 136 u32 inten_rise3_shift;
202 u32 inten_fall0_shift; 137 u32 inten_fall0_shift;
203 u32 inten_fall1_shift;
204 u32 inten_fall2_shift;
205 u32 inten_fall3_shift;
206 138
207 u32 tmu_intstat; 139 u32 tmu_intstat;
208 140
209 u32 tmu_intclear; 141 u32 tmu_intclear;
210 u32 intclr_fall_shift;
211 u32 intclr_rise_shift;
212 u32 intclr_fall_mask;
213 u32 intclr_rise_mask;
214 142
215 u32 emul_con; 143 u32 emul_con;
216 u32 emul_temp_shift; 144 u32 emul_temp_shift;
217 u32 emul_time_shift; 145 u32 emul_time_shift;
218 u32 emul_time_mask;
219 146
220 u32 tmu_irqstatus; 147 u32 tmu_irqstatus;
221 u32 tmu_pmin; 148 u32 tmu_pmin;
@@ -250,11 +177,12 @@ struct exynos_tmu_registers {
250 * 1 = enable trigger_level[] interrupt, 177 * 1 = enable trigger_level[] interrupt,
251 * 0 = disable trigger_level[] interrupt 178 * 0 = disable trigger_level[] interrupt
252 * @max_trigger_level: max trigger level supported by the TMU 179 * @max_trigger_level: max trigger level supported by the TMU
180 * @non_hw_trigger_levels: number of defined non-hardware trigger levels
253 * @gain: gain of amplifier in the positive-TC generator block 181 * @gain: gain of amplifier in the positive-TC generator block
254 * 0 <= gain <= 15 182 * 0 < gain <= 15
255 * @reference_voltage: reference voltage of amplifier 183 * @reference_voltage: reference voltage of amplifier
256 * in the positive-TC generator block 184 * in the positive-TC generator block
257 * 0 <= reference_voltage <= 31 185 * 0 < reference_voltage <= 31
258 * @noise_cancel_mode: noise cancellation mode 186 * @noise_cancel_mode: noise cancellation mode
259 * 000, 100, 101, 110 and 111 can be different modes 187 * 000, 100, 101, 110 and 111 can be different modes
260 * @type: determines the type of SOC 188 * @type: determines the type of SOC
@@ -265,8 +193,8 @@ struct exynos_tmu_registers {
265 * @second_point_trim: temp value of the second point trimming 193 * @second_point_trim: temp value of the second point trimming
266 * @default_temp_offset: default temperature offset in case of no trimming 194 * @default_temp_offset: default temperature offset in case of no trimming
267 * @test_mux; information if SoC supports test MUX 195 * @test_mux; information if SoC supports test MUX
196 * @triminfo_reload: reload value to read TRIMINFO register
268 * @cal_type: calibration type for temperature 197 * @cal_type: calibration type for temperature
269 * @cal_mode: calibration mode for temperature
270 * @freq_clip_table: Table representing frequency reduction percentage. 198 * @freq_clip_table: Table representing frequency reduction percentage.
271 * @freq_tab_count: Count of the above table as frequency reduction may 199 * @freq_tab_count: Count of the above table as frequency reduction may
272 * applicable to only some of the trigger levels. 200 * applicable to only some of the trigger levels.
@@ -284,6 +212,7 @@ struct exynos_tmu_platform_data {
284 enum trigger_type trigger_type[MAX_TRIP_COUNT]; 212 enum trigger_type trigger_type[MAX_TRIP_COUNT];
285 bool trigger_enable[MAX_TRIP_COUNT]; 213 bool trigger_enable[MAX_TRIP_COUNT];
286 u8 max_trigger_level; 214 u8 max_trigger_level;
215 u8 non_hw_trigger_levels;
287 u8 gain; 216 u8 gain;
288 u8 reference_voltage; 217 u8 reference_voltage;
289 u8 noise_cancel_mode; 218 u8 noise_cancel_mode;
@@ -295,9 +224,9 @@ struct exynos_tmu_platform_data {
295 u8 second_point_trim; 224 u8 second_point_trim;
296 u8 default_temp_offset; 225 u8 default_temp_offset;
297 u8 test_mux; 226 u8 test_mux;
227 u8 triminfo_reload[MAX_TRIMINFO_CTRL_REG];
298 228
299 enum calibration_type cal_type; 229 enum calibration_type cal_type;
300 enum calibration_mode cal_mode;
301 enum soc_type type; 230 enum soc_type type;
302 struct freq_clip_table freq_tab[4]; 231 struct freq_clip_table freq_tab[4];
303 unsigned int freq_tab_count; 232 unsigned int freq_tab_count;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index aa8e0dee2055..1724f6cdaef8 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -27,14 +27,7 @@
27#if defined(CONFIG_CPU_EXYNOS4210) 27#if defined(CONFIG_CPU_EXYNOS4210)
28static const struct exynos_tmu_registers exynos4210_tmu_registers = { 28static const struct exynos_tmu_registers exynos4210_tmu_registers = {
29 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, 29 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
30 .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
31 .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
32 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, 30 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
33 .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
34 .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
35 .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
36 .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
37 .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
38 .tmu_status = EXYNOS_TMU_REG_STATUS, 31 .tmu_status = EXYNOS_TMU_REG_STATUS,
39 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, 32 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
40 .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP, 33 .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP,
@@ -46,7 +39,6 @@ static const struct exynos_tmu_registers exynos4210_tmu_registers = {
46 .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, 39 .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT,
47 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, 40 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
48 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, 41 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
49 .intclr_rise_mask = EXYNOS4210_TMU_TRIG_LEVEL_MASK,
50}; 42};
51 43
52struct exynos_tmu_init_data const exynos4210_default_tmu_data = { 44struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
@@ -64,6 +56,7 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
64 .trigger_type[1] = THROTTLE_ACTIVE, 56 .trigger_type[1] = THROTTLE_ACTIVE,
65 .trigger_type[2] = SW_TRIP, 57 .trigger_type[2] = SW_TRIP,
66 .max_trigger_level = 4, 58 .max_trigger_level = 4,
59 .non_hw_trigger_levels = 3,
67 .gain = 15, 60 .gain = 15,
68 .reference_voltage = 7, 61 .reference_voltage = 7,
69 .cal_type = TYPE_ONE_POINT_TRIMMING, 62 .cal_type = TYPE_ONE_POINT_TRIMMING,
@@ -93,18 +86,14 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
93#if defined(CONFIG_SOC_EXYNOS3250) 86#if defined(CONFIG_SOC_EXYNOS3250)
94static const struct exynos_tmu_registers exynos3250_tmu_registers = { 87static const struct exynos_tmu_registers exynos3250_tmu_registers = {
95 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, 88 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
96 .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, 89 .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON1,
97 .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, 90 .triminfo_ctrl[1] = EXYNOS_TMU_TRIMINFO_CON2,
91 .triminfo_ctrl_count = 2,
98 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, 92 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
99 .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, 93 .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
100 .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
101 .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
102 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, 94 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
103 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, 95 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
104 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, 96 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
105 .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
106 .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
107 .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
108 .tmu_status = EXYNOS_TMU_REG_STATUS, 97 .tmu_status = EXYNOS_TMU_REG_STATUS,
109 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, 98 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
110 .threshold_th0 = EXYNOS_THD_TEMP_RISE, 99 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -116,14 +105,9 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = {
116 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, 105 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
117 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, 106 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
118 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, 107 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
119 .intclr_fall_shift = EXYNOS_TMU_CLEAR_FALL_INT_SHIFT,
120 .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT,
121 .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK,
122 .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK,
123 .emul_con = EXYNOS_EMUL_CON, 108 .emul_con = EXYNOS_EMUL_CON,
124 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, 109 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
125 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, 110 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
126 .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
127}; 111};
128 112
129#define EXYNOS3250_TMU_DATA \ 113#define EXYNOS3250_TMU_DATA \
@@ -141,6 +125,7 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = {
141 .trigger_type[2] = SW_TRIP, \ 125 .trigger_type[2] = SW_TRIP, \
142 .trigger_type[3] = HW_TRIP, \ 126 .trigger_type[3] = HW_TRIP, \
143 .max_trigger_level = 4, \ 127 .max_trigger_level = 4, \
128 .non_hw_trigger_levels = 3, \
144 .gain = 8, \ 129 .gain = 8, \
145 .reference_voltage = 16, \ 130 .reference_voltage = 16, \
146 .noise_cancel_mode = 4, \ 131 .noise_cancel_mode = 4, \
@@ -160,8 +145,10 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = {
160 .temp_level = 95, \ 145 .temp_level = 95, \
161 }, \ 146 }, \
162 .freq_tab_count = 2, \ 147 .freq_tab_count = 2, \
148 .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
149 .triminfo_reload[1] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
163 .registers = &exynos3250_tmu_registers, \ 150 .registers = &exynos3250_tmu_registers, \
164 .features = (TMU_SUPPORT_EMULATION | \ 151 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
165 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ 152 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
166 TMU_SUPPORT_EMUL_TIME) 153 TMU_SUPPORT_EMUL_TIME)
167#endif 154#endif
@@ -182,20 +169,13 @@ struct exynos_tmu_init_data const exynos3250_default_tmu_data = {
182#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250) 169#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
183static const struct exynos_tmu_registers exynos4412_tmu_registers = { 170static const struct exynos_tmu_registers exynos4412_tmu_registers = {
184 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, 171 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
185 .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, 172 .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON2,
186 .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, 173 .triminfo_ctrl_count = 1,
187 .triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON,
188 .triminfo_reload_shift = EXYNOS_TRIMINFO_RELOAD_SHIFT,
189 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, 174 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
190 .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, 175 .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
191 .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
192 .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
193 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, 176 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
194 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, 177 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
195 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, 178 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
196 .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
197 .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
198 .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
199 .tmu_status = EXYNOS_TMU_REG_STATUS, 179 .tmu_status = EXYNOS_TMU_REG_STATUS,
200 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, 180 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
201 .threshold_th0 = EXYNOS_THD_TEMP_RISE, 181 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -208,14 +188,9 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = {
208 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, 188 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
209 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, 189 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
210 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, 190 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
211 .intclr_fall_shift = EXYNOS_TMU_CLEAR_FALL_INT_SHIFT,
212 .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT,
213 .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK,
214 .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK,
215 .emul_con = EXYNOS_EMUL_CON, 191 .emul_con = EXYNOS_EMUL_CON,
216 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, 192 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
217 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, 193 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
218 .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
219}; 194};
220 195
221#define EXYNOS4412_TMU_DATA \ 196#define EXYNOS4412_TMU_DATA \
@@ -233,6 +208,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = {
233 .trigger_type[2] = SW_TRIP, \ 208 .trigger_type[2] = SW_TRIP, \
234 .trigger_type[3] = HW_TRIP, \ 209 .trigger_type[3] = HW_TRIP, \
235 .max_trigger_level = 4, \ 210 .max_trigger_level = 4, \
211 .non_hw_trigger_levels = 3, \
236 .gain = 8, \ 212 .gain = 8, \
237 .reference_voltage = 16, \ 213 .reference_voltage = 16, \
238 .noise_cancel_mode = 4, \ 214 .noise_cancel_mode = 4, \
@@ -252,6 +228,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = {
252 .temp_level = 95, \ 228 .temp_level = 95, \
253 }, \ 229 }, \
254 .freq_tab_count = 2, \ 230 .freq_tab_count = 2, \
231 .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \
255 .registers = &exynos4412_tmu_registers, \ 232 .registers = &exynos4412_tmu_registers, \
256 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ 233 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
257 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ 234 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
@@ -286,18 +263,10 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
286#if defined(CONFIG_SOC_EXYNOS5260) 263#if defined(CONFIG_SOC_EXYNOS5260)
287static const struct exynos_tmu_registers exynos5260_tmu_registers = { 264static const struct exynos_tmu_registers exynos5260_tmu_registers = {
288 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, 265 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
289 .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
290 .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
291 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, 266 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
292 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1,
293 .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
294 .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
295 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, 267 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
296 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, 268 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
297 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, 269 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
298 .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
299 .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
300 .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
301 .tmu_status = EXYNOS_TMU_REG_STATUS, 270 .tmu_status = EXYNOS_TMU_REG_STATUS,
302 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, 271 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
303 .threshold_th0 = EXYNOS_THD_TEMP_RISE, 272 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -310,14 +279,9 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = {
310 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, 279 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
311 .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT, 280 .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT,
312 .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR, 281 .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR,
313 .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT,
314 .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT,
315 .intclr_rise_mask = EXYNOS5260_TMU_RISE_INT_MASK,
316 .intclr_fall_mask = EXYNOS5260_TMU_FALL_INT_MASK,
317 .emul_con = EXYNOS5260_EMUL_CON, 282 .emul_con = EXYNOS5260_EMUL_CON,
318 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, 283 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
319 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, 284 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
320 .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
321}; 285};
322 286
323#define __EXYNOS5260_TMU_DATA \ 287#define __EXYNOS5260_TMU_DATA \
@@ -335,6 +299,7 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = {
335 .trigger_type[2] = SW_TRIP, \ 299 .trigger_type[2] = SW_TRIP, \
336 .trigger_type[3] = HW_TRIP, \ 300 .trigger_type[3] = HW_TRIP, \
337 .max_trigger_level = 4, \ 301 .max_trigger_level = 4, \
302 .non_hw_trigger_levels = 3, \
338 .gain = 8, \ 303 .gain = 8, \
339 .reference_voltage = 16, \ 304 .reference_voltage = 16, \
340 .noise_cancel_mode = 4, \ 305 .noise_cancel_mode = 4, \
@@ -359,9 +324,8 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = {
359#define EXYNOS5260_TMU_DATA \ 324#define EXYNOS5260_TMU_DATA \
360 __EXYNOS5260_TMU_DATA \ 325 __EXYNOS5260_TMU_DATA \
361 .type = SOC_ARCH_EXYNOS5260, \ 326 .type = SOC_ARCH_EXYNOS5260, \
362 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ 327 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
363 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ 328 TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME)
364 TMU_SUPPORT_EMUL_TIME)
365 329
366struct exynos_tmu_init_data const exynos5260_default_tmu_data = { 330struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
367 .tmu_data = { 331 .tmu_data = {
@@ -378,17 +342,10 @@ struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
378#if defined(CONFIG_SOC_EXYNOS5420) 342#if defined(CONFIG_SOC_EXYNOS5420)
379static const struct exynos_tmu_registers exynos5420_tmu_registers = { 343static const struct exynos_tmu_registers exynos5420_tmu_registers = {
380 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, 344 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
381 .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
382 .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
383 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, 345 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
384 .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
385 .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
386 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, 346 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
387 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, 347 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
388 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, 348 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
389 .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
390 .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
391 .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
392 .tmu_status = EXYNOS_TMU_REG_STATUS, 349 .tmu_status = EXYNOS_TMU_REG_STATUS,
393 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, 350 .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
394 .threshold_th0 = EXYNOS_THD_TEMP_RISE, 351 .threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -402,14 +359,9 @@ static const struct exynos_tmu_registers exynos5420_tmu_registers = {
402 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, 359 .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT,
403 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, 360 .tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
404 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, 361 .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
405 .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT,
406 .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT,
407 .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK,
408 .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK,
409 .emul_con = EXYNOS_EMUL_CON, 362 .emul_con = EXYNOS_EMUL_CON,
410 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, 363 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
411 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, 364 .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
412 .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
413}; 365};
414 366
415#define __EXYNOS5420_TMU_DATA \ 367#define __EXYNOS5420_TMU_DATA \
@@ -427,6 +379,7 @@ static const struct exynos_tmu_registers exynos5420_tmu_registers = {
427 .trigger_type[2] = SW_TRIP, \ 379 .trigger_type[2] = SW_TRIP, \
428 .trigger_type[3] = HW_TRIP, \ 380 .trigger_type[3] = HW_TRIP, \
429 .max_trigger_level = 4, \ 381 .max_trigger_level = 4, \
382 .non_hw_trigger_levels = 3, \
430 .gain = 8, \ 383 .gain = 8, \
431 .reference_voltage = 16, \ 384 .reference_voltage = 16, \
432 .noise_cancel_mode = 4, \ 385 .noise_cancel_mode = 4, \
@@ -451,16 +404,15 @@ static const struct exynos_tmu_registers exynos5420_tmu_registers = {
451#define EXYNOS5420_TMU_DATA \ 404#define EXYNOS5420_TMU_DATA \
452 __EXYNOS5420_TMU_DATA \ 405 __EXYNOS5420_TMU_DATA \
453 .type = SOC_ARCH_EXYNOS5250, \ 406 .type = SOC_ARCH_EXYNOS5250, \
454 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ 407 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
455 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ 408 TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME)
456 TMU_SUPPORT_EMUL_TIME)
457 409
458#define EXYNOS5420_TMU_DATA_SHARED \ 410#define EXYNOS5420_TMU_DATA_SHARED \
459 __EXYNOS5420_TMU_DATA \ 411 __EXYNOS5420_TMU_DATA \
460 .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \ 412 .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \
461 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ 413 .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
462 TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ 414 TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME | \
463 TMU_SUPPORT_EMUL_TIME | TMU_SUPPORT_ADDRESS_MULTIPLE) 415 TMU_SUPPORT_ADDRESS_MULTIPLE)
464 416
465struct exynos_tmu_init_data const exynos5420_default_tmu_data = { 417struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
466 .tmu_data = { 418 .tmu_data = {
@@ -477,19 +429,10 @@ struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
477#if defined(CONFIG_SOC_EXYNOS5440) 429#if defined(CONFIG_SOC_EXYNOS5440)
478static const struct exynos_tmu_registers exynos5440_tmu_registers = { 430static const struct exynos_tmu_registers exynos5440_tmu_registers = {
479 .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM, 431 .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM,
480 .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
481 .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
482 .tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL, 432 .tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL,
483 .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
484 .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
485 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, 433 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
486 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, 434 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
487 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, 435 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
488 .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
489 .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
490 .calib_mode_shift = EXYNOS_TMU_CALIB_MODE_SHIFT,
491 .calib_mode_mask = EXYNOS_TMU_CALIB_MODE_MASK,
492 .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT,
493 .tmu_status = EXYNOS5440_TMU_S0_7_STATUS, 436 .tmu_status = EXYNOS5440_TMU_S0_7_STATUS,
494 .tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP, 437 .tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP,
495 .threshold_th0 = EXYNOS5440_TMU_S0_7_TH0, 438 .threshold_th0 = EXYNOS5440_TMU_S0_7_TH0,
@@ -504,10 +447,6 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = {
504 .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT, 447 .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT,
505 .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ, 448 .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ,
506 .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ, 449 .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ,
507 .intclr_fall_shift = EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT,
508 .intclr_rise_shift = EXYNOS5440_TMU_RISE_INT_SHIFT,
509 .intclr_rise_mask = EXYNOS5440_TMU_RISE_INT_MASK,
510 .intclr_fall_mask = EXYNOS5440_TMU_FALL_INT_MASK,
511 .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS, 450 .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS,
512 .emul_con = EXYNOS5440_TMU_S0_7_DEBUG, 451 .emul_con = EXYNOS5440_TMU_S0_7_DEBUG,
513 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, 452 .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
@@ -521,11 +460,11 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = {
521 .trigger_type[0] = SW_TRIP, \ 460 .trigger_type[0] = SW_TRIP, \
522 .trigger_type[4] = HW_TRIP, \ 461 .trigger_type[4] = HW_TRIP, \
523 .max_trigger_level = 5, \ 462 .max_trigger_level = 5, \
463 .non_hw_trigger_levels = 1, \
524 .gain = 5, \ 464 .gain = 5, \
525 .reference_voltage = 16, \ 465 .reference_voltage = 16, \
526 .noise_cancel_mode = 4, \ 466 .noise_cancel_mode = 4, \
527 .cal_type = TYPE_ONE_POINT_TRIMMING, \ 467 .cal_type = TYPE_ONE_POINT_TRIMMING, \
528 .cal_mode = 0, \
529 .efuse_value = 0x5b2d, \ 468 .efuse_value = 0x5b2d, \
530 .min_efuse_value = 16, \ 469 .min_efuse_value = 16, \
531 .max_efuse_value = 76, \ 470 .max_efuse_value = 76, \
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
index f0979e598491..63de598c9c2c 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -39,55 +39,31 @@
39#define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8 39#define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8
40#define EXYNOS_TMU_CORE_EN_SHIFT 0 40#define EXYNOS_TMU_CORE_EN_SHIFT 0
41 41
42/* Exynos3250 specific registers */
43#define EXYNOS_TMU_TRIMINFO_CON1 0x10
44
42/* Exynos4210 specific registers */ 45/* Exynos4210 specific registers */
43#define EXYNOS4210_TMU_REG_THRESHOLD_TEMP 0x44 46#define EXYNOS4210_TMU_REG_THRESHOLD_TEMP 0x44
44#define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50 47#define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50
45#define EXYNOS4210_TMU_REG_TRIG_LEVEL1 0x54 48
46#define EXYNOS4210_TMU_REG_TRIG_LEVEL2 0x58 49/* Exynos5250, Exynos4412, Exynos3250 specific registers */
47#define EXYNOS4210_TMU_REG_TRIG_LEVEL3 0x5C 50#define EXYNOS_TMU_TRIMINFO_CON2 0x14
48#define EXYNOS4210_TMU_REG_PAST_TEMP0 0x60
49#define EXYNOS4210_TMU_REG_PAST_TEMP1 0x64
50#define EXYNOS4210_TMU_REG_PAST_TEMP2 0x68
51#define EXYNOS4210_TMU_REG_PAST_TEMP3 0x6C
52
53#define EXYNOS4210_TMU_TRIG_LEVEL0_MASK 0x1
54#define EXYNOS4210_TMU_TRIG_LEVEL1_MASK 0x10
55#define EXYNOS4210_TMU_TRIG_LEVEL2_MASK 0x100
56#define EXYNOS4210_TMU_TRIG_LEVEL3_MASK 0x1000
57#define EXYNOS4210_TMU_TRIG_LEVEL_MASK 0x1111
58#define EXYNOS4210_TMU_INTCLEAR_VAL 0x1111
59
60/* Exynos5250 and Exynos4412 specific registers */
61#define EXYNOS_TMU_TRIMINFO_CON 0x14
62#define EXYNOS_THD_TEMP_RISE 0x50 51#define EXYNOS_THD_TEMP_RISE 0x50
63#define EXYNOS_THD_TEMP_FALL 0x54 52#define EXYNOS_THD_TEMP_FALL 0x54
64#define EXYNOS_EMUL_CON 0x80 53#define EXYNOS_EMUL_CON 0x80
65 54
66#define EXYNOS_TRIMINFO_RELOAD_SHIFT 1 55#define EXYNOS_TRIMINFO_RELOAD_ENABLE 1
67#define EXYNOS_TRIMINFO_25_SHIFT 0 56#define EXYNOS_TRIMINFO_25_SHIFT 0
68#define EXYNOS_TRIMINFO_85_SHIFT 8 57#define EXYNOS_TRIMINFO_85_SHIFT 8
69#define EXYNOS_TMU_RISE_INT_MASK 0x111
70#define EXYNOS_TMU_RISE_INT_SHIFT 0
71#define EXYNOS_TMU_FALL_INT_MASK 0x111
72#define EXYNOS_TMU_CLEAR_RISE_INT 0x111
73#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12)
74#define EXYNOS_TMU_CLEAR_FALL_INT_SHIFT 12
75#define EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT 16
76#define EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT 4
77#define EXYNOS_TMU_TRIP_MODE_SHIFT 13 58#define EXYNOS_TMU_TRIP_MODE_SHIFT 13
78#define EXYNOS_TMU_TRIP_MODE_MASK 0x7 59#define EXYNOS_TMU_TRIP_MODE_MASK 0x7
79#define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 60#define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12
80#define EXYNOS_TMU_CALIB_MODE_SHIFT 4
81#define EXYNOS_TMU_CALIB_MODE_MASK 0x3
82 61
83#define EXYNOS_TMU_INTEN_RISE0_SHIFT 0 62#define EXYNOS_TMU_INTEN_RISE0_SHIFT 0
84#define EXYNOS_TMU_INTEN_RISE1_SHIFT 4 63#define EXYNOS_TMU_INTEN_RISE1_SHIFT 4
85#define EXYNOS_TMU_INTEN_RISE2_SHIFT 8 64#define EXYNOS_TMU_INTEN_RISE2_SHIFT 8
86#define EXYNOS_TMU_INTEN_RISE3_SHIFT 12 65#define EXYNOS_TMU_INTEN_RISE3_SHIFT 12
87#define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 66#define EXYNOS_TMU_INTEN_FALL0_SHIFT 16
88#define EXYNOS_TMU_INTEN_FALL1_SHIFT 20
89#define EXYNOS_TMU_INTEN_FALL2_SHIFT 24
90#define EXYNOS_TMU_INTEN_FALL3_SHIFT 28
91 67
92#define EXYNOS_EMUL_TIME 0x57F0 68#define EXYNOS_EMUL_TIME 0x57F0
93#define EXYNOS_EMUL_TIME_MASK 0xffff 69#define EXYNOS_EMUL_TIME_MASK 0xffff
@@ -99,14 +75,9 @@
99#define EXYNOS_MAX_TRIGGER_PER_REG 4 75#define EXYNOS_MAX_TRIGGER_PER_REG 4
100 76
101/* Exynos5260 specific */ 77/* Exynos5260 specific */
102#define EXYNOS_TMU_REG_CONTROL1 0x24
103#define EXYNOS5260_TMU_REG_INTEN 0xC0 78#define EXYNOS5260_TMU_REG_INTEN 0xC0
104#define EXYNOS5260_TMU_REG_INTSTAT 0xC4 79#define EXYNOS5260_TMU_REG_INTSTAT 0xC4
105#define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 80#define EXYNOS5260_TMU_REG_INTCLEAR 0xC8
106#define EXYNOS5260_TMU_CLEAR_RISE_INT 0x1111
107#define EXYNOS5260_TMU_CLEAR_FALL_INT (0x1111 << 16)
108#define EXYNOS5260_TMU_RISE_INT_MASK 0x1111
109#define EXYNOS5260_TMU_FALL_INT_MASK 0x1111
110#define EXYNOS5260_EMUL_CON 0x100 81#define EXYNOS5260_EMUL_CON 0x100
111 82
112/* Exynos4412 specific */ 83/* Exynos4412 specific */
@@ -122,29 +93,17 @@
122#define EXYNOS5440_TMU_S0_7_TH0 0x110 93#define EXYNOS5440_TMU_S0_7_TH0 0x110
123#define EXYNOS5440_TMU_S0_7_TH1 0x130 94#define EXYNOS5440_TMU_S0_7_TH1 0x130
124#define EXYNOS5440_TMU_S0_7_TH2 0x150 95#define EXYNOS5440_TMU_S0_7_TH2 0x150
125#define EXYNOS5440_TMU_S0_7_EVTEN 0x1F0
126#define EXYNOS5440_TMU_S0_7_IRQEN 0x210 96#define EXYNOS5440_TMU_S0_7_IRQEN 0x210
127#define EXYNOS5440_TMU_S0_7_IRQ 0x230 97#define EXYNOS5440_TMU_S0_7_IRQ 0x230
128/* exynos5440 common registers */ 98/* exynos5440 common registers */
129#define EXYNOS5440_TMU_IRQ_STATUS 0x000 99#define EXYNOS5440_TMU_IRQ_STATUS 0x000
130#define EXYNOS5440_TMU_PMIN 0x004 100#define EXYNOS5440_TMU_PMIN 0x004
131#define EXYNOS5440_TMU_TEMP 0x008
132 101
133#define EXYNOS5440_TMU_RISE_INT_MASK 0xf
134#define EXYNOS5440_TMU_RISE_INT_SHIFT 0
135#define EXYNOS5440_TMU_FALL_INT_MASK 0xf
136#define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0 102#define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0
137#define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1 103#define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1
138#define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2 104#define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2
139#define EXYNOS5440_TMU_INTEN_RISE3_SHIFT 3 105#define EXYNOS5440_TMU_INTEN_RISE3_SHIFT 3
140#define EXYNOS5440_TMU_INTEN_FALL0_SHIFT 4 106#define EXYNOS5440_TMU_INTEN_FALL0_SHIFT 4
141#define EXYNOS5440_TMU_INTEN_FALL1_SHIFT 5
142#define EXYNOS5440_TMU_INTEN_FALL2_SHIFT 6
143#define EXYNOS5440_TMU_INTEN_FALL3_SHIFT 7
144#define EXYNOS5440_TMU_TH_RISE0_SHIFT 0
145#define EXYNOS5440_TMU_TH_RISE1_SHIFT 8
146#define EXYNOS5440_TMU_TH_RISE2_SHIFT 16
147#define EXYNOS5440_TMU_TH_RISE3_SHIFT 24
148#define EXYNOS5440_TMU_TH_RISE4_SHIFT 24 107#define EXYNOS5440_TMU_TH_RISE4_SHIFT 24
149#define EXYNOS5440_EFUSE_SWAP_OFFSET 8 108#define EXYNOS5440_EFUSE_SWAP_OFFSET 8
150 109
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9bf10aa6069b..43b90709585f 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1575,8 +1575,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
1575 1575
1576 thermal_zone_device_update(tz); 1576 thermal_zone_device_update(tz);
1577 1577
1578 if (!result) 1578 return tz;
1579 return tz;
1580 1579
1581unregister: 1580unregister:
1582 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 1581 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 89c4cee253e3..2e900a98c3e3 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2413,12 +2413,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
2413 2413
2414 poll_wait(file, &tty->read_wait, wait); 2414 poll_wait(file, &tty->read_wait, wait);
2415 poll_wait(file, &tty->write_wait, wait); 2415 poll_wait(file, &tty->write_wait, wait);
2416 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
2417 mask |= POLLHUP;
2416 if (input_available_p(tty, 1)) 2418 if (input_available_p(tty, 1))
2417 mask |= POLLIN | POLLRDNORM; 2419 mask |= POLLIN | POLLRDNORM;
2420 else if (mask & POLLHUP) {
2421 tty_flush_to_ldisc(tty);
2422 if (input_available_p(tty, 1))
2423 mask |= POLLIN | POLLRDNORM;
2424 }
2418 if (tty->packet && tty->link->ctrl_status) 2425 if (tty->packet && tty->link->ctrl_status)
2419 mask |= POLLPRI | POLLIN | POLLRDNORM; 2426 mask |= POLLPRI | POLLIN | POLLRDNORM;
2420 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
2421 mask |= POLLHUP;
2422 if (tty_hung_up_p(file)) 2427 if (tty_hung_up_p(file))
2423 mask |= POLLHUP; 2428 mask |= POLLHUP;
2424 if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { 2429 if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) {
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 8f37d57165ec..de7aae523b37 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -81,7 +81,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
81 /* Set to highest baudrate supported */ 81 /* Set to highest baudrate supported */
82 if (baud >= 1152000) 82 if (baud >= 1152000)
83 baud = 921600; 83 baud = 921600;
84 quot = DIV_ROUND_CLOSEST(port->uartclk, 256 * baud); 84 quot = (port->uartclk / (256 * baud)) + 1;
85 } 85 }
86 86
87 /* 87 /*
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563335ae..56982da4a9e9 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
158 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) 158 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
159 return -EBUSY; 159 return -EBUSY;
160 160
161 info = kmalloc(sizeof(*info), GFP_KERNEL); 161 info = kzalloc(sizeof(*info), GFP_KERNEL);
162 if (info == NULL) 162 if (info == NULL)
163 return -ENOMEM; 163 return -ENOMEM;
164 164
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index df3a8c74358e..eaeb9a02c7fe 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -363,7 +363,7 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
363 * The spd_hi, spd_vhi, spd_shi, spd_warp kludge... 363 * The spd_hi, spd_vhi, spd_shi, spd_warp kludge...
364 * Die! Die! Die! 364 * Die! Die! Die!
365 */ 365 */
366 if (baud == 38400) 366 if (try == 0 && baud == 38400)
367 baud = altbaud; 367 baud = altbaud;
368 368
369 /* 369 /*
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 16a2c0237dd6..0508a1d8e4cd 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1709,6 +1709,8 @@ int tty_release(struct inode *inode, struct file *filp)
1709 int pty_master, tty_closing, o_tty_closing, do_sleep; 1709 int pty_master, tty_closing, o_tty_closing, do_sleep;
1710 int idx; 1710 int idx;
1711 char buf[64]; 1711 char buf[64];
1712 long timeout = 0;
1713 int once = 1;
1712 1714
1713 if (tty_paranoia_check(tty, inode, __func__)) 1715 if (tty_paranoia_check(tty, inode, __func__))
1714 return 0; 1716 return 0;
@@ -1789,11 +1791,18 @@ int tty_release(struct inode *inode, struct file *filp)
1789 if (!do_sleep) 1791 if (!do_sleep)
1790 break; 1792 break;
1791 1793
1792 printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", 1794 if (once) {
1793 __func__, tty_name(tty, buf)); 1795 once = 0;
1796 printk(KERN_WARNING "%s: %s: read/write wait queue active!\n",
1797 __func__, tty_name(tty, buf));
1798 }
1794 tty_unlock_pair(tty, o_tty); 1799 tty_unlock_pair(tty, o_tty);
1795 mutex_unlock(&tty_mutex); 1800 mutex_unlock(&tty_mutex);
1796 schedule(); 1801 schedule_timeout_killable(timeout);
1802 if (timeout < 120 * HZ)
1803 timeout = 2 * timeout + 1;
1804 else
1805 timeout = MAX_SCHEDULE_TIMEOUT;
1797 } 1806 }
1798 1807
1799 /* 1808 /*
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 610b720d3b91..59b25e039968 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -539,6 +539,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
539 539
540 /* Save original vc_unipagdir_loc in case we allocate a new one */ 540 /* Save original vc_unipagdir_loc in case we allocate a new one */
541 p = *vc->vc_uni_pagedir_loc; 541 p = *vc->vc_uni_pagedir_loc;
542
543 if (!p) {
544 err = -EINVAL;
545
546 goto out_unlock;
547 }
542 548
543 if (p->refcount > 1) { 549 if (p->refcount > 1) {
544 int j, k; 550 int j, k;
@@ -623,6 +629,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
623 set_inverse_transl(vc, p, i); /* Update inverse translations */ 629 set_inverse_transl(vc, p, i); /* Update inverse translations */
624 set_inverse_trans_unicode(vc, p); 630 set_inverse_trans_unicode(vc, p);
625 631
632out_unlock:
626 console_unlock(); 633 console_unlock();
627 return err; 634 return err;
628} 635}
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 3df5005c554d..9bdc6bd73432 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -742,7 +742,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
742 ci_role_destroy(ci); 742 ci_role_destroy(ci);
743 ci_hdrc_enter_lpm(ci, true); 743 ci_hdrc_enter_lpm(ci, true);
744 usb_phy_shutdown(ci->transceiver); 744 usb_phy_shutdown(ci->transceiver);
745 kfree(ci->hw_bank.regmap);
746 745
747 return 0; 746 return 0;
748} 747}
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index e934e19f49f5..077d58ac3dcb 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS];
60 60
61static DEFINE_MUTEX(acm_table_lock); 61static DEFINE_MUTEX(acm_table_lock);
62 62
63static void acm_tty_set_termios(struct tty_struct *tty,
64 struct ktermios *termios_old);
65
63/* 66/*
64 * acm_table accessors 67 * acm_table accessors
65 */ 68 */
@@ -145,8 +148,15 @@ static int acm_ctrl_msg(struct acm *acm, int request, int value,
145/* devices aren't required to support these requests. 148/* devices aren't required to support these requests.
146 * the cdc acm descriptor tells whether they do... 149 * the cdc acm descriptor tells whether they do...
147 */ 150 */
148#define acm_set_control(acm, control) \ 151static inline int acm_set_control(struct acm *acm, int control)
149 acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0) 152{
153 if (acm->quirks & QUIRK_CONTROL_LINE_STATE)
154 return -EOPNOTSUPP;
155
156 return acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE,
157 control, NULL, 0);
158}
159
150#define acm_set_line(acm, line) \ 160#define acm_set_line(acm, line) \
151 acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) 161 acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line))
152#define acm_send_break(acm, ms) \ 162#define acm_send_break(acm, ms) \
@@ -554,6 +564,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty)
554 goto error_submit_urb; 564 goto error_submit_urb;
555 } 565 }
556 566
567 acm_tty_set_termios(tty, NULL);
568
557 /* 569 /*
558 * Unthrottle device in case the TTY was closed while throttled. 570 * Unthrottle device in case the TTY was closed while throttled.
559 */ 571 */
@@ -980,11 +992,12 @@ static void acm_tty_set_termios(struct tty_struct *tty,
980 /* FIXME: Needs to clear unsupported bits in the termios */ 992 /* FIXME: Needs to clear unsupported bits in the termios */
981 acm->clocal = ((termios->c_cflag & CLOCAL) != 0); 993 acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
982 994
983 if (!newline.dwDTERate) { 995 if (C_BAUD(tty) == B0) {
984 newline.dwDTERate = acm->line.dwDTERate; 996 newline.dwDTERate = acm->line.dwDTERate;
985 newctrl &= ~ACM_CTRL_DTR; 997 newctrl &= ~ACM_CTRL_DTR;
986 } else 998 } else if (termios_old && (termios_old->c_cflag & CBAUD) == B0) {
987 newctrl |= ACM_CTRL_DTR; 999 newctrl |= ACM_CTRL_DTR;
1000 }
988 1001
989 if (newctrl != acm->ctrlout) 1002 if (newctrl != acm->ctrlout)
990 acm_set_control(acm, acm->ctrlout = newctrl); 1003 acm_set_control(acm, acm->ctrlout = newctrl);
@@ -1314,6 +1327,7 @@ made_compressed_probe:
1314 tty_port_init(&acm->port); 1327 tty_port_init(&acm->port);
1315 acm->port.ops = &acm_port_ops; 1328 acm->port.ops = &acm_port_ops;
1316 init_usb_anchor(&acm->delayed); 1329 init_usb_anchor(&acm->delayed);
1330 acm->quirks = quirks;
1317 1331
1318 buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); 1332 buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
1319 if (!buf) { 1333 if (!buf) {
@@ -1681,6 +1695,9 @@ static const struct usb_device_id acm_ids[] = {
1681 { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ 1695 { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */
1682 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1696 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1683 }, 1697 },
1698 { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */
1699 .driver_info = QUIRK_CONTROL_LINE_STATE, },
1700 { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */
1684 { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ 1701 { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
1685 }, 1702 },
1686 /* Motorola H24 HSPA module: */ 1703 /* Motorola H24 HSPA module: */
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index fc75651afe1c..d3251ebd09e2 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -121,6 +121,7 @@ struct acm {
121 unsigned int throttle_req:1; /* throttle requested */ 121 unsigned int throttle_req:1; /* throttle requested */
122 u8 bInterval; 122 u8 bInterval;
123 struct usb_anchor delayed; /* writes queued for a device about to be woken */ 123 struct usb_anchor delayed; /* writes queued for a device about to be woken */
124 unsigned long quirks;
124}; 125};
125 126
126#define CDC_DATA_INTERFACE_TYPE 0x0a 127#define CDC_DATA_INTERFACE_TYPE 0x0a
@@ -132,3 +133,4 @@ struct acm {
132#define NOT_A_MODEM BIT(3) 133#define NOT_A_MODEM BIT(3)
133#define NO_DATA_INTERFACE BIT(4) 134#define NO_DATA_INTERFACE BIT(4)
134#define IGNORE_DEVICE BIT(5) 135#define IGNORE_DEVICE BIT(5)
136#define QUIRK_CONTROL_LINE_STATE BIT(6)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index b84fb141e122..a6efb4184f2b 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2060,6 +2060,8 @@ int usb_alloc_streams(struct usb_interface *interface,
2060 return -EINVAL; 2060 return -EINVAL;
2061 if (dev->speed != USB_SPEED_SUPER) 2061 if (dev->speed != USB_SPEED_SUPER)
2062 return -EINVAL; 2062 return -EINVAL;
2063 if (dev->state < USB_STATE_CONFIGURED)
2064 return -ENODEV;
2063 2065
2064 for (i = 0; i < num_eps; i++) { 2066 for (i = 0; i < num_eps; i++) {
2065 /* Streams only apply to bulk endpoints. */ 2067 /* Streams only apply to bulk endpoints. */
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 11e80ac31324..b649fef2e35d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4468,9 +4468,6 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
4468 if (retval) 4468 if (retval)
4469 goto fail; 4469 goto fail;
4470 4470
4471 if (hcd->usb_phy && !hdev->parent)
4472 usb_phy_notify_connect(hcd->usb_phy, udev->speed);
4473
4474 /* 4471 /*
4475 * Some superspeed devices have finished the link training process 4472 * Some superspeed devices have finished the link training process
4476 * and attached to a superspeed hub port, but the device descriptor 4473 * and attached to a superspeed hub port, but the device descriptor
@@ -4627,8 +4624,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
4627 4624
4628 /* Disconnect any existing devices under this port */ 4625 /* Disconnect any existing devices under this port */
4629 if (udev) { 4626 if (udev) {
4630 if (hcd->usb_phy && !hdev->parent && 4627 if (hcd->usb_phy && !hdev->parent)
4631 !(portstatus & USB_PORT_STAT_CONNECTION))
4632 usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); 4628 usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
4633 usb_disconnect(&port_dev->child); 4629 usb_disconnect(&port_dev->child);
4634 } 4630 }
@@ -4783,6 +4779,10 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
4783 port_dev->child = NULL; 4779 port_dev->child = NULL;
4784 spin_unlock_irq(&device_state_lock); 4780 spin_unlock_irq(&device_state_lock);
4785 mutex_unlock(&usb_port_peer_mutex); 4781 mutex_unlock(&usb_port_peer_mutex);
4782 } else {
4783 if (hcd->usb_phy && !hdev->parent)
4784 usb_phy_notify_connect(hcd->usb_phy,
4785 udev->speed);
4786 } 4786 }
4787 } 4787 }
4788 4788
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 5ae883dc21f5..39b4081b632d 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -97,6 +97,12 @@ static const struct usb_device_id usb_quirk_list[] = {
97 { USB_DEVICE(0x04f3, 0x0089), .driver_info = 97 { USB_DEVICE(0x04f3, 0x0089), .driver_info =
98 USB_QUIRK_DEVICE_QUALIFIER }, 98 USB_QUIRK_DEVICE_QUALIFIER },
99 99
100 { USB_DEVICE(0x04f3, 0x009b), .driver_info =
101 USB_QUIRK_DEVICE_QUALIFIER },
102
103 { USB_DEVICE(0x04f3, 0x016f), .driver_info =
104 USB_QUIRK_DEVICE_QUALIFIER },
105
100 /* Roland SC-8820 */ 106 /* Roland SC-8820 */
101 { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, 107 { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },
102 108
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index bf015ab3b44c..55c90c53f2d6 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -619,7 +619,7 @@ struct dwc2_hsotg {
619 unsigned port_suspend_change:1; 619 unsigned port_suspend_change:1;
620 unsigned port_over_current_change:1; 620 unsigned port_over_current_change:1;
621 unsigned port_l1_change:1; 621 unsigned port_l1_change:1;
622 unsigned reserved:26; 622 unsigned reserved:25;
623 } b; 623 } b;
624 } flags; 624 } flags;
625 625
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 7b5856fadd93..8b5c079c7b7d 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2327,7 +2327,7 @@ irq_retry:
2327 2327
2328 u32 usb_status = readl(hsotg->regs + GOTGCTL); 2328 u32 usb_status = readl(hsotg->regs + GOTGCTL);
2329 2329
2330 dev_info(hsotg->dev, "%s: USBRst\n", __func__); 2330 dev_dbg(hsotg->dev, "%s: USBRst\n", __func__);
2331 dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", 2331 dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n",
2332 readl(hsotg->regs + GNPTXSTS)); 2332 readl(hsotg->regs + GNPTXSTS));
2333 2333
@@ -2561,8 +2561,10 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
2561 hs_ep->fifo_size = val; 2561 hs_ep->fifo_size = val;
2562 break; 2562 break;
2563 } 2563 }
2564 if (i == 8) 2564 if (i == 8) {
2565 return -ENOMEM; 2565 ret = -ENOMEM;
2566 goto error;
2567 }
2566 } 2568 }
2567 2569
2568 /* for non control endpoints, set PID to D0 */ 2570 /* for non control endpoints, set PID to D0 */
@@ -2579,6 +2581,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
2579 /* enable the endpoint interrupt */ 2581 /* enable the endpoint interrupt */
2580 s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); 2582 s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
2581 2583
2584error:
2582 spin_unlock_irqrestore(&hsotg->lock, flags); 2585 spin_unlock_irqrestore(&hsotg->lock, flags);
2583 return ret; 2586 return ret;
2584} 2587}
@@ -2934,9 +2937,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
2934 2937
2935 spin_lock_irqsave(&hsotg->lock, flags); 2938 spin_lock_irqsave(&hsotg->lock, flags);
2936 2939
2937 if (!driver) 2940 hsotg->driver = NULL;
2938 hsotg->driver = NULL;
2939
2940 hsotg->gadget.speed = USB_SPEED_UNKNOWN; 2941 hsotg->gadget.speed = USB_SPEED_UNKNOWN;
2941 2942
2942 spin_unlock_irqrestore(&hsotg->lock, flags); 2943 spin_unlock_irqrestore(&hsotg->lock, flags);
@@ -3567,6 +3568,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
3567 s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum); 3568 s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum);
3568 3569
3569 /* disable power and clock */ 3570 /* disable power and clock */
3571 s3c_hsotg_phy_disable(hsotg);
3570 3572
3571 ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), 3573 ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
3572 hsotg->supplies); 3574 hsotg->supplies);
@@ -3575,8 +3577,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
3575 goto err_ep_mem; 3577 goto err_ep_mem;
3576 } 3578 }
3577 3579
3578 s3c_hsotg_phy_disable(hsotg);
3579
3580 ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget); 3580 ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget);
3581 if (ret) 3581 if (ret)
3582 goto err_ep_mem; 3582 goto err_ep_mem;
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 2f537d588225..a0aa9f3da441 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -597,7 +597,7 @@ static int dwc3_omap_prepare(struct device *dev)
597{ 597{
598 struct dwc3_omap *omap = dev_get_drvdata(dev); 598 struct dwc3_omap *omap = dev_get_drvdata(dev);
599 599
600 dwc3_omap_write_irqmisc_set(omap, 0x00); 600 dwc3_omap_disable_irqs(omap);
601 601
602 return 0; 602 return 0;
603} 603}
@@ -605,19 +605,8 @@ static int dwc3_omap_prepare(struct device *dev)
605static void dwc3_omap_complete(struct device *dev) 605static void dwc3_omap_complete(struct device *dev)
606{ 606{
607 struct dwc3_omap *omap = dev_get_drvdata(dev); 607 struct dwc3_omap *omap = dev_get_drvdata(dev);
608 u32 reg;
609 608
610 reg = (USBOTGSS_IRQMISC_OEVT | 609 dwc3_omap_enable_irqs(omap);
611 USBOTGSS_IRQMISC_DRVVBUS_RISE |
612 USBOTGSS_IRQMISC_CHRGVBUS_RISE |
613 USBOTGSS_IRQMISC_DISCHRGVBUS_RISE |
614 USBOTGSS_IRQMISC_IDPULLUP_RISE |
615 USBOTGSS_IRQMISC_DRVVBUS_FALL |
616 USBOTGSS_IRQMISC_CHRGVBUS_FALL |
617 USBOTGSS_IRQMISC_DISCHRGVBUS_FALL |
618 USBOTGSS_IRQMISC_IDPULLUP_FALL);
619
620 dwc3_omap_write_irqmisc_set(omap, reg);
621} 610}
622 611
623static int dwc3_omap_suspend(struct device *dev) 612static int dwc3_omap_suspend(struct device *dev)
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 436fb08c40b8..a36cf66302fb 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -30,6 +30,7 @@
30#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd 30#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
31#define PCI_DEVICE_ID_INTEL_BYT 0x0f37 31#define PCI_DEVICE_ID_INTEL_BYT 0x0f37
32#define PCI_DEVICE_ID_INTEL_MRFLD 0x119e 32#define PCI_DEVICE_ID_INTEL_MRFLD 0x119e
33#define PCI_DEVICE_ID_INTEL_BSW 0x22B7
33 34
34struct dwc3_pci { 35struct dwc3_pci {
35 struct device *dev; 36 struct device *dev;
@@ -181,6 +182,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
181 PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, 182 PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
182 PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), 183 PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
183 }, 184 },
185 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), },
184 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, 186 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
185 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, 187 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
186 { } /* Terminating Entry */ 188 { } /* Terminating Entry */
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index b35938777dde..711b23019d54 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -256,7 +256,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
256 256
257 /* stall is always issued on EP0 */ 257 /* stall is always issued on EP0 */
258 dep = dwc->eps[0]; 258 dep = dwc->eps[0];
259 __dwc3_gadget_ep_set_halt(dep, 1); 259 __dwc3_gadget_ep_set_halt(dep, 1, false);
260 dep->flags = DWC3_EP_ENABLED; 260 dep->flags = DWC3_EP_ENABLED;
261 dwc->delayed_status = false; 261 dwc->delayed_status = false;
262 262
@@ -271,7 +271,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
271 dwc3_ep0_out_start(dwc); 271 dwc3_ep0_out_start(dwc);
272} 272}
273 273
274int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) 274int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value)
275{ 275{
276 struct dwc3_ep *dep = to_dwc3_ep(ep); 276 struct dwc3_ep *dep = to_dwc3_ep(ep);
277 struct dwc3 *dwc = dep->dwc; 277 struct dwc3 *dwc = dep->dwc;
@@ -281,6 +281,20 @@ int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value)
281 return 0; 281 return 0;
282} 282}
283 283
284int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value)
285{
286 struct dwc3_ep *dep = to_dwc3_ep(ep);
287 struct dwc3 *dwc = dep->dwc;
288 unsigned long flags;
289 int ret;
290
291 spin_lock_irqsave(&dwc->lock, flags);
292 ret = __dwc3_gadget_ep0_set_halt(ep, value);
293 spin_unlock_irqrestore(&dwc->lock, flags);
294
295 return ret;
296}
297
284void dwc3_ep0_out_start(struct dwc3 *dwc) 298void dwc3_ep0_out_start(struct dwc3 *dwc)
285{ 299{
286 int ret; 300 int ret;
@@ -466,7 +480,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
466 return -EINVAL; 480 return -EINVAL;
467 if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) 481 if (set == 0 && (dep->flags & DWC3_EP_WEDGE))
468 break; 482 break;
469 ret = __dwc3_gadget_ep_set_halt(dep, set); 483 ret = __dwc3_gadget_ep_set_halt(dep, set, true);
470 if (ret) 484 if (ret)
471 return -EINVAL; 485 return -EINVAL;
472 break; 486 break;
@@ -775,9 +789,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
775 789
776 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; 790 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS;
777 791
778 r = next_request(&ep0->request_list);
779 ur = &r->request;
780
781 trb = dwc->ep0_trb; 792 trb = dwc->ep0_trb;
782 793
783 status = DWC3_TRB_SIZE_TRBSTS(trb->size); 794 status = DWC3_TRB_SIZE_TRBSTS(trb->size);
@@ -790,6 +801,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
790 return; 801 return;
791 } 802 }
792 803
804 r = next_request(&ep0->request_list);
805 if (!r)
806 return;
807
808 ur = &r->request;
809
793 length = trb->size & DWC3_TRB_SIZE_MASK; 810 length = trb->size & DWC3_TRB_SIZE_MASK;
794 811
795 if (dwc->ep0_bounced) { 812 if (dwc->ep0_bounced) {
@@ -811,12 +828,19 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
811 828
812 dwc3_ep0_stall_and_restart(dwc); 829 dwc3_ep0_stall_and_restart(dwc);
813 } else { 830 } else {
814 /* 831 dwc3_gadget_giveback(ep0, r, 0);
815 * handle the case where we have to send a zero packet. This 832
816 * seems to be case when req.length > maxpacket. Could it be? 833 if (IS_ALIGNED(ur->length, ep0->endpoint.maxpacket) &&
817 */ 834 ur->length && ur->zero) {
818 if (r) 835 int ret;
819 dwc3_gadget_giveback(ep0, r, 0); 836
837 dwc->ep0_next_event = DWC3_EP0_COMPLETE;
838
839 ret = dwc3_ep0_start_trans(dwc, epnum,
840 dwc->ctrl_req_addr, 0,
841 DWC3_TRBCTL_CONTROL_DATA);
842 WARN_ON(ret < 0);
843 }
820 } 844 }
821} 845}
822 846
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3818b26bfc05..546ea5431b8c 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -525,12 +525,11 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
525 if (!usb_endpoint_xfer_isoc(desc)) 525 if (!usb_endpoint_xfer_isoc(desc))
526 return 0; 526 return 0;
527 527
528 memset(&trb_link, 0, sizeof(trb_link));
529
530 /* Link TRB for ISOC. The HWO bit is never reset */ 528 /* Link TRB for ISOC. The HWO bit is never reset */
531 trb_st_hw = &dep->trb_pool[0]; 529 trb_st_hw = &dep->trb_pool[0];
532 530
533 trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; 531 trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1];
532 memset(trb_link, 0, sizeof(*trb_link));
534 533
535 trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); 534 trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw));
536 trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); 535 trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw));
@@ -581,7 +580,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
581 580
582 /* make sure HW endpoint isn't stalled */ 581 /* make sure HW endpoint isn't stalled */
583 if (dep->flags & DWC3_EP_STALL) 582 if (dep->flags & DWC3_EP_STALL)
584 __dwc3_gadget_ep_set_halt(dep, 0); 583 __dwc3_gadget_ep_set_halt(dep, 0, false);
585 584
586 reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); 585 reg = dwc3_readl(dwc->regs, DWC3_DALEPENA);
587 reg &= ~DWC3_DALEPENA_EP(dep->number); 586 reg &= ~DWC3_DALEPENA_EP(dep->number);
@@ -1202,15 +1201,28 @@ out0:
1202 return ret; 1201 return ret;
1203} 1202}
1204 1203
1205int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) 1204int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
1206{ 1205{
1207 struct dwc3_gadget_ep_cmd_params params; 1206 struct dwc3_gadget_ep_cmd_params params;
1208 struct dwc3 *dwc = dep->dwc; 1207 struct dwc3 *dwc = dep->dwc;
1209 int ret; 1208 int ret;
1210 1209
1210 if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
1211 dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name);
1212 return -EINVAL;
1213 }
1214
1211 memset(&params, 0x00, sizeof(params)); 1215 memset(&params, 0x00, sizeof(params));
1212 1216
1213 if (value) { 1217 if (value) {
1218 if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) ||
1219 (!list_empty(&dep->req_queued) ||
1220 !list_empty(&dep->request_list)))) {
1221 dev_dbg(dwc->dev, "%s: pending request, cannot halt\n",
1222 dep->name);
1223 return -EAGAIN;
1224 }
1225
1214 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, 1226 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
1215 DWC3_DEPCMD_SETSTALL, &params); 1227 DWC3_DEPCMD_SETSTALL, &params);
1216 if (ret) 1228 if (ret)
@@ -1241,15 +1253,7 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value)
1241 int ret; 1253 int ret;
1242 1254
1243 spin_lock_irqsave(&dwc->lock, flags); 1255 spin_lock_irqsave(&dwc->lock, flags);
1244 1256 ret = __dwc3_gadget_ep_set_halt(dep, value, false);
1245 if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
1246 dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name);
1247 ret = -EINVAL;
1248 goto out;
1249 }
1250
1251 ret = __dwc3_gadget_ep_set_halt(dep, value);
1252out:
1253 spin_unlock_irqrestore(&dwc->lock, flags); 1257 spin_unlock_irqrestore(&dwc->lock, flags);
1254 1258
1255 return ret; 1259 return ret;
@@ -1260,15 +1264,18 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep)
1260 struct dwc3_ep *dep = to_dwc3_ep(ep); 1264 struct dwc3_ep *dep = to_dwc3_ep(ep);
1261 struct dwc3 *dwc = dep->dwc; 1265 struct dwc3 *dwc = dep->dwc;
1262 unsigned long flags; 1266 unsigned long flags;
1267 int ret;
1263 1268
1264 spin_lock_irqsave(&dwc->lock, flags); 1269 spin_lock_irqsave(&dwc->lock, flags);
1265 dep->flags |= DWC3_EP_WEDGE; 1270 dep->flags |= DWC3_EP_WEDGE;
1266 spin_unlock_irqrestore(&dwc->lock, flags);
1267 1271
1268 if (dep->number == 0 || dep->number == 1) 1272 if (dep->number == 0 || dep->number == 1)
1269 return dwc3_gadget_ep0_set_halt(ep, 1); 1273 ret = __dwc3_gadget_ep0_set_halt(ep, 1);
1270 else 1274 else
1271 return dwc3_gadget_ep_set_halt(ep, 1); 1275 ret = __dwc3_gadget_ep_set_halt(dep, 1, false);
1276 spin_unlock_irqrestore(&dwc->lock, flags);
1277
1278 return ret;
1272} 1279}
1273 1280
1274/* -------------------------------------------------------------------------- */ 1281/* -------------------------------------------------------------------------- */
diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
index 178ad8982206..18ae3eaa8b6f 100644
--- a/drivers/usb/dwc3/gadget.h
+++ b/drivers/usb/dwc3/gadget.h
@@ -82,10 +82,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
82void dwc3_ep0_interrupt(struct dwc3 *dwc, 82void dwc3_ep0_interrupt(struct dwc3 *dwc,
83 const struct dwc3_event_depevt *event); 83 const struct dwc3_event_depevt *event);
84void dwc3_ep0_out_start(struct dwc3 *dwc); 84void dwc3_ep0_out_start(struct dwc3 *dwc);
85int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value);
85int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); 86int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value);
86int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, 87int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
87 gfp_t gfp_flags); 88 gfp_t gfp_flags);
88int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value); 89int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol);
89 90
90/** 91/**
91 * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW 92 * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index 78aff1da089a..60b0f41eafc4 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -73,15 +73,23 @@ DECLARE_EVENT_CLASS(dwc3_log_ctrl,
73 TP_PROTO(struct usb_ctrlrequest *ctrl), 73 TP_PROTO(struct usb_ctrlrequest *ctrl),
74 TP_ARGS(ctrl), 74 TP_ARGS(ctrl),
75 TP_STRUCT__entry( 75 TP_STRUCT__entry(
76 __field(struct usb_ctrlrequest *, ctrl) 76 __field(__u8, bRequestType)
77 __field(__u8, bRequest)
78 __field(__le16, wValue)
79 __field(__le16, wIndex)
80 __field(__le16, wLength)
77 ), 81 ),
78 TP_fast_assign( 82 TP_fast_assign(
79 __entry->ctrl = ctrl; 83 __entry->bRequestType = ctrl->bRequestType;
84 __entry->bRequest = ctrl->bRequest;
85 __entry->wValue = ctrl->wValue;
86 __entry->wIndex = ctrl->wIndex;
87 __entry->wLength = ctrl->wLength;
80 ), 88 ),
81 TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", 89 TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
82 __entry->ctrl->bRequestType, __entry->ctrl->bRequest, 90 __entry->bRequestType, __entry->bRequest,
83 le16_to_cpu(__entry->ctrl->wValue), le16_to_cpu(__entry->ctrl->wIndex), 91 le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex),
84 le16_to_cpu(__entry->ctrl->wLength) 92 le16_to_cpu(__entry->wLength)
85 ) 93 )
86); 94);
87 95
@@ -94,15 +102,22 @@ DECLARE_EVENT_CLASS(dwc3_log_request,
94 TP_PROTO(struct dwc3_request *req), 102 TP_PROTO(struct dwc3_request *req),
95 TP_ARGS(req), 103 TP_ARGS(req),
96 TP_STRUCT__entry( 104 TP_STRUCT__entry(
105 __dynamic_array(char, name, DWC3_MSG_MAX)
97 __field(struct dwc3_request *, req) 106 __field(struct dwc3_request *, req)
107 __field(unsigned, actual)
108 __field(unsigned, length)
109 __field(int, status)
98 ), 110 ),
99 TP_fast_assign( 111 TP_fast_assign(
112 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name);
100 __entry->req = req; 113 __entry->req = req;
114 __entry->actual = req->request.actual;
115 __entry->length = req->request.length;
116 __entry->status = req->request.status;
101 ), 117 ),
102 TP_printk("%s: req %p length %u/%u ==> %d", 118 TP_printk("%s: req %p length %u/%u ==> %d",
103 __entry->req->dep->name, __entry->req, 119 __get_str(name), __entry->req, __entry->actual, __entry->length,
104 __entry->req->request.actual, __entry->req->request.length, 120 __entry->status
105 __entry->req->request.status
106 ) 121 )
107); 122);
108 123
@@ -158,17 +173,17 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
158 struct dwc3_gadget_ep_cmd_params *params), 173 struct dwc3_gadget_ep_cmd_params *params),
159 TP_ARGS(dep, cmd, params), 174 TP_ARGS(dep, cmd, params),
160 TP_STRUCT__entry( 175 TP_STRUCT__entry(
161 __field(struct dwc3_ep *, dep) 176 __dynamic_array(char, name, DWC3_MSG_MAX)
162 __field(unsigned int, cmd) 177 __field(unsigned int, cmd)
163 __field(struct dwc3_gadget_ep_cmd_params *, params) 178 __field(struct dwc3_gadget_ep_cmd_params *, params)
164 ), 179 ),
165 TP_fast_assign( 180 TP_fast_assign(
166 __entry->dep = dep; 181 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
167 __entry->cmd = cmd; 182 __entry->cmd = cmd;
168 __entry->params = params; 183 __entry->params = params;
169 ), 184 ),
170 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", 185 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n",
171 __entry->dep->name, dwc3_gadget_ep_cmd_string(__entry->cmd), 186 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
172 __entry->cmd, __entry->params->param0, 187 __entry->cmd, __entry->params->param0,
173 __entry->params->param1, __entry->params->param2 188 __entry->params->param1, __entry->params->param2
174 ) 189 )
@@ -184,16 +199,24 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
184 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), 199 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
185 TP_ARGS(dep, trb), 200 TP_ARGS(dep, trb),
186 TP_STRUCT__entry( 201 TP_STRUCT__entry(
187 __field(struct dwc3_ep *, dep) 202 __dynamic_array(char, name, DWC3_MSG_MAX)
188 __field(struct dwc3_trb *, trb) 203 __field(struct dwc3_trb *, trb)
204 __field(u32, bpl)
205 __field(u32, bph)
206 __field(u32, size)
207 __field(u32, ctrl)
189 ), 208 ),
190 TP_fast_assign( 209 TP_fast_assign(
191 __entry->dep = dep; 210 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
192 __entry->trb = trb; 211 __entry->trb = trb;
212 __entry->bpl = trb->bpl;
213 __entry->bph = trb->bph;
214 __entry->size = trb->size;
215 __entry->ctrl = trb->ctrl;
193 ), 216 ),
194 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", 217 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n",
195 __entry->dep->name, __entry->trb, __entry->trb->bph, 218 __get_str(name), __entry->trb, __entry->bph, __entry->bpl,
196 __entry->trb->bpl, __entry->trb->size, __entry->trb->ctrl 219 __entry->size, __entry->ctrl
197 ) 220 )
198); 221);
199 222
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index a8c18df171c3..f6a51fddd5b5 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -560,7 +560,7 @@ static int bos_desc(struct usb_composite_dev *cdev)
560 usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; 560 usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE;
561 usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; 561 usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY;
562 usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; 562 usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT;
563 usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT); 563 usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT | USB_BESL_SUPPORT);
564 564
565 /* 565 /*
566 * The Superspeed USB Capability descriptor shall be implemented by all 566 * The Superspeed USB Capability descriptor shall be implemented by all
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
index 6da4685490ef..aad8165e98ef 100644
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -433,12 +433,12 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
433 dev_vdbg(&cdev->gadget->dev, 433 dev_vdbg(&cdev->gadget->dev,
434 "reset acm control interface %d\n", intf); 434 "reset acm control interface %d\n", intf);
435 usb_ep_disable(acm->notify); 435 usb_ep_disable(acm->notify);
436 } else { 436 }
437 dev_vdbg(&cdev->gadget->dev, 437
438 "init acm ctrl interface %d\n", intf); 438 if (!acm->notify->desc)
439 if (config_ep_by_speed(cdev->gadget, f, acm->notify)) 439 if (config_ep_by_speed(cdev->gadget, f, acm->notify))
440 return -EINVAL; 440 return -EINVAL;
441 } 441
442 usb_ep_enable(acm->notify); 442 usb_ep_enable(acm->notify);
443 acm->notify->driver_data = acm; 443 acm->notify->driver_data = acm;
444 444
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
index 4d8b236ea608..c9e90de5bdd9 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -325,7 +325,6 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f)
325 return 0; 325 return 0;
326 326
327fail: 327fail:
328 usb_free_all_descriptors(f);
329 if (eem->port.out_ep) 328 if (eem->port.out_ep)
330 eem->port.out_ep->driver_data = NULL; 329 eem->port.out_ep->driver_data = NULL;
331 if (eem->port.in_ep) 330 if (eem->port.in_ep)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 7c6771d027a2..63314ede7ba6 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -647,15 +647,26 @@ static void ffs_user_copy_worker(struct work_struct *work)
647 if (io_data->read && ret > 0) { 647 if (io_data->read && ret > 0) {
648 int i; 648 int i;
649 size_t pos = 0; 649 size_t pos = 0;
650
651 /*
652 * Since req->length may be bigger than io_data->len (after
653 * being rounded up to maxpacketsize), we may end up with more
654 * data then user space has space for.
655 */
656 ret = min_t(int, ret, io_data->len);
657
650 use_mm(io_data->mm); 658 use_mm(io_data->mm);
651 for (i = 0; i < io_data->nr_segs; i++) { 659 for (i = 0; i < io_data->nr_segs; i++) {
660 size_t len = min_t(size_t, ret - pos,
661 io_data->iovec[i].iov_len);
662 if (!len)
663 break;
652 if (unlikely(copy_to_user(io_data->iovec[i].iov_base, 664 if (unlikely(copy_to_user(io_data->iovec[i].iov_base,
653 &io_data->buf[pos], 665 &io_data->buf[pos], len))) {
654 io_data->iovec[i].iov_len))) {
655 ret = -EFAULT; 666 ret = -EFAULT;
656 break; 667 break;
657 } 668 }
658 pos += io_data->iovec[i].iov_len; 669 pos += len;
659 } 670 }
660 unuse_mm(io_data->mm); 671 unuse_mm(io_data->mm);
661 } 672 }
@@ -687,7 +698,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
687 struct ffs_epfile *epfile = file->private_data; 698 struct ffs_epfile *epfile = file->private_data;
688 struct ffs_ep *ep; 699 struct ffs_ep *ep;
689 char *data = NULL; 700 char *data = NULL;
690 ssize_t ret, data_len; 701 ssize_t ret, data_len = -EINVAL;
691 int halt; 702 int halt;
692 703
693 /* Are we still active? */ 704 /* Are we still active? */
@@ -787,13 +798,30 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
787 /* Fire the request */ 798 /* Fire the request */
788 struct usb_request *req; 799 struct usb_request *req;
789 800
801 /*
802 * Sanity Check: even though data_len can't be used
803 * uninitialized at the time I write this comment, some
804 * compilers complain about this situation.
805 * In order to keep the code clean from warnings, data_len is
806 * being initialized to -EINVAL during its declaration, which
807 * means we can't rely on compiler anymore to warn no future
808 * changes won't result in data_len being used uninitialized.
809 * For such reason, we're adding this redundant sanity check
810 * here.
811 */
812 if (unlikely(data_len == -EINVAL)) {
813 WARN(1, "%s: data_len == -EINVAL\n", __func__);
814 ret = -EINVAL;
815 goto error_lock;
816 }
817
790 if (io_data->aio) { 818 if (io_data->aio) {
791 req = usb_ep_alloc_request(ep->ep, GFP_KERNEL); 819 req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
792 if (unlikely(!req)) 820 if (unlikely(!req))
793 goto error_lock; 821 goto error_lock;
794 822
795 req->buf = data; 823 req->buf = data;
796 req->length = io_data->len; 824 req->length = data_len;
797 825
798 io_data->buf = data; 826 io_data->buf = data;
799 io_data->ep = ep->ep; 827 io_data->ep = ep->ep;
@@ -815,7 +843,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
815 843
816 req = ep->req; 844 req = ep->req;
817 req->buf = data; 845 req->buf = data;
818 req->length = io_data->len; 846 req->length = data_len;
819 847
820 req->context = &done; 848 req->context = &done;
821 req->complete = ffs_epfile_io_complete; 849 req->complete = ffs_epfile_io_complete;
@@ -2663,8 +2691,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,
2663 func->conf = c; 2691 func->conf = c;
2664 func->gadget = c->cdev->gadget; 2692 func->gadget = c->cdev->gadget;
2665 2693
2666 ffs_data_get(func->ffs);
2667
2668 /* 2694 /*
2669 * in drivers/usb/gadget/configfs.c:configfs_composite_bind() 2695 * in drivers/usb/gadget/configfs.c:configfs_composite_bind()
2670 * configurations are bound in sequence with list_for_each_entry, 2696 * configurations are bound in sequence with list_for_each_entry,
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index a95290a1289f..59ab62c92b66 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -621,12 +621,14 @@ static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f)
621 dev = MKDEV(major, hidg->minor); 621 dev = MKDEV(major, hidg->minor);
622 status = cdev_add(&hidg->cdev, dev, 1); 622 status = cdev_add(&hidg->cdev, dev, 1);
623 if (status) 623 if (status)
624 goto fail; 624 goto fail_free_descs;
625 625
626 device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor); 626 device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor);
627 627
628 return 0; 628 return 0;
629 629
630fail_free_descs:
631 usb_free_all_descriptors(f);
630fail: 632fail:
631 ERROR(f->config->cdev, "hidg_bind FAILED\n"); 633 ERROR(f->config->cdev, "hidg_bind FAILED\n");
632 if (hidg->req != NULL) { 634 if (hidg->req != NULL) {
@@ -635,7 +637,6 @@ fail:
635 usb_ep_free_request(hidg->in_ep, hidg->req); 637 usb_ep_free_request(hidg->in_ep, hidg->req);
636 } 638 }
637 639
638 usb_free_all_descriptors(f);
639 return status; 640 return status;
640} 641}
641 642
diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c
index bf04389137e6..298b46112b1a 100644
--- a/drivers/usb/gadget/function/f_loopback.c
+++ b/drivers/usb/gadget/function/f_loopback.c
@@ -253,22 +253,13 @@ static void loopback_complete(struct usb_ep *ep, struct usb_request *req)
253 253
254 case 0: /* normal completion? */ 254 case 0: /* normal completion? */
255 if (ep == loop->out_ep) { 255 if (ep == loop->out_ep) {
256 /* loop this OUT packet back IN to the host */
257 req->zero = (req->actual < req->length); 256 req->zero = (req->actual < req->length);
258 req->length = req->actual; 257 req->length = req->actual;
259 status = usb_ep_queue(loop->in_ep, req, GFP_ATOMIC);
260 if (status == 0)
261 return;
262
263 /* "should never get here" */
264 ERROR(cdev, "can't loop %s to %s: %d\n",
265 ep->name, loop->in_ep->name,
266 status);
267 } 258 }
268 259
269 /* queue the buffer for some later OUT packet */ 260 /* queue the buffer for some later OUT packet */
270 req->length = buflen; 261 req->length = buflen;
271 status = usb_ep_queue(loop->out_ep, req, GFP_ATOMIC); 262 status = usb_ep_queue(ep, req, GFP_ATOMIC);
272 if (status == 0) 263 if (status == 0)
273 return; 264 return;
274 265
@@ -308,60 +299,66 @@ static inline struct usb_request *lb_alloc_ep_req(struct usb_ep *ep, int len)
308 return alloc_ep_req(ep, len, buflen); 299 return alloc_ep_req(ep, len, buflen);
309} 300}
310 301
311static int 302static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback *loop,
312enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) 303 struct usb_ep *ep)
313{ 304{
314 int result = 0;
315 struct usb_ep *ep;
316 struct usb_request *req; 305 struct usb_request *req;
317 unsigned i; 306 unsigned i;
307 int result;
318 308
319 /* one endpoint writes data back IN to the host */ 309 /*
320 ep = loop->in_ep; 310 * one endpoint writes data back IN to the host while another endpoint
311 * just reads OUT packets
312 */
321 result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); 313 result = config_ep_by_speed(cdev->gadget, &(loop->function), ep);
322 if (result) 314 if (result)
323 return result; 315 goto fail0;
324 result = usb_ep_enable(ep); 316 result = usb_ep_enable(ep);
325 if (result < 0) 317 if (result < 0)
326 return result;
327 ep->driver_data = loop;
328
329 /* one endpoint just reads OUT packets */
330 ep = loop->out_ep;
331 result = config_ep_by_speed(cdev->gadget, &(loop->function), ep);
332 if (result)
333 goto fail0; 318 goto fail0;
334
335 result = usb_ep_enable(ep);
336 if (result < 0) {
337fail0:
338 ep = loop->in_ep;
339 usb_ep_disable(ep);
340 ep->driver_data = NULL;
341 return result;
342 }
343 ep->driver_data = loop; 319 ep->driver_data = loop;
344 320
345 /* allocate a bunch of read buffers and queue them all at once. 321 /*
322 * allocate a bunch of read buffers and queue them all at once.
346 * we buffer at most 'qlen' transfers; fewer if any need more 323 * we buffer at most 'qlen' transfers; fewer if any need more
347 * than 'buflen' bytes each. 324 * than 'buflen' bytes each.
348 */ 325 */
349 for (i = 0; i < qlen && result == 0; i++) { 326 for (i = 0; i < qlen && result == 0; i++) {
350 req = lb_alloc_ep_req(ep, 0); 327 req = lb_alloc_ep_req(ep, 0);
351 if (req) { 328 if (!req)
352 req->complete = loopback_complete; 329 goto fail1;
353 result = usb_ep_queue(ep, req, GFP_ATOMIC); 330
354 if (result) 331 req->complete = loopback_complete;
355 ERROR(cdev, "%s queue req --> %d\n", 332 result = usb_ep_queue(ep, req, GFP_ATOMIC);
356 ep->name, result); 333 if (result) {
357 } else { 334 ERROR(cdev, "%s queue req --> %d\n",
358 usb_ep_disable(ep); 335 ep->name, result);
359 ep->driver_data = NULL; 336 goto fail1;
360 result = -ENOMEM;
361 goto fail0;
362 } 337 }
363 } 338 }
364 339
340 return 0;
341
342fail1:
343 usb_ep_disable(ep);
344
345fail0:
346 return result;
347}
348
349static int
350enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop)
351{
352 int result = 0;
353
354 result = enable_endpoint(cdev, loop, loop->in_ep);
355 if (result)
356 return result;
357
358 result = enable_endpoint(cdev, loop, loop->out_ep);
359 if (result)
360 return result;
361
365 DBG(cdev, "%s enabled\n", loop->function.name); 362 DBG(cdev, "%s enabled\n", loop->function.name);
366 return result; 363 return result;
367} 364}
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index 146f48cc65d7..16361b0a8b46 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1461,7 +1461,6 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
1461 return 0; 1461 return 0;
1462 1462
1463fail: 1463fail:
1464 usb_free_all_descriptors(f);
1465 if (ncm->notify_req) { 1464 if (ncm->notify_req) {
1466 kfree(ncm->notify_req->buf); 1465 kfree(ncm->notify_req->buf);
1467 usb_ep_free_request(ncm->notify, ncm->notify_req); 1466 usb_ep_free_request(ncm->notify, ncm->notify_req);
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c
index 5f40080c92cc..a1b79c53499c 100644
--- a/drivers/usb/gadget/function/f_obex.c
+++ b/drivers/usb/gadget/function/f_obex.c
@@ -35,6 +35,7 @@ struct f_obex {
35 struct gserial port; 35 struct gserial port;
36 u8 ctrl_id; 36 u8 ctrl_id;
37 u8 data_id; 37 u8 data_id;
38 u8 cur_alt;
38 u8 port_num; 39 u8 port_num;
39 u8 can_activate; 40 u8 can_activate;
40}; 41};
@@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
235 } else 236 } else
236 goto fail; 237 goto fail;
237 238
239 obex->cur_alt = alt;
240
238 return 0; 241 return 0;
239 242
240fail: 243fail:
@@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf)
245{ 248{
246 struct f_obex *obex = func_to_obex(f); 249 struct f_obex *obex = func_to_obex(f);
247 250
248 if (intf == obex->ctrl_id) 251 return obex->cur_alt;
249 return 0;
250
251 return obex->port.in->driver_data ? 1 : 0;
252} 252}
253 253
254static void obex_disable(struct usb_function *f) 254static void obex_disable(struct usb_function *f)
@@ -397,7 +397,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f)
397 return 0; 397 return 0;
398 398
399fail: 399fail:
400 usb_free_all_descriptors(f);
401 /* we might as well release our claims on endpoints */ 400 /* we might as well release our claims on endpoints */
402 if (obex->port.out) 401 if (obex->port.out)
403 obex->port.out->driver_data = NULL; 402 obex->port.out->driver_data = NULL;
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c
index cde73974a52e..c89e96cfa3e4 100644
--- a/drivers/usb/gadget/function/f_phonet.c
+++ b/drivers/usb/gadget/function/f_phonet.c
@@ -570,8 +570,8 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f)
570err_req: 570err_req:
571 for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++) 571 for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++)
572 usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); 572 usb_ep_free_request(fp->out_ep, fp->out_reqv[i]);
573err:
574 usb_free_all_descriptors(f); 573 usb_free_all_descriptors(f);
574err:
575 if (fp->out_ep) 575 if (fp->out_ep)
576 fp->out_ep->driver_data = NULL; 576 fp->out_ep->driver_data = NULL;
577 if (fp->in_ep) 577 if (fp->in_ep)
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index ddb09dc6d1f2..f13fc6a58565 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -802,8 +802,10 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
802 802
803 if (rndis->manufacturer && rndis->vendorID && 803 if (rndis->manufacturer && rndis->vendorID &&
804 rndis_set_param_vendor(rndis->config, rndis->vendorID, 804 rndis_set_param_vendor(rndis->config, rndis->vendorID,
805 rndis->manufacturer)) 805 rndis->manufacturer)) {
806 goto fail; 806 status = -EINVAL;
807 goto fail_free_descs;
808 }
807 809
808 /* NOTE: all that is done without knowing or caring about 810 /* NOTE: all that is done without knowing or caring about
809 * the network link ... which is unavailable to this code 811 * the network link ... which is unavailable to this code
@@ -817,10 +819,11 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
817 rndis->notify->name); 819 rndis->notify->name);
818 return 0; 820 return 0;
819 821
822fail_free_descs:
823 usb_free_all_descriptors(f);
820fail: 824fail:
821 kfree(f->os_desc_table); 825 kfree(f->os_desc_table);
822 f->os_desc_n = 0; 826 f->os_desc_n = 0;
823 usb_free_all_descriptors(f);
824 827
825 if (rndis->notify_req) { 828 if (rndis->notify_req) {
826 kfree(rndis->notify_req->buf); 829 kfree(rndis->notify_req->buf);
diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c
index 1ea8baf33333..e3dfa675ff06 100644
--- a/drivers/usb/gadget/function/f_subset.c
+++ b/drivers/usb/gadget/function/f_subset.c
@@ -380,7 +380,6 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
380 return 0; 380 return 0;
381 381
382fail: 382fail:
383 usb_free_all_descriptors(f);
384 /* we might as well release our claims on endpoints */ 383 /* we might as well release our claims on endpoints */
385 if (geth->port.out_ep) 384 if (geth->port.out_ep)
386 geth->port.out_ep->driver_data = NULL; 385 geth->port.out_ep->driver_data = NULL;
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index a5a27a504d67..33e16658e5cf 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -512,6 +512,11 @@ static int snd_uac2_remove(struct platform_device *pdev)
512 return 0; 512 return 0;
513} 513}
514 514
515static void snd_uac2_release(struct device *dev)
516{
517 dev_dbg(dev, "releasing '%s'\n", dev_name(dev));
518}
519
515static int alsa_uac2_init(struct audio_dev *agdev) 520static int alsa_uac2_init(struct audio_dev *agdev)
516{ 521{
517 struct snd_uac2_chip *uac2 = &agdev->uac2; 522 struct snd_uac2_chip *uac2 = &agdev->uac2;
@@ -523,6 +528,7 @@ static int alsa_uac2_init(struct audio_dev *agdev)
523 528
524 uac2->pdev.id = 0; 529 uac2->pdev.id = 0;
525 uac2->pdev.name = uac2_name; 530 uac2->pdev.name = uac2_name;
531 uac2->pdev.dev.release = snd_uac2_release;
526 532
527 /* Register snd_uac2 driver */ 533 /* Register snd_uac2 driver */
528 err = platform_driver_register(&uac2->pdrv); 534 err = platform_driver_register(&uac2->pdrv);
@@ -772,6 +778,7 @@ struct usb_endpoint_descriptor fs_epout_desc = {
772 778
773 .bEndpointAddress = USB_DIR_OUT, 779 .bEndpointAddress = USB_DIR_OUT,
774 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 780 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
781 .wMaxPacketSize = cpu_to_le16(1023),
775 .bInterval = 1, 782 .bInterval = 1,
776}; 783};
777 784
@@ -780,6 +787,7 @@ struct usb_endpoint_descriptor hs_epout_desc = {
780 .bDescriptorType = USB_DT_ENDPOINT, 787 .bDescriptorType = USB_DT_ENDPOINT,
781 788
782 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 789 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
790 .wMaxPacketSize = cpu_to_le16(1024),
783 .bInterval = 4, 791 .bInterval = 4,
784}; 792};
785 793
@@ -847,6 +855,7 @@ struct usb_endpoint_descriptor fs_epin_desc = {
847 855
848 .bEndpointAddress = USB_DIR_IN, 856 .bEndpointAddress = USB_DIR_IN,
849 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 857 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
858 .wMaxPacketSize = cpu_to_le16(1023),
850 .bInterval = 1, 859 .bInterval = 1,
851}; 860};
852 861
@@ -855,6 +864,7 @@ struct usb_endpoint_descriptor hs_epin_desc = {
855 .bDescriptorType = USB_DT_ENDPOINT, 864 .bDescriptorType = USB_DT_ENDPOINT,
856 865
857 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, 866 .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC,
867 .wMaxPacketSize = cpu_to_le16(1024),
858 .bInterval = 4, 868 .bInterval = 4,
859}; 869};
860 870
@@ -947,6 +957,9 @@ free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep)
947 struct snd_uac2_chip *uac2 = prm->uac2; 957 struct snd_uac2_chip *uac2 = prm->uac2;
948 int i; 958 int i;
949 959
960 if (!prm->ep_enabled)
961 return;
962
950 prm->ep_enabled = false; 963 prm->ep_enabled = false;
951 964
952 for (i = 0; i < USB_XFERS; i++) { 965 for (i = 0; i < USB_XFERS; i++) {
@@ -1071,7 +1084,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
1071 prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); 1084 prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL);
1072 if (!prm->rbuf) { 1085 if (!prm->rbuf) {
1073 prm->max_psize = 0; 1086 prm->max_psize = 0;
1074 goto err; 1087 goto err_free_descs;
1075 } 1088 }
1076 1089
1077 prm = &agdev->uac2.p_prm; 1090 prm = &agdev->uac2.p_prm;
@@ -1079,17 +1092,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
1079 prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); 1092 prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL);
1080 if (!prm->rbuf) { 1093 if (!prm->rbuf) {
1081 prm->max_psize = 0; 1094 prm->max_psize = 0;
1082 goto err; 1095 goto err_free_descs;
1083 } 1096 }
1084 1097
1085 ret = alsa_uac2_init(agdev); 1098 ret = alsa_uac2_init(agdev);
1086 if (ret) 1099 if (ret)
1087 goto err; 1100 goto err_free_descs;
1088 return 0; 1101 return 0;
1102
1103err_free_descs:
1104 usb_free_all_descriptors(fn);
1089err: 1105err:
1090 kfree(agdev->uac2.p_prm.rbuf); 1106 kfree(agdev->uac2.p_prm.rbuf);
1091 kfree(agdev->uac2.c_prm.rbuf); 1107 kfree(agdev->uac2.c_prm.rbuf);
1092 usb_free_all_descriptors(fn);
1093 if (agdev->in_ep) 1108 if (agdev->in_ep)
1094 agdev->in_ep->driver_data = NULL; 1109 agdev->in_ep->driver_data = NULL;
1095 if (agdev->out_ep) 1110 if (agdev->out_ep)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index e126439e4b65..945b3bd2ca98 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -279,27 +279,41 @@ uvc_function_get_alt(struct usb_function *f, unsigned interface)
279 else if (interface != uvc->streaming_intf) 279 else if (interface != uvc->streaming_intf)
280 return -EINVAL; 280 return -EINVAL;
281 else 281 else
282 return uvc->state == UVC_STATE_STREAMING ? 1 : 0; 282 return uvc->video.ep->driver_data ? 1 : 0;
283} 283}
284 284
285static int 285static int
286uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) 286uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt)
287{ 287{
288 struct uvc_device *uvc = to_uvc(f); 288 struct uvc_device *uvc = to_uvc(f);
289 struct usb_composite_dev *cdev = f->config->cdev;
289 struct v4l2_event v4l2_event; 290 struct v4l2_event v4l2_event;
290 struct uvc_event *uvc_event = (void *)&v4l2_event.u.data; 291 struct uvc_event *uvc_event = (void *)&v4l2_event.u.data;
291 int ret; 292 int ret;
292 293
293 INFO(f->config->cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt); 294 INFO(cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt);
294 295
295 if (interface == uvc->control_intf) { 296 if (interface == uvc->control_intf) {
296 if (alt) 297 if (alt)
297 return -EINVAL; 298 return -EINVAL;
298 299
300 if (uvc->control_ep->driver_data) {
301 INFO(cdev, "reset UVC Control\n");
302 usb_ep_disable(uvc->control_ep);
303 uvc->control_ep->driver_data = NULL;
304 }
305
306 if (!uvc->control_ep->desc)
307 if (config_ep_by_speed(cdev->gadget, f, uvc->control_ep))
308 return -EINVAL;
309
310 usb_ep_enable(uvc->control_ep);
311 uvc->control_ep->driver_data = uvc;
312
299 if (uvc->state == UVC_STATE_DISCONNECTED) { 313 if (uvc->state == UVC_STATE_DISCONNECTED) {
300 memset(&v4l2_event, 0, sizeof(v4l2_event)); 314 memset(&v4l2_event, 0, sizeof(v4l2_event));
301 v4l2_event.type = UVC_EVENT_CONNECT; 315 v4l2_event.type = UVC_EVENT_CONNECT;
302 uvc_event->speed = f->config->cdev->gadget->speed; 316 uvc_event->speed = cdev->gadget->speed;
303 v4l2_event_queue(uvc->vdev, &v4l2_event); 317 v4l2_event_queue(uvc->vdev, &v4l2_event);
304 318
305 uvc->state = UVC_STATE_CONNECTED; 319 uvc->state = UVC_STATE_CONNECTED;
@@ -321,8 +335,10 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt)
321 if (uvc->state != UVC_STATE_STREAMING) 335 if (uvc->state != UVC_STATE_STREAMING)
322 return 0; 336 return 0;
323 337
324 if (uvc->video.ep) 338 if (uvc->video.ep) {
325 usb_ep_disable(uvc->video.ep); 339 usb_ep_disable(uvc->video.ep);
340 uvc->video.ep->driver_data = NULL;
341 }
326 342
327 memset(&v4l2_event, 0, sizeof(v4l2_event)); 343 memset(&v4l2_event, 0, sizeof(v4l2_event));
328 v4l2_event.type = UVC_EVENT_STREAMOFF; 344 v4l2_event.type = UVC_EVENT_STREAMOFF;
@@ -335,14 +351,22 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt)
335 if (uvc->state != UVC_STATE_CONNECTED) 351 if (uvc->state != UVC_STATE_CONNECTED)
336 return 0; 352 return 0;
337 353
338 if (uvc->video.ep) { 354 if (!uvc->video.ep)
339 ret = config_ep_by_speed(f->config->cdev->gadget, 355 return -EINVAL;
340 &(uvc->func), uvc->video.ep); 356
341 if (ret) 357 if (uvc->video.ep->driver_data) {
342 return ret; 358 INFO(cdev, "reset UVC\n");
343 usb_ep_enable(uvc->video.ep); 359 usb_ep_disable(uvc->video.ep);
360 uvc->video.ep->driver_data = NULL;
344 } 361 }
345 362
363 ret = config_ep_by_speed(f->config->cdev->gadget,
364 &(uvc->func), uvc->video.ep);
365 if (ret)
366 return ret;
367 usb_ep_enable(uvc->video.ep);
368 uvc->video.ep->driver_data = uvc;
369
346 memset(&v4l2_event, 0, sizeof(v4l2_event)); 370 memset(&v4l2_event, 0, sizeof(v4l2_event));
347 v4l2_event.type = UVC_EVENT_STREAMON; 371 v4l2_event.type = UVC_EVENT_STREAMON;
348 v4l2_event_queue(uvc->vdev, &v4l2_event); 372 v4l2_event_queue(uvc->vdev, &v4l2_event);
@@ -366,6 +390,16 @@ uvc_function_disable(struct usb_function *f)
366 v4l2_event_queue(uvc->vdev, &v4l2_event); 390 v4l2_event_queue(uvc->vdev, &v4l2_event);
367 391
368 uvc->state = UVC_STATE_DISCONNECTED; 392 uvc->state = UVC_STATE_DISCONNECTED;
393
394 if (uvc->video.ep->driver_data) {
395 usb_ep_disable(uvc->video.ep);
396 uvc->video.ep->driver_data = NULL;
397 }
398
399 if (uvc->control_ep->driver_data) {
400 usb_ep_disable(uvc->control_ep);
401 uvc->control_ep->driver_data = NULL;
402 }
369} 403}
370 404
371/* -------------------------------------------------------------------------- 405/* --------------------------------------------------------------------------
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index c3e1f27dbbef..9cb86bc1a9a5 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -352,7 +352,8 @@ int uvcg_video_enable(struct uvc_video *video, int enable)
352 352
353 if (!enable) { 353 if (!enable) {
354 for (i = 0; i < UVC_NUM_REQUESTS; ++i) 354 for (i = 0; i < UVC_NUM_REQUESTS; ++i)
355 usb_ep_dequeue(video->ep, video->req[i]); 355 if (video->req[i])
356 usb_ep_dequeue(video->ep, video->req[i]);
356 357
357 uvc_video_free_requests(video); 358 uvc_video_free_requests(video);
358 uvcg_queue_enable(&video->queue, 0); 359 uvcg_queue_enable(&video->queue, 0);
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 3ea287b0e448..217365d35a25 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -357,6 +357,7 @@ config USB_EG20T
357 357
358config USB_GADGET_XILINX 358config USB_GADGET_XILINX
359 tristate "Xilinx USB Driver" 359 tristate "Xilinx USB Driver"
360 depends on HAS_DMA
360 depends on OF || COMPILE_TEST 361 depends on OF || COMPILE_TEST
361 help 362 help
362 USB peripheral controller driver for Xilinx USB2 device. 363 USB peripheral controller driver for Xilinx USB2 device.
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index f107bb60a5ab..f2054659f25b 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -507,6 +507,11 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
507{ 507{
508 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 508 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
509 509
510 if (!udc->driver) {
511 dev_err(dev, "soft-connect without a gadget driver\n");
512 return -EOPNOTSUPP;
513 }
514
510 if (sysfs_streq(buf, "connect")) { 515 if (sysfs_streq(buf, "connect")) {
511 usb_gadget_udc_start(udc->gadget, udc->driver); 516 usb_gadget_udc_start(udc->gadget, udc->driver);
512 usb_gadget_connect(udc->gadget); 517 usb_gadget_connect(udc->gadget);
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index a8a30b1d4167..a3ca1375dd52 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -234,7 +234,7 @@ config USB_EHCI_SH
234 234
235config USB_EHCI_EXYNOS 235config USB_EHCI_EXYNOS
236 tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" 236 tristate "EHCI support for Samsung S5P/EXYNOS SoC Series"
237 depends on PLAT_S5P || ARCH_EXYNOS 237 depends on ARCH_S5PV210 || ARCH_EXYNOS
238 help 238 help
239 Enable support for the Samsung Exynos SOC's on-chip EHCI controller. 239 Enable support for the Samsung Exynos SOC's on-chip EHCI controller.
240 240
@@ -550,7 +550,7 @@ config USB_OHCI_SH
550 550
551config USB_OHCI_EXYNOS 551config USB_OHCI_EXYNOS
552 tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" 552 tristate "OHCI support for Samsung S5P/EXYNOS SoC Series"
553 depends on PLAT_S5P || ARCH_EXYNOS 553 depends on ARCH_S5PV210 || ARCH_EXYNOS
554 help 554 help
555 Enable support for the Samsung Exynos SOC's on-chip OHCI controller. 555 Enable support for the Samsung Exynos SOC's on-chip OHCI controller.
556 556
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index d0d8fadf7066..1db0626c8bf4 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -607,7 +607,7 @@ found:
607 wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; 607 wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr;
608 if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) 608 if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100)
609 dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", 609 dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n",
610 le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00 >> 8, 610 (le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00) >> 8,
611 le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); 611 le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff);
612 result = 0; 612 result = 0;
613error: 613error:
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 280dde93abe5..9a69b1f1b300 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -128,20 +128,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
128 xhci->quirks |= XHCI_AVOID_BEI; 128 xhci->quirks |= XHCI_AVOID_BEI;
129 } 129 }
130 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 130 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
131 (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI ||
132 pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI)) {
133 /* Workaround for occasional spurious wakeups from S5 (or
134 * any other sleep) on Haswell machines with LPT and LPT-LP
135 * with the new Intel BIOS
136 */
137 /* Limit the quirk to only known vendors, as this triggers
138 * yet another BIOS bug on some other machines
139 * https://bugzilla.kernel.org/show_bug.cgi?id=66171
140 */
141 if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)
142 xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
143 }
144 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
145 pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { 131 pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
146 xhci->quirks |= XHCI_SPURIOUS_REBOOT; 132 xhci->quirks |= XHCI_SPURIOUS_REBOOT;
147 } 133 }
@@ -162,6 +148,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
162 pdev->device == 0x3432) 148 pdev->device == 0x3432)
163 xhci->quirks |= XHCI_BROKEN_STREAMS; 149 xhci->quirks |= XHCI_BROKEN_STREAMS;
164 150
151 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
152 pdev->device == 0x1042)
153 xhci->quirks |= XHCI_BROKEN_STREAMS;
154
165 if (xhci->quirks & XHCI_RESET_ON_RESUME) 155 if (xhci->quirks & XHCI_RESET_ON_RESUME)
166 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, 156 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
167 "QUIRK: Resetting on resume"); 157 "QUIRK: Resetting on resume");
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index acdfb3e68a90..5a9b977fbc19 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -209,7 +209,8 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer)
209 } 209 }
210 } 210 }
211 211
212 if (!list_empty(&controller->early_tx_list)) { 212 if (!list_empty(&controller->early_tx_list) &&
213 !hrtimer_is_queued(&controller->early_tx)) {
213 ret = HRTIMER_RESTART; 214 ret = HRTIMER_RESTART;
214 hrtimer_forward_now(&controller->early_tx, 215 hrtimer_forward_now(&controller->early_tx,
215 ktime_set(0, 20 * NSEC_PER_USEC)); 216 ktime_set(0, 20 * NSEC_PER_USEC));
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 154bcf1b5dfa..48bc09e7b83b 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -868,9 +868,15 @@ static int dsps_suspend(struct device *dev)
868 struct dsps_glue *glue = dev_get_drvdata(dev); 868 struct dsps_glue *glue = dev_get_drvdata(dev);
869 const struct dsps_musb_wrapper *wrp = glue->wrp; 869 const struct dsps_musb_wrapper *wrp = glue->wrp;
870 struct musb *musb = platform_get_drvdata(glue->musb); 870 struct musb *musb = platform_get_drvdata(glue->musb);
871 void __iomem *mbase = musb->ctrl_base; 871 void __iomem *mbase;
872 872
873 del_timer_sync(&glue->timer); 873 del_timer_sync(&glue->timer);
874
875 if (!musb)
876 /* This can happen if the musb device is in -EPROBE_DEFER */
877 return 0;
878
879 mbase = musb->ctrl_base;
874 glue->context.control = dsps_readl(mbase, wrp->control); 880 glue->context.control = dsps_readl(mbase, wrp->control);
875 glue->context.epintr = dsps_readl(mbase, wrp->epintr_set); 881 glue->context.epintr = dsps_readl(mbase, wrp->epintr_set);
876 glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set); 882 glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set);
@@ -887,8 +893,12 @@ static int dsps_resume(struct device *dev)
887 struct dsps_glue *glue = dev_get_drvdata(dev); 893 struct dsps_glue *glue = dev_get_drvdata(dev);
888 const struct dsps_musb_wrapper *wrp = glue->wrp; 894 const struct dsps_musb_wrapper *wrp = glue->wrp;
889 struct musb *musb = platform_get_drvdata(glue->musb); 895 struct musb *musb = platform_get_drvdata(glue->musb);
890 void __iomem *mbase = musb->ctrl_base; 896 void __iomem *mbase;
897
898 if (!musb)
899 return 0;
891 900
901 mbase = musb->ctrl_base;
892 dsps_writel(mbase, wrp->control, glue->context.control); 902 dsps_writel(mbase, wrp->control, glue->context.control);
893 dsps_writel(mbase, wrp->epintr_set, glue->context.epintr); 903 dsps_writel(mbase, wrp->epintr_set, glue->context.epintr);
894 dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr); 904 dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr);
@@ -896,7 +906,9 @@ static int dsps_resume(struct device *dev)
896 dsps_writel(mbase, wrp->mode, glue->context.mode); 906 dsps_writel(mbase, wrp->mode, glue->context.mode);
897 dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); 907 dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode);
898 dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); 908 dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode);
899 setup_timer(&glue->timer, otg_timer, (unsigned long) musb); 909 if (musb->xceiv->state == OTG_STATE_B_IDLE &&
910 musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE)
911 mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ);
900 912
901 return 0; 913 return 0;
902} 914}
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index eca1747ca8c7..cfd009dc4018 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -155,6 +155,7 @@ static const struct usb_device_id id_table[] = {
155 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 155 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
156 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ 156 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
157 { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ 157 { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
158 { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
158 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ 159 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
159 { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ 160 { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */
160 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ 161 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index dc72b924c399..0dad8ce5a609 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -140,6 +140,7 @@ static struct ftdi_sio_quirk ftdi_8u2232c_quirk = {
140 * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report. 140 * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report.
141 */ 141 */
142static const struct usb_device_id id_table_combined[] = { 142static const struct usb_device_id id_table_combined[] = {
143 { USB_DEVICE(FTDI_VID, FTDI_BRICK_PID) },
143 { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, 144 { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) },
144 { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, 145 { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) },
145 { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, 146 { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) },
@@ -661,6 +662,8 @@ static const struct usb_device_id id_table_combined[] = {
661 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, 662 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) },
662 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, 663 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) },
663 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, 664 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) },
665 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) },
666 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
664 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, 667 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
665 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, 668 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
666 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, 669 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 5937b2d242f2..6786b705ccf6 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -30,6 +30,12 @@
30 30
31/*** third-party PIDs (using FTDI_VID) ***/ 31/*** third-party PIDs (using FTDI_VID) ***/
32 32
33/*
34 * Certain versions of the official Windows FTDI driver reprogrammed
35 * counterfeit FTDI devices to PID 0. Support these devices anyway.
36 */
37#define FTDI_BRICK_PID 0x0000
38
33#define FTDI_LUMEL_PD12_PID 0x6002 39#define FTDI_LUMEL_PD12_PID 0x6002
34 40
35/* 41/*
@@ -143,8 +149,12 @@
143 * Xsens Technologies BV products (http://www.xsens.com). 149 * Xsens Technologies BV products (http://www.xsens.com).
144 */ 150 */
145#define XSENS_VID 0x2639 151#define XSENS_VID 0x2639
146#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ 152#define XSENS_AWINDA_STATION_PID 0x0101
153#define XSENS_AWINDA_DONGLE_PID 0x0102
147#define XSENS_MTW_PID 0x0200 /* Xsens MTw */ 154#define XSENS_MTW_PID 0x0200 /* Xsens MTw */
155#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */
156
157/* Xsens devices using FTDI VID */
148#define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ 158#define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */
149#define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ 159#define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */
150#define XSENS_CONVERTER_2_PID 0xD38A 160#define XSENS_CONVERTER_2_PID 0xD38A
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 078f9ed419c8..02c420af251e 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -335,7 +335,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
335 port->interrupt_out_urb->transfer_buffer_length = length; 335 port->interrupt_out_urb->transfer_buffer_length = length;
336 336
337 priv->cur_pos = priv->cur_pos + length; 337 priv->cur_pos = priv->cur_pos + length;
338 result = usb_submit_urb(port->interrupt_out_urb, GFP_NOIO); 338 result = usb_submit_urb(port->interrupt_out_urb,
339 GFP_ATOMIC);
339 dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); 340 dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result);
340 todo = priv->filled - priv->cur_pos; 341 todo = priv->filled - priv->cur_pos;
341 342
@@ -350,7 +351,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
350 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || 351 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
351 priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { 352 priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
352 result = usb_submit_urb(port->interrupt_in_urb, 353 result = usb_submit_urb(port->interrupt_in_urb,
353 GFP_NOIO); 354 GFP_ATOMIC);
354 dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); 355 dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
355 } 356 }
356 } 357 }
@@ -414,8 +415,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
414 int result; 415 int result;
415 int dtr = 0; 416 int dtr = 0;
416 int rts = 0; 417 int rts = 0;
417 unsigned char *transfer_buffer;
418 int transfer_buffer_length = 8;
419 418
420 /* FIXME: locking ? */ 419 /* FIXME: locking ? */
421 priv = usb_get_serial_port_data(port); 420 priv = usb_get_serial_port_data(port);
@@ -425,11 +424,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
425 return -EINVAL; 424 return -EINVAL;
426 } 425 }
427 426
428 /* allocate memory for transfer buffer */
429 transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
430 if (!transfer_buffer)
431 return -ENOMEM;
432
433 if (set & TIOCM_RTS) 427 if (set & TIOCM_RTS)
434 rts = 1; 428 rts = 1;
435 if (set & TIOCM_DTR) 429 if (set & TIOCM_DTR)
@@ -469,7 +463,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
469 KOBIL_TIMEOUT); 463 KOBIL_TIMEOUT);
470 } 464 }
471 dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result); 465 dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result);
472 kfree(transfer_buffer);
473 return (result < 0) ? result : 0; 466 return (result < 0) ? result : 0;
474} 467}
475 468
@@ -530,8 +523,6 @@ static int kobil_ioctl(struct tty_struct *tty,
530{ 523{
531 struct usb_serial_port *port = tty->driver_data; 524 struct usb_serial_port *port = tty->driver_data;
532 struct kobil_private *priv = usb_get_serial_port_data(port); 525 struct kobil_private *priv = usb_get_serial_port_data(port);
533 unsigned char *transfer_buffer;
534 int transfer_buffer_length = 8;
535 int result; 526 int result;
536 527
537 if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || 528 if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
@@ -541,10 +532,6 @@ static int kobil_ioctl(struct tty_struct *tty,
541 532
542 switch (cmd) { 533 switch (cmd) {
543 case TCFLSH: 534 case TCFLSH:
544 transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL);
545 if (!transfer_buffer)
546 return -ENOBUFS;
547
548 result = usb_control_msg(port->serial->dev, 535 result = usb_control_msg(port->serial->dev,
549 usb_sndctrlpipe(port->serial->dev, 0), 536 usb_sndctrlpipe(port->serial->dev, 0),
550 SUSBCRequest_Misc, 537 SUSBCRequest_Misc,
@@ -559,7 +546,6 @@ static int kobil_ioctl(struct tty_struct *tty,
559 dev_dbg(&port->dev, 546 dev_dbg(&port->dev,
560 "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", 547 "%s - Send reset_all_queues (FLUSH) URB returns: %i\n",
561 __func__, result); 548 __func__, result);
562 kfree(transfer_buffer);
563 return (result < 0) ? -EIO: 0; 549 return (result < 0) ? -EIO: 0;
564 default: 550 default:
565 return -ENOIOCTLCMD; 551 return -ENOIOCTLCMD;
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 4856fb7e637e..4b7bfb394a32 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -215,7 +215,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
215 215
216 /* The connected devices do not have a bulk write endpoint, 216 /* The connected devices do not have a bulk write endpoint,
217 * to transmit data to de barcode device the control endpoint is used */ 217 * to transmit data to de barcode device the control endpoint is used */
218 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); 218 dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
219 if (!dr) { 219 if (!dr) {
220 count = -ENOMEM; 220 count = -ENOMEM;
221 goto error_no_dr; 221 goto error_no_dr;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index d1a3f6044c8a..7a4c21b4f676 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -269,6 +269,7 @@ static void option_instat_callback(struct urb *urb);
269#define TELIT_PRODUCT_DE910_DUAL 0x1010 269#define TELIT_PRODUCT_DE910_DUAL 0x1010
270#define TELIT_PRODUCT_UE910_V2 0x1012 270#define TELIT_PRODUCT_UE910_V2 0x1012
271#define TELIT_PRODUCT_LE920 0x1200 271#define TELIT_PRODUCT_LE920 0x1200
272#define TELIT_PRODUCT_LE910 0x1201
272 273
273/* ZTE PRODUCTS */ 274/* ZTE PRODUCTS */
274#define ZTE_VENDOR_ID 0x19d2 275#define ZTE_VENDOR_ID 0x19d2
@@ -362,6 +363,7 @@ static void option_instat_callback(struct urb *urb);
362 363
363/* Haier products */ 364/* Haier products */
364#define HAIER_VENDOR_ID 0x201e 365#define HAIER_VENDOR_ID 0x201e
366#define HAIER_PRODUCT_CE81B 0x10f8
365#define HAIER_PRODUCT_CE100 0x2009 367#define HAIER_PRODUCT_CE100 0x2009
366 368
367/* Cinterion (formerly Siemens) products */ 369/* Cinterion (formerly Siemens) products */
@@ -589,6 +591,11 @@ static const struct option_blacklist_info zte_1255_blacklist = {
589 .reserved = BIT(3) | BIT(4), 591 .reserved = BIT(3) | BIT(4),
590}; 592};
591 593
594static const struct option_blacklist_info telit_le910_blacklist = {
595 .sendsetup = BIT(0),
596 .reserved = BIT(1) | BIT(2),
597};
598
592static const struct option_blacklist_info telit_le920_blacklist = { 599static const struct option_blacklist_info telit_le920_blacklist = {
593 .sendsetup = BIT(0), 600 .sendsetup = BIT(0),
594 .reserved = BIT(1) | BIT(5), 601 .reserved = BIT(1) | BIT(5),
@@ -1138,6 +1145,8 @@ static const struct usb_device_id option_ids[] = {
1138 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, 1145 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) },
1139 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, 1146 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) },
1140 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, 1147 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) },
1148 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
1149 .driver_info = (kernel_ulong_t)&telit_le910_blacklist },
1141 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), 1150 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
1142 .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, 1151 .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
1143 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ 1152 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
@@ -1621,6 +1630,7 @@ static const struct usb_device_id option_ids[] = {
1621 { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, 1630 { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
1622 { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, 1631 { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
1623 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, 1632 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
1633 { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 0xff, 0xff, 0xff) },
1624 /* Pirelli */ 1634 /* Pirelli */
1625 { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, 1635 { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) },
1626 { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) }, 1636 { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) },
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
index 4bc2fc98636e..73f125e0cb58 100644
--- a/drivers/usb/storage/initializers.c
+++ b/drivers/usb/storage/initializers.c
@@ -52,7 +52,7 @@ int usb_stor_euscsi_init(struct us_data *us)
52 us->iobuf[0] = 0x1; 52 us->iobuf[0] = 0x1;
53 result = usb_stor_control_msg(us, us->send_ctrl_pipe, 53 result = usb_stor_control_msg(us, us->send_ctrl_pipe,
54 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, 54 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR,
55 0x01, 0x0, us->iobuf, 0x1, USB_CTRL_SET_TIMEOUT); 55 0x01, 0x0, us->iobuf, 0x1, 5 * HZ);
56 usb_stor_dbg(us, "-- result is %d\n", result); 56 usb_stor_dbg(us, "-- result is %d\n", result);
57 57
58 return 0; 58 return 0;
@@ -100,7 +100,7 @@ int usb_stor_huawei_e220_init(struct us_data *us)
100 result = usb_stor_control_msg(us, us->send_ctrl_pipe, 100 result = usb_stor_control_msg(us, us->send_ctrl_pipe,
101 USB_REQ_SET_FEATURE, 101 USB_REQ_SET_FEATURE,
102 USB_TYPE_STANDARD | USB_RECIP_DEVICE, 102 USB_TYPE_STANDARD | USB_RECIP_DEVICE,
103 0x01, 0x0, NULL, 0x0, 1000); 103 0x01, 0x0, NULL, 0x0, 1 * HZ);
104 usb_stor_dbg(us, "Huawei mode set result is %d\n", result); 104 usb_stor_dbg(us, "Huawei mode set result is %d\n", result);
105 return 0; 105 return 0;
106} 106}
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 8591d89a38e6..27e4a580d2ed 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -626,6 +626,7 @@ static int config_autodelink_after_power_on(struct us_data *us)
626 return 0; 626 return 0;
627} 627}
628 628
629#ifdef CONFIG_PM
629static int config_autodelink_before_power_down(struct us_data *us) 630static int config_autodelink_before_power_down(struct us_data *us)
630{ 631{
631 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); 632 struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra);
@@ -716,6 +717,7 @@ static void fw5895_init(struct us_data *us)
716 } 717 }
717 } 718 }
718} 719}
720#endif
719 721
720#ifdef CONFIG_REALTEK_AUTOPM 722#ifdef CONFIG_REALTEK_AUTOPM
721static void fw5895_set_mmc_wp(struct us_data *us) 723static void fw5895_set_mmc_wp(struct us_data *us)
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 22c7d4360fa2..b1d815eb6d0b 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -1118,6 +1118,31 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
1118 */ 1118 */
1119 if (result == USB_STOR_XFER_LONG) 1119 if (result == USB_STOR_XFER_LONG)
1120 fake_sense = 1; 1120 fake_sense = 1;
1121
1122 /*
1123 * Sometimes a device will mistakenly skip the data phase
1124 * and go directly to the status phase without sending a
1125 * zero-length packet. If we get a 13-byte response here,
1126 * check whether it really is a CSW.
1127 */
1128 if (result == USB_STOR_XFER_SHORT &&
1129 srb->sc_data_direction == DMA_FROM_DEVICE &&
1130 transfer_length - scsi_get_resid(srb) ==
1131 US_BULK_CS_WRAP_LEN) {
1132 struct scatterlist *sg = NULL;
1133 unsigned int offset = 0;
1134
1135 if (usb_stor_access_xfer_buf((unsigned char *) bcs,
1136 US_BULK_CS_WRAP_LEN, srb, &sg,
1137 &offset, FROM_XFER_BUF) ==
1138 US_BULK_CS_WRAP_LEN &&
1139 bcs->Signature ==
1140 cpu_to_le32(US_BULK_CS_SIGN)) {
1141 usb_stor_dbg(us, "Device skipped data phase\n");
1142 scsi_set_resid(srb, transfer_length);
1143 goto skipped_data_phase;
1144 }
1145 }
1121 } 1146 }
1122 1147
1123 /* See flow chart on pg 15 of the Bulk Only Transport spec for 1148 /* See flow chart on pg 15 of the Bulk Only Transport spec for
@@ -1153,6 +1178,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
1153 if (result != USB_STOR_XFER_GOOD) 1178 if (result != USB_STOR_XFER_GOOD)
1154 return USB_STOR_TRANSPORT_ERROR; 1179 return USB_STOR_TRANSPORT_ERROR;
1155 1180
1181 skipped_data_phase:
1156 /* check bulk status */ 1182 /* check bulk status */
1157 residue = le32_to_cpu(bcs->Residue); 1183 residue = le32_to_cpu(bcs->Residue);
1158 usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", 1184 usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
index 8511b54a65d9..2fefaf923e4a 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -54,6 +54,20 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999,
54 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 54 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
55 US_FL_NO_ATA_1X), 55 US_FL_NO_ATA_1X),
56 56
57/* Reported-by: Hans de Goede <hdegoede@redhat.com> */
58UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999,
59 "Seagate",
60 "Expansion Desk",
61 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
62 US_FL_NO_ATA_1X),
63
64/* Reported-by: Bogdan Mihalcea <bogdan.mihalcea@infim.ro> */
65UNUSUAL_DEV(0x0bc2, 0xa003, 0x0000, 0x9999,
66 "Seagate",
67 "Backup Plus",
68 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
69 US_FL_NO_ATA_1X),
70
57/* https://bbs.archlinux.org/viewtopic.php?id=183190 */ 71/* https://bbs.archlinux.org/viewtopic.php?id=183190 */
58UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, 72UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999,
59 "Seagate", 73 "Seagate",
@@ -61,6 +75,13 @@ UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999,
61 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 75 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
62 US_FL_NO_ATA_1X), 76 US_FL_NO_ATA_1X),
63 77
78/* https://bbs.archlinux.org/viewtopic.php?id=183190 */
79UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x9999,
80 "Seagate",
81 "Backup+ BK",
82 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
83 US_FL_NO_ATA_1X),
84
64/* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ 85/* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */
65UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, 86UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999,
66 "JMicron", 87 "JMicron",
@@ -75,3 +96,10 @@ UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999,
75 "ASM1051", 96 "ASM1051",
76 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 97 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
77 US_FL_IGNORE_UAS), 98 US_FL_IGNORE_UAS),
99
100/* Reported-by: Hans de Goede <hdegoede@redhat.com> */
101UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
102 "VIA",
103 "VL711",
104 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
105 US_FL_NO_ATA_1X),
diff --git a/fs/block_dev.c b/fs/block_dev.c
index cc9d4114cda0..1d9c9f3754f8 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1585,7 +1585,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
1585} 1585}
1586EXPORT_SYMBOL_GPL(blkdev_write_iter); 1586EXPORT_SYMBOL_GPL(blkdev_write_iter);
1587 1587
1588static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) 1588ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
1589{ 1589{
1590 struct file *file = iocb->ki_filp; 1590 struct file *file = iocb->ki_filp;
1591 struct inode *bd_inode = file->f_mapping->host; 1591 struct inode *bd_inode = file->f_mapping->host;
@@ -1599,6 +1599,7 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
1599 iov_iter_truncate(to, size); 1599 iov_iter_truncate(to, size);
1600 return generic_file_read_iter(iocb, to); 1600 return generic_file_read_iter(iocb, to);
1601} 1601}
1602EXPORT_SYMBOL_GPL(blkdev_read_iter);
1602 1603
1603/* 1604/*
1604 * Try to release a page associated with block device when the system 1605 * Try to release a page associated with block device when the system
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index d557264ee974..fe69edda11fb 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3276,7 +3276,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
3276 struct btrfs_root *root, unsigned long count); 3276 struct btrfs_root *root, unsigned long count);
3277int btrfs_async_run_delayed_refs(struct btrfs_root *root, 3277int btrfs_async_run_delayed_refs(struct btrfs_root *root,
3278 unsigned long count, int wait); 3278 unsigned long count, int wait);
3279int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); 3279int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len);
3280int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, 3280int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
3281 struct btrfs_root *root, u64 bytenr, 3281 struct btrfs_root *root, u64 bytenr,
3282 u64 offset, int metadata, u64 *refs, u64 *flags); 3282 u64 offset, int metadata, u64 *refs, u64 *flags);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1ad0f47ac850..1bf9f897065d 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3817,19 +3817,19 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3817 struct btrfs_super_block *sb = fs_info->super_copy; 3817 struct btrfs_super_block *sb = fs_info->super_copy;
3818 int ret = 0; 3818 int ret = 0;
3819 3819
3820 if (sb->root_level > BTRFS_MAX_LEVEL) { 3820 if (btrfs_super_root_level(sb) >= BTRFS_MAX_LEVEL) {
3821 printk(KERN_ERR "BTRFS: tree_root level too big: %d > %d\n", 3821 printk(KERN_ERR "BTRFS: tree_root level too big: %d >= %d\n",
3822 sb->root_level, BTRFS_MAX_LEVEL); 3822 btrfs_super_root_level(sb), BTRFS_MAX_LEVEL);
3823 ret = -EINVAL; 3823 ret = -EINVAL;
3824 } 3824 }
3825 if (sb->chunk_root_level > BTRFS_MAX_LEVEL) { 3825 if (btrfs_super_chunk_root_level(sb) >= BTRFS_MAX_LEVEL) {
3826 printk(KERN_ERR "BTRFS: chunk_root level too big: %d > %d\n", 3826 printk(KERN_ERR "BTRFS: chunk_root level too big: %d >= %d\n",
3827 sb->chunk_root_level, BTRFS_MAX_LEVEL); 3827 btrfs_super_chunk_root_level(sb), BTRFS_MAX_LEVEL);
3828 ret = -EINVAL; 3828 ret = -EINVAL;
3829 } 3829 }
3830 if (sb->log_root_level > BTRFS_MAX_LEVEL) { 3830 if (btrfs_super_log_root_level(sb) >= BTRFS_MAX_LEVEL) {
3831 printk(KERN_ERR "BTRFS: log_root level too big: %d > %d\n", 3831 printk(KERN_ERR "BTRFS: log_root level too big: %d >= %d\n",
3832 sb->log_root_level, BTRFS_MAX_LEVEL); 3832 btrfs_super_log_root_level(sb), BTRFS_MAX_LEVEL);
3833 ret = -EINVAL; 3833 ret = -EINVAL;
3834 } 3834 }
3835 3835
@@ -3837,15 +3837,15 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3837 * The common minimum, we don't know if we can trust the nodesize/sectorsize 3837 * The common minimum, we don't know if we can trust the nodesize/sectorsize
3838 * items yet, they'll be verified later. Issue just a warning. 3838 * items yet, they'll be verified later. Issue just a warning.
3839 */ 3839 */
3840 if (!IS_ALIGNED(sb->root, 4096)) 3840 if (!IS_ALIGNED(btrfs_super_root(sb), 4096))
3841 printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", 3841 printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n",
3842 sb->root); 3842 sb->root);
3843 if (!IS_ALIGNED(sb->chunk_root, 4096)) 3843 if (!IS_ALIGNED(btrfs_super_chunk_root(sb), 4096))
3844 printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", 3844 printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n",
3845 sb->chunk_root); 3845 sb->chunk_root);
3846 if (!IS_ALIGNED(sb->log_root, 4096)) 3846 if (!IS_ALIGNED(btrfs_super_log_root(sb), 4096))
3847 printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", 3847 printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n",
3848 sb->log_root); 3848 btrfs_super_log_root(sb));
3849 3849
3850 if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) { 3850 if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) {
3851 printk(KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n", 3851 printk(KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n",
@@ -3857,13 +3857,13 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3857 * Hint to catch really bogus numbers, bitflips or so, more exact checks are 3857 * Hint to catch really bogus numbers, bitflips or so, more exact checks are
3858 * done later 3858 * done later
3859 */ 3859 */
3860 if (sb->num_devices > (1UL << 31)) 3860 if (btrfs_super_num_devices(sb) > (1UL << 31))
3861 printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n", 3861 printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n",
3862 sb->num_devices); 3862 btrfs_super_num_devices(sb));
3863 3863
3864 if (sb->bytenr != BTRFS_SUPER_INFO_OFFSET) { 3864 if (btrfs_super_bytenr(sb) != BTRFS_SUPER_INFO_OFFSET) {
3865 printk(KERN_ERR "BTRFS: super offset mismatch %llu != %u\n", 3865 printk(KERN_ERR "BTRFS: super offset mismatch %llu != %u\n",
3866 sb->bytenr, BTRFS_SUPER_INFO_OFFSET); 3866 btrfs_super_bytenr(sb), BTRFS_SUPER_INFO_OFFSET);
3867 ret = -EINVAL; 3867 ret = -EINVAL;
3868 } 3868 }
3869 3869
@@ -3871,14 +3871,15 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
3871 * The generation is a global counter, we'll trust it more than the others 3871 * The generation is a global counter, we'll trust it more than the others
3872 * but it's still possible that it's the one that's wrong. 3872 * but it's still possible that it's the one that's wrong.
3873 */ 3873 */
3874 if (sb->generation < sb->chunk_root_generation) 3874 if (btrfs_super_generation(sb) < btrfs_super_chunk_root_generation(sb))
3875 printk(KERN_WARNING 3875 printk(KERN_WARNING
3876 "BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n", 3876 "BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n",
3877 sb->generation, sb->chunk_root_generation); 3877 btrfs_super_generation(sb), btrfs_super_chunk_root_generation(sb));
3878 if (sb->generation < sb->cache_generation && sb->cache_generation != (u64)-1) 3878 if (btrfs_super_generation(sb) < btrfs_super_cache_generation(sb)
3879 && btrfs_super_cache_generation(sb) != (u64)-1)
3879 printk(KERN_WARNING 3880 printk(KERN_WARNING
3880 "BTRFS: suspicious: generation < cache_generation: %llu < %llu\n", 3881 "BTRFS: suspicious: generation < cache_generation: %llu < %llu\n",
3881 sb->generation, sb->cache_generation); 3882 btrfs_super_generation(sb), btrfs_super_cache_generation(sb));
3882 3883
3883 return ret; 3884 return ret;
3884} 3885}
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d56589571012..47c1ba141082 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -710,8 +710,8 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info *info)
710 rcu_read_unlock(); 710 rcu_read_unlock();
711} 711}
712 712
713/* simple helper to search for an existing extent at a given offset */ 713/* simple helper to search for an existing data extent at a given offset */
714int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) 714int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len)
715{ 715{
716 int ret; 716 int ret;
717 struct btrfs_key key; 717 struct btrfs_key key;
@@ -726,12 +726,6 @@ int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len)
726 key.type = BTRFS_EXTENT_ITEM_KEY; 726 key.type = BTRFS_EXTENT_ITEM_KEY;
727 ret = btrfs_search_slot(NULL, root->fs_info->extent_root, &key, path, 727 ret = btrfs_search_slot(NULL, root->fs_info->extent_root, &key, path,
728 0, 0); 728 0, 0);
729 if (ret > 0) {
730 btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
731 if (key.objectid == start &&
732 key.type == BTRFS_METADATA_ITEM_KEY)
733 ret = 0;
734 }
735 btrfs_free_path(path); 729 btrfs_free_path(path);
736 return ret; 730 return ret;
737} 731}
@@ -786,7 +780,6 @@ search_again:
786 else 780 else
787 key.type = BTRFS_EXTENT_ITEM_KEY; 781 key.type = BTRFS_EXTENT_ITEM_KEY;
788 782
789again:
790 ret = btrfs_search_slot(trans, root->fs_info->extent_root, 783 ret = btrfs_search_slot(trans, root->fs_info->extent_root,
791 &key, path, 0, 0); 784 &key, path, 0, 0);
792 if (ret < 0) 785 if (ret < 0)
@@ -802,13 +795,6 @@ again:
802 key.offset == root->nodesize) 795 key.offset == root->nodesize)
803 ret = 0; 796 ret = 0;
804 } 797 }
805 if (ret) {
806 key.objectid = bytenr;
807 key.type = BTRFS_EXTENT_ITEM_KEY;
808 key.offset = root->nodesize;
809 btrfs_release_path(path);
810 goto again;
811 }
812 } 798 }
813 799
814 if (ret == 0) { 800 if (ret == 0) {
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 783a94355efd..84a2d1868271 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -413,7 +413,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
413 ret = 0; 413 ret = 0;
414fail: 414fail:
415 while (ret < 0 && !list_empty(&tmplist)) { 415 while (ret < 0 && !list_empty(&tmplist)) {
416 sums = list_entry(&tmplist, struct btrfs_ordered_sum, list); 416 sums = list_entry(tmplist.next, struct btrfs_ordered_sum, list);
417 list_del(&sums->list); 417 list_del(&sums->list);
418 kfree(sums); 418 kfree(sums);
419 } 419 }
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index a2b97ef10317..54bd91ece35b 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2151,6 +2151,7 @@ static void __exit exit_btrfs_fs(void)
2151 extent_map_exit(); 2151 extent_map_exit();
2152 extent_io_exit(); 2152 extent_io_exit();
2153 btrfs_interface_exit(); 2153 btrfs_interface_exit();
2154 btrfs_end_io_wq_exit();
2154 unregister_filesystem(&btrfs_fs_type); 2155 unregister_filesystem(&btrfs_fs_type);
2155 btrfs_exit_sysfs(); 2156 btrfs_exit_sysfs();
2156 btrfs_cleanup_fs_uuids(); 2157 btrfs_cleanup_fs_uuids();
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1475979e5718..286213cec861 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -672,7 +672,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
672 * is this extent already allocated in the extent 672 * is this extent already allocated in the extent
673 * allocation tree? If so, just add a reference 673 * allocation tree? If so, just add a reference
674 */ 674 */
675 ret = btrfs_lookup_extent(root, ins.objectid, 675 ret = btrfs_lookup_data_extent(root, ins.objectid,
676 ins.offset); 676 ins.offset);
677 if (ret == 0) { 677 if (ret == 0) {
678 ret = btrfs_inc_extent_ref(trans, root, 678 ret = btrfs_inc_extent_ref(trans, root,
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 659f2ea9e6f7..cefca661464b 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2638,7 +2638,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
2638 2638
2639 for (i = 0; i < CEPH_CAP_BITS; i++) 2639 for (i = 0; i < CEPH_CAP_BITS; i++)
2640 if ((dirty & (1 << i)) && 2640 if ((dirty & (1 << i)) &&
2641 flush_tid == ci->i_cap_flush_tid[i]) 2641 (u16)flush_tid == ci->i_cap_flush_tid[i])
2642 cleaned |= 1 << i; 2642 cleaned |= 1 << i;
2643 2643
2644 dout("handle_cap_flush_ack inode %p mds%d seq %d on %s cleaned %s," 2644 dout("handle_cap_flush_ack inode %p mds%d seq %d on %s cleaned %s,"
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 881b3bd0143f..fe839b915116 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -29,13 +29,9 @@
29#define BEQUIET 29#define BEQUIET
30 30
31static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); 31static int isofs_hashi(const struct dentry *parent, struct qstr *qstr);
32static int isofs_hash(const struct dentry *parent, struct qstr *qstr);
33static int isofs_dentry_cmpi(const struct dentry *parent, 32static int isofs_dentry_cmpi(const struct dentry *parent,
34 const struct dentry *dentry, 33 const struct dentry *dentry,
35 unsigned int len, const char *str, const struct qstr *name); 34 unsigned int len, const char *str, const struct qstr *name);
36static int isofs_dentry_cmp(const struct dentry *parent,
37 const struct dentry *dentry,
38 unsigned int len, const char *str, const struct qstr *name);
39 35
40#ifdef CONFIG_JOLIET 36#ifdef CONFIG_JOLIET
41static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); 37static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr);
@@ -135,10 +131,6 @@ static const struct super_operations isofs_sops = {
135 131
136static const struct dentry_operations isofs_dentry_ops[] = { 132static const struct dentry_operations isofs_dentry_ops[] = {
137 { 133 {
138 .d_hash = isofs_hash,
139 .d_compare = isofs_dentry_cmp,
140 },
141 {
142 .d_hash = isofs_hashi, 134 .d_hash = isofs_hashi,
143 .d_compare = isofs_dentry_cmpi, 135 .d_compare = isofs_dentry_cmpi,
144 }, 136 },
@@ -258,25 +250,12 @@ static int isofs_dentry_cmp_common(
258} 250}
259 251
260static int 252static int
261isofs_hash(const struct dentry *dentry, struct qstr *qstr)
262{
263 return isofs_hash_common(qstr, 0);
264}
265
266static int
267isofs_hashi(const struct dentry *dentry, struct qstr *qstr) 253isofs_hashi(const struct dentry *dentry, struct qstr *qstr)
268{ 254{
269 return isofs_hashi_common(qstr, 0); 255 return isofs_hashi_common(qstr, 0);
270} 256}
271 257
272static int 258static int
273isofs_dentry_cmp(const struct dentry *parent, const struct dentry *dentry,
274 unsigned int len, const char *str, const struct qstr *name)
275{
276 return isofs_dentry_cmp_common(len, str, name, 0, 0);
277}
278
279static int
280isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, 259isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry,
281 unsigned int len, const char *str, const struct qstr *name) 260 unsigned int len, const char *str, const struct qstr *name)
282{ 261{
@@ -930,7 +909,8 @@ root_found:
930 if (opt.check == 'r') 909 if (opt.check == 'r')
931 table++; 910 table++;
932 911
933 s->s_d_op = &isofs_dentry_ops[table]; 912 if (table)
913 s->s_d_op = &isofs_dentry_ops[table - 1];
934 914
935 /* get the root dentry */ 915 /* get the root dentry */
936 s->s_root = d_make_root(inode); 916 s->s_root = d_make_root(inode);
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 95295640d9c8..7b543e6b6526 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -18,25 +18,10 @@ static int
18isofs_cmp(struct dentry *dentry, const char *compare, int dlen) 18isofs_cmp(struct dentry *dentry, const char *compare, int dlen)
19{ 19{
20 struct qstr qstr; 20 struct qstr qstr;
21
22 if (!compare)
23 return 1;
24
25 /* check special "." and ".." files */
26 if (dlen == 1) {
27 /* "." */
28 if (compare[0] == 0) {
29 if (!dentry->d_name.len)
30 return 0;
31 compare = ".";
32 } else if (compare[0] == 1) {
33 compare = "..";
34 dlen = 2;
35 }
36 }
37
38 qstr.name = compare; 21 qstr.name = compare;
39 qstr.len = dlen; 22 qstr.len = dlen;
23 if (likely(!dentry->d_op))
24 return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen);
40 return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); 25 return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr);
41} 26}
42 27
@@ -146,7 +131,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
146 (!(de->flags[-sbi->s_high_sierra] & 1))) && 131 (!(de->flags[-sbi->s_high_sierra] & 1))) &&
147 (sbi->s_showassoc || 132 (sbi->s_showassoc ||
148 (!(de->flags[-sbi->s_high_sierra] & 4)))) { 133 (!(de->flags[-sbi->s_high_sierra] & 4)))) {
149 match = (isofs_cmp(dentry, dpnt, dlen) == 0); 134 if (dpnt && (dlen > 1 || dpnt[0] > 1))
135 match = (isofs_cmp(dentry, dpnt, dlen) == 0);
150 } 136 }
151 if (match) { 137 if (match) {
152 isofs_normalize_block_and_offset(de, 138 isofs_normalize_block_and_offset(de,
diff --git a/fs/namei.c b/fs/namei.c
index 78512898d3ba..db5fe86319e6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2497,7 +2497,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2)
2497 } 2497 }
2498 2498
2499 mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); 2499 mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT);
2500 mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_CHILD); 2500 mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT2);
2501 return NULL; 2501 return NULL;
2502} 2502}
2503EXPORT_SYMBOL(lock_rename); 2503EXPORT_SYMBOL(lock_rename);
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 9d3e9c50066a..89326acd4561 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -229,8 +229,16 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
229 &fsnotify_mark_srcu); 229 &fsnotify_mark_srcu);
230 } 230 }
231 231
232 /*
233 * We need to merge inode & vfsmount mark lists so that inode mark
234 * ignore masks are properly reflected for mount mark notifications.
235 * That's why this traversal is so complicated...
236 */
232 while (inode_node || vfsmount_node) { 237 while (inode_node || vfsmount_node) {
233 inode_group = vfsmount_group = NULL; 238 inode_group = NULL;
239 inode_mark = NULL;
240 vfsmount_group = NULL;
241 vfsmount_mark = NULL;
234 242
235 if (inode_node) { 243 if (inode_node) {
236 inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu), 244 inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu),
@@ -244,21 +252,19 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
244 vfsmount_group = vfsmount_mark->group; 252 vfsmount_group = vfsmount_mark->group;
245 } 253 }
246 254
247 if (inode_group > vfsmount_group) { 255 if (inode_group && vfsmount_group) {
248 /* handle inode */ 256 int cmp = fsnotify_compare_groups(inode_group,
249 ret = send_to_group(to_tell, inode_mark, NULL, mask, 257 vfsmount_group);
250 data, data_is, cookie, file_name); 258 if (cmp > 0) {
251 /* we didn't use the vfsmount_mark */ 259 inode_group = NULL;
252 vfsmount_group = NULL; 260 inode_mark = NULL;
253 } else if (vfsmount_group > inode_group) { 261 } else if (cmp < 0) {
254 ret = send_to_group(to_tell, NULL, vfsmount_mark, mask, 262 vfsmount_group = NULL;
255 data, data_is, cookie, file_name); 263 vfsmount_mark = NULL;
256 inode_group = NULL; 264 }
257 } else {
258 ret = send_to_group(to_tell, inode_mark, vfsmount_mark,
259 mask, data, data_is, cookie,
260 file_name);
261 } 265 }
266 ret = send_to_group(to_tell, inode_mark, vfsmount_mark, mask,
267 data, data_is, cookie, file_name);
262 268
263 if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) 269 if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS))
264 goto out; 270 goto out;
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h
index 9c0898c4cfe1..3b68b0ae0a97 100644
--- a/fs/notify/fsnotify.h
+++ b/fs/notify/fsnotify.h
@@ -12,6 +12,10 @@ extern void fsnotify_flush_notify(struct fsnotify_group *group);
12/* protects reads of inode and vfsmount marks list */ 12/* protects reads of inode and vfsmount marks list */
13extern struct srcu_struct fsnotify_mark_srcu; 13extern struct srcu_struct fsnotify_mark_srcu;
14 14
15/* compare two groups for sorting of marks lists */
16extern int fsnotify_compare_groups(struct fsnotify_group *a,
17 struct fsnotify_group *b);
18
15extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark, 19extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark,
16 __u32 mask); 20 __u32 mask);
17/* add a mark to an inode */ 21/* add a mark to an inode */
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
index e8497144b323..dfbf5447eea4 100644
--- a/fs/notify/inode_mark.c
+++ b/fs/notify/inode_mark.c
@@ -194,6 +194,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
194{ 194{
195 struct fsnotify_mark *lmark, *last = NULL; 195 struct fsnotify_mark *lmark, *last = NULL;
196 int ret = 0; 196 int ret = 0;
197 int cmp;
197 198
198 mark->flags |= FSNOTIFY_MARK_FLAG_INODE; 199 mark->flags |= FSNOTIFY_MARK_FLAG_INODE;
199 200
@@ -219,11 +220,8 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
219 goto out; 220 goto out;
220 } 221 }
221 222
222 if (mark->group->priority < lmark->group->priority) 223 cmp = fsnotify_compare_groups(lmark->group, mark->group);
223 continue; 224 if (cmp < 0)
224
225 if ((mark->group->priority == lmark->group->priority) &&
226 (mark->group < lmark->group))
227 continue; 225 continue;
228 226
229 hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list); 227 hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list);
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index d90deaa08e78..34c38fabf514 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -210,6 +210,42 @@ void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mas
210} 210}
211 211
212/* 212/*
213 * Sorting function for lists of fsnotify marks.
214 *
215 * Fanotify supports different notification classes (reflected as priority of
216 * notification group). Events shall be passed to notification groups in
217 * decreasing priority order. To achieve this marks in notification lists for
218 * inodes and vfsmounts are sorted so that priorities of corresponding groups
219 * are descending.
220 *
221 * Furthermore correct handling of the ignore mask requires processing inode
222 * and vfsmount marks of each group together. Using the group address as
223 * further sort criterion provides a unique sorting order and thus we can
224 * merge inode and vfsmount lists of marks in linear time and find groups
225 * present in both lists.
226 *
227 * A return value of 1 signifies that b has priority over a.
228 * A return value of 0 signifies that the two marks have to be handled together.
229 * A return value of -1 signifies that a has priority over b.
230 */
231int fsnotify_compare_groups(struct fsnotify_group *a, struct fsnotify_group *b)
232{
233 if (a == b)
234 return 0;
235 if (!a)
236 return 1;
237 if (!b)
238 return -1;
239 if (a->priority < b->priority)
240 return 1;
241 if (a->priority > b->priority)
242 return -1;
243 if (a < b)
244 return 1;
245 return -1;
246}
247
248/*
213 * Attach an initialized mark to a given group and fs object. 249 * Attach an initialized mark to a given group and fs object.
214 * These marks may be used for the fsnotify backend to determine which 250 * These marks may be used for the fsnotify backend to determine which
215 * event types should be delivered to which group. 251 * event types should be delivered to which group.
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c
index ac851e8376b1..faefa72a11eb 100644
--- a/fs/notify/vfsmount_mark.c
+++ b/fs/notify/vfsmount_mark.c
@@ -153,6 +153,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
153 struct mount *m = real_mount(mnt); 153 struct mount *m = real_mount(mnt);
154 struct fsnotify_mark *lmark, *last = NULL; 154 struct fsnotify_mark *lmark, *last = NULL;
155 int ret = 0; 155 int ret = 0;
156 int cmp;
156 157
157 mark->flags |= FSNOTIFY_MARK_FLAG_VFSMOUNT; 158 mark->flags |= FSNOTIFY_MARK_FLAG_VFSMOUNT;
158 159
@@ -178,11 +179,8 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
178 goto out; 179 goto out;
179 } 180 }
180 181
181 if (mark->group->priority < lmark->group->priority) 182 cmp = fsnotify_compare_groups(lmark->group, mark->group);
182 continue; 183 if (cmp < 0)
183
184 if ((mark->group->priority == lmark->group->priority) &&
185 (mark->group < lmark->group))
186 continue; 184 continue;
187 185
188 hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list); 186 hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list);
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 97de0fbd9f78..a96044004064 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -925,7 +925,7 @@ static int o2net_send_tcp_msg(struct socket *sock, struct kvec *vec,
925 size_t veclen, size_t total) 925 size_t veclen, size_t total)
926{ 926{
927 int ret; 927 int ret;
928 struct msghdr msg; 928 struct msghdr msg = {.msg_flags = 0,};
929 929
930 if (sock == NULL) { 930 if (sock == NULL) {
931 ret = -EINVAL; 931 ret = -EINVAL;
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 910553f37aca..2a7ef4f8e2a6 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -21,9 +21,10 @@ struct ovl_cache_entry {
21 unsigned int len; 21 unsigned int len;
22 unsigned int type; 22 unsigned int type;
23 u64 ino; 23 u64 ino;
24 bool is_whiteout;
25 struct list_head l_node; 24 struct list_head l_node;
26 struct rb_node node; 25 struct rb_node node;
26 bool is_whiteout;
27 bool is_cursor;
27 char name[]; 28 char name[];
28}; 29};
29 30
@@ -92,6 +93,7 @@ static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len,
92 p->type = d_type; 93 p->type = d_type;
93 p->ino = ino; 94 p->ino = ino;
94 p->is_whiteout = false; 95 p->is_whiteout = false;
96 p->is_cursor = false;
95 } 97 }
96 98
97 return p; 99 return p;
@@ -166,7 +168,7 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry)
166{ 168{
167 struct ovl_dir_cache *cache = od->cache; 169 struct ovl_dir_cache *cache = od->cache;
168 170
169 list_del(&od->cursor.l_node); 171 list_del_init(&od->cursor.l_node);
170 WARN_ON(cache->refcount <= 0); 172 WARN_ON(cache->refcount <= 0);
171 cache->refcount--; 173 cache->refcount--;
172 if (!cache->refcount) { 174 if (!cache->refcount) {
@@ -251,7 +253,7 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir,
251 253
252 mutex_lock(&dir->d_inode->i_mutex); 254 mutex_lock(&dir->d_inode->i_mutex);
253 list_for_each_entry(p, rdd->list, l_node) { 255 list_for_each_entry(p, rdd->list, l_node) {
254 if (!p->name) 256 if (p->is_cursor)
255 continue; 257 continue;
256 258
257 if (p->type != DT_CHR) 259 if (p->type != DT_CHR)
@@ -307,7 +309,6 @@ static inline int ovl_dir_read_merged(struct path *upperpath,
307 } 309 }
308out: 310out:
309 return err; 311 return err;
310
311} 312}
312 313
313static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) 314static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos)
@@ -316,7 +317,7 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos)
316 loff_t off = 0; 317 loff_t off = 0;
317 318
318 list_for_each_entry(p, &od->cache->entries, l_node) { 319 list_for_each_entry(p, &od->cache->entries, l_node) {
319 if (!p->name) 320 if (p->is_cursor)
320 continue; 321 continue;
321 if (off >= pos) 322 if (off >= pos)
322 break; 323 break;
@@ -389,7 +390,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx)
389 390
390 p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); 391 p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node);
391 /* Skip cursors */ 392 /* Skip cursors */
392 if (p->name) { 393 if (!p->is_cursor) {
393 if (!p->is_whiteout) { 394 if (!p->is_whiteout) {
394 if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) 395 if (!dir_emit(ctx, p->name, p->len, p->ino, p->type))
395 break; 396 break;
@@ -454,12 +455,13 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end,
454 if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { 455 if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) {
455 struct inode *inode = file_inode(file); 456 struct inode *inode = file_inode(file);
456 457
457 realfile = od->upperfile; 458 realfile =lockless_dereference(od->upperfile);
458 if (!realfile) { 459 if (!realfile) {
459 struct path upperpath; 460 struct path upperpath;
460 461
461 ovl_path_upper(dentry, &upperpath); 462 ovl_path_upper(dentry, &upperpath);
462 realfile = ovl_path_open(&upperpath, O_RDONLY); 463 realfile = ovl_path_open(&upperpath, O_RDONLY);
464 smp_mb__before_spinlock();
463 mutex_lock(&inode->i_mutex); 465 mutex_lock(&inode->i_mutex);
464 if (!od->upperfile) { 466 if (!od->upperfile) {
465 if (IS_ERR(realfile)) { 467 if (IS_ERR(realfile)) {
@@ -518,6 +520,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file)
518 od->realfile = realfile; 520 od->realfile = realfile;
519 od->is_real = (type != OVL_PATH_MERGE); 521 od->is_real = (type != OVL_PATH_MERGE);
520 od->is_upper = (type != OVL_PATH_LOWER); 522 od->is_upper = (type != OVL_PATH_LOWER);
523 od->cursor.is_cursor = true;
521 file->private_data = od; 524 file->private_data = od;
522 525
523 return 0; 526 return 0;
@@ -569,7 +572,7 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list)
569{ 572{
570 struct ovl_cache_entry *p; 573 struct ovl_cache_entry *p;
571 574
572 mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_PARENT); 575 mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_CHILD);
573 list_for_each_entry(p, list, l_node) { 576 list_for_each_entry(p, list, l_node) {
574 struct dentry *dentry; 577 struct dentry *dentry;
575 578
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 92e8f99a5857..281002689d64 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1338,7 +1338,10 @@ xfs_free_file_space(
1338 goto out; 1338 goto out;
1339} 1339}
1340 1340
1341 1341/*
1342 * Preallocate and zero a range of a file. This mechanism has the allocation
1343 * semantics of fallocate and in addition converts data in the range to zeroes.
1344 */
1342int 1345int
1343xfs_zero_file_space( 1346xfs_zero_file_space(
1344 struct xfs_inode *ip, 1347 struct xfs_inode *ip,
@@ -1346,65 +1349,30 @@ xfs_zero_file_space(
1346 xfs_off_t len) 1349 xfs_off_t len)
1347{ 1350{
1348 struct xfs_mount *mp = ip->i_mount; 1351 struct xfs_mount *mp = ip->i_mount;
1349 uint granularity; 1352 uint blksize;
1350 xfs_off_t start_boundary;
1351 xfs_off_t end_boundary;
1352 int error; 1353 int error;
1353 1354
1354 trace_xfs_zero_file_space(ip); 1355 trace_xfs_zero_file_space(ip);
1355 1356
1356 granularity = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE); 1357 blksize = 1 << mp->m_sb.sb_blocklog;
1357 1358
1358 /* 1359 /*
1359 * Round the range of extents we are going to convert inwards. If the 1360 * Punch a hole and prealloc the range. We use hole punch rather than
1360 * offset is aligned, then it doesn't get changed so we zero from the 1361 * unwritten extent conversion for two reasons:
1361 * start of the block offset points to. 1362 *
1363 * 1.) Hole punch handles partial block zeroing for us.
1364 *
1365 * 2.) If prealloc returns ENOSPC, the file range is still zero-valued
1366 * by virtue of the hole punch.
1362 */ 1367 */
1363 start_boundary = round_up(offset, granularity); 1368 error = xfs_free_file_space(ip, offset, len);
1364 end_boundary = round_down(offset + len, granularity); 1369 if (error)
1365 1370 goto out;
1366 ASSERT(start_boundary >= offset);
1367 ASSERT(end_boundary <= offset + len);
1368
1369 if (start_boundary < end_boundary - 1) {
1370 /*
1371 * Writeback the range to ensure any inode size updates due to
1372 * appending writes make it to disk (otherwise we could just
1373 * punch out the delalloc blocks).
1374 */
1375 error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
1376 start_boundary, end_boundary - 1);
1377 if (error)
1378 goto out;
1379 truncate_pagecache_range(VFS_I(ip), start_boundary,
1380 end_boundary - 1);
1381
1382 /* convert the blocks */
1383 error = xfs_alloc_file_space(ip, start_boundary,
1384 end_boundary - start_boundary - 1,
1385 XFS_BMAPI_PREALLOC | XFS_BMAPI_CONVERT);
1386 if (error)
1387 goto out;
1388
1389 /* We've handled the interior of the range, now for the edges */
1390 if (start_boundary != offset) {
1391 error = xfs_iozero(ip, offset, start_boundary - offset);
1392 if (error)
1393 goto out;
1394 }
1395
1396 if (end_boundary != offset + len)
1397 error = xfs_iozero(ip, end_boundary,
1398 offset + len - end_boundary);
1399
1400 } else {
1401 /*
1402 * It's either a sub-granularity range or the range spanned lies
1403 * partially across two adjacent blocks.
1404 */
1405 error = xfs_iozero(ip, offset, len);
1406 }
1407 1371
1372 error = xfs_alloc_file_space(ip, round_down(offset, blksize),
1373 round_up(offset + len, blksize) -
1374 round_down(offset, blksize),
1375 XFS_BMAPI_PREALLOC);
1408out: 1376out:
1409 return error; 1377 return error;
1410 1378
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index f1deb961a296..894924a5129b 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -236,8 +236,10 @@ xfs_bulkstat_grab_ichunk(
236 XFS_WANT_CORRUPTED_RETURN(stat == 1); 236 XFS_WANT_CORRUPTED_RETURN(stat == 1);
237 237
238 /* Check if the record contains the inode in request */ 238 /* Check if the record contains the inode in request */
239 if (irec->ir_startino + XFS_INODES_PER_CHUNK <= agino) 239 if (irec->ir_startino + XFS_INODES_PER_CHUNK <= agino) {
240 return -EINVAL; 240 *icount = 0;
241 return 0;
242 }
241 243
242 idx = agino - irec->ir_startino + 1; 244 idx = agino - irec->ir_startino + 1;
243 if (idx < XFS_INODES_PER_CHUNK && 245 if (idx < XFS_INODES_PER_CHUNK &&
@@ -262,75 +264,76 @@ xfs_bulkstat_grab_ichunk(
262 264
263#define XFS_BULKSTAT_UBLEFT(ubleft) ((ubleft) >= statstruct_size) 265#define XFS_BULKSTAT_UBLEFT(ubleft) ((ubleft) >= statstruct_size)
264 266
267struct xfs_bulkstat_agichunk {
268 char __user **ac_ubuffer;/* pointer into user's buffer */
269 int ac_ubleft; /* bytes left in user's buffer */
270 int ac_ubelem; /* spaces used in user's buffer */
271};
272
265/* 273/*
266 * Process inodes in chunk with a pointer to a formatter function 274 * Process inodes in chunk with a pointer to a formatter function
267 * that will iget the inode and fill in the appropriate structure. 275 * that will iget the inode and fill in the appropriate structure.
268 */ 276 */
269int 277static int
270xfs_bulkstat_ag_ichunk( 278xfs_bulkstat_ag_ichunk(
271 struct xfs_mount *mp, 279 struct xfs_mount *mp,
272 xfs_agnumber_t agno, 280 xfs_agnumber_t agno,
273 struct xfs_inobt_rec_incore *irbp, 281 struct xfs_inobt_rec_incore *irbp,
274 bulkstat_one_pf formatter, 282 bulkstat_one_pf formatter,
275 size_t statstruct_size, 283 size_t statstruct_size,
276 struct xfs_bulkstat_agichunk *acp) 284 struct xfs_bulkstat_agichunk *acp,
285 xfs_agino_t *last_agino)
277{ 286{
278 xfs_ino_t lastino = acp->ac_lastino;
279 char __user **ubufp = acp->ac_ubuffer; 287 char __user **ubufp = acp->ac_ubuffer;
280 int ubleft = acp->ac_ubleft; 288 int chunkidx;
281 int ubelem = acp->ac_ubelem;
282 int chunkidx, clustidx;
283 int error = 0; 289 int error = 0;
284 xfs_agino_t agino; 290 xfs_agino_t agino = irbp->ir_startino;
285 291
286 for (agino = irbp->ir_startino, chunkidx = clustidx = 0; 292 for (chunkidx = 0; chunkidx < XFS_INODES_PER_CHUNK;
287 XFS_BULKSTAT_UBLEFT(ubleft) && 293 chunkidx++, agino++) {
288 irbp->ir_freecount < XFS_INODES_PER_CHUNK; 294 int fmterror;
289 chunkidx++, clustidx++, agino++) {
290 int fmterror; /* bulkstat formatter result */
291 int ubused; 295 int ubused;
292 xfs_ino_t ino = XFS_AGINO_TO_INO(mp, agno, agino);
293 296
294 ASSERT(chunkidx < XFS_INODES_PER_CHUNK); 297 /* inode won't fit in buffer, we are done */
298 if (acp->ac_ubleft < statstruct_size)
299 break;
295 300
296 /* Skip if this inode is free */ 301 /* Skip if this inode is free */
297 if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free) { 302 if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free)
298 lastino = ino;
299 continue; 303 continue;
300 }
301
302 /*
303 * Count used inodes as free so we can tell when the
304 * chunk is used up.
305 */
306 irbp->ir_freecount++;
307 304
308 /* Get the inode and fill in a single buffer */ 305 /* Get the inode and fill in a single buffer */
309 ubused = statstruct_size; 306 ubused = statstruct_size;
310 error = formatter(mp, ino, *ubufp, ubleft, &ubused, &fmterror); 307 error = formatter(mp, XFS_AGINO_TO_INO(mp, agno, agino),
311 if (fmterror == BULKSTAT_RV_NOTHING) { 308 *ubufp, acp->ac_ubleft, &ubused, &fmterror);
312 if (error && error != -ENOENT && error != -EINVAL) { 309
313 ubleft = 0; 310 if (fmterror == BULKSTAT_RV_GIVEUP ||
314 break; 311 (error && error != -ENOENT && error != -EINVAL)) {
315 } 312 acp->ac_ubleft = 0;
316 lastino = ino;
317 continue;
318 }
319 if (fmterror == BULKSTAT_RV_GIVEUP) {
320 ubleft = 0;
321 ASSERT(error); 313 ASSERT(error);
322 break; 314 break;
323 } 315 }
324 if (*ubufp) 316
325 *ubufp += ubused; 317 /* be careful not to leak error if at end of chunk */
326 ubleft -= ubused; 318 if (fmterror == BULKSTAT_RV_NOTHING || error) {
327 ubelem++; 319 error = 0;
328 lastino = ino; 320 continue;
321 }
322
323 *ubufp += ubused;
324 acp->ac_ubleft -= ubused;
325 acp->ac_ubelem++;
329 } 326 }
330 327
331 acp->ac_lastino = lastino; 328 /*
332 acp->ac_ubleft = ubleft; 329 * Post-update *last_agino. At this point, agino will always point one
333 acp->ac_ubelem = ubelem; 330 * inode past the last inode we processed successfully. Hence we
331 * substract that inode when setting the *last_agino cursor so that we
332 * return the correct cookie to userspace. On the next bulkstat call,
333 * the inode under the lastino cookie will be skipped as we have already
334 * processed it here.
335 */
336 *last_agino = agino - 1;
334 337
335 return error; 338 return error;
336} 339}
@@ -353,45 +356,33 @@ xfs_bulkstat(
353 xfs_agino_t agino; /* inode # in allocation group */ 356 xfs_agino_t agino; /* inode # in allocation group */
354 xfs_agnumber_t agno; /* allocation group number */ 357 xfs_agnumber_t agno; /* allocation group number */
355 xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */ 358 xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */
356 int end_of_ag; /* set if we've seen the ag end */
357 int error; /* error code */
358 int fmterror;/* bulkstat formatter result */
359 int i; /* loop index */
360 int icount; /* count of inodes good in irbuf */
361 size_t irbsize; /* size of irec buffer in bytes */ 359 size_t irbsize; /* size of irec buffer in bytes */
362 xfs_ino_t ino; /* inode number (filesystem) */
363 xfs_inobt_rec_incore_t *irbp; /* current irec buffer pointer */
364 xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */ 360 xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */
365 xfs_inobt_rec_incore_t *irbufend; /* end of good irec buffer entries */
366 xfs_ino_t lastino; /* last inode number returned */
367 int nirbuf; /* size of irbuf */ 361 int nirbuf; /* size of irbuf */
368 int rval; /* return value error code */
369 int tmp; /* result value from btree calls */
370 int ubcount; /* size of user's buffer */ 362 int ubcount; /* size of user's buffer */
371 int ubleft; /* bytes left in user's buffer */ 363 struct xfs_bulkstat_agichunk ac;
372 char __user *ubufp; /* pointer into user's buffer */ 364 int error = 0;
373 int ubelem; /* spaces used in user's buffer */
374 365
375 /* 366 /*
376 * Get the last inode value, see if there's nothing to do. 367 * Get the last inode value, see if there's nothing to do.
377 */ 368 */
378 ino = (xfs_ino_t)*lastinop; 369 agno = XFS_INO_TO_AGNO(mp, *lastinop);
379 lastino = ino; 370 agino = XFS_INO_TO_AGINO(mp, *lastinop);
380 agno = XFS_INO_TO_AGNO(mp, ino);
381 agino = XFS_INO_TO_AGINO(mp, ino);
382 if (agno >= mp->m_sb.sb_agcount || 371 if (agno >= mp->m_sb.sb_agcount ||
383 ino != XFS_AGINO_TO_INO(mp, agno, agino)) { 372 *lastinop != XFS_AGINO_TO_INO(mp, agno, agino)) {
384 *done = 1; 373 *done = 1;
385 *ubcountp = 0; 374 *ubcountp = 0;
386 return 0; 375 return 0;
387 } 376 }
388 377
389 ubcount = *ubcountp; /* statstruct's */ 378 ubcount = *ubcountp; /* statstruct's */
390 ubleft = ubcount * statstruct_size; /* bytes */ 379 ac.ac_ubuffer = &ubuffer;
391 *ubcountp = ubelem = 0; 380 ac.ac_ubleft = ubcount * statstruct_size; /* bytes */;
381 ac.ac_ubelem = 0;
382
383 *ubcountp = 0;
392 *done = 0; 384 *done = 0;
393 fmterror = 0; 385
394 ubufp = ubuffer;
395 irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4); 386 irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
396 if (!irbuf) 387 if (!irbuf)
397 return -ENOMEM; 388 return -ENOMEM;
@@ -402,9 +393,13 @@ xfs_bulkstat(
402 * Loop over the allocation groups, starting from the last 393 * Loop over the allocation groups, starting from the last
403 * inode returned; 0 means start of the allocation group. 394 * inode returned; 0 means start of the allocation group.
404 */ 395 */
405 rval = 0; 396 while (agno < mp->m_sb.sb_agcount) {
406 while (XFS_BULKSTAT_UBLEFT(ubleft) && agno < mp->m_sb.sb_agcount) { 397 struct xfs_inobt_rec_incore *irbp = irbuf;
407 cond_resched(); 398 struct xfs_inobt_rec_incore *irbufend = irbuf + nirbuf;
399 bool end_of_ag = false;
400 int icount = 0;
401 int stat;
402
408 error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp); 403 error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
409 if (error) 404 if (error)
410 break; 405 break;
@@ -414,10 +409,6 @@ xfs_bulkstat(
414 */ 409 */
415 cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, 410 cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno,
416 XFS_BTNUM_INO); 411 XFS_BTNUM_INO);
417 irbp = irbuf;
418 irbufend = irbuf + nirbuf;
419 end_of_ag = 0;
420 icount = 0;
421 if (agino > 0) { 412 if (agino > 0) {
422 /* 413 /*
423 * In the middle of an allocation group, we need to get 414 * In the middle of an allocation group, we need to get
@@ -427,22 +418,23 @@ xfs_bulkstat(
427 418
428 error = xfs_bulkstat_grab_ichunk(cur, agino, &icount, &r); 419 error = xfs_bulkstat_grab_ichunk(cur, agino, &icount, &r);
429 if (error) 420 if (error)
430 break; 421 goto del_cursor;
431 if (icount) { 422 if (icount) {
432 irbp->ir_startino = r.ir_startino; 423 irbp->ir_startino = r.ir_startino;
433 irbp->ir_freecount = r.ir_freecount; 424 irbp->ir_freecount = r.ir_freecount;
434 irbp->ir_free = r.ir_free; 425 irbp->ir_free = r.ir_free;
435 irbp++; 426 irbp++;
436 agino = r.ir_startino + XFS_INODES_PER_CHUNK;
437 } 427 }
438 /* Increment to the next record */ 428 /* Increment to the next record */
439 error = xfs_btree_increment(cur, 0, &tmp); 429 error = xfs_btree_increment(cur, 0, &stat);
440 } else { 430 } else {
441 /* Start of ag. Lookup the first inode chunk */ 431 /* Start of ag. Lookup the first inode chunk */
442 error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &tmp); 432 error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &stat);
433 }
434 if (error || stat == 0) {
435 end_of_ag = true;
436 goto del_cursor;
443 } 437 }
444 if (error)
445 break;
446 438
447 /* 439 /*
448 * Loop through inode btree records in this ag, 440 * Loop through inode btree records in this ag,
@@ -451,10 +443,10 @@ xfs_bulkstat(
451 while (irbp < irbufend && icount < ubcount) { 443 while (irbp < irbufend && icount < ubcount) {
452 struct xfs_inobt_rec_incore r; 444 struct xfs_inobt_rec_incore r;
453 445
454 error = xfs_inobt_get_rec(cur, &r, &i); 446 error = xfs_inobt_get_rec(cur, &r, &stat);
455 if (error || i == 0) { 447 if (error || stat == 0) {
456 end_of_ag = 1; 448 end_of_ag = true;
457 break; 449 goto del_cursor;
458 } 450 }
459 451
460 /* 452 /*
@@ -469,77 +461,79 @@ xfs_bulkstat(
469 irbp++; 461 irbp++;
470 icount += XFS_INODES_PER_CHUNK - r.ir_freecount; 462 icount += XFS_INODES_PER_CHUNK - r.ir_freecount;
471 } 463 }
472 /* 464 error = xfs_btree_increment(cur, 0, &stat);
473 * Set agino to after this chunk and bump the cursor. 465 if (error || stat == 0) {
474 */ 466 end_of_ag = true;
475 agino = r.ir_startino + XFS_INODES_PER_CHUNK; 467 goto del_cursor;
476 error = xfs_btree_increment(cur, 0, &tmp); 468 }
477 cond_resched(); 469 cond_resched();
478 } 470 }
471
479 /* 472 /*
480 * Drop the btree buffers and the agi buffer. 473 * Drop the btree buffers and the agi buffer as we can't hold any
481 * We can't hold any of the locks these represent 474 * of the locks these represent when calling iget. If there is a
482 * when calling iget. 475 * pending error, then we are done.
483 */ 476 */
477del_cursor:
484 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 478 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
485 xfs_buf_relse(agbp); 479 xfs_buf_relse(agbp);
480 if (error)
481 break;
486 /* 482 /*
487 * Now format all the good inodes into the user's buffer. 483 * Now format all the good inodes into the user's buffer. The
484 * call to xfs_bulkstat_ag_ichunk() sets up the agino pointer
485 * for the next loop iteration.
488 */ 486 */
489 irbufend = irbp; 487 irbufend = irbp;
490 for (irbp = irbuf; 488 for (irbp = irbuf;
491 irbp < irbufend && XFS_BULKSTAT_UBLEFT(ubleft); irbp++) { 489 irbp < irbufend && ac.ac_ubleft >= statstruct_size;
492 struct xfs_bulkstat_agichunk ac; 490 irbp++) {
493
494 ac.ac_lastino = lastino;
495 ac.ac_ubuffer = &ubuffer;
496 ac.ac_ubleft = ubleft;
497 ac.ac_ubelem = ubelem;
498 error = xfs_bulkstat_ag_ichunk(mp, agno, irbp, 491 error = xfs_bulkstat_ag_ichunk(mp, agno, irbp,
499 formatter, statstruct_size, &ac); 492 formatter, statstruct_size, &ac,
493 &agino);
500 if (error) 494 if (error)
501 rval = error; 495 break;
502
503 lastino = ac.ac_lastino;
504 ubleft = ac.ac_ubleft;
505 ubelem = ac.ac_ubelem;
506 496
507 cond_resched(); 497 cond_resched();
508 } 498 }
499
509 /* 500 /*
510 * Set up for the next loop iteration. 501 * If we've run out of space or had a formatting error, we
502 * are now done
511 */ 503 */
512 if (XFS_BULKSTAT_UBLEFT(ubleft)) { 504 if (ac.ac_ubleft < statstruct_size || error)
513 if (end_of_ag) {
514 agno++;
515 agino = 0;
516 } else
517 agino = XFS_INO_TO_AGINO(mp, lastino);
518 } else
519 break; 505 break;
506
507 if (end_of_ag) {
508 agno++;
509 agino = 0;
510 }
520 } 511 }
521 /* 512 /*
522 * Done, we're either out of filesystem or space to put the data. 513 * Done, we're either out of filesystem or space to put the data.
523 */ 514 */
524 kmem_free(irbuf); 515 kmem_free(irbuf);
525 *ubcountp = ubelem; 516 *ubcountp = ac.ac_ubelem;
517
526 /* 518 /*
527 * Found some inodes, return them now and return the error next time. 519 * We found some inodes, so clear the error status and return them.
520 * The lastino pointer will point directly at the inode that triggered
521 * any error that occurred, so on the next call the error will be
522 * triggered again and propagated to userspace as there will be no
523 * formatted inodes in the buffer.
528 */ 524 */
529 if (ubelem) 525 if (ac.ac_ubelem)
530 rval = 0; 526 error = 0;
531 if (agno >= mp->m_sb.sb_agcount) { 527
532 /* 528 /*
533 * If we ran out of filesystem, mark lastino as off 529 * If we ran out of filesystem, lastino will point off the end of
534 * the end of the filesystem, so the next call 530 * the filesystem so the next call will return immediately.
535 * will return immediately. 531 */
536 */ 532 *lastinop = XFS_AGINO_TO_INO(mp, agno, agino);
537 *lastinop = (xfs_ino_t)XFS_AGINO_TO_INO(mp, agno, 0); 533 if (agno >= mp->m_sb.sb_agcount)
538 *done = 1; 534 *done = 1;
539 } else
540 *lastinop = (xfs_ino_t)lastino;
541 535
542 return rval; 536 return error;
543} 537}
544 538
545int 539int
diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h
index aaed08022eb9..6ea8b3912fa4 100644
--- a/fs/xfs/xfs_itable.h
+++ b/fs/xfs/xfs_itable.h
@@ -30,22 +30,6 @@ typedef int (*bulkstat_one_pf)(struct xfs_mount *mp,
30 int *ubused, 30 int *ubused,
31 int *stat); 31 int *stat);
32 32
33struct xfs_bulkstat_agichunk {
34 xfs_ino_t ac_lastino; /* last inode returned */
35 char __user **ac_ubuffer;/* pointer into user's buffer */
36 int ac_ubleft; /* bytes left in user's buffer */
37 int ac_ubelem; /* spaces used in user's buffer */
38};
39
40int
41xfs_bulkstat_ag_ichunk(
42 struct xfs_mount *mp,
43 xfs_agnumber_t agno,
44 struct xfs_inobt_rec_incore *irbp,
45 bulkstat_one_pf formatter,
46 size_t statstruct_size,
47 struct xfs_bulkstat_agichunk *acp);
48
49/* 33/*
50 * Values for stat return value. 34 * Values for stat return value.
51 */ 35 */
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index e973540cd15b..2dd405c9be78 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -74,7 +74,6 @@
74 {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ 74 {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \
75 {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ 75 {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \
76 {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ 76 {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \
77 {0x1002, 0x4C6E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \
78 {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ 77 {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
79 {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ 78 {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
80 {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ 79 {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index d6b56b21539b..801c0ac50c47 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -21,24 +21,24 @@
21#define VF610_CLK_FASK_CLK_SEL 8 21#define VF610_CLK_FASK_CLK_SEL 8
22#define VF610_CLK_AUDIO_EXT 9 22#define VF610_CLK_AUDIO_EXT 9
23#define VF610_CLK_ENET_EXT 10 23#define VF610_CLK_ENET_EXT 10
24#define VF610_CLK_PLL1_MAIN 11 24#define VF610_CLK_PLL1_SYS 11
25#define VF610_CLK_PLL1_PFD1 12 25#define VF610_CLK_PLL1_PFD1 12
26#define VF610_CLK_PLL1_PFD2 13 26#define VF610_CLK_PLL1_PFD2 13
27#define VF610_CLK_PLL1_PFD3 14 27#define VF610_CLK_PLL1_PFD3 14
28#define VF610_CLK_PLL1_PFD4 15 28#define VF610_CLK_PLL1_PFD4 15
29#define VF610_CLK_PLL2_MAIN 16 29#define VF610_CLK_PLL2_BUS 16
30#define VF610_CLK_PLL2_PFD1 17 30#define VF610_CLK_PLL2_PFD1 17
31#define VF610_CLK_PLL2_PFD2 18 31#define VF610_CLK_PLL2_PFD2 18
32#define VF610_CLK_PLL2_PFD3 19 32#define VF610_CLK_PLL2_PFD3 19
33#define VF610_CLK_PLL2_PFD4 20 33#define VF610_CLK_PLL2_PFD4 20
34#define VF610_CLK_PLL3_MAIN 21 34#define VF610_CLK_PLL3_USB_OTG 21
35#define VF610_CLK_PLL3_PFD1 22 35#define VF610_CLK_PLL3_PFD1 22
36#define VF610_CLK_PLL3_PFD2 23 36#define VF610_CLK_PLL3_PFD2 23
37#define VF610_CLK_PLL3_PFD3 24 37#define VF610_CLK_PLL3_PFD3 24
38#define VF610_CLK_PLL3_PFD4 25 38#define VF610_CLK_PLL3_PFD4 25
39#define VF610_CLK_PLL4_MAIN 26 39#define VF610_CLK_PLL4_AUDIO 26
40#define VF610_CLK_PLL5_MAIN 27 40#define VF610_CLK_PLL5_ENET 27
41#define VF610_CLK_PLL6_MAIN 28 41#define VF610_CLK_PLL6_VIDEO 28
42#define VF610_CLK_PLL3_MAIN_DIV 29 42#define VF610_CLK_PLL3_MAIN_DIV 29
43#define VF610_CLK_PLL4_MAIN_DIV 30 43#define VF610_CLK_PLL4_MAIN_DIV 30
44#define VF610_CLK_PLL6_MAIN_DIV 31 44#define VF610_CLK_PLL6_MAIN_DIV 31
@@ -166,9 +166,32 @@
166#define VF610_CLK_DMAMUX3 153 166#define VF610_CLK_DMAMUX3 153
167#define VF610_CLK_FLEXCAN0_EN 154 167#define VF610_CLK_FLEXCAN0_EN 154
168#define VF610_CLK_FLEXCAN1_EN 155 168#define VF610_CLK_FLEXCAN1_EN 155
169#define VF610_CLK_PLL7_MAIN 156 169#define VF610_CLK_PLL7_USB_HOST 156
170#define VF610_CLK_USBPHY0 157 170#define VF610_CLK_USBPHY0 157
171#define VF610_CLK_USBPHY1 158 171#define VF610_CLK_USBPHY1 158
172#define VF610_CLK_END 159 172#define VF610_CLK_LVDS1_IN 159
173#define VF610_CLK_ANACLK1 160
174#define VF610_CLK_PLL1_BYPASS_SRC 161
175#define VF610_CLK_PLL2_BYPASS_SRC 162
176#define VF610_CLK_PLL3_BYPASS_SRC 163
177#define VF610_CLK_PLL4_BYPASS_SRC 164
178#define VF610_CLK_PLL5_BYPASS_SRC 165
179#define VF610_CLK_PLL6_BYPASS_SRC 166
180#define VF610_CLK_PLL7_BYPASS_SRC 167
181#define VF610_CLK_PLL1 168
182#define VF610_CLK_PLL2 169
183#define VF610_CLK_PLL3 170
184#define VF610_CLK_PLL4 171
185#define VF610_CLK_PLL5 172
186#define VF610_CLK_PLL6 173
187#define VF610_CLK_PLL7 174
188#define VF610_PLL1_BYPASS 175
189#define VF610_PLL2_BYPASS 176
190#define VF610_PLL3_BYPASS 177
191#define VF610_PLL4_BYPASS 178
192#define VF610_PLL5_BYPASS 179
193#define VF610_PLL6_BYPASS 180
194#define VF610_PLL7_BYPASS 181
195#define VF610_CLK_END 182
173 196
174#endif /* __DT_BINDINGS_CLOCK_VF610_H */ 197#endif /* __DT_BINDINGS_CLOCK_VF610_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6cbee8395f60..aac0f9ea952a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1136,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1136/* 1136/*
1137 * tag stuff 1137 * tag stuff
1138 */ 1138 */
1139#define blk_rq_tagged(rq) \ 1139#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
1140 ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
1141extern int blk_queue_start_tag(struct request_queue *, struct request *); 1140extern int blk_queue_start_tag(struct request_queue *, struct request *);
1142extern struct request *blk_queue_find_tag(struct request_queue *, int); 1141extern struct request *blk_queue_find_tag(struct request_queue *, int);
1143extern void blk_queue_end_tag(struct request_queue *, struct request *); 1142extern void blk_queue_end_tag(struct request_queue *, struct request *);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 4e2bd4c95b66..0995c2de8162 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -46,6 +46,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
46extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 46extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
47 47
48extern unsigned long free_all_bootmem(void); 48extern unsigned long free_all_bootmem(void);
49extern void reset_node_managed_pages(pg_data_t *pgdat);
49extern void reset_all_zones_managed_pages(void); 50extern void reset_all_zones_managed_pages(void);
50 51
51extern void free_bootmem_node(pg_data_t *pgdat, 52extern void free_bootmem_node(pg_data_t *pgdat,
diff --git a/include/linux/cma.h b/include/linux/cma.h
index 0430ed05d3b9..a93438beb33c 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -18,12 +18,12 @@ struct cma;
18extern phys_addr_t cma_get_base(struct cma *cma); 18extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma); 19extern unsigned long cma_get_size(struct cma *cma);
20 20
21extern int __init cma_declare_contiguous(phys_addr_t size, 21extern int __init cma_declare_contiguous(phys_addr_t base,
22 phys_addr_t base, phys_addr_t limit, 22 phys_addr_t size, phys_addr_t limit,
23 phys_addr_t alignment, unsigned int order_per_bit, 23 phys_addr_t alignment, unsigned int order_per_bit,
24 bool fixed, struct cma **res_cma); 24 bool fixed, struct cma **res_cma);
25extern int cma_init_reserved_mem(phys_addr_t size, 25extern int cma_init_reserved_mem(phys_addr_t base,
26 phys_addr_t base, int order_per_bit, 26 phys_addr_t size, int order_per_bit,
27 struct cma **res_cma); 27 struct cma **res_cma);
28extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); 28extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
29extern bool cma_release(struct cma *cma, struct page *pages, int count); 29extern bool cma_release(struct cma *cma, struct page *pages, int count);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4e41a4a331bb..9ab779e8a63c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -639,11 +639,13 @@ static inline int inode_unhashed(struct inode *inode)
639 * 2: child/target 639 * 2: child/target
640 * 3: xattr 640 * 3: xattr
641 * 4: second non-directory 641 * 4: second non-directory
642 * The last is for certain operations (such as rename) which lock two 642 * 5: second parent (when locking independent directories in rename)
643 *
644 * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two
643 * non-directories at once. 645 * non-directories at once.
644 * 646 *
645 * The locking order between these classes is 647 * The locking order between these classes is
646 * parent -> child -> normal -> xattr -> second non-directory 648 * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory
647 */ 649 */
648enum inode_i_mutex_lock_class 650enum inode_i_mutex_lock_class
649{ 651{
@@ -651,7 +653,8 @@ enum inode_i_mutex_lock_class
651 I_MUTEX_PARENT, 653 I_MUTEX_PARENT,
652 I_MUTEX_CHILD, 654 I_MUTEX_CHILD,
653 I_MUTEX_XATTR, 655 I_MUTEX_XATTR,
654 I_MUTEX_NONDIR2 656 I_MUTEX_NONDIR2,
657 I_MUTEX_PARENT2,
655}; 658};
656 659
657void lock_two_nondirectories(struct inode *, struct inode*); 660void lock_two_nondirectories(struct inode *, struct inode*);
@@ -2466,6 +2469,7 @@ extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
2466extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2469extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2467 2470
2468/* fs/block_dev.c */ 2471/* fs/block_dev.c */
2472extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to);
2469extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); 2473extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
2470extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2474extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2471 int datasync); 2475 int datasync);
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index fc17d56581b2..582e67f34054 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -330,6 +330,13 @@ enum max77693_irq_source {
330 MAX77693_IRQ_GROUP_NR, 330 MAX77693_IRQ_GROUP_NR,
331}; 331};
332 332
333#define SRC_IRQ_CHARGER BIT(0)
334#define SRC_IRQ_TOP BIT(1)
335#define SRC_IRQ_FLASH BIT(2)
336#define SRC_IRQ_MUIC BIT(3)
337#define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \
338 | SRC_IRQ_FLASH | SRC_IRQ_MUIC)
339
333#define LED_IRQ_FLED2_OPEN BIT(0) 340#define LED_IRQ_FLED2_OPEN BIT(0)
334#define LED_IRQ_FLED2_SHORT BIT(1) 341#define LED_IRQ_FLED2_SHORT BIT(1)
335#define LED_IRQ_FLED1_OPEN BIT(2) 342#define LED_IRQ_FLED1_OPEN BIT(2)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 48bf12ef6620..ffe66e381c04 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -431,6 +431,15 @@ struct zone {
431 */ 431 */
432 int nr_migrate_reserve_block; 432 int nr_migrate_reserve_block;
433 433
434#ifdef CONFIG_MEMORY_ISOLATION
435 /*
436 * Number of isolated pageblock. It is used to solve incorrect
437 * freepage counting problem due to racy retrieving migratetype
438 * of pageblock. Protected by zone->lock.
439 */
440 unsigned long nr_isolate_pageblock;
441#endif
442
434#ifdef CONFIG_MEMORY_HOTPLUG 443#ifdef CONFIG_MEMORY_HOTPLUG
435 /* see spanned/present_pages for more description */ 444 /* see spanned/present_pages for more description */
436 seqlock_t span_seqlock; 445 seqlock_t span_seqlock;
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 9e6294f32ba8..046a0a2e4c4e 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -187,32 +187,17 @@ struct spi_nor {
187/** 187/**
188 * spi_nor_scan() - scan the SPI NOR 188 * spi_nor_scan() - scan the SPI NOR
189 * @nor: the spi_nor structure 189 * @nor: the spi_nor structure
190 * @id: the spi_device_id provided by the driver 190 * @name: the chip type name
191 * @mode: the read mode supported by the driver 191 * @mode: the read mode supported by the driver
192 * 192 *
193 * The drivers can use this fuction to scan the SPI NOR. 193 * The drivers can use this fuction to scan the SPI NOR.
194 * In the scanning, it will try to get all the necessary information to 194 * In the scanning, it will try to get all the necessary information to
195 * fill the mtd_info{} and the spi_nor{}. 195 * fill the mtd_info{} and the spi_nor{}.
196 * 196 *
197 * The board may assigns a spi_device_id with @id which be used to compared with 197 * The chip type name can be provided through the @name parameter.
198 * the spi_device_id detected by the scanning.
199 * 198 *
200 * Return: 0 for success, others for failure. 199 * Return: 0 for success, others for failure.
201 */ 200 */
202int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, 201int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
203 enum read_mode mode);
204extern const struct spi_device_id spi_nor_ids[];
205
206/**
207 * spi_nor_match_id() - find the spi_device_id by the name
208 * @name: the name of the spi_device_id
209 *
210 * The drivers use this function to find the spi_device_id
211 * specified by the @name.
212 *
213 * Return: returns the right spi_device_id pointer on success,
214 * and returns NULL on failure.
215 */
216const struct spi_device_id *spi_nor_match_id(char *name);
217 202
218#endif 203#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index 6545e7aec7bb..29f0adc5f3e4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -267,14 +267,12 @@ extern int of_property_read_u64(const struct device_node *np,
267extern int of_property_read_string(struct device_node *np, 267extern int of_property_read_string(struct device_node *np,
268 const char *propname, 268 const char *propname,
269 const char **out_string); 269 const char **out_string);
270extern int of_property_read_string_index(struct device_node *np,
271 const char *propname,
272 int index, const char **output);
273extern int of_property_match_string(struct device_node *np, 270extern int of_property_match_string(struct device_node *np,
274 const char *propname, 271 const char *propname,
275 const char *string); 272 const char *string);
276extern int of_property_count_strings(struct device_node *np, 273extern int of_property_read_string_helper(struct device_node *np,
277 const char *propname); 274 const char *propname,
275 const char **out_strs, size_t sz, int index);
278extern int of_device_is_compatible(const struct device_node *device, 276extern int of_device_is_compatible(const struct device_node *device,
279 const char *); 277 const char *);
280extern int of_device_is_available(const struct device_node *device); 278extern int of_device_is_available(const struct device_node *device);
@@ -486,15 +484,9 @@ static inline int of_property_read_string(struct device_node *np,
486 return -ENOSYS; 484 return -ENOSYS;
487} 485}
488 486
489static inline int of_property_read_string_index(struct device_node *np, 487static inline int of_property_read_string_helper(struct device_node *np,
490 const char *propname, int index, 488 const char *propname,
491 const char **out_string) 489 const char **out_strs, size_t sz, int index)
492{
493 return -ENOSYS;
494}
495
496static inline int of_property_count_strings(struct device_node *np,
497 const char *propname)
498{ 490{
499 return -ENOSYS; 491 return -ENOSYS;
500} 492}
@@ -668,6 +660,70 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
668} 660}
669 661
670/** 662/**
663 * of_property_read_string_array() - Read an array of strings from a multiple
664 * strings property.
665 * @np: device node from which the property value is to be read.
666 * @propname: name of the property to be searched.
667 * @out_strs: output array of string pointers.
668 * @sz: number of array elements to read.
669 *
670 * Search for a property in a device tree node and retrieve a list of
671 * terminated string values (pointer to data, not a copy) in that property.
672 *
673 * If @out_strs is NULL, the number of strings in the property is returned.
674 */
675static inline int of_property_read_string_array(struct device_node *np,
676 const char *propname, const char **out_strs,
677 size_t sz)
678{
679 return of_property_read_string_helper(np, propname, out_strs, sz, 0);
680}
681
682/**
683 * of_property_count_strings() - Find and return the number of strings from a
684 * multiple strings property.
685 * @np: device node from which the property value is to be read.
686 * @propname: name of the property to be searched.
687 *
688 * Search for a property in a device tree node and retrieve the number of null
689 * terminated string contain in it. Returns the number of strings on
690 * success, -EINVAL if the property does not exist, -ENODATA if property
691 * does not have a value, and -EILSEQ if the string is not null-terminated
692 * within the length of the property data.
693 */
694static inline int of_property_count_strings(struct device_node *np,
695 const char *propname)
696{
697 return of_property_read_string_helper(np, propname, NULL, 0, 0);
698}
699
700/**
701 * of_property_read_string_index() - Find and read a string from a multiple
702 * strings property.
703 * @np: device node from which the property value is to be read.
704 * @propname: name of the property to be searched.
705 * @index: index of the string in the list of strings
706 * @out_string: pointer to null terminated return string, modified only if
707 * return value is 0.
708 *
709 * Search for a property in a device tree node and retrieve a null
710 * terminated string value (pointer to data, not a copy) in the list of strings
711 * contained in that property.
712 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
713 * property does not have a value, and -EILSEQ if the string is not
714 * null-terminated within the length of the property data.
715 *
716 * The out_string pointer is modified only if a valid string can be decoded.
717 */
718static inline int of_property_read_string_index(struct device_node *np,
719 const char *propname,
720 int index, const char **output)
721{
722 int rc = of_property_read_string_helper(np, propname, output, 1, index);
723 return rc < 0 ? rc : 0;
724}
725
726/**
671 * of_property_read_bool - Findfrom a property 727 * of_property_read_bool - Findfrom a property
672 * @np: device node from which the property value is to be read. 728 * @np: device node from which the property value is to be read.
673 * @propname: name of the property to be searched. 729 * @propname: name of the property to be searched.
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 3fff8e774067..2dc1e1697b45 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -2,6 +2,10 @@
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4#ifdef CONFIG_MEMORY_ISOLATION 4#ifdef CONFIG_MEMORY_ISOLATION
5static inline bool has_isolate_pageblock(struct zone *zone)
6{
7 return zone->nr_isolate_pageblock;
8}
5static inline bool is_migrate_isolate_page(struct page *page) 9static inline bool is_migrate_isolate_page(struct page *page)
6{ 10{
7 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; 11 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
@@ -11,6 +15,10 @@ static inline bool is_migrate_isolate(int migratetype)
11 return migratetype == MIGRATE_ISOLATE; 15 return migratetype == MIGRATE_ISOLATE;
12} 16}
13#else 17#else
18static inline bool has_isolate_pageblock(struct zone *zone)
19{
20 return false;
21}
14static inline bool is_migrate_isolate_page(struct page *page) 22static inline bool is_migrate_isolate_page(struct page *page)
15{ 23{
16 return false; 24 return false;
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 64dacb7288a6..24c7728ca681 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -41,8 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
41 41
42 if (pci_is_root_bus(pbus)) 42 if (pci_is_root_bus(pbus))
43 dev = pbus->bridge; 43 dev = pbus->bridge;
44 else 44 else {
45 /* If pbus is a virtual bus, there is no bridge to it */
46 if (!pbus->self)
47 return NULL;
48
45 dev = &pbus->self->dev; 49 dev = &pbus->self->dev;
50 }
46 51
47 return ACPI_HANDLE(dev); 52 return ACPI_HANDLE(dev);
48} 53}
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index a4a819ffb2d1..53ff1a752d7e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -617,6 +617,21 @@ static inline void rcu_preempt_sleep_check(void)
617#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) 617#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
618 618
619/** 619/**
620 * lockless_dereference() - safely load a pointer for later dereference
621 * @p: The pointer to load
622 *
623 * Similar to rcu_dereference(), but for situations where the pointed-to
624 * object's lifetime is managed by something other than RCU. That
625 * "something other" might be reference counting or simple immortality.
626 */
627#define lockless_dereference(p) \
628({ \
629 typeof(p) _________p1 = ACCESS_ONCE(p); \
630 smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
631 (_________p1); \
632})
633
634/**
620 * rcu_assign_pointer() - assign to RCU-protected pointer 635 * rcu_assign_pointer() - assign to RCU-protected pointer
621 * @p: pointer to assign to 636 * @p: pointer to assign to
622 * @v: value to assign (publish) 637 * @v: value to assign (publish)
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 49a4d6f59108..e2c13cd863bd 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
97 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
98}) 98})
99 99
100int ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table); 102 struct file *filp, poll_table *poll_table);
103 103
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index a47790bcaa38..2a50a70ef587 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -100,6 +100,15 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb,
100 return iptunnel_handle_offloads(skb, udp_csum, type); 100 return iptunnel_handle_offloads(skb, udp_csum, type);
101} 101}
102 102
103static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
104{
105 struct udphdr *uh;
106
107 uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr));
108 skb_shinfo(skb)->gso_type |= uh->check ?
109 SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
110}
111
103static inline void udp_tunnel_encap_enable(struct socket *sock) 112static inline void udp_tunnel_encap_enable(struct socket *sock)
104{ 113{
105#if IS_ENABLED(CONFIG_IPV6) 114#if IS_ENABLED(CONFIG_IPV6)
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index e64583560701..56ed843969ca 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
67 if (!sdev->tagged_supported) 67 if (!sdev->tagged_supported)
68 return; 68 return;
69 69
70 if (!shost_use_blk_mq(sdev->host) && 70 if (shost_use_blk_mq(sdev->host))
71 !blk_queue_tagged(sdev->request_queue)) 71 queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
72 else if (!blk_queue_tagged(sdev->request_queue))
72 blk_queue_init_tags(sdev->request_queue, depth, 73 blk_queue_init_tags(sdev->request_queue, depth,
73 sdev->host->bqt); 74 sdev->host->bqt);
74 75
@@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
81 **/ 82 **/
82static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth) 83static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
83{ 84{
84 if (!shost_use_blk_mq(sdev->host) && 85 if (blk_queue_tagged(sdev->request_queue))
85 blk_queue_tagged(sdev->request_queue))
86 blk_queue_free_tags(sdev->request_queue); 86 blk_queue_free_tags(sdev->request_queue);
87 scsi_adjust_queue_depth(sdev, 0, depth); 87 scsi_adjust_queue_depth(sdev, 0, depth);
88} 88}
diff --git a/init/main.c b/init/main.c
index 800a0daede7e..321d0ceb26d3 100644
--- a/init/main.c
+++ b/init/main.c
@@ -544,7 +544,7 @@ asmlinkage __visible void __init start_kernel(void)
544 static_command_line, __start___param, 544 static_command_line, __start___param,
545 __stop___param - __start___param, 545 __stop___param - __start___param,
546 -1, -1, &unknown_bootoption); 546 -1, -1, &unknown_bootoption);
547 if (after_dashes) 547 if (!IS_ERR_OR_NULL(after_dashes))
548 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, 548 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
549 set_init_arg); 549 set_init_arg);
550 550
diff --git a/kernel/audit.c b/kernel/audit.c
index 80983df92cd4..cebb11db4d34 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -739,7 +739,7 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature
739 739
740 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE); 740 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE);
741 audit_log_task_info(ab, current); 741 audit_log_task_info(ab, current);
742 audit_log_format(ab, "feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", 742 audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d",
743 audit_feature_names[which], !!old_feature, !!new_feature, 743 audit_feature_names[which], !!old_feature, !!new_feature,
744 !!old_lock, !!new_lock, res); 744 !!old_lock, !!new_lock, res);
745 audit_log_end(ab); 745 audit_log_end(ab);
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index e242e3a9864a..80f29e015570 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -154,6 +154,7 @@ static struct audit_chunk *alloc_chunk(int count)
154 chunk->owners[i].index = i; 154 chunk->owners[i].index = i;
155 } 155 }
156 fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch); 156 fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch);
157 chunk->mark.mask = FS_IN_IGNORED;
157 return chunk; 158 return chunk;
158} 159}
159 160
diff --git a/kernel/panic.c b/kernel/panic.c
index d09dc5c32c67..cf80672b7924 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -244,6 +244,7 @@ static const struct tnt tnts[] = {
244 * 'I' - Working around severe firmware bug. 244 * 'I' - Working around severe firmware bug.
245 * 'O' - Out-of-tree module has been loaded. 245 * 'O' - Out-of-tree module has been loaded.
246 * 'E' - Unsigned module has been loaded. 246 * 'E' - Unsigned module has been loaded.
247 * 'L' - A soft lockup has previously occurred.
247 * 248 *
248 * The string is overwritten by the next call to print_tainted(). 249 * The string is overwritten by the next call to print_tainted().
249 */ 250 */
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 2d75c94ae87d..a56e07c8d15b 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -538,16 +538,18 @@ static void rb_wake_up_waiters(struct irq_work *work)
538 * ring_buffer_wait - wait for input to the ring buffer 538 * ring_buffer_wait - wait for input to the ring buffer
539 * @buffer: buffer to wait on 539 * @buffer: buffer to wait on
540 * @cpu: the cpu buffer to wait on 540 * @cpu: the cpu buffer to wait on
541 * @full: wait until a full page is available, if @cpu != RING_BUFFER_ALL_CPUS
541 * 542 *
542 * If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon 543 * If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon
543 * as data is added to any of the @buffer's cpu buffers. Otherwise 544 * as data is added to any of the @buffer's cpu buffers. Otherwise
544 * it will wait for data to be added to a specific cpu buffer. 545 * it will wait for data to be added to a specific cpu buffer.
545 */ 546 */
546int ring_buffer_wait(struct ring_buffer *buffer, int cpu) 547int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full)
547{ 548{
548 struct ring_buffer_per_cpu *cpu_buffer; 549 struct ring_buffer_per_cpu *uninitialized_var(cpu_buffer);
549 DEFINE_WAIT(wait); 550 DEFINE_WAIT(wait);
550 struct rb_irq_work *work; 551 struct rb_irq_work *work;
552 int ret = 0;
551 553
552 /* 554 /*
553 * Depending on what the caller is waiting for, either any 555 * Depending on what the caller is waiting for, either any
@@ -564,36 +566,61 @@ int ring_buffer_wait(struct ring_buffer *buffer, int cpu)
564 } 566 }
565 567
566 568
567 prepare_to_wait(&work->waiters, &wait, TASK_INTERRUPTIBLE); 569 while (true) {
570 prepare_to_wait(&work->waiters, &wait, TASK_INTERRUPTIBLE);
568 571
569 /* 572 /*
570 * The events can happen in critical sections where 573 * The events can happen in critical sections where
571 * checking a work queue can cause deadlocks. 574 * checking a work queue can cause deadlocks.
572 * After adding a task to the queue, this flag is set 575 * After adding a task to the queue, this flag is set
573 * only to notify events to try to wake up the queue 576 * only to notify events to try to wake up the queue
574 * using irq_work. 577 * using irq_work.
575 * 578 *
576 * We don't clear it even if the buffer is no longer 579 * We don't clear it even if the buffer is no longer
577 * empty. The flag only causes the next event to run 580 * empty. The flag only causes the next event to run
578 * irq_work to do the work queue wake up. The worse 581 * irq_work to do the work queue wake up. The worse
579 * that can happen if we race with !trace_empty() is that 582 * that can happen if we race with !trace_empty() is that
580 * an event will cause an irq_work to try to wake up 583 * an event will cause an irq_work to try to wake up
581 * an empty queue. 584 * an empty queue.
582 * 585 *
583 * There's no reason to protect this flag either, as 586 * There's no reason to protect this flag either, as
584 * the work queue and irq_work logic will do the necessary 587 * the work queue and irq_work logic will do the necessary
585 * synchronization for the wake ups. The only thing 588 * synchronization for the wake ups. The only thing
586 * that is necessary is that the wake up happens after 589 * that is necessary is that the wake up happens after
587 * a task has been queued. It's OK for spurious wake ups. 590 * a task has been queued. It's OK for spurious wake ups.
588 */ 591 */
589 work->waiters_pending = true; 592 work->waiters_pending = true;
593
594 if (signal_pending(current)) {
595 ret = -EINTR;
596 break;
597 }
598
599 if (cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer))
600 break;
601
602 if (cpu != RING_BUFFER_ALL_CPUS &&
603 !ring_buffer_empty_cpu(buffer, cpu)) {
604 unsigned long flags;
605 bool pagebusy;
606
607 if (!full)
608 break;
609
610 raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
611 pagebusy = cpu_buffer->reader_page == cpu_buffer->commit_page;
612 raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
613
614 if (!pagebusy)
615 break;
616 }
590 617
591 if ((cpu == RING_BUFFER_ALL_CPUS && ring_buffer_empty(buffer)) ||
592 (cpu != RING_BUFFER_ALL_CPUS && ring_buffer_empty_cpu(buffer, cpu)))
593 schedule(); 618 schedule();
619 }
594 620
595 finish_wait(&work->waiters, &wait); 621 finish_wait(&work->waiters, &wait);
596 return 0; 622
623 return ret;
597} 624}
598 625
599/** 626/**
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8a528392b1f4..92f4a6cee172 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1076,13 +1076,14 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
1076} 1076}
1077#endif /* CONFIG_TRACER_MAX_TRACE */ 1077#endif /* CONFIG_TRACER_MAX_TRACE */
1078 1078
1079static int wait_on_pipe(struct trace_iterator *iter) 1079static int wait_on_pipe(struct trace_iterator *iter, bool full)
1080{ 1080{
1081 /* Iterators are static, they should be filled or empty */ 1081 /* Iterators are static, they should be filled or empty */
1082 if (trace_buffer_iter(iter, iter->cpu_file)) 1082 if (trace_buffer_iter(iter, iter->cpu_file))
1083 return 0; 1083 return 0;
1084 1084
1085 return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file); 1085 return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file,
1086 full);
1086} 1087}
1087 1088
1088#ifdef CONFIG_FTRACE_STARTUP_TEST 1089#ifdef CONFIG_FTRACE_STARTUP_TEST
@@ -4434,15 +4435,12 @@ static int tracing_wait_pipe(struct file *filp)
4434 4435
4435 mutex_unlock(&iter->mutex); 4436 mutex_unlock(&iter->mutex);
4436 4437
4437 ret = wait_on_pipe(iter); 4438 ret = wait_on_pipe(iter, false);
4438 4439
4439 mutex_lock(&iter->mutex); 4440 mutex_lock(&iter->mutex);
4440 4441
4441 if (ret) 4442 if (ret)
4442 return ret; 4443 return ret;
4443
4444 if (signal_pending(current))
4445 return -EINTR;
4446 } 4444 }
4447 4445
4448 return 1; 4446 return 1;
@@ -5372,16 +5370,12 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
5372 goto out_unlock; 5370 goto out_unlock;
5373 } 5371 }
5374 mutex_unlock(&trace_types_lock); 5372 mutex_unlock(&trace_types_lock);
5375 ret = wait_on_pipe(iter); 5373 ret = wait_on_pipe(iter, false);
5376 mutex_lock(&trace_types_lock); 5374 mutex_lock(&trace_types_lock);
5377 if (ret) { 5375 if (ret) {
5378 size = ret; 5376 size = ret;
5379 goto out_unlock; 5377 goto out_unlock;
5380 } 5378 }
5381 if (signal_pending(current)) {
5382 size = -EINTR;
5383 goto out_unlock;
5384 }
5385 goto again; 5379 goto again;
5386 } 5380 }
5387 size = 0; 5381 size = 0;
@@ -5500,7 +5494,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
5500 }; 5494 };
5501 struct buffer_ref *ref; 5495 struct buffer_ref *ref;
5502 int entries, size, i; 5496 int entries, size, i;
5503 ssize_t ret; 5497 ssize_t ret = 0;
5504 5498
5505 mutex_lock(&trace_types_lock); 5499 mutex_lock(&trace_types_lock);
5506 5500
@@ -5538,13 +5532,16 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
5538 int r; 5532 int r;
5539 5533
5540 ref = kzalloc(sizeof(*ref), GFP_KERNEL); 5534 ref = kzalloc(sizeof(*ref), GFP_KERNEL);
5541 if (!ref) 5535 if (!ref) {
5536 ret = -ENOMEM;
5542 break; 5537 break;
5538 }
5543 5539
5544 ref->ref = 1; 5540 ref->ref = 1;
5545 ref->buffer = iter->trace_buffer->buffer; 5541 ref->buffer = iter->trace_buffer->buffer;
5546 ref->page = ring_buffer_alloc_read_page(ref->buffer, iter->cpu_file); 5542 ref->page = ring_buffer_alloc_read_page(ref->buffer, iter->cpu_file);
5547 if (!ref->page) { 5543 if (!ref->page) {
5544 ret = -ENOMEM;
5548 kfree(ref); 5545 kfree(ref);
5549 break; 5546 break;
5550 } 5547 }
@@ -5582,19 +5579,19 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
5582 5579
5583 /* did we read anything? */ 5580 /* did we read anything? */
5584 if (!spd.nr_pages) { 5581 if (!spd.nr_pages) {
5582 if (ret)
5583 goto out;
5584
5585 if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) { 5585 if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) {
5586 ret = -EAGAIN; 5586 ret = -EAGAIN;
5587 goto out; 5587 goto out;
5588 } 5588 }
5589 mutex_unlock(&trace_types_lock); 5589 mutex_unlock(&trace_types_lock);
5590 ret = wait_on_pipe(iter); 5590 ret = wait_on_pipe(iter, true);
5591 mutex_lock(&trace_types_lock); 5591 mutex_lock(&trace_types_lock);
5592 if (ret) 5592 if (ret)
5593 goto out; 5593 goto out;
5594 if (signal_pending(current)) { 5594
5595 ret = -EINTR;
5596 goto out;
5597 }
5598 goto again; 5595 goto again;
5599 } 5596 }
5600 5597
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 25e4c213b08a..e5f5e69c7a7b 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -229,7 +229,7 @@ int rhashtable_expand(struct rhashtable *ht)
229 ht->shift++; 229 ht->shift++;
230 230
231 /* For each new bucket, search the corresponding old bucket 231 /* For each new bucket, search the corresponding old bucket
232 * for the rst entry that hashes to the new bucket, and 232 * for the first entry that hashes to the new bucket, and
233 * link the new bucket to that entry. Since all the entries 233 * link the new bucket to that entry. Since all the entries
234 * which will end up in the new bucket appear in the same 234 * which will end up in the new bucket appear in the same
235 * old bucket, this constructs an entirely valid new hash 235 * old bucket, this constructs an entirely valid new hash
@@ -247,8 +247,8 @@ int rhashtable_expand(struct rhashtable *ht)
247 } 247 }
248 248
249 /* Publish the new table pointer. Lookups may now traverse 249 /* Publish the new table pointer. Lookups may now traverse
250 * the new table, but they will not benet from any 250 * the new table, but they will not benefit from any
251 * additional efciency until later steps unzip the buckets. 251 * additional efficiency until later steps unzip the buckets.
252 */ 252 */
253 rcu_assign_pointer(ht->tbl, new_tbl); 253 rcu_assign_pointer(ht->tbl, new_tbl);
254 254
@@ -304,14 +304,14 @@ int rhashtable_shrink(struct rhashtable *ht)
304 304
305 ht->shift--; 305 ht->shift--;
306 306
307 /* Link each bucket in the new table to the rst bucket 307 /* Link each bucket in the new table to the first bucket
308 * in the old table that contains entries which will hash 308 * in the old table that contains entries which will hash
309 * to the new bucket. 309 * to the new bucket.
310 */ 310 */
311 for (i = 0; i < ntbl->size; i++) { 311 for (i = 0; i < ntbl->size; i++) {
312 ntbl->buckets[i] = tbl->buckets[i]; 312 ntbl->buckets[i] = tbl->buckets[i];
313 313
314 /* Link each bucket in the new table to the rst bucket 314 /* Link each bucket in the new table to the first bucket
315 * in the old table that contains entries which will hash 315 * in the old table that contains entries which will hash
316 * to the new bucket. 316 * to the new bucket.
317 */ 317 */
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 8a000cebb0d7..477be696511d 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -243,13 +243,10 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
243 243
244static int reset_managed_pages_done __initdata; 244static int reset_managed_pages_done __initdata;
245 245
246static inline void __init reset_node_managed_pages(pg_data_t *pgdat) 246void reset_node_managed_pages(pg_data_t *pgdat)
247{ 247{
248 struct zone *z; 248 struct zone *z;
249 249
250 if (reset_managed_pages_done)
251 return;
252
253 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) 250 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
254 z->managed_pages = 0; 251 z->managed_pages = 0;
255} 252}
@@ -258,8 +255,12 @@ void __init reset_all_zones_managed_pages(void)
258{ 255{
259 struct pglist_data *pgdat; 256 struct pglist_data *pgdat;
260 257
258 if (reset_managed_pages_done)
259 return;
260
261 for_each_online_pgdat(pgdat) 261 for_each_online_pgdat(pgdat)
262 reset_node_managed_pages(pgdat); 262 reset_node_managed_pages(pgdat);
263
263 reset_managed_pages_done = 1; 264 reset_managed_pages_done = 1;
264} 265}
265 266
diff --git a/mm/cma.c b/mm/cma.c
index 963bc4add9af..fde706e1284f 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma)
124 124
125err: 125err:
126 kfree(cma->bitmap); 126 kfree(cma->bitmap);
127 cma->count = 0;
127 return -EINVAL; 128 return -EINVAL;
128} 129}
129 130
@@ -217,9 +218,8 @@ int __init cma_declare_contiguous(phys_addr_t base,
217 phys_addr_t highmem_start = __pa(high_memory); 218 phys_addr_t highmem_start = __pa(high_memory);
218 int ret = 0; 219 int ret = 0;
219 220
220 pr_debug("%s(size %lx, base %08lx, limit %08lx alignment %08lx)\n", 221 pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n",
221 __func__, (unsigned long)size, (unsigned long)base, 222 __func__, &size, &base, &limit, &alignment);
222 (unsigned long)limit, (unsigned long)alignment);
223 223
224 if (cma_area_count == ARRAY_SIZE(cma_areas)) { 224 if (cma_area_count == ARRAY_SIZE(cma_areas)) {
225 pr_err("Not enough slots for CMA reserved regions!\n"); 225 pr_err("Not enough slots for CMA reserved regions!\n");
@@ -244,52 +244,72 @@ int __init cma_declare_contiguous(phys_addr_t base,
244 size = ALIGN(size, alignment); 244 size = ALIGN(size, alignment);
245 limit &= ~(alignment - 1); 245 limit &= ~(alignment - 1);
246 246
247 if (!base)
248 fixed = false;
249
247 /* size should be aligned with order_per_bit */ 250 /* size should be aligned with order_per_bit */
248 if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit)) 251 if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit))
249 return -EINVAL; 252 return -EINVAL;
250 253
251 /* 254 /*
252 * adjust limit to avoid crossing low/high memory boundary for 255 * If allocating at a fixed base the request region must not cross the
253 * automatically allocated regions 256 * low/high memory boundary.
254 */ 257 */
255 if (((limit == 0 || limit > memblock_end) && 258 if (fixed && base < highmem_start && base + size > highmem_start) {
256 (memblock_end - size < highmem_start &&
257 memblock_end > highmem_start)) ||
258 (!fixed && limit > highmem_start && limit - size < highmem_start)) {
259 limit = highmem_start;
260 }
261
262 if (fixed && base < highmem_start && base+size > highmem_start) {
263 ret = -EINVAL; 259 ret = -EINVAL;
264 pr_err("Region at %08lx defined on low/high memory boundary (%08lx)\n", 260 pr_err("Region at %pa defined on low/high memory boundary (%pa)\n",
265 (unsigned long)base, (unsigned long)highmem_start); 261 &base, &highmem_start);
266 goto err; 262 goto err;
267 } 263 }
268 264
265 /*
266 * If the limit is unspecified or above the memblock end, its effective
267 * value will be the memblock end. Set it explicitly to simplify further
268 * checks.
269 */
270 if (limit == 0 || limit > memblock_end)
271 limit = memblock_end;
272
269 /* Reserve memory */ 273 /* Reserve memory */
270 if (base && fixed) { 274 if (fixed) {
271 if (memblock_is_region_reserved(base, size) || 275 if (memblock_is_region_reserved(base, size) ||
272 memblock_reserve(base, size) < 0) { 276 memblock_reserve(base, size) < 0) {
273 ret = -EBUSY; 277 ret = -EBUSY;
274 goto err; 278 goto err;
275 } 279 }
276 } else { 280 } else {
277 phys_addr_t addr = memblock_alloc_range(size, alignment, base, 281 phys_addr_t addr = 0;
278 limit); 282
283 /*
284 * All pages in the reserved area must come from the same zone.
285 * If the requested region crosses the low/high memory boundary,
286 * try allocating from high memory first and fall back to low
287 * memory in case of failure.
288 */
289 if (base < highmem_start && limit > highmem_start) {
290 addr = memblock_alloc_range(size, alignment,
291 highmem_start, limit);
292 limit = highmem_start;
293 }
294
279 if (!addr) { 295 if (!addr) {
280 ret = -ENOMEM; 296 addr = memblock_alloc_range(size, alignment, base,
281 goto err; 297 limit);
282 } else { 298 if (!addr) {
283 base = addr; 299 ret = -ENOMEM;
300 goto err;
301 }
284 } 302 }
303
304 base = addr;
285 } 305 }
286 306
287 ret = cma_init_reserved_mem(base, size, order_per_bit, res_cma); 307 ret = cma_init_reserved_mem(base, size, order_per_bit, res_cma);
288 if (ret) 308 if (ret)
289 goto err; 309 goto err;
290 310
291 pr_info("Reserved %ld MiB at %08lx\n", (unsigned long)size / SZ_1M, 311 pr_info("Reserved %ld MiB at %pa\n", (unsigned long)size / SZ_1M,
292 (unsigned long)base); 312 &base);
293 return 0; 313 return 0;
294 314
295err: 315err:
diff --git a/mm/compaction.c b/mm/compaction.c
index ec74cf0123ef..f9792ba3537c 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -479,6 +479,16 @@ isolate_freepages_range(struct compact_control *cc,
479 479
480 block_end_pfn = min(block_end_pfn, end_pfn); 480 block_end_pfn = min(block_end_pfn, end_pfn);
481 481
482 /*
483 * pfn could pass the block_end_pfn if isolated freepage
484 * is more than pageblock order. In this case, we adjust
485 * scanning range to right one.
486 */
487 if (pfn >= block_end_pfn) {
488 block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
489 block_end_pfn = min(block_end_pfn, end_pfn);
490 }
491
482 if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone)) 492 if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone))
483 break; 493 break;
484 494
@@ -1029,8 +1039,12 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
1029 } 1039 }
1030 1040
1031 acct_isolated(zone, cc); 1041 acct_isolated(zone, cc);
1032 /* Record where migration scanner will be restarted */ 1042 /*
1033 cc->migrate_pfn = low_pfn; 1043 * Record where migration scanner will be restarted. If we end up in
1044 * the same pageblock as the free scanner, make the scanners fully
1045 * meet so that compact_finished() terminates compaction.
1046 */
1047 cc->migrate_pfn = (end_pfn <= cc->free_pfn) ? low_pfn : cc->free_pfn;
1034 1048
1035 return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; 1049 return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE;
1036} 1050}
diff --git a/mm/internal.h b/mm/internal.h
index 829304090b90..a4f90ba7068e 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -108,6 +108,31 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);
108/* 108/*
109 * in mm/page_alloc.c 109 * in mm/page_alloc.c
110 */ 110 */
111
112/*
113 * Locate the struct page for both the matching buddy in our
114 * pair (buddy1) and the combined O(n+1) page they form (page).
115 *
116 * 1) Any buddy B1 will have an order O twin B2 which satisfies
117 * the following equation:
118 * B2 = B1 ^ (1 << O)
119 * For example, if the starting buddy (buddy2) is #8 its order
120 * 1 buddy is #10:
121 * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10
122 *
123 * 2) Any buddy B will have an order O+1 parent P which
124 * satisfies the following equation:
125 * P = B & ~(1 << O)
126 *
127 * Assumption: *_mem_map is contiguous at least up to MAX_ORDER
128 */
129static inline unsigned long
130__find_buddy_index(unsigned long page_idx, unsigned int order)
131{
132 return page_idx ^ (1 << order);
133}
134
135extern int __isolate_free_page(struct page *page, unsigned int order);
111extern void __free_pages_bootmem(struct page *page, unsigned int order); 136extern void __free_pages_bootmem(struct page *page, unsigned int order);
112extern void prep_compound_page(struct page *page, unsigned long order); 137extern void prep_compound_page(struct page *page, unsigned long order);
113#ifdef CONFIG_MEMORY_FAILURE 138#ifdef CONFIG_MEMORY_FAILURE
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 252e1dbbed86..1bf4807cb21e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -31,6 +31,7 @@
31#include <linux/stop_machine.h> 31#include <linux/stop_machine.h>
32#include <linux/hugetlb.h> 32#include <linux/hugetlb.h>
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34#include <linux/bootmem.h>
34 35
35#include <asm/tlbflush.h> 36#include <asm/tlbflush.h>
36 37
@@ -1066,6 +1067,16 @@ out:
1066} 1067}
1067#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 1068#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
1068 1069
1070static void reset_node_present_pages(pg_data_t *pgdat)
1071{
1072 struct zone *z;
1073
1074 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
1075 z->present_pages = 0;
1076
1077 pgdat->node_present_pages = 0;
1078}
1079
1069/* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ 1080/* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
1070static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) 1081static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
1071{ 1082{
@@ -1096,6 +1107,21 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
1096 build_all_zonelists(pgdat, NULL); 1107 build_all_zonelists(pgdat, NULL);
1097 mutex_unlock(&zonelists_mutex); 1108 mutex_unlock(&zonelists_mutex);
1098 1109
1110 /*
1111 * zone->managed_pages is set to an approximate value in
1112 * free_area_init_core(), which will cause
1113 * /sys/device/system/node/nodeX/meminfo has wrong data.
1114 * So reset it to 0 before any memory is onlined.
1115 */
1116 reset_node_managed_pages(pgdat);
1117
1118 /*
1119 * When memory is hot-added, all the memory is in offline state. So
1120 * clear all zones' present_pages because they will be updated in
1121 * online_pages() and offline_pages().
1122 */
1123 reset_node_present_pages(pgdat);
1124
1099 return pgdat; 1125 return pgdat;
1100} 1126}
1101 1127
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 7c7ab32ee503..90b50468333e 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -145,12 +145,10 @@ static unsigned long __init free_low_memory_core_early(void)
145 145
146static int reset_managed_pages_done __initdata; 146static int reset_managed_pages_done __initdata;
147 147
148static inline void __init reset_node_managed_pages(pg_data_t *pgdat) 148void reset_node_managed_pages(pg_data_t *pgdat)
149{ 149{
150 struct zone *z; 150 struct zone *z;
151 151
152 if (reset_managed_pages_done)
153 return;
154 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) 152 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
155 z->managed_pages = 0; 153 z->managed_pages = 0;
156} 154}
@@ -159,8 +157,12 @@ void __init reset_all_zones_managed_pages(void)
159{ 157{
160 struct pglist_data *pgdat; 158 struct pglist_data *pgdat;
161 159
160 if (reset_managed_pages_done)
161 return;
162
162 for_each_online_pgdat(pgdat) 163 for_each_online_pgdat(pgdat)
163 reset_node_managed_pages(pgdat); 164 reset_node_managed_pages(pgdat);
165
164 reset_managed_pages_done = 1; 166 reset_managed_pages_done = 1;
165} 167}
166 168
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9cd36b822444..616a2c956b4b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -467,29 +467,6 @@ static inline void rmv_page_order(struct page *page)
467} 467}
468 468
469/* 469/*
470 * Locate the struct page for both the matching buddy in our
471 * pair (buddy1) and the combined O(n+1) page they form (page).
472 *
473 * 1) Any buddy B1 will have an order O twin B2 which satisfies
474 * the following equation:
475 * B2 = B1 ^ (1 << O)
476 * For example, if the starting buddy (buddy2) is #8 its order
477 * 1 buddy is #10:
478 * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10
479 *
480 * 2) Any buddy B will have an order O+1 parent P which
481 * satisfies the following equation:
482 * P = B & ~(1 << O)
483 *
484 * Assumption: *_mem_map is contiguous at least up to MAX_ORDER
485 */
486static inline unsigned long
487__find_buddy_index(unsigned long page_idx, unsigned int order)
488{
489 return page_idx ^ (1 << order);
490}
491
492/*
493 * This function checks whether a page is free && is the buddy 470 * This function checks whether a page is free && is the buddy
494 * we can do coalesce a page and its buddy if 471 * we can do coalesce a page and its buddy if
495 * (a) the buddy is not in a hole && 472 * (a) the buddy is not in a hole &&
@@ -569,6 +546,7 @@ static inline void __free_one_page(struct page *page,
569 unsigned long combined_idx; 546 unsigned long combined_idx;
570 unsigned long uninitialized_var(buddy_idx); 547 unsigned long uninitialized_var(buddy_idx);
571 struct page *buddy; 548 struct page *buddy;
549 int max_order = MAX_ORDER;
572 550
573 VM_BUG_ON(!zone_is_initialized(zone)); 551 VM_BUG_ON(!zone_is_initialized(zone));
574 552
@@ -577,13 +555,24 @@ static inline void __free_one_page(struct page *page,
577 return; 555 return;
578 556
579 VM_BUG_ON(migratetype == -1); 557 VM_BUG_ON(migratetype == -1);
558 if (is_migrate_isolate(migratetype)) {
559 /*
560 * We restrict max order of merging to prevent merge
561 * between freepages on isolate pageblock and normal
562 * pageblock. Without this, pageblock isolation
563 * could cause incorrect freepage accounting.
564 */
565 max_order = min(MAX_ORDER, pageblock_order + 1);
566 } else {
567 __mod_zone_freepage_state(zone, 1 << order, migratetype);
568 }
580 569
581 page_idx = pfn & ((1 << MAX_ORDER) - 1); 570 page_idx = pfn & ((1 << max_order) - 1);
582 571
583 VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page); 572 VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page);
584 VM_BUG_ON_PAGE(bad_range(zone, page), page); 573 VM_BUG_ON_PAGE(bad_range(zone, page), page);
585 574
586 while (order < MAX_ORDER-1) { 575 while (order < max_order - 1) {
587 buddy_idx = __find_buddy_index(page_idx, order); 576 buddy_idx = __find_buddy_index(page_idx, order);
588 buddy = page + (buddy_idx - page_idx); 577 buddy = page + (buddy_idx - page_idx);
589 if (!page_is_buddy(page, buddy, order)) 578 if (!page_is_buddy(page, buddy, order))
@@ -594,9 +583,11 @@ static inline void __free_one_page(struct page *page,
594 */ 583 */
595 if (page_is_guard(buddy)) { 584 if (page_is_guard(buddy)) {
596 clear_page_guard_flag(buddy); 585 clear_page_guard_flag(buddy);
597 set_page_private(page, 0); 586 set_page_private(buddy, 0);
598 __mod_zone_freepage_state(zone, 1 << order, 587 if (!is_migrate_isolate(migratetype)) {
599 migratetype); 588 __mod_zone_freepage_state(zone, 1 << order,
589 migratetype);
590 }
600 } else { 591 } else {
601 list_del(&buddy->lru); 592 list_del(&buddy->lru);
602 zone->free_area[order].nr_free--; 593 zone->free_area[order].nr_free--;
@@ -715,14 +706,12 @@ static void free_pcppages_bulk(struct zone *zone, int count,
715 /* must delete as __free_one_page list manipulates */ 706 /* must delete as __free_one_page list manipulates */
716 list_del(&page->lru); 707 list_del(&page->lru);
717 mt = get_freepage_migratetype(page); 708 mt = get_freepage_migratetype(page);
709 if (unlikely(has_isolate_pageblock(zone)))
710 mt = get_pageblock_migratetype(page);
711
718 /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ 712 /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
719 __free_one_page(page, page_to_pfn(page), zone, 0, mt); 713 __free_one_page(page, page_to_pfn(page), zone, 0, mt);
720 trace_mm_page_pcpu_drain(page, 0, mt); 714 trace_mm_page_pcpu_drain(page, 0, mt);
721 if (likely(!is_migrate_isolate_page(page))) {
722 __mod_zone_page_state(zone, NR_FREE_PAGES, 1);
723 if (is_migrate_cma(mt))
724 __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1);
725 }
726 } while (--to_free && --batch_free && !list_empty(list)); 715 } while (--to_free && --batch_free && !list_empty(list));
727 } 716 }
728 spin_unlock(&zone->lock); 717 spin_unlock(&zone->lock);
@@ -739,9 +728,11 @@ static void free_one_page(struct zone *zone,
739 if (nr_scanned) 728 if (nr_scanned)
740 __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); 729 __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned);
741 730
731 if (unlikely(has_isolate_pageblock(zone) ||
732 is_migrate_isolate(migratetype))) {
733 migratetype = get_pfnblock_migratetype(page, pfn);
734 }
742 __free_one_page(page, pfn, zone, order, migratetype); 735 __free_one_page(page, pfn, zone, order, migratetype);
743 if (unlikely(!is_migrate_isolate(migratetype)))
744 __mod_zone_freepage_state(zone, 1 << order, migratetype);
745 spin_unlock(&zone->lock); 736 spin_unlock(&zone->lock);
746} 737}
747 738
@@ -1484,7 +1475,7 @@ void split_page(struct page *page, unsigned int order)
1484} 1475}
1485EXPORT_SYMBOL_GPL(split_page); 1476EXPORT_SYMBOL_GPL(split_page);
1486 1477
1487static int __isolate_free_page(struct page *page, unsigned int order) 1478int __isolate_free_page(struct page *page, unsigned int order)
1488{ 1479{
1489 unsigned long watermark; 1480 unsigned long watermark;
1490 struct zone *zone; 1481 struct zone *zone;
@@ -6408,13 +6399,12 @@ int alloc_contig_range(unsigned long start, unsigned long end,
6408 6399
6409 /* Make sure the range is really isolated. */ 6400 /* Make sure the range is really isolated. */
6410 if (test_pages_isolated(outer_start, end, false)) { 6401 if (test_pages_isolated(outer_start, end, false)) {
6411 pr_warn("alloc_contig_range test_pages_isolated(%lx, %lx) failed\n", 6402 pr_info("%s: [%lx, %lx) PFNs busy\n",
6412 outer_start, end); 6403 __func__, outer_start, end);
6413 ret = -EBUSY; 6404 ret = -EBUSY;
6414 goto done; 6405 goto done;
6415 } 6406 }
6416 6407
6417
6418 /* Grab isolated pages from freelists. */ 6408 /* Grab isolated pages from freelists. */
6419 outer_end = isolate_freepages_range(&cc, outer_start, end); 6409 outer_end = isolate_freepages_range(&cc, outer_start, end);
6420 if (!outer_end) { 6410 if (!outer_end) {
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index d1473b2e9481..c8778f7e208e 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -60,6 +60,7 @@ out:
60 int migratetype = get_pageblock_migratetype(page); 60 int migratetype = get_pageblock_migratetype(page);
61 61
62 set_pageblock_migratetype(page, MIGRATE_ISOLATE); 62 set_pageblock_migratetype(page, MIGRATE_ISOLATE);
63 zone->nr_isolate_pageblock++;
63 nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); 64 nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE);
64 65
65 __mod_zone_freepage_state(zone, -nr_pages, migratetype); 66 __mod_zone_freepage_state(zone, -nr_pages, migratetype);
@@ -75,16 +76,54 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype)
75{ 76{
76 struct zone *zone; 77 struct zone *zone;
77 unsigned long flags, nr_pages; 78 unsigned long flags, nr_pages;
79 struct page *isolated_page = NULL;
80 unsigned int order;
81 unsigned long page_idx, buddy_idx;
82 struct page *buddy;
78 83
79 zone = page_zone(page); 84 zone = page_zone(page);
80 spin_lock_irqsave(&zone->lock, flags); 85 spin_lock_irqsave(&zone->lock, flags);
81 if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) 86 if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
82 goto out; 87 goto out;
83 nr_pages = move_freepages_block(zone, page, migratetype); 88
84 __mod_zone_freepage_state(zone, nr_pages, migratetype); 89 /*
90 * Because freepage with more than pageblock_order on isolated
91 * pageblock is restricted to merge due to freepage counting problem,
92 * it is possible that there is free buddy page.
93 * move_freepages_block() doesn't care of merge so we need other
94 * approach in order to merge them. Isolation and free will make
95 * these pages to be merged.
96 */
97 if (PageBuddy(page)) {
98 order = page_order(page);
99 if (order >= pageblock_order) {
100 page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1);
101 buddy_idx = __find_buddy_index(page_idx, order);
102 buddy = page + (buddy_idx - page_idx);
103
104 if (!is_migrate_isolate_page(buddy)) {
105 __isolate_free_page(page, order);
106 set_page_refcounted(page);
107 isolated_page = page;
108 }
109 }
110 }
111
112 /*
113 * If we isolate freepage with more than pageblock_order, there
114 * should be no freepage in the range, so we could avoid costly
115 * pageblock scanning for freepage moving.
116 */
117 if (!isolated_page) {
118 nr_pages = move_freepages_block(zone, page, migratetype);
119 __mod_zone_freepage_state(zone, nr_pages, migratetype);
120 }
85 set_pageblock_migratetype(page, migratetype); 121 set_pageblock_migratetype(page, migratetype);
122 zone->nr_isolate_pageblock--;
86out: 123out:
87 spin_unlock_irqrestore(&zone->lock, flags); 124 spin_unlock_irqrestore(&zone->lock, flags);
125 if (isolated_page)
126 __free_pages(isolated_page, order);
88} 127}
89 128
90static inline struct page * 129static inline struct page *
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 406944207b61..dcdab81bd240 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -259,6 +259,10 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
259 if (s->size - size >= sizeof(void *)) 259 if (s->size - size >= sizeof(void *))
260 continue; 260 continue;
261 261
262 if (IS_ENABLED(CONFIG_SLAB) && align &&
263 (align > s->align || s->align % align))
264 continue;
265
262 return s; 266 return s;
263 } 267 }
264 return NULL; 268 return NULL;
diff --git a/mm/truncate.c b/mm/truncate.c
index 261eaf6e5a19..f1e4d6052369 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -715,8 +715,9 @@ EXPORT_SYMBOL(truncate_pagecache);
715 * necessary) to @newsize. It will be typically be called from the filesystem's 715 * necessary) to @newsize. It will be typically be called from the filesystem's
716 * setattr function when ATTR_SIZE is passed in. 716 * setattr function when ATTR_SIZE is passed in.
717 * 717 *
718 * Must be called with inode_mutex held and before all filesystem specific 718 * Must be called with a lock serializing truncates and writes (generally
719 * block truncation has been performed. 719 * i_mutex but e.g. xfs uses a different lock) and before all filesystem
720 * specific block truncation has been performed.
720 */ 721 */
721void truncate_setsize(struct inode *inode, loff_t newsize) 722void truncate_setsize(struct inode *inode, loff_t newsize)
722{ 723{
@@ -755,7 +756,6 @@ void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to)
755 struct page *page; 756 struct page *page;
756 pgoff_t index; 757 pgoff_t index;
757 758
758 WARN_ON(!mutex_is_locked(&inode->i_mutex));
759 WARN_ON(to > inode->i_size); 759 WARN_ON(to > inode->i_size);
760 760
761 if (from >= to || bsize == PAGE_CACHE_SIZE) 761 if (from >= to || bsize == PAGE_CACHE_SIZE)
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index de6662b14e1f..7e38b729696a 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -149,6 +149,7 @@ static int process_one_ticket(struct ceph_auth_client *ac,
149 struct ceph_crypto_key old_key; 149 struct ceph_crypto_key old_key;
150 void *ticket_buf = NULL; 150 void *ticket_buf = NULL;
151 void *tp, *tpend; 151 void *tp, *tpend;
152 void **ptp;
152 struct ceph_timespec new_validity; 153 struct ceph_timespec new_validity;
153 struct ceph_crypto_key new_session_key; 154 struct ceph_crypto_key new_session_key;
154 struct ceph_buffer *new_ticket_blob; 155 struct ceph_buffer *new_ticket_blob;
@@ -208,25 +209,19 @@ static int process_one_ticket(struct ceph_auth_client *ac,
208 goto out; 209 goto out;
209 } 210 }
210 tp = ticket_buf; 211 tp = ticket_buf;
211 dlen = ceph_decode_32(&tp); 212 ptp = &tp;
213 tpend = *ptp + dlen;
212 } else { 214 } else {
213 /* unencrypted */ 215 /* unencrypted */
214 ceph_decode_32_safe(p, end, dlen, bad); 216 ptp = p;
215 ticket_buf = kmalloc(dlen, GFP_NOFS); 217 tpend = end;
216 if (!ticket_buf) {
217 ret = -ENOMEM;
218 goto out;
219 }
220 tp = ticket_buf;
221 ceph_decode_need(p, end, dlen, bad);
222 ceph_decode_copy(p, ticket_buf, dlen);
223 } 218 }
224 tpend = tp + dlen; 219 ceph_decode_32_safe(ptp, tpend, dlen, bad);
225 dout(" ticket blob is %d bytes\n", dlen); 220 dout(" ticket blob is %d bytes\n", dlen);
226 ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); 221 ceph_decode_need(ptp, tpend, 1 + sizeof(u64), bad);
227 blob_struct_v = ceph_decode_8(&tp); 222 blob_struct_v = ceph_decode_8(ptp);
228 new_secret_id = ceph_decode_64(&tp); 223 new_secret_id = ceph_decode_64(ptp);
229 ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); 224 ret = ceph_decode_buffer(&new_ticket_blob, ptp, tpend);
230 if (ret) 225 if (ret)
231 goto out; 226 goto out;
232 227
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 62fc5e7a9acf..790fe89d90c0 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -90,11 +90,82 @@ static struct crypto_blkcipher *ceph_crypto_alloc_cipher(void)
90 90
91static const u8 *aes_iv = (u8 *)CEPH_AES_IV; 91static const u8 *aes_iv = (u8 *)CEPH_AES_IV;
92 92
93/*
94 * Should be used for buffers allocated with ceph_kvmalloc().
95 * Currently these are encrypt out-buffer (ceph_buffer) and decrypt
96 * in-buffer (msg front).
97 *
98 * Dispose of @sgt with teardown_sgtable().
99 *
100 * @prealloc_sg is to avoid memory allocation inside sg_alloc_table()
101 * in cases where a single sg is sufficient. No attempt to reduce the
102 * number of sgs by squeezing physically contiguous pages together is
103 * made though, for simplicity.
104 */
105static int setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg,
106 const void *buf, unsigned int buf_len)
107{
108 struct scatterlist *sg;
109 const bool is_vmalloc = is_vmalloc_addr(buf);
110 unsigned int off = offset_in_page(buf);
111 unsigned int chunk_cnt = 1;
112 unsigned int chunk_len = PAGE_ALIGN(off + buf_len);
113 int i;
114 int ret;
115
116 if (buf_len == 0) {
117 memset(sgt, 0, sizeof(*sgt));
118 return -EINVAL;
119 }
120
121 if (is_vmalloc) {
122 chunk_cnt = chunk_len >> PAGE_SHIFT;
123 chunk_len = PAGE_SIZE;
124 }
125
126 if (chunk_cnt > 1) {
127 ret = sg_alloc_table(sgt, chunk_cnt, GFP_NOFS);
128 if (ret)
129 return ret;
130 } else {
131 WARN_ON(chunk_cnt != 1);
132 sg_init_table(prealloc_sg, 1);
133 sgt->sgl = prealloc_sg;
134 sgt->nents = sgt->orig_nents = 1;
135 }
136
137 for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) {
138 struct page *page;
139 unsigned int len = min(chunk_len - off, buf_len);
140
141 if (is_vmalloc)
142 page = vmalloc_to_page(buf);
143 else
144 page = virt_to_page(buf);
145
146 sg_set_page(sg, page, len, off);
147
148 off = 0;
149 buf += len;
150 buf_len -= len;
151 }
152 WARN_ON(buf_len != 0);
153
154 return 0;
155}
156
157static void teardown_sgtable(struct sg_table *sgt)
158{
159 if (sgt->orig_nents > 1)
160 sg_free_table(sgt);
161}
162
93static int ceph_aes_encrypt(const void *key, int key_len, 163static int ceph_aes_encrypt(const void *key, int key_len,
94 void *dst, size_t *dst_len, 164 void *dst, size_t *dst_len,
95 const void *src, size_t src_len) 165 const void *src, size_t src_len)
96{ 166{
97 struct scatterlist sg_in[2], sg_out[1]; 167 struct scatterlist sg_in[2], prealloc_sg;
168 struct sg_table sg_out;
98 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 169 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher();
99 struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; 170 struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 };
100 int ret; 171 int ret;
@@ -110,16 +181,18 @@ static int ceph_aes_encrypt(const void *key, int key_len,
110 181
111 *dst_len = src_len + zero_padding; 182 *dst_len = src_len + zero_padding;
112 183
113 crypto_blkcipher_setkey((void *)tfm, key, key_len);
114 sg_init_table(sg_in, 2); 184 sg_init_table(sg_in, 2);
115 sg_set_buf(&sg_in[0], src, src_len); 185 sg_set_buf(&sg_in[0], src, src_len);
116 sg_set_buf(&sg_in[1], pad, zero_padding); 186 sg_set_buf(&sg_in[1], pad, zero_padding);
117 sg_init_table(sg_out, 1); 187 ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len);
118 sg_set_buf(sg_out, dst, *dst_len); 188 if (ret)
189 goto out_tfm;
190
191 crypto_blkcipher_setkey((void *)tfm, key, key_len);
119 iv = crypto_blkcipher_crt(tfm)->iv; 192 iv = crypto_blkcipher_crt(tfm)->iv;
120 ivsize = crypto_blkcipher_ivsize(tfm); 193 ivsize = crypto_blkcipher_ivsize(tfm);
121
122 memcpy(iv, aes_iv, ivsize); 194 memcpy(iv, aes_iv, ivsize);
195
123 /* 196 /*
124 print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, 197 print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1,
125 key, key_len, 1); 198 key, key_len, 1);
@@ -128,16 +201,22 @@ static int ceph_aes_encrypt(const void *key, int key_len,
128 print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, 201 print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1,
129 pad, zero_padding, 1); 202 pad, zero_padding, 1);
130 */ 203 */
131 ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 204 ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in,
132 src_len + zero_padding); 205 src_len + zero_padding);
133 crypto_free_blkcipher(tfm); 206 if (ret < 0) {
134 if (ret < 0)
135 pr_err("ceph_aes_crypt failed %d\n", ret); 207 pr_err("ceph_aes_crypt failed %d\n", ret);
208 goto out_sg;
209 }
136 /* 210 /*
137 print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, 211 print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1,
138 dst, *dst_len, 1); 212 dst, *dst_len, 1);
139 */ 213 */
140 return 0; 214
215out_sg:
216 teardown_sgtable(&sg_out);
217out_tfm:
218 crypto_free_blkcipher(tfm);
219 return ret;
141} 220}
142 221
143static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, 222static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
@@ -145,7 +224,8 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
145 const void *src1, size_t src1_len, 224 const void *src1, size_t src1_len,
146 const void *src2, size_t src2_len) 225 const void *src2, size_t src2_len)
147{ 226{
148 struct scatterlist sg_in[3], sg_out[1]; 227 struct scatterlist sg_in[3], prealloc_sg;
228 struct sg_table sg_out;
149 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 229 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher();
150 struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; 230 struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 };
151 int ret; 231 int ret;
@@ -161,17 +241,19 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
161 241
162 *dst_len = src1_len + src2_len + zero_padding; 242 *dst_len = src1_len + src2_len + zero_padding;
163 243
164 crypto_blkcipher_setkey((void *)tfm, key, key_len);
165 sg_init_table(sg_in, 3); 244 sg_init_table(sg_in, 3);
166 sg_set_buf(&sg_in[0], src1, src1_len); 245 sg_set_buf(&sg_in[0], src1, src1_len);
167 sg_set_buf(&sg_in[1], src2, src2_len); 246 sg_set_buf(&sg_in[1], src2, src2_len);
168 sg_set_buf(&sg_in[2], pad, zero_padding); 247 sg_set_buf(&sg_in[2], pad, zero_padding);
169 sg_init_table(sg_out, 1); 248 ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len);
170 sg_set_buf(sg_out, dst, *dst_len); 249 if (ret)
250 goto out_tfm;
251
252 crypto_blkcipher_setkey((void *)tfm, key, key_len);
171 iv = crypto_blkcipher_crt(tfm)->iv; 253 iv = crypto_blkcipher_crt(tfm)->iv;
172 ivsize = crypto_blkcipher_ivsize(tfm); 254 ivsize = crypto_blkcipher_ivsize(tfm);
173
174 memcpy(iv, aes_iv, ivsize); 255 memcpy(iv, aes_iv, ivsize);
256
175 /* 257 /*
176 print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, 258 print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1,
177 key, key_len, 1); 259 key, key_len, 1);
@@ -182,23 +264,30 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
182 print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, 264 print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1,
183 pad, zero_padding, 1); 265 pad, zero_padding, 1);
184 */ 266 */
185 ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 267 ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in,
186 src1_len + src2_len + zero_padding); 268 src1_len + src2_len + zero_padding);
187 crypto_free_blkcipher(tfm); 269 if (ret < 0) {
188 if (ret < 0)
189 pr_err("ceph_aes_crypt2 failed %d\n", ret); 270 pr_err("ceph_aes_crypt2 failed %d\n", ret);
271 goto out_sg;
272 }
190 /* 273 /*
191 print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, 274 print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1,
192 dst, *dst_len, 1); 275 dst, *dst_len, 1);
193 */ 276 */
194 return 0; 277
278out_sg:
279 teardown_sgtable(&sg_out);
280out_tfm:
281 crypto_free_blkcipher(tfm);
282 return ret;
195} 283}
196 284
197static int ceph_aes_decrypt(const void *key, int key_len, 285static int ceph_aes_decrypt(const void *key, int key_len,
198 void *dst, size_t *dst_len, 286 void *dst, size_t *dst_len,
199 const void *src, size_t src_len) 287 const void *src, size_t src_len)
200{ 288{
201 struct scatterlist sg_in[1], sg_out[2]; 289 struct sg_table sg_in;
290 struct scatterlist sg_out[2], prealloc_sg;
202 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 291 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher();
203 struct blkcipher_desc desc = { .tfm = tfm }; 292 struct blkcipher_desc desc = { .tfm = tfm };
204 char pad[16]; 293 char pad[16];
@@ -210,16 +299,16 @@ static int ceph_aes_decrypt(const void *key, int key_len,
210 if (IS_ERR(tfm)) 299 if (IS_ERR(tfm))
211 return PTR_ERR(tfm); 300 return PTR_ERR(tfm);
212 301
213 crypto_blkcipher_setkey((void *)tfm, key, key_len);
214 sg_init_table(sg_in, 1);
215 sg_init_table(sg_out, 2); 302 sg_init_table(sg_out, 2);
216 sg_set_buf(sg_in, src, src_len);
217 sg_set_buf(&sg_out[0], dst, *dst_len); 303 sg_set_buf(&sg_out[0], dst, *dst_len);
218 sg_set_buf(&sg_out[1], pad, sizeof(pad)); 304 sg_set_buf(&sg_out[1], pad, sizeof(pad));
305 ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len);
306 if (ret)
307 goto out_tfm;
219 308
309 crypto_blkcipher_setkey((void *)tfm, key, key_len);
220 iv = crypto_blkcipher_crt(tfm)->iv; 310 iv = crypto_blkcipher_crt(tfm)->iv;
221 ivsize = crypto_blkcipher_ivsize(tfm); 311 ivsize = crypto_blkcipher_ivsize(tfm);
222
223 memcpy(iv, aes_iv, ivsize); 312 memcpy(iv, aes_iv, ivsize);
224 313
225 /* 314 /*
@@ -228,12 +317,10 @@ static int ceph_aes_decrypt(const void *key, int key_len,
228 print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, 317 print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1,
229 src, src_len, 1); 318 src, src_len, 1);
230 */ 319 */
231 320 ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len);
232 ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len);
233 crypto_free_blkcipher(tfm);
234 if (ret < 0) { 321 if (ret < 0) {
235 pr_err("ceph_aes_decrypt failed %d\n", ret); 322 pr_err("ceph_aes_decrypt failed %d\n", ret);
236 return ret; 323 goto out_sg;
237 } 324 }
238 325
239 if (src_len <= *dst_len) 326 if (src_len <= *dst_len)
@@ -251,7 +338,12 @@ static int ceph_aes_decrypt(const void *key, int key_len,
251 print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, 338 print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1,
252 dst, *dst_len, 1); 339 dst, *dst_len, 1);
253 */ 340 */
254 return 0; 341
342out_sg:
343 teardown_sgtable(&sg_in);
344out_tfm:
345 crypto_free_blkcipher(tfm);
346 return ret;
255} 347}
256 348
257static int ceph_aes_decrypt2(const void *key, int key_len, 349static int ceph_aes_decrypt2(const void *key, int key_len,
@@ -259,7 +351,8 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
259 void *dst2, size_t *dst2_len, 351 void *dst2, size_t *dst2_len,
260 const void *src, size_t src_len) 352 const void *src, size_t src_len)
261{ 353{
262 struct scatterlist sg_in[1], sg_out[3]; 354 struct sg_table sg_in;
355 struct scatterlist sg_out[3], prealloc_sg;
263 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 356 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher();
264 struct blkcipher_desc desc = { .tfm = tfm }; 357 struct blkcipher_desc desc = { .tfm = tfm };
265 char pad[16]; 358 char pad[16];
@@ -271,17 +364,17 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
271 if (IS_ERR(tfm)) 364 if (IS_ERR(tfm))
272 return PTR_ERR(tfm); 365 return PTR_ERR(tfm);
273 366
274 sg_init_table(sg_in, 1);
275 sg_set_buf(sg_in, src, src_len);
276 sg_init_table(sg_out, 3); 367 sg_init_table(sg_out, 3);
277 sg_set_buf(&sg_out[0], dst1, *dst1_len); 368 sg_set_buf(&sg_out[0], dst1, *dst1_len);
278 sg_set_buf(&sg_out[1], dst2, *dst2_len); 369 sg_set_buf(&sg_out[1], dst2, *dst2_len);
279 sg_set_buf(&sg_out[2], pad, sizeof(pad)); 370 sg_set_buf(&sg_out[2], pad, sizeof(pad));
371 ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len);
372 if (ret)
373 goto out_tfm;
280 374
281 crypto_blkcipher_setkey((void *)tfm, key, key_len); 375 crypto_blkcipher_setkey((void *)tfm, key, key_len);
282 iv = crypto_blkcipher_crt(tfm)->iv; 376 iv = crypto_blkcipher_crt(tfm)->iv;
283 ivsize = crypto_blkcipher_ivsize(tfm); 377 ivsize = crypto_blkcipher_ivsize(tfm);
284
285 memcpy(iv, aes_iv, ivsize); 378 memcpy(iv, aes_iv, ivsize);
286 379
287 /* 380 /*
@@ -290,12 +383,10 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
290 print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, 383 print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1,
291 src, src_len, 1); 384 src, src_len, 1);
292 */ 385 */
293 386 ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len);
294 ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len);
295 crypto_free_blkcipher(tfm);
296 if (ret < 0) { 387 if (ret < 0) {
297 pr_err("ceph_aes_decrypt failed %d\n", ret); 388 pr_err("ceph_aes_decrypt failed %d\n", ret);
298 return ret; 389 goto out_sg;
299 } 390 }
300 391
301 if (src_len <= *dst1_len) 392 if (src_len <= *dst1_len)
@@ -325,7 +416,11 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
325 dst2, *dst2_len, 1); 416 dst2, *dst2_len, 1);
326 */ 417 */
327 418
328 return 0; 419out_sg:
420 teardown_sgtable(&sg_in);
421out_tfm:
422 crypto_free_blkcipher(tfm);
423 return ret;
329} 424}
330 425
331 426
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 559c9f619c20..8d1653caffdb 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -484,7 +484,7 @@ static int ceph_tcp_connect(struct ceph_connection *con)
484 IPPROTO_TCP, &sock); 484 IPPROTO_TCP, &sock);
485 if (ret) 485 if (ret)
486 return ret; 486 return ret;
487 sock->sk->sk_allocation = GFP_NOFS; 487 sock->sk->sk_allocation = GFP_NOFS | __GFP_MEMALLOC;
488 488
489#ifdef CONFIG_LOCKDEP 489#ifdef CONFIG_LOCKDEP
490 lockdep_set_class(&sock->sk->sk_lock, &socket_class); 490 lockdep_set_class(&sock->sk->sk_lock, &socket_class);
@@ -509,6 +509,9 @@ static int ceph_tcp_connect(struct ceph_connection *con)
509 509
510 return ret; 510 return ret;
511 } 511 }
512
513 sk_set_memalloc(sock->sk);
514
512 con->sock = sock; 515 con->sock = sock;
513 return 0; 516 return 0;
514} 517}
@@ -2769,8 +2772,11 @@ static void con_work(struct work_struct *work)
2769{ 2772{
2770 struct ceph_connection *con = container_of(work, struct ceph_connection, 2773 struct ceph_connection *con = container_of(work, struct ceph_connection,
2771 work.work); 2774 work.work);
2775 unsigned long pflags = current->flags;
2772 bool fault; 2776 bool fault;
2773 2777
2778 current->flags |= PF_MEMALLOC;
2779
2774 mutex_lock(&con->mutex); 2780 mutex_lock(&con->mutex);
2775 while (true) { 2781 while (true) {
2776 int ret; 2782 int ret;
@@ -2824,6 +2830,8 @@ static void con_work(struct work_struct *work)
2824 con_fault_finish(con); 2830 con_fault_finish(con);
2825 2831
2826 con->ops->put(con); 2832 con->ops->put(con);
2833
2834 tsk_restore_flags(current, pflags, PF_MEMALLOC);
2827} 2835}
2828 2836
2829/* 2837/*
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index f3fc54eac09d..6f164289bde8 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1007,8 +1007,8 @@ static void put_osd(struct ceph_osd *osd)
1007static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) 1007static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
1008{ 1008{
1009 dout("__remove_osd %p\n", osd); 1009 dout("__remove_osd %p\n", osd);
1010 BUG_ON(!list_empty(&osd->o_requests)); 1010 WARN_ON(!list_empty(&osd->o_requests));
1011 BUG_ON(!list_empty(&osd->o_linger_requests)); 1011 WARN_ON(!list_empty(&osd->o_linger_requests));
1012 1012
1013 rb_erase(&osd->o_node, &osdc->osds); 1013 rb_erase(&osd->o_node, &osdc->osds);
1014 list_del_init(&osd->o_osd_lru); 1014 list_del_init(&osd->o_osd_lru);
@@ -1254,6 +1254,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,
1254 if (list_empty(&req->r_osd_item)) 1254 if (list_empty(&req->r_osd_item))
1255 req->r_osd = NULL; 1255 req->r_osd = NULL;
1256 } 1256 }
1257
1258 list_del_init(&req->r_req_lru_item); /* can be on notarget */
1257 ceph_osdc_put_request(req); 1259 ceph_osdc_put_request(req);
1258} 1260}
1259 1261
@@ -1395,6 +1397,7 @@ static int __map_request(struct ceph_osd_client *osdc,
1395 if (req->r_osd) { 1397 if (req->r_osd) {
1396 __cancel_request(req); 1398 __cancel_request(req);
1397 list_del_init(&req->r_osd_item); 1399 list_del_init(&req->r_osd_item);
1400 list_del_init(&req->r_linger_osd_item);
1398 req->r_osd = NULL; 1401 req->r_osd = NULL;
1399 } 1402 }
1400 1403
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index b0b436b0692c..3dfe9828e7ef 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -227,6 +227,8 @@ static int fou_gro_complete(struct sk_buff *skb, int nhoff)
227 int err = -ENOSYS; 227 int err = -ENOSYS;
228 const struct net_offload **offloads; 228 const struct net_offload **offloads;
229 229
230 udp_tunnel_gro_complete(skb, nhoff);
231
230 rcu_read_lock(); 232 rcu_read_lock();
231 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; 233 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
232 ops = rcu_dereference(offloads[proto]); 234 ops = rcu_dereference(offloads[proto]);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 21894df66262..b7826575d215 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -195,7 +195,7 @@ int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc,
195 for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { 195 for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
196 if (!CMSG_OK(msg, cmsg)) 196 if (!CMSG_OK(msg, cmsg))
197 return -EINVAL; 197 return -EINVAL;
198#if defined(CONFIG_IPV6) 198#if IS_ENABLED(CONFIG_IPV6)
199 if (allow_ipv6 && 199 if (allow_ipv6 &&
200 cmsg->cmsg_level == SOL_IPV6 && 200 cmsg->cmsg_level == SOL_IPV6 &&
201 cmsg->cmsg_type == IPV6_PKTINFO) { 201 cmsg->cmsg_type == IPV6_PKTINFO) {
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 31f70a8c7813..e8c409055922 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1052,8 +1052,6 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr,
1052 1052
1053 if (sk->sk_state != TCP_ESTABLISHED) { 1053 if (sk->sk_state != TCP_ESTABLISHED) {
1054 sock->state = SS_UNCONNECTED; 1054 sock->state = SS_UNCONNECTED;
1055 if (sk->sk_prot->disconnect(sk, flags))
1056 sock->state = SS_DISCONNECTING;
1057 err = sock_error(sk); 1055 err = sock_error(sk);
1058 if (!err) 1056 if (!err)
1059 err = -ECONNRESET; 1057 err = -ECONNRESET;
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 56b53571c807..509bc157ce55 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -805,7 +805,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
805 805
806 memset(&params, 0, sizeof(params)); 806 memset(&params, 0, sizeof(params));
807 memset(&csa_ie, 0, sizeof(csa_ie)); 807 memset(&csa_ie, 0, sizeof(csa_ie));
808 err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, 808 err = ieee80211_parse_ch_switch_ie(sdata, elems,
809 ifibss->chandef.chan->band, 809 ifibss->chandef.chan->band,
810 sta_flags, ifibss->bssid, &csa_ie); 810 sta_flags, ifibss->bssid, &csa_ie);
811 /* can't switch to destination channel, fail */ 811 /* can't switch to destination channel, fail */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a51c993ece73..842e0661fb57 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1705,7 +1705,6 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
1705 * ieee80211_parse_ch_switch_ie - parses channel switch IEs 1705 * ieee80211_parse_ch_switch_ie - parses channel switch IEs
1706 * @sdata: the sdata of the interface which has received the frame 1706 * @sdata: the sdata of the interface which has received the frame
1707 * @elems: parsed 802.11 elements received with the frame 1707 * @elems: parsed 802.11 elements received with the frame
1708 * @beacon: indicates if the frame was a beacon or probe response
1709 * @current_band: indicates the current band 1708 * @current_band: indicates the current band
1710 * @sta_flags: contains information about own capabilities and restrictions 1709 * @sta_flags: contains information about own capabilities and restrictions
1711 * to decide which channel switch announcements can be accepted. Only the 1710 * to decide which channel switch announcements can be accepted. Only the
@@ -1719,7 +1718,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
1719 * Return: 0 on success, <0 on error and >0 if there is nothing to parse. 1718 * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
1720 */ 1719 */
1721int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 1720int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
1722 struct ieee802_11_elems *elems, bool beacon, 1721 struct ieee802_11_elems *elems,
1723 enum ieee80211_band current_band, 1722 enum ieee80211_band current_band,
1724 u32 sta_flags, u8 *bssid, 1723 u32 sta_flags, u8 *bssid,
1725 struct ieee80211_csa_ie *csa_ie); 1724 struct ieee80211_csa_ie *csa_ie);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 6b631c049eba..9df26adb864a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -777,10 +777,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
777 int i, flushed; 777 int i, flushed;
778 struct ps_data *ps; 778 struct ps_data *ps;
779 struct cfg80211_chan_def chandef; 779 struct cfg80211_chan_def chandef;
780 bool cancel_scan;
780 781
781 clear_bit(SDATA_STATE_RUNNING, &sdata->state); 782 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
782 783
783 if (rcu_access_pointer(local->scan_sdata) == sdata) 784 cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
785 if (cancel_scan)
784 ieee80211_scan_cancel(local); 786 ieee80211_scan_cancel(local);
785 787
786 /* 788 /*
@@ -911,6 +913,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
911 list_del(&sdata->u.vlan.list); 913 list_del(&sdata->u.vlan.list);
912 mutex_unlock(&local->mtx); 914 mutex_unlock(&local->mtx);
913 RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); 915 RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL);
916 /* see comment in the default case below */
917 ieee80211_free_keys(sdata, true);
914 /* no need to tell driver */ 918 /* no need to tell driver */
915 break; 919 break;
916 case NL80211_IFTYPE_MONITOR: 920 case NL80211_IFTYPE_MONITOR:
@@ -936,17 +940,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
936 /* 940 /*
937 * When we get here, the interface is marked down. 941 * When we get here, the interface is marked down.
938 * Free the remaining keys, if there are any 942 * Free the remaining keys, if there are any
939 * (shouldn't be, except maybe in WDS mode?) 943 * (which can happen in AP mode if userspace sets
944 * keys before the interface is operating, and maybe
945 * also in WDS mode)
940 * 946 *
941 * Force the key freeing to always synchronize_net() 947 * Force the key freeing to always synchronize_net()
942 * to wait for the RX path in case it is using this 948 * to wait for the RX path in case it is using this
943 * interface enqueuing frames * at this very time on 949 * interface enqueuing frames at this very time on
944 * another CPU. 950 * another CPU.
945 */ 951 */
946 ieee80211_free_keys(sdata, true); 952 ieee80211_free_keys(sdata, true);
947
948 /* fall through */
949 case NL80211_IFTYPE_AP:
950 skb_queue_purge(&sdata->skb_queue); 953 skb_queue_purge(&sdata->skb_queue);
951 } 954 }
952 955
@@ -1004,6 +1007,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
1004 1007
1005 ieee80211_recalc_ps(local, -1); 1008 ieee80211_recalc_ps(local, -1);
1006 1009
1010 if (cancel_scan)
1011 flush_delayed_work(&local->scan_work);
1012
1007 if (local->open_count == 0) { 1013 if (local->open_count == 0) {
1008 ieee80211_stop_device(local); 1014 ieee80211_stop_device(local);
1009 1015
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index e9f99c1e3fad..0c8b2a77d312 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -874,7 +874,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
874 874
875 memset(&params, 0, sizeof(params)); 875 memset(&params, 0, sizeof(params));
876 memset(&csa_ie, 0, sizeof(csa_ie)); 876 memset(&csa_ie, 0, sizeof(csa_ie));
877 err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band, 877 err = ieee80211_parse_ch_switch_ie(sdata, elems, band,
878 sta_flags, sdata->vif.addr, 878 sta_flags, sdata->vif.addr,
879 &csa_ie); 879 &csa_ie);
880 if (err < 0) 880 if (err < 0)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 213a420704a6..0d166e766dad 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1117,7 +1117,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1117 1117
1118 current_band = cbss->channel->band; 1118 current_band = cbss->channel->band;
1119 memset(&csa_ie, 0, sizeof(csa_ie)); 1119 memset(&csa_ie, 0, sizeof(csa_ie));
1120 res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band, 1120 res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band,
1121 ifmgd->flags, 1121 ifmgd->flags,
1122 ifmgd->associated->bssid, &csa_ie); 1122 ifmgd->associated->bssid, &csa_ie);
1123 if (res < 0) 1123 if (res < 0)
@@ -1216,7 +1216,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1216 ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); 1216 ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work);
1217 else 1217 else
1218 mod_timer(&ifmgd->chswitch_timer, 1218 mod_timer(&ifmgd->chswitch_timer,
1219 TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval)); 1219 TU_TO_EXP_TIME((csa_ie.count - 1) *
1220 cbss->beacon_interval));
1220} 1221}
1221 1222
1222static bool 1223static bool
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bc63aa0c5401..a726bb169302 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1685,11 +1685,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1685 sc = le16_to_cpu(hdr->seq_ctrl); 1685 sc = le16_to_cpu(hdr->seq_ctrl);
1686 frag = sc & IEEE80211_SCTL_FRAG; 1686 frag = sc & IEEE80211_SCTL_FRAG;
1687 1687
1688 if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || 1688 if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1689 is_multicast_ether_addr(hdr->addr1))) { 1689 goto out;
1690 /* not fragmented */ 1690
1691 if (is_multicast_ether_addr(hdr->addr1)) {
1692 rx->local->dot11MulticastReceivedFrameCount++;
1691 goto out; 1693 goto out;
1692 } 1694 }
1695
1693 I802_DEBUG_INC(rx->local->rx_handlers_fragments); 1696 I802_DEBUG_INC(rx->local->rx_handlers_fragments);
1694 1697
1695 if (skb_linearize(rx->skb)) 1698 if (skb_linearize(rx->skb))
@@ -1782,10 +1785,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1782 out: 1785 out:
1783 if (rx->sta) 1786 if (rx->sta)
1784 rx->sta->rx_packets++; 1787 rx->sta->rx_packets++;
1785 if (is_multicast_ether_addr(hdr->addr1)) 1788 ieee80211_led_rx(rx->local);
1786 rx->local->dot11MulticastReceivedFrameCount++;
1787 else
1788 ieee80211_led_rx(rx->local);
1789 return RX_CONTINUE; 1789 return RX_CONTINUE;
1790} 1790}
1791 1791
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c
index 6ab009070084..efeba56c913b 100644
--- a/net/mac80211/spectmgmt.c
+++ b/net/mac80211/spectmgmt.c
@@ -22,7 +22,7 @@
22#include "wme.h" 22#include "wme.h"
23 23
24int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 24int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
25 struct ieee802_11_elems *elems, bool beacon, 25 struct ieee802_11_elems *elems,
26 enum ieee80211_band current_band, 26 enum ieee80211_band current_band,
27 u32 sta_flags, u8 *bssid, 27 u32 sta_flags, u8 *bssid,
28 struct ieee80211_csa_ie *csa_ie) 28 struct ieee80211_csa_ie *csa_ie)
@@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
91 return -EINVAL; 91 return -EINVAL;
92 } 92 }
93 93
94 if (!beacon && sec_chan_offs) { 94 if (sec_chan_offs) {
95 secondary_channel_offset = sec_chan_offs->sec_chan_offs; 95 secondary_channel_offset = sec_chan_offs->sec_chan_offs;
96 } else if (beacon && ht_oper) {
97 secondary_channel_offset =
98 ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
99 } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { 96 } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) {
100 /* If it's not a beacon, HT is enabled and the IE not present, 97 /* If the secondary channel offset IE is not present,
101 * it's 20 MHz, 802.11-2012 8.5.2.6: 98 * we can't know what's the post-CSA offset, so the
102 * This element [the Secondary Channel Offset Element] is 99 * best we can do is use 20MHz.
103 * present when switching to a 40 MHz channel. It may be 100 */
104 * present when switching to a 20 MHz channel (in which
105 * case the secondary channel offset is set to SCN).
106 */
107 secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; 101 secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
108 } 102 }
109 103
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a491c1a4861f..d479b32d5826 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1440,7 +1440,7 @@ static void netlink_unbind(int group, long unsigned int groups,
1440 return; 1440 return;
1441 1441
1442 for (undo = 0; undo < group; undo++) 1442 for (undo = 0; undo < group; undo++)
1443 if (test_bit(group, &groups)) 1443 if (test_bit(undo, &groups))
1444 nlk->netlink_unbind(undo); 1444 nlk->netlink_unbind(undo);
1445} 1445}
1446 1446
@@ -1492,7 +1492,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
1492 netlink_insert(sk, net, nladdr->nl_pid) : 1492 netlink_insert(sk, net, nladdr->nl_pid) :
1493 netlink_autobind(sock); 1493 netlink_autobind(sock);
1494 if (err) { 1494 if (err) {
1495 netlink_unbind(nlk->ngroups - 1, groups, nlk); 1495 netlink_unbind(nlk->ngroups, groups, nlk);
1496 return err; 1496 return err;
1497 } 1497 }
1498 } 1498 }
@@ -2509,6 +2509,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
2509 nl_table[unit].module = module; 2509 nl_table[unit].module = module;
2510 if (cfg) { 2510 if (cfg) {
2511 nl_table[unit].bind = cfg->bind; 2511 nl_table[unit].bind = cfg->bind;
2512 nl_table[unit].unbind = cfg->unbind;
2512 nl_table[unit].flags = cfg->flags; 2513 nl_table[unit].flags = cfg->flags;
2513 if (cfg->compare) 2514 if (cfg->compare)
2514 nl_table[unit].compare = cfg->compare; 2515 nl_table[unit].compare = cfg->compare;
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 0e8529113dc5..fb7976aee61c 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -862,8 +862,6 @@ int sctp_auth_set_key(struct sctp_endpoint *ep,
862 list_add(&cur_key->key_list, sh_keys); 862 list_add(&cur_key->key_list, sh_keys);
863 863
864 cur_key->key = key; 864 cur_key->key = key;
865 sctp_auth_key_hold(key);
866
867 return 0; 865 return 0;
868nomem: 866nomem:
869 if (!replace) 867 if (!replace)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index ab734be8cb20..9f32741abb1c 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2609,6 +2609,9 @@ do_addr_param:
2609 addr_param = param.v + sizeof(sctp_addip_param_t); 2609 addr_param = param.v + sizeof(sctp_addip_param_t);
2610 2610
2611 af = sctp_get_af_specific(param_type2af(param.p->type)); 2611 af = sctp_get_af_specific(param_type2af(param.p->type));
2612 if (af == NULL)
2613 break;
2614
2612 af->from_addr_param(&addr, addr_param, 2615 af->from_addr_param(&addr, addr_param,
2613 htons(asoc->peer.port), 0); 2616 htons(asoc->peer.port), 0);
2614 2617
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e66314138b38..c603b20356ad 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4725,9 +4725,10 @@ static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb)
4725 err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm); 4725 err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm);
4726 if (err) { 4726 if (err) {
4727 if (err == -EINVAL) { 4727 if (err == -EINVAL) {
4728 WARN_ONCE(1, "selinux_nlmsg_perm: unrecognized netlink message:" 4728 printk(KERN_WARNING
4729 " protocol=%hu nlmsg_type=%hu sclass=%hu\n", 4729 "SELinux: unrecognized netlink message:"
4730 sk->sk_protocol, nlh->nlmsg_type, sksec->sclass); 4730 " protocol=%hu nlmsg_type=%hu sclass=%hu\n",
4731 sk->sk_protocol, nlh->nlmsg_type, sksec->sclass);
4731 if (!selinux_enforcing || security_get_allow_unknown()) 4732 if (!selinux_enforcing || security_get_allow_unknown())
4732 err = 0; 4733 err = 0;
4733 } 4734 }
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9ab1e631cb32..16660f312043 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -219,6 +219,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
219 "{Intel, LPT_LP}," 219 "{Intel, LPT_LP},"
220 "{Intel, WPT_LP}," 220 "{Intel, WPT_LP},"
221 "{Intel, SPT}," 221 "{Intel, SPT},"
222 "{Intel, SPT_LP},"
222 "{Intel, HPT}," 223 "{Intel, HPT},"
223 "{Intel, PBG}," 224 "{Intel, PBG},"
224 "{Intel, SCH}," 225 "{Intel, SCH},"
@@ -2004,6 +2005,9 @@ static const struct pci_device_id azx_ids[] = {
2004 /* Sunrise Point */ 2005 /* Sunrise Point */
2005 { PCI_DEVICE(0x8086, 0xa170), 2006 { PCI_DEVICE(0x8086, 0xa170),
2006 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2007 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
2008 /* Sunrise Point-LP */
2009 { PCI_DEVICE(0x8086, 0x9d70),
2010 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
2007 /* Haswell */ 2011 /* Haswell */
2008 { PCI_DEVICE(0x8086, 0x0a0c), 2012 { PCI_DEVICE(0x8086, 0x0a0c),
2009 .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, 2013 .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL },
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 71e4bad06345..e9ebc7bd752c 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -43,6 +43,7 @@ struct conexant_spec {
43 unsigned int num_eapds; 43 unsigned int num_eapds;
44 hda_nid_t eapds[4]; 44 hda_nid_t eapds[4];
45 bool dynamic_eapd; 45 bool dynamic_eapd;
46 hda_nid_t mute_led_eapd;
46 47
47 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ 48 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
48 49
@@ -163,6 +164,17 @@ static void cx_auto_vmaster_hook(void *private_data, int enabled)
163 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); 164 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled);
164} 165}
165 166
167/* turn on/off EAPD according to Master switch (inversely!) for mute LED */
168static void cx_auto_vmaster_hook_mute_led(void *private_data, int enabled)
169{
170 struct hda_codec *codec = private_data;
171 struct conexant_spec *spec = codec->spec;
172
173 snd_hda_codec_write(codec, spec->mute_led_eapd, 0,
174 AC_VERB_SET_EAPD_BTLENABLE,
175 enabled ? 0x00 : 0x02);
176}
177
166static int cx_auto_build_controls(struct hda_codec *codec) 178static int cx_auto_build_controls(struct hda_codec *codec)
167{ 179{
168 int err; 180 int err;
@@ -223,6 +235,7 @@ enum {
223 CXT_FIXUP_TOSHIBA_P105, 235 CXT_FIXUP_TOSHIBA_P105,
224 CXT_FIXUP_HP_530, 236 CXT_FIXUP_HP_530,
225 CXT_FIXUP_CAP_MIX_AMP_5047, 237 CXT_FIXUP_CAP_MIX_AMP_5047,
238 CXT_FIXUP_MUTE_LED_EAPD,
226}; 239};
227 240
228/* for hda_fixup_thinkpad_acpi() */ 241/* for hda_fixup_thinkpad_acpi() */
@@ -557,6 +570,18 @@ static void cxt_fixup_olpc_xo(struct hda_codec *codec,
557 } 570 }
558} 571}
559 572
573static void cxt_fixup_mute_led_eapd(struct hda_codec *codec,
574 const struct hda_fixup *fix, int action)
575{
576 struct conexant_spec *spec = codec->spec;
577
578 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
579 spec->mute_led_eapd = 0x1b;
580 spec->dynamic_eapd = 1;
581 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook_mute_led;
582 }
583}
584
560/* 585/*
561 * Fix max input level on mixer widget to 0dB 586 * Fix max input level on mixer widget to 0dB
562 * (originally it has 0x2b steps with 0dB offset 0x14) 587 * (originally it has 0x2b steps with 0dB offset 0x14)
@@ -705,6 +730,10 @@ static const struct hda_fixup cxt_fixups[] = {
705 .type = HDA_FIXUP_FUNC, 730 .type = HDA_FIXUP_FUNC,
706 .v.func = cxt_fixup_cap_mix_amp_5047, 731 .v.func = cxt_fixup_cap_mix_amp_5047,
707 }, 732 },
733 [CXT_FIXUP_MUTE_LED_EAPD] = {
734 .type = HDA_FIXUP_FUNC,
735 .v.func = cxt_fixup_mute_led_eapd,
736 },
708}; 737};
709 738
710static const struct snd_pci_quirk cxt5045_fixups[] = { 739static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -762,6 +791,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
762 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 791 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
763 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), 792 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410),
764 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), 793 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
794 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD),
765 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 795 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
766 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 796 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
767 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 797 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
@@ -780,6 +810,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = {
780 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, 810 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
781 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, 811 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
782 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, 812 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
813 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
783 {} 814 {}
784}; 815};
785 816
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c9cf248ce8ec..172395465e8a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -288,21 +288,91 @@ static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
288 snd_hda_jack_unsol_event(codec, res >> 2); 288 snd_hda_jack_unsol_event(codec, res >> 2);
289} 289}
290 290
291/* additional initialization for ALC888 variants */ 291/* Change EAPD to verb control */
292static void alc888_coef_init(struct hda_codec *codec) 292static void alc_fill_eapd_coef(struct hda_codec *codec)
293{ 293{
294 if (alc_get_coef0(codec) == 0x20) 294 int coef;
295 /* alc888S-VC */ 295
296 alc_write_coef_idx(codec, 7, 0x830); 296 coef = alc_get_coef0(codec);
297 else 297
298 /* alc888-VB */ 298 switch (codec->vendor_id) {
299 alc_write_coef_idx(codec, 7, 0x3030); 299 case 0x10ec0262:
300 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
301 break;
302 case 0x10ec0267:
303 case 0x10ec0268:
304 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
305 break;
306 case 0x10ec0269:
307 if ((coef & 0x00f0) == 0x0010)
308 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
309 if ((coef & 0x00f0) == 0x0020)
310 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
311 if ((coef & 0x00f0) == 0x0030)
312 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
313 break;
314 case 0x10ec0280:
315 case 0x10ec0284:
316 case 0x10ec0290:
317 case 0x10ec0292:
318 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
319 break;
320 case 0x10ec0233:
321 case 0x10ec0255:
322 case 0x10ec0282:
323 case 0x10ec0283:
324 case 0x10ec0286:
325 case 0x10ec0288:
326 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
327 break;
328 case 0x10ec0285:
329 case 0x10ec0293:
330 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
331 break;
332 case 0x10ec0662:
333 if ((coef & 0x00f0) == 0x0030)
334 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
335 break;
336 case 0x10ec0272:
337 case 0x10ec0273:
338 case 0x10ec0663:
339 case 0x10ec0665:
340 case 0x10ec0670:
341 case 0x10ec0671:
342 case 0x10ec0672:
343 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
344 break;
345 case 0x10ec0668:
346 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
347 break;
348 case 0x10ec0867:
349 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
350 break;
351 case 0x10ec0888:
352 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
353 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
354 break;
355 case 0x10ec0892:
356 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
357 break;
358 case 0x10ec0899:
359 case 0x10ec0900:
360 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
361 break;
362 }
300} 363}
301 364
302/* additional initialization for ALC889 variants */ 365/* additional initialization for ALC888 variants */
303static void alc889_coef_init(struct hda_codec *codec) 366static void alc888_coef_init(struct hda_codec *codec)
304{ 367{
305 alc_update_coef_idx(codec, 7, 0, 0x2010); 368 switch (alc_get_coef0(codec) & 0x00f0) {
369 /* alc888-VA */
370 case 0x00:
371 /* alc888-VB */
372 case 0x10:
373 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
374 break;
375 }
306} 376}
307 377
308/* turn on/off EAPD control (only if available) */ 378/* turn on/off EAPD control (only if available) */
@@ -343,6 +413,7 @@ static void alc_eapd_shutup(struct hda_codec *codec)
343/* generic EAPD initialization */ 413/* generic EAPD initialization */
344static void alc_auto_init_amp(struct hda_codec *codec, int type) 414static void alc_auto_init_amp(struct hda_codec *codec, int type)
345{ 415{
416 alc_fill_eapd_coef(codec);
346 alc_auto_setup_eapd(codec, true); 417 alc_auto_setup_eapd(codec, true);
347 switch (type) { 418 switch (type) {
348 case ALC_INIT_GPIO1: 419 case ALC_INIT_GPIO1:
@@ -359,25 +430,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
359 case 0x10ec0260: 430 case 0x10ec0260:
360 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); 431 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
361 break; 432 break;
362 case 0x10ec0262:
363 case 0x10ec0880: 433 case 0x10ec0880:
364 case 0x10ec0882: 434 case 0x10ec0882:
365 case 0x10ec0883: 435 case 0x10ec0883:
366 case 0x10ec0885: 436 case 0x10ec0885:
367 case 0x10ec0887: 437 alc_update_coef_idx(codec, 7, 0, 0x2030);
368 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
369 case 0x10ec0900:
370 alc889_coef_init(codec);
371 break; 438 break;
372 case 0x10ec0888: 439 case 0x10ec0888:
373 alc888_coef_init(codec); 440 alc888_coef_init(codec);
374 break; 441 break;
375#if 0 /* XXX: This may cause the silent output on speaker on some machines */
376 case 0x10ec0267:
377 case 0x10ec0268:
378 alc_update_coef_idx(codec, 7, 0, 0x3000);
379 break;
380#endif /* XXX */
381 } 442 }
382 break; 443 break;
383 } 444 }
@@ -1710,7 +1771,7 @@ static void alc889_fixup_coef(struct hda_codec *codec,
1710{ 1771{
1711 if (action != HDA_FIXUP_ACT_INIT) 1772 if (action != HDA_FIXUP_ACT_INIT)
1712 return; 1773 return;
1713 alc889_coef_init(codec); 1774 alc_update_coef_idx(codec, 7, 0, 0x2030);
1714} 1775}
1715 1776
1716/* toggle speaker-output according to the hp-jack state */ 1777/* toggle speaker-output according to the hp-jack state */
@@ -3350,6 +3411,27 @@ static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3350 } 3411 }
3351} 3412}
3352 3413
3414static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3415 const struct hda_fixup *fix, int action)
3416{
3417 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3418 struct alc_spec *spec = codec->spec;
3419 static const struct hda_verb gpio_init[] = {
3420 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3421 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3422 {}
3423 };
3424
3425 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3426 spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook;
3427 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3428 spec->gpio_led = 0;
3429 spec->cap_mute_led_nid = 0x18;
3430 snd_hda_add_verbs(codec, gpio_init);
3431 codec->power_filter = led_power_filter;
3432 }
3433}
3434
3353static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, 3435static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3354 const struct hda_fixup *fix, int action) 3436 const struct hda_fixup *fix, int action)
3355{ 3437{
@@ -4217,6 +4299,7 @@ enum {
4217 ALC283_FIXUP_BXBT2807_MIC, 4299 ALC283_FIXUP_BXBT2807_MIC,
4218 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, 4300 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4219 ALC282_FIXUP_ASPIRE_V5_PINS, 4301 ALC282_FIXUP_ASPIRE_V5_PINS,
4302 ALC280_FIXUP_HP_GPIO4,
4220}; 4303};
4221 4304
4222static const struct hda_fixup alc269_fixups[] = { 4305static const struct hda_fixup alc269_fixups[] = {
@@ -4680,7 +4763,10 @@ static const struct hda_fixup alc269_fixups[] = {
4680 { }, 4763 { },
4681 }, 4764 },
4682 }, 4765 },
4683 4766 [ALC280_FIXUP_HP_GPIO4] = {
4767 .type = HDA_FIXUP_FUNC,
4768 .v.func = alc280_fixup_hp_gpio4,
4769 },
4684}; 4770};
4685 4771
4686static const struct snd_pci_quirk alc269_fixup_tbl[] = { 4772static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4728,21 +4814,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4728 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4814 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4729 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4815 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4730 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4816 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4731 SND_PCI_QUIRK(0x103c, 0x8004, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4732 /* ALC290 */ 4817 /* ALC290 */
4733 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4818 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4734 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4819 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4735 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4820 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4736 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4821 SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4737 SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4738 SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4739 SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4740 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4822 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4741 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4823 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4742 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4824 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4743 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4825 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4744 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4826 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4745 SND_PCI_QUIRK(0x103c, 0x2258, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4746 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4827 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4747 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4828 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4748 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4829 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
@@ -4751,7 +4832,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4751 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4832 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4752 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4833 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4753 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4834 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4754 SND_PCI_QUIRK(0x103c, 0x2277, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4755 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4835 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4756 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4836 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4757 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4837 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
@@ -4804,7 +4884,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4804 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), 4884 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4805 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), 4885 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
4806 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), 4886 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
4807 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4887 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
4808 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4888 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4809 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 4889 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
4810 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4890 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -4984,6 +5064,19 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4984 {0x17, 0x40000000}, 5064 {0x17, 0x40000000},
4985 {0x1d, 0x40700001}, 5065 {0x1d, 0x40700001},
4986 {0x21, 0x02211040}), 5066 {0x21, 0x02211040}),
5067 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
5068 {0x12, 0x90a60130},
5069 {0x13, 0x40000000},
5070 {0x14, 0x90170110},
5071 {0x15, 0x0421101f},
5072 {0x16, 0x411111f0},
5073 {0x17, 0x411111f0},
5074 {0x18, 0x411111f0},
5075 {0x19, 0x411111f0},
5076 {0x1a, 0x04a11020},
5077 {0x1b, 0x411111f0},
5078 {0x1d, 0x40748605},
5079 {0x1e, 0x411111f0}),
4987 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED, 5080 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
4988 {0x12, 0x90a60140}, 5081 {0x12, 0x90a60140},
4989 {0x13, 0x40000000}, 5082 {0x13, 0x40000000},
@@ -5194,9 +5287,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
5194 } 5287 }
5195 } 5288 }
5196 5289
5197 /* Class D */
5198 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
5199
5200 /* HP */ 5290 /* HP */
5201 alc_update_coef_idx(codec, 0x4, 0, 1<<11); 5291 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
5202} 5292}
@@ -5651,6 +5741,35 @@ static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5651 } 5741 }
5652} 5742}
5653 5743
5744static struct coef_fw alc668_coefs[] = {
5745 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
5746 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
5747 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
5748 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
5749 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
5750 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
5751 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
5752 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
5753 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
5754 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
5755 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
5756 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
5757 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
5758 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
5759 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
5760 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
5761 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
5762 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
5763 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
5764 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
5765 {}
5766};
5767
5768static void alc668_restore_default_value(struct hda_codec *codec)
5769{
5770 alc_process_coef_fw(codec, alc668_coefs);
5771}
5772
5654enum { 5773enum {
5655 ALC662_FIXUP_ASPIRE, 5774 ALC662_FIXUP_ASPIRE,
5656 ALC662_FIXUP_LED_GPIO1, 5775 ALC662_FIXUP_LED_GPIO1,
@@ -6077,29 +6196,6 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
6077 {} 6196 {}
6078}; 6197};
6079 6198
6080static void alc662_fill_coef(struct hda_codec *codec)
6081{
6082 int coef;
6083
6084 coef = alc_get_coef0(codec);
6085
6086 switch (codec->vendor_id) {
6087 case 0x10ec0662:
6088 if ((coef & 0x00f0) == 0x0030)
6089 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
6090 break;
6091 case 0x10ec0272:
6092 case 0x10ec0273:
6093 case 0x10ec0663:
6094 case 0x10ec0665:
6095 case 0x10ec0670:
6096 case 0x10ec0671:
6097 case 0x10ec0672:
6098 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
6099 break;
6100 }
6101}
6102
6103/* 6199/*
6104 */ 6200 */
6105static int patch_alc662(struct hda_codec *codec) 6201static int patch_alc662(struct hda_codec *codec)
@@ -6118,8 +6214,11 @@ static int patch_alc662(struct hda_codec *codec)
6118 6214
6119 alc_fix_pll_init(codec, 0x20, 0x04, 15); 6215 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6120 6216
6121 spec->init_hook = alc662_fill_coef; 6217 switch (codec->vendor_id) {
6122 alc662_fill_coef(codec); 6218 case 0x10ec0668:
6219 spec->init_hook = alc668_restore_default_value;
6220 break;
6221 }
6123 6222
6124 snd_hda_pick_fixup(codec, alc662_fixup_models, 6223 snd_hda_pick_fixup(codec, alc662_fixup_models,
6125 alc662_fixup_tbl, alc662_fixups); 6224 alc662_fixup_tbl, alc662_fixups);
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 7ecd0e8a5c51..f61ebb17cc64 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -591,18 +591,19 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
591{ 591{
592 struct snd_card *card; 592 struct snd_card *card;
593 struct list_head *p; 593 struct list_head *p;
594 bool was_shutdown;
594 595
595 if (chip == (void *)-1L) 596 if (chip == (void *)-1L)
596 return; 597 return;
597 598
598 card = chip->card; 599 card = chip->card;
599 down_write(&chip->shutdown_rwsem); 600 down_write(&chip->shutdown_rwsem);
601 was_shutdown = chip->shutdown;
600 chip->shutdown = 1; 602 chip->shutdown = 1;
601 up_write(&chip->shutdown_rwsem); 603 up_write(&chip->shutdown_rwsem);
602 604
603 mutex_lock(&register_mutex); 605 mutex_lock(&register_mutex);
604 chip->num_interfaces--; 606 if (!was_shutdown) {
605 if (chip->num_interfaces <= 0) {
606 struct snd_usb_endpoint *ep; 607 struct snd_usb_endpoint *ep;
607 608
608 snd_card_disconnect(card); 609 snd_card_disconnect(card);
@@ -622,6 +623,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
622 list_for_each(p, &chip->mixer_list) { 623 list_for_each(p, &chip->mixer_list) {
623 snd_usb_mixer_disconnect(p); 624 snd_usb_mixer_disconnect(p);
624 } 625 }
626 }
627
628 chip->num_interfaces--;
629 if (chip->num_interfaces <= 0) {
625 usb_chip[chip->index] = NULL; 630 usb_chip[chip->index] = NULL;
626 mutex_unlock(&register_mutex); 631 mutex_unlock(&register_mutex);
627 snd_card_free_when_closed(card); 632 snd_card_free_when_closed(card);
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index f119a41ed9a9..7c83bab69dee 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -885,6 +885,11 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
885 return changed; 885 return changed;
886} 886}
887 887
888static void kctl_private_value_free(struct snd_kcontrol *kctl)
889{
890 kfree((void *)kctl->private_value);
891}
892
888static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, 893static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer,
889 int validx, int bUnitID) 894 int validx, int bUnitID)
890{ 895{
@@ -919,6 +924,7 @@ static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer,
919 return -ENOMEM; 924 return -ENOMEM;
920 } 925 }
921 926
927 kctl->private_free = kctl_private_value_free;
922 err = snd_ctl_add(mixer->chip->card, kctl); 928 err = snd_ctl_add(mixer->chip->card, kctl);
923 if (err < 0) 929 if (err < 0)
924 return err; 930 return err;
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index a8f81c782856..515247601df4 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -82,7 +82,7 @@ parse_opts() { # opts
82} 82}
83 83
84# Parameters 84# Parameters
85DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' '` 85DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
86TRACING_DIR=$DEBUGFS_DIR/tracing 86TRACING_DIR=$DEBUGFS_DIR/tracing
87TOP_DIR=`absdir $0` 87TOP_DIR=`absdir $0`
88TEST_DIR=$TOP_DIR/test.d 88TEST_DIR=$TOP_DIR/test.d
diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
index 57b9c2b7c4ff..6f6733331d95 100644
--- a/tools/testing/selftests/net/psock_fanout.c
+++ b/tools/testing/selftests/net/psock_fanout.c
@@ -128,7 +128,7 @@ static int sock_fanout_read_ring(int fd, void *ring)
128 struct tpacket2_hdr *header = ring; 128 struct tpacket2_hdr *header = ring;
129 int count = 0; 129 int count = 0;
130 130
131 while (header->tp_status & TP_STATUS_USER && count < RING_NUM_FRAMES) { 131 while (count < RING_NUM_FRAMES && header->tp_status & TP_STATUS_USER) {
132 count++; 132 count++;
133 header = ring + (count * getpagesize()); 133 header = ring + (count * getpagesize());
134 } 134 }