summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/acglobal.h1
-rw-r--r--drivers/acpi/acpica/actables.h4
-rw-r--r--drivers/acpi/acpica/evxfevnt.c2
-rw-r--r--drivers/acpi/acpica/tbfadt.c10
-rw-r--r--drivers/acpi/acpica/tbutils.c26
-rw-r--r--drivers/base/power/domain_governor.c22
-rw-r--r--drivers/base/regmap/regmap-debugfs.c5
-rw-r--r--drivers/block/loop.c11
-rw-r--r--drivers/block/null_blk.c2
-rw-r--r--drivers/block/nvme-core.c52
-rw-r--r--drivers/block/rbd.c10
-rw-r--r--drivers/block/virtio_blk.c2
-rw-r--r--drivers/block/xen-blkback/xenbus.c38
-rw-r--r--drivers/block/xen-blkfront.c19
-rw-r--r--drivers/bus/Kconfig1
-rw-r--r--drivers/clk/mvebu/clk-cpu.c4
-rw-r--r--drivers/clk/samsung/clk-cpu.c10
-rw-r--r--drivers/clk/ti/clk-3xxx.c2
-rw-r--r--drivers/clk/ti/clk-7xx.c18
-rw-r--r--drivers/clk/ti/clkt_dflt.c4
-rw-r--r--drivers/clocksource/rockchip_timer.c2
-rw-r--r--drivers/clocksource/timer-keystone.c2
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c3
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/cpufreq/intel_pstate.c5
-rw-r--r--drivers/devfreq/devfreq.c7
-rw-r--r--drivers/dma/at_xdmac.c15
-rw-r--r--drivers/dma/dmaengine.c10
-rw-r--r--drivers/dma/dw/core.c4
-rw-r--r--drivers/dma/idma64.c16
-rw-r--r--drivers/dma/pxa_dma.c31
-rw-r--r--drivers/dma/sun4i-dma.c6
-rw-r--r--drivers/dma/xgene-dma.c46
-rw-r--r--drivers/dma/zx296702_dma.c2
-rw-r--r--drivers/firmware/efi/libstub/arm-stub.c88
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c39
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_display.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/atombios_encoders.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_dpm.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c30
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c32
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c30
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c3
-rw-r--r--drivers/gpu/drm/amd/include/cgs_linux.h17
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c88
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c6
-rw-r--r--drivers/gpu/drm/drm_probe_helper.c19
-rw-r--r--drivers/gpu/drm/drm_sysfs.c12
-rw-r--r--drivers/gpu/drm/exynos/exynos7_drm_decon.c12
-rw-r--r--drivers/gpu/drm/exynos/exynos_dp_core.c23
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_core.c6
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c15
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimc.c36
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c14
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_g2d.c3
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c94
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.h6
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_rotator.c2
-rw-r--r--drivers/gpu/drm/i915/intel_dp_mst.c9
-rw-r--r--drivers/gpu/drm/i915/intel_hotplug.c2
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c39
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.h2
-rw-r--r--drivers/gpu/drm/i915/intel_runtime_pm.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c24
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c27
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c17
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c8
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c12
-rw-r--r--drivers/gpu/drm/qxl/qxl_fb.c19
-rw-r--r--drivers/gpu/drm/qxl/qxl_release.c4
-rw-r--r--drivers/gpu/drm/radeon/atombios_encoders.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c14
-rw-r--r--drivers/gpu/drm/radeon/radeon_dp_mst.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c48
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c63
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c1
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_debugfs.c4
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_fence.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c8
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c3
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c33
-rw-r--r--drivers/i2c/busses/i2c-rcar.c7
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c8
-rw-r--r--drivers/i2c/i2c-core.c12
-rw-r--r--drivers/infiniband/core/cma.c54
-rw-r--r--drivers/infiniband/hw/usnic/usnic.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_abi.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_common_util.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_debugfs.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_debugfs.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_fwd.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_fwd.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_main.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_sysfs.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_sysfs.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_verbs.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_verbs.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_log.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_transport.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_transport.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom.c2
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_vnic.c21
-rw-r--r--drivers/infiniband/hw/usnic/usnic_vnic.h21
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c2
-rw-r--r--drivers/input/joystick/walkera0701.c4
-rw-r--r--drivers/input/keyboard/omap4-keypad.c2
-rw-r--r--drivers/input/misc/pm8941-pwrkey.c2
-rw-r--r--drivers/input/misc/uinput.c2
-rw-r--r--drivers/input/mouse/cyapa_gen6.c10
-rw-r--r--drivers/input/mouse/elan_i2c.h2
-rw-r--r--drivers/input/mouse/elan_i2c_core.c26
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c4
-rw-r--r--drivers/input/mouse/elan_i2c_smbus.c4
-rw-r--r--drivers/input/mouse/synaptics.c12
-rw-r--r--drivers/input/serio/libps2.c22
-rw-r--r--drivers/input/serio/parkbd.c1
-rw-r--r--drivers/input/touchscreen/ads7846.c8
-rw-r--r--drivers/input/touchscreen/imx6ul_tsc.c34
-rw-r--r--drivers/input/touchscreen/mms114.c4
-rw-r--r--drivers/iommu/Kconfig3
-rw-r--r--drivers/iommu/amd_iommu.c9
-rw-r--r--drivers/iommu/amd_iommu_init.c3
-rw-r--r--drivers/iommu/arm-smmu-v3.c21
-rw-r--r--drivers/iommu/intel-iommu.c1
-rw-r--r--drivers/iommu/io-pgtable-arm.c24
-rw-r--r--drivers/irqchip/irq-gic-v3-its-pci-msi.c2
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c3
-rw-r--r--drivers/mcb/mcb-pci.c6
-rw-r--r--drivers/md/bitmap.c3
-rw-r--r--drivers/md/dm-cache-policy-cleaner.c2
-rw-r--r--drivers/md/dm-exception-store.c6
-rw-r--r--drivers/md/dm-exception-store.h5
-rw-r--r--drivers/md/dm-raid.c3
-rw-r--r--drivers/md/dm-snap-persistent.c30
-rw-r--r--drivers/md/dm-snap-transient.c3
-rw-r--r--drivers/md/dm-snap.c14
-rw-r--r--drivers/md/dm-thin.c2
-rw-r--r--drivers/md/dm.c11
-rw-r--r--drivers/md/md.c5
-rw-r--r--drivers/md/multipath.c3
-rw-r--r--drivers/md/raid0.c12
-rw-r--r--drivers/md/raid1.c15
-rw-r--r--drivers/md/raid10.c13
-rw-r--r--drivers/md/raid5.c11
-rw-r--r--drivers/mfd/intel-lpss.h2
-rw-r--r--drivers/mfd/max77843.c2
-rw-r--r--drivers/misc/cxl/api.c1
-rw-r--r--drivers/misc/cxl/context.c3
-rw-r--r--drivers/misc/cxl/cxl.h1
-rw-r--r--drivers/misc/cxl/file.c13
-rw-r--r--drivers/misc/cxl/irq.c4
-rw-r--r--drivers/misc/cxl/native.c2
-rw-r--r--drivers/misc/cxl/pci.c28
-rw-r--r--drivers/misc/mei/hbm.c2
-rw-r--r--drivers/mmc/host/omap_hsmmc.c14
-rw-r--r--drivers/mmc/host/sdhci-of-at91.c1
-rw-r--r--drivers/mmc/host/sdhci-pxav3.c6
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/sdhci.h5
-rw-r--r--drivers/mtd/nand/mxc_nand.c2
-rw-r--r--drivers/mtd/nand/sunxi_nand.c27
-rw-r--r--drivers/net/can/sja1000/peak_pci.c1
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c7
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c32
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c31
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h10
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c28
-rw-r--r--drivers/net/ethernet/freescale/fsl_pq_mdio.c34
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq.c4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_adminq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/port.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/item.h4
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/pci.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/switchx2.c2
-rw-r--r--drivers/net/ethernet/nxp/lpc_eth.c13
-rw-r--r--drivers/net/ethernet/via/via-rhine.c3
-rw-r--r--drivers/net/geneve.c12
-rw-r--r--drivers/net/phy/Kconfig2
-rw-r--r--drivers/net/ppp/pppoe.c1
-rw-r--r--drivers/net/usb/Kconfig1
-rw-r--r--drivers/net/usb/asix_devices.c4
-rw-r--r--drivers/net/vxlan.c7
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c1
-rw-r--r--drivers/net/wireless/b43/main.c1
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-7000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/d3.c27
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h5
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c1
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rtlwifi/pci.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8821ae/hw.c17
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8821ae/sw.c5
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h3
-rw-r--r--drivers/net/xen-netback/xenbus.c6
-rw-r--r--drivers/nvmem/core.c8
-rw-r--r--drivers/nvmem/sunxi_sid.c11
-rw-r--r--drivers/pci/msi.c4
-rw-r--r--drivers/phy/phy-berlin-sata.c1
-rw-r--r--drivers/phy/phy-qcom-ufs.c11
-rw-r--r--drivers/phy/phy-rockchip-usb.c6
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx25.c4
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c2
-rw-r--r--drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c226
-rw-r--r--drivers/regulator/axp20x-regulator.c4
-rw-r--r--drivers/regulator/core.c4
-rw-r--r--drivers/scsi/3w-9xxx.c28
-rw-r--r--drivers/scsi/libiscsi.c17
-rw-r--r--drivers/scsi/scsi_dh.c2
-rw-r--r--drivers/scsi/scsi_lib.c2
-rw-r--r--drivers/spi/spi-davinci.c7
-rw-r--r--drivers/staging/lustre/lustre/llite/dir.c2
-rw-r--r--drivers/staging/speakup/fakekey.c1
-rw-r--r--drivers/tty/n_tty.c15
-rw-r--r--drivers/tty/serial/8250/8250_port.c8
-rw-r--r--drivers/tty/serial/atmel_serial.c2
-rw-r--r--drivers/tty/serial/imx.c20
-rw-r--r--drivers/tty/tty_buffer.c22
-rw-r--r--drivers/tty/tty_io.c40
-rw-r--r--drivers/usb/core/quirks.c13
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_ep.c4
-rw-r--r--drivers/usb/misc/chaoskey.c2
-rw-r--r--drivers/usb/renesas_usbhs/common.c7
-rw-r--r--drivers/video/fbdev/broadsheetfb.c8
-rw-r--r--drivers/video/fbdev/fsl-diu-fb.c9
-rw-r--r--drivers/video/fbdev/mb862xx/mb862xxfbdrv.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-dvi.c2
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c1
-rw-r--r--drivers/video/fbdev/tridentfb.c12
-rw-r--r--drivers/video/of_display_timing.c1
269 files changed, 2191 insertions, 1183 deletions
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 09f37b516808..4dde37c3d8fc 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -61,6 +61,7 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
61ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX); 61ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX);
62ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX); 62ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX);
63ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX); 63ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX);
64ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX);
64 65
65#if (!ACPI_REDUCED_HARDWARE) 66#if (!ACPI_REDUCED_HARDWARE)
66ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS); 67ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index f7731f260c31..591ea95319e2 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -85,7 +85,7 @@ void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
85/* 85/*
86 * tbfadt - FADT parse/convert/validate 86 * tbfadt - FADT parse/convert/validate
87 */ 87 */
88void acpi_tb_parse_fadt(u32 table_index); 88void acpi_tb_parse_fadt(void);
89 89
90void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length); 90void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
91 91
@@ -138,8 +138,6 @@ acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id);
138 */ 138 */
139acpi_status acpi_tb_initialize_facs(void); 139acpi_status acpi_tb_initialize_facs(void);
140 140
141u8 acpi_tb_tables_loaded(void);
142
143void 141void
144acpi_tb_print_table_header(acpi_physical_address address, 142acpi_tb_print_table_header(acpi_physical_address address,
145 struct acpi_table_header *header); 143 struct acpi_table_header *header);
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index faad911d46b5..10ce48e16ebf 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -71,7 +71,7 @@ acpi_status acpi_enable(void)
71 71
72 /* ACPI tables must be present */ 72 /* ACPI tables must be present */
73 73
74 if (!acpi_tb_tables_loaded()) { 74 if (acpi_gbl_fadt_index == ACPI_INVALID_TABLE_INDEX) {
75 return_ACPI_STATUS(AE_NO_ACPI_TABLES); 75 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
76 } 76 }
77 77
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 455a0700db39..a6454f4a6fb3 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -298,7 +298,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64)
298 * 298 *
299 * FUNCTION: acpi_tb_parse_fadt 299 * FUNCTION: acpi_tb_parse_fadt
300 * 300 *
301 * PARAMETERS: table_index - Index for the FADT 301 * PARAMETERS: None
302 * 302 *
303 * RETURN: None 303 * RETURN: None
304 * 304 *
@@ -307,7 +307,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64)
307 * 307 *
308 ******************************************************************************/ 308 ******************************************************************************/
309 309
310void acpi_tb_parse_fadt(u32 table_index) 310void acpi_tb_parse_fadt(void)
311{ 311{
312 u32 length; 312 u32 length;
313 struct acpi_table_header *table; 313 struct acpi_table_header *table;
@@ -319,11 +319,11 @@ void acpi_tb_parse_fadt(u32 table_index)
319 * Get a local copy of the FADT and convert it to a common format 319 * Get a local copy of the FADT and convert it to a common format
320 * Map entire FADT, assumed to be smaller than one page. 320 * Map entire FADT, assumed to be smaller than one page.
321 */ 321 */
322 length = acpi_gbl_root_table_list.tables[table_index].length; 322 length = acpi_gbl_root_table_list.tables[acpi_gbl_fadt_index].length;
323 323
324 table = 324 table =
325 acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. 325 acpi_os_map_memory(acpi_gbl_root_table_list.
326 address, length); 326 tables[acpi_gbl_fadt_index].address, length);
327 if (!table) { 327 if (!table) {
328 return; 328 return;
329 } 329 }
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 4337990127cc..d8ddef38c947 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -99,29 +99,6 @@ acpi_status acpi_tb_initialize_facs(void)
99 99
100/******************************************************************************* 100/*******************************************************************************
101 * 101 *
102 * FUNCTION: acpi_tb_tables_loaded
103 *
104 * PARAMETERS: None
105 *
106 * RETURN: TRUE if required ACPI tables are loaded
107 *
108 * DESCRIPTION: Determine if the minimum required ACPI tables are present
109 * (FADT, FACS, DSDT)
110 *
111 ******************************************************************************/
112
113u8 acpi_tb_tables_loaded(void)
114{
115
116 if (acpi_gbl_root_table_list.current_table_count >= 4) {
117 return (TRUE);
118 }
119
120 return (FALSE);
121}
122
123/*******************************************************************************
124 *
125 * FUNCTION: acpi_tb_check_dsdt_header 102 * FUNCTION: acpi_tb_check_dsdt_header
126 * 103 *
127 * PARAMETERS: None 104 * PARAMETERS: None
@@ -392,7 +369,8 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
392 ACPI_COMPARE_NAME(&acpi_gbl_root_table_list. 369 ACPI_COMPARE_NAME(&acpi_gbl_root_table_list.
393 tables[table_index].signature, 370 tables[table_index].signature,
394 ACPI_SIG_FADT)) { 371 ACPI_SIG_FADT)) {
395 acpi_tb_parse_fadt(table_index); 372 acpi_gbl_fadt_index = table_index;
373 acpi_tb_parse_fadt();
396 } 374 }
397 375
398next_table: 376next_table:
diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c
index 2a4154a09e4d..85e17bacc834 100644
--- a/drivers/base/power/domain_governor.c
+++ b/drivers/base/power/domain_governor.c
@@ -77,13 +77,16 @@ static bool default_stop_ok(struct device *dev)
77 dev_update_qos_constraint); 77 dev_update_qos_constraint);
78 78
79 if (constraint_ns > 0) { 79 if (constraint_ns > 0) {
80 constraint_ns -= td->start_latency_ns; 80 constraint_ns -= td->save_state_latency_ns +
81 td->stop_latency_ns +
82 td->start_latency_ns +
83 td->restore_state_latency_ns;
81 if (constraint_ns == 0) 84 if (constraint_ns == 0)
82 return false; 85 return false;
83 } 86 }
84 td->effective_constraint_ns = constraint_ns; 87 td->effective_constraint_ns = constraint_ns;
85 td->cached_stop_ok = constraint_ns > td->stop_latency_ns || 88 td->cached_stop_ok = constraint_ns >= 0;
86 constraint_ns == 0; 89
87 /* 90 /*
88 * The children have been suspended already, so we don't need to take 91 * The children have been suspended already, so we don't need to take
89 * their stop latencies into account here. 92 * their stop latencies into account here.
@@ -126,18 +129,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd)
126 129
127 off_on_time_ns = genpd->power_off_latency_ns + 130 off_on_time_ns = genpd->power_off_latency_ns +
128 genpd->power_on_latency_ns; 131 genpd->power_on_latency_ns;
129 /*
130 * It doesn't make sense to remove power from the domain if saving
131 * the state of all devices in it and the power off/power on operations
132 * take too much time.
133 *
134 * All devices in this domain have been stopped already at this point.
135 */
136 list_for_each_entry(pdd, &genpd->dev_list, list_node) {
137 if (pdd->dev->driver)
138 off_on_time_ns +=
139 to_gpd_data(pdd)->td.save_state_latency_ns;
140 }
141 132
142 min_off_time_ns = -1; 133 min_off_time_ns = -1;
143 /* 134 /*
@@ -193,7 +184,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd)
193 * constraint_ns cannot be negative here, because the device has 184 * constraint_ns cannot be negative here, because the device has
194 * been suspended. 185 * been suspended.
195 */ 186 */
196 constraint_ns -= td->restore_state_latency_ns;
197 if (constraint_ns <= off_on_time_ns) 187 if (constraint_ns <= off_on_time_ns)
198 return false; 188 return false;
199 189
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index f42f2bac6466..4c55cfbad19e 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -32,8 +32,7 @@ static DEFINE_MUTEX(regmap_debugfs_early_lock);
32/* Calculate the length of a fixed format */ 32/* Calculate the length of a fixed format */
33static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) 33static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size)
34{ 34{
35 snprintf(buf, buf_size, "%x", max_val); 35 return snprintf(NULL, 0, "%x", max_val);
36 return strlen(buf);
37} 36}
38 37
39static ssize_t regmap_name_read_file(struct file *file, 38static ssize_t regmap_name_read_file(struct file *file,
@@ -432,7 +431,7 @@ static ssize_t regmap_access_read_file(struct file *file,
432 /* If we're in the region the user is trying to read */ 431 /* If we're in the region the user is trying to read */
433 if (p >= *ppos) { 432 if (p >= *ppos) {
434 /* ...but not beyond it */ 433 /* ...but not beyond it */
435 if (buf_pos >= count - 1 - tot_len) 434 if (buf_pos + tot_len + 1 >= count)
436 break; 435 break;
437 436
438 /* Format the register */ 437 /* Format the register */
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index f9889b6bc02c..674f800a3b57 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1486,17 +1486,16 @@ static void loop_handle_cmd(struct loop_cmd *cmd)
1486{ 1486{
1487 const bool write = cmd->rq->cmd_flags & REQ_WRITE; 1487 const bool write = cmd->rq->cmd_flags & REQ_WRITE;
1488 struct loop_device *lo = cmd->rq->q->queuedata; 1488 struct loop_device *lo = cmd->rq->q->queuedata;
1489 int ret = -EIO; 1489 int ret = 0;
1490 1490
1491 if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) 1491 if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) {
1492 ret = -EIO;
1492 goto failed; 1493 goto failed;
1494 }
1493 1495
1494 ret = do_req_filebacked(lo, cmd->rq); 1496 ret = do_req_filebacked(lo, cmd->rq);
1495
1496 failed: 1497 failed:
1497 if (ret) 1498 blk_mq_complete_request(cmd->rq, ret ? -EIO : 0);
1498 cmd->rq->errors = -EIO;
1499 blk_mq_complete_request(cmd->rq);
1500} 1499}
1501 1500
1502static void loop_queue_write_work(struct work_struct *work) 1501static void loop_queue_write_work(struct work_struct *work)
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index a295b98c6bae..1c9e4fe5aa44 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -289,7 +289,7 @@ static inline void null_handle_cmd(struct nullb_cmd *cmd)
289 case NULL_IRQ_SOFTIRQ: 289 case NULL_IRQ_SOFTIRQ:
290 switch (queue_mode) { 290 switch (queue_mode) {
291 case NULL_Q_MQ: 291 case NULL_Q_MQ:
292 blk_mq_complete_request(cmd->rq); 292 blk_mq_complete_request(cmd->rq, cmd->rq->errors);
293 break; 293 break;
294 case NULL_Q_RQ: 294 case NULL_Q_RQ:
295 blk_complete_request(cmd->rq); 295 blk_complete_request(cmd->rq);
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index b97fc3fe0916..6f04771f1019 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -618,16 +618,15 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
618 spin_unlock_irqrestore(req->q->queue_lock, flags); 618 spin_unlock_irqrestore(req->q->queue_lock, flags);
619 return; 619 return;
620 } 620 }
621
621 if (req->cmd_type == REQ_TYPE_DRV_PRIV) { 622 if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
622 if (cmd_rq->ctx == CMD_CTX_CANCELLED) 623 if (cmd_rq->ctx == CMD_CTX_CANCELLED)
623 req->errors = -EINTR; 624 status = -EINTR;
624 else
625 req->errors = status;
626 } else { 625 } else {
627 req->errors = nvme_error_status(status); 626 status = nvme_error_status(status);
628 } 627 }
629 } else 628 }
630 req->errors = 0; 629
631 if (req->cmd_type == REQ_TYPE_DRV_PRIV) { 630 if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
632 u32 result = le32_to_cpup(&cqe->result); 631 u32 result = le32_to_cpup(&cqe->result);
633 req->special = (void *)(uintptr_t)result; 632 req->special = (void *)(uintptr_t)result;
@@ -650,7 +649,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
650 } 649 }
651 nvme_free_iod(nvmeq->dev, iod); 650 nvme_free_iod(nvmeq->dev, iod);
652 651
653 blk_mq_complete_request(req); 652 blk_mq_complete_request(req, status);
654} 653}
655 654
656/* length is in bytes. gfp flags indicates whether we may sleep. */ 655/* length is in bytes. gfp flags indicates whether we may sleep. */
@@ -863,8 +862,7 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
863 if (ns && ns->ms && !blk_integrity_rq(req)) { 862 if (ns && ns->ms && !blk_integrity_rq(req)) {
864 if (!(ns->pi_type && ns->ms == 8) && 863 if (!(ns->pi_type && ns->ms == 8) &&
865 req->cmd_type != REQ_TYPE_DRV_PRIV) { 864 req->cmd_type != REQ_TYPE_DRV_PRIV) {
866 req->errors = -EFAULT; 865 blk_mq_complete_request(req, -EFAULT);
867 blk_mq_complete_request(req);
868 return BLK_MQ_RQ_QUEUE_OK; 866 return BLK_MQ_RQ_QUEUE_OK;
869 } 867 }
870 } 868 }
@@ -2439,6 +2437,22 @@ static void nvme_scan_namespaces(struct nvme_dev *dev, unsigned nn)
2439 list_sort(NULL, &dev->namespaces, ns_cmp); 2437 list_sort(NULL, &dev->namespaces, ns_cmp);
2440} 2438}
2441 2439
2440static void nvme_set_irq_hints(struct nvme_dev *dev)
2441{
2442 struct nvme_queue *nvmeq;
2443 int i;
2444
2445 for (i = 0; i < dev->online_queues; i++) {
2446 nvmeq = dev->queues[i];
2447
2448 if (!nvmeq->tags || !(*nvmeq->tags))
2449 continue;
2450
2451 irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector,
2452 blk_mq_tags_cpumask(*nvmeq->tags));
2453 }
2454}
2455
2442static void nvme_dev_scan(struct work_struct *work) 2456static void nvme_dev_scan(struct work_struct *work)
2443{ 2457{
2444 struct nvme_dev *dev = container_of(work, struct nvme_dev, scan_work); 2458 struct nvme_dev *dev = container_of(work, struct nvme_dev, scan_work);
@@ -2450,6 +2464,7 @@ static void nvme_dev_scan(struct work_struct *work)
2450 return; 2464 return;
2451 nvme_scan_namespaces(dev, le32_to_cpup(&ctrl->nn)); 2465 nvme_scan_namespaces(dev, le32_to_cpup(&ctrl->nn));
2452 kfree(ctrl); 2466 kfree(ctrl);
2467 nvme_set_irq_hints(dev);
2453} 2468}
2454 2469
2455/* 2470/*
@@ -2953,22 +2968,6 @@ static const struct file_operations nvme_dev_fops = {
2953 .compat_ioctl = nvme_dev_ioctl, 2968 .compat_ioctl = nvme_dev_ioctl,
2954}; 2969};
2955 2970
2956static void nvme_set_irq_hints(struct nvme_dev *dev)
2957{
2958 struct nvme_queue *nvmeq;
2959 int i;
2960
2961 for (i = 0; i < dev->online_queues; i++) {
2962 nvmeq = dev->queues[i];
2963
2964 if (!nvmeq->tags || !(*nvmeq->tags))
2965 continue;
2966
2967 irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector,
2968 blk_mq_tags_cpumask(*nvmeq->tags));
2969 }
2970}
2971
2972static int nvme_dev_start(struct nvme_dev *dev) 2971static int nvme_dev_start(struct nvme_dev *dev)
2973{ 2972{
2974 int result; 2973 int result;
@@ -3010,8 +3009,6 @@ static int nvme_dev_start(struct nvme_dev *dev)
3010 if (result) 3009 if (result)
3011 goto free_tags; 3010 goto free_tags;
3012 3011
3013 nvme_set_irq_hints(dev);
3014
3015 dev->event_limit = 1; 3012 dev->event_limit = 1;
3016 return result; 3013 return result;
3017 3014
@@ -3062,7 +3059,6 @@ static int nvme_dev_resume(struct nvme_dev *dev)
3062 } else { 3059 } else {
3063 nvme_unfreeze_queues(dev); 3060 nvme_unfreeze_queues(dev);
3064 nvme_dev_add(dev); 3061 nvme_dev_add(dev);
3065 nvme_set_irq_hints(dev);
3066 } 3062 }
3067 return 0; 3063 return 0;
3068} 3064}
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d93a0372b37b..f5e49b639818 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1863,9 +1863,11 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,
1863 rbd_osd_read_callback(obj_request); 1863 rbd_osd_read_callback(obj_request);
1864 break; 1864 break;
1865 case CEPH_OSD_OP_SETALLOCHINT: 1865 case CEPH_OSD_OP_SETALLOCHINT:
1866 rbd_assert(osd_req->r_ops[1].op == CEPH_OSD_OP_WRITE); 1866 rbd_assert(osd_req->r_ops[1].op == CEPH_OSD_OP_WRITE ||
1867 osd_req->r_ops[1].op == CEPH_OSD_OP_WRITEFULL);
1867 /* fall through */ 1868 /* fall through */
1868 case CEPH_OSD_OP_WRITE: 1869 case CEPH_OSD_OP_WRITE:
1870 case CEPH_OSD_OP_WRITEFULL:
1869 rbd_osd_write_callback(obj_request); 1871 rbd_osd_write_callback(obj_request);
1870 break; 1872 break;
1871 case CEPH_OSD_OP_STAT: 1873 case CEPH_OSD_OP_STAT:
@@ -2401,7 +2403,10 @@ static void rbd_img_obj_request_fill(struct rbd_obj_request *obj_request,
2401 opcode = CEPH_OSD_OP_ZERO; 2403 opcode = CEPH_OSD_OP_ZERO;
2402 } 2404 }
2403 } else if (op_type == OBJ_OP_WRITE) { 2405 } else if (op_type == OBJ_OP_WRITE) {
2404 opcode = CEPH_OSD_OP_WRITE; 2406 if (!offset && length == object_size)
2407 opcode = CEPH_OSD_OP_WRITEFULL;
2408 else
2409 opcode = CEPH_OSD_OP_WRITE;
2405 osd_req_op_alloc_hint_init(osd_request, num_ops, 2410 osd_req_op_alloc_hint_init(osd_request, num_ops,
2406 object_size, object_size); 2411 object_size, object_size);
2407 num_ops++; 2412 num_ops++;
@@ -3760,6 +3765,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
3760 /* set io sizes to object size */ 3765 /* set io sizes to object size */
3761 segment_size = rbd_obj_bytes(&rbd_dev->header); 3766 segment_size = rbd_obj_bytes(&rbd_dev->header);
3762 blk_queue_max_hw_sectors(q, segment_size / SECTOR_SIZE); 3767 blk_queue_max_hw_sectors(q, segment_size / SECTOR_SIZE);
3768 q->limits.max_sectors = queue_max_hw_sectors(q);
3763 blk_queue_max_segments(q, segment_size / SECTOR_SIZE); 3769 blk_queue_max_segments(q, segment_size / SECTOR_SIZE);
3764 blk_queue_max_segment_size(q, segment_size); 3770 blk_queue_max_segment_size(q, segment_size);
3765 blk_queue_io_min(q, segment_size); 3771 blk_queue_io_min(q, segment_size);
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index e93899cc6f60..6ca35495a5be 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -144,7 +144,7 @@ static void virtblk_done(struct virtqueue *vq)
144 do { 144 do {
145 virtqueue_disable_cb(vq); 145 virtqueue_disable_cb(vq);
146 while ((vbr = virtqueue_get_buf(vblk->vqs[qid].vq, &len)) != NULL) { 146 while ((vbr = virtqueue_get_buf(vblk->vqs[qid].vq, &len)) != NULL) {
147 blk_mq_complete_request(vbr->req); 147 blk_mq_complete_request(vbr->req, vbr->req->errors);
148 req_done = true; 148 req_done = true;
149 } 149 }
150 if (unlikely(virtqueue_is_broken(vq))) 150 if (unlikely(virtqueue_is_broken(vq)))
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index deb3f001791f..767657565de6 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -212,6 +212,9 @@ static int xen_blkif_map(struct xen_blkif *blkif, grant_ref_t *gref,
212 212
213static int xen_blkif_disconnect(struct xen_blkif *blkif) 213static int xen_blkif_disconnect(struct xen_blkif *blkif)
214{ 214{
215 struct pending_req *req, *n;
216 int i = 0, j;
217
215 if (blkif->xenblkd) { 218 if (blkif->xenblkd) {
216 kthread_stop(blkif->xenblkd); 219 kthread_stop(blkif->xenblkd);
217 wake_up(&blkif->shutdown_wq); 220 wake_up(&blkif->shutdown_wq);
@@ -238,13 +241,28 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
238 /* Remove all persistent grants and the cache of ballooned pages. */ 241 /* Remove all persistent grants and the cache of ballooned pages. */
239 xen_blkbk_free_caches(blkif); 242 xen_blkbk_free_caches(blkif);
240 243
244 /* Check that there is no request in use */
245 list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) {
246 list_del(&req->free_list);
247
248 for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++)
249 kfree(req->segments[j]);
250
251 for (j = 0; j < MAX_INDIRECT_PAGES; j++)
252 kfree(req->indirect_pages[j]);
253
254 kfree(req);
255 i++;
256 }
257
258 WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
259 blkif->nr_ring_pages = 0;
260
241 return 0; 261 return 0;
242} 262}
243 263
244static void xen_blkif_free(struct xen_blkif *blkif) 264static void xen_blkif_free(struct xen_blkif *blkif)
245{ 265{
246 struct pending_req *req, *n;
247 int i = 0, j;
248 266
249 xen_blkif_disconnect(blkif); 267 xen_blkif_disconnect(blkif);
250 xen_vbd_free(&blkif->vbd); 268 xen_vbd_free(&blkif->vbd);
@@ -257,22 +275,6 @@ static void xen_blkif_free(struct xen_blkif *blkif)
257 BUG_ON(!list_empty(&blkif->free_pages)); 275 BUG_ON(!list_empty(&blkif->free_pages));
258 BUG_ON(!RB_EMPTY_ROOT(&blkif->persistent_gnts)); 276 BUG_ON(!RB_EMPTY_ROOT(&blkif->persistent_gnts));
259 277
260 /* Check that there is no request in use */
261 list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) {
262 list_del(&req->free_list);
263
264 for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++)
265 kfree(req->segments[j]);
266
267 for (j = 0; j < MAX_INDIRECT_PAGES; j++)
268 kfree(req->indirect_pages[j]);
269
270 kfree(req);
271 i++;
272 }
273
274 WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
275
276 kmem_cache_free(xen_blkif_cachep, blkif); 278 kmem_cache_free(xen_blkif_cachep, blkif);
277} 279}
278 280
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 0823a96902f8..611170896b8c 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1142,6 +1142,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
1142 RING_IDX i, rp; 1142 RING_IDX i, rp;
1143 unsigned long flags; 1143 unsigned long flags;
1144 struct blkfront_info *info = (struct blkfront_info *)dev_id; 1144 struct blkfront_info *info = (struct blkfront_info *)dev_id;
1145 int error;
1145 1146
1146 spin_lock_irqsave(&info->io_lock, flags); 1147 spin_lock_irqsave(&info->io_lock, flags);
1147 1148
@@ -1182,37 +1183,37 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
1182 continue; 1183 continue;
1183 } 1184 }
1184 1185
1185 req->errors = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; 1186 error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO;
1186 switch (bret->operation) { 1187 switch (bret->operation) {
1187 case BLKIF_OP_DISCARD: 1188 case BLKIF_OP_DISCARD:
1188 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { 1189 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
1189 struct request_queue *rq = info->rq; 1190 struct request_queue *rq = info->rq;
1190 printk(KERN_WARNING "blkfront: %s: %s op failed\n", 1191 printk(KERN_WARNING "blkfront: %s: %s op failed\n",
1191 info->gd->disk_name, op_name(bret->operation)); 1192 info->gd->disk_name, op_name(bret->operation));
1192 req->errors = -EOPNOTSUPP; 1193 error = -EOPNOTSUPP;
1193 info->feature_discard = 0; 1194 info->feature_discard = 0;
1194 info->feature_secdiscard = 0; 1195 info->feature_secdiscard = 0;
1195 queue_flag_clear(QUEUE_FLAG_DISCARD, rq); 1196 queue_flag_clear(QUEUE_FLAG_DISCARD, rq);
1196 queue_flag_clear(QUEUE_FLAG_SECDISCARD, rq); 1197 queue_flag_clear(QUEUE_FLAG_SECDISCARD, rq);
1197 } 1198 }
1198 blk_mq_complete_request(req); 1199 blk_mq_complete_request(req, error);
1199 break; 1200 break;
1200 case BLKIF_OP_FLUSH_DISKCACHE: 1201 case BLKIF_OP_FLUSH_DISKCACHE:
1201 case BLKIF_OP_WRITE_BARRIER: 1202 case BLKIF_OP_WRITE_BARRIER:
1202 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { 1203 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
1203 printk(KERN_WARNING "blkfront: %s: %s op failed\n", 1204 printk(KERN_WARNING "blkfront: %s: %s op failed\n",
1204 info->gd->disk_name, op_name(bret->operation)); 1205 info->gd->disk_name, op_name(bret->operation));
1205 req->errors = -EOPNOTSUPP; 1206 error = -EOPNOTSUPP;
1206 } 1207 }
1207 if (unlikely(bret->status == BLKIF_RSP_ERROR && 1208 if (unlikely(bret->status == BLKIF_RSP_ERROR &&
1208 info->shadow[id].req.u.rw.nr_segments == 0)) { 1209 info->shadow[id].req.u.rw.nr_segments == 0)) {
1209 printk(KERN_WARNING "blkfront: %s: empty %s op failed\n", 1210 printk(KERN_WARNING "blkfront: %s: empty %s op failed\n",
1210 info->gd->disk_name, op_name(bret->operation)); 1211 info->gd->disk_name, op_name(bret->operation));
1211 req->errors = -EOPNOTSUPP; 1212 error = -EOPNOTSUPP;
1212 } 1213 }
1213 if (unlikely(req->errors)) { 1214 if (unlikely(error)) {
1214 if (req->errors == -EOPNOTSUPP) 1215 if (error == -EOPNOTSUPP)
1215 req->errors = 0; 1216 error = 0;
1216 info->feature_flush = 0; 1217 info->feature_flush = 0;
1217 xlvbd_flush(info); 1218 xlvbd_flush(info);
1218 } 1219 }
@@ -1223,7 +1224,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
1223 dev_dbg(&info->xbdev->dev, "Bad return from blkdev data " 1224 dev_dbg(&info->xbdev->dev, "Bad return from blkdev data "
1224 "request: %x\n", bret->status); 1225 "request: %x\n", bret->status);
1225 1226
1226 blk_mq_complete_request(req); 1227 blk_mq_complete_request(req, error);
1227 break; 1228 break;
1228 default: 1229 default:
1229 BUG(); 1230 BUG();
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 1a82f3a17681..0ebca8ba7bc4 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -36,7 +36,6 @@ config ARM_CCI400_PORT_CTRL
36 36
37config ARM_CCI500_PMU 37config ARM_CCI500_PMU
38 bool "ARM CCI500 PMU support" 38 bool "ARM CCI500 PMU support"
39 default y
40 depends on (ARM && CPU_V7) || ARM64 39 depends on (ARM && CPU_V7) || ARM64
41 depends on PERF_EVENTS 40 depends on PERF_EVENTS
42 select ARM_CCI_PMU 41 select ARM_CCI_PMU
diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
index 5837eb8a212f..85da8b983256 100644
--- a/drivers/clk/mvebu/clk-cpu.c
+++ b/drivers/clk/mvebu/clk-cpu.c
@@ -197,6 +197,7 @@ static void __init of_cpu_clk_setup(struct device_node *node)
197 for_each_node_by_type(dn, "cpu") { 197 for_each_node_by_type(dn, "cpu") {
198 struct clk_init_data init; 198 struct clk_init_data init;
199 struct clk *clk; 199 struct clk *clk;
200 struct clk *parent_clk;
200 char *clk_name = kzalloc(5, GFP_KERNEL); 201 char *clk_name = kzalloc(5, GFP_KERNEL);
201 int cpu, err; 202 int cpu, err;
202 203
@@ -208,8 +209,9 @@ static void __init of_cpu_clk_setup(struct device_node *node)
208 goto bail_out; 209 goto bail_out;
209 210
210 sprintf(clk_name, "cpu%d", cpu); 211 sprintf(clk_name, "cpu%d", cpu);
212 parent_clk = of_clk_get(node, 0);
211 213
212 cpuclk[cpu].parent_name = of_clk_get_parent_name(node, 0); 214 cpuclk[cpu].parent_name = __clk_get_name(parent_clk);
213 cpuclk[cpu].clk_name = clk_name; 215 cpuclk[cpu].clk_name = clk_name;
214 cpuclk[cpu].cpu = cpu; 216 cpuclk[cpu].cpu = cpu;
215 cpuclk[cpu].reg_base = clock_complex_base; 217 cpuclk[cpu].reg_base = clock_complex_base;
diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
index 7c1e1f58e2da..2fe37f708dc7 100644
--- a/drivers/clk/samsung/clk-cpu.c
+++ b/drivers/clk/samsung/clk-cpu.c
@@ -164,7 +164,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
164 * the values for DIV_COPY and DIV_HPM dividers need not be set. 164 * the values for DIV_COPY and DIV_HPM dividers need not be set.
165 */ 165 */
166 div0 = cfg_data->div0; 166 div0 = cfg_data->div0;
167 if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { 167 if (cpuclk->flags & CLK_CPU_HAS_DIV1) {
168 div1 = cfg_data->div1; 168 div1 = cfg_data->div1;
169 if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK) 169 if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK)
170 div1 = readl(base + E4210_DIV_CPU1) & 170 div1 = readl(base + E4210_DIV_CPU1) &
@@ -185,7 +185,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
185 alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1; 185 alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1;
186 WARN_ON(alt_div >= MAX_DIV); 186 WARN_ON(alt_div >= MAX_DIV);
187 187
188 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 188 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
189 /* 189 /*
190 * In Exynos4210, ATB clock parent is also mout_core. So 190 * In Exynos4210, ATB clock parent is also mout_core. So
191 * ATB clock also needs to be mantained at safe speed. 191 * ATB clock also needs to be mantained at safe speed.
@@ -206,7 +206,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
206 writel(div0, base + E4210_DIV_CPU0); 206 writel(div0, base + E4210_DIV_CPU0);
207 wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL); 207 wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL);
208 208
209 if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { 209 if (cpuclk->flags & CLK_CPU_HAS_DIV1) {
210 writel(div1, base + E4210_DIV_CPU1); 210 writel(div1, base + E4210_DIV_CPU1);
211 wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, 211 wait_until_divider_stable(base + E4210_DIV_STAT_CPU1,
212 DIV_MASK_ALL); 212 DIV_MASK_ALL);
@@ -225,7 +225,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata,
225 unsigned long mux_reg; 225 unsigned long mux_reg;
226 226
227 /* find out the divider values to use for clock data */ 227 /* find out the divider values to use for clock data */
228 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 228 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
229 while ((cfg_data->prate * 1000) != ndata->new_rate) { 229 while ((cfg_data->prate * 1000) != ndata->new_rate) {
230 if (cfg_data->prate == 0) 230 if (cfg_data->prate == 0)
231 return -EINVAL; 231 return -EINVAL;
@@ -240,7 +240,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata,
240 writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU); 240 writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU);
241 wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1); 241 wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1);
242 242
243 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 243 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
244 div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK); 244 div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK);
245 div_mask |= E4210_DIV0_ATB_MASK; 245 div_mask |= E4210_DIV0_ATB_MASK;
246 } 246 }
diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c
index 676ee8f6d813..8831e1a05367 100644
--- a/drivers/clk/ti/clk-3xxx.c
+++ b/drivers/clk/ti/clk-3xxx.c
@@ -374,7 +374,6 @@ static struct ti_dt_clk omap3xxx_clks[] = {
374 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"), 374 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"),
375 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"), 375 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"),
376 DT_CLK(NULL, "uart3_ick", "uart3_ick"), 376 DT_CLK(NULL, "uart3_ick", "uart3_ick"),
377 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
378 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"), 377 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"),
379 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"), 378 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"),
380 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"), 379 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"),
@@ -519,6 +518,7 @@ static struct ti_dt_clk am35xx_clks[] = {
519static struct ti_dt_clk omap36xx_clks[] = { 518static struct ti_dt_clk omap36xx_clks[] = {
520 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"), 519 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"),
521 DT_CLK(NULL, "uart4_fck", "uart4_fck"), 520 DT_CLK(NULL, "uart4_fck", "uart4_fck"),
521 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
522 { .node_name = NULL }, 522 { .node_name = NULL },
523}; 523};
524 524
diff --git a/drivers/clk/ti/clk-7xx.c b/drivers/clk/ti/clk-7xx.c
index 9b5b289e6334..a911d7de3377 100644
--- a/drivers/clk/ti/clk-7xx.c
+++ b/drivers/clk/ti/clk-7xx.c
@@ -18,7 +18,6 @@
18 18
19#include "clock.h" 19#include "clock.h"
20 20
21#define DRA7_DPLL_ABE_DEFFREQ 180633600
22#define DRA7_DPLL_GMAC_DEFFREQ 1000000000 21#define DRA7_DPLL_GMAC_DEFFREQ 1000000000
23#define DRA7_DPLL_USB_DEFFREQ 960000000 22#define DRA7_DPLL_USB_DEFFREQ 960000000
24 23
@@ -313,27 +312,12 @@ static struct ti_dt_clk dra7xx_clks[] = {
313int __init dra7xx_dt_clk_init(void) 312int __init dra7xx_dt_clk_init(void)
314{ 313{
315 int rc; 314 int rc;
316 struct clk *abe_dpll_mux, *sys_clkin2, *dpll_ck, *hdcp_ck; 315 struct clk *dpll_ck, *hdcp_ck;
317 316
318 ti_dt_clocks_register(dra7xx_clks); 317 ti_dt_clocks_register(dra7xx_clks);
319 318
320 omap2_clk_disable_autoidle_all(); 319 omap2_clk_disable_autoidle_all();
321 320
322 abe_dpll_mux = clk_get_sys(NULL, "abe_dpll_sys_clk_mux");
323 sys_clkin2 = clk_get_sys(NULL, "sys_clkin2");
324 dpll_ck = clk_get_sys(NULL, "dpll_abe_ck");
325
326 rc = clk_set_parent(abe_dpll_mux, sys_clkin2);
327 if (!rc)
328 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ);
329 if (rc)
330 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
331
332 dpll_ck = clk_get_sys(NULL, "dpll_abe_m2x2_ck");
333 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ * 2);
334 if (rc)
335 pr_err("%s: failed to configure ABE DPLL m2x2!\n", __func__);
336
337 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck"); 321 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck");
338 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ); 322 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ);
339 if (rc) 323 if (rc)
diff --git a/drivers/clk/ti/clkt_dflt.c b/drivers/clk/ti/clkt_dflt.c
index 90d7d8a21c49..1ddc288fce4e 100644
--- a/drivers/clk/ti/clkt_dflt.c
+++ b/drivers/clk/ti/clkt_dflt.c
@@ -222,7 +222,7 @@ int omap2_dflt_clk_enable(struct clk_hw *hw)
222 } 222 }
223 } 223 }
224 224
225 if (unlikely(!clk->enable_reg)) { 225 if (unlikely(IS_ERR(clk->enable_reg))) {
226 pr_err("%s: %s missing enable_reg\n", __func__, 226 pr_err("%s: %s missing enable_reg\n", __func__,
227 clk_hw_get_name(hw)); 227 clk_hw_get_name(hw));
228 ret = -EINVAL; 228 ret = -EINVAL;
@@ -264,7 +264,7 @@ void omap2_dflt_clk_disable(struct clk_hw *hw)
264 u32 v; 264 u32 v;
265 265
266 clk = to_clk_hw_omap(hw); 266 clk = to_clk_hw_omap(hw);
267 if (!clk->enable_reg) { 267 if (IS_ERR(clk->enable_reg)) {
268 /* 268 /*
269 * 'independent' here refers to a clock which is not 269 * 'independent' here refers to a clock which is not
270 * controlled by its parent. 270 * controlled by its parent.
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index bb2c2b050964..d3c1742ded1a 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np)
148 bc_timer.freq = clk_get_rate(timer_clk); 148 bc_timer.freq = clk_get_rate(timer_clk);
149 149
150 irq = irq_of_parse_and_map(np, 0); 150 irq = irq_of_parse_and_map(np, 0);
151 if (irq == NO_IRQ) { 151 if (!irq) {
152 pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME); 152 pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
153 return; 153 return;
154 } 154 }
diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c
index edacf3902e10..1cea08cf603e 100644
--- a/drivers/clocksource/timer-keystone.c
+++ b/drivers/clocksource/timer-keystone.c
@@ -152,7 +152,7 @@ static void __init keystone_timer_init(struct device_node *np)
152 int irq, error; 152 int irq, error;
153 153
154 irq = irq_of_parse_and_map(np, 0); 154 irq = irq_of_parse_and_map(np, 0);
155 if (irq == NO_IRQ) { 155 if (!irq) {
156 pr_err("%s: failed to map interrupts\n", __func__); 156 pr_err("%s: failed to map interrupts\n", __func__);
157 return; 157 return;
158 } 158 }
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 798277227de7..cec1ee2d2f74 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -149,6 +149,9 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
149{ 149{
150 struct acpi_cpufreq_data *data = policy->driver_data; 150 struct acpi_cpufreq_data *data = policy->driver_data;
151 151
152 if (unlikely(!data))
153 return -ENODEV;
154
152 return cpufreq_show_cpus(data->freqdomain_cpus, buf); 155 return cpufreq_show_cpus(data->freqdomain_cpus, buf);
153} 156}
154 157
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index ef5ed9470de9..25c4c15103a0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1436,8 +1436,10 @@ static void cpufreq_offline_finish(unsigned int cpu)
1436 * since this is a core component, and is essential for the 1436 * since this is a core component, and is essential for the
1437 * subsequent light-weight ->init() to succeed. 1437 * subsequent light-weight ->init() to succeed.
1438 */ 1438 */
1439 if (cpufreq_driver->exit) 1439 if (cpufreq_driver->exit) {
1440 cpufreq_driver->exit(policy); 1440 cpufreq_driver->exit(policy);
1441 policy->freq_table = NULL;
1442 }
1441} 1443}
1442 1444
1443/** 1445/**
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3af9dd7332e6..aa33b92b3e3e 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -776,6 +776,11 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
776 local_irq_save(flags); 776 local_irq_save(flags);
777 rdmsrl(MSR_IA32_APERF, aperf); 777 rdmsrl(MSR_IA32_APERF, aperf);
778 rdmsrl(MSR_IA32_MPERF, mperf); 778 rdmsrl(MSR_IA32_MPERF, mperf);
779 if (cpu->prev_mperf == mperf) {
780 local_irq_restore(flags);
781 return;
782 }
783
779 tsc = rdtsc(); 784 tsc = rdtsc();
780 local_irq_restore(flags); 785 local_irq_restore(flags);
781 786
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 3927ed9fdbd5..ca848cc6a8fd 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
492 if (err) { 492 if (err) {
493 put_device(&devfreq->dev); 493 put_device(&devfreq->dev);
494 mutex_unlock(&devfreq->lock); 494 mutex_unlock(&devfreq->lock);
495 goto err_dev; 495 goto err_out;
496 } 496 }
497 497
498 mutex_unlock(&devfreq->lock); 498 mutex_unlock(&devfreq->lock);
@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
518err_init: 518err_init:
519 list_del(&devfreq->node); 519 list_del(&devfreq->node);
520 device_unregister(&devfreq->dev); 520 device_unregister(&devfreq->dev);
521err_dev:
522 kfree(devfreq); 521 kfree(devfreq);
523err_out: 522err_out:
524 return ERR_PTR(err); 523 return ERR_PTR(err);
@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
795 ret = PTR_ERR(governor); 794 ret = PTR_ERR(governor);
796 goto out; 795 goto out;
797 } 796 }
798 if (df->governor == governor) 797 if (df->governor == governor) {
798 ret = 0;
799 goto out; 799 goto out;
800 }
800 801
801 if (df->governor) { 802 if (df->governor) {
802 ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL); 803 ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index a165b4bfd330..dd24375b76dd 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -455,6 +455,15 @@ static struct at_xdmac_desc *at_xdmac_alloc_desc(struct dma_chan *chan,
455 return desc; 455 return desc;
456} 456}
457 457
458void at_xdmac_init_used_desc(struct at_xdmac_desc *desc)
459{
460 memset(&desc->lld, 0, sizeof(desc->lld));
461 INIT_LIST_HEAD(&desc->descs_list);
462 desc->direction = DMA_TRANS_NONE;
463 desc->xfer_size = 0;
464 desc->active_xfer = false;
465}
466
458/* Call must be protected by lock. */ 467/* Call must be protected by lock. */
459static struct at_xdmac_desc *at_xdmac_get_desc(struct at_xdmac_chan *atchan) 468static struct at_xdmac_desc *at_xdmac_get_desc(struct at_xdmac_chan *atchan)
460{ 469{
@@ -466,7 +475,7 @@ static struct at_xdmac_desc *at_xdmac_get_desc(struct at_xdmac_chan *atchan)
466 desc = list_first_entry(&atchan->free_descs_list, 475 desc = list_first_entry(&atchan->free_descs_list,
467 struct at_xdmac_desc, desc_node); 476 struct at_xdmac_desc, desc_node);
468 list_del(&desc->desc_node); 477 list_del(&desc->desc_node);
469 desc->active_xfer = false; 478 at_xdmac_init_used_desc(desc);
470 } 479 }
471 480
472 return desc; 481 return desc;
@@ -875,14 +884,14 @@ at_xdmac_interleaved_queue_desc(struct dma_chan *chan,
875 884
876 if (xt->src_inc) { 885 if (xt->src_inc) {
877 if (xt->src_sgl) 886 if (xt->src_sgl)
878 chan_cc |= AT_XDMAC_CC_SAM_UBS_DS_AM; 887 chan_cc |= AT_XDMAC_CC_SAM_UBS_AM;
879 else 888 else
880 chan_cc |= AT_XDMAC_CC_SAM_INCREMENTED_AM; 889 chan_cc |= AT_XDMAC_CC_SAM_INCREMENTED_AM;
881 } 890 }
882 891
883 if (xt->dst_inc) { 892 if (xt->dst_inc) {
884 if (xt->dst_sgl) 893 if (xt->dst_sgl)
885 chan_cc |= AT_XDMAC_CC_DAM_UBS_DS_AM; 894 chan_cc |= AT_XDMAC_CC_DAM_UBS_AM;
886 else 895 else
887 chan_cc |= AT_XDMAC_CC_DAM_INCREMENTED_AM; 896 chan_cc |= AT_XDMAC_CC_DAM_INCREMENTED_AM;
888 } 897 }
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 3ff284c8e3d5..09479d4be4db 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -554,10 +554,18 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
554 mutex_lock(&dma_list_mutex); 554 mutex_lock(&dma_list_mutex);
555 555
556 if (chan->client_count == 0) { 556 if (chan->client_count == 0) {
557 struct dma_device *device = chan->device;
558
559 dma_cap_set(DMA_PRIVATE, device->cap_mask);
560 device->privatecnt++;
557 err = dma_chan_get(chan); 561 err = dma_chan_get(chan);
558 if (err) 562 if (err) {
559 pr_debug("%s: failed to get %s: (%d)\n", 563 pr_debug("%s: failed to get %s: (%d)\n",
560 __func__, dma_chan_name(chan), err); 564 __func__, dma_chan_name(chan), err);
565 chan = NULL;
566 if (--device->privatecnt == 0)
567 dma_cap_clear(DMA_PRIVATE, device->cap_mask);
568 }
561 } else 569 } else
562 chan = NULL; 570 chan = NULL;
563 571
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index cf1c87fa1edd..bedce038c6e2 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -1591,7 +1591,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
1591 INIT_LIST_HEAD(&dw->dma.channels); 1591 INIT_LIST_HEAD(&dw->dma.channels);
1592 for (i = 0; i < nr_channels; i++) { 1592 for (i = 0; i < nr_channels; i++) {
1593 struct dw_dma_chan *dwc = &dw->chan[i]; 1593 struct dw_dma_chan *dwc = &dw->chan[i];
1594 int r = nr_channels - i - 1;
1595 1594
1596 dwc->chan.device = &dw->dma; 1595 dwc->chan.device = &dw->dma;
1597 dma_cookie_init(&dwc->chan); 1596 dma_cookie_init(&dwc->chan);
@@ -1603,7 +1602,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
1603 1602
1604 /* 7 is highest priority & 0 is lowest. */ 1603 /* 7 is highest priority & 0 is lowest. */
1605 if (pdata->chan_priority == CHAN_PRIORITY_ASCENDING) 1604 if (pdata->chan_priority == CHAN_PRIORITY_ASCENDING)
1606 dwc->priority = r; 1605 dwc->priority = nr_channels - i - 1;
1607 else 1606 else
1608 dwc->priority = i; 1607 dwc->priority = i;
1609 1608
@@ -1622,6 +1621,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
1622 /* Hardware configuration */ 1621 /* Hardware configuration */
1623 if (autocfg) { 1622 if (autocfg) {
1624 unsigned int dwc_params; 1623 unsigned int dwc_params;
1624 unsigned int r = DW_DMA_MAX_NR_CHANNELS - i - 1;
1625 void __iomem *addr = chip->regs + r * sizeof(u32); 1625 void __iomem *addr = chip->regs + r * sizeof(u32);
1626 1626
1627 dwc_params = dma_read_byaddr(addr, DWC_PARAMS); 1627 dwc_params = dma_read_byaddr(addr, DWC_PARAMS);
diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index 18c14e1f1414..48d6d9e94f67 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -355,23 +355,23 @@ static size_t idma64_active_desc_size(struct idma64_chan *idma64c)
355 struct idma64_desc *desc = idma64c->desc; 355 struct idma64_desc *desc = idma64c->desc;
356 struct idma64_hw_desc *hw; 356 struct idma64_hw_desc *hw;
357 size_t bytes = desc->length; 357 size_t bytes = desc->length;
358 u64 llp; 358 u64 llp = channel_readq(idma64c, LLP);
359 u32 ctlhi; 359 u32 ctlhi = channel_readl(idma64c, CTL_HI);
360 unsigned int i = 0; 360 unsigned int i = 0;
361 361
362 llp = channel_readq(idma64c, LLP);
363 do { 362 do {
364 hw = &desc->hw[i]; 363 hw = &desc->hw[i];
365 } while ((hw->llp != llp) && (++i < desc->ndesc)); 364 if (hw->llp == llp)
365 break;
366 bytes -= hw->len;
367 } while (++i < desc->ndesc);
366 368
367 if (!i) 369 if (!i)
368 return bytes; 370 return bytes;
369 371
370 do { 372 /* The current chunk is not fully transfered yet */
371 bytes -= desc->hw[--i].len; 373 bytes += desc->hw[--i].len;
372 } while (i);
373 374
374 ctlhi = channel_readl(idma64c, CTL_HI);
375 return bytes - IDMA64C_CTLH_BLOCK_TS(ctlhi); 375 return bytes - IDMA64C_CTLH_BLOCK_TS(ctlhi);
376} 376}
377 377
diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c
index 5cb61ce01036..fc4156afa070 100644
--- a/drivers/dma/pxa_dma.c
+++ b/drivers/dma/pxa_dma.c
@@ -473,8 +473,10 @@ static void pxad_free_phy(struct pxad_chan *chan)
473 return; 473 return;
474 474
475 /* clear the channel mapping in DRCMR */ 475 /* clear the channel mapping in DRCMR */
476 reg = pxad_drcmr(chan->drcmr); 476 if (chan->drcmr <= DRCMR_CHLNUM) {
477 writel_relaxed(0, chan->phy->base + reg); 477 reg = pxad_drcmr(chan->drcmr);
478 writel_relaxed(0, chan->phy->base + reg);
479 }
478 480
479 spin_lock_irqsave(&pdev->phy_lock, flags); 481 spin_lock_irqsave(&pdev->phy_lock, flags);
480 for (i = 0; i < 32; i++) 482 for (i = 0; i < 32; i++)
@@ -516,8 +518,10 @@ static void phy_enable(struct pxad_phy *phy, bool misaligned)
516 "%s(); phy=%p(%d) misaligned=%d\n", __func__, 518 "%s(); phy=%p(%d) misaligned=%d\n", __func__,
517 phy, phy->idx, misaligned); 519 phy, phy->idx, misaligned);
518 520
519 reg = pxad_drcmr(phy->vchan->drcmr); 521 if (phy->vchan->drcmr <= DRCMR_CHLNUM) {
520 writel_relaxed(DRCMR_MAPVLD | phy->idx, phy->base + reg); 522 reg = pxad_drcmr(phy->vchan->drcmr);
523 writel_relaxed(DRCMR_MAPVLD | phy->idx, phy->base + reg);
524 }
521 525
522 dalgn = phy_readl_relaxed(phy, DALGN); 526 dalgn = phy_readl_relaxed(phy, DALGN);
523 if (misaligned) 527 if (misaligned)
@@ -887,6 +891,7 @@ pxad_tx_prep(struct virt_dma_chan *vc, struct virt_dma_desc *vd,
887 struct dma_async_tx_descriptor *tx; 891 struct dma_async_tx_descriptor *tx;
888 struct pxad_chan *chan = container_of(vc, struct pxad_chan, vc); 892 struct pxad_chan *chan = container_of(vc, struct pxad_chan, vc);
889 893
894 INIT_LIST_HEAD(&vd->node);
890 tx = vchan_tx_prep(vc, vd, tx_flags); 895 tx = vchan_tx_prep(vc, vd, tx_flags);
891 tx->tx_submit = pxad_tx_submit; 896 tx->tx_submit = pxad_tx_submit;
892 dev_dbg(&chan->vc.chan.dev->device, 897 dev_dbg(&chan->vc.chan.dev->device,
@@ -910,14 +915,18 @@ static void pxad_get_config(struct pxad_chan *chan,
910 width = chan->cfg.src_addr_width; 915 width = chan->cfg.src_addr_width;
911 dev_addr = chan->cfg.src_addr; 916 dev_addr = chan->cfg.src_addr;
912 *dev_src = dev_addr; 917 *dev_src = dev_addr;
913 *dcmd |= PXA_DCMD_INCTRGADDR | PXA_DCMD_FLOWSRC; 918 *dcmd |= PXA_DCMD_INCTRGADDR;
919 if (chan->drcmr <= DRCMR_CHLNUM)
920 *dcmd |= PXA_DCMD_FLOWSRC;
914 } 921 }
915 if (dir == DMA_MEM_TO_DEV) { 922 if (dir == DMA_MEM_TO_DEV) {
916 maxburst = chan->cfg.dst_maxburst; 923 maxburst = chan->cfg.dst_maxburst;
917 width = chan->cfg.dst_addr_width; 924 width = chan->cfg.dst_addr_width;
918 dev_addr = chan->cfg.dst_addr; 925 dev_addr = chan->cfg.dst_addr;
919 *dev_dst = dev_addr; 926 *dev_dst = dev_addr;
920 *dcmd |= PXA_DCMD_INCSRCADDR | PXA_DCMD_FLOWTRG; 927 *dcmd |= PXA_DCMD_INCSRCADDR;
928 if (chan->drcmr <= DRCMR_CHLNUM)
929 *dcmd |= PXA_DCMD_FLOWTRG;
921 } 930 }
922 if (dir == DMA_MEM_TO_MEM) 931 if (dir == DMA_MEM_TO_MEM)
923 *dcmd |= PXA_DCMD_BURST32 | PXA_DCMD_INCTRGADDR | 932 *dcmd |= PXA_DCMD_BURST32 | PXA_DCMD_INCTRGADDR |
@@ -1177,6 +1186,16 @@ static unsigned int pxad_residue(struct pxad_chan *chan,
1177 else 1186 else
1178 curr = phy_readl_relaxed(chan->phy, DTADR); 1187 curr = phy_readl_relaxed(chan->phy, DTADR);
1179 1188
1189 /*
1190 * curr has to be actually read before checking descriptor
1191 * completion, so that a curr inside a status updater
1192 * descriptor implies the following test returns true, and
1193 * preventing reordering of curr load and the test.
1194 */
1195 rmb();
1196 if (is_desc_completed(vd))
1197 goto out;
1198
1180 for (i = 0; i < sw_desc->nb_desc - 1; i++) { 1199 for (i = 0; i < sw_desc->nb_desc - 1; i++) {
1181 hw_desc = sw_desc->hw_desc[i]; 1200 hw_desc = sw_desc->hw_desc[i];
1182 if (sw_desc->hw_desc[0]->dcmd & PXA_DCMD_INCSRCADDR) 1201 if (sw_desc->hw_desc[0]->dcmd & PXA_DCMD_INCSRCADDR)
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
index a1a500d96ff2..1661d518224a 100644
--- a/drivers/dma/sun4i-dma.c
+++ b/drivers/dma/sun4i-dma.c
@@ -599,13 +599,13 @@ get_next_cyclic_promise(struct sun4i_dma_contract *contract)
599static void sun4i_dma_free_contract(struct virt_dma_desc *vd) 599static void sun4i_dma_free_contract(struct virt_dma_desc *vd)
600{ 600{
601 struct sun4i_dma_contract *contract = to_sun4i_dma_contract(vd); 601 struct sun4i_dma_contract *contract = to_sun4i_dma_contract(vd);
602 struct sun4i_dma_promise *promise; 602 struct sun4i_dma_promise *promise, *tmp;
603 603
604 /* Free all the demands and completed demands */ 604 /* Free all the demands and completed demands */
605 list_for_each_entry(promise, &contract->demands, list) 605 list_for_each_entry_safe(promise, tmp, &contract->demands, list)
606 kfree(promise); 606 kfree(promise);
607 607
608 list_for_each_entry(promise, &contract->completed_demands, list) 608 list_for_each_entry_safe(promise, tmp, &contract->completed_demands, list)
609 kfree(promise); 609 kfree(promise);
610 610
611 kfree(contract); 611 kfree(contract);
diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c
index b23e8d52d126..8d57b1b12e41 100644
--- a/drivers/dma/xgene-dma.c
+++ b/drivers/dma/xgene-dma.c
@@ -59,7 +59,6 @@
59#define XGENE_DMA_RING_MEM_RAM_SHUTDOWN 0xD070 59#define XGENE_DMA_RING_MEM_RAM_SHUTDOWN 0xD070
60#define XGENE_DMA_RING_BLK_MEM_RDY 0xD074 60#define XGENE_DMA_RING_BLK_MEM_RDY 0xD074
61#define XGENE_DMA_RING_BLK_MEM_RDY_VAL 0xFFFFFFFF 61#define XGENE_DMA_RING_BLK_MEM_RDY_VAL 0xFFFFFFFF
62#define XGENE_DMA_RING_DESC_CNT(v) (((v) & 0x0001FFFE) >> 1)
63#define XGENE_DMA_RING_ID_GET(owner, num) (((owner) << 6) | (num)) 62#define XGENE_DMA_RING_ID_GET(owner, num) (((owner) << 6) | (num))
64#define XGENE_DMA_RING_DST_ID(v) ((1 << 10) | (v)) 63#define XGENE_DMA_RING_DST_ID(v) ((1 << 10) | (v))
65#define XGENE_DMA_RING_CMD_OFFSET 0x2C 64#define XGENE_DMA_RING_CMD_OFFSET 0x2C
@@ -379,14 +378,6 @@ static u8 xgene_dma_encode_xor_flyby(u32 src_cnt)
379 return flyby_type[src_cnt]; 378 return flyby_type[src_cnt];
380} 379}
381 380
382static u32 xgene_dma_ring_desc_cnt(struct xgene_dma_ring *ring)
383{
384 u32 __iomem *cmd_base = ring->cmd_base;
385 u32 ring_state = ioread32(&cmd_base[1]);
386
387 return XGENE_DMA_RING_DESC_CNT(ring_state);
388}
389
390static void xgene_dma_set_src_buffer(__le64 *ext8, size_t *len, 381static void xgene_dma_set_src_buffer(__le64 *ext8, size_t *len,
391 dma_addr_t *paddr) 382 dma_addr_t *paddr)
392{ 383{
@@ -659,15 +650,12 @@ static void xgene_dma_clean_running_descriptor(struct xgene_dma_chan *chan,
659 dma_pool_free(chan->desc_pool, desc, desc->tx.phys); 650 dma_pool_free(chan->desc_pool, desc, desc->tx.phys);
660} 651}
661 652
662static int xgene_chan_xfer_request(struct xgene_dma_ring *ring, 653static void xgene_chan_xfer_request(struct xgene_dma_chan *chan,
663 struct xgene_dma_desc_sw *desc_sw) 654 struct xgene_dma_desc_sw *desc_sw)
664{ 655{
656 struct xgene_dma_ring *ring = &chan->tx_ring;
665 struct xgene_dma_desc_hw *desc_hw; 657 struct xgene_dma_desc_hw *desc_hw;
666 658
667 /* Check if can push more descriptor to hw for execution */
668 if (xgene_dma_ring_desc_cnt(ring) > (ring->slots - 2))
669 return -EBUSY;
670
671 /* Get hw descriptor from DMA tx ring */ 659 /* Get hw descriptor from DMA tx ring */
672 desc_hw = &ring->desc_hw[ring->head]; 660 desc_hw = &ring->desc_hw[ring->head];
673 661
@@ -694,11 +682,13 @@ static int xgene_chan_xfer_request(struct xgene_dma_ring *ring,
694 memcpy(desc_hw, &desc_sw->desc2, sizeof(*desc_hw)); 682 memcpy(desc_hw, &desc_sw->desc2, sizeof(*desc_hw));
695 } 683 }
696 684
685 /* Increment the pending transaction count */
686 chan->pending += ((desc_sw->flags &
687 XGENE_DMA_FLAG_64B_DESC) ? 2 : 1);
688
697 /* Notify the hw that we have descriptor ready for execution */ 689 /* Notify the hw that we have descriptor ready for execution */
698 iowrite32((desc_sw->flags & XGENE_DMA_FLAG_64B_DESC) ? 690 iowrite32((desc_sw->flags & XGENE_DMA_FLAG_64B_DESC) ?
699 2 : 1, ring->cmd); 691 2 : 1, ring->cmd);
700
701 return 0;
702} 692}
703 693
704/** 694/**
@@ -710,7 +700,6 @@ static int xgene_chan_xfer_request(struct xgene_dma_ring *ring,
710static void xgene_chan_xfer_ld_pending(struct xgene_dma_chan *chan) 700static void xgene_chan_xfer_ld_pending(struct xgene_dma_chan *chan)
711{ 701{
712 struct xgene_dma_desc_sw *desc_sw, *_desc_sw; 702 struct xgene_dma_desc_sw *desc_sw, *_desc_sw;
713 int ret;
714 703
715 /* 704 /*
716 * If the list of pending descriptors is empty, then we 705 * If the list of pending descriptors is empty, then we
@@ -735,18 +724,13 @@ static void xgene_chan_xfer_ld_pending(struct xgene_dma_chan *chan)
735 if (chan->pending >= chan->max_outstanding) 724 if (chan->pending >= chan->max_outstanding)
736 return; 725 return;
737 726
738 ret = xgene_chan_xfer_request(&chan->tx_ring, desc_sw); 727 xgene_chan_xfer_request(chan, desc_sw);
739 if (ret)
740 return;
741 728
742 /* 729 /*
743 * Delete this element from ld pending queue and append it to 730 * Delete this element from ld pending queue and append it to
744 * ld running queue 731 * ld running queue
745 */ 732 */
746 list_move_tail(&desc_sw->node, &chan->ld_running); 733 list_move_tail(&desc_sw->node, &chan->ld_running);
747
748 /* Increment the pending transaction count */
749 chan->pending++;
750 } 734 }
751} 735}
752 736
@@ -821,7 +805,8 @@ static void xgene_dma_cleanup_descriptors(struct xgene_dma_chan *chan)
821 * Decrement the pending transaction count 805 * Decrement the pending transaction count
822 * as we have processed one 806 * as we have processed one
823 */ 807 */
824 chan->pending--; 808 chan->pending -= ((desc_sw->flags &
809 XGENE_DMA_FLAG_64B_DESC) ? 2 : 1);
825 810
826 /* 811 /*
827 * Delete this node from ld running queue and append it to 812 * Delete this node from ld running queue and append it to
@@ -1421,15 +1406,18 @@ static int xgene_dma_create_ring_one(struct xgene_dma_chan *chan,
1421 struct xgene_dma_ring *ring, 1406 struct xgene_dma_ring *ring,
1422 enum xgene_dma_ring_cfgsize cfgsize) 1407 enum xgene_dma_ring_cfgsize cfgsize)
1423{ 1408{
1409 int ret;
1410
1424 /* Setup DMA ring descriptor variables */ 1411 /* Setup DMA ring descriptor variables */
1425 ring->pdma = chan->pdma; 1412 ring->pdma = chan->pdma;
1426 ring->cfgsize = cfgsize; 1413 ring->cfgsize = cfgsize;
1427 ring->num = chan->pdma->ring_num++; 1414 ring->num = chan->pdma->ring_num++;
1428 ring->id = XGENE_DMA_RING_ID_GET(ring->owner, ring->buf_num); 1415 ring->id = XGENE_DMA_RING_ID_GET(ring->owner, ring->buf_num);
1429 1416
1430 ring->size = xgene_dma_get_ring_size(chan, cfgsize); 1417 ret = xgene_dma_get_ring_size(chan, cfgsize);
1431 if (ring->size <= 0) 1418 if (ret <= 0)
1432 return ring->size; 1419 return ret;
1420 ring->size = ret;
1433 1421
1434 /* Allocate memory for DMA ring descriptor */ 1422 /* Allocate memory for DMA ring descriptor */
1435 ring->desc_vaddr = dma_zalloc_coherent(chan->dev, ring->size, 1423 ring->desc_vaddr = dma_zalloc_coherent(chan->dev, ring->size,
@@ -1482,7 +1470,7 @@ static int xgene_dma_create_chan_rings(struct xgene_dma_chan *chan)
1482 tx_ring->id, tx_ring->num, tx_ring->desc_vaddr); 1470 tx_ring->id, tx_ring->num, tx_ring->desc_vaddr);
1483 1471
1484 /* Set the max outstanding request possible to this channel */ 1472 /* Set the max outstanding request possible to this channel */
1485 chan->max_outstanding = rx_ring->slots; 1473 chan->max_outstanding = tx_ring->slots;
1486 1474
1487 return ret; 1475 return ret;
1488} 1476}
diff --git a/drivers/dma/zx296702_dma.c b/drivers/dma/zx296702_dma.c
index 39915a6b7986..c017fcd8e07c 100644
--- a/drivers/dma/zx296702_dma.c
+++ b/drivers/dma/zx296702_dma.c
@@ -739,7 +739,7 @@ static struct dma_chan *zx_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
739 struct dma_chan *chan; 739 struct dma_chan *chan;
740 struct zx_dma_chan *c; 740 struct zx_dma_chan *c;
741 741
742 if (request > d->dma_requests) 742 if (request >= d->dma_requests)
743 return NULL; 743 return NULL;
744 744
745 chan = dma_get_any_slave_channel(&d->slave); 745 chan = dma_get_any_slave_channel(&d->slave);
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index e29560e6b40b..950c87f5d279 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/efi.h> 15#include <linux/efi.h>
16#include <linux/sort.h>
16#include <asm/efi.h> 17#include <asm/efi.h>
17 18
18#include "efistub.h" 19#include "efistub.h"
@@ -305,6 +306,44 @@ fail:
305 */ 306 */
306#define EFI_RT_VIRTUAL_BASE 0x40000000 307#define EFI_RT_VIRTUAL_BASE 0x40000000
307 308
309static int cmp_mem_desc(const void *l, const void *r)
310{
311 const efi_memory_desc_t *left = l, *right = r;
312
313 return (left->phys_addr > right->phys_addr) ? 1 : -1;
314}
315
316/*
317 * Returns whether region @left ends exactly where region @right starts,
318 * or false if either argument is NULL.
319 */
320static bool regions_are_adjacent(efi_memory_desc_t *left,
321 efi_memory_desc_t *right)
322{
323 u64 left_end;
324
325 if (left == NULL || right == NULL)
326 return false;
327
328 left_end = left->phys_addr + left->num_pages * EFI_PAGE_SIZE;
329
330 return left_end == right->phys_addr;
331}
332
333/*
334 * Returns whether region @left and region @right have compatible memory type
335 * mapping attributes, and are both EFI_MEMORY_RUNTIME regions.
336 */
337static bool regions_have_compatible_memory_type_attrs(efi_memory_desc_t *left,
338 efi_memory_desc_t *right)
339{
340 static const u64 mem_type_mask = EFI_MEMORY_WB | EFI_MEMORY_WT |
341 EFI_MEMORY_WC | EFI_MEMORY_UC |
342 EFI_MEMORY_RUNTIME;
343
344 return ((left->attribute ^ right->attribute) & mem_type_mask) == 0;
345}
346
308/* 347/*
309 * efi_get_virtmap() - create a virtual mapping for the EFI memory map 348 * efi_get_virtmap() - create a virtual mapping for the EFI memory map
310 * 349 *
@@ -317,33 +356,52 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
317 int *count) 356 int *count)
318{ 357{
319 u64 efi_virt_base = EFI_RT_VIRTUAL_BASE; 358 u64 efi_virt_base = EFI_RT_VIRTUAL_BASE;
320 efi_memory_desc_t *out = runtime_map; 359 efi_memory_desc_t *in, *prev = NULL, *out = runtime_map;
321 int l; 360 int l;
322 361
323 for (l = 0; l < map_size; l += desc_size) { 362 /*
324 efi_memory_desc_t *in = (void *)memory_map + l; 363 * To work around potential issues with the Properties Table feature
364 * introduced in UEFI 2.5, which may split PE/COFF executable images
365 * in memory into several RuntimeServicesCode and RuntimeServicesData
366 * regions, we need to preserve the relative offsets between adjacent
367 * EFI_MEMORY_RUNTIME regions with the same memory type attributes.
368 * The easiest way to find adjacent regions is to sort the memory map
369 * before traversing it.
370 */
371 sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc, NULL);
372
373 for (l = 0; l < map_size; l += desc_size, prev = in) {
325 u64 paddr, size; 374 u64 paddr, size;
326 375
376 in = (void *)memory_map + l;
327 if (!(in->attribute & EFI_MEMORY_RUNTIME)) 377 if (!(in->attribute & EFI_MEMORY_RUNTIME))
328 continue; 378 continue;
329 379
380 paddr = in->phys_addr;
381 size = in->num_pages * EFI_PAGE_SIZE;
382
330 /* 383 /*
331 * Make the mapping compatible with 64k pages: this allows 384 * Make the mapping compatible with 64k pages: this allows
332 * a 4k page size kernel to kexec a 64k page size kernel and 385 * a 4k page size kernel to kexec a 64k page size kernel and
333 * vice versa. 386 * vice versa.
334 */ 387 */
335 paddr = round_down(in->phys_addr, SZ_64K); 388 if (!regions_are_adjacent(prev, in) ||
336 size = round_up(in->num_pages * EFI_PAGE_SIZE + 389 !regions_have_compatible_memory_type_attrs(prev, in)) {
337 in->phys_addr - paddr, SZ_64K); 390
338 391 paddr = round_down(in->phys_addr, SZ_64K);
339 /* 392 size += in->phys_addr - paddr;
340 * Avoid wasting memory on PTEs by choosing a virtual base that 393
341 * is compatible with section mappings if this region has the 394 /*
342 * appropriate size and physical alignment. (Sections are 2 MB 395 * Avoid wasting memory on PTEs by choosing a virtual
343 * on 4k granule kernels) 396 * base that is compatible with section mappings if this
344 */ 397 * region has the appropriate size and physical
345 if (IS_ALIGNED(in->phys_addr, SZ_2M) && size >= SZ_2M) 398 * alignment. (Sections are 2 MB on 4k granule kernels)
346 efi_virt_base = round_up(efi_virt_base, SZ_2M); 399 */
400 if (IS_ALIGNED(in->phys_addr, SZ_2M) && size >= SZ_2M)
401 efi_virt_base = round_up(efi_virt_base, SZ_2M);
402 else
403 efi_virt_base = round_up(efi_virt_base, SZ_64K);
404 }
347 405
348 in->virt_addr = efi_virt_base + in->phys_addr - paddr; 406 in->virt_addr = efi_virt_base + in->phys_addr - paddr;
349 efi_virt_base += size; 407 efi_virt_base += size;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
index 77f1d7c6ea3a..9416e0f5c1db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
@@ -672,8 +672,12 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev)
672 /* disp clock */ 672 /* disp clock */
673 adev->clock.default_dispclk = 673 adev->clock.default_dispclk =
674 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); 674 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq);
675 if (adev->clock.default_dispclk == 0) 675 /* set a reasonable default for DP */
676 adev->clock.default_dispclk = 54000; /* 540 Mhz */ 676 if (adev->clock.default_dispclk < 53900) {
677 DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n",
678 adev->clock.default_dispclk / 100);
679 adev->clock.default_dispclk = 60000;
680 }
677 adev->clock.dp_extclk = 681 adev->clock.dp_extclk =
678 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); 682 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq);
679 adev->clock.current_dispclk = adev->clock.default_dispclk; 683 adev->clock.current_dispclk = adev->clock.default_dispclk;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 1c3fc99c5465..8e995148f56e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -208,44 +208,6 @@ static int amdgpu_cgs_alloc_gpu_mem(void *cgs_device,
208 return ret; 208 return ret;
209} 209}
210 210
211static int amdgpu_cgs_import_gpu_mem(void *cgs_device, int dmabuf_fd,
212 cgs_handle_t *handle)
213{
214 CGS_FUNC_ADEV;
215 int r;
216 uint32_t dma_handle;
217 struct drm_gem_object *obj;
218 struct amdgpu_bo *bo;
219 struct drm_device *dev = adev->ddev;
220 struct drm_file *file_priv = NULL, *priv;
221
222 mutex_lock(&dev->struct_mutex);
223 list_for_each_entry(priv, &dev->filelist, lhead) {
224 rcu_read_lock();
225 if (priv->pid == get_pid(task_pid(current)))
226 file_priv = priv;
227 rcu_read_unlock();
228 if (file_priv)
229 break;
230 }
231 mutex_unlock(&dev->struct_mutex);
232 r = dev->driver->prime_fd_to_handle(dev,
233 file_priv, dmabuf_fd,
234 &dma_handle);
235 spin_lock(&file_priv->table_lock);
236
237 /* Check if we currently have a reference on the object */
238 obj = idr_find(&file_priv->object_idr, dma_handle);
239 if (obj == NULL) {
240 spin_unlock(&file_priv->table_lock);
241 return -EINVAL;
242 }
243 spin_unlock(&file_priv->table_lock);
244 bo = gem_to_amdgpu_bo(obj);
245 *handle = (cgs_handle_t)bo;
246 return 0;
247}
248
249static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle) 211static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle)
250{ 212{
251 struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; 213 struct amdgpu_bo *obj = (struct amdgpu_bo *)handle;
@@ -810,7 +772,6 @@ static const struct cgs_ops amdgpu_cgs_ops = {
810}; 772};
811 773
812static const struct cgs_os_ops amdgpu_cgs_os_ops = { 774static const struct cgs_os_ops amdgpu_cgs_os_ops = {
813 amdgpu_cgs_import_gpu_mem,
814 amdgpu_cgs_add_irq_source, 775 amdgpu_cgs_add_irq_source,
815 amdgpu_cgs_irq_get, 776 amdgpu_cgs_irq_get,
816 amdgpu_cgs_irq_put 777 amdgpu_cgs_irq_put
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 749420f1ea6f..fd16652aa277 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -156,7 +156,8 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
156 uint64_t *chunk_array_user; 156 uint64_t *chunk_array_user;
157 uint64_t *chunk_array; 157 uint64_t *chunk_array;
158 struct amdgpu_fpriv *fpriv = p->filp->driver_priv; 158 struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
159 unsigned size, i; 159 unsigned size;
160 int i;
160 int ret; 161 int ret;
161 162
162 if (cs->in.num_chunks == 0) 163 if (cs->in.num_chunks == 0)
@@ -176,7 +177,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
176 177
177 /* get chunks */ 178 /* get chunks */
178 INIT_LIST_HEAD(&p->validated); 179 INIT_LIST_HEAD(&p->validated);
179 chunk_array_user = (uint64_t __user *)(cs->in.chunks); 180 chunk_array_user = (uint64_t __user *)(unsigned long)(cs->in.chunks);
180 if (copy_from_user(chunk_array, chunk_array_user, 181 if (copy_from_user(chunk_array, chunk_array_user,
181 sizeof(uint64_t)*cs->in.num_chunks)) { 182 sizeof(uint64_t)*cs->in.num_chunks)) {
182 ret = -EFAULT; 183 ret = -EFAULT;
@@ -196,7 +197,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
196 struct drm_amdgpu_cs_chunk user_chunk; 197 struct drm_amdgpu_cs_chunk user_chunk;
197 uint32_t __user *cdata; 198 uint32_t __user *cdata;
198 199
199 chunk_ptr = (void __user *)chunk_array[i]; 200 chunk_ptr = (void __user *)(unsigned long)chunk_array[i];
200 if (copy_from_user(&user_chunk, chunk_ptr, 201 if (copy_from_user(&user_chunk, chunk_ptr,
201 sizeof(struct drm_amdgpu_cs_chunk))) { 202 sizeof(struct drm_amdgpu_cs_chunk))) {
202 ret = -EFAULT; 203 ret = -EFAULT;
@@ -207,7 +208,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
207 p->chunks[i].length_dw = user_chunk.length_dw; 208 p->chunks[i].length_dw = user_chunk.length_dw;
208 209
209 size = p->chunks[i].length_dw; 210 size = p->chunks[i].length_dw;
210 cdata = (void __user *)user_chunk.chunk_data; 211 cdata = (void __user *)(unsigned long)user_chunk.chunk_data;
211 p->chunks[i].user_ptr = cdata; 212 p->chunks[i].user_ptr = cdata;
212 213
213 p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); 214 p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t));
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index e3d70772b531..dc29ed8145c2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -85,8 +85,6 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
85 /* We borrow the event spin lock for protecting flip_status */ 85 /* We borrow the event spin lock for protecting flip_status */
86 spin_lock_irqsave(&crtc->dev->event_lock, flags); 86 spin_lock_irqsave(&crtc->dev->event_lock, flags);
87 87
88 /* set the proper interrupt */
89 amdgpu_irq_get(adev, &adev->pageflip_irq, work->crtc_id);
90 /* do the flip (mmio) */ 88 /* do the flip (mmio) */
91 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base); 89 adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);
92 /* set the flip status */ 90 /* set the flip status */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index adb48353f2e1..b190c2a83680 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -242,11 +242,11 @@ static struct pci_device_id pciidlist[] = {
242 {0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU}, 242 {0x1002, 0x985F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_MULLINS|AMD_IS_MOBILITY|AMD_IS_APU},
243#endif 243#endif
244 /* topaz */ 244 /* topaz */
245 {0x1002, 0x6900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 245 {0x1002, 0x6900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
246 {0x1002, 0x6901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 246 {0x1002, 0x6901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
247 {0x1002, 0x6902, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 247 {0x1002, 0x6902, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
248 {0x1002, 0x6903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 248 {0x1002, 0x6903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
249 {0x1002, 0x6907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ}, 249 {0x1002, 0x6907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TOPAZ|AMD_EXP_HW_SUPPORT},
250 /* tonga */ 250 /* tonga */
251 {0x1002, 0x6920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA}, 251 {0x1002, 0x6920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
252 {0x1002, 0x6921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA}, 252 {0x1002, 0x6921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TONGA},
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 8a122b1b7786..96290d9cddca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -402,3 +402,19 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
402 return true; 402 return true;
403 return false; 403 return false;
404} 404}
405
406void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev)
407{
408 struct amdgpu_fbdev *afbdev = adev->mode_info.rfbdev;
409 struct drm_fb_helper *fb_helper;
410 int ret;
411
412 if (!afbdev)
413 return;
414
415 fb_helper = &afbdev->helper;
416
417 ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
418 if (ret)
419 DRM_DEBUG("failed to restore crtc mode\n");
420}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 8c735f544b66..5d11e798230c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -485,7 +485,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
485 * Outdated mess for old drm with Xorg being in charge (void function now). 485 * Outdated mess for old drm with Xorg being in charge (void function now).
486 */ 486 */
487/** 487/**
488 * amdgpu_driver_firstopen_kms - drm callback for last close 488 * amdgpu_driver_lastclose_kms - drm callback for last close
489 * 489 *
490 * @dev: drm dev pointer 490 * @dev: drm dev pointer
491 * 491 *
@@ -493,6 +493,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
493 */ 493 */
494void amdgpu_driver_lastclose_kms(struct drm_device *dev) 494void amdgpu_driver_lastclose_kms(struct drm_device *dev)
495{ 495{
496 struct amdgpu_device *adev = dev->dev_private;
497
498 amdgpu_fbdev_restore_mode(adev);
496 vga_switcheroo_process_delayed_switch(); 499 vga_switcheroo_process_delayed_switch();
497} 500}
498 501
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 64efe5b52e65..7bd470d9ac30 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -567,6 +567,7 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev);
567void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state); 567void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state);
568int amdgpu_fbdev_total_size(struct amdgpu_device *adev); 568int amdgpu_fbdev_total_size(struct amdgpu_device *adev);
569bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj); 569bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj);
570void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev);
570 571
571void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev); 572void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev);
572 573
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 1e14531353e0..53d551f2d839 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -455,8 +455,10 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
455 return -ENOMEM; 455 return -ENOMEM;
456 456
457 r = amdgpu_ib_get(ring, NULL, ndw * 4, ib); 457 r = amdgpu_ib_get(ring, NULL, ndw * 4, ib);
458 if (r) 458 if (r) {
459 kfree(ib);
459 return r; 460 return r;
461 }
460 ib->length_dw = 0; 462 ib->length_dw = 0;
461 463
462 /* walk over the address space and update the page directory */ 464 /* walk over the address space and update the page directory */
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
index cd6edc40c9cd..1e0bba29e167 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -1279,8 +1279,7 @@ amdgpu_atombios_encoder_setup_dig(struct drm_encoder *encoder, int action)
1279 amdgpu_atombios_encoder_setup_dig_encoder(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0); 1279 amdgpu_atombios_encoder_setup_dig_encoder(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
1280 } 1280 }
1281 if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) 1281 if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
1282 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, 1282 amdgpu_atombios_encoder_set_backlight_level(amdgpu_encoder, dig->backlight_level);
1283 ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0);
1284 if (ext_encoder) 1283 if (ext_encoder)
1285 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, ATOM_ENABLE); 1284 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, ATOM_ENABLE);
1286 } else { 1285 } else {
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 82e8d0730517..a1a35a5df8e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -6185,6 +6185,11 @@ static int ci_dpm_late_init(void *handle)
6185 if (!amdgpu_dpm) 6185 if (!amdgpu_dpm)
6186 return 0; 6186 return 0;
6187 6187
6188 /* init the sysfs and debugfs files late */
6189 ret = amdgpu_pm_sysfs_init(adev);
6190 if (ret)
6191 return ret;
6192
6188 ret = ci_set_temperature_range(adev); 6193 ret = ci_set_temperature_range(adev);
6189 if (ret) 6194 if (ret)
6190 return ret; 6195 return ret;
@@ -6232,9 +6237,6 @@ static int ci_dpm_sw_init(void *handle)
6232 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; 6237 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
6233 if (amdgpu_dpm == 1) 6238 if (amdgpu_dpm == 1)
6234 amdgpu_pm_print_power_states(adev); 6239 amdgpu_pm_print_power_states(adev);
6235 ret = amdgpu_pm_sysfs_init(adev);
6236 if (ret)
6237 goto dpm_failed;
6238 mutex_unlock(&adev->pm.mutex); 6240 mutex_unlock(&adev->pm.mutex);
6239 DRM_INFO("amdgpu: dpm initialized\n"); 6241 DRM_INFO("amdgpu: dpm initialized\n");
6240 6242
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index 4b6ce74753cd..484710cfdf82 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1567,6 +1567,9 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev)
1567 int ret, i; 1567 int ret, i;
1568 u16 tmp16; 1568 u16 tmp16;
1569 1569
1570 if (pci_is_root_bus(adev->pdev->bus))
1571 return;
1572
1570 if (amdgpu_pcie_gen2 == 0) 1573 if (amdgpu_pcie_gen2 == 0)
1571 return; 1574 return;
1572 1575
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
index 44fa96ad4709..2e3373ed4c94 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
@@ -596,6 +596,12 @@ static int cz_dpm_late_init(void *handle)
596 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 596 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
597 597
598 if (amdgpu_dpm) { 598 if (amdgpu_dpm) {
599 int ret;
600 /* init the sysfs and debugfs files late */
601 ret = amdgpu_pm_sysfs_init(adev);
602 if (ret)
603 return ret;
604
599 /* powerdown unused blocks for now */ 605 /* powerdown unused blocks for now */
600 cz_dpm_powergate_uvd(adev, true); 606 cz_dpm_powergate_uvd(adev, true);
601 cz_dpm_powergate_vce(adev, true); 607 cz_dpm_powergate_vce(adev, true);
@@ -632,10 +638,6 @@ static int cz_dpm_sw_init(void *handle)
632 if (amdgpu_dpm == 1) 638 if (amdgpu_dpm == 1)
633 amdgpu_pm_print_power_states(adev); 639 amdgpu_pm_print_power_states(adev);
634 640
635 ret = amdgpu_pm_sysfs_init(adev);
636 if (ret)
637 goto dpm_init_failed;
638
639 mutex_unlock(&adev->pm.mutex); 641 mutex_unlock(&adev->pm.mutex);
640 DRM_INFO("amdgpu: dpm initialized\n"); 642 DRM_INFO("amdgpu: dpm initialized\n");
641 643
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index e4d101b1252a..d4c82b625727 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -255,6 +255,24 @@ static u32 dce_v10_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
255 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); 255 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
256} 256}
257 257
258static void dce_v10_0_pageflip_interrupt_init(struct amdgpu_device *adev)
259{
260 unsigned i;
261
262 /* Enable pflip interrupts */
263 for (i = 0; i < adev->mode_info.num_crtc; i++)
264 amdgpu_irq_get(adev, &adev->pageflip_irq, i);
265}
266
267static void dce_v10_0_pageflip_interrupt_fini(struct amdgpu_device *adev)
268{
269 unsigned i;
270
271 /* Disable pflip interrupts */
272 for (i = 0; i < adev->mode_info.num_crtc; i++)
273 amdgpu_irq_put(adev, &adev->pageflip_irq, i);
274}
275
258/** 276/**
259 * dce_v10_0_page_flip - pageflip callback. 277 * dce_v10_0_page_flip - pageflip callback.
260 * 278 *
@@ -2663,9 +2681,10 @@ static void dce_v10_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2663 dce_v10_0_vga_enable(crtc, true); 2681 dce_v10_0_vga_enable(crtc, true);
2664 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2682 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2665 dce_v10_0_vga_enable(crtc, false); 2683 dce_v10_0_vga_enable(crtc, false);
2666 /* Make sure VBLANK interrupt is still enabled */ 2684 /* Make sure VBLANK and PFLIP interrupts are still enabled */
2667 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); 2685 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2668 amdgpu_irq_update(adev, &adev->crtc_irq, type); 2686 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2687 amdgpu_irq_update(adev, &adev->pageflip_irq, type);
2669 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2688 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2670 dce_v10_0_crtc_load_lut(crtc); 2689 dce_v10_0_crtc_load_lut(crtc);
2671 break; 2690 break;
@@ -3025,6 +3044,8 @@ static int dce_v10_0_hw_init(void *handle)
3025 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3044 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3026 } 3045 }
3027 3046
3047 dce_v10_0_pageflip_interrupt_init(adev);
3048
3028 return 0; 3049 return 0;
3029} 3050}
3030 3051
@@ -3039,6 +3060,8 @@ static int dce_v10_0_hw_fini(void *handle)
3039 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3060 dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3040 } 3061 }
3041 3062
3063 dce_v10_0_pageflip_interrupt_fini(adev);
3064
3042 return 0; 3065 return 0;
3043} 3066}
3044 3067
@@ -3050,6 +3073,8 @@ static int dce_v10_0_suspend(void *handle)
3050 3073
3051 dce_v10_0_hpd_fini(adev); 3074 dce_v10_0_hpd_fini(adev);
3052 3075
3076 dce_v10_0_pageflip_interrupt_fini(adev);
3077
3053 return 0; 3078 return 0;
3054} 3079}
3055 3080
@@ -3075,6 +3100,8 @@ static int dce_v10_0_resume(void *handle)
3075 /* initialize hpd */ 3100 /* initialize hpd */
3076 dce_v10_0_hpd_init(adev); 3101 dce_v10_0_hpd_init(adev);
3077 3102
3103 dce_v10_0_pageflip_interrupt_init(adev);
3104
3078 return 0; 3105 return 0;
3079} 3106}
3080 3107
@@ -3369,7 +3396,6 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
3369 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 3396 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
3370 3397
3371 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); 3398 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
3372 amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id);
3373 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); 3399 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work);
3374 3400
3375 return 0; 3401 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 6411e8244671..7e1cf5e4eebf 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -233,6 +233,24 @@ static u32 dce_v11_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
233 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); 233 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
234} 234}
235 235
236static void dce_v11_0_pageflip_interrupt_init(struct amdgpu_device *adev)
237{
238 unsigned i;
239
240 /* Enable pflip interrupts */
241 for (i = 0; i < adev->mode_info.num_crtc; i++)
242 amdgpu_irq_get(adev, &adev->pageflip_irq, i);
243}
244
245static void dce_v11_0_pageflip_interrupt_fini(struct amdgpu_device *adev)
246{
247 unsigned i;
248
249 /* Disable pflip interrupts */
250 for (i = 0; i < adev->mode_info.num_crtc; i++)
251 amdgpu_irq_put(adev, &adev->pageflip_irq, i);
252}
253
236/** 254/**
237 * dce_v11_0_page_flip - pageflip callback. 255 * dce_v11_0_page_flip - pageflip callback.
238 * 256 *
@@ -2640,9 +2658,10 @@ static void dce_v11_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2640 dce_v11_0_vga_enable(crtc, true); 2658 dce_v11_0_vga_enable(crtc, true);
2641 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2659 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2642 dce_v11_0_vga_enable(crtc, false); 2660 dce_v11_0_vga_enable(crtc, false);
2643 /* Make sure VBLANK interrupt is still enabled */ 2661 /* Make sure VBLANK and PFLIP interrupts are still enabled */
2644 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); 2662 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2645 amdgpu_irq_update(adev, &adev->crtc_irq, type); 2663 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2664 amdgpu_irq_update(adev, &adev->pageflip_irq, type);
2646 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2665 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2647 dce_v11_0_crtc_load_lut(crtc); 2666 dce_v11_0_crtc_load_lut(crtc);
2648 break; 2667 break;
@@ -2888,7 +2907,7 @@ static int dce_v11_0_early_init(void *handle)
2888 2907
2889 switch (adev->asic_type) { 2908 switch (adev->asic_type) {
2890 case CHIP_CARRIZO: 2909 case CHIP_CARRIZO:
2891 adev->mode_info.num_crtc = 4; 2910 adev->mode_info.num_crtc = 3;
2892 adev->mode_info.num_hpd = 6; 2911 adev->mode_info.num_hpd = 6;
2893 adev->mode_info.num_dig = 9; 2912 adev->mode_info.num_dig = 9;
2894 break; 2913 break;
@@ -3000,6 +3019,8 @@ static int dce_v11_0_hw_init(void *handle)
3000 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3019 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3001 } 3020 }
3002 3021
3022 dce_v11_0_pageflip_interrupt_init(adev);
3023
3003 return 0; 3024 return 0;
3004} 3025}
3005 3026
@@ -3014,6 +3035,8 @@ static int dce_v11_0_hw_fini(void *handle)
3014 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 3035 dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
3015 } 3036 }
3016 3037
3038 dce_v11_0_pageflip_interrupt_fini(adev);
3039
3017 return 0; 3040 return 0;
3018} 3041}
3019 3042
@@ -3025,6 +3048,8 @@ static int dce_v11_0_suspend(void *handle)
3025 3048
3026 dce_v11_0_hpd_fini(adev); 3049 dce_v11_0_hpd_fini(adev);
3027 3050
3051 dce_v11_0_pageflip_interrupt_fini(adev);
3052
3028 return 0; 3053 return 0;
3029} 3054}
3030 3055
@@ -3051,6 +3076,8 @@ static int dce_v11_0_resume(void *handle)
3051 /* initialize hpd */ 3076 /* initialize hpd */
3052 dce_v11_0_hpd_init(adev); 3077 dce_v11_0_hpd_init(adev);
3053 3078
3079 dce_v11_0_pageflip_interrupt_init(adev);
3080
3054 return 0; 3081 return 0;
3055} 3082}
3056 3083
@@ -3345,7 +3372,6 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
3345 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 3372 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
3346 3373
3347 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); 3374 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
3348 amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id);
3349 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); 3375 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work);
3350 3376
3351 return 0; 3377 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index c86911c2ea2a..34b9c2a9d8d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -204,6 +204,24 @@ static u32 dce_v8_0_vblank_get_counter(struct amdgpu_device *adev, int crtc)
204 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); 204 return RREG32(mmCRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]);
205} 205}
206 206
207static void dce_v8_0_pageflip_interrupt_init(struct amdgpu_device *adev)
208{
209 unsigned i;
210
211 /* Enable pflip interrupts */
212 for (i = 0; i < adev->mode_info.num_crtc; i++)
213 amdgpu_irq_get(adev, &adev->pageflip_irq, i);
214}
215
216static void dce_v8_0_pageflip_interrupt_fini(struct amdgpu_device *adev)
217{
218 unsigned i;
219
220 /* Disable pflip interrupts */
221 for (i = 0; i < adev->mode_info.num_crtc; i++)
222 amdgpu_irq_put(adev, &adev->pageflip_irq, i);
223}
224
207/** 225/**
208 * dce_v8_0_page_flip - pageflip callback. 226 * dce_v8_0_page_flip - pageflip callback.
209 * 227 *
@@ -2575,9 +2593,10 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2575 dce_v8_0_vga_enable(crtc, true); 2593 dce_v8_0_vga_enable(crtc, true);
2576 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2594 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2577 dce_v8_0_vga_enable(crtc, false); 2595 dce_v8_0_vga_enable(crtc, false);
2578 /* Make sure VBLANK interrupt is still enabled */ 2596 /* Make sure VBLANK and PFLIP interrupts are still enabled */
2579 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id); 2597 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2580 amdgpu_irq_update(adev, &adev->crtc_irq, type); 2598 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2599 amdgpu_irq_update(adev, &adev->pageflip_irq, type);
2581 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2600 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2582 dce_v8_0_crtc_load_lut(crtc); 2601 dce_v8_0_crtc_load_lut(crtc);
2583 break; 2602 break;
@@ -2933,6 +2952,8 @@ static int dce_v8_0_hw_init(void *handle)
2933 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 2952 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
2934 } 2953 }
2935 2954
2955 dce_v8_0_pageflip_interrupt_init(adev);
2956
2936 return 0; 2957 return 0;
2937} 2958}
2938 2959
@@ -2947,6 +2968,8 @@ static int dce_v8_0_hw_fini(void *handle)
2947 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false); 2968 dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
2948 } 2969 }
2949 2970
2971 dce_v8_0_pageflip_interrupt_fini(adev);
2972
2950 return 0; 2973 return 0;
2951} 2974}
2952 2975
@@ -2958,6 +2981,8 @@ static int dce_v8_0_suspend(void *handle)
2958 2981
2959 dce_v8_0_hpd_fini(adev); 2982 dce_v8_0_hpd_fini(adev);
2960 2983
2984 dce_v8_0_pageflip_interrupt_fini(adev);
2985
2961 return 0; 2986 return 0;
2962} 2987}
2963 2988
@@ -2981,6 +3006,8 @@ static int dce_v8_0_resume(void *handle)
2981 /* initialize hpd */ 3006 /* initialize hpd */
2982 dce_v8_0_hpd_init(adev); 3007 dce_v8_0_hpd_init(adev);
2983 3008
3009 dce_v8_0_pageflip_interrupt_init(adev);
3010
2984 return 0; 3011 return 0;
2985} 3012}
2986 3013
@@ -3376,7 +3403,6 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
3376 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 3403 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
3377 3404
3378 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); 3405 drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
3379 amdgpu_irq_put(adev, &adev->pageflip_irq, crtc_id);
3380 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work); 3406 queue_work(amdgpu_crtc->pflip_queue, &works->unpin_work);
3381 3407
3382 return 0; 3408 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 774528ab8704..fab5471d25d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -1262,6 +1262,12 @@ static int gmc_v7_0_process_interrupt(struct amdgpu_device *adev,
1262 addr = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_ADDR); 1262 addr = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_ADDR);
1263 status = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_STATUS); 1263 status = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_STATUS);
1264 mc_client = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); 1264 mc_client = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_MCCLIENT);
1265 /* reset addr and status */
1266 WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1);
1267
1268 if (!addr && !status)
1269 return 0;
1270
1265 dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n", 1271 dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n",
1266 entry->src_id, entry->src_data); 1272 entry->src_id, entry->src_data);
1267 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", 1273 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
@@ -1269,8 +1275,6 @@ static int gmc_v7_0_process_interrupt(struct amdgpu_device *adev,
1269 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 1275 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
1270 status); 1276 status);
1271 gmc_v7_0_vm_decode_fault(adev, status, addr, mc_client); 1277 gmc_v7_0_vm_decode_fault(adev, status, addr, mc_client);
1272 /* reset addr and status */
1273 WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1);
1274 1278
1275 return 0; 1279 return 0;
1276} 1280}
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 9a07742620d0..7bc9e9fcf3d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1262,6 +1262,12 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
1262 addr = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_ADDR); 1262 addr = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_ADDR);
1263 status = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_STATUS); 1263 status = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_STATUS);
1264 mc_client = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); 1264 mc_client = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_MCCLIENT);
1265 /* reset addr and status */
1266 WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1);
1267
1268 if (!addr && !status)
1269 return 0;
1270
1265 dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n", 1271 dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n",
1266 entry->src_id, entry->src_data); 1272 entry->src_id, entry->src_data);
1267 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", 1273 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
@@ -1269,8 +1275,6 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
1269 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 1275 dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
1270 status); 1276 status);
1271 gmc_v8_0_vm_decode_fault(adev, status, addr, mc_client); 1277 gmc_v8_0_vm_decode_fault(adev, status, addr, mc_client);
1272 /* reset addr and status */
1273 WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1);
1274 1278
1275 return 0; 1279 return 0;
1276} 1280}
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index 94ec04a9c4d5..9745ed3a9aef 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -2995,6 +2995,12 @@ static int kv_dpm_late_init(void *handle)
2995{ 2995{
2996 /* powerdown unused blocks for now */ 2996 /* powerdown unused blocks for now */
2997 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2997 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
2998 int ret;
2999
3000 /* init the sysfs and debugfs files late */
3001 ret = amdgpu_pm_sysfs_init(adev);
3002 if (ret)
3003 return ret;
2998 3004
2999 kv_dpm_powergate_acp(adev, true); 3005 kv_dpm_powergate_acp(adev, true);
3000 kv_dpm_powergate_samu(adev, true); 3006 kv_dpm_powergate_samu(adev, true);
@@ -3038,9 +3044,6 @@ static int kv_dpm_sw_init(void *handle)
3038 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; 3044 adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
3039 if (amdgpu_dpm == 1) 3045 if (amdgpu_dpm == 1)
3040 amdgpu_pm_print_power_states(adev); 3046 amdgpu_pm_print_power_states(adev);
3041 ret = amdgpu_pm_sysfs_init(adev);
3042 if (ret)
3043 goto dpm_failed;
3044 mutex_unlock(&adev->pm.mutex); 3047 mutex_unlock(&adev->pm.mutex);
3045 DRM_INFO("amdgpu: dpm initialized\n"); 3048 DRM_INFO("amdgpu: dpm initialized\n");
3046 3049
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index b55ceb14fdcd..0bac8702e934 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -1005,6 +1005,9 @@ static void vi_pcie_gen3_enable(struct amdgpu_device *adev)
1005 u32 mask; 1005 u32 mask;
1006 int ret; 1006 int ret;
1007 1007
1008 if (pci_is_root_bus(adev->pdev->bus))
1009 return;
1010
1008 if (amdgpu_pcie_gen2 == 0) 1011 if (amdgpu_pcie_gen2 == 0)
1009 return; 1012 return;
1010 1013
diff --git a/drivers/gpu/drm/amd/include/cgs_linux.h b/drivers/gpu/drm/amd/include/cgs_linux.h
index 488642f08267..3b47ae313e36 100644
--- a/drivers/gpu/drm/amd/include/cgs_linux.h
+++ b/drivers/gpu/drm/amd/include/cgs_linux.h
@@ -27,19 +27,6 @@
27#include "cgs_common.h" 27#include "cgs_common.h"
28 28
29/** 29/**
30 * cgs_import_gpu_mem() - Import dmabuf handle
31 * @cgs_device: opaque device handle
32 * @dmabuf_fd: DMABuf file descriptor
33 * @handle: memory handle (output)
34 *
35 * Must be called in the process context that dmabuf_fd belongs to.
36 *
37 * Return: 0 on success, -errno otherwise
38 */
39typedef int (*cgs_import_gpu_mem_t)(void *cgs_device, int dmabuf_fd,
40 cgs_handle_t *handle);
41
42/**
43 * cgs_irq_source_set_func() - Callback for enabling/disabling interrupt sources 30 * cgs_irq_source_set_func() - Callback for enabling/disabling interrupt sources
44 * @private_data: private data provided to cgs_add_irq_source 31 * @private_data: private data provided to cgs_add_irq_source
45 * @src_id: interrupt source ID 32 * @src_id: interrupt source ID
@@ -114,16 +101,12 @@ typedef int (*cgs_irq_get_t)(void *cgs_device, unsigned src_id, unsigned type);
114typedef int (*cgs_irq_put_t)(void *cgs_device, unsigned src_id, unsigned type); 101typedef int (*cgs_irq_put_t)(void *cgs_device, unsigned src_id, unsigned type);
115 102
116struct cgs_os_ops { 103struct cgs_os_ops {
117 cgs_import_gpu_mem_t import_gpu_mem;
118
119 /* IRQ handling */ 104 /* IRQ handling */
120 cgs_add_irq_source_t add_irq_source; 105 cgs_add_irq_source_t add_irq_source;
121 cgs_irq_get_t irq_get; 106 cgs_irq_get_t irq_get;
122 cgs_irq_put_t irq_put; 107 cgs_irq_put_t irq_put;
123}; 108};
124 109
125#define cgs_import_gpu_mem(dev,dmabuf_fd,handle) \
126 CGS_OS_CALL(import_gpu_mem,dev,dmabuf_fd,handle)
127#define cgs_add_irq_source(dev,src_id,num_types,set,handler,private_data) \ 110#define cgs_add_irq_source(dev,src_id,num_types,set,handler,private_data) \
128 CGS_OS_CALL(add_irq_source,dev,src_id,num_types,set,handler, \ 111 CGS_OS_CALL(add_irq_source,dev,src_id,num_types,set,handler, \
129 private_data) 112 private_data)
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index e23df5fd3836..5bca390d9ae2 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -53,8 +53,8 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
53 struct drm_dp_mst_port *port, 53 struct drm_dp_mst_port *port,
54 int offset, int size, u8 *bytes); 54 int offset, int size, u8 *bytes);
55 55
56static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, 56static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
57 struct drm_dp_mst_branch *mstb); 57 struct drm_dp_mst_branch *mstb);
58static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, 58static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
59 struct drm_dp_mst_branch *mstb, 59 struct drm_dp_mst_branch *mstb,
60 struct drm_dp_mst_port *port); 60 struct drm_dp_mst_port *port);
@@ -804,8 +804,6 @@ static void drm_dp_destroy_mst_branch_device(struct kref *kref)
804 struct drm_dp_mst_port *port, *tmp; 804 struct drm_dp_mst_port *port, *tmp;
805 bool wake_tx = false; 805 bool wake_tx = false;
806 806
807 cancel_work_sync(&mstb->mgr->work);
808
809 /* 807 /*
810 * destroy all ports - don't need lock 808 * destroy all ports - don't need lock
811 * as there are no more references to the mst branch 809 * as there are no more references to the mst branch
@@ -863,29 +861,33 @@ static void drm_dp_destroy_port(struct kref *kref)
863{ 861{
864 struct drm_dp_mst_port *port = container_of(kref, struct drm_dp_mst_port, kref); 862 struct drm_dp_mst_port *port = container_of(kref, struct drm_dp_mst_port, kref);
865 struct drm_dp_mst_topology_mgr *mgr = port->mgr; 863 struct drm_dp_mst_topology_mgr *mgr = port->mgr;
864
866 if (!port->input) { 865 if (!port->input) {
867 port->vcpi.num_slots = 0; 866 port->vcpi.num_slots = 0;
868 867
869 kfree(port->cached_edid); 868 kfree(port->cached_edid);
870 869
871 /* we can't destroy the connector here, as 870 /*
872 we might be holding the mode_config.mutex 871 * The only time we don't have a connector
873 from an EDID retrieval */ 872 * on an output port is if the connector init
873 * fails.
874 */
874 if (port->connector) { 875 if (port->connector) {
876 /* we can't destroy the connector here, as
877 * we might be holding the mode_config.mutex
878 * from an EDID retrieval */
879
875 mutex_lock(&mgr->destroy_connector_lock); 880 mutex_lock(&mgr->destroy_connector_lock);
876 list_add(&port->next, &mgr->destroy_connector_list); 881 list_add(&port->next, &mgr->destroy_connector_list);
877 mutex_unlock(&mgr->destroy_connector_lock); 882 mutex_unlock(&mgr->destroy_connector_lock);
878 schedule_work(&mgr->destroy_connector_work); 883 schedule_work(&mgr->destroy_connector_work);
879 return; 884 return;
880 } 885 }
886 /* no need to clean up vcpi
887 * as if we have no connector we never setup a vcpi */
881 drm_dp_port_teardown_pdt(port, port->pdt); 888 drm_dp_port_teardown_pdt(port, port->pdt);
882
883 if (!port->input && port->vcpi.vcpi > 0)
884 drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi);
885 } 889 }
886 kfree(port); 890 kfree(port);
887
888 (*mgr->cbs->hotplug)(mgr);
889} 891}
890 892
891static void drm_dp_put_port(struct drm_dp_mst_port *port) 893static void drm_dp_put_port(struct drm_dp_mst_port *port)
@@ -1027,8 +1029,8 @@ static void drm_dp_check_port_guid(struct drm_dp_mst_branch *mstb,
1027 } 1029 }
1028} 1030}
1029 1031
1030static void build_mst_prop_path(struct drm_dp_mst_port *port, 1032static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
1031 struct drm_dp_mst_branch *mstb, 1033 int pnum,
1032 char *proppath, 1034 char *proppath,
1033 size_t proppath_size) 1035 size_t proppath_size)
1034{ 1036{
@@ -1041,7 +1043,7 @@ static void build_mst_prop_path(struct drm_dp_mst_port *port,
1041 snprintf(temp, sizeof(temp), "-%d", port_num); 1043 snprintf(temp, sizeof(temp), "-%d", port_num);
1042 strlcat(proppath, temp, proppath_size); 1044 strlcat(proppath, temp, proppath_size);
1043 } 1045 }
1044 snprintf(temp, sizeof(temp), "-%d", port->port_num); 1046 snprintf(temp, sizeof(temp), "-%d", pnum);
1045 strlcat(proppath, temp, proppath_size); 1047 strlcat(proppath, temp, proppath_size);
1046} 1048}
1047 1049
@@ -1105,22 +1107,32 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
1105 drm_dp_port_teardown_pdt(port, old_pdt); 1107 drm_dp_port_teardown_pdt(port, old_pdt);
1106 1108
1107 ret = drm_dp_port_setup_pdt(port); 1109 ret = drm_dp_port_setup_pdt(port);
1108 if (ret == true) { 1110 if (ret == true)
1109 drm_dp_send_link_address(mstb->mgr, port->mstb); 1111 drm_dp_send_link_address(mstb->mgr, port->mstb);
1110 port->mstb->link_address_sent = true;
1111 }
1112 } 1112 }
1113 1113
1114 if (created && !port->input) { 1114 if (created && !port->input) {
1115 char proppath[255]; 1115 char proppath[255];
1116 build_mst_prop_path(port, mstb, proppath, sizeof(proppath));
1117 port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath);
1118 1116
1119 if (port->port_num >= 8) { 1117 build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
1118 port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath);
1119 if (!port->connector) {
1120 /* remove it from the port list */
1121 mutex_lock(&mstb->mgr->lock);
1122 list_del(&port->next);
1123 mutex_unlock(&mstb->mgr->lock);
1124 /* drop port list reference */
1125 drm_dp_put_port(port);
1126 goto out;
1127 }
1128 if (port->port_num >= DP_MST_LOGICAL_PORT_0) {
1120 port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); 1129 port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc);
1130 drm_mode_connector_set_tile_property(port->connector);
1121 } 1131 }
1132 (*mstb->mgr->cbs->register_connector)(port->connector);
1122 } 1133 }
1123 1134
1135out:
1124 /* put reference to this port */ 1136 /* put reference to this port */
1125 drm_dp_put_port(port); 1137 drm_dp_put_port(port);
1126} 1138}
@@ -1202,10 +1214,9 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m
1202{ 1214{
1203 struct drm_dp_mst_port *port; 1215 struct drm_dp_mst_port *port;
1204 struct drm_dp_mst_branch *mstb_child; 1216 struct drm_dp_mst_branch *mstb_child;
1205 if (!mstb->link_address_sent) { 1217 if (!mstb->link_address_sent)
1206 drm_dp_send_link_address(mgr, mstb); 1218 drm_dp_send_link_address(mgr, mstb);
1207 mstb->link_address_sent = true; 1219
1208 }
1209 list_for_each_entry(port, &mstb->ports, next) { 1220 list_for_each_entry(port, &mstb->ports, next) {
1210 if (port->input) 1221 if (port->input)
1211 continue; 1222 continue;
@@ -1458,8 +1469,8 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
1458 mutex_unlock(&mgr->qlock); 1469 mutex_unlock(&mgr->qlock);
1459} 1470}
1460 1471
1461static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, 1472static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
1462 struct drm_dp_mst_branch *mstb) 1473 struct drm_dp_mst_branch *mstb)
1463{ 1474{
1464 int len; 1475 int len;
1465 struct drm_dp_sideband_msg_tx *txmsg; 1476 struct drm_dp_sideband_msg_tx *txmsg;
@@ -1467,11 +1478,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
1467 1478
1468 txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); 1479 txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
1469 if (!txmsg) 1480 if (!txmsg)
1470 return -ENOMEM; 1481 return;
1471 1482
1472 txmsg->dst = mstb; 1483 txmsg->dst = mstb;
1473 len = build_link_address(txmsg); 1484 len = build_link_address(txmsg);
1474 1485
1486 mstb->link_address_sent = true;
1475 drm_dp_queue_down_tx(mgr, txmsg); 1487 drm_dp_queue_down_tx(mgr, txmsg);
1476 1488
1477 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); 1489 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
@@ -1499,11 +1511,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
1499 } 1511 }
1500 (*mgr->cbs->hotplug)(mgr); 1512 (*mgr->cbs->hotplug)(mgr);
1501 } 1513 }
1502 } else 1514 } else {
1515 mstb->link_address_sent = false;
1503 DRM_DEBUG_KMS("link address failed %d\n", ret); 1516 DRM_DEBUG_KMS("link address failed %d\n", ret);
1517 }
1504 1518
1505 kfree(txmsg); 1519 kfree(txmsg);
1506 return 0;
1507} 1520}
1508 1521
1509static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, 1522static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
@@ -1978,6 +1991,8 @@ void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr)
1978 drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 1991 drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL,
1979 DP_MST_EN | DP_UPSTREAM_IS_SRC); 1992 DP_MST_EN | DP_UPSTREAM_IS_SRC);
1980 mutex_unlock(&mgr->lock); 1993 mutex_unlock(&mgr->lock);
1994 flush_work(&mgr->work);
1995 flush_work(&mgr->destroy_connector_work);
1981} 1996}
1982EXPORT_SYMBOL(drm_dp_mst_topology_mgr_suspend); 1997EXPORT_SYMBOL(drm_dp_mst_topology_mgr_suspend);
1983 1998
@@ -2263,10 +2278,10 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
2263 2278
2264 if (port->cached_edid) 2279 if (port->cached_edid)
2265 edid = drm_edid_duplicate(port->cached_edid); 2280 edid = drm_edid_duplicate(port->cached_edid);
2266 else 2281 else {
2267 edid = drm_get_edid(connector, &port->aux.ddc); 2282 edid = drm_get_edid(connector, &port->aux.ddc);
2268 2283 drm_mode_connector_set_tile_property(connector);
2269 drm_mode_connector_set_tile_property(connector); 2284 }
2270 drm_dp_put_port(port); 2285 drm_dp_put_port(port);
2271 return edid; 2286 return edid;
2272} 2287}
@@ -2671,7 +2686,7 @@ static void drm_dp_destroy_connector_work(struct work_struct *work)
2671{ 2686{
2672 struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); 2687 struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work);
2673 struct drm_dp_mst_port *port; 2688 struct drm_dp_mst_port *port;
2674 2689 bool send_hotplug = false;
2675 /* 2690 /*
2676 * Not a regular list traverse as we have to drop the destroy 2691 * Not a regular list traverse as we have to drop the destroy
2677 * connector lock before destroying the connector, to avoid AB->BA 2692 * connector lock before destroying the connector, to avoid AB->BA
@@ -2694,7 +2709,10 @@ static void drm_dp_destroy_connector_work(struct work_struct *work)
2694 if (!port->input && port->vcpi.vcpi > 0) 2709 if (!port->input && port->vcpi.vcpi > 0)
2695 drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi); 2710 drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi);
2696 kfree(port); 2711 kfree(port);
2712 send_hotplug = true;
2697 } 2713 }
2714 if (send_hotplug)
2715 (*mgr->cbs->hotplug)(mgr);
2698} 2716}
2699 2717
2700/** 2718/**
@@ -2747,6 +2765,7 @@ EXPORT_SYMBOL(drm_dp_mst_topology_mgr_init);
2747 */ 2765 */
2748void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr) 2766void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr)
2749{ 2767{
2768 flush_work(&mgr->work);
2750 flush_work(&mgr->destroy_connector_work); 2769 flush_work(&mgr->destroy_connector_work);
2751 mutex_lock(&mgr->payload_lock); 2770 mutex_lock(&mgr->payload_lock);
2752 kfree(mgr->payloads); 2771 kfree(mgr->payloads);
@@ -2782,12 +2801,13 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs
2782 if (msgs[num - 1].flags & I2C_M_RD) 2801 if (msgs[num - 1].flags & I2C_M_RD)
2783 reading = true; 2802 reading = true;
2784 2803
2785 if (!reading) { 2804 if (!reading || (num - 1 > DP_REMOTE_I2C_READ_MAX_TRANSACTIONS)) {
2786 DRM_DEBUG_KMS("Unsupported I2C transaction for MST device\n"); 2805 DRM_DEBUG_KMS("Unsupported I2C transaction for MST device\n");
2787 ret = -EIO; 2806 ret = -EIO;
2788 goto out; 2807 goto out;
2789 } 2808 }
2790 2809
2810 memset(&msg, 0, sizeof(msg));
2791 msg.req_type = DP_REMOTE_I2C_READ; 2811 msg.req_type = DP_REMOTE_I2C_READ;
2792 msg.u.i2c_read.num_transactions = num - 1; 2812 msg.u.i2c_read.num_transactions = num - 1;
2793 msg.u.i2c_read.port_number = port->port_num; 2813 msg.u.i2c_read.port_number = port->port_num;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 418d299f3b12..ca08c472311b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
345 struct drm_crtc *crtc = mode_set->crtc; 345 struct drm_crtc *crtc = mode_set->crtc;
346 int ret; 346 int ret;
347 347
348 if (crtc->funcs->cursor_set) { 348 if (crtc->funcs->cursor_set2) {
349 ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
350 if (ret)
351 error = true;
352 } else if (crtc->funcs->cursor_set) {
349 ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0); 353 ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
350 if (ret) 354 if (ret)
351 error = true; 355 error = true;
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index d734780b31c0..a18164f2f6d2 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -94,7 +94,18 @@ static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
94} 94}
95 95
96#define DRM_OUTPUT_POLL_PERIOD (10*HZ) 96#define DRM_OUTPUT_POLL_PERIOD (10*HZ)
97static void __drm_kms_helper_poll_enable(struct drm_device *dev) 97/**
98 * drm_kms_helper_poll_enable_locked - re-enable output polling.
99 * @dev: drm_device
100 *
101 * This function re-enables the output polling work without
102 * locking the mode_config mutex.
103 *
104 * This is like drm_kms_helper_poll_enable() however it is to be
105 * called from a context where the mode_config mutex is locked
106 * already.
107 */
108void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
98{ 109{
99 bool poll = false; 110 bool poll = false;
100 struct drm_connector *connector; 111 struct drm_connector *connector;
@@ -113,6 +124,8 @@ static void __drm_kms_helper_poll_enable(struct drm_device *dev)
113 if (poll) 124 if (poll)
114 schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); 125 schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD);
115} 126}
127EXPORT_SYMBOL(drm_kms_helper_poll_enable_locked);
128
116 129
117static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connector *connector, 130static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connector *connector,
118 uint32_t maxX, uint32_t maxY, bool merge_type_bits) 131 uint32_t maxX, uint32_t maxY, bool merge_type_bits)
@@ -174,7 +187,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
174 187
175 /* Re-enable polling in case the global poll config changed. */ 188 /* Re-enable polling in case the global poll config changed. */
176 if (drm_kms_helper_poll != dev->mode_config.poll_running) 189 if (drm_kms_helper_poll != dev->mode_config.poll_running)
177 __drm_kms_helper_poll_enable(dev); 190 drm_kms_helper_poll_enable_locked(dev);
178 191
179 dev->mode_config.poll_running = drm_kms_helper_poll; 192 dev->mode_config.poll_running = drm_kms_helper_poll;
180 193
@@ -428,7 +441,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_disable);
428void drm_kms_helper_poll_enable(struct drm_device *dev) 441void drm_kms_helper_poll_enable(struct drm_device *dev)
429{ 442{
430 mutex_lock(&dev->mode_config.mutex); 443 mutex_lock(&dev->mode_config.mutex);
431 __drm_kms_helper_poll_enable(dev); 444 drm_kms_helper_poll_enable_locked(dev);
432 mutex_unlock(&dev->mode_config.mutex); 445 mutex_unlock(&dev->mode_config.mutex);
433} 446}
434EXPORT_SYMBOL(drm_kms_helper_poll_enable); 447EXPORT_SYMBOL(drm_kms_helper_poll_enable);
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 0f6cd33b531f..684bd4a13843 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -235,18 +235,12 @@ static ssize_t dpms_show(struct device *device,
235 char *buf) 235 char *buf)
236{ 236{
237 struct drm_connector *connector = to_drm_connector(device); 237 struct drm_connector *connector = to_drm_connector(device);
238 struct drm_device *dev = connector->dev; 238 int dpms;
239 uint64_t dpms_status;
240 int ret;
241 239
242 ret = drm_object_property_get_value(&connector->base, 240 dpms = READ_ONCE(connector->dpms);
243 dev->mode_config.dpms_property,
244 &dpms_status);
245 if (ret)
246 return 0;
247 241
248 return snprintf(buf, PAGE_SIZE, "%s\n", 242 return snprintf(buf, PAGE_SIZE, "%s\n",
249 drm_get_dpms_name((int)dpms_status)); 243 drm_get_dpms_name(dpms));
250} 244}
251 245
252static ssize_t enabled_show(struct device *device, 246static ssize_t enabled_show(struct device *device,
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index cbdb78ef3bac..e6cbaca821a4 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -37,7 +37,6 @@
37 * DECON stands for Display and Enhancement controller. 37 * DECON stands for Display and Enhancement controller.
38 */ 38 */
39 39
40#define DECON_DEFAULT_FRAMERATE 60
41#define MIN_FB_WIDTH_FOR_16WORD_BURST 128 40#define MIN_FB_WIDTH_FOR_16WORD_BURST 128
42 41
43#define WINDOWS_NR 2 42#define WINDOWS_NR 2
@@ -165,16 +164,6 @@ static u32 decon_calc_clkdiv(struct decon_context *ctx,
165 return (clkdiv < 0x100) ? clkdiv : 0xff; 164 return (clkdiv < 0x100) ? clkdiv : 0xff;
166} 165}
167 166
168static bool decon_mode_fixup(struct exynos_drm_crtc *crtc,
169 const struct drm_display_mode *mode,
170 struct drm_display_mode *adjusted_mode)
171{
172 if (adjusted_mode->vrefresh == 0)
173 adjusted_mode->vrefresh = DECON_DEFAULT_FRAMERATE;
174
175 return true;
176}
177
178static void decon_commit(struct exynos_drm_crtc *crtc) 167static void decon_commit(struct exynos_drm_crtc *crtc)
179{ 168{
180 struct decon_context *ctx = crtc->ctx; 169 struct decon_context *ctx = crtc->ctx;
@@ -637,7 +626,6 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
637static const struct exynos_drm_crtc_ops decon_crtc_ops = { 626static const struct exynos_drm_crtc_ops decon_crtc_ops = {
638 .enable = decon_enable, 627 .enable = decon_enable,
639 .disable = decon_disable, 628 .disable = decon_disable,
640 .mode_fixup = decon_mode_fixup,
641 .commit = decon_commit, 629 .commit = decon_commit,
642 .enable_vblank = decon_enable_vblank, 630 .enable_vblank = decon_enable_vblank,
643 .disable_vblank = decon_disable_vblank, 631 .disable_vblank = decon_disable_vblank,
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index d66ade0efac8..124fb9a56f02 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1383,28 +1383,6 @@ static int exynos_dp_remove(struct platform_device *pdev)
1383 return 0; 1383 return 0;
1384} 1384}
1385 1385
1386#ifdef CONFIG_PM_SLEEP
1387static int exynos_dp_suspend(struct device *dev)
1388{
1389 struct exynos_dp_device *dp = dev_get_drvdata(dev);
1390
1391 exynos_dp_disable(&dp->encoder);
1392 return 0;
1393}
1394
1395static int exynos_dp_resume(struct device *dev)
1396{
1397 struct exynos_dp_device *dp = dev_get_drvdata(dev);
1398
1399 exynos_dp_enable(&dp->encoder);
1400 return 0;
1401}
1402#endif
1403
1404static const struct dev_pm_ops exynos_dp_pm_ops = {
1405 SET_SYSTEM_SLEEP_PM_OPS(exynos_dp_suspend, exynos_dp_resume)
1406};
1407
1408static const struct of_device_id exynos_dp_match[] = { 1386static const struct of_device_id exynos_dp_match[] = {
1409 { .compatible = "samsung,exynos5-dp" }, 1387 { .compatible = "samsung,exynos5-dp" },
1410 {}, 1388 {},
@@ -1417,7 +1395,6 @@ struct platform_driver dp_driver = {
1417 .driver = { 1395 .driver = {
1418 .name = "exynos-dp", 1396 .name = "exynos-dp",
1419 .owner = THIS_MODULE, 1397 .owner = THIS_MODULE,
1420 .pm = &exynos_dp_pm_ops,
1421 .of_match_table = exynos_dp_match, 1398 .of_match_table = exynos_dp_match,
1422 }, 1399 },
1423}; 1400};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c
index c68a6a2a9b57..7f55ba6771c6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -28,7 +28,6 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv)
28 28
29 return 0; 29 return 0;
30} 30}
31EXPORT_SYMBOL_GPL(exynos_drm_subdrv_register);
32 31
33int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv) 32int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv)
34{ 33{
@@ -39,7 +38,6 @@ int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv)
39 38
40 return 0; 39 return 0;
41} 40}
42EXPORT_SYMBOL_GPL(exynos_drm_subdrv_unregister);
43 41
44int exynos_drm_device_subdrv_probe(struct drm_device *dev) 42int exynos_drm_device_subdrv_probe(struct drm_device *dev)
45{ 43{
@@ -69,7 +67,6 @@ int exynos_drm_device_subdrv_probe(struct drm_device *dev)
69 67
70 return 0; 68 return 0;
71} 69}
72EXPORT_SYMBOL_GPL(exynos_drm_device_subdrv_probe);
73 70
74int exynos_drm_device_subdrv_remove(struct drm_device *dev) 71int exynos_drm_device_subdrv_remove(struct drm_device *dev)
75{ 72{
@@ -87,7 +84,6 @@ int exynos_drm_device_subdrv_remove(struct drm_device *dev)
87 84
88 return 0; 85 return 0;
89} 86}
90EXPORT_SYMBOL_GPL(exynos_drm_device_subdrv_remove);
91 87
92int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) 88int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file)
93{ 89{
@@ -111,7 +107,6 @@ err:
111 } 107 }
112 return ret; 108 return ret;
113} 109}
114EXPORT_SYMBOL_GPL(exynos_drm_subdrv_open);
115 110
116void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) 111void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file)
117{ 112{
@@ -122,4 +117,3 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file)
122 subdrv->close(dev, subdrv->dev, file); 117 subdrv->close(dev, subdrv->dev, file);
123 } 118 }
124} 119}
125EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0872aa2f450f..ed28823d3b35 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -41,20 +41,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
41 exynos_crtc->ops->disable(exynos_crtc); 41 exynos_crtc->ops->disable(exynos_crtc);
42} 42}
43 43
44static bool
45exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
46 const struct drm_display_mode *mode,
47 struct drm_display_mode *adjusted_mode)
48{
49 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
50
51 if (exynos_crtc->ops->mode_fixup)
52 return exynos_crtc->ops->mode_fixup(exynos_crtc, mode,
53 adjusted_mode);
54
55 return true;
56}
57
58static void 44static void
59exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) 45exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
60{ 46{
@@ -99,7 +85,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
99static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { 85static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
100 .enable = exynos_drm_crtc_enable, 86 .enable = exynos_drm_crtc_enable,
101 .disable = exynos_drm_crtc_disable, 87 .disable = exynos_drm_crtc_disable,
102 .mode_fixup = exynos_drm_crtc_mode_fixup,
103 .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, 88 .mode_set_nofb = exynos_drm_crtc_mode_set_nofb,
104 .atomic_begin = exynos_crtc_atomic_begin, 89 .atomic_begin = exynos_crtc_atomic_begin,
105 .atomic_flush = exynos_crtc_atomic_flush, 90 .atomic_flush = exynos_crtc_atomic_flush,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 831d2e4cacf9..ae9e6b2d3758 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -304,6 +304,7 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
304 return 0; 304 return 0;
305} 305}
306 306
307#ifdef CONFIG_PM_SLEEP
307static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state) 308static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state)
308{ 309{
309 struct drm_connector *connector; 310 struct drm_connector *connector;
@@ -340,6 +341,7 @@ static int exynos_drm_resume(struct drm_device *dev)
340 341
341 return 0; 342 return 0;
342} 343}
344#endif
343 345
344static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) 346static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
345{ 347{
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index b7ba21dfb696..6c717ba672db 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -82,7 +82,6 @@ struct exynos_drm_plane {
82 * 82 *
83 * @enable: enable the device 83 * @enable: enable the device
84 * @disable: disable the device 84 * @disable: disable the device
85 * @mode_fixup: fix mode data before applying it
86 * @commit: set current hw specific display mode to hw. 85 * @commit: set current hw specific display mode to hw.
87 * @enable_vblank: specific driver callback for enabling vblank interrupt. 86 * @enable_vblank: specific driver callback for enabling vblank interrupt.
88 * @disable_vblank: specific driver callback for disabling vblank interrupt. 87 * @disable_vblank: specific driver callback for disabling vblank interrupt.
@@ -103,9 +102,6 @@ struct exynos_drm_crtc;
103struct exynos_drm_crtc_ops { 102struct exynos_drm_crtc_ops {
104 void (*enable)(struct exynos_drm_crtc *crtc); 103 void (*enable)(struct exynos_drm_crtc *crtc);
105 void (*disable)(struct exynos_drm_crtc *crtc); 104 void (*disable)(struct exynos_drm_crtc *crtc);
106 bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
107 const struct drm_display_mode *mode,
108 struct drm_display_mode *adjusted_mode);
109 void (*commit)(struct exynos_drm_crtc *crtc); 105 void (*commit)(struct exynos_drm_crtc *crtc);
110 int (*enable_vblank)(struct exynos_drm_crtc *crtc); 106 int (*enable_vblank)(struct exynos_drm_crtc *crtc);
111 void (*disable_vblank)(struct exynos_drm_crtc *crtc); 107 void (*disable_vblank)(struct exynos_drm_crtc *crtc);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 2a652359af64..dd3a5e6d58c8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -1206,23 +1206,6 @@ static struct exynos_drm_ipp_ops fimc_dst_ops = {
1206 .set_addr = fimc_dst_set_addr, 1206 .set_addr = fimc_dst_set_addr,
1207}; 1207};
1208 1208
1209static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable)
1210{
1211 DRM_DEBUG_KMS("enable[%d]\n", enable);
1212
1213 if (enable) {
1214 clk_prepare_enable(ctx->clocks[FIMC_CLK_GATE]);
1215 clk_prepare_enable(ctx->clocks[FIMC_CLK_WB_A]);
1216 ctx->suspended = false;
1217 } else {
1218 clk_disable_unprepare(ctx->clocks[FIMC_CLK_GATE]);
1219 clk_disable_unprepare(ctx->clocks[FIMC_CLK_WB_A]);
1220 ctx->suspended = true;
1221 }
1222
1223 return 0;
1224}
1225
1226static irqreturn_t fimc_irq_handler(int irq, void *dev_id) 1209static irqreturn_t fimc_irq_handler(int irq, void *dev_id)
1227{ 1210{
1228 struct fimc_context *ctx = dev_id; 1211 struct fimc_context *ctx = dev_id;
@@ -1780,6 +1763,24 @@ static int fimc_remove(struct platform_device *pdev)
1780 return 0; 1763 return 0;
1781} 1764}
1782 1765
1766#ifdef CONFIG_PM
1767static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable)
1768{
1769 DRM_DEBUG_KMS("enable[%d]\n", enable);
1770
1771 if (enable) {
1772 clk_prepare_enable(ctx->clocks[FIMC_CLK_GATE]);
1773 clk_prepare_enable(ctx->clocks[FIMC_CLK_WB_A]);
1774 ctx->suspended = false;
1775 } else {
1776 clk_disable_unprepare(ctx->clocks[FIMC_CLK_GATE]);
1777 clk_disable_unprepare(ctx->clocks[FIMC_CLK_WB_A]);
1778 ctx->suspended = true;
1779 }
1780
1781 return 0;
1782}
1783
1783#ifdef CONFIG_PM_SLEEP 1784#ifdef CONFIG_PM_SLEEP
1784static int fimc_suspend(struct device *dev) 1785static int fimc_suspend(struct device *dev)
1785{ 1786{
@@ -1806,7 +1807,6 @@ static int fimc_resume(struct device *dev)
1806} 1807}
1807#endif 1808#endif
1808 1809
1809#ifdef CONFIG_PM
1810static int fimc_runtime_suspend(struct device *dev) 1810static int fimc_runtime_suspend(struct device *dev)
1811{ 1811{
1812 struct fimc_context *ctx = get_fimc_context(dev); 1812 struct fimc_context *ctx = get_fimc_context(dev);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 750a9e6b9e8d..3d1aba67758b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -41,7 +41,6 @@
41 * CPU Interface. 41 * CPU Interface.
42 */ 42 */
43 43
44#define FIMD_DEFAULT_FRAMERATE 60
45#define MIN_FB_WIDTH_FOR_16WORD_BURST 128 44#define MIN_FB_WIDTH_FOR_16WORD_BURST 128
46 45
47/* position control register for hardware window 0, 2 ~ 4.*/ 46/* position control register for hardware window 0, 2 ~ 4.*/
@@ -377,16 +376,6 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
377 return (clkdiv < 0x100) ? clkdiv : 0xff; 376 return (clkdiv < 0x100) ? clkdiv : 0xff;
378} 377}
379 378
380static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc,
381 const struct drm_display_mode *mode,
382 struct drm_display_mode *adjusted_mode)
383{
384 if (adjusted_mode->vrefresh == 0)
385 adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
386
387 return true;
388}
389
390static void fimd_commit(struct exynos_drm_crtc *crtc) 379static void fimd_commit(struct exynos_drm_crtc *crtc)
391{ 380{
392 struct fimd_context *ctx = crtc->ctx; 381 struct fimd_context *ctx = crtc->ctx;
@@ -882,13 +871,12 @@ static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable)
882 return; 871 return;
883 872
884 val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; 873 val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
885 writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); 874 writel(val, ctx->regs + DP_MIE_CLKCON);
886} 875}
887 876
888static const struct exynos_drm_crtc_ops fimd_crtc_ops = { 877static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
889 .enable = fimd_enable, 878 .enable = fimd_enable,
890 .disable = fimd_disable, 879 .disable = fimd_disable,
891 .mode_fixup = fimd_mode_fixup,
892 .commit = fimd_commit, 880 .commit = fimd_commit,
893 .enable_vblank = fimd_enable_vblank, 881 .enable_vblank = fimd_enable_vblank,
894 .disable_vblank = fimd_disable_vblank, 882 .disable_vblank = fimd_disable_vblank,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 3734c34aed16..c17efdb238a6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1059,7 +1059,6 @@ int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, void *data,
1059 1059
1060 return 0; 1060 return 0;
1061} 1061}
1062EXPORT_SYMBOL_GPL(exynos_g2d_get_ver_ioctl);
1063 1062
1064int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, 1063int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
1065 struct drm_file *file) 1064 struct drm_file *file)
@@ -1230,7 +1229,6 @@ err:
1230 g2d_put_cmdlist(g2d, node); 1229 g2d_put_cmdlist(g2d, node);
1231 return ret; 1230 return ret;
1232} 1231}
1233EXPORT_SYMBOL_GPL(exynos_g2d_set_cmdlist_ioctl);
1234 1232
1235int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, 1233int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
1236 struct drm_file *file) 1234 struct drm_file *file)
@@ -1293,7 +1291,6 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
1293out: 1291out:
1294 return 0; 1292 return 0;
1295} 1293}
1296EXPORT_SYMBOL_GPL(exynos_g2d_exec_ioctl);
1297 1294
1298static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev) 1295static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
1299{ 1296{
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index f12fbc36b120..407afedb6003 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -56,39 +56,35 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem_obj *obj)
56 nr_pages = obj->size >> PAGE_SHIFT; 56 nr_pages = obj->size >> PAGE_SHIFT;
57 57
58 if (!is_drm_iommu_supported(dev)) { 58 if (!is_drm_iommu_supported(dev)) {
59 dma_addr_t start_addr;
60 unsigned int i = 0;
61
62 obj->pages = drm_calloc_large(nr_pages, sizeof(struct page *)); 59 obj->pages = drm_calloc_large(nr_pages, sizeof(struct page *));
63 if (!obj->pages) { 60 if (!obj->pages) {
64 DRM_ERROR("failed to allocate pages.\n"); 61 DRM_ERROR("failed to allocate pages.\n");
65 return -ENOMEM; 62 return -ENOMEM;
66 } 63 }
64 }
67 65
68 obj->cookie = dma_alloc_attrs(dev->dev, 66 obj->cookie = dma_alloc_attrs(dev->dev, obj->size, &obj->dma_addr,
69 obj->size, 67 GFP_KERNEL, &obj->dma_attrs);
70 &obj->dma_addr, GFP_KERNEL, 68 if (!obj->cookie) {
71 &obj->dma_attrs); 69 DRM_ERROR("failed to allocate buffer.\n");
72 if (!obj->cookie) { 70 if (obj->pages)
73 DRM_ERROR("failed to allocate buffer.\n");
74 drm_free_large(obj->pages); 71 drm_free_large(obj->pages);
75 return -ENOMEM; 72 return -ENOMEM;
76 } 73 }
74
75 if (obj->pages) {
76 dma_addr_t start_addr;
77 unsigned int i = 0;
77 78
78 start_addr = obj->dma_addr; 79 start_addr = obj->dma_addr;
79 while (i < nr_pages) { 80 while (i < nr_pages) {
80 obj->pages[i] = phys_to_page(start_addr); 81 obj->pages[i] = pfn_to_page(dma_to_pfn(dev->dev,
82 start_addr));
81 start_addr += PAGE_SIZE; 83 start_addr += PAGE_SIZE;
82 i++; 84 i++;
83 } 85 }
84 } else { 86 } else {
85 obj->pages = dma_alloc_attrs(dev->dev, obj->size, 87 obj->pages = obj->cookie;
86 &obj->dma_addr, GFP_KERNEL,
87 &obj->dma_attrs);
88 if (!obj->pages) {
89 DRM_ERROR("failed to allocate buffer.\n");
90 return -ENOMEM;
91 }
92 } 88 }
93 89
94 DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", 90 DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n",
@@ -110,15 +106,11 @@ static void exynos_drm_free_buf(struct exynos_drm_gem_obj *obj)
110 DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", 106 DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n",
111 (unsigned long)obj->dma_addr, obj->size); 107 (unsigned long)obj->dma_addr, obj->size);
112 108
113 if (!is_drm_iommu_supported(dev)) { 109 dma_free_attrs(dev->dev, obj->size, obj->cookie,
114 dma_free_attrs(dev->dev, obj->size, obj->cookie, 110 (dma_addr_t)obj->dma_addr, &obj->dma_attrs);
115 (dma_addr_t)obj->dma_addr, &obj->dma_attrs);
116 drm_free_large(obj->pages);
117 } else
118 dma_free_attrs(dev->dev, obj->size, obj->pages,
119 (dma_addr_t)obj->dma_addr, &obj->dma_attrs);
120 111
121 obj->dma_addr = (dma_addr_t)NULL; 112 if (!is_drm_iommu_supported(dev))
113 drm_free_large(obj->pages);
122} 114}
123 115
124static int exynos_drm_gem_handle_create(struct drm_gem_object *obj, 116static int exynos_drm_gem_handle_create(struct drm_gem_object *obj,
@@ -156,18 +148,14 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem_obj *exynos_gem_obj)
156 * once dmabuf's refcount becomes 0. 148 * once dmabuf's refcount becomes 0.
157 */ 149 */
158 if (obj->import_attach) 150 if (obj->import_attach)
159 goto out; 151 drm_prime_gem_destroy(obj, exynos_gem_obj->sgt);
160 152 else
161 exynos_drm_free_buf(exynos_gem_obj); 153 exynos_drm_free_buf(exynos_gem_obj);
162
163out:
164 drm_gem_free_mmap_offset(obj);
165 154
166 /* release file pointer to gem object. */ 155 /* release file pointer to gem object. */
167 drm_gem_object_release(obj); 156 drm_gem_object_release(obj);
168 157
169 kfree(exynos_gem_obj); 158 kfree(exynos_gem_obj);
170 exynos_gem_obj = NULL;
171} 159}
172 160
173unsigned long exynos_drm_gem_get_size(struct drm_device *dev, 161unsigned long exynos_drm_gem_get_size(struct drm_device *dev,
@@ -190,8 +178,7 @@ unsigned long exynos_drm_gem_get_size(struct drm_device *dev,
190 return exynos_gem_obj->size; 178 return exynos_gem_obj->size;
191} 179}
192 180
193 181static struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev,
194struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev,
195 unsigned long size) 182 unsigned long size)
196{ 183{
197 struct exynos_drm_gem_obj *exynos_gem_obj; 184 struct exynos_drm_gem_obj *exynos_gem_obj;
@@ -212,6 +199,13 @@ struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev,
212 return ERR_PTR(ret); 199 return ERR_PTR(ret);
213 } 200 }
214 201
202 ret = drm_gem_create_mmap_offset(obj);
203 if (ret < 0) {
204 drm_gem_object_release(obj);
205 kfree(exynos_gem_obj);
206 return ERR_PTR(ret);
207 }
208
215 DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); 209 DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp);
216 210
217 return exynos_gem_obj; 211 return exynos_gem_obj;
@@ -313,7 +307,7 @@ void exynos_drm_gem_put_dma_addr(struct drm_device *dev,
313 drm_gem_object_unreference_unlocked(obj); 307 drm_gem_object_unreference_unlocked(obj);
314} 308}
315 309
316int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem_obj *exynos_gem_obj, 310static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem_obj *exynos_gem_obj,
317 struct vm_area_struct *vma) 311 struct vm_area_struct *vma)
318{ 312{
319 struct drm_device *drm_dev = exynos_gem_obj->base.dev; 313 struct drm_device *drm_dev = exynos_gem_obj->base.dev;
@@ -342,7 +336,8 @@ int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem_obj *exynos_gem_obj,
342 336
343int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, 337int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
344 struct drm_file *file_priv) 338 struct drm_file *file_priv)
345{ struct exynos_drm_gem_obj *exynos_gem_obj; 339{
340 struct exynos_drm_gem_obj *exynos_gem_obj;
346 struct drm_exynos_gem_info *args = data; 341 struct drm_exynos_gem_info *args = data;
347 struct drm_gem_object *obj; 342 struct drm_gem_object *obj;
348 343
@@ -402,6 +397,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv,
402 struct drm_mode_create_dumb *args) 397 struct drm_mode_create_dumb *args)
403{ 398{
404 struct exynos_drm_gem_obj *exynos_gem_obj; 399 struct exynos_drm_gem_obj *exynos_gem_obj;
400 unsigned int flags;
405 int ret; 401 int ret;
406 402
407 /* 403 /*
@@ -413,16 +409,12 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv,
413 args->pitch = args->width * ((args->bpp + 7) / 8); 409 args->pitch = args->width * ((args->bpp + 7) / 8);
414 args->size = args->pitch * args->height; 410 args->size = args->pitch * args->height;
415 411
416 if (is_drm_iommu_supported(dev)) { 412 if (is_drm_iommu_supported(dev))
417 exynos_gem_obj = exynos_drm_gem_create(dev, 413 flags = EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC;
418 EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC, 414 else
419 args->size); 415 flags = EXYNOS_BO_CONTIG | EXYNOS_BO_WC;
420 } else {
421 exynos_gem_obj = exynos_drm_gem_create(dev,
422 EXYNOS_BO_CONTIG | EXYNOS_BO_WC,
423 args->size);
424 }
425 416
417 exynos_gem_obj = exynos_drm_gem_create(dev, flags, args->size);
426 if (IS_ERR(exynos_gem_obj)) { 418 if (IS_ERR(exynos_gem_obj)) {
427 dev_warn(dev->dev, "FB allocation failed.\n"); 419 dev_warn(dev->dev, "FB allocation failed.\n");
428 return PTR_ERR(exynos_gem_obj); 420 return PTR_ERR(exynos_gem_obj);
@@ -460,14 +452,9 @@ int exynos_drm_gem_dumb_map_offset(struct drm_file *file_priv,
460 goto unlock; 452 goto unlock;
461 } 453 }
462 454
463 ret = drm_gem_create_mmap_offset(obj);
464 if (ret)
465 goto out;
466
467 *offset = drm_vma_node_offset_addr(&obj->vma_node); 455 *offset = drm_vma_node_offset_addr(&obj->vma_node);
468 DRM_DEBUG_KMS("offset = 0x%lx\n", (unsigned long)*offset); 456 DRM_DEBUG_KMS("offset = 0x%lx\n", (unsigned long)*offset);
469 457
470out:
471 drm_gem_object_unreference(obj); 458 drm_gem_object_unreference(obj);
472unlock: 459unlock:
473 mutex_unlock(&dev->struct_mutex); 460 mutex_unlock(&dev->struct_mutex);
@@ -543,7 +530,6 @@ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
543 530
544err_close_vm: 531err_close_vm:
545 drm_gem_vm_close(vma); 532 drm_gem_vm_close(vma);
546 drm_gem_free_mmap_offset(obj);
547 533
548 return ret; 534 return ret;
549} 535}
@@ -588,6 +574,8 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
588 if (ret < 0) 574 if (ret < 0)
589 goto err_free_large; 575 goto err_free_large;
590 576
577 exynos_gem_obj->sgt = sgt;
578
591 if (sgt->nents == 1) { 579 if (sgt->nents == 1) {
592 /* always physically continuous memory if sgt->nents is 1. */ 580 /* always physically continuous memory if sgt->nents is 1. */
593 exynos_gem_obj->flags |= EXYNOS_BO_CONTIG; 581 exynos_gem_obj->flags |= EXYNOS_BO_CONTIG;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h
index cd62f8410d1e..b62d1007c0e0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
@@ -39,6 +39,7 @@
39 * - this address could be physical address without IOMMU and 39 * - this address could be physical address without IOMMU and
40 * device address with IOMMU. 40 * device address with IOMMU.
41 * @pages: Array of backing pages. 41 * @pages: Array of backing pages.
42 * @sgt: Imported sg_table.
42 * 43 *
43 * P.S. this object would be transferred to user as kms_bo.handle so 44 * P.S. this object would be transferred to user as kms_bo.handle so
44 * user can access the buffer through kms_bo.handle. 45 * user can access the buffer through kms_bo.handle.
@@ -52,6 +53,7 @@ struct exynos_drm_gem_obj {
52 dma_addr_t dma_addr; 53 dma_addr_t dma_addr;
53 struct dma_attrs dma_attrs; 54 struct dma_attrs dma_attrs;
54 struct page **pages; 55 struct page **pages;
56 struct sg_table *sgt;
55}; 57};
56 58
57struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); 59struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
@@ -59,10 +61,6 @@ struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
59/* destroy a buffer with gem object */ 61/* destroy a buffer with gem object */
60void exynos_drm_gem_destroy(struct exynos_drm_gem_obj *exynos_gem_obj); 62void exynos_drm_gem_destroy(struct exynos_drm_gem_obj *exynos_gem_obj);
61 63
62/* create a private gem object and initialize it. */
63struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev,
64 unsigned long size);
65
66/* create a new buffer with gem object */ 64/* create a new buffer with gem object */
67struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, 65struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev,
68 unsigned int flags, 66 unsigned int flags,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index 425e70625388..2f5c118f4c8e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -786,6 +786,7 @@ static int rotator_remove(struct platform_device *pdev)
786 return 0; 786 return 0;
787} 787}
788 788
789#ifdef CONFIG_PM
789static int rotator_clk_crtl(struct rot_context *rot, bool enable) 790static int rotator_clk_crtl(struct rot_context *rot, bool enable)
790{ 791{
791 if (enable) { 792 if (enable) {
@@ -822,7 +823,6 @@ static int rotator_resume(struct device *dev)
822} 823}
823#endif 824#endif
824 825
825#ifdef CONFIG_PM
826static int rotator_runtime_suspend(struct device *dev) 826static int rotator_runtime_suspend(struct device *dev)
827{ 827{
828 struct rot_context *rot = dev_get_drvdata(dev); 828 struct rot_context *rot = dev_get_drvdata(dev);
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 3e4be5a3becd..6ade06888432 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -462,11 +462,17 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
462 drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0); 462 drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
463 463
464 drm_mode_connector_set_path_property(connector, pathprop); 464 drm_mode_connector_set_path_property(connector, pathprop);
465 return connector;
466}
467
468static void intel_dp_register_mst_connector(struct drm_connector *connector)
469{
470 struct intel_connector *intel_connector = to_intel_connector(connector);
471 struct drm_device *dev = connector->dev;
465 drm_modeset_lock_all(dev); 472 drm_modeset_lock_all(dev);
466 intel_connector_add_to_fbdev(intel_connector); 473 intel_connector_add_to_fbdev(intel_connector);
467 drm_modeset_unlock_all(dev); 474 drm_modeset_unlock_all(dev);
468 drm_connector_register(&intel_connector->base); 475 drm_connector_register(&intel_connector->base);
469 return connector;
470} 476}
471 477
472static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, 478static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
@@ -512,6 +518,7 @@ static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
512 518
513static struct drm_dp_mst_topology_cbs mst_cbs = { 519static struct drm_dp_mst_topology_cbs mst_cbs = {
514 .add_connector = intel_dp_add_mst_connector, 520 .add_connector = intel_dp_add_mst_connector,
521 .register_connector = intel_dp_register_mst_connector,
515 .destroy_connector = intel_dp_destroy_mst_connector, 522 .destroy_connector = intel_dp_destroy_mst_connector,
516 .hotplug = intel_dp_mst_hotplug, 523 .hotplug = intel_dp_mst_hotplug,
517}; 524};
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 53c0173a39fe..b17785719598 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -180,7 +180,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
180 180
181 /* Enable polling and queue hotplug re-enabling. */ 181 /* Enable polling and queue hotplug re-enabling. */
182 if (hpd_disabled) { 182 if (hpd_disabled) {
183 drm_kms_helper_poll_enable(dev); 183 drm_kms_helper_poll_enable_locked(dev);
184 mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work, 184 mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work,
185 msecs_to_jiffies(HPD_STORM_REENABLE_DELAY)); 185 msecs_to_jiffies(HPD_STORM_REENABLE_DELAY));
186 } 186 }
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 72e0edd7bbde..7412caedcf7f 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -484,18 +484,18 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
484 status_pointer = I915_READ(RING_CONTEXT_STATUS_PTR(ring)); 484 status_pointer = I915_READ(RING_CONTEXT_STATUS_PTR(ring));
485 485
486 read_pointer = ring->next_context_status_buffer; 486 read_pointer = ring->next_context_status_buffer;
487 write_pointer = status_pointer & 0x07; 487 write_pointer = status_pointer & GEN8_CSB_PTR_MASK;
488 if (read_pointer > write_pointer) 488 if (read_pointer > write_pointer)
489 write_pointer += 6; 489 write_pointer += GEN8_CSB_ENTRIES;
490 490
491 spin_lock(&ring->execlist_lock); 491 spin_lock(&ring->execlist_lock);
492 492
493 while (read_pointer < write_pointer) { 493 while (read_pointer < write_pointer) {
494 read_pointer++; 494 read_pointer++;
495 status = I915_READ(RING_CONTEXT_STATUS_BUF(ring) + 495 status = I915_READ(RING_CONTEXT_STATUS_BUF(ring) +
496 (read_pointer % 6) * 8); 496 (read_pointer % GEN8_CSB_ENTRIES) * 8);
497 status_id = I915_READ(RING_CONTEXT_STATUS_BUF(ring) + 497 status_id = I915_READ(RING_CONTEXT_STATUS_BUF(ring) +
498 (read_pointer % 6) * 8 + 4); 498 (read_pointer % GEN8_CSB_ENTRIES) * 8 + 4);
499 499
500 if (status & GEN8_CTX_STATUS_IDLE_ACTIVE) 500 if (status & GEN8_CTX_STATUS_IDLE_ACTIVE)
501 continue; 501 continue;
@@ -521,10 +521,12 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
521 spin_unlock(&ring->execlist_lock); 521 spin_unlock(&ring->execlist_lock);
522 522
523 WARN(submit_contexts > 2, "More than two context complete events?\n"); 523 WARN(submit_contexts > 2, "More than two context complete events?\n");
524 ring->next_context_status_buffer = write_pointer % 6; 524 ring->next_context_status_buffer = write_pointer % GEN8_CSB_ENTRIES;
525 525
526 I915_WRITE(RING_CONTEXT_STATUS_PTR(ring), 526 I915_WRITE(RING_CONTEXT_STATUS_PTR(ring),
527 _MASKED_FIELD(0x07 << 8, ((u32)ring->next_context_status_buffer & 0x07) << 8)); 527 _MASKED_FIELD(GEN8_CSB_PTR_MASK << 8,
528 ((u32)ring->next_context_status_buffer &
529 GEN8_CSB_PTR_MASK) << 8));
528} 530}
529 531
530static int execlists_context_queue(struct drm_i915_gem_request *request) 532static int execlists_context_queue(struct drm_i915_gem_request *request)
@@ -1422,6 +1424,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *ring)
1422{ 1424{
1423 struct drm_device *dev = ring->dev; 1425 struct drm_device *dev = ring->dev;
1424 struct drm_i915_private *dev_priv = dev->dev_private; 1426 struct drm_i915_private *dev_priv = dev->dev_private;
1427 u8 next_context_status_buffer_hw;
1425 1428
1426 I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask)); 1429 I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask));
1427 I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff); 1430 I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff);
@@ -1436,7 +1439,29 @@ static int gen8_init_common_ring(struct intel_engine_cs *ring)
1436 _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) | 1439 _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) |
1437 _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE)); 1440 _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE));
1438 POSTING_READ(RING_MODE_GEN7(ring)); 1441 POSTING_READ(RING_MODE_GEN7(ring));
1439 ring->next_context_status_buffer = 0; 1442
1443 /*
1444 * Instead of resetting the Context Status Buffer (CSB) read pointer to
1445 * zero, we need to read the write pointer from hardware and use its
1446 * value because "this register is power context save restored".
1447 * Effectively, these states have been observed:
1448 *
1449 * | Suspend-to-idle (freeze) | Suspend-to-RAM (mem) |
1450 * BDW | CSB regs not reset | CSB regs reset |
1451 * CHT | CSB regs not reset | CSB regs not reset |
1452 */
1453 next_context_status_buffer_hw = (I915_READ(RING_CONTEXT_STATUS_PTR(ring))
1454 & GEN8_CSB_PTR_MASK);
1455
1456 /*
1457 * When the CSB registers are reset (also after power-up / gpu reset),
1458 * CSB write pointer is set to all 1's, which is not valid, use '5' in
1459 * this special case, so the first element read is CSB[0].
1460 */
1461 if (next_context_status_buffer_hw == GEN8_CSB_PTR_MASK)
1462 next_context_status_buffer_hw = (GEN8_CSB_ENTRIES - 1);
1463
1464 ring->next_context_status_buffer = next_context_status_buffer_hw;
1440 DRM_DEBUG_DRIVER("Execlists enabled for %s\n", ring->name); 1465 DRM_DEBUG_DRIVER("Execlists enabled for %s\n", ring->name);
1441 1466
1442 memset(&ring->hangcheck, 0, sizeof(ring->hangcheck)); 1467 memset(&ring->hangcheck, 0, sizeof(ring->hangcheck));
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index 64f89f9982a2..3c63bb32ad81 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -25,6 +25,8 @@
25#define _INTEL_LRC_H_ 25#define _INTEL_LRC_H_
26 26
27#define GEN8_LR_CONTEXT_ALIGN 4096 27#define GEN8_LR_CONTEXT_ALIGN 4096
28#define GEN8_CSB_ENTRIES 6
29#define GEN8_CSB_PTR_MASK 0x07
28 30
29/* Execlists regs */ 31/* Execlists regs */
30#define RING_ELSP(ring) ((ring)->mmio_base+0x230) 32#define RING_ELSP(ring) ((ring)->mmio_base+0x230)
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index af7fdb3bd663..7401cf90b0db 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -246,7 +246,8 @@ static void skl_power_well_post_enable(struct drm_i915_private *dev_priv,
246 } 246 }
247 247
248 if (power_well->data == SKL_DISP_PW_1) { 248 if (power_well->data == SKL_DISP_PW_1) {
249 intel_prepare_ddi(dev); 249 if (!dev_priv->power_domains.initializing)
250 intel_prepare_ddi(dev);
250 gen8_irq_power_well_post_enable(dev_priv, 1 << PIPE_A); 251 gen8_irq_power_well_post_enable(dev_priv, 1 << PIPE_A);
251 } 252 }
252} 253}
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index cc6c228e11c8..e905c00acf1a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -469,9 +469,13 @@ nouveau_display_create(struct drm_device *dev)
469 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) { 469 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
470 dev->mode_config.max_width = 4096; 470 dev->mode_config.max_width = 4096;
471 dev->mode_config.max_height = 4096; 471 dev->mode_config.max_height = 4096;
472 } else { 472 } else
473 if (drm->device.info.family < NV_DEVICE_INFO_V0_FERMI) {
473 dev->mode_config.max_width = 8192; 474 dev->mode_config.max_width = 8192;
474 dev->mode_config.max_height = 8192; 475 dev->mode_config.max_height = 8192;
476 } else {
477 dev->mode_config.max_width = 16384;
478 dev->mode_config.max_height = 16384;
475 } 479 }
476 480
477 dev->mode_config.preferred_depth = 24; 481 dev->mode_config.preferred_depth = 24;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 2791701685dc..59f27e774acb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -178,8 +178,30 @@ nouveau_fbcon_sync(struct fb_info *info)
178 return 0; 178 return 0;
179} 179}
180 180
181static int
182nouveau_fbcon_open(struct fb_info *info, int user)
183{
184 struct nouveau_fbdev *fbcon = info->par;
185 struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
186 int ret = pm_runtime_get_sync(drm->dev->dev);
187 if (ret < 0 && ret != -EACCES)
188 return ret;
189 return 0;
190}
191
192static int
193nouveau_fbcon_release(struct fb_info *info, int user)
194{
195 struct nouveau_fbdev *fbcon = info->par;
196 struct nouveau_drm *drm = nouveau_drm(fbcon->dev);
197 pm_runtime_put(drm->dev->dev);
198 return 0;
199}
200
181static struct fb_ops nouveau_fbcon_ops = { 201static struct fb_ops nouveau_fbcon_ops = {
182 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
203 .fb_open = nouveau_fbcon_open,
204 .fb_release = nouveau_fbcon_release,
183 .fb_check_var = drm_fb_helper_check_var, 205 .fb_check_var = drm_fb_helper_check_var,
184 .fb_set_par = drm_fb_helper_set_par, 206 .fb_set_par = drm_fb_helper_set_par,
185 .fb_fillrect = nouveau_fbcon_fillrect, 207 .fb_fillrect = nouveau_fbcon_fillrect,
@@ -195,6 +217,8 @@ static struct fb_ops nouveau_fbcon_ops = {
195 217
196static struct fb_ops nouveau_fbcon_sw_ops = { 218static struct fb_ops nouveau_fbcon_sw_ops = {
197 .owner = THIS_MODULE, 219 .owner = THIS_MODULE,
220 .fb_open = nouveau_fbcon_open,
221 .fb_release = nouveau_fbcon_release,
198 .fb_check_var = drm_fb_helper_check_var, 222 .fb_check_var = drm_fb_helper_check_var,
199 .fb_set_par = drm_fb_helper_set_par, 223 .fb_set_par = drm_fb_helper_set_par,
200 .fb_fillrect = drm_fb_helper_cfb_fillrect, 224 .fb_fillrect = drm_fb_helper_cfb_fillrect,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
index 65af31441e9c..a7d69ce7abc1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
@@ -267,6 +267,12 @@ init_i2c(struct nvbios_init *init, int index)
267 index = NVKM_I2C_BUS_PRI; 267 index = NVKM_I2C_BUS_PRI;
268 if (init->outp && init->outp->i2c_upper_default) 268 if (init->outp && init->outp->i2c_upper_default)
269 index = NVKM_I2C_BUS_SEC; 269 index = NVKM_I2C_BUS_SEC;
270 } else
271 if (index == 0x80) {
272 index = NVKM_I2C_BUS_PRI;
273 } else
274 if (index == 0x81) {
275 index = NVKM_I2C_BUS_SEC;
270 } 276 }
271 277
272 bus = nvkm_i2c_bus_find(i2c, index); 278 bus = nvkm_i2c_bus_find(i2c, index);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
index e0ec2a6b7b79..212800ecdce9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
@@ -8,7 +8,10 @@ struct nvbios_source {
8 void *(*init)(struct nvkm_bios *, const char *); 8 void *(*init)(struct nvkm_bios *, const char *);
9 void (*fini)(void *); 9 void (*fini)(void *);
10 u32 (*read)(void *, u32 offset, u32 length, struct nvkm_bios *); 10 u32 (*read)(void *, u32 offset, u32 length, struct nvkm_bios *);
11 u32 (*size)(void *);
11 bool rw; 12 bool rw;
13 bool ignore_checksum;
14 bool no_pcir;
12}; 15};
13 16
14int nvbios_extend(struct nvkm_bios *, u32 length); 17int nvbios_extend(struct nvkm_bios *, u32 length);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
index 792f017525f6..b2557e87afdd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
@@ -45,7 +45,7 @@ shadow_fetch(struct nvkm_bios *bios, struct shadow *mthd, u32 upto)
45 u32 read = mthd->func->read(data, start, limit - start, bios); 45 u32 read = mthd->func->read(data, start, limit - start, bios);
46 bios->size = start + read; 46 bios->size = start + read;
47 } 47 }
48 return bios->size >= limit; 48 return bios->size >= upto;
49} 49}
50 50
51static int 51static int
@@ -55,14 +55,22 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
55 struct nvbios_image image; 55 struct nvbios_image image;
56 int score = 1; 56 int score = 1;
57 57
58 if (!shadow_fetch(bios, mthd, offset + 0x1000)) { 58 if (mthd->func->no_pcir) {
59 nvkm_debug(subdev, "%08x: header fetch failed\n", offset); 59 image.base = 0;
60 return 0; 60 image.type = 0;
61 } 61 image.size = mthd->func->size(mthd->data);
62 image.last = 1;
63 } else {
64 if (!shadow_fetch(bios, mthd, offset + 0x1000)) {
65 nvkm_debug(subdev, "%08x: header fetch failed\n",
66 offset);
67 return 0;
68 }
62 69
63 if (!nvbios_image(bios, idx, &image)) { 70 if (!nvbios_image(bios, idx, &image)) {
64 nvkm_debug(subdev, "image %d invalid\n", idx); 71 nvkm_debug(subdev, "image %d invalid\n", idx);
65 return 0; 72 return 0;
73 }
66 } 74 }
67 nvkm_debug(subdev, "%08x: type %02x, %d bytes\n", 75 nvkm_debug(subdev, "%08x: type %02x, %d bytes\n",
68 image.base, image.type, image.size); 76 image.base, image.type, image.size);
@@ -74,7 +82,8 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
74 82
75 switch (image.type) { 83 switch (image.type) {
76 case 0x00: 84 case 0x00:
77 if (nvbios_checksum(&bios->data[image.base], image.size)) { 85 if (!mthd->func->ignore_checksum &&
86 nvbios_checksum(&bios->data[image.base], image.size)) {
78 nvkm_debug(subdev, "%08x: checksum failed\n", 87 nvkm_debug(subdev, "%08x: checksum failed\n",
79 image.base); 88 image.base);
80 if (mthd->func->rw) 89 if (mthd->func->rw)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
index bd60d7dd09f5..4bf486b57101 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
@@ -21,6 +21,7 @@
21 * 21 *
22 */ 22 */
23#include "priv.h" 23#include "priv.h"
24
24#include <core/pci.h> 25#include <core/pci.h>
25 26
26#if defined(__powerpc__) 27#if defined(__powerpc__)
@@ -33,17 +34,26 @@ static u32
33of_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios) 34of_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
34{ 35{
35 struct priv *priv = data; 36 struct priv *priv = data;
36 if (offset + length <= priv->size) { 37 if (offset < priv->size) {
38 length = min_t(u32, length, priv->size - offset);
37 memcpy_fromio(bios->data + offset, priv->data + offset, length); 39 memcpy_fromio(bios->data + offset, priv->data + offset, length);
38 return length; 40 return length;
39 } 41 }
40 return 0; 42 return 0;
41} 43}
42 44
45static u32
46of_size(void *data)
47{
48 struct priv *priv = data;
49 return priv->size;
50}
51
43static void * 52static void *
44of_init(struct nvkm_bios *bios, const char *name) 53of_init(struct nvkm_bios *bios, const char *name)
45{ 54{
46 struct pci_dev *pdev = bios->subdev.device->func->pci(bios->subdev.device)->pdev; 55 struct nvkm_device *device = bios->subdev.device;
56 struct pci_dev *pdev = device->func->pci(device)->pdev;
47 struct device_node *dn; 57 struct device_node *dn;
48 struct priv *priv; 58 struct priv *priv;
49 if (!(dn = pci_device_to_OF_node(pdev))) 59 if (!(dn = pci_device_to_OF_node(pdev)))
@@ -62,7 +72,10 @@ nvbios_of = {
62 .init = of_init, 72 .init = of_init,
63 .fini = (void(*)(void *))kfree, 73 .fini = (void(*)(void *))kfree,
64 .read = of_read, 74 .read = of_read,
75 .size = of_size,
65 .rw = false, 76 .rw = false,
77 .ignore_checksum = true,
78 .no_pcir = true,
66}; 79};
67#else 80#else
68const struct nvbios_source 81const struct nvbios_source
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
index 814cb51cc873..385a90f91ed6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
@@ -35,6 +35,8 @@ static const struct nvkm_device_agp_quirk
35nvkm_device_agp_quirks[] = { 35nvkm_device_agp_quirks[] = {
36 /* VIA Apollo PRO133x / GeForce FX 5600 Ultra - fdo#20341 */ 36 /* VIA Apollo PRO133x / GeForce FX 5600 Ultra - fdo#20341 */
37 { PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 }, 37 { PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 },
38 /* SiS 761 does not support AGP cards, use PCI mode */
39 { PCI_VENDOR_ID_SI, 0x0761, PCI_ANY_ID, PCI_ANY_ID, 0 },
38 {}, 40 {},
39}; 41};
40 42
@@ -137,8 +139,10 @@ nvkm_agp_ctor(struct nvkm_pci *pci)
137 while (quirk->hostbridge_vendor) { 139 while (quirk->hostbridge_vendor) {
138 if (info.device->vendor == quirk->hostbridge_vendor && 140 if (info.device->vendor == quirk->hostbridge_vendor &&
139 info.device->device == quirk->hostbridge_device && 141 info.device->device == quirk->hostbridge_device &&
140 pci->pdev->vendor == quirk->chip_vendor && 142 (quirk->chip_vendor == (u16)PCI_ANY_ID ||
141 pci->pdev->device == quirk->chip_device) { 143 pci->pdev->vendor == quirk->chip_vendor) &&
144 (quirk->chip_device == (u16)PCI_ANY_ID ||
145 pci->pdev->device == quirk->chip_device)) {
142 nvkm_info(subdev, "forcing default agp mode to %dX, " 146 nvkm_info(subdev, "forcing default agp mode to %dX, "
143 "use NvAGP=<mode> to override\n", 147 "use NvAGP=<mode> to override\n",
144 quirk->mode); 148 quirk->mode);
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index dd845f82cc24..183aea1abebc 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -244,6 +244,10 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
244 ret = qxl_bo_reserve(bo, false); 244 ret = qxl_bo_reserve(bo, false);
245 if (ret) 245 if (ret)
246 return ret; 246 return ret;
247 ret = qxl_bo_pin(bo, bo->type, NULL);
248 qxl_bo_unreserve(bo);
249 if (ret)
250 return ret;
247 251
248 qxl_draw_dirty_fb(qdev, qfb_src, bo, 0, 0, 252 qxl_draw_dirty_fb(qdev, qfb_src, bo, 0, 0,
249 &norect, one_clip_rect, inc); 253 &norect, one_clip_rect, inc);
@@ -257,7 +261,11 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
257 } 261 }
258 drm_vblank_put(dev, qcrtc->index); 262 drm_vblank_put(dev, qcrtc->index);
259 263
260 qxl_bo_unreserve(bo); 264 ret = qxl_bo_reserve(bo, false);
265 if (!ret) {
266 qxl_bo_unpin(bo);
267 qxl_bo_unreserve(bo);
268 }
261 269
262 return 0; 270 return 0;
263} 271}
@@ -618,7 +626,7 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
618 adjusted_mode->hdisplay, 626 adjusted_mode->hdisplay,
619 adjusted_mode->vdisplay); 627 adjusted_mode->vdisplay);
620 628
621 if (qcrtc->index == 0) 629 if (bo->is_primary == false)
622 recreate_primary = true; 630 recreate_primary = true;
623 631
624 if (bo->surf.stride * bo->surf.height > qdev->vram_size) { 632 if (bo->surf.stride * bo->surf.height > qdev->vram_size) {
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 41c422fee31a..c4a552637c93 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -144,14 +144,17 @@ static void qxl_dirty_update(struct qxl_fbdev *qfbdev,
144 144
145 spin_lock_irqsave(&qfbdev->dirty.lock, flags); 145 spin_lock_irqsave(&qfbdev->dirty.lock, flags);
146 146
147 if (qfbdev->dirty.y1 < y) 147 if ((qfbdev->dirty.y2 - qfbdev->dirty.y1) &&
148 y = qfbdev->dirty.y1; 148 (qfbdev->dirty.x2 - qfbdev->dirty.x1)) {
149 if (qfbdev->dirty.y2 > y2) 149 if (qfbdev->dirty.y1 < y)
150 y2 = qfbdev->dirty.y2; 150 y = qfbdev->dirty.y1;
151 if (qfbdev->dirty.x1 < x) 151 if (qfbdev->dirty.y2 > y2)
152 x = qfbdev->dirty.x1; 152 y2 = qfbdev->dirty.y2;
153 if (qfbdev->dirty.x2 > x2) 153 if (qfbdev->dirty.x1 < x)
154 x2 = qfbdev->dirty.x2; 154 x = qfbdev->dirty.x1;
155 if (qfbdev->dirty.x2 > x2)
156 x2 = qfbdev->dirty.x2;
157 }
155 158
156 qfbdev->dirty.x1 = x; 159 qfbdev->dirty.x1 = x;
157 qfbdev->dirty.x2 = x2; 160 qfbdev->dirty.x2 = x2;
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index b66ec331c17c..4efa8e261baf 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -307,7 +307,7 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
307 idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release); 307 idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release);
308 if (idr_ret < 0) 308 if (idr_ret < 0)
309 return idr_ret; 309 return idr_ret;
310 bo = qxl_bo_ref(to_qxl_bo(entry->tv.bo)); 310 bo = to_qxl_bo(entry->tv.bo);
311 311
312 (*release)->release_offset = create_rel->release_offset + 64; 312 (*release)->release_offset = create_rel->release_offset + 64;
313 313
@@ -316,8 +316,6 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
316 info = qxl_release_map(qdev, *release); 316 info = qxl_release_map(qdev, *release);
317 info->id = idr_ret; 317 info->id = idr_ret;
318 qxl_release_unmap(qdev, *release, info); 318 qxl_release_unmap(qdev, *release, info);
319
320 qxl_bo_unref(&bo);
321 return 0; 319 return 0;
322 } 320 }
323 321
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index c3872598b85a..65adb9c72377 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1624,8 +1624,9 @@ radeon_atom_encoder_dpms_avivo(struct drm_encoder *encoder, int mode)
1624 } else 1624 } else
1625 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 1625 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
1626 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 1626 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
1627 args.ucAction = ATOM_LCD_BLON; 1627 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1628 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 1628
1629 atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
1629 } 1630 }
1630 break; 1631 break;
1631 case DRM_MODE_DPMS_STANDBY: 1632 case DRM_MODE_DPMS_STANDBY:
@@ -1706,8 +1707,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
1706 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0); 1707 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
1707 } 1708 }
1708 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) 1709 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
1709 atombios_dig_transmitter_setup(encoder, 1710 atombios_set_backlight_level(radeon_encoder, dig->backlight_level);
1710 ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0);
1711 if (ext_encoder) 1711 if (ext_encoder)
1712 atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); 1712 atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE);
1713 break; 1713 break;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index d2e9e9efc159..6743174acdbc 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1633,18 +1633,8 @@ int radeon_modeset_init(struct radeon_device *rdev)
1633 radeon_fbdev_init(rdev); 1633 radeon_fbdev_init(rdev);
1634 drm_kms_helper_poll_init(rdev->ddev); 1634 drm_kms_helper_poll_init(rdev->ddev);
1635 1635
1636 if (rdev->pm.dpm_enabled) { 1636 /* do pm late init */
1637 /* do dpm late init */ 1637 ret = radeon_pm_late_init(rdev);
1638 ret = radeon_pm_late_init(rdev);
1639 if (ret) {
1640 rdev->pm.dpm_enabled = false;
1641 DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");
1642 }
1643 /* set the dpm state for PX since there won't be
1644 * a modeset to call this.
1645 */
1646 radeon_pm_compute_clocks(rdev);
1647 }
1648 1638
1649 return 0; 1639 return 0;
1650} 1640}
diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c
index 5e09c061847f..744f5c49c664 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_mst.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c
@@ -265,7 +265,6 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol
265{ 265{
266 struct radeon_connector *master = container_of(mgr, struct radeon_connector, mst_mgr); 266 struct radeon_connector *master = container_of(mgr, struct radeon_connector, mst_mgr);
267 struct drm_device *dev = master->base.dev; 267 struct drm_device *dev = master->base.dev;
268 struct radeon_device *rdev = dev->dev_private;
269 struct radeon_connector *radeon_connector; 268 struct radeon_connector *radeon_connector;
270 struct drm_connector *connector; 269 struct drm_connector *connector;
271 270
@@ -284,14 +283,22 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol
284 radeon_connector->mst_encoder = radeon_dp_create_fake_mst_encoder(master); 283 radeon_connector->mst_encoder = radeon_dp_create_fake_mst_encoder(master);
285 284
286 drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); 285 drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
286 drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
287 drm_mode_connector_set_path_property(connector, pathprop); 287 drm_mode_connector_set_path_property(connector, pathprop);
288 288
289 return connector;
290}
291
292static void radeon_dp_register_mst_connector(struct drm_connector *connector)
293{
294 struct drm_device *dev = connector->dev;
295 struct radeon_device *rdev = dev->dev_private;
296
289 drm_modeset_lock_all(dev); 297 drm_modeset_lock_all(dev);
290 radeon_fb_add_connector(rdev, connector); 298 radeon_fb_add_connector(rdev, connector);
291 drm_modeset_unlock_all(dev); 299 drm_modeset_unlock_all(dev);
292 300
293 drm_connector_register(connector); 301 drm_connector_register(connector);
294 return connector;
295} 302}
296 303
297static void radeon_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, 304static void radeon_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
@@ -324,6 +331,7 @@ static void radeon_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
324 331
325struct drm_dp_mst_topology_cbs mst_cbs = { 332struct drm_dp_mst_topology_cbs mst_cbs = {
326 .add_connector = radeon_dp_add_mst_connector, 333 .add_connector = radeon_dp_add_mst_connector,
334 .register_connector = radeon_dp_register_mst_connector,
327 .destroy_connector = radeon_dp_destroy_mst_connector, 335 .destroy_connector = radeon_dp_destroy_mst_connector,
328 .hotplug = radeon_dp_mst_hotplug, 336 .hotplug = radeon_dp_mst_hotplug,
329}; 337};
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 7214858ffcea..26da2f4d7b4f 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -48,40 +48,10 @@ struct radeon_fbdev {
48 struct radeon_device *rdev; 48 struct radeon_device *rdev;
49}; 49};
50 50
51/**
52 * radeon_fb_helper_set_par - Hide cursor on CRTCs used by fbdev.
53 *
54 * @info: fbdev info
55 *
56 * This function hides the cursor on all CRTCs used by fbdev.
57 */
58static int radeon_fb_helper_set_par(struct fb_info *info)
59{
60 int ret;
61
62 ret = drm_fb_helper_set_par(info);
63
64 /* XXX: with universal plane support fbdev will automatically disable
65 * all non-primary planes (including the cursor)
66 */
67 if (ret == 0) {
68 struct drm_fb_helper *fb_helper = info->par;
69 int i;
70
71 for (i = 0; i < fb_helper->crtc_count; i++) {
72 struct drm_crtc *crtc = fb_helper->crtc_info[i].mode_set.crtc;
73
74 radeon_crtc_cursor_set2(crtc, NULL, 0, 0, 0, 0, 0);
75 }
76 }
77
78 return ret;
79}
80
81static struct fb_ops radeonfb_ops = { 51static struct fb_ops radeonfb_ops = {
82 .owner = THIS_MODULE, 52 .owner = THIS_MODULE,
83 .fb_check_var = drm_fb_helper_check_var, 53 .fb_check_var = drm_fb_helper_check_var,
84 .fb_set_par = radeon_fb_helper_set_par, 54 .fb_set_par = drm_fb_helper_set_par,
85 .fb_fillrect = drm_fb_helper_cfb_fillrect, 55 .fb_fillrect = drm_fb_helper_cfb_fillrect,
86 .fb_copyarea = drm_fb_helper_cfb_copyarea, 56 .fb_copyarea = drm_fb_helper_cfb_copyarea,
87 .fb_imageblit = drm_fb_helper_cfb_imageblit, 57 .fb_imageblit = drm_fb_helper_cfb_imageblit,
@@ -427,3 +397,19 @@ void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector
427{ 397{
428 drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector); 398 drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
429} 399}
400
401void radeon_fbdev_restore_mode(struct radeon_device *rdev)
402{
403 struct radeon_fbdev *rfbdev = rdev->mode_info.rfbdev;
404 struct drm_fb_helper *fb_helper;
405 int ret;
406
407 if (!rfbdev)
408 return;
409
410 fb_helper = &rfbdev->helper;
411
412 ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
413 if (ret)
414 DRM_DEBUG("failed to restore crtc mode\n");
415}
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 4a119c255ba9..0e932bf932c1 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -598,7 +598,7 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
598 * Outdated mess for old drm with Xorg being in charge (void function now). 598 * Outdated mess for old drm with Xorg being in charge (void function now).
599 */ 599 */
600/** 600/**
601 * radeon_driver_firstopen_kms - drm callback for last close 601 * radeon_driver_lastclose_kms - drm callback for last close
602 * 602 *
603 * @dev: drm dev pointer 603 * @dev: drm dev pointer
604 * 604 *
@@ -606,6 +606,9 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file
606 */ 606 */
607void radeon_driver_lastclose_kms(struct drm_device *dev) 607void radeon_driver_lastclose_kms(struct drm_device *dev)
608{ 608{
609 struct radeon_device *rdev = dev->dev_private;
610
611 radeon_fbdev_restore_mode(rdev);
609 vga_switcheroo_process_delayed_switch(); 612 vga_switcheroo_process_delayed_switch();
610} 613}
611 614
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index aecc3e3dec0c..457b026a0972 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -980,6 +980,7 @@ int radeon_fbdev_init(struct radeon_device *rdev);
980void radeon_fbdev_fini(struct radeon_device *rdev); 980void radeon_fbdev_fini(struct radeon_device *rdev);
981void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state); 981void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state);
982bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj); 982bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj);
983void radeon_fbdev_restore_mode(struct radeon_device *rdev);
983 984
984void radeon_fb_output_poll_changed(struct radeon_device *rdev); 985void radeon_fb_output_poll_changed(struct radeon_device *rdev);
985 986
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 05751f3f8444..44489cce7458 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1326,14 +1326,6 @@ static int radeon_pm_init_old(struct radeon_device *rdev)
1326 INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); 1326 INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
1327 1327
1328 if (rdev->pm.num_power_states > 1) { 1328 if (rdev->pm.num_power_states > 1) {
1329 /* where's the best place to put these? */
1330 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1331 if (ret)
1332 DRM_ERROR("failed to create device file for power profile\n");
1333 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1334 if (ret)
1335 DRM_ERROR("failed to create device file for power method\n");
1336
1337 if (radeon_debugfs_pm_init(rdev)) { 1329 if (radeon_debugfs_pm_init(rdev)) {
1338 DRM_ERROR("Failed to register debugfs file for PM!\n"); 1330 DRM_ERROR("Failed to register debugfs file for PM!\n");
1339 } 1331 }
@@ -1391,20 +1383,6 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev)
1391 goto dpm_failed; 1383 goto dpm_failed;
1392 rdev->pm.dpm_enabled = true; 1384 rdev->pm.dpm_enabled = true;
1393 1385
1394 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
1395 if (ret)
1396 DRM_ERROR("failed to create device file for dpm state\n");
1397 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
1398 if (ret)
1399 DRM_ERROR("failed to create device file for dpm state\n");
1400 /* XXX: these are noops for dpm but are here for backwards compat */
1401 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1402 if (ret)
1403 DRM_ERROR("failed to create device file for power profile\n");
1404 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1405 if (ret)
1406 DRM_ERROR("failed to create device file for power method\n");
1407
1408 if (radeon_debugfs_pm_init(rdev)) { 1386 if (radeon_debugfs_pm_init(rdev)) {
1409 DRM_ERROR("Failed to register debugfs file for dpm!\n"); 1387 DRM_ERROR("Failed to register debugfs file for dpm!\n");
1410 } 1388 }
@@ -1545,9 +1523,44 @@ int radeon_pm_late_init(struct radeon_device *rdev)
1545 int ret = 0; 1523 int ret = 0;
1546 1524
1547 if (rdev->pm.pm_method == PM_METHOD_DPM) { 1525 if (rdev->pm.pm_method == PM_METHOD_DPM) {
1548 mutex_lock(&rdev->pm.mutex); 1526 if (rdev->pm.dpm_enabled) {
1549 ret = radeon_dpm_late_enable(rdev); 1527 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
1550 mutex_unlock(&rdev->pm.mutex); 1528 if (ret)
1529 DRM_ERROR("failed to create device file for dpm state\n");
1530 ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
1531 if (ret)
1532 DRM_ERROR("failed to create device file for dpm state\n");
1533 /* XXX: these are noops for dpm but are here for backwards compat */
1534 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1535 if (ret)
1536 DRM_ERROR("failed to create device file for power profile\n");
1537 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1538 if (ret)
1539 DRM_ERROR("failed to create device file for power method\n");
1540
1541 mutex_lock(&rdev->pm.mutex);
1542 ret = radeon_dpm_late_enable(rdev);
1543 mutex_unlock(&rdev->pm.mutex);
1544 if (ret) {
1545 rdev->pm.dpm_enabled = false;
1546 DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n");
1547 } else {
1548 /* set the dpm state for PX since there won't be
1549 * a modeset to call this.
1550 */
1551 radeon_pm_compute_clocks(rdev);
1552 }
1553 }
1554 } else {
1555 if (rdev->pm.num_power_states > 1) {
1556 /* where's the best place to put these? */
1557 ret = device_create_file(rdev->dev, &dev_attr_power_profile);
1558 if (ret)
1559 DRM_ERROR("failed to create device file for power profile\n");
1560 ret = device_create_file(rdev->dev, &dev_attr_power_method);
1561 if (ret)
1562 DRM_ERROR("failed to create device file for power method\n");
1563 }
1551 } 1564 }
1552 return ret; 1565 return ret;
1553} 1566}
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index e9115d3f67b0..e72bf46042e0 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2928,6 +2928,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, 2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
2929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, 2929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
2930 { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 }, 2930 { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 },
2931 { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
2931 { 0, 0, 0, 0 }, 2932 { 0, 0, 0, 0 },
2932}; 2933};
2933 2934
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index db8b49101a8b..512263919282 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -34,8 +34,8 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
34 struct drm_info_node *node = (struct drm_info_node *) m->private; 34 struct drm_info_node *node = (struct drm_info_node *) m->private;
35 struct virtio_gpu_device *vgdev = node->minor->dev->dev_private; 35 struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
36 36
37 seq_printf(m, "fence %ld %lld\n", 37 seq_printf(m, "fence %llu %lld\n",
38 atomic64_read(&vgdev->fence_drv.last_seq), 38 (u64)atomic64_read(&vgdev->fence_drv.last_seq),
39 vgdev->fence_drv.sync_seq); 39 vgdev->fence_drv.sync_seq);
40 return 0; 40 return 0;
41} 41}
diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virtio/virtgpu_fence.c
index 1da632631dac..67097c9ce9c1 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fence.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fence.c
@@ -61,7 +61,7 @@ static void virtio_timeline_value_str(struct fence *f, char *str, int size)
61{ 61{
62 struct virtio_gpu_fence *fence = to_virtio_fence(f); 62 struct virtio_gpu_fence *fence = to_virtio_fence(f);
63 63
64 snprintf(str, size, "%lu", atomic64_read(&fence->drv->last_seq)); 64 snprintf(str, size, "%llu", (u64)atomic64_read(&fence->drv->last_seq));
65} 65}
66 66
67static const struct fence_ops virtio_fence_ops = { 67static const struct fence_ops virtio_fence_ops = {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 5ae8f921da2a..8a76821177a6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -681,6 +681,14 @@ static bool vmw_cmdbuf_try_alloc(struct vmw_cmdbuf_man *man,
681 0, 0, 681 0, 0,
682 DRM_MM_SEARCH_DEFAULT, 682 DRM_MM_SEARCH_DEFAULT,
683 DRM_MM_CREATE_DEFAULT); 683 DRM_MM_CREATE_DEFAULT);
684 if (ret) {
685 (void) vmw_cmdbuf_man_process(man);
686 ret = drm_mm_insert_node_generic(&man->mm, info->node,
687 info->page_size, 0, 0,
688 DRM_MM_SEARCH_DEFAULT,
689 DRM_MM_CREATE_DEFAULT);
690 }
691
684 spin_unlock_bh(&man->lock); 692 spin_unlock_bh(&man->lock);
685 info->done = !ret; 693 info->done = !ret;
686 694
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 64b50409fa07..03f63c749c02 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -657,7 +657,8 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
657 struct vmw_resource *res = &user_srf->srf.res; 657 struct vmw_resource *res = &user_srf->srf.res;
658 658
659 *p_base = NULL; 659 *p_base = NULL;
660 ttm_base_object_unref(&user_srf->backup_base); 660 if (user_srf->backup_base)
661 ttm_base_object_unref(&user_srf->backup_base);
661 vmw_resource_unreference(&res); 662 vmw_resource_unreference(&res);
662} 663}
663 664
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 3dd2de31a2f8..472b88285c75 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -24,6 +24,7 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/dmi.h>
27#include <linux/i2c.h> 28#include <linux/i2c.h>
28#include <linux/clk.h> 29#include <linux/clk.h>
29#include <linux/clk-provider.h> 30#include <linux/clk-provider.h>
@@ -51,6 +52,22 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
51} 52}
52 53
53#ifdef CONFIG_ACPI 54#ifdef CONFIG_ACPI
55/*
56 * The HCNT/LCNT information coming from ACPI should be the most accurate
57 * for given platform. However, some systems get it wrong. On such systems
58 * we get better results by calculating those based on the input clock.
59 */
60static const struct dmi_system_id dw_i2c_no_acpi_params[] = {
61 {
62 .ident = "Dell Inspiron 7348",
63 .matches = {
64 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
65 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7348"),
66 },
67 },
68 { }
69};
70
54static void dw_i2c_acpi_params(struct platform_device *pdev, char method[], 71static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
55 u16 *hcnt, u16 *lcnt, u32 *sda_hold) 72 u16 *hcnt, u16 *lcnt, u32 *sda_hold)
56{ 73{
@@ -58,6 +75,9 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
58 acpi_handle handle = ACPI_HANDLE(&pdev->dev); 75 acpi_handle handle = ACPI_HANDLE(&pdev->dev);
59 union acpi_object *obj; 76 union acpi_object *obj;
60 77
78 if (dmi_check_system(dw_i2c_no_acpi_params))
79 return;
80
61 if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf))) 81 if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf)))
62 return; 82 return;
63 83
@@ -253,12 +273,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
253 adap->dev.parent = &pdev->dev; 273 adap->dev.parent = &pdev->dev;
254 adap->dev.of_node = pdev->dev.of_node; 274 adap->dev.of_node = pdev->dev.of_node;
255 275
256 r = i2c_add_numbered_adapter(adap);
257 if (r) {
258 dev_err(&pdev->dev, "failure adding adapter\n");
259 return r;
260 }
261
262 if (dev->pm_runtime_disabled) { 276 if (dev->pm_runtime_disabled) {
263 pm_runtime_forbid(&pdev->dev); 277 pm_runtime_forbid(&pdev->dev);
264 } else { 278 } else {
@@ -268,6 +282,13 @@ static int dw_i2c_probe(struct platform_device *pdev)
268 pm_runtime_enable(&pdev->dev); 282 pm_runtime_enable(&pdev->dev);
269 } 283 }
270 284
285 r = i2c_add_numbered_adapter(adap);
286 if (r) {
287 dev_err(&pdev->dev, "failure adding adapter\n");
288 pm_runtime_disable(&pdev->dev);
289 return r;
290 }
291
271 return 0; 292 return 0;
272} 293}
273 294
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index d8361dada584..d8b5a8fee1e6 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -690,15 +690,16 @@ static int rcar_i2c_probe(struct platform_device *pdev)
690 return ret; 690 return ret;
691 } 691 }
692 692
693 pm_runtime_enable(dev);
694 platform_set_drvdata(pdev, priv);
695
693 ret = i2c_add_numbered_adapter(adap); 696 ret = i2c_add_numbered_adapter(adap);
694 if (ret < 0) { 697 if (ret < 0) {
695 dev_err(dev, "reg adap failed: %d\n", ret); 698 dev_err(dev, "reg adap failed: %d\n", ret);
699 pm_runtime_disable(dev);
696 return ret; 700 return ret;
697 } 701 }
698 702
699 pm_runtime_enable(dev);
700 platform_set_drvdata(pdev, priv);
701
702 dev_info(dev, "probed\n"); 703 dev_info(dev, "probed\n");
703 704
704 return 0; 705 return 0;
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 50bfd8cef5f2..5df819610d52 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1243,17 +1243,19 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
1243 i2c->adap.nr = i2c->pdata->bus_num; 1243 i2c->adap.nr = i2c->pdata->bus_num;
1244 i2c->adap.dev.of_node = pdev->dev.of_node; 1244 i2c->adap.dev.of_node = pdev->dev.of_node;
1245 1245
1246 platform_set_drvdata(pdev, i2c);
1247
1248 pm_runtime_enable(&pdev->dev);
1249
1246 ret = i2c_add_numbered_adapter(&i2c->adap); 1250 ret = i2c_add_numbered_adapter(&i2c->adap);
1247 if (ret < 0) { 1251 if (ret < 0) {
1248 dev_err(&pdev->dev, "failed to add bus to i2c core\n"); 1252 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
1253 pm_runtime_disable(&pdev->dev);
1249 s3c24xx_i2c_deregister_cpufreq(i2c); 1254 s3c24xx_i2c_deregister_cpufreq(i2c);
1250 clk_unprepare(i2c->clk); 1255 clk_unprepare(i2c->clk);
1251 return ret; 1256 return ret;
1252 } 1257 }
1253 1258
1254 platform_set_drvdata(pdev, i2c);
1255
1256 pm_runtime_enable(&pdev->dev);
1257 pm_runtime_enable(&i2c->adap.dev); 1259 pm_runtime_enable(&i2c->adap.dev);
1258 1260
1259 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); 1261 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5f89f1e3c2f2..a59c3111f7fb 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -694,12 +694,12 @@ static int i2c_device_probe(struct device *dev)
694 goto err_clear_wakeup_irq; 694 goto err_clear_wakeup_irq;
695 695
696 status = dev_pm_domain_attach(&client->dev, true); 696 status = dev_pm_domain_attach(&client->dev, true);
697 if (status != -EPROBE_DEFER) { 697 if (status == -EPROBE_DEFER)
698 status = driver->probe(client, i2c_match_id(driver->id_table, 698 goto err_clear_wakeup_irq;
699 client)); 699
700 if (status) 700 status = driver->probe(client, i2c_match_id(driver->id_table, client));
701 goto err_detach_pm_domain; 701 if (status)
702 } 702 goto err_detach_pm_domain;
703 703
704 return 0; 704 return 0;
705 705
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index b1ab13f3e182..59a2dafc8c57 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1232,14 +1232,32 @@ static bool cma_match_private_data(struct rdma_id_private *id_priv,
1232 return true; 1232 return true;
1233} 1233}
1234 1234
1235static bool cma_protocol_roce_dev_port(struct ib_device *device, int port_num)
1236{
1237 enum rdma_link_layer ll = rdma_port_get_link_layer(device, port_num);
1238 enum rdma_transport_type transport =
1239 rdma_node_get_transport(device->node_type);
1240
1241 return ll == IB_LINK_LAYER_ETHERNET && transport == RDMA_TRANSPORT_IB;
1242}
1243
1244static bool cma_protocol_roce(const struct rdma_cm_id *id)
1245{
1246 struct ib_device *device = id->device;
1247 const int port_num = id->port_num ?: rdma_start_port(device);
1248
1249 return cma_protocol_roce_dev_port(device, port_num);
1250}
1251
1235static bool cma_match_net_dev(const struct rdma_id_private *id_priv, 1252static bool cma_match_net_dev(const struct rdma_id_private *id_priv,
1236 const struct net_device *net_dev) 1253 const struct net_device *net_dev)
1237{ 1254{
1238 const struct rdma_addr *addr = &id_priv->id.route.addr; 1255 const struct rdma_addr *addr = &id_priv->id.route.addr;
1239 1256
1240 if (!net_dev) 1257 if (!net_dev)
1241 /* This request is an AF_IB request */ 1258 /* This request is an AF_IB request or a RoCE request */
1242 return addr->src_addr.ss_family == AF_IB; 1259 return addr->src_addr.ss_family == AF_IB ||
1260 cma_protocol_roce(&id_priv->id);
1243 1261
1244 return !addr->dev_addr.bound_dev_if || 1262 return !addr->dev_addr.bound_dev_if ||
1245 (net_eq(dev_net(net_dev), &init_net) && 1263 (net_eq(dev_net(net_dev), &init_net) &&
@@ -1294,6 +1312,10 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
1294 if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) { 1312 if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) {
1295 /* Assuming the protocol is AF_IB */ 1313 /* Assuming the protocol is AF_IB */
1296 *net_dev = NULL; 1314 *net_dev = NULL;
1315 } else if (cma_protocol_roce_dev_port(req.device, req.port)) {
1316 /* TODO find the net dev matching the request parameters
1317 * through the RoCE GID table */
1318 *net_dev = NULL;
1297 } else { 1319 } else {
1298 return ERR_CAST(*net_dev); 1320 return ERR_CAST(*net_dev);
1299 } 1321 }
@@ -1593,11 +1615,16 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id,
1593 if (ret) 1615 if (ret)
1594 goto err; 1616 goto err;
1595 } else { 1617 } else {
1596 /* An AF_IB connection */ 1618 if (!cma_protocol_roce(listen_id) &&
1597 WARN_ON_ONCE(ss_family != AF_IB); 1619 cma_any_addr(cma_src_addr(id_priv))) {
1598 1620 rt->addr.dev_addr.dev_type = ARPHRD_INFINIBAND;
1599 cma_translate_ib((struct sockaddr_ib *)cma_src_addr(id_priv), 1621 rdma_addr_set_sgid(&rt->addr.dev_addr, &rt->path_rec[0].sgid);
1600 &rt->addr.dev_addr); 1622 ib_addr_set_pkey(&rt->addr.dev_addr, be16_to_cpu(rt->path_rec[0].pkey));
1623 } else if (!cma_any_addr(cma_src_addr(id_priv))) {
1624 ret = cma_translate_addr(cma_src_addr(id_priv), &rt->addr.dev_addr);
1625 if (ret)
1626 goto err;
1627 }
1601 } 1628 }
1602 rdma_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid); 1629 rdma_addr_set_dgid(&rt->addr.dev_addr, &rt->path_rec[0].dgid);
1603 1630
@@ -1635,13 +1662,12 @@ static struct rdma_id_private *cma_new_udp_id(struct rdma_cm_id *listen_id,
1635 if (ret) 1662 if (ret)
1636 goto err; 1663 goto err;
1637 } else { 1664 } else {
1638 /* An AF_IB connection */ 1665 if (!cma_any_addr(cma_src_addr(id_priv))) {
1639 WARN_ON_ONCE(ss_family != AF_IB); 1666 ret = cma_translate_addr(cma_src_addr(id_priv),
1640 1667 &id->route.addr.dev_addr);
1641 if (!cma_any_addr(cma_src_addr(id_priv))) 1668 if (ret)
1642 cma_translate_ib((struct sockaddr_ib *) 1669 goto err;
1643 cma_src_addr(id_priv), 1670 }
1644 &id->route.addr.dev_addr);
1645 } 1671 }
1646 1672
1647 id_priv->state = RDMA_CM_CONNECT; 1673 id_priv->state = RDMA_CM_CONNECT;
diff --git a/drivers/infiniband/hw/usnic/usnic.h b/drivers/infiniband/hw/usnic/usnic.h
index 5be13d8991bc..f903502d3883 100644
--- a/drivers/infiniband/hw/usnic/usnic.h
+++ b/drivers/infiniband/hw/usnic/usnic.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_abi.h b/drivers/infiniband/hw/usnic/usnic_abi.h
index 04a66229584e..7fe9502ce8d3 100644
--- a/drivers/infiniband/hw/usnic/usnic_abi.h
+++ b/drivers/infiniband/hw/usnic/usnic_abi.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h b/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h
index 393567266142..596e0ed49a8e 100644
--- a/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h
+++ b/drivers/infiniband/hw/usnic/usnic_common_pkt_hdr.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_common_util.h b/drivers/infiniband/hw/usnic/usnic_common_util.h
index 9d737ed5e55d..b54986de5f0c 100644
--- a/drivers/infiniband/hw/usnic/usnic_common_util.h
+++ b/drivers/infiniband/hw/usnic/usnic_common_util.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_debugfs.c b/drivers/infiniband/hw/usnic/usnic_debugfs.c
index 5d13860161a4..5e55b8bc6fe4 100644
--- a/drivers/infiniband/hw/usnic/usnic_debugfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_debugfs.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_debugfs.h b/drivers/infiniband/hw/usnic/usnic_debugfs.h
index 4087d24a88f6..98453e91daa6 100644
--- a/drivers/infiniband/hw/usnic/usnic_debugfs.h
+++ b/drivers/infiniband/hw/usnic/usnic_debugfs.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_fwd.c b/drivers/infiniband/hw/usnic/usnic_fwd.c
index e3c9bd9d3ba3..3c37dd59c04e 100644
--- a/drivers/infiniband/hw/usnic/usnic_fwd.c
+++ b/drivers/infiniband/hw/usnic/usnic_fwd.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_fwd.h b/drivers/infiniband/hw/usnic/usnic_fwd.h
index 93713a2230b3..3a8add9ddf46 100644
--- a/drivers/infiniband/hw/usnic/usnic_fwd.h
+++ b/drivers/infiniband/hw/usnic/usnic_fwd.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib.h b/drivers/infiniband/hw/usnic/usnic_ib.h
index e5a9297dd1bd..525bf272671e 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 34c49b8105fe..0c15bd885035 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
index db3588df3546..85dc3f989ff7 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
index b0aafe8db0c3..b1458be1d402 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
index 27dc67c1689f..3412ea06116e 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h
index 0d09b493cd02..3d98e16cfeaf 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_sysfs.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 7df43827cb29..f8e3211689a3 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
index 0bd04efa16f3..414eaa566bd9 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_log.h b/drivers/infiniband/hw/usnic/usnic_log.h
index 75777a66c684..183fcb6a952f 100644
--- a/drivers/infiniband/hw/usnic/usnic_log.h
+++ b/drivers/infiniband/hw/usnic/usnic_log.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_transport.c b/drivers/infiniband/hw/usnic/usnic_transport.c
index ddef6f77a78c..de318389a301 100644
--- a/drivers/infiniband/hw/usnic/usnic_transport.c
+++ b/drivers/infiniband/hw/usnic/usnic_transport.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_transport.h b/drivers/infiniband/hw/usnic/usnic_transport.h
index 7e5dc6d9f462..9a7a2d9755c0 100644
--- a/drivers/infiniband/hw/usnic/usnic_transport.h
+++ b/drivers/infiniband/hw/usnic/usnic_transport.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c
index cb2337f0532b..645a5f6e6c88 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
@@ -7,7 +7,7 @@
7 * licenses. You may choose to be licensed under the terms of the GNU 7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file 8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the 9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below: 10 * BSD license below:
11 * 11 *
12 * Redistribution and use in source and binary forms, with or 12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following 13 * without modification, are permitted provided that the following
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.h b/drivers/infiniband/hw/usnic/usnic_uiom.h
index 70440996e8f2..45ca7c1613a7 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.h
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
index 3a4288e0fbac..42b4b4c4e452 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2014, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2014, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h
index d4f752e258fd..c0b0b876ab90 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h
+++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_vnic.c b/drivers/infiniband/hw/usnic/usnic_vnic.c
index 656b88c39eda..66de93fb8ea9 100644
--- a/drivers/infiniband/hw/usnic/usnic_vnic.c
+++ b/drivers/infiniband/hw/usnic/usnic_vnic.c
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/hw/usnic/usnic_vnic.h b/drivers/infiniband/hw/usnic/usnic_vnic.h
index 14d931a8829d..a08423e478af 100644
--- a/drivers/infiniband/hw/usnic/usnic_vnic.h
+++ b/drivers/infiniband/hw/usnic/usnic_vnic.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 * 3 *
4 * This program is free software; you may redistribute it and/or modify 4 * This software is available to you under a choice of one of two
5 * it under the terms of the GNU General Public License as published by 5 * licenses. You may choose to be licensed under the terms of the GNU
6 * the Free Software Foundation; version 2 of the License. 6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
7 * 22 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 4cd5428a2399..edc5b8565d6d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -495,6 +495,7 @@ void ipoib_dev_cleanup(struct net_device *dev);
495void ipoib_mcast_join_task(struct work_struct *work); 495void ipoib_mcast_join_task(struct work_struct *work);
496void ipoib_mcast_carrier_on_task(struct work_struct *work); 496void ipoib_mcast_carrier_on_task(struct work_struct *work);
497void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb); 497void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb);
498void ipoib_mcast_free(struct ipoib_mcast *mc);
498 499
499void ipoib_mcast_restart_task(struct work_struct *work); 500void ipoib_mcast_restart_task(struct work_struct *work);
500int ipoib_mcast_start_thread(struct net_device *dev); 501int ipoib_mcast_start_thread(struct net_device *dev);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f74316e679d2..babba05d7a0e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1207,8 +1207,10 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
1207 1207
1208out_unlock: 1208out_unlock:
1209 spin_unlock_irqrestore(&priv->lock, flags); 1209 spin_unlock_irqrestore(&priv->lock, flags);
1210 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) 1210 list_for_each_entry_safe(mcast, tmcast, &remove_list, list) {
1211 ipoib_mcast_leave(dev, mcast); 1211 ipoib_mcast_leave(dev, mcast);
1212 ipoib_mcast_free(mcast);
1213 }
1212} 1214}
1213 1215
1214static void ipoib_reap_neigh(struct work_struct *work) 1216static void ipoib_reap_neigh(struct work_struct *work)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 136cbefe00f8..d750a86042f3 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -106,7 +106,7 @@ static void __ipoib_mcast_schedule_join_thread(struct ipoib_dev_priv *priv,
106 queue_delayed_work(priv->wq, &priv->mcast_task, 0); 106 queue_delayed_work(priv->wq, &priv->mcast_task, 0);
107} 107}
108 108
109static void ipoib_mcast_free(struct ipoib_mcast *mcast) 109void ipoib_mcast_free(struct ipoib_mcast *mcast)
110{ 110{
111 struct net_device *dev = mcast->dev; 111 struct net_device *dev = mcast->dev;
112 int tx_dropped = 0; 112 int tx_dropped = 0;
diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c
index b76ac580703c..a8bc2fe170dd 100644
--- a/drivers/input/joystick/walkera0701.c
+++ b/drivers/input/joystick/walkera0701.c
@@ -150,7 +150,7 @@ static void walkera0701_irq_handler(void *handler_data)
150 if (w->counter == 24) { /* full frame */ 150 if (w->counter == 24) { /* full frame */
151 walkera0701_parse_frame(w); 151 walkera0701_parse_frame(w);
152 w->counter = NO_SYNC; 152 w->counter = NO_SYNC;
153 if (abs(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ 153 if (abs64(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */
154 w->counter = 0; 154 w->counter = 0;
155 } else { 155 } else {
156 if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) 156 if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE)
@@ -161,7 +161,7 @@ static void walkera0701_irq_handler(void *handler_data)
161 } else 161 } else
162 w->counter = NO_SYNC; 162 w->counter = NO_SYNC;
163 } 163 }
164 } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < 164 } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) <
165 RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ 165 RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */
166 w->counter = 0; 166 w->counter = 0;
167 167
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index b052afec9a11..6639b2b8528a 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -266,7 +266,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
266 266
267 error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); 267 error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
268 if (error) 268 if (error)
269 return error; 269 goto err_free_keypad;
270 270
271 res = request_mem_region(res->start, resource_size(res), pdev->name); 271 res = request_mem_region(res->start, resource_size(res), pdev->name);
272 if (!res) { 272 if (!res) {
diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
index 867db8a91372..e317b75357a0 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -93,7 +93,7 @@ static int pm8941_reboot_notify(struct notifier_block *nb,
93 default: 93 default:
94 reset_type = PON_PS_HOLD_TYPE_HARD_RESET; 94 reset_type = PON_PS_HOLD_TYPE_HARD_RESET;
95 break; 95 break;
96 }; 96 }
97 97
98 error = regmap_update_bits(pwrkey->regmap, 98 error = regmap_update_bits(pwrkey->regmap,
99 pwrkey->baseaddr + PON_PS_HOLD_RST_CTL, 99 pwrkey->baseaddr + PON_PS_HOLD_RST_CTL,
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 345df9b03aed..5adbcedcb81c 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -414,7 +414,7 @@ static int uinput_setup_device(struct uinput_device *udev,
414 dev->id.product = user_dev->id.product; 414 dev->id.product = user_dev->id.product;
415 dev->id.version = user_dev->id.version; 415 dev->id.version = user_dev->id.version;
416 416
417 for_each_set_bit(i, dev->absbit, ABS_CNT) { 417 for (i = 0; i < ABS_CNT; i++) {
418 input_abs_set_max(dev, i, user_dev->absmax[i]); 418 input_abs_set_max(dev, i, user_dev->absmax[i]);
419 input_abs_set_min(dev, i, user_dev->absmin[i]); 419 input_abs_set_min(dev, i, user_dev->absmin[i]);
420 input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]); 420 input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]);
diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c
index 5f191071d44a..e4eb048d1bf6 100644
--- a/drivers/input/mouse/cyapa_gen6.c
+++ b/drivers/input/mouse/cyapa_gen6.c
@@ -241,14 +241,10 @@ static int cyapa_gen6_read_sys_info(struct cyapa *cyapa)
241 memcpy(&cyapa->product_id[13], &resp_data[62], 2); 241 memcpy(&cyapa->product_id[13], &resp_data[62], 2);
242 cyapa->product_id[15] = '\0'; 242 cyapa->product_id[15] = '\0';
243 243
244 /* Get the number of Rx electrodes. */
244 rotat_align = resp_data[68]; 245 rotat_align = resp_data[68];
245 if (rotat_align) { 246 cyapa->electrodes_rx =
246 cyapa->electrodes_rx = cyapa->electrodes_y; 247 rotat_align ? cyapa->electrodes_y : cyapa->electrodes_x;
247 cyapa->electrodes_rx = cyapa->electrodes_y;
248 } else {
249 cyapa->electrodes_rx = cyapa->electrodes_x;
250 cyapa->electrodes_rx = cyapa->electrodes_y;
251 }
252 cyapa->aligned_electrodes_rx = (cyapa->electrodes_rx + 3) & ~3u; 248 cyapa->aligned_electrodes_rx = (cyapa->electrodes_rx + 3) & ~3u;
253 249
254 if (!cyapa->electrodes_x || !cyapa->electrodes_y || 250 if (!cyapa->electrodes_x || !cyapa->electrodes_y ||
diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
index 73670f2aebfd..c0ec26118732 100644
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -60,7 +60,7 @@ struct elan_transport_ops {
60 int (*get_sm_version)(struct i2c_client *client, 60 int (*get_sm_version)(struct i2c_client *client,
61 u8* ic_type, u8 *version); 61 u8* ic_type, u8 *version);
62 int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); 62 int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
63 int (*get_product_id)(struct i2c_client *client, u8 *id); 63 int (*get_product_id)(struct i2c_client *client, u16 *id);
64 64
65 int (*get_max)(struct i2c_client *client, 65 int (*get_max)(struct i2c_client *client,
66 unsigned int *max_x, unsigned int *max_y); 66 unsigned int *max_x, unsigned int *max_y);
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index fa945304b9a5..5e1665bbaa0b 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -40,7 +40,7 @@
40#include "elan_i2c.h" 40#include "elan_i2c.h"
41 41
42#define DRIVER_NAME "elan_i2c" 42#define DRIVER_NAME "elan_i2c"
43#define ELAN_DRIVER_VERSION "1.6.0" 43#define ELAN_DRIVER_VERSION "1.6.1"
44#define ETP_MAX_PRESSURE 255 44#define ETP_MAX_PRESSURE 255
45#define ETP_FWIDTH_REDUCE 90 45#define ETP_FWIDTH_REDUCE 90
46#define ETP_FINGER_WIDTH 15 46#define ETP_FINGER_WIDTH 15
@@ -76,7 +76,7 @@ struct elan_tp_data {
76 unsigned int x_res; 76 unsigned int x_res;
77 unsigned int y_res; 77 unsigned int y_res;
78 78
79 u8 product_id; 79 u16 product_id;
80 u8 fw_version; 80 u8 fw_version;
81 u8 sm_version; 81 u8 sm_version;
82 u8 iap_version; 82 u8 iap_version;
@@ -98,15 +98,25 @@ static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
98 u16 *signature_address) 98 u16 *signature_address)
99{ 99{
100 switch (iap_version) { 100 switch (iap_version) {
101 case 0x00:
102 case 0x06:
101 case 0x08: 103 case 0x08:
102 *validpage_count = 512; 104 *validpage_count = 512;
103 break; 105 break;
106 case 0x03:
107 case 0x07:
104 case 0x09: 108 case 0x09:
109 case 0x0A:
110 case 0x0B:
111 case 0x0C:
105 *validpage_count = 768; 112 *validpage_count = 768;
106 break; 113 break;
107 case 0x0D: 114 case 0x0D:
108 *validpage_count = 896; 115 *validpage_count = 896;
109 break; 116 break;
117 case 0x0E:
118 *validpage_count = 640;
119 break;
110 default: 120 default:
111 /* unknown ic type clear value */ 121 /* unknown ic type clear value */
112 *validpage_count = 0; 122 *validpage_count = 0;
@@ -266,11 +276,10 @@ static int elan_query_device_info(struct elan_tp_data *data)
266 276
267 error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, 277 error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count,
268 &data->fw_signature_address); 278 &data->fw_signature_address);
269 if (error) { 279 if (error)
270 dev_err(&data->client->dev, 280 dev_warn(&data->client->dev,
271 "unknown iap version %d\n", data->iap_version); 281 "unexpected iap version %#04x (ic type: %#04x), firmware update will not work\n",
272 return error; 282 data->iap_version, data->ic_type);
273 }
274 283
275 return 0; 284 return 0;
276} 285}
@@ -486,6 +495,9 @@ static ssize_t elan_sysfs_update_fw(struct device *dev,
486 const u8 *fw_signature; 495 const u8 *fw_signature;
487 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; 496 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF};
488 497
498 if (data->fw_validpage_count == 0)
499 return -EINVAL;
500
489 /* Look for a firmware with the product id appended. */ 501 /* Look for a firmware with the product id appended. */
490 fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id); 502 fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id);
491 if (!fw_name) { 503 if (!fw_name) {
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index 683c840c9dd7..a679e56c44cd 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -276,7 +276,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client,
276 return 0; 276 return 0;
277} 277}
278 278
279static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) 279static int elan_i2c_get_product_id(struct i2c_client *client, u16 *id)
280{ 280{
281 int error; 281 int error;
282 u8 val[3]; 282 u8 val[3];
@@ -287,7 +287,7 @@ static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id)
287 return error; 287 return error;
288 } 288 }
289 289
290 *id = val[0]; 290 *id = le16_to_cpup((__le16 *)val);
291 return 0; 291 return 0;
292} 292}
293 293
diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
index ff36a366b2aa..cb6aecbc1dc2 100644
--- a/drivers/input/mouse/elan_i2c_smbus.c
+++ b/drivers/input/mouse/elan_i2c_smbus.c
@@ -183,7 +183,7 @@ static int elan_smbus_get_sm_version(struct i2c_client *client,
183 return 0; 183 return 0;
184} 184}
185 185
186static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) 186static int elan_smbus_get_product_id(struct i2c_client *client, u16 *id)
187{ 187{
188 int error; 188 int error;
189 u8 val[3]; 189 u8 val[3];
@@ -195,7 +195,7 @@ static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id)
195 return error; 195 return error;
196 } 196 }
197 197
198 *id = val[1]; 198 *id = be16_to_cpup((__be16 *)val);
199 return 0; 199 return 0;
200} 200}
201 201
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 994ae7886156..6025eb430c0a 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -519,18 +519,14 @@ static int synaptics_set_mode(struct psmouse *psmouse)
519 struct synaptics_data *priv = psmouse->private; 519 struct synaptics_data *priv = psmouse->private;
520 520
521 priv->mode = 0; 521 priv->mode = 0;
522 522 if (priv->absolute_mode)
523 if (priv->absolute_mode) {
524 priv->mode |= SYN_BIT_ABSOLUTE_MODE; 523 priv->mode |= SYN_BIT_ABSOLUTE_MODE;
525 if (SYN_CAP_EXTENDED(priv->capabilities)) 524 if (priv->disable_gesture)
526 priv->mode |= SYN_BIT_W_MODE;
527 }
528
529 if (!SYN_MODE_WMODE(priv->mode) && priv->disable_gesture)
530 priv->mode |= SYN_BIT_DISABLE_GESTURE; 525 priv->mode |= SYN_BIT_DISABLE_GESTURE;
531
532 if (psmouse->rate >= 80) 526 if (psmouse->rate >= 80)
533 priv->mode |= SYN_BIT_HIGH_RATE; 527 priv->mode |= SYN_BIT_HIGH_RATE;
528 if (SYN_CAP_EXTENDED(priv->capabilities))
529 priv->mode |= SYN_BIT_W_MODE;
534 530
535 if (synaptics_mode_cmd(psmouse, priv->mode)) 531 if (synaptics_mode_cmd(psmouse, priv->mode))
536 return -1; 532 return -1;
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index 75516996db20..316f2c897101 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -212,12 +212,17 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
212 * time before the ACK arrives. 212 * time before the ACK arrives.
213 */ 213 */
214 if (ps2_sendbyte(ps2dev, command & 0xff, 214 if (ps2_sendbyte(ps2dev, command & 0xff,
215 command == PS2_CMD_RESET_BAT ? 1000 : 200)) 215 command == PS2_CMD_RESET_BAT ? 1000 : 200)) {
216 goto out; 216 serio_pause_rx(ps2dev->serio);
217 goto out_reset_flags;
218 }
217 219
218 for (i = 0; i < send; i++) 220 for (i = 0; i < send; i++) {
219 if (ps2_sendbyte(ps2dev, param[i], 200)) 221 if (ps2_sendbyte(ps2dev, param[i], 200)) {
220 goto out; 222 serio_pause_rx(ps2dev->serio);
223 goto out_reset_flags;
224 }
225 }
221 226
222 /* 227 /*
223 * The reset command takes a long time to execute. 228 * The reset command takes a long time to execute.
@@ -234,17 +239,18 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
234 !(ps2dev->flags & PS2_FLAG_CMD), timeout); 239 !(ps2dev->flags & PS2_FLAG_CMD), timeout);
235 } 240 }
236 241
242 serio_pause_rx(ps2dev->serio);
243
237 if (param) 244 if (param)
238 for (i = 0; i < receive; i++) 245 for (i = 0; i < receive; i++)
239 param[i] = ps2dev->cmdbuf[(receive - 1) - i]; 246 param[i] = ps2dev->cmdbuf[(receive - 1) - i];
240 247
241 if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) 248 if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1))
242 goto out; 249 goto out_reset_flags;
243 250
244 rc = 0; 251 rc = 0;
245 252
246 out: 253 out_reset_flags:
247 serio_pause_rx(ps2dev->serio);
248 ps2dev->flags = 0; 254 ps2dev->flags = 0;
249 serio_continue_rx(ps2dev->serio); 255 serio_continue_rx(ps2dev->serio);
250 256
diff --git a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c
index 26b45936f9fd..1e8cd6f1fe9e 100644
--- a/drivers/input/serio/parkbd.c
+++ b/drivers/input/serio/parkbd.c
@@ -194,6 +194,7 @@ static int __init parkbd_init(void)
194 parkbd_port = parkbd_allocate_serio(); 194 parkbd_port = parkbd_allocate_serio();
195 if (!parkbd_port) { 195 if (!parkbd_port) {
196 parport_release(parkbd_dev); 196 parport_release(parkbd_dev);
197 parport_unregister_device(parkbd_dev);
197 return -ENOMEM; 198 return -ENOMEM;
198 } 199 }
199 200
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 0f5f968592bd..04edc8f7122f 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -668,18 +668,22 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val)
668 668
669static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m) 669static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m)
670{ 670{
671 int value;
671 struct spi_transfer *t = 672 struct spi_transfer *t =
672 list_entry(m->transfers.prev, struct spi_transfer, transfer_list); 673 list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
673 674
674 if (ts->model == 7845) { 675 if (ts->model == 7845) {
675 return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3; 676 value = be16_to_cpup((__be16 *)&(((char *)t->rx_buf)[1]));
676 } else { 677 } else {
677 /* 678 /*
678 * adjust: on-wire is a must-ignore bit, a BE12 value, then 679 * adjust: on-wire is a must-ignore bit, a BE12 value, then
679 * padding; built from two 8 bit values written msb-first. 680 * padding; built from two 8 bit values written msb-first.
680 */ 681 */
681 return be16_to_cpup((__be16 *)t->rx_buf) >> 3; 682 value = be16_to_cpup((__be16 *)t->rx_buf);
682 } 683 }
684
685 /* enforce ADC output is 12 bits width */
686 return (value >> 3) & 0xfff;
683} 687}
684 688
685static void ads7846_update_value(struct spi_message *m, int val) 689static void ads7846_update_value(struct spi_message *m, int val)
diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c
index ff0b75813daa..8275267eac25 100644
--- a/drivers/input/touchscreen/imx6ul_tsc.c
+++ b/drivers/input/touchscreen/imx6ul_tsc.c
@@ -94,7 +94,7 @@ struct imx6ul_tsc {
94 * TSC module need ADC to get the measure value. So 94 * TSC module need ADC to get the measure value. So
95 * before config TSC, we should initialize ADC module. 95 * before config TSC, we should initialize ADC module.
96 */ 96 */
97static void imx6ul_adc_init(struct imx6ul_tsc *tsc) 97static int imx6ul_adc_init(struct imx6ul_tsc *tsc)
98{ 98{
99 int adc_hc = 0; 99 int adc_hc = 0;
100 int adc_gc; 100 int adc_gc;
@@ -122,17 +122,23 @@ static void imx6ul_adc_init(struct imx6ul_tsc *tsc)
122 122
123 timeout = wait_for_completion_timeout 123 timeout = wait_for_completion_timeout
124 (&tsc->completion, ADC_TIMEOUT); 124 (&tsc->completion, ADC_TIMEOUT);
125 if (timeout == 0) 125 if (timeout == 0) {
126 dev_err(tsc->dev, "Timeout for adc calibration\n"); 126 dev_err(tsc->dev, "Timeout for adc calibration\n");
127 return -ETIMEDOUT;
128 }
127 129
128 adc_gs = readl(tsc->adc_regs + REG_ADC_GS); 130 adc_gs = readl(tsc->adc_regs + REG_ADC_GS);
129 if (adc_gs & ADC_CALF) 131 if (adc_gs & ADC_CALF) {
130 dev_err(tsc->dev, "ADC calibration failed\n"); 132 dev_err(tsc->dev, "ADC calibration failed\n");
133 return -EINVAL;
134 }
131 135
132 /* TSC need the ADC work in hardware trigger */ 136 /* TSC need the ADC work in hardware trigger */
133 adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG); 137 adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG);
134 adc_cfg |= ADC_HARDWARE_TRIGGER; 138 adc_cfg |= ADC_HARDWARE_TRIGGER;
135 writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG); 139 writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG);
140
141 return 0;
136} 142}
137 143
138/* 144/*
@@ -188,11 +194,17 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc)
188 writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL); 194 writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL);
189} 195}
190 196
191static void imx6ul_tsc_init(struct imx6ul_tsc *tsc) 197static int imx6ul_tsc_init(struct imx6ul_tsc *tsc)
192{ 198{
193 imx6ul_adc_init(tsc); 199 int err;
200
201 err = imx6ul_adc_init(tsc);
202 if (err)
203 return err;
194 imx6ul_tsc_channel_config(tsc); 204 imx6ul_tsc_channel_config(tsc);
195 imx6ul_tsc_set(tsc); 205 imx6ul_tsc_set(tsc);
206
207 return 0;
196} 208}
197 209
198static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc) 210static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc)
@@ -311,9 +323,7 @@ static int imx6ul_tsc_open(struct input_dev *input_dev)
311 return err; 323 return err;
312 } 324 }
313 325
314 imx6ul_tsc_init(tsc); 326 return imx6ul_tsc_init(tsc);
315
316 return 0;
317} 327}
318 328
319static void imx6ul_tsc_close(struct input_dev *input_dev) 329static void imx6ul_tsc_close(struct input_dev *input_dev)
@@ -337,7 +347,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
337 int tsc_irq; 347 int tsc_irq;
338 int adc_irq; 348 int adc_irq;
339 349
340 tsc = devm_kzalloc(&pdev->dev, sizeof(struct imx6ul_tsc), GFP_KERNEL); 350 tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL);
341 if (!tsc) 351 if (!tsc)
342 return -ENOMEM; 352 return -ENOMEM;
343 353
@@ -345,7 +355,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
345 if (!input_dev) 355 if (!input_dev)
346 return -ENOMEM; 356 return -ENOMEM;
347 357
348 input_dev->name = "iMX6UL TouchScreen Controller"; 358 input_dev->name = "iMX6UL Touchscreen Controller";
349 input_dev->id.bustype = BUS_HOST; 359 input_dev->id.bustype = BUS_HOST;
350 360
351 input_dev->open = imx6ul_tsc_open; 361 input_dev->open = imx6ul_tsc_open;
@@ -406,7 +416,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
406 } 416 }
407 417
408 adc_irq = platform_get_irq(pdev, 1); 418 adc_irq = platform_get_irq(pdev, 1);
409 if (adc_irq <= 0) { 419 if (adc_irq < 0) {
410 dev_err(&pdev->dev, "no adc irq resource?\n"); 420 dev_err(&pdev->dev, "no adc irq resource?\n");
411 return adc_irq; 421 return adc_irq;
412 } 422 }
@@ -491,7 +501,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
491 goto out; 501 goto out;
492 } 502 }
493 503
494 imx6ul_tsc_init(tsc); 504 retval = imx6ul_tsc_init(tsc);
495 } 505 }
496 506
497out: 507out:
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index 7cce87650fc8..1fafc9f57af6 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -394,12 +394,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
394 if (of_property_read_u32(np, "x-size", &pdata->x_size)) { 394 if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
395 dev_err(dev, "failed to get x-size property\n"); 395 dev_err(dev, "failed to get x-size property\n");
396 return NULL; 396 return NULL;
397 }; 397 }
398 398
399 if (of_property_read_u32(np, "y-size", &pdata->y_size)) { 399 if (of_property_read_u32(np, "y-size", &pdata->y_size)) {
400 dev_err(dev, "failed to get y-size property\n"); 400 dev_err(dev, "failed to get y-size property\n");
401 return NULL; 401 return NULL;
402 }; 402 }
403 403
404 of_property_read_u32(np, "contact-threshold", 404 of_property_read_u32(np, "contact-threshold",
405 &pdata->contact_threshold); 405 &pdata->contact_threshold);
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index d9da766719c8..cbe6a890a93a 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -23,8 +23,7 @@ config IOMMU_IO_PGTABLE
23config IOMMU_IO_PGTABLE_LPAE 23config IOMMU_IO_PGTABLE_LPAE
24 bool "ARMv7/v8 Long Descriptor Format" 24 bool "ARMv7/v8 Long Descriptor Format"
25 select IOMMU_IO_PGTABLE 25 select IOMMU_IO_PGTABLE
26 # SWIOTLB guarantees a dma_to_phys() implementation 26 depends on HAS_DMA && (ARM || ARM64 || COMPILE_TEST)
27 depends on ARM || ARM64 || (COMPILE_TEST && SWIOTLB)
28 help 27 help
29 Enable support for the ARM long descriptor pagetable format. 28 Enable support for the ARM long descriptor pagetable format.
30 This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page 29 This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index f82060e778a2..08d2775887f7 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2006,6 +2006,15 @@ static void do_detach(struct iommu_dev_data *dev_data)
2006{ 2006{
2007 struct amd_iommu *iommu; 2007 struct amd_iommu *iommu;
2008 2008
2009 /*
2010 * First check if the device is still attached. It might already
2011 * be detached from its domain because the generic
2012 * iommu_detach_group code detached it and we try again here in
2013 * our alias handling.
2014 */
2015 if (!dev_data->domain)
2016 return;
2017
2009 iommu = amd_iommu_rlookup_table[dev_data->devid]; 2018 iommu = amd_iommu_rlookup_table[dev_data->devid];
2010 2019
2011 /* decrease reference counters */ 2020 /* decrease reference counters */
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 5ef347a13cb5..1b066e7d144d 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1256,6 +1256,9 @@ static int iommu_init_pci(struct amd_iommu *iommu)
1256 if (!iommu->dev) 1256 if (!iommu->dev)
1257 return -ENODEV; 1257 return -ENODEV;
1258 1258
1259 /* Prevent binding other PCI device drivers to IOMMU devices */
1260 iommu->dev->match_driver = false;
1261
1259 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET, 1262 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET,
1260 &iommu->cap); 1263 &iommu->cap);
1261 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET, 1264 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET,
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index dafaf59dc3b8..286e890e7d64 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -56,6 +56,7 @@
56#define IDR0_TTF_SHIFT 2 56#define IDR0_TTF_SHIFT 2
57#define IDR0_TTF_MASK 0x3 57#define IDR0_TTF_MASK 0x3
58#define IDR0_TTF_AARCH64 (2 << IDR0_TTF_SHIFT) 58#define IDR0_TTF_AARCH64 (2 << IDR0_TTF_SHIFT)
59#define IDR0_TTF_AARCH32_64 (3 << IDR0_TTF_SHIFT)
59#define IDR0_S1P (1 << 1) 60#define IDR0_S1P (1 << 1)
60#define IDR0_S2P (1 << 0) 61#define IDR0_S2P (1 << 0)
61 62
@@ -342,7 +343,8 @@
342#define CMDQ_TLBI_0_VMID_SHIFT 32 343#define CMDQ_TLBI_0_VMID_SHIFT 32
343#define CMDQ_TLBI_0_ASID_SHIFT 48 344#define CMDQ_TLBI_0_ASID_SHIFT 48
344#define CMDQ_TLBI_1_LEAF (1UL << 0) 345#define CMDQ_TLBI_1_LEAF (1UL << 0)
345#define CMDQ_TLBI_1_ADDR_MASK ~0xfffUL 346#define CMDQ_TLBI_1_VA_MASK ~0xfffUL
347#define CMDQ_TLBI_1_IPA_MASK 0xfffffffff000UL
346 348
347#define CMDQ_PRI_0_SSID_SHIFT 12 349#define CMDQ_PRI_0_SSID_SHIFT 12
348#define CMDQ_PRI_0_SSID_MASK 0xfffffUL 350#define CMDQ_PRI_0_SSID_MASK 0xfffffUL
@@ -770,11 +772,13 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent)
770 break; 772 break;
771 case CMDQ_OP_TLBI_NH_VA: 773 case CMDQ_OP_TLBI_NH_VA:
772 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT; 774 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT;
773 /* Fallthrough */ 775 cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0;
776 cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_VA_MASK;
777 break;
774 case CMDQ_OP_TLBI_S2_IPA: 778 case CMDQ_OP_TLBI_S2_IPA:
775 cmd[0] |= (u64)ent->tlbi.vmid << CMDQ_TLBI_0_VMID_SHIFT; 779 cmd[0] |= (u64)ent->tlbi.vmid << CMDQ_TLBI_0_VMID_SHIFT;
776 cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0; 780 cmd[1] |= ent->tlbi.leaf ? CMDQ_TLBI_1_LEAF : 0;
777 cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_ADDR_MASK; 781 cmd[1] |= ent->tlbi.addr & CMDQ_TLBI_1_IPA_MASK;
778 break; 782 break;
779 case CMDQ_OP_TLBI_NH_ASID: 783 case CMDQ_OP_TLBI_NH_ASID:
780 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT; 784 cmd[0] |= (u64)ent->tlbi.asid << CMDQ_TLBI_0_ASID_SHIFT;
@@ -2460,7 +2464,13 @@ static int arm_smmu_device_probe(struct arm_smmu_device *smmu)
2460 } 2464 }
2461 2465
2462 /* We only support the AArch64 table format at present */ 2466 /* We only support the AArch64 table format at present */
2463 if ((reg & IDR0_TTF_MASK << IDR0_TTF_SHIFT) < IDR0_TTF_AARCH64) { 2467 switch (reg & IDR0_TTF_MASK << IDR0_TTF_SHIFT) {
2468 case IDR0_TTF_AARCH32_64:
2469 smmu->ias = 40;
2470 /* Fallthrough */
2471 case IDR0_TTF_AARCH64:
2472 break;
2473 default:
2464 dev_err(smmu->dev, "AArch64 table format not supported!\n"); 2474 dev_err(smmu->dev, "AArch64 table format not supported!\n");
2465 return -ENXIO; 2475 return -ENXIO;
2466 } 2476 }
@@ -2541,8 +2551,7 @@ static int arm_smmu_device_probe(struct arm_smmu_device *smmu)
2541 dev_warn(smmu->dev, 2551 dev_warn(smmu->dev,
2542 "failed to set DMA mask for table walker\n"); 2552 "failed to set DMA mask for table walker\n");
2543 2553
2544 if (!smmu->ias) 2554 smmu->ias = max(smmu->ias, smmu->oas);
2545 smmu->ias = smmu->oas;
2546 2555
2547 dev_info(smmu->dev, "ias %lu-bit, oas %lu-bit (features 0x%08x)\n", 2556 dev_info(smmu->dev, "ias %lu-bit, oas %lu-bit (features 0x%08x)\n",
2548 smmu->ias, smmu->oas, smmu->features); 2557 smmu->ias, smmu->oas, smmu->features);
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 041bc1810a86..35365f046923 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2301,6 +2301,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2301 2301
2302 if (ret) { 2302 if (ret) {
2303 spin_unlock_irqrestore(&device_domain_lock, flags); 2303 spin_unlock_irqrestore(&device_domain_lock, flags);
2304 free_devinfo_mem(info);
2304 return NULL; 2305 return NULL;
2305 } 2306 }
2306 2307
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 73c07482f487..7df97777662d 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -202,9 +202,9 @@ typedef u64 arm_lpae_iopte;
202 202
203static bool selftest_running = false; 203static bool selftest_running = false;
204 204
205static dma_addr_t __arm_lpae_dma_addr(struct device *dev, void *pages) 205static dma_addr_t __arm_lpae_dma_addr(void *pages)
206{ 206{
207 return phys_to_dma(dev, virt_to_phys(pages)); 207 return (dma_addr_t)virt_to_phys(pages);
208} 208}
209 209
210static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, 210static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp,
@@ -223,10 +223,10 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp,
223 goto out_free; 223 goto out_free;
224 /* 224 /*
225 * We depend on the IOMMU being able to work with any physical 225 * We depend on the IOMMU being able to work with any physical
226 * address directly, so if the DMA layer suggests it can't by 226 * address directly, so if the DMA layer suggests otherwise by
227 * giving us back some translation, that bodes very badly... 227 * translating or truncating them, that bodes very badly...
228 */ 228 */
229 if (dma != __arm_lpae_dma_addr(dev, pages)) 229 if (dma != virt_to_phys(pages))
230 goto out_unmap; 230 goto out_unmap;
231 } 231 }
232 232
@@ -243,10 +243,8 @@ out_free:
243static void __arm_lpae_free_pages(void *pages, size_t size, 243static void __arm_lpae_free_pages(void *pages, size_t size,
244 struct io_pgtable_cfg *cfg) 244 struct io_pgtable_cfg *cfg)
245{ 245{
246 struct device *dev = cfg->iommu_dev;
247
248 if (!selftest_running) 246 if (!selftest_running)
249 dma_unmap_single(dev, __arm_lpae_dma_addr(dev, pages), 247 dma_unmap_single(cfg->iommu_dev, __arm_lpae_dma_addr(pages),
250 size, DMA_TO_DEVICE); 248 size, DMA_TO_DEVICE);
251 free_pages_exact(pages, size); 249 free_pages_exact(pages, size);
252} 250}
@@ -254,12 +252,11 @@ static void __arm_lpae_free_pages(void *pages, size_t size,
254static void __arm_lpae_set_pte(arm_lpae_iopte *ptep, arm_lpae_iopte pte, 252static void __arm_lpae_set_pte(arm_lpae_iopte *ptep, arm_lpae_iopte pte,
255 struct io_pgtable_cfg *cfg) 253 struct io_pgtable_cfg *cfg)
256{ 254{
257 struct device *dev = cfg->iommu_dev;
258
259 *ptep = pte; 255 *ptep = pte;
260 256
261 if (!selftest_running) 257 if (!selftest_running)
262 dma_sync_single_for_device(dev, __arm_lpae_dma_addr(dev, ptep), 258 dma_sync_single_for_device(cfg->iommu_dev,
259 __arm_lpae_dma_addr(ptep),
263 sizeof(pte), DMA_TO_DEVICE); 260 sizeof(pte), DMA_TO_DEVICE);
264} 261}
265 262
@@ -629,6 +626,11 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg)
629 if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS) 626 if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS)
630 return NULL; 627 return NULL;
631 628
629 if (!selftest_running && cfg->iommu_dev->dma_pfn_offset) {
630 dev_err(cfg->iommu_dev, "Cannot accommodate DMA offset for IOMMU page tables\n");
631 return NULL;
632 }
633
632 data = kmalloc(sizeof(*data), GFP_KERNEL); 634 data = kmalloc(sizeof(*data), GFP_KERNEL);
633 if (!data) 635 if (!data)
634 return NULL; 636 return NULL;
diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index cf351c637464..a7c8c9ffbafd 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -62,7 +62,7 @@ static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
62 62
63 dev_alias->dev_id = alias; 63 dev_alias->dev_id = alias;
64 if (pdev != dev_alias->pdev) 64 if (pdev != dev_alias->pdev)
65 dev_alias->count += its_pci_msi_vec_count(dev_alias->pdev); 65 dev_alias->count += its_pci_msi_vec_count(pdev);
66 66
67 return 0; 67 return 0;
68} 68}
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index ac7ae2b3cb83..25ceae9f7348 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -719,6 +719,9 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids)
719out: 719out:
720 spin_unlock(&lpi_lock); 720 spin_unlock(&lpi_lock);
721 721
722 if (!bitmap)
723 *base = *nr_ids = 0;
724
722 return bitmap; 725 return bitmap;
723} 726}
724 727
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c
index de36237d7c6b..051645498b53 100644
--- a/drivers/mcb/mcb-pci.c
+++ b/drivers/mcb/mcb-pci.c
@@ -74,7 +74,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
74 ret = -ENOTSUPP; 74 ret = -ENOTSUPP;
75 dev_err(&pdev->dev, 75 dev_err(&pdev->dev,
76 "IO mapped PCI devices are not supported\n"); 76 "IO mapped PCI devices are not supported\n");
77 goto out_release; 77 goto out_iounmap;
78 } 78 }
79 79
80 pci_set_drvdata(pdev, priv); 80 pci_set_drvdata(pdev, priv);
@@ -89,7 +89,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
89 89
90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); 90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base);
91 if (ret < 0) 91 if (ret < 0)
92 goto out_iounmap; 92 goto out_mcb_bus;
93 num_cells = ret; 93 num_cells = ret;
94 94
95 dev_dbg(&pdev->dev, "Found %d cells\n", num_cells); 95 dev_dbg(&pdev->dev, "Found %d cells\n", num_cells);
@@ -98,6 +98,8 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
98 98
99 return 0; 99 return 0;
100 100
101out_mcb_bus:
102 mcb_release_bus(priv->bus);
101out_iounmap: 103out_iounmap:
102 iounmap(priv->base); 104 iounmap(priv->base);
103out_release: 105out_release:
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index e51de52eeb94..48b5890c28e3 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1997,7 +1997,8 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
1997 if (bitmap->mddev->bitmap_info.offset || bitmap->mddev->bitmap_info.file) 1997 if (bitmap->mddev->bitmap_info.offset || bitmap->mddev->bitmap_info.file)
1998 ret = bitmap_storage_alloc(&store, chunks, 1998 ret = bitmap_storage_alloc(&store, chunks,
1999 !bitmap->mddev->bitmap_info.external, 1999 !bitmap->mddev->bitmap_info.external,
2000 bitmap->cluster_slot); 2000 mddev_is_clustered(bitmap->mddev)
2001 ? bitmap->cluster_slot : 0);
2001 if (ret) 2002 if (ret)
2002 goto err; 2003 goto err;
2003 2004
diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c
index 240c9f0e85e7..8a096456579b 100644
--- a/drivers/md/dm-cache-policy-cleaner.c
+++ b/drivers/md/dm-cache-policy-cleaner.c
@@ -436,7 +436,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size,
436static struct dm_cache_policy_type wb_policy_type = { 436static struct dm_cache_policy_type wb_policy_type = {
437 .name = "cleaner", 437 .name = "cleaner",
438 .version = {1, 0, 0}, 438 .version = {1, 0, 0},
439 .hint_size = 0, 439 .hint_size = 4,
440 .owner = THIS_MODULE, 440 .owner = THIS_MODULE,
441 .create = wb_create 441 .create = wb_create
442}; 442};
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index ebaa4f803eec..192bb8beeb6b 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -203,7 +203,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
203 return -EINVAL; 203 return -EINVAL;
204 } 204 }
205 205
206 tmp_store = kmalloc(sizeof(*tmp_store), GFP_KERNEL); 206 tmp_store = kzalloc(sizeof(*tmp_store), GFP_KERNEL);
207 if (!tmp_store) { 207 if (!tmp_store) {
208 ti->error = "Exception store allocation failed"; 208 ti->error = "Exception store allocation failed";
209 return -ENOMEM; 209 return -ENOMEM;
@@ -215,7 +215,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
215 else if (persistent == 'N') 215 else if (persistent == 'N')
216 type = get_type("N"); 216 type = get_type("N");
217 else { 217 else {
218 ti->error = "Persistent flag is not P or N"; 218 ti->error = "Exception store type is not P or N";
219 r = -EINVAL; 219 r = -EINVAL;
220 goto bad_type; 220 goto bad_type;
221 } 221 }
@@ -233,7 +233,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
233 if (r) 233 if (r)
234 goto bad; 234 goto bad;
235 235
236 r = type->ctr(tmp_store, 0, NULL); 236 r = type->ctr(tmp_store, (strlen(argv[0]) > 1 ? &argv[0][1] : NULL));
237 if (r) { 237 if (r) {
238 ti->error = "Exception store type constructor failed"; 238 ti->error = "Exception store type constructor failed";
239 goto bad; 239 goto bad;
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 0b2536247cf5..fae34e7a0b1e 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -42,8 +42,7 @@ struct dm_exception_store_type {
42 const char *name; 42 const char *name;
43 struct module *module; 43 struct module *module;
44 44
45 int (*ctr) (struct dm_exception_store *store, 45 int (*ctr) (struct dm_exception_store *store, char *options);
46 unsigned argc, char **argv);
47 46
48 /* 47 /*
49 * Destroys this object when you've finished with it. 48 * Destroys this object when you've finished with it.
@@ -123,6 +122,8 @@ struct dm_exception_store {
123 unsigned chunk_shift; 122 unsigned chunk_shift;
124 123
125 void *context; 124 void *context;
125
126 bool userspace_supports_overflow;
126}; 127};
127 128
128/* 129/*
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 97e165183e79..a0901214aef5 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -329,8 +329,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
329 */ 329 */
330 if (min_region_size > (1 << 13)) { 330 if (min_region_size > (1 << 13)) {
331 /* If not a power of 2, make it the next power of 2 */ 331 /* If not a power of 2, make it the next power of 2 */
332 if (min_region_size & (min_region_size - 1)) 332 region_size = roundup_pow_of_two(min_region_size);
333 region_size = 1 << fls(region_size);
334 DMINFO("Choosing default region size of %lu sectors", 333 DMINFO("Choosing default region size of %lu sectors",
335 region_size); 334 region_size);
336 } else { 335 } else {
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index bf71583296f7..117a05e40090 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -7,6 +7,7 @@
7 7
8#include "dm-exception-store.h" 8#include "dm-exception-store.h"
9 9
10#include <linux/ctype.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/pagemap.h> 12#include <linux/pagemap.h>
12#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
@@ -843,10 +844,10 @@ static void persistent_drop_snapshot(struct dm_exception_store *store)
843 DMWARN("write header failed"); 844 DMWARN("write header failed");
844} 845}
845 846
846static int persistent_ctr(struct dm_exception_store *store, 847static int persistent_ctr(struct dm_exception_store *store, char *options)
847 unsigned argc, char **argv)
848{ 848{
849 struct pstore *ps; 849 struct pstore *ps;
850 int r;
850 851
851 /* allocate the pstore */ 852 /* allocate the pstore */
852 ps = kzalloc(sizeof(*ps), GFP_KERNEL); 853 ps = kzalloc(sizeof(*ps), GFP_KERNEL);
@@ -868,14 +869,32 @@ static int persistent_ctr(struct dm_exception_store *store,
868 869
869 ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0); 870 ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0);
870 if (!ps->metadata_wq) { 871 if (!ps->metadata_wq) {
871 kfree(ps);
872 DMERR("couldn't start header metadata update thread"); 872 DMERR("couldn't start header metadata update thread");
873 return -ENOMEM; 873 r = -ENOMEM;
874 goto err_workqueue;
875 }
876
877 if (options) {
878 char overflow = toupper(options[0]);
879 if (overflow == 'O')
880 store->userspace_supports_overflow = true;
881 else {
882 DMERR("Unsupported persistent store option: %s", options);
883 r = -EINVAL;
884 goto err_options;
885 }
874 } 886 }
875 887
876 store->context = ps; 888 store->context = ps;
877 889
878 return 0; 890 return 0;
891
892err_options:
893 destroy_workqueue(ps->metadata_wq);
894err_workqueue:
895 kfree(ps);
896
897 return r;
879} 898}
880 899
881static unsigned persistent_status(struct dm_exception_store *store, 900static unsigned persistent_status(struct dm_exception_store *store,
@@ -888,7 +907,8 @@ static unsigned persistent_status(struct dm_exception_store *store,
888 case STATUSTYPE_INFO: 907 case STATUSTYPE_INFO:
889 break; 908 break;
890 case STATUSTYPE_TABLE: 909 case STATUSTYPE_TABLE:
891 DMEMIT(" P %llu", (unsigned long long)store->chunk_size); 910 DMEMIT(" %s %llu", store->userspace_supports_overflow ? "PO" : "P",
911 (unsigned long long)store->chunk_size);
892 } 912 }
893 913
894 return sz; 914 return sz;
diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c
index 1ce9a2586e41..9b7c8c8049d6 100644
--- a/drivers/md/dm-snap-transient.c
+++ b/drivers/md/dm-snap-transient.c
@@ -70,8 +70,7 @@ static void transient_usage(struct dm_exception_store *store,
70 *metadata_sectors = 0; 70 *metadata_sectors = 0;
71} 71}
72 72
73static int transient_ctr(struct dm_exception_store *store, 73static int transient_ctr(struct dm_exception_store *store, char *options)
74 unsigned argc, char **argv)
75{ 74{
76 struct transient_c *tc; 75 struct transient_c *tc;
77 76
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index c0bcd6516dfe..c06b74e91cd6 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1098,7 +1098,7 @@ static void stop_merge(struct dm_snapshot *s)
1098} 1098}
1099 1099
1100/* 1100/*
1101 * Construct a snapshot mapping: <origin_dev> <COW-dev> <p/n> <chunk-size> 1101 * Construct a snapshot mapping: <origin_dev> <COW-dev> <p|po|n> <chunk-size>
1102 */ 1102 */
1103static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) 1103static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1104{ 1104{
@@ -1302,6 +1302,7 @@ static void __handover_exceptions(struct dm_snapshot *snap_src,
1302 1302
1303 u.store_swap = snap_dest->store; 1303 u.store_swap = snap_dest->store;
1304 snap_dest->store = snap_src->store; 1304 snap_dest->store = snap_src->store;
1305 snap_dest->store->userspace_supports_overflow = u.store_swap->userspace_supports_overflow;
1305 snap_src->store = u.store_swap; 1306 snap_src->store = u.store_swap;
1306 1307
1307 snap_dest->store->snap = snap_dest; 1308 snap_dest->store->snap = snap_dest;
@@ -1739,8 +1740,11 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
1739 1740
1740 pe = __find_pending_exception(s, pe, chunk); 1741 pe = __find_pending_exception(s, pe, chunk);
1741 if (!pe) { 1742 if (!pe) {
1742 s->snapshot_overflowed = 1; 1743 if (s->store->userspace_supports_overflow) {
1743 DMERR("Snapshot overflowed: Unable to allocate exception."); 1744 s->snapshot_overflowed = 1;
1745 DMERR("Snapshot overflowed: Unable to allocate exception.");
1746 } else
1747 __invalidate_snapshot(s, -ENOMEM);
1744 r = -EIO; 1748 r = -EIO;
1745 goto out_unlock; 1749 goto out_unlock;
1746 } 1750 }
@@ -2365,7 +2369,7 @@ static struct target_type origin_target = {
2365 2369
2366static struct target_type snapshot_target = { 2370static struct target_type snapshot_target = {
2367 .name = "snapshot", 2371 .name = "snapshot",
2368 .version = {1, 14, 0}, 2372 .version = {1, 15, 0},
2369 .module = THIS_MODULE, 2373 .module = THIS_MODULE,
2370 .ctr = snapshot_ctr, 2374 .ctr = snapshot_ctr,
2371 .dtr = snapshot_dtr, 2375 .dtr = snapshot_dtr,
@@ -2379,7 +2383,7 @@ static struct target_type snapshot_target = {
2379 2383
2380static struct target_type merge_target = { 2384static struct target_type merge_target = {
2381 .name = dm_snapshot_merge_target_name, 2385 .name = dm_snapshot_merge_target_name,
2382 .version = {1, 3, 0}, 2386 .version = {1, 4, 0},
2383 .module = THIS_MODULE, 2387 .module = THIS_MODULE,
2384 .ctr = snapshot_ctr, 2388 .ctr = snapshot_ctr,
2385 .dtr = snapshot_dtr, 2389 .dtr = snapshot_dtr,
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 6fcbfb063366..3897b90bd462 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3201,7 +3201,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
3201 metadata_low_callback, 3201 metadata_low_callback,
3202 pool); 3202 pool);
3203 if (r) 3203 if (r)
3204 goto out_free_pt; 3204 goto out_flags_changed;
3205 3205
3206 pt->callbacks.congested_fn = pool_is_congested; 3206 pt->callbacks.congested_fn = pool_is_congested;
3207 dm_table_add_target_callbacks(ti->table, &pt->callbacks); 3207 dm_table_add_target_callbacks(ti->table, &pt->callbacks);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6264781dc69a..1b5c6047e4f1 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1001,6 +1001,7 @@ static void end_clone_bio(struct bio *clone)
1001 struct dm_rq_target_io *tio = info->tio; 1001 struct dm_rq_target_io *tio = info->tio;
1002 struct bio *bio = info->orig; 1002 struct bio *bio = info->orig;
1003 unsigned int nr_bytes = info->orig->bi_iter.bi_size; 1003 unsigned int nr_bytes = info->orig->bi_iter.bi_size;
1004 int error = clone->bi_error;
1004 1005
1005 bio_put(clone); 1006 bio_put(clone);
1006 1007
@@ -1011,13 +1012,13 @@ static void end_clone_bio(struct bio *clone)
1011 * the remainder. 1012 * the remainder.
1012 */ 1013 */
1013 return; 1014 return;
1014 else if (bio->bi_error) { 1015 else if (error) {
1015 /* 1016 /*
1016 * Don't notice the error to the upper layer yet. 1017 * Don't notice the error to the upper layer yet.
1017 * The error handling decision is made by the target driver, 1018 * The error handling decision is made by the target driver,
1018 * when the request is completed. 1019 * when the request is completed.
1019 */ 1020 */
1020 tio->error = bio->bi_error; 1021 tio->error = error;
1021 return; 1022 return;
1022 } 1023 }
1023 1024
@@ -2837,8 +2838,6 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
2837 2838
2838 might_sleep(); 2839 might_sleep();
2839 2840
2840 map = dm_get_live_table(md, &srcu_idx);
2841
2842 spin_lock(&_minor_lock); 2841 spin_lock(&_minor_lock);
2843 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); 2842 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md))));
2844 set_bit(DMF_FREEING, &md->flags); 2843 set_bit(DMF_FREEING, &md->flags);
@@ -2852,14 +2851,14 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
2852 * do not race with internal suspend. 2851 * do not race with internal suspend.
2853 */ 2852 */
2854 mutex_lock(&md->suspend_lock); 2853 mutex_lock(&md->suspend_lock);
2854 map = dm_get_live_table(md, &srcu_idx);
2855 if (!dm_suspended_md(md)) { 2855 if (!dm_suspended_md(md)) {
2856 dm_table_presuspend_targets(map); 2856 dm_table_presuspend_targets(map);
2857 dm_table_postsuspend_targets(map); 2857 dm_table_postsuspend_targets(map);
2858 } 2858 }
2859 mutex_unlock(&md->suspend_lock);
2860
2861 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ 2859 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */
2862 dm_put_live_table(md, srcu_idx); 2860 dm_put_live_table(md, srcu_idx);
2861 mutex_unlock(&md->suspend_lock);
2863 2862
2864 /* 2863 /*
2865 * Rare, but there may be I/O requests still going to complete, 2864 * Rare, but there may be I/O requests still going to complete,
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4f5ecbe94ccb..c702de18207a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5409,9 +5409,13 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
5409 * which will now never happen */ 5409 * which will now never happen */
5410 wake_up_process(mddev->sync_thread->tsk); 5410 wake_up_process(mddev->sync_thread->tsk);
5411 5411
5412 if (mddev->external && test_bit(MD_CHANGE_PENDING, &mddev->flags))
5413 return -EBUSY;
5412 mddev_unlock(mddev); 5414 mddev_unlock(mddev);
5413 wait_event(resync_wait, !test_bit(MD_RECOVERY_RUNNING, 5415 wait_event(resync_wait, !test_bit(MD_RECOVERY_RUNNING,
5414 &mddev->recovery)); 5416 &mddev->recovery));
5417 wait_event(mddev->sb_wait,
5418 !test_bit(MD_CHANGE_PENDING, &mddev->flags));
5415 mddev_lock_nointr(mddev); 5419 mddev_lock_nointr(mddev);
5416 5420
5417 mutex_lock(&mddev->open_mutex); 5421 mutex_lock(&mddev->open_mutex);
@@ -8160,6 +8164,7 @@ void md_check_recovery(struct mddev *mddev)
8160 md_reap_sync_thread(mddev); 8164 md_reap_sync_thread(mddev);
8161 clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery); 8165 clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
8162 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 8166 clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
8167 clear_bit(MD_CHANGE_PENDING, &mddev->flags);
8163 goto unlock; 8168 goto unlock;
8164 } 8169 }
8165 8170
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index d222522c52e0..d132f06afdd1 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -470,8 +470,7 @@ static int multipath_run (struct mddev *mddev)
470 return 0; 470 return 0;
471 471
472out_free_conf: 472out_free_conf:
473 if (conf->pool) 473 mempool_destroy(conf->pool);
474 mempool_destroy(conf->pool);
475 kfree(conf->multipaths); 474 kfree(conf->multipaths);
476 kfree(conf); 475 kfree(conf);
477 mddev->private = NULL; 476 mddev->private = NULL;
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 63e619b2f44e..f8e5db0cb5aa 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -376,12 +376,6 @@ static int raid0_run(struct mddev *mddev)
376 struct md_rdev *rdev; 376 struct md_rdev *rdev;
377 bool discard_supported = false; 377 bool discard_supported = false;
378 378
379 rdev_for_each(rdev, mddev) {
380 disk_stack_limits(mddev->gendisk, rdev->bdev,
381 rdev->data_offset << 9);
382 if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
383 discard_supported = true;
384 }
385 blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); 379 blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
386 blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors); 380 blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
387 blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors); 381 blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
@@ -390,6 +384,12 @@ static int raid0_run(struct mddev *mddev)
390 blk_queue_io_opt(mddev->queue, 384 blk_queue_io_opt(mddev->queue,
391 (mddev->chunk_sectors << 9) * mddev->raid_disks); 385 (mddev->chunk_sectors << 9) * mddev->raid_disks);
392 386
387 rdev_for_each(rdev, mddev) {
388 disk_stack_limits(mddev->gendisk, rdev->bdev,
389 rdev->data_offset << 9);
390 if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
391 discard_supported = true;
392 }
393 if (!discard_supported) 393 if (!discard_supported)
394 queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); 394 queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
395 else 395 else
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 4517f06c41ba..ddd8a5f572aa 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
881 } 881 }
882 882
883 if (bio && bio_data_dir(bio) == WRITE) { 883 if (bio && bio_data_dir(bio) == WRITE) {
884 if (bio->bi_iter.bi_sector >= 884 if (bio->bi_iter.bi_sector >= conf->next_resync) {
885 conf->mddev->curr_resync_completed) {
886 if (conf->start_next_window == MaxSector) 885 if (conf->start_next_window == MaxSector)
887 conf->start_next_window = 886 conf->start_next_window =
888 conf->next_resync + 887 conf->next_resync +
@@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf)
1516 conf->r1buf_pool = NULL; 1515 conf->r1buf_pool = NULL;
1517 1516
1518 spin_lock_irq(&conf->resync_lock); 1517 spin_lock_irq(&conf->resync_lock);
1519 conf->next_resync = 0; 1518 conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE;
1520 conf->start_next_window = MaxSector; 1519 conf->start_next_window = MaxSector;
1521 conf->current_window_requests += 1520 conf->current_window_requests +=
1522 conf->next_window_requests; 1521 conf->next_window_requests;
@@ -2383,8 +2382,8 @@ static void raid1d(struct md_thread *thread)
2383 } 2382 }
2384 spin_unlock_irqrestore(&conf->device_lock, flags); 2383 spin_unlock_irqrestore(&conf->device_lock, flags);
2385 while (!list_empty(&tmp)) { 2384 while (!list_empty(&tmp)) {
2386 r1_bio = list_first_entry(&conf->bio_end_io_list, 2385 r1_bio = list_first_entry(&tmp, struct r1bio,
2387 struct r1bio, retry_list); 2386 retry_list);
2388 list_del(&r1_bio->retry_list); 2387 list_del(&r1_bio->retry_list);
2389 raid_end_bio_io(r1_bio); 2388 raid_end_bio_io(r1_bio);
2390 } 2389 }
@@ -2843,8 +2842,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
2843 2842
2844 abort: 2843 abort:
2845 if (conf) { 2844 if (conf) {
2846 if (conf->r1bio_pool) 2845 mempool_destroy(conf->r1bio_pool);
2847 mempool_destroy(conf->r1bio_pool);
2848 kfree(conf->mirrors); 2846 kfree(conf->mirrors);
2849 safe_put_page(conf->tmppage); 2847 safe_put_page(conf->tmppage);
2850 kfree(conf->poolinfo); 2848 kfree(conf->poolinfo);
@@ -2946,8 +2944,7 @@ static void raid1_free(struct mddev *mddev, void *priv)
2946{ 2944{
2947 struct r1conf *conf = priv; 2945 struct r1conf *conf = priv;
2948 2946
2949 if (conf->r1bio_pool) 2947 mempool_destroy(conf->r1bio_pool);
2950 mempool_destroy(conf->r1bio_pool);
2951 kfree(conf->mirrors); 2948 kfree(conf->mirrors);
2952 safe_put_page(conf->tmppage); 2949 safe_put_page(conf->tmppage);
2953 kfree(conf->poolinfo); 2950 kfree(conf->poolinfo);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 0fc33eb88855..9f69dc526f8c 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2688,8 +2688,8 @@ static void raid10d(struct md_thread *thread)
2688 } 2688 }
2689 spin_unlock_irqrestore(&conf->device_lock, flags); 2689 spin_unlock_irqrestore(&conf->device_lock, flags);
2690 while (!list_empty(&tmp)) { 2690 while (!list_empty(&tmp)) {
2691 r10_bio = list_first_entry(&conf->bio_end_io_list, 2691 r10_bio = list_first_entry(&tmp, struct r10bio,
2692 struct r10bio, retry_list); 2692 retry_list);
2693 list_del(&r10_bio->retry_list); 2693 list_del(&r10_bio->retry_list);
2694 raid_end_bio_io(r10_bio); 2694 raid_end_bio_io(r10_bio);
2695 } 2695 }
@@ -3486,8 +3486,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
3486 printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n", 3486 printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n",
3487 mdname(mddev)); 3487 mdname(mddev));
3488 if (conf) { 3488 if (conf) {
3489 if (conf->r10bio_pool) 3489 mempool_destroy(conf->r10bio_pool);
3490 mempool_destroy(conf->r10bio_pool);
3491 kfree(conf->mirrors); 3490 kfree(conf->mirrors);
3492 safe_put_page(conf->tmppage); 3491 safe_put_page(conf->tmppage);
3493 kfree(conf); 3492 kfree(conf);
@@ -3682,8 +3681,7 @@ static int run(struct mddev *mddev)
3682 3681
3683out_free_conf: 3682out_free_conf:
3684 md_unregister_thread(&mddev->thread); 3683 md_unregister_thread(&mddev->thread);
3685 if (conf->r10bio_pool) 3684 mempool_destroy(conf->r10bio_pool);
3686 mempool_destroy(conf->r10bio_pool);
3687 safe_put_page(conf->tmppage); 3685 safe_put_page(conf->tmppage);
3688 kfree(conf->mirrors); 3686 kfree(conf->mirrors);
3689 kfree(conf); 3687 kfree(conf);
@@ -3696,8 +3694,7 @@ static void raid10_free(struct mddev *mddev, void *priv)
3696{ 3694{
3697 struct r10conf *conf = priv; 3695 struct r10conf *conf = priv;
3698 3696
3699 if (conf->r10bio_pool) 3697 mempool_destroy(conf->r10bio_pool);
3700 mempool_destroy(conf->r10bio_pool);
3701 safe_put_page(conf->tmppage); 3698 safe_put_page(conf->tmppage);
3702 kfree(conf->mirrors); 3699 kfree(conf->mirrors);
3703 kfree(conf->mirrors_old); 3700 kfree(conf->mirrors_old);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 15ef2c641b2b..49bb8d3ff9be 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2271,8 +2271,7 @@ static void shrink_stripes(struct r5conf *conf)
2271 drop_one_stripe(conf)) 2271 drop_one_stripe(conf))
2272 ; 2272 ;
2273 2273
2274 if (conf->slab_cache) 2274 kmem_cache_destroy(conf->slab_cache);
2275 kmem_cache_destroy(conf->slab_cache);
2276 conf->slab_cache = NULL; 2275 conf->slab_cache = NULL;
2277} 2276}
2278 2277
@@ -3150,6 +3149,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
3150 spin_unlock_irq(&sh->stripe_lock); 3149 spin_unlock_irq(&sh->stripe_lock);
3151 if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) 3150 if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags))
3152 wake_up(&conf->wait_for_overlap); 3151 wake_up(&conf->wait_for_overlap);
3152 if (bi)
3153 s->to_read--;
3153 while (bi && bi->bi_iter.bi_sector < 3154 while (bi && bi->bi_iter.bi_sector <
3154 sh->dev[i].sector + STRIPE_SECTORS) { 3155 sh->dev[i].sector + STRIPE_SECTORS) {
3155 struct bio *nextbi = 3156 struct bio *nextbi =
@@ -3169,6 +3170,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
3169 */ 3170 */
3170 clear_bit(R5_LOCKED, &sh->dev[i].flags); 3171 clear_bit(R5_LOCKED, &sh->dev[i].flags);
3171 } 3172 }
3173 s->to_write = 0;
3174 s->written = 0;
3172 3175
3173 if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) 3176 if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state))
3174 if (atomic_dec_and_test(&conf->pending_full_writes)) 3177 if (atomic_dec_and_test(&conf->pending_full_writes))
@@ -3300,7 +3303,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s,
3300 */ 3303 */
3301 return 0; 3304 return 0;
3302 3305
3303 for (i = 0; i < s->failed; i++) { 3306 for (i = 0; i < s->failed && i < 2; i++) {
3304 if (fdev[i]->towrite && 3307 if (fdev[i]->towrite &&
3305 !test_bit(R5_UPTODATE, &fdev[i]->flags) && 3308 !test_bit(R5_UPTODATE, &fdev[i]->flags) &&
3306 !test_bit(R5_OVERWRITE, &fdev[i]->flags)) 3309 !test_bit(R5_OVERWRITE, &fdev[i]->flags))
@@ -3324,7 +3327,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s,
3324 sh->sector < sh->raid_conf->mddev->recovery_cp) 3327 sh->sector < sh->raid_conf->mddev->recovery_cp)
3325 /* reconstruct-write isn't being forced */ 3328 /* reconstruct-write isn't being forced */
3326 return 0; 3329 return 0;
3327 for (i = 0; i < s->failed; i++) { 3330 for (i = 0; i < s->failed && i < 2; i++) {
3328 if (s->failed_num[i] != sh->pd_idx && 3331 if (s->failed_num[i] != sh->pd_idx &&
3329 s->failed_num[i] != sh->qd_idx && 3332 s->failed_num[i] != sh->qd_idx &&
3330 !test_bit(R5_UPTODATE, &fdev[i]->flags) && 3333 !test_bit(R5_UPTODATE, &fdev[i]->flags) &&
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index f28cb28a62f8..2c7f8d7c0595 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -42,6 +42,8 @@ int intel_lpss_resume(struct device *dev);
42 .thaw = intel_lpss_resume, \ 42 .thaw = intel_lpss_resume, \
43 .poweroff = intel_lpss_suspend, \ 43 .poweroff = intel_lpss_suspend, \
44 .restore = intel_lpss_resume, 44 .restore = intel_lpss_resume,
45#else
46#define INTEL_LPSS_SLEEP_PM_OPS
45#endif 47#endif
46 48
47#define INTEL_LPSS_RUNTIME_PM_OPS \ 49#define INTEL_LPSS_RUNTIME_PM_OPS \
diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
index c52162ea3d0a..586098f1b233 100644
--- a/drivers/mfd/max77843.c
+++ b/drivers/mfd/max77843.c
@@ -80,7 +80,7 @@ static int max77843_chg_init(struct max77693_dev *max77843)
80 if (!max77843->i2c_chg) { 80 if (!max77843->i2c_chg) {
81 dev_err(&max77843->i2c->dev, 81 dev_err(&max77843->i2c->dev,
82 "Cannot allocate I2C device for Charger\n"); 82 "Cannot allocate I2C device for Charger\n");
83 return PTR_ERR(max77843->i2c_chg); 83 return -ENODEV;
84 } 84 }
85 i2c_set_clientdata(max77843->i2c_chg, max77843); 85 i2c_set_clientdata(max77843->i2c_chg, max77843);
86 86
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 8af12c884b04..103baf0e0c5b 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -105,6 +105,7 @@ EXPORT_SYMBOL_GPL(cxl_allocate_afu_irqs);
105 105
106void cxl_free_afu_irqs(struct cxl_context *ctx) 106void cxl_free_afu_irqs(struct cxl_context *ctx)
107{ 107{
108 afu_irq_name_free(ctx);
108 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter); 109 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter);
109} 110}
110EXPORT_SYMBOL_GPL(cxl_free_afu_irqs); 111EXPORT_SYMBOL_GPL(cxl_free_afu_irqs);
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index e762f85ee233..2faa1270d085 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -275,6 +275,9 @@ static void reclaim_ctx(struct rcu_head *rcu)
275 if (ctx->kernelapi) 275 if (ctx->kernelapi)
276 kfree(ctx->mapping); 276 kfree(ctx->mapping);
277 277
278 if (ctx->irq_bitmap)
279 kfree(ctx->irq_bitmap);
280
278 kfree(ctx); 281 kfree(ctx);
279} 282}
280 283
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index 1c30ef77073d..0cfb9c129f27 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -677,6 +677,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu);
677void cxl_release_serr_irq(struct cxl_afu *afu); 677void cxl_release_serr_irq(struct cxl_afu *afu);
678int afu_register_irqs(struct cxl_context *ctx, u32 count); 678int afu_register_irqs(struct cxl_context *ctx, u32 count);
679void afu_release_irqs(struct cxl_context *ctx, void *cookie); 679void afu_release_irqs(struct cxl_context *ctx, void *cookie);
680void afu_irq_name_free(struct cxl_context *ctx);
680irqreturn_t cxl_slice_irq_err(int irq, void *data); 681irqreturn_t cxl_slice_irq_err(int irq, void *data);
681 682
682int cxl_debugfs_init(void); 683int cxl_debugfs_init(void);
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index a30bf285b5bd..7ccd2998be92 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -120,9 +120,16 @@ int afu_release(struct inode *inode, struct file *file)
120 __func__, ctx->pe); 120 __func__, ctx->pe);
121 cxl_context_detach(ctx); 121 cxl_context_detach(ctx);
122 122
123 mutex_lock(&ctx->mapping_lock); 123
124 ctx->mapping = NULL; 124 /*
125 mutex_unlock(&ctx->mapping_lock); 125 * Delete the context's mapping pointer, unless it's created by the
126 * kernel API, in which case leave it so it can be freed by reclaim_ctx()
127 */
128 if (!ctx->kernelapi) {
129 mutex_lock(&ctx->mapping_lock);
130 ctx->mapping = NULL;
131 mutex_unlock(&ctx->mapping_lock);
132 }
126 133
127 put_device(&ctx->afu->dev); 134 put_device(&ctx->afu->dev);
128 135
diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index 583b42afeda2..09a406058c46 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -414,7 +414,7 @@ void cxl_release_psl_irq(struct cxl_afu *afu)
414 kfree(afu->psl_irq_name); 414 kfree(afu->psl_irq_name);
415} 415}
416 416
417static void afu_irq_name_free(struct cxl_context *ctx) 417void afu_irq_name_free(struct cxl_context *ctx)
418{ 418{
419 struct cxl_irq_name *irq_name, *tmp; 419 struct cxl_irq_name *irq_name, *tmp;
420 420
@@ -524,7 +524,5 @@ void afu_release_irqs(struct cxl_context *ctx, void *cookie)
524 afu_irq_name_free(ctx); 524 afu_irq_name_free(ctx);
525 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter); 525 cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter);
526 526
527 kfree(ctx->irq_bitmap);
528 ctx->irq_bitmap = NULL;
529 ctx->irq_count = 0; 527 ctx->irq_count = 0;
530} 528}
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index b37f2e8004f5..d2e75c88f4d2 100644
--- a/drivers/misc/cxl/native.c
+++ b/drivers/misc/cxl/native.c
@@ -457,6 +457,7 @@ static int activate_afu_directed(struct cxl_afu *afu)
457 457
458 dev_info(&afu->dev, "Activating AFU directed mode\n"); 458 dev_info(&afu->dev, "Activating AFU directed mode\n");
459 459
460 afu->num_procs = afu->max_procs_virtualised;
460 if (afu->spa == NULL) { 461 if (afu->spa == NULL) {
461 if (cxl_alloc_spa(afu)) 462 if (cxl_alloc_spa(afu))
462 return -ENOMEM; 463 return -ENOMEM;
@@ -468,7 +469,6 @@ static int activate_afu_directed(struct cxl_afu *afu)
468 cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L); 469 cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L);
469 470
470 afu->current_mode = CXL_MODE_DIRECTED; 471 afu->current_mode = CXL_MODE_DIRECTED;
471 afu->num_procs = afu->max_procs_virtualised;
472 472
473 if ((rc = cxl_chardev_m_afu_add(afu))) 473 if ((rc = cxl_chardev_m_afu_add(afu)))
474 return rc; 474 return rc;
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index a5e977192b61..85761d7eb333 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1035,6 +1035,32 @@ static int cxl_read_vsec(struct cxl *adapter, struct pci_dev *dev)
1035 return 0; 1035 return 0;
1036} 1036}
1037 1037
1038/*
1039 * Workaround a PCIe Host Bridge defect on some cards, that can cause
1040 * malformed Transaction Layer Packet (TLP) errors to be erroneously
1041 * reported. Mask this error in the Uncorrectable Error Mask Register.
1042 *
1043 * The upper nibble of the PSL revision is used to distinguish between
1044 * different cards. The affected ones have it set to 0.
1045 */
1046static void cxl_fixup_malformed_tlp(struct cxl *adapter, struct pci_dev *dev)
1047{
1048 int aer;
1049 u32 data;
1050
1051 if (adapter->psl_rev & 0xf000)
1052 return;
1053 if (!(aer = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR)))
1054 return;
1055 pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, &data);
1056 if (data & PCI_ERR_UNC_MALF_TLP)
1057 if (data & PCI_ERR_UNC_INTN)
1058 return;
1059 data |= PCI_ERR_UNC_MALF_TLP;
1060 data |= PCI_ERR_UNC_INTN;
1061 pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, data);
1062}
1063
1038static int cxl_vsec_looks_ok(struct cxl *adapter, struct pci_dev *dev) 1064static int cxl_vsec_looks_ok(struct cxl *adapter, struct pci_dev *dev)
1039{ 1065{
1040 if (adapter->vsec_status & CXL_STATUS_SECOND_PORT) 1066 if (adapter->vsec_status & CXL_STATUS_SECOND_PORT)
@@ -1134,6 +1160,8 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
1134 if ((rc = cxl_vsec_looks_ok(adapter, dev))) 1160 if ((rc = cxl_vsec_looks_ok(adapter, dev)))
1135 return rc; 1161 return rc;
1136 1162
1163 cxl_fixup_malformed_tlp(adapter, dev);
1164
1137 if ((rc = setup_cxl_bars(dev))) 1165 if ((rc = setup_cxl_bars(dev)))
1138 return rc; 1166 return rc;
1139 1167
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index 8eec887c8f70..6d7c188fb65c 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -1209,7 +1209,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
1209 * after the host receives the enum_resp 1209 * after the host receives the enum_resp
1210 * message clients may be added or removed 1210 * message clients may be added or removed
1211 */ 1211 */
1212 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS && 1212 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS ||
1213 dev->hbm_state >= MEI_HBM_STOPPED) { 1213 dev->hbm_state >= MEI_HBM_STOPPED) {
1214 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", 1214 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n",
1215 dev->dev_state, dev->hbm_state); 1215 dev->dev_state, dev->hbm_state);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 781e4db31767..7fb0753abe30 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -182,6 +182,7 @@ struct omap_hsmmc_host {
182 struct clk *fclk; 182 struct clk *fclk;
183 struct clk *dbclk; 183 struct clk *dbclk;
184 struct regulator *pbias; 184 struct regulator *pbias;
185 bool pbias_enabled;
185 void __iomem *base; 186 void __iomem *base;
186 int vqmmc_enabled; 187 int vqmmc_enabled;
187 resource_size_t mapbase; 188 resource_size_t mapbase;
@@ -328,20 +329,22 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
328 return ret; 329 return ret;
329 } 330 }
330 331
331 if (!regulator_is_enabled(host->pbias)) { 332 if (host->pbias_enabled == 0) {
332 ret = regulator_enable(host->pbias); 333 ret = regulator_enable(host->pbias);
333 if (ret) { 334 if (ret) {
334 dev_err(host->dev, "pbias reg enable fail\n"); 335 dev_err(host->dev, "pbias reg enable fail\n");
335 return ret; 336 return ret;
336 } 337 }
338 host->pbias_enabled = 1;
337 } 339 }
338 } else { 340 } else {
339 if (regulator_is_enabled(host->pbias)) { 341 if (host->pbias_enabled == 1) {
340 ret = regulator_disable(host->pbias); 342 ret = regulator_disable(host->pbias);
341 if (ret) { 343 if (ret) {
342 dev_err(host->dev, "pbias reg disable fail\n"); 344 dev_err(host->dev, "pbias reg disable fail\n");
343 return ret; 345 return ret;
344 } 346 }
347 host->pbias_enabled = 0;
345 } 348 }
346 } 349 }
347 350
@@ -475,7 +478,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
475 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); 478 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc");
476 if (IS_ERR(mmc->supply.vmmc)) { 479 if (IS_ERR(mmc->supply.vmmc)) {
477 ret = PTR_ERR(mmc->supply.vmmc); 480 ret = PTR_ERR(mmc->supply.vmmc);
478 if (ret != -ENODEV) 481 if ((ret != -ENODEV) && host->dev->of_node)
479 return ret; 482 return ret;
480 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", 483 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
481 PTR_ERR(mmc->supply.vmmc)); 484 PTR_ERR(mmc->supply.vmmc));
@@ -490,7 +493,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
490 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); 493 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux");
491 if (IS_ERR(mmc->supply.vqmmc)) { 494 if (IS_ERR(mmc->supply.vqmmc)) {
492 ret = PTR_ERR(mmc->supply.vqmmc); 495 ret = PTR_ERR(mmc->supply.vqmmc);
493 if (ret != -ENODEV) 496 if ((ret != -ENODEV) && host->dev->of_node)
494 return ret; 497 return ret;
495 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", 498 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
496 PTR_ERR(mmc->supply.vqmmc)); 499 PTR_ERR(mmc->supply.vqmmc));
@@ -500,7 +503,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
500 host->pbias = devm_regulator_get_optional(host->dev, "pbias"); 503 host->pbias = devm_regulator_get_optional(host->dev, "pbias");
501 if (IS_ERR(host->pbias)) { 504 if (IS_ERR(host->pbias)) {
502 ret = PTR_ERR(host->pbias); 505 ret = PTR_ERR(host->pbias);
503 if (ret != -ENODEV) 506 if ((ret != -ENODEV) && host->dev->of_node)
504 return ret; 507 return ret;
505 dev_dbg(host->dev, "unable to get pbias regulator %ld\n", 508 dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
506 PTR_ERR(host->pbias)); 509 PTR_ERR(host->pbias));
@@ -2053,6 +2056,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2053 host->base = base + pdata->reg_offset; 2056 host->base = base + pdata->reg_offset;
2054 host->power_mode = MMC_POWER_OFF; 2057 host->power_mode = MMC_POWER_OFF;
2055 host->next_data.cookie = 1; 2058 host->next_data.cookie = 1;
2059 host->pbias_enabled = 0;
2056 host->vqmmc_enabled = 0; 2060 host->vqmmc_enabled = 0;
2057 2061
2058 ret = omap_hsmmc_gpio_init(mmc, host, pdata); 2062 ret = omap_hsmmc_gpio_init(mmc, host, pdata);
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index d1556643a41d..a0f05de5409f 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -43,6 +43,7 @@ static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
43 43
44static const struct sdhci_pltfm_data soc_data_sama5d2 = { 44static const struct sdhci_pltfm_data soc_data_sama5d2 = {
45 .ops = &sdhci_at91_sama5d2_ops, 45 .ops = &sdhci_at91_sama5d2_ops,
46 .quirks2 = SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST,
46}; 47};
47 48
48static const struct of_device_id sdhci_at91_dt_match[] = { 49static const struct of_device_id sdhci_at91_dt_match[] = {
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 946d37f94a31..f5edf9d3a18a 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -135,6 +135,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
135 struct sdhci_pxa *pxa = pltfm_host->priv; 135 struct sdhci_pxa *pxa = pltfm_host->priv;
136 struct resource *res; 136 struct resource *res;
137 137
138 host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
138 host->quirks |= SDHCI_QUIRK_MISSING_CAPS; 139 host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
139 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 140 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
140 "conf-sdio3"); 141 "conf-sdio3");
@@ -290,6 +291,9 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
290 uhs == MMC_TIMING_UHS_DDR50) { 291 uhs == MMC_TIMING_UHS_DDR50) {
291 reg_val &= ~SDIO3_CONF_CLK_INV; 292 reg_val &= ~SDIO3_CONF_CLK_INV;
292 reg_val |= SDIO3_CONF_SD_FB_CLK; 293 reg_val |= SDIO3_CONF_SD_FB_CLK;
294 } else if (uhs == MMC_TIMING_MMC_HS) {
295 reg_val &= ~SDIO3_CONF_CLK_INV;
296 reg_val &= ~SDIO3_CONF_SD_FB_CLK;
293 } else { 297 } else {
294 reg_val |= SDIO3_CONF_CLK_INV; 298 reg_val |= SDIO3_CONF_CLK_INV;
295 reg_val &= ~SDIO3_CONF_SD_FB_CLK; 299 reg_val &= ~SDIO3_CONF_SD_FB_CLK;
@@ -398,7 +402,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
398 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 402 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
399 ret = armada_38x_quirks(pdev, host); 403 ret = armada_38x_quirks(pdev, host);
400 if (ret < 0) 404 if (ret < 0)
401 goto err_clk_get; 405 goto err_mbus_win;
402 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); 406 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
403 if (ret < 0) 407 if (ret < 0)
404 goto err_mbus_win; 408 goto err_mbus_win;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 64b7fdbd1a9c..fbc7efdddcb5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1160,6 +1160,8 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1160 host->mmc->actual_clock = 0; 1160 host->mmc->actual_clock = 0;
1161 1161
1162 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 1162 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
1163 if (host->quirks2 & SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST)
1164 mdelay(1);
1163 1165
1164 if (clock == 0) 1166 if (clock == 0)
1165 return; 1167 return;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 7c02ff46c8ac..9d4aa31b683a 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -412,6 +412,11 @@ struct sdhci_host {
412#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) 412#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14)
413/* Broken Clock divider zero in controller */ 413/* Broken Clock divider zero in controller */
414#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) 414#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15)
415/*
416 * When internal clock is disabled, a delay is needed before modifying the
417 * SD clock frequency or enabling back the internal clock.
418 */
419#define SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST (1<<16)
415 420
416 int irq; /* Device IRQ */ 421 int irq; /* Device IRQ */
417 void __iomem *ioaddr; /* Mapped address */ 422 void __iomem *ioaddr; /* Mapped address */
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 2426db88db36..f04445b992f5 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -879,7 +879,7 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom)
879 oob_chunk_size); 879 oob_chunk_size);
880 880
881 /* the last chunk */ 881 /* the last chunk */
882 memcpy16_toio(&s[oob_chunk_size * sparebuf_size], 882 memcpy16_toio(&s[i * sparebuf_size],
883 &d[i * oob_chunk_size], 883 &d[i * oob_chunk_size],
884 host->used_oobsize - i * oob_chunk_size); 884 host->used_oobsize - i * oob_chunk_size);
885 } 885 }
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index f97a58d6aae1..e7d333c162be 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -147,6 +147,10 @@
147#define NFC_ECC_MODE GENMASK(15, 12) 147#define NFC_ECC_MODE GENMASK(15, 12)
148#define NFC_RANDOM_SEED GENMASK(30, 16) 148#define NFC_RANDOM_SEED GENMASK(30, 16)
149 149
150/* NFC_USER_DATA helper macros */
151#define NFC_BUF_TO_USER_DATA(buf) ((buf)[0] | ((buf)[1] << 8) | \
152 ((buf)[2] << 16) | ((buf)[3] << 24))
153
150#define NFC_DEFAULT_TIMEOUT_MS 1000 154#define NFC_DEFAULT_TIMEOUT_MS 1000
151 155
152#define NFC_SRAM_SIZE 1024 156#define NFC_SRAM_SIZE 1024
@@ -646,15 +650,9 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
646 offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize; 650 offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize;
647 651
648 /* Fill OOB data in */ 652 /* Fill OOB data in */
649 if (oob_required) { 653 writel(NFC_BUF_TO_USER_DATA(chip->oob_poi +
650 tmp = 0xffffffff; 654 layout->oobfree[i].offset),
651 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, &tmp, 655 nfc->regs + NFC_REG_USER_DATA_BASE);
652 4);
653 } else {
654 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE,
655 chip->oob_poi + offset - mtd->writesize,
656 4);
657 }
658 656
659 chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1); 657 chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
660 658
@@ -784,14 +782,8 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
784 offset += ecc->size; 782 offset += ecc->size;
785 783
786 /* Fill OOB data in */ 784 /* Fill OOB data in */
787 if (oob_required) { 785 writel(NFC_BUF_TO_USER_DATA(oob),
788 tmp = 0xffffffff; 786 nfc->regs + NFC_REG_USER_DATA_BASE);
789 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, &tmp,
790 4);
791 } else {
792 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, oob,
793 4);
794 }
795 787
796 tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR | 788 tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR |
797 (1 << 30); 789 (1 << 30);
@@ -1389,6 +1381,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
1389 node); 1381 node);
1390 nand_release(&chip->mtd); 1382 nand_release(&chip->mtd);
1391 sunxi_nand_ecc_cleanup(&chip->nand.ecc); 1383 sunxi_nand_ecc_cleanup(&chip->nand.ecc);
1384 list_del(&chip->node);
1392 } 1385 }
1393} 1386}
1394 1387
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index e5fac368068a..131026fbc2d7 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -87,6 +87,7 @@ static const struct pci_device_id peak_pci_tbl[] = {
87 {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 87 {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
88 {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 88 {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
89 {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 89 {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
90 {PEAK_PCI_VENDOR_ID, PEAK_PCIE_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,},
90#ifdef CONFIG_CAN_PEAK_PCIEC 91#ifdef CONFIG_CAN_PEAK_PCIEC
91 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 92 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
92 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 93 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
index 2c063b60db4b..96f485ab612e 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
@@ -327,9 +327,13 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
327 pdata->debugfs_xpcs_reg = 0; 327 pdata->debugfs_xpcs_reg = 0;
328 328
329 buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name); 329 buf = kasprintf(GFP_KERNEL, "amd-xgbe-%s", pdata->netdev->name);
330 if (!buf)
331 return;
332
330 pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); 333 pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
331 if (!pdata->xgbe_debugfs) { 334 if (!pdata->xgbe_debugfs) {
332 netdev_err(pdata->netdev, "debugfs_create_dir failed\n"); 335 netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
336 kfree(buf);
333 return; 337 return;
334 } 338 }
335 339
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index a2bc5314a62b..d84efcd34fac 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -3347,6 +3347,13 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
3347 udp_rss_requested = 0; 3347 udp_rss_requested = 0;
3348 else 3348 else
3349 return -EINVAL; 3349 return -EINVAL;
3350
3351 if (CHIP_IS_E1x(bp) && udp_rss_requested) {
3352 DP(BNX2X_MSG_ETHTOOL,
3353 "57710, 57711 boards don't support RSS according to UDP 4-tuple\n");
3354 return -EINVAL;
3355 }
3356
3350 if ((info->flow_type == UDP_V4_FLOW) && 3357 if ((info->flow_type == UDP_V4_FLOW) &&
3351 (bp->rss_conf_obj.udp_rss_v4 != udp_rss_requested)) { 3358 (bp->rss_conf_obj.udp_rss_v4 != udp_rss_requested)) {
3352 bp->rss_conf_obj.udp_rss_v4 = udp_rss_requested; 3359 bp->rss_conf_obj.udp_rss_v4 = udp_rss_requested;
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 410995cd7ea4..50f63b7f3c3e 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1831,6 +1831,24 @@ static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
1831 bcmgenet_intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR); 1831 bcmgenet_intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
1832} 1832}
1833 1833
1834static void bcmgenet_link_intr_enable(struct bcmgenet_priv *priv)
1835{
1836 u32 int0_enable = 0;
1837
1838 /* Monitor cable plug/unplugged event for internal PHY, external PHY
1839 * and MoCA PHY
1840 */
1841 if (priv->internal_phy) {
1842 int0_enable |= UMAC_IRQ_LINK_EVENT;
1843 } else if (priv->ext_phy) {
1844 int0_enable |= UMAC_IRQ_LINK_EVENT;
1845 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1846 if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
1847 int0_enable |= UMAC_IRQ_LINK_EVENT;
1848 }
1849 bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR);
1850}
1851
1834static int init_umac(struct bcmgenet_priv *priv) 1852static int init_umac(struct bcmgenet_priv *priv)
1835{ 1853{
1836 struct device *kdev = &priv->pdev->dev; 1854 struct device *kdev = &priv->pdev->dev;
@@ -1871,15 +1889,8 @@ static int init_umac(struct bcmgenet_priv *priv)
1871 /* Enable Tx default queue 16 interrupts */ 1889 /* Enable Tx default queue 16 interrupts */
1872 int0_enable |= UMAC_IRQ_TXDMA_DONE; 1890 int0_enable |= UMAC_IRQ_TXDMA_DONE;
1873 1891
1874 /* Monitor cable plug/unplugged event for internal PHY */ 1892 /* Configure backpressure vectors for MoCA */
1875 if (priv->internal_phy) { 1893 if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1876 int0_enable |= UMAC_IRQ_LINK_EVENT;
1877 } else if (priv->ext_phy) {
1878 int0_enable |= UMAC_IRQ_LINK_EVENT;
1879 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1880 if (priv->hw_params->flags & GENET_HAS_MOCA_LINK_DET)
1881 int0_enable |= UMAC_IRQ_LINK_EVENT;
1882
1883 reg = bcmgenet_bp_mc_get(priv); 1894 reg = bcmgenet_bp_mc_get(priv);
1884 reg |= BIT(priv->hw_params->bp_in_en_shift); 1895 reg |= BIT(priv->hw_params->bp_in_en_shift);
1885 1896
@@ -2793,6 +2804,9 @@ static void bcmgenet_netif_start(struct net_device *dev)
2793 2804
2794 netif_tx_start_all_queues(dev); 2805 netif_tx_start_all_queues(dev);
2795 2806
2807 /* Monitor link interrupts now */
2808 bcmgenet_link_intr_enable(priv);
2809
2796 phy_start(priv->phydev); 2810 phy_start(priv->phydev);
2797} 2811}
2798 2812
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 821540913343..d463563e1f70 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -592,6 +592,7 @@ struct be_adapter {
592 int be_get_temp_freq; 592 int be_get_temp_freq;
593 struct be_hwmon hwmon_info; 593 struct be_hwmon hwmon_info;
594 u8 pf_number; 594 u8 pf_number;
595 u8 pci_func_num;
595 struct rss_info rss_info; 596 struct rss_info rss_info;
596 /* Filters for packets that need to be sent to BMC */ 597 /* Filters for packets that need to be sent to BMC */
597 u32 bmc_filt_mask; 598 u32 bmc_filt_mask;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index eb323913cd39..1795c935ff02 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -851,8 +851,10 @@ static int be_cmd_notify_wait(struct be_adapter *adapter,
851 return status; 851 return status;
852 852
853 dest_wrb = be_cmd_copy(adapter, wrb); 853 dest_wrb = be_cmd_copy(adapter, wrb);
854 if (!dest_wrb) 854 if (!dest_wrb) {
855 return -EBUSY; 855 status = -EBUSY;
856 goto unlock;
857 }
856 858
857 if (use_mcc(adapter)) 859 if (use_mcc(adapter))
858 status = be_mcc_notify_wait(adapter); 860 status = be_mcc_notify_wait(adapter);
@@ -862,6 +864,7 @@ static int be_cmd_notify_wait(struct be_adapter *adapter,
862 if (!status) 864 if (!status)
863 memcpy(wrb, dest_wrb, sizeof(*wrb)); 865 memcpy(wrb, dest_wrb, sizeof(*wrb));
864 866
867unlock:
865 be_cmd_unlock(adapter); 868 be_cmd_unlock(adapter);
866 return status; 869 return status;
867} 870}
@@ -1984,6 +1987,8 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
1984 be_if_cap_flags(adapter)); 1987 be_if_cap_flags(adapter));
1985 } 1988 }
1986 flags &= be_if_cap_flags(adapter); 1989 flags &= be_if_cap_flags(adapter);
1990 if (!flags)
1991 return -ENOTSUPP;
1987 1992
1988 return __be_cmd_rx_filter(adapter, flags, value); 1993 return __be_cmd_rx_filter(adapter, flags, value);
1989} 1994}
@@ -2887,6 +2892,7 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
2887 if (!status) { 2892 if (!status) {
2888 attribs = attribs_cmd.va + sizeof(struct be_cmd_resp_hdr); 2893 attribs = attribs_cmd.va + sizeof(struct be_cmd_resp_hdr);
2889 adapter->hba_port_num = attribs->hba_attribs.phy_port; 2894 adapter->hba_port_num = attribs->hba_attribs.phy_port;
2895 adapter->pci_func_num = attribs->pci_func_num;
2890 serial_num = attribs->hba_attribs.controller_serial_number; 2896 serial_num = attribs->hba_attribs.controller_serial_number;
2891 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++) 2897 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++)
2892 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) & 2898 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) &
@@ -3709,7 +3715,6 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res)
3709 status = -EINVAL; 3715 status = -EINVAL;
3710 goto err; 3716 goto err;
3711 } 3717 }
3712
3713 adapter->pf_number = desc->pf_num; 3718 adapter->pf_number = desc->pf_num;
3714 be_copy_nic_desc(res, desc); 3719 be_copy_nic_desc(res, desc);
3715 } 3720 }
@@ -3721,7 +3726,10 @@ err:
3721 return status; 3726 return status;
3722} 3727}
3723 3728
3724/* Will use MBOX only if MCCQ has not been created */ 3729/* Will use MBOX only if MCCQ has not been created
3730 * non-zero domain => a PF is querying this on behalf of a VF
3731 * zero domain => a PF or a VF is querying this for itself
3732 */
3725int be_cmd_get_profile_config(struct be_adapter *adapter, 3733int be_cmd_get_profile_config(struct be_adapter *adapter,
3726 struct be_resources *res, u8 query, u8 domain) 3734 struct be_resources *res, u8 query, u8 domain)
3727{ 3735{
@@ -3748,10 +3756,15 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
3748 OPCODE_COMMON_GET_PROFILE_CONFIG, 3756 OPCODE_COMMON_GET_PROFILE_CONFIG,
3749 cmd.size, &wrb, &cmd); 3757 cmd.size, &wrb, &cmd);
3750 3758
3751 req->hdr.domain = domain;
3752 if (!lancer_chip(adapter)) 3759 if (!lancer_chip(adapter))
3753 req->hdr.version = 1; 3760 req->hdr.version = 1;
3754 req->type = ACTIVE_PROFILE_TYPE; 3761 req->type = ACTIVE_PROFILE_TYPE;
3762 /* When a function is querying profile information relating to
3763 * itself hdr.pf_number must be set to it's pci_func_num + 1
3764 */
3765 req->hdr.domain = domain;
3766 if (domain == 0)
3767 req->hdr.pf_num = adapter->pci_func_num + 1;
3755 3768
3756 /* When QUERY_MODIFIABLE_FIELDS_TYPE bit is set, cmd returns the 3769 /* When QUERY_MODIFIABLE_FIELDS_TYPE bit is set, cmd returns the
3757 * descriptors with all bits set to "1" for the fields which can be 3770 * descriptors with all bits set to "1" for the fields which can be
@@ -3921,12 +3934,16 @@ static void be_fill_vf_res_template(struct be_adapter *adapter,
3921 vf_if_cap_flags &= ~(BE_IF_FLAGS_RSS | 3934 vf_if_cap_flags &= ~(BE_IF_FLAGS_RSS |
3922 BE_IF_FLAGS_DEFQ_RSS); 3935 BE_IF_FLAGS_DEFQ_RSS);
3923 } 3936 }
3924
3925 nic_vft->cap_flags = cpu_to_le32(vf_if_cap_flags);
3926 } else { 3937 } else {
3927 num_vf_qs = 1; 3938 num_vf_qs = 1;
3928 } 3939 }
3929 3940
3941 if (res_mod.vf_if_cap_flags & BE_IF_FLAGS_VLAN_PROMISCUOUS) {
3942 nic_vft->flags |= BIT(IF_CAPS_FLAGS_VALID_SHIFT);
3943 vf_if_cap_flags &= ~BE_IF_FLAGS_VLAN_PROMISCUOUS;
3944 }
3945
3946 nic_vft->cap_flags = cpu_to_le32(vf_if_cap_flags);
3930 nic_vft->rq_count = cpu_to_le16(num_vf_qs); 3947 nic_vft->rq_count = cpu_to_le16(num_vf_qs);
3931 nic_vft->txq_count = cpu_to_le16(num_vf_qs); 3948 nic_vft->txq_count = cpu_to_le16(num_vf_qs);
3932 nic_vft->rssq_count = cpu_to_le16(num_vf_qs); 3949 nic_vft->rssq_count = cpu_to_le16(num_vf_qs);
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 7d178bdb112e..91155ea74f34 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -289,7 +289,9 @@ struct be_cmd_req_hdr {
289 u32 timeout; /* dword 1 */ 289 u32 timeout; /* dword 1 */
290 u32 request_length; /* dword 2 */ 290 u32 request_length; /* dword 2 */
291 u8 version; /* dword 3 */ 291 u8 version; /* dword 3 */
292 u8 rsvd[3]; /* dword 3 */ 292 u8 rsvd1; /* dword 3 */
293 u8 pf_num; /* dword 3 */
294 u8 rsvd2; /* dword 3 */
293}; 295};
294 296
295#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ 297#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
@@ -1652,7 +1654,11 @@ struct mgmt_hba_attribs {
1652 1654
1653struct mgmt_controller_attrib { 1655struct mgmt_controller_attrib {
1654 struct mgmt_hba_attribs hba_attribs; 1656 struct mgmt_hba_attribs hba_attribs;
1655 u32 rsvd0[10]; 1657 u32 rsvd0[2];
1658 u16 rsvd1;
1659 u8 pci_func_num;
1660 u8 rsvd2;
1661 u32 rsvd3[7];
1656} __packed; 1662} __packed;
1657 1663
1658struct be_cmd_req_cntl_attribs { 1664struct be_cmd_req_cntl_attribs {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7bf51a1a0a77..eb48a977f8da 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1123,11 +1123,12 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
1123 struct sk_buff *skb, 1123 struct sk_buff *skb,
1124 struct be_wrb_params *wrb_params) 1124 struct be_wrb_params *wrb_params)
1125{ 1125{
1126 /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or 1126 /* Lancer, SH and BE3 in SRIOV mode have a bug wherein
1127 * less may cause a transmit stall on that port. So the work-around is 1127 * packets that are 32b or less may cause a transmit stall
1128 * to pad short packets (<= 32 bytes) to a 36-byte length. 1128 * on that port. The workaround is to pad such packets
1129 * (len <= 32 bytes) to a minimum length of 36b.
1129 */ 1130 */
1130 if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { 1131 if (skb->len <= 32) {
1131 if (skb_put_padto(skb, 36)) 1132 if (skb_put_padto(skb, 36))
1132 return NULL; 1133 return NULL;
1133 } 1134 }
@@ -4205,10 +4206,6 @@ static int be_get_config(struct be_adapter *adapter)
4205 int status, level; 4206 int status, level;
4206 u16 profile_id; 4207 u16 profile_id;
4207 4208
4208 status = be_cmd_get_cntl_attributes(adapter);
4209 if (status)
4210 return status;
4211
4212 status = be_cmd_query_fw_cfg(adapter); 4209 status = be_cmd_query_fw_cfg(adapter);
4213 if (status) 4210 if (status)
4214 return status; 4211 return status;
@@ -4407,6 +4404,11 @@ static int be_setup(struct be_adapter *adapter)
4407 if (!lancer_chip(adapter)) 4404 if (!lancer_chip(adapter))
4408 be_cmd_req_native_mode(adapter); 4405 be_cmd_req_native_mode(adapter);
4409 4406
4407 /* Need to invoke this cmd first to get the PCI Function Number */
4408 status = be_cmd_get_cntl_attributes(adapter);
4409 if (status)
4410 return status;
4411
4410 if (!BE2_chip(adapter) && be_physfn(adapter)) 4412 if (!BE2_chip(adapter) && be_physfn(adapter))
4411 be_alloc_sriov_res(adapter); 4413 be_alloc_sriov_res(adapter);
4412 4414
@@ -4999,7 +5001,15 @@ static bool be_check_ufi_compatibility(struct be_adapter *adapter,
4999 return false; 5001 return false;
5000 } 5002 }
5001 5003
5002 return (fhdr->asic_type_rev >= adapter->asic_rev); 5004 /* In BE3 FW images the "asic_type_rev" field doesn't track the
5005 * asic_rev of the chips it is compatible with.
5006 * When asic_type_rev is 0 the image is compatible only with
5007 * pre-BE3-R chips (asic_rev < 0x10)
5008 */
5009 if (BEx_chip(adapter) && fhdr->asic_type_rev == 0)
5010 return adapter->asic_rev < 0x10;
5011 else
5012 return (fhdr->asic_type_rev >= adapter->asic_rev);
5003} 5013}
5004 5014
5005static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) 5015static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 3c40f6b99224..55c36230e176 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -198,11 +198,13 @@ static int fsl_pq_mdio_reset(struct mii_bus *bus)
198 198
199#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE) 199#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
200/* 200/*
201 * Return the TBIPA address, starting from the address
202 * of the mapped GFAR MDIO registers (struct gfar)
201 * This is mildly evil, but so is our hardware for doing this. 203 * This is mildly evil, but so is our hardware for doing this.
202 * Also, we have to cast back to struct gfar because of 204 * Also, we have to cast back to struct gfar because of
203 * definition weirdness done in gianfar.h. 205 * definition weirdness done in gianfar.h.
204 */ 206 */
205static uint32_t __iomem *get_gfar_tbipa(void __iomem *p) 207static uint32_t __iomem *get_gfar_tbipa_from_mdio(void __iomem *p)
206{ 208{
207 struct gfar __iomem *enet_regs = p; 209 struct gfar __iomem *enet_regs = p;
208 210
@@ -210,6 +212,15 @@ static uint32_t __iomem *get_gfar_tbipa(void __iomem *p)
210} 212}
211 213
212/* 214/*
215 * Return the TBIPA address, starting from the address
216 * of the mapped GFAR MII registers (gfar_mii_regs[] within struct gfar)
217 */
218static uint32_t __iomem *get_gfar_tbipa_from_mii(void __iomem *p)
219{
220 return get_gfar_tbipa_from_mdio(container_of(p, struct gfar, gfar_mii_regs));
221}
222
223/*
213 * Return the TBIPAR address for an eTSEC2 node 224 * Return the TBIPAR address for an eTSEC2 node
214 */ 225 */
215static uint32_t __iomem *get_etsec_tbipa(void __iomem *p) 226static uint32_t __iomem *get_etsec_tbipa(void __iomem *p)
@@ -220,11 +231,12 @@ static uint32_t __iomem *get_etsec_tbipa(void __iomem *p)
220 231
221#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE) 232#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
222/* 233/*
223 * Return the TBIPAR address for a QE MDIO node 234 * Return the TBIPAR address for a QE MDIO node, starting from the address
235 * of the mapped MII registers (struct fsl_pq_mii)
224 */ 236 */
225static uint32_t __iomem *get_ucc_tbipa(void __iomem *p) 237static uint32_t __iomem *get_ucc_tbipa(void __iomem *p)
226{ 238{
227 struct fsl_pq_mdio __iomem *mdio = p; 239 struct fsl_pq_mdio __iomem *mdio = container_of(p, struct fsl_pq_mdio, mii);
228 240
229 return &mdio->utbipar; 241 return &mdio->utbipar;
230} 242}
@@ -300,14 +312,14 @@ static const struct of_device_id fsl_pq_mdio_match[] = {
300 .compatible = "fsl,gianfar-tbi", 312 .compatible = "fsl,gianfar-tbi",
301 .data = &(struct fsl_pq_mdio_data) { 313 .data = &(struct fsl_pq_mdio_data) {
302 .mii_offset = 0, 314 .mii_offset = 0,
303 .get_tbipa = get_gfar_tbipa, 315 .get_tbipa = get_gfar_tbipa_from_mii,
304 }, 316 },
305 }, 317 },
306 { 318 {
307 .compatible = "fsl,gianfar-mdio", 319 .compatible = "fsl,gianfar-mdio",
308 .data = &(struct fsl_pq_mdio_data) { 320 .data = &(struct fsl_pq_mdio_data) {
309 .mii_offset = 0, 321 .mii_offset = 0,
310 .get_tbipa = get_gfar_tbipa, 322 .get_tbipa = get_gfar_tbipa_from_mii,
311 }, 323 },
312 }, 324 },
313 { 325 {
@@ -315,7 +327,7 @@ static const struct of_device_id fsl_pq_mdio_match[] = {
315 .compatible = "gianfar", 327 .compatible = "gianfar",
316 .data = &(struct fsl_pq_mdio_data) { 328 .data = &(struct fsl_pq_mdio_data) {
317 .mii_offset = offsetof(struct fsl_pq_mdio, mii), 329 .mii_offset = offsetof(struct fsl_pq_mdio, mii),
318 .get_tbipa = get_gfar_tbipa, 330 .get_tbipa = get_gfar_tbipa_from_mdio,
319 }, 331 },
320 }, 332 },
321 { 333 {
@@ -445,6 +457,16 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
445 457
446 tbipa = data->get_tbipa(priv->map); 458 tbipa = data->get_tbipa(priv->map);
447 459
460 /*
461 * Add consistency check to make sure TBI is contained
462 * within the mapped range (not because we would get a
463 * segfault, rather to catch bugs in computing TBI
464 * address). Print error message but continue anyway.
465 */
466 if ((void *)tbipa > priv->map + resource_size(&res) - 4)
467 dev_err(&pdev->dev, "invalid register map (should be at least 0x%04x to contain TBI address)\n",
468 ((void *)tbipa - priv->map) + 4);
469
448 iowrite32be(be32_to_cpup(prop), tbipa); 470 iowrite32be(be32_to_cpup(prop), tbipa);
449 } 471 }
450 } 472 }
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index 5c950e20f2ee..0ff8f01e57ee 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -386,7 +386,6 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
386 386
387 hw->aq.asq.next_to_use = 0; 387 hw->aq.asq.next_to_use = 0;
388 hw->aq.asq.next_to_clean = 0; 388 hw->aq.asq.next_to_clean = 0;
389 hw->aq.asq.count = hw->aq.num_asq_entries;
390 389
391 /* allocate the ring memory */ 390 /* allocate the ring memory */
392 ret_code = i40e_alloc_adminq_asq_ring(hw); 391 ret_code = i40e_alloc_adminq_asq_ring(hw);
@@ -404,6 +403,7 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
404 goto init_adminq_free_rings; 403 goto init_adminq_free_rings;
405 404
406 /* success! */ 405 /* success! */
406 hw->aq.asq.count = hw->aq.num_asq_entries;
407 goto init_adminq_exit; 407 goto init_adminq_exit;
408 408
409init_adminq_free_rings: 409init_adminq_free_rings:
@@ -445,7 +445,6 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
445 445
446 hw->aq.arq.next_to_use = 0; 446 hw->aq.arq.next_to_use = 0;
447 hw->aq.arq.next_to_clean = 0; 447 hw->aq.arq.next_to_clean = 0;
448 hw->aq.arq.count = hw->aq.num_arq_entries;
449 448
450 /* allocate the ring memory */ 449 /* allocate the ring memory */
451 ret_code = i40e_alloc_adminq_arq_ring(hw); 450 ret_code = i40e_alloc_adminq_arq_ring(hw);
@@ -463,6 +462,7 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
463 goto init_adminq_free_rings; 462 goto init_adminq_free_rings;
464 463
465 /* success! */ 464 /* success! */
465 hw->aq.arq.count = hw->aq.num_arq_entries;
466 goto init_adminq_exit; 466 goto init_adminq_exit;
467 467
468init_adminq_free_rings: 468init_adminq_free_rings:
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 87a5d09cb087..f7ed3131d037 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8445,6 +8445,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
8445 8445
8446 netdev->hw_enc_features |= NETIF_F_IP_CSUM | 8446 netdev->hw_enc_features |= NETIF_F_IP_CSUM |
8447 NETIF_F_GSO_UDP_TUNNEL | 8447 NETIF_F_GSO_UDP_TUNNEL |
8448 NETIF_F_GSO_GRE |
8448 NETIF_F_TSO; 8449 NETIF_F_TSO;
8449 8450
8450 netdev->features = NETIF_F_SG | 8451 netdev->features = NETIF_F_SG |
@@ -8452,6 +8453,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
8452 NETIF_F_SCTP_CSUM | 8453 NETIF_F_SCTP_CSUM |
8453 NETIF_F_HIGHDMA | 8454 NETIF_F_HIGHDMA |
8454 NETIF_F_GSO_UDP_TUNNEL | 8455 NETIF_F_GSO_UDP_TUNNEL |
8456 NETIF_F_GSO_GRE |
8455 NETIF_F_HW_VLAN_CTAG_TX | 8457 NETIF_F_HW_VLAN_CTAG_TX |
8456 NETIF_F_HW_VLAN_CTAG_RX | 8458 NETIF_F_HW_VLAN_CTAG_RX |
8457 NETIF_F_HW_VLAN_CTAG_FILTER | 8459 NETIF_F_HW_VLAN_CTAG_FILTER |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
index 3eba36913c1d..fd123ca60761 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
@@ -373,7 +373,6 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
373 373
374 hw->aq.asq.next_to_use = 0; 374 hw->aq.asq.next_to_use = 0;
375 hw->aq.asq.next_to_clean = 0; 375 hw->aq.asq.next_to_clean = 0;
376 hw->aq.asq.count = hw->aq.num_asq_entries;
377 376
378 /* allocate the ring memory */ 377 /* allocate the ring memory */
379 ret_code = i40e_alloc_adminq_asq_ring(hw); 378 ret_code = i40e_alloc_adminq_asq_ring(hw);
@@ -391,6 +390,7 @@ static i40e_status i40e_init_asq(struct i40e_hw *hw)
391 goto init_adminq_free_rings; 390 goto init_adminq_free_rings;
392 391
393 /* success! */ 392 /* success! */
393 hw->aq.asq.count = hw->aq.num_asq_entries;
394 goto init_adminq_exit; 394 goto init_adminq_exit;
395 395
396init_adminq_free_rings: 396init_adminq_free_rings:
@@ -432,7 +432,6 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
432 432
433 hw->aq.arq.next_to_use = 0; 433 hw->aq.arq.next_to_use = 0;
434 hw->aq.arq.next_to_clean = 0; 434 hw->aq.arq.next_to_clean = 0;
435 hw->aq.arq.count = hw->aq.num_arq_entries;
436 435
437 /* allocate the ring memory */ 436 /* allocate the ring memory */
438 ret_code = i40e_alloc_adminq_arq_ring(hw); 437 ret_code = i40e_alloc_adminq_arq_ring(hw);
@@ -450,6 +449,7 @@ static i40e_status i40e_init_arq(struct i40e_hw *hw)
450 goto init_adminq_free_rings; 449 goto init_adminq_free_rings;
451 450
452 /* success! */ 451 /* success! */
452 hw->aq.arq.count = hw->aq.num_arq_entries;
453 goto init_adminq_exit; 453 goto init_adminq_exit;
454 454
455init_adminq_free_rings: 455init_adminq_free_rings:
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 8e81e53c370e..c34488479365 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1364,6 +1364,10 @@ int mlx4_test_interrupts(struct mlx4_dev *dev)
1364 * and performing a NOP command 1364 * and performing a NOP command
1365 */ 1365 */
1366 for(i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) { 1366 for(i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) {
1367 /* Make sure request_irq was called */
1368 if (!priv->eq_table.eq[i].have_irq)
1369 continue;
1370
1367 /* Temporary use polling for command completions */ 1371 /* Temporary use polling for command completions */
1368 mlx4_cmd_use_polling(dev); 1372 mlx4_cmd_use_polling(dev);
1369 1373
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index bcbdfab1fe19..85f1b1e7e505 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2671,14 +2671,11 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
2671 2671
2672 if (msi_x) { 2672 if (msi_x) {
2673 int nreq = dev->caps.num_ports * num_online_cpus() + 1; 2673 int nreq = dev->caps.num_ports * num_online_cpus() + 1;
2674 bool shared_ports = false;
2675 2674
2676 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, 2675 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
2677 nreq); 2676 nreq);
2678 if (nreq > MAX_MSIX) { 2677 if (nreq > MAX_MSIX)
2679 nreq = MAX_MSIX; 2678 nreq = MAX_MSIX;
2680 shared_ports = true;
2681 }
2682 2679
2683 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 2680 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
2684 if (!entries) 2681 if (!entries)
@@ -2701,9 +2698,6 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
2701 bitmap_zero(priv->eq_table.eq[MLX4_EQ_ASYNC].actv_ports.ports, 2698 bitmap_zero(priv->eq_table.eq[MLX4_EQ_ASYNC].actv_ports.ports,
2702 dev->caps.num_ports); 2699 dev->caps.num_ports);
2703 2700
2704 if (MLX4_IS_LEGACY_EQ_MODE(dev->caps))
2705 shared_ports = true;
2706
2707 for (i = 0; i < dev->caps.num_comp_vectors + 1; i++) { 2701 for (i = 0; i < dev->caps.num_comp_vectors + 1; i++) {
2708 if (i == MLX4_EQ_ASYNC) 2702 if (i == MLX4_EQ_ASYNC)
2709 continue; 2703 continue;
@@ -2711,7 +2705,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
2711 priv->eq_table.eq[i].irq = 2705 priv->eq_table.eq[i].irq =
2712 entries[i + 1 - !!(i > MLX4_EQ_ASYNC)].vector; 2706 entries[i + 1 - !!(i > MLX4_EQ_ASYNC)].vector;
2713 2707
2714 if (shared_ports) { 2708 if (MLX4_IS_LEGACY_EQ_MODE(dev->caps)) {
2715 bitmap_fill(priv->eq_table.eq[i].actv_ports.ports, 2709 bitmap_fill(priv->eq_table.eq[i].actv_ports.ports,
2716 dev->caps.num_ports); 2710 dev->caps.num_ports);
2717 /* We don't set affinity hint when there 2711 /* We don't set affinity hint when there
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
index e71563ce05d1..22d603f78273 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_flow_table.c
@@ -598,6 +598,8 @@ void mlx5e_enable_vlan_filter(struct mlx5e_priv *priv)
598 return; 598 return;
599 599
600 priv->vlan.filter_disabled = false; 600 priv->vlan.filter_disabled = false;
601 if (priv->netdev->flags & IFF_PROMISC)
602 return;
601 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0); 603 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0);
602} 604}
603 605
@@ -607,6 +609,8 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv)
607 return; 609 return;
608 610
609 priv->vlan.filter_disabled = true; 611 priv->vlan.filter_disabled = true;
612 if (priv->netdev->flags & IFF_PROMISC)
613 return;
610 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0); 614 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID, 0);
611} 615}
612 616
@@ -717,8 +721,12 @@ void mlx5e_set_rx_mode_work(struct work_struct *work)
717 bool enable_broadcast = !ea->broadcast_enabled && broadcast_enabled; 721 bool enable_broadcast = !ea->broadcast_enabled && broadcast_enabled;
718 bool disable_broadcast = ea->broadcast_enabled && !broadcast_enabled; 722 bool disable_broadcast = ea->broadcast_enabled && !broadcast_enabled;
719 723
720 if (enable_promisc) 724 if (enable_promisc) {
721 mlx5e_add_eth_addr_rule(priv, &ea->promisc, MLX5E_PROMISC); 725 mlx5e_add_eth_addr_rule(priv, &ea->promisc, MLX5E_PROMISC);
726 if (!priv->vlan.filter_disabled)
727 mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
728 0);
729 }
722 if (enable_allmulti) 730 if (enable_allmulti)
723 mlx5e_add_eth_addr_rule(priv, &ea->allmulti, MLX5E_ALLMULTI); 731 mlx5e_add_eth_addr_rule(priv, &ea->allmulti, MLX5E_ALLMULTI);
724 if (enable_broadcast) 732 if (enable_broadcast)
@@ -730,8 +738,12 @@ void mlx5e_set_rx_mode_work(struct work_struct *work)
730 mlx5e_del_eth_addr_from_flow_table(priv, &ea->broadcast); 738 mlx5e_del_eth_addr_from_flow_table(priv, &ea->broadcast);
731 if (disable_allmulti) 739 if (disable_allmulti)
732 mlx5e_del_eth_addr_from_flow_table(priv, &ea->allmulti); 740 mlx5e_del_eth_addr_from_flow_table(priv, &ea->allmulti);
733 if (disable_promisc) 741 if (disable_promisc) {
742 if (!priv->vlan.filter_disabled)
743 mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_VID,
744 0);
734 mlx5e_del_eth_addr_from_flow_table(priv, &ea->promisc); 745 mlx5e_del_eth_addr_from_flow_table(priv, &ea->promisc);
746 }
735 747
736 ea->promisc_enabled = promisc_enabled; 748 ea->promisc_enabled = promisc_enabled;
737 ea->allmulti_enabled = allmulti_enabled; 749 ea->allmulti_enabled = allmulti_enabled;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index ae302614e74b..a87e773e93f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -302,7 +302,7 @@ static int mlx5_query_port_pvlc(struct mlx5_core_dev *dev, u32 *pvlc,
302 u32 in[MLX5_ST_SZ_DW(pvlc_reg)]; 302 u32 in[MLX5_ST_SZ_DW(pvlc_reg)];
303 303
304 memset(in, 0, sizeof(in)); 304 memset(in, 0, sizeof(in));
305 MLX5_SET(ptys_reg, in, local_port, local_port); 305 MLX5_SET(pvlc_reg, in, local_port, local_port);
306 306
307 return mlx5_core_access_reg(dev, in, sizeof(in), pvlc, 307 return mlx5_core_access_reg(dev, in, sizeof(in), pvlc,
308 pvlc_size, MLX5_REG_PVLC, 0, 0); 308 pvlc_size, MLX5_REG_PVLC, 0, 0);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 9f4a0bf01336..bd80ac714a8a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -374,26 +374,31 @@ static int __mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
374 int err; 374 int err;
375 int ret; 375 int ret;
376 376
377 mlxsw_core->emad.trans_active = true;
378
377 err = mlxsw_core_skb_transmit(mlxsw_core->driver_priv, skb, tx_info); 379 err = mlxsw_core_skb_transmit(mlxsw_core->driver_priv, skb, tx_info);
378 if (err) { 380 if (err) {
379 dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n", 381 dev_err(mlxsw_core->bus_info->dev, "Failed to transmit EMAD (tid=%llx)\n",
380 mlxsw_core->emad.tid); 382 mlxsw_core->emad.tid);
381 dev_kfree_skb(skb); 383 dev_kfree_skb(skb);
382 return err; 384 goto trans_inactive_out;
383 } 385 }
384 386
385 mlxsw_core->emad.trans_active = true;
386 ret = wait_event_timeout(mlxsw_core->emad.wait, 387 ret = wait_event_timeout(mlxsw_core->emad.wait,
387 !(mlxsw_core->emad.trans_active), 388 !(mlxsw_core->emad.trans_active),
388 msecs_to_jiffies(MLXSW_EMAD_TIMEOUT_MS)); 389 msecs_to_jiffies(MLXSW_EMAD_TIMEOUT_MS));
389 if (!ret) { 390 if (!ret) {
390 dev_warn(mlxsw_core->bus_info->dev, "EMAD timed-out (tid=%llx)\n", 391 dev_warn(mlxsw_core->bus_info->dev, "EMAD timed-out (tid=%llx)\n",
391 mlxsw_core->emad.tid); 392 mlxsw_core->emad.tid);
392 mlxsw_core->emad.trans_active = false; 393 err = -EIO;
393 return -EIO; 394 goto trans_inactive_out;
394 } 395 }
395 396
396 return 0; 397 return 0;
398
399trans_inactive_out:
400 mlxsw_core->emad.trans_active = false;
401 return err;
397} 402}
398 403
399static int mlxsw_emad_process_status(struct mlxsw_core *mlxsw_core, 404static int mlxsw_emad_process_status(struct mlxsw_core *mlxsw_core,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/item.h b/drivers/net/ethernet/mellanox/mlxsw/item.h
index 1c5e43eb9b4f..a94dbda6590b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/item.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/item.h
@@ -193,6 +193,7 @@ __mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift)
193{ 193{
194 u16 max_index, be_index; 194 u16 max_index, be_index;
195 u16 offset; /* byte offset inside the array */ 195 u16 offset; /* byte offset inside the array */
196 u8 in_byte_index;
196 197
197 BUG_ON(index && !item->element_size); 198 BUG_ON(index && !item->element_size);
198 if (item->offset % sizeof(u32) != 0 || 199 if (item->offset % sizeof(u32) != 0 ||
@@ -205,7 +206,8 @@ __mlxsw_item_bit_array_offset(struct mlxsw_item *item, u16 index, u8 *shift)
205 max_index = (item->size.bytes << 3) / item->element_size - 1; 206 max_index = (item->size.bytes << 3) / item->element_size - 1;
206 be_index = max_index - index; 207 be_index = max_index - index;
207 offset = be_index * item->element_size >> 3; 208 offset = be_index * item->element_size >> 3;
208 *shift = index % (BITS_PER_BYTE / item->element_size) << 1; 209 in_byte_index = index % (BITS_PER_BYTE / item->element_size);
210 *shift = in_byte_index * item->element_size;
209 211
210 return item->offset + offset; 212 return item->offset + offset;
211} 213}
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index 879e000684c3..371ea3f56aed 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -1602,11 +1602,11 @@ static int mlxsw_pci_cmd_exec(void *bus_priv, u16 opcode, u8 opcode_mod,
1602 1602
1603 if (in_mbox) 1603 if (in_mbox)
1604 memcpy(mlxsw_pci->cmd.in_mbox.buf, in_mbox, in_mbox_size); 1604 memcpy(mlxsw_pci->cmd.in_mbox.buf, in_mbox, in_mbox_size);
1605 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_HI, in_mapaddr >> 32); 1605 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_HI, upper_32_bits(in_mapaddr));
1606 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_LO, in_mapaddr); 1606 mlxsw_pci_write32(mlxsw_pci, CIR_IN_PARAM_LO, lower_32_bits(in_mapaddr));
1607 1607
1608 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_HI, out_mapaddr >> 32); 1608 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_HI, upper_32_bits(out_mapaddr));
1609 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_LO, out_mapaddr); 1609 mlxsw_pci_write32(mlxsw_pci, CIR_OUT_PARAM_LO, lower_32_bits(out_mapaddr));
1610 1610
1611 mlxsw_pci_write32(mlxsw_pci, CIR_IN_MODIFIER, in_mod); 1611 mlxsw_pci_write32(mlxsw_pci, CIR_IN_MODIFIER, in_mod);
1612 mlxsw_pci_write32(mlxsw_pci, CIR_TOKEN, 0); 1612 mlxsw_pci_write32(mlxsw_pci, CIR_TOKEN, 0);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index 2fd2279b628e..50e29c4879db 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -1068,9 +1068,9 @@ static int mlxsw_sx_port_create(struct mlxsw_sx *mlxsw_sx, u8 local_port)
1068 return 0; 1068 return 0;
1069 1069
1070err_register_netdev: 1070err_register_netdev:
1071err_port_admin_status_set:
1072err_port_mac_learning_mode_set: 1071err_port_mac_learning_mode_set:
1073err_port_stp_state_set: 1072err_port_stp_state_set:
1073err_port_admin_status_set:
1074err_port_mtu_set: 1074err_port_mtu_set:
1075err_port_speed_set: 1075err_port_speed_set:
1076err_port_swid_set: 1076err_port_swid_set:
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 66fd868152e5..b159ef8303cc 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -476,13 +476,12 @@ static void __lpc_get_mac(struct netdata_local *pldat, u8 *mac)
476 mac[5] = tmp >> 8; 476 mac[5] = tmp >> 8;
477} 477}
478 478
479static void __lpc_eth_clock_enable(struct netdata_local *pldat, 479static void __lpc_eth_clock_enable(struct netdata_local *pldat, bool enable)
480 bool enable)
481{ 480{
482 if (enable) 481 if (enable)
483 clk_enable(pldat->clk); 482 clk_prepare_enable(pldat->clk);
484 else 483 else
485 clk_disable(pldat->clk); 484 clk_disable_unprepare(pldat->clk);
486} 485}
487 486
488static void __lpc_params_setup(struct netdata_local *pldat) 487static void __lpc_params_setup(struct netdata_local *pldat)
@@ -1494,7 +1493,7 @@ err_out_free_irq:
1494err_out_iounmap: 1493err_out_iounmap:
1495 iounmap(pldat->net_base); 1494 iounmap(pldat->net_base);
1496err_out_disable_clocks: 1495err_out_disable_clocks:
1497 clk_disable(pldat->clk); 1496 clk_disable_unprepare(pldat->clk);
1498 clk_put(pldat->clk); 1497 clk_put(pldat->clk);
1499err_out_free_dev: 1498err_out_free_dev:
1500 free_netdev(ndev); 1499 free_netdev(ndev);
@@ -1519,7 +1518,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev)
1519 iounmap(pldat->net_base); 1518 iounmap(pldat->net_base);
1520 mdiobus_unregister(pldat->mii_bus); 1519 mdiobus_unregister(pldat->mii_bus);
1521 mdiobus_free(pldat->mii_bus); 1520 mdiobus_free(pldat->mii_bus);
1522 clk_disable(pldat->clk); 1521 clk_disable_unprepare(pldat->clk);
1523 clk_put(pldat->clk); 1522 clk_put(pldat->clk);
1524 free_netdev(ndev); 1523 free_netdev(ndev);
1525 1524
@@ -1540,7 +1539,7 @@ static int lpc_eth_drv_suspend(struct platform_device *pdev,
1540 if (netif_running(ndev)) { 1539 if (netif_running(ndev)) {
1541 netif_device_detach(ndev); 1540 netif_device_detach(ndev);
1542 __lpc_eth_shutdown(pldat); 1541 __lpc_eth_shutdown(pldat);
1543 clk_disable(pldat->clk); 1542 clk_disable_unprepare(pldat->clk);
1544 1543
1545 /* 1544 /*
1546 * Reset again now clock is disable to be sure 1545 * Reset again now clock is disable to be sure
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index a83263743665..2b7550c43f78 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -2134,10 +2134,11 @@ static int rhine_rx(struct net_device *dev, int limit)
2134 } 2134 }
2135 2135
2136 skb_put(skb, pkt_len); 2136 skb_put(skb, pkt_len);
2137 skb->protocol = eth_type_trans(skb, dev);
2138 2137
2139 rhine_rx_vlan_tag(skb, desc, data_size); 2138 rhine_rx_vlan_tag(skb, desc, data_size);
2140 2139
2140 skb->protocol = eth_type_trans(skb, dev);
2141
2141 netif_receive_skb(skb); 2142 netif_receive_skb(skb);
2142 2143
2143 u64_stats_update_begin(&rp->rx_stats.syncp); 2144 u64_stats_update_begin(&rp->rx_stats.syncp);
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 8f5c02eed47d..cde29f8a37bf 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -870,14 +870,14 @@ static int geneve_newlink(struct net *net, struct net_device *dev,
870 __be16 dst_port = htons(GENEVE_UDP_PORT); 870 __be16 dst_port = htons(GENEVE_UDP_PORT);
871 __u8 ttl = 0, tos = 0; 871 __u8 ttl = 0, tos = 0;
872 bool metadata = false; 872 bool metadata = false;
873 __be32 rem_addr; 873 __be32 rem_addr = 0;
874 __u32 vni; 874 __u32 vni = 0;
875 875
876 if (!data[IFLA_GENEVE_ID] || !data[IFLA_GENEVE_REMOTE]) 876 if (data[IFLA_GENEVE_ID])
877 return -EINVAL; 877 vni = nla_get_u32(data[IFLA_GENEVE_ID]);
878 878
879 vni = nla_get_u32(data[IFLA_GENEVE_ID]); 879 if (data[IFLA_GENEVE_REMOTE])
880 rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]); 880 rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]);
881 881
882 if (data[IFLA_GENEVE_TTL]) 882 if (data[IFLA_GENEVE_TTL])
883 ttl = nla_get_u8(data[IFLA_GENEVE_TTL]); 883 ttl = nla_get_u8(data[IFLA_GENEVE_TTL]);
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 9d097ae54fb2..a7fb66580cee 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -187,8 +187,6 @@ config MDIO_OCTEON
187 busses. It is required by the Octeon and ThunderX ethernet device 187 busses. It is required by the Octeon and ThunderX ethernet device
188 drivers. 188 drivers.
189 189
190 If in doubt, say Y.
191
192config MDIO_SUN4I 190config MDIO_SUN4I
193 tristate "Allwinner sun4i MDIO interface support" 191 tristate "Allwinner sun4i MDIO interface support"
194 depends on ARCH_SUNXI 192 depends on ARCH_SUNXI
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 3837ae344f63..2ed75060da50 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -313,7 +313,6 @@ static void pppoe_flush_dev(struct net_device *dev)
313 if (po->pppoe_dev == dev && 313 if (po->pppoe_dev == dev &&
314 sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { 314 sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) {
315 pppox_unbind_sock(sk); 315 pppox_unbind_sock(sk);
316 sk->sk_state = PPPOX_ZOMBIE;
317 sk->sk_state_change(sk); 316 sk->sk_state_change(sk);
318 po->pppoe_dev = NULL; 317 po->pppoe_dev = NULL;
319 dev_put(dev); 318 dev_put(dev);
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 3a8a36c8ded1..7f83504dfa69 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -166,6 +166,7 @@ config USB_NET_AX8817X
166 * Aten UC210T 166 * Aten UC210T
167 * ASIX AX88172 167 * ASIX AX88172
168 * Billionton Systems, USB2AR 168 * Billionton Systems, USB2AR
169 * Billionton Systems, GUSB2AM-1G-B
169 * Buffalo LUA-U2-KTX 170 * Buffalo LUA-U2-KTX
170 * Corega FEther USB2-TX 171 * Corega FEther USB2-TX
171 * D-Link DUB-E100 172 * D-Link DUB-E100
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 1173a24feda3..5cabefc23494 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -959,6 +959,10 @@ static const struct usb_device_id products [] = {
959 USB_DEVICE (0x08dd, 0x90ff), 959 USB_DEVICE (0x08dd, 0x90ff),
960 .driver_info = (unsigned long) &ax8817x_info, 960 .driver_info = (unsigned long) &ax8817x_info,
961}, { 961}, {
962 // Billionton Systems, GUSB2AM-1G-B
963 USB_DEVICE(0x08dd, 0x0114),
964 .driver_info = (unsigned long) &ax88178_info,
965}, {
962 // ATEN UC210T 966 // ATEN UC210T
963 USB_DEVICE (0x0557, 0x2009), 967 USB_DEVICE (0x0557, 0x2009),
964 .driver_info = (unsigned long) &ax8817x_info, 968 .driver_info = (unsigned long) &ax8817x_info,
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ce704df7681b..cf262ccf5047 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2794,11 +2794,10 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
2794 struct vxlan_config conf; 2794 struct vxlan_config conf;
2795 int err; 2795 int err;
2796 2796
2797 if (!data[IFLA_VXLAN_ID])
2798 return -EINVAL;
2799
2800 memset(&conf, 0, sizeof(conf)); 2797 memset(&conf, 0, sizeof(conf));
2801 conf.vni = nla_get_u32(data[IFLA_VXLAN_ID]); 2798
2799 if (data[IFLA_VXLAN_ID])
2800 conf.vni = nla_get_u32(data[IFLA_VXLAN_ID]);
2802 2801
2803 if (data[IFLA_VXLAN_GROUP]) { 2802 if (data[IFLA_VXLAN_GROUP]) {
2804 conf.remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]); 2803 conf.remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index bc421a5c5356..80c174ff6b7b 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -337,7 +337,7 @@ enum ath10k_hw_rate_cck {
337#define TARGET_10X_MAX_FRAG_ENTRIES 0 337#define TARGET_10X_MAX_FRAG_ENTRIES 0
338 338
339/* 10.2 parameters */ 339/* 10.2 parameters */
340#define TARGET_10_2_DMA_BURST_SIZE 1 340#define TARGET_10_2_DMA_BURST_SIZE 0
341 341
342/* Target specific defines for WMI-TLV firmware */ 342/* Target specific defines for WMI-TLV firmware */
343#define TARGET_TLV_NUM_VDEVS 4 343#define TARGET_TLV_NUM_VDEVS 4
@@ -391,7 +391,7 @@ enum ath10k_hw_rate_cck {
391 391
392#define TARGET_10_4_TX_DBG_LOG_SIZE 1024 392#define TARGET_10_4_TX_DBG_LOG_SIZE 1024
393#define TARGET_10_4_NUM_WDS_ENTRIES 32 393#define TARGET_10_4_NUM_WDS_ENTRIES 32
394#define TARGET_10_4_DMA_BURST_SIZE 1 394#define TARGET_10_4_DMA_BURST_SIZE 0
395#define TARGET_10_4_MAC_AGGR_DELIM 0 395#define TARGET_10_4_MAC_AGGR_DELIM 0
396#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1 396#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
397#define TARGET_10_4_VOW_CONFIG 0 397#define TARGET_10_4_VOW_CONFIG 0
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 5d532c7b813f..2e2b92ba96b8 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -881,6 +881,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
881 hw->max_rate_tries = 10; 881 hw->max_rate_tries = 10;
882 hw->sta_data_size = sizeof(struct ath_node); 882 hw->sta_data_size = sizeof(struct ath_node);
883 hw->vif_data_size = sizeof(struct ath_vif); 883 hw->vif_data_size = sizeof(struct ath_vif);
884 hw->extra_tx_headroom = 4;
884 885
885 hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; 886 hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
886 hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1; 887 hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 28490702124a..71d3e9adbf3c 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -120,6 +120,7 @@ MODULE_PARM_DESC(allhwsupport, "Enable support for all hardware (even it if over
120#ifdef CONFIG_B43_BCMA 120#ifdef CONFIG_B43_BCMA
121static const struct bcma_device_id b43_bcma_tbl[] = { 121static const struct bcma_device_id b43_bcma_tbl[] = {
122 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS), 122 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS),
123 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x15, BCMA_ANY_CLASS),
123 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS), 124 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
124 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS), 125 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
125 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1C, BCMA_ANY_CLASS), 126 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1C, BCMA_ANY_CLASS),
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c
index ab45819c1fbb..e18629a16fb0 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -1020,7 +1020,7 @@ static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw,
1020 u8 *pn = seq.ccmp.pn; 1020 u8 *pn = seq.ccmp.pn;
1021 1021
1022 ieee80211_get_key_rx_seq(key, i, &seq); 1022 ieee80211_get_key_rx_seq(key, i, &seq);
1023 aes_sc->pn = cpu_to_le64( 1023 aes_sc[i].pn = cpu_to_le64(
1024 (u64)pn[5] | 1024 (u64)pn[5] |
1025 ((u64)pn[4] << 8) | 1025 ((u64)pn[4] << 8) |
1026 ((u64)pn[3] << 16) | 1026 ((u64)pn[3] << 16) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
index d561181f2cff..1a73c7a1da77 100644
--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -341,6 +341,6 @@ const struct iwl_cfg iwl7265d_n_cfg = {
341}; 341};
342 342
343MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 343MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
344MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); 344MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
345MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 345MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
346MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 346MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 1d54355ad76a..85ae902df7c0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -274,18 +274,13 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
274 break; 274 break;
275 case WLAN_CIPHER_SUITE_CCMP: 275 case WLAN_CIPHER_SUITE_CCMP:
276 if (sta) { 276 if (sta) {
277 u8 *pn = seq.ccmp.pn; 277 u64 pn64;
278 278
279 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; 279 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc;
280 aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; 280 aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc;
281 281
282 ieee80211_get_key_tx_seq(key, &seq); 282 pn64 = atomic64_read(&key->tx_pn);
283 aes_tx_sc->pn = cpu_to_le64((u64)pn[5] | 283 aes_tx_sc->pn = cpu_to_le64(pn64);
284 ((u64)pn[4] << 8) |
285 ((u64)pn[3] << 16) |
286 ((u64)pn[2] << 24) |
287 ((u64)pn[1] << 32) |
288 ((u64)pn[0] << 40));
289 } else { 284 } else {
290 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; 285 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc;
291 } 286 }
@@ -298,12 +293,12 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
298 u8 *pn = seq.ccmp.pn; 293 u8 *pn = seq.ccmp.pn;
299 294
300 ieee80211_get_key_rx_seq(key, i, &seq); 295 ieee80211_get_key_rx_seq(key, i, &seq);
301 aes_sc->pn = cpu_to_le64((u64)pn[5] | 296 aes_sc[i].pn = cpu_to_le64((u64)pn[5] |
302 ((u64)pn[4] << 8) | 297 ((u64)pn[4] << 8) |
303 ((u64)pn[3] << 16) | 298 ((u64)pn[3] << 16) |
304 ((u64)pn[2] << 24) | 299 ((u64)pn[2] << 24) |
305 ((u64)pn[1] << 32) | 300 ((u64)pn[1] << 32) |
306 ((u64)pn[0] << 40)); 301 ((u64)pn[0] << 40));
307 } 302 }
308 data->use_rsc_tsc = true; 303 data->use_rsc_tsc = true;
309 break; 304 break;
@@ -1456,15 +1451,15 @@ static void iwl_mvm_d3_update_gtks(struct ieee80211_hw *hw,
1456 1451
1457 switch (key->cipher) { 1452 switch (key->cipher) {
1458 case WLAN_CIPHER_SUITE_CCMP: 1453 case WLAN_CIPHER_SUITE_CCMP:
1459 iwl_mvm_aes_sc_to_seq(&sc->aes.tsc, &seq);
1460 iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key); 1454 iwl_mvm_set_aes_rx_seq(sc->aes.unicast_rsc, key);
1455 atomic64_set(&key->tx_pn, le64_to_cpu(sc->aes.tsc.pn));
1461 break; 1456 break;
1462 case WLAN_CIPHER_SUITE_TKIP: 1457 case WLAN_CIPHER_SUITE_TKIP:
1463 iwl_mvm_tkip_sc_to_seq(&sc->tkip.tsc, &seq); 1458 iwl_mvm_tkip_sc_to_seq(&sc->tkip.tsc, &seq);
1464 iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key); 1459 iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key);
1460 ieee80211_set_key_tx_seq(key, &seq);
1465 break; 1461 break;
1466 } 1462 }
1467 ieee80211_set_key_tx_seq(key, &seq);
1468 1463
1469 /* that's it for this key */ 1464 /* that's it for this key */
1470 return; 1465 return;
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index 834641e250fb..d906fa13ba97 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -699,7 +699,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
699 * abort after reading the nvm in case RF Kill is on, we will complete 699 * abort after reading the nvm in case RF Kill is on, we will complete
700 * the init seq later when RF kill will switch to off 700 * the init seq later when RF kill will switch to off
701 */ 701 */
702 if (iwl_mvm_is_radio_killed(mvm)) { 702 if (iwl_mvm_is_radio_hw_killed(mvm)) {
703 IWL_DEBUG_RF_KILL(mvm, 703 IWL_DEBUG_RF_KILL(mvm,
704 "jump over all phy activities due to RF kill\n"); 704 "jump over all phy activities due to RF kill\n");
705 iwl_remove_notification(&mvm->notif_wait, &calib_wait); 705 iwl_remove_notification(&mvm->notif_wait, &calib_wait);
@@ -732,7 +732,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
732 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, 732 ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait,
733 MVM_UCODE_CALIB_TIMEOUT); 733 MVM_UCODE_CALIB_TIMEOUT);
734 734
735 if (ret && iwl_mvm_is_radio_killed(mvm)) { 735 if (ret && iwl_mvm_is_radio_hw_killed(mvm)) {
736 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); 736 IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n");
737 ret = 1; 737 ret = 1;
738 } 738 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 8443e14101cf..a38e07bb137f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -2373,6 +2373,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
2373 iwl_mvm_remove_time_event(mvm, mvmvif, 2373 iwl_mvm_remove_time_event(mvm, mvmvif,
2374 &mvmvif->time_event_data); 2374 &mvmvif->time_event_data);
2375 RCU_INIT_POINTER(mvm->csa_vif, NULL); 2375 RCU_INIT_POINTER(mvm->csa_vif, NULL);
2376 mvmvif->csa_countdown = false;
2376 } 2377 }
2377 2378
2378 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) { 2379 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) {
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 0d3aff1b4bad..16c5a6d7e0c9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -870,6 +870,11 @@ static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
870 test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); 870 test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
871} 871}
872 872
873static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
874{
875 return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
876}
877
873/* Must be called with rcu_read_lock() held and it can only be 878/* Must be called with rcu_read_lock() held and it can only be
874 * released when mvmsta is not needed anymore. 879 * released when mvmsta is not needed anymore.
875 */ 880 */
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index 064c100e45fe..7fcd2c24a0a4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -602,6 +602,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
602 ieee80211_unregister_hw(mvm->hw); 602 ieee80211_unregister_hw(mvm->hw);
603 iwl_mvm_leds_exit(mvm); 603 iwl_mvm_leds_exit(mvm);
604 out_free: 604 out_free:
605 flush_delayed_work(&mvm->fw_dump_wk);
605 iwl_phy_db_free(mvm->phy_db); 606 iwl_phy_db_free(mvm->phy_db);
606 kfree(mvm->scan_cmd); 607 kfree(mvm->scan_cmd);
607 if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name) 608 if (!cfg->no_power_up_nic_in_init || !mvm->nvm_file_name)
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index b0825c402c73..644b58bc5226 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -414,6 +414,11 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
414 {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)}, 414 {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)},
415 {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)}, 415 {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)},
416 {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)}, 416 {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)},
417 {IWL_PCI_DEVICE(0x095A, 0x5F10, iwl7265_2ac_cfg)},
418 {IWL_PCI_DEVICE(0x095B, 0x5212, iwl7265_2ac_cfg)},
419 {IWL_PCI_DEVICE(0x095B, 0x520A, iwl7265_2ac_cfg)},
420 {IWL_PCI_DEVICE(0x095A, 0x9000, iwl7265_2ac_cfg)},
421 {IWL_PCI_DEVICE(0x095A, 0x9400, iwl7265_2ac_cfg)},
417 422
418/* 8000 Series */ 423/* 8000 Series */
419 {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, 424 {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)},
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 5932306084fd..bf9afbf46c1b 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1114,6 +1114,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
1114 { USB_DEVICE(0x0db0, 0x871c) }, 1114 { USB_DEVICE(0x0db0, 0x871c) },
1115 { USB_DEVICE(0x0db0, 0x899a) }, 1115 { USB_DEVICE(0x0db0, 0x899a) },
1116 /* Ovislink */ 1116 /* Ovislink */
1117 { USB_DEVICE(0x1b75, 0x3070) },
1117 { USB_DEVICE(0x1b75, 0x3071) }, 1118 { USB_DEVICE(0x1b75, 0x3071) },
1118 { USB_DEVICE(0x1b75, 0x3072) }, 1119 { USB_DEVICE(0x1b75, 0x3072) },
1119 { USB_DEVICE(0x1b75, 0xa200) }, 1120 { USB_DEVICE(0x1b75, 0xa200) },
diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
index d4567d12e07e..5da6703942d9 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -247,6 +247,8 @@ struct rtl_pci {
247 /* MSI support */ 247 /* MSI support */
248 bool msi_support; 248 bool msi_support;
249 bool using_msi; 249 bool using_msi;
250 /* interrupt clear before set */
251 bool int_clear;
250}; 252};
251 253
252struct mp_adapter { 254struct mp_adapter {
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
index b7f18e2155eb..6e9418ed90c2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
@@ -2253,11 +2253,28 @@ void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci)
2253 } 2253 }
2254} 2254}
2255 2255
2256static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw)
2257{
2258 struct rtl_priv *rtlpriv = rtl_priv(hw);
2259 u32 tmp = rtl_read_dword(rtlpriv, REG_HISR);
2260
2261 rtl_write_dword(rtlpriv, REG_HISR, tmp);
2262
2263 tmp = rtl_read_dword(rtlpriv, REG_HISRE);
2264 rtl_write_dword(rtlpriv, REG_HISRE, tmp);
2265
2266 tmp = rtl_read_dword(rtlpriv, REG_HSISR);
2267 rtl_write_dword(rtlpriv, REG_HSISR, tmp);
2268}
2269
2256void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw) 2270void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw)
2257{ 2271{
2258 struct rtl_priv *rtlpriv = rtl_priv(hw); 2272 struct rtl_priv *rtlpriv = rtl_priv(hw);
2259 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 2273 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
2260 2274
2275 if (!rtlpci->int_clear)
2276 rtl8821ae_clear_interrupt(hw);/*clear it here first*/
2277
2261 rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); 2278 rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF);
2262 rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); 2279 rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF);
2263 rtlpci->irq_enabled = true; 2280 rtlpci->irq_enabled = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
index a4988121e1ab..8ee141a55bc5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
@@ -96,6 +96,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
96 96
97 rtl8821ae_bt_reg_init(hw); 97 rtl8821ae_bt_reg_init(hw);
98 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; 98 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
99 rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
99 rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); 100 rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
100 101
101 rtlpriv->dm.dm_initialgain_enable = 1; 102 rtlpriv->dm.dm_initialgain_enable = 1;
@@ -167,6 +168,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
167 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; 168 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
168 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; 169 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
169 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; 170 rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
171 rtlpci->msi_support = rtlpriv->cfg->mod_params->int_clear;
170 if (rtlpriv->cfg->mod_params->disable_watchdog) 172 if (rtlpriv->cfg->mod_params->disable_watchdog)
171 pr_info("watchdog disabled\n"); 173 pr_info("watchdog disabled\n");
172 rtlpriv->psc.reg_fwctrl_lps = 3; 174 rtlpriv->psc.reg_fwctrl_lps = 3;
@@ -308,6 +310,7 @@ static struct rtl_mod_params rtl8821ae_mod_params = {
308 .swctrl_lps = false, 310 .swctrl_lps = false,
309 .fwctrl_lps = true, 311 .fwctrl_lps = true,
310 .msi_support = true, 312 .msi_support = true,
313 .int_clear = true,
311 .debug = DBG_EMERG, 314 .debug = DBG_EMERG,
312 .disable_watchdog = 0, 315 .disable_watchdog = 0,
313}; 316};
@@ -437,6 +440,7 @@ module_param_named(fwlps, rtl8821ae_mod_params.fwctrl_lps, bool, 0444);
437module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444); 440module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444);
438module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog, 441module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog,
439 bool, 0444); 442 bool, 0444);
443module_param_named(int_clear, rtl8821ae_mod_params.int_clear, bool, 0444);
440MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); 444MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
441MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); 445MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
442MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); 446MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
@@ -444,6 +448,7 @@ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
444MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n"); 448MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
445MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); 449MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
446MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n"); 450MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n");
451MODULE_PARM_DESC(int_clear, "Set to 1 to disable interrupt clear before set (default 0)\n");
447 452
448static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); 453static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
449 454
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index b90ca618b123..4544752a2ba8 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -2249,6 +2249,9 @@ struct rtl_mod_params {
2249 2249
2250 /* default 0: 1 means disable */ 2250 /* default 0: 1 means disable */
2251 bool disable_watchdog; 2251 bool disable_watchdog;
2252
2253 /* default 0: 1 means do not disable interrupts */
2254 bool int_clear;
2252}; 2255};
2253 2256
2254struct rtl_hal_usbint_cfg { 2257struct rtl_hal_usbint_cfg {
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 929a6e7e5ecf..56ebd8267386 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -788,6 +788,12 @@ static void connect(struct backend_info *be)
788 /* Use the number of queues requested by the frontend */ 788 /* Use the number of queues requested by the frontend */
789 be->vif->queues = vzalloc(requested_num_queues * 789 be->vif->queues = vzalloc(requested_num_queues *
790 sizeof(struct xenvif_queue)); 790 sizeof(struct xenvif_queue));
791 if (!be->vif->queues) {
792 xenbus_dev_fatal(dev, -ENOMEM,
793 "allocating queues");
794 return;
795 }
796
791 be->vif->num_queues = requested_num_queues; 797 be->vif->num_queues = requested_num_queues;
792 be->vif->stalled_queues = requested_num_queues; 798 be->vif->stalled_queues = requested_num_queues;
793 799
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index d3c6676b3c0c..6fd4e5a5ef4a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -67,7 +67,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
67 int rc; 67 int rc;
68 68
69 /* Stop the user from reading */ 69 /* Stop the user from reading */
70 if (pos > nvmem->size) 70 if (pos >= nvmem->size)
71 return 0; 71 return 0;
72 72
73 if (pos + count > nvmem->size) 73 if (pos + count > nvmem->size)
@@ -92,7 +92,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
92 int rc; 92 int rc;
93 93
94 /* Stop the user from writing */ 94 /* Stop the user from writing */
95 if (pos > nvmem->size) 95 if (pos >= nvmem->size)
96 return 0; 96 return 0;
97 97
98 if (pos + count > nvmem->size) 98 if (pos + count > nvmem->size)
@@ -825,7 +825,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
825 return rc; 825 return rc;
826 826
827 /* shift bits in-place */ 827 /* shift bits in-place */
828 if (cell->bit_offset || cell->bit_offset) 828 if (cell->bit_offset || cell->nbits)
829 nvmem_shift_read_buffer_in_place(cell, buf); 829 nvmem_shift_read_buffer_in_place(cell, buf);
830 830
831 *len = cell->bytes; 831 *len = cell->bytes;
@@ -938,7 +938,7 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len)
938 rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes); 938 rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes);
939 939
940 /* free the tmp buffer */ 940 /* free the tmp buffer */
941 if (cell->bit_offset) 941 if (cell->bit_offset || cell->nbits)
942 kfree(buf); 942 kfree(buf);
943 943
944 if (IS_ERR_VALUE(rc)) 944 if (IS_ERR_VALUE(rc))
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 14777dd5212d..cfa3b85064dd 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -103,7 +103,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
103 struct nvmem_device *nvmem; 103 struct nvmem_device *nvmem;
104 struct regmap *regmap; 104 struct regmap *regmap;
105 struct sunxi_sid *sid; 105 struct sunxi_sid *sid;
106 int i, size; 106 int ret, i, size;
107 char *randomness; 107 char *randomness;
108 108
109 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL); 109 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL);
@@ -131,6 +131,11 @@ static int sunxi_sid_probe(struct platform_device *pdev)
131 return PTR_ERR(nvmem); 131 return PTR_ERR(nvmem);
132 132
133 randomness = kzalloc(sizeof(u8) * size, GFP_KERNEL); 133 randomness = kzalloc(sizeof(u8) * size, GFP_KERNEL);
134 if (!randomness) {
135 ret = -EINVAL;
136 goto err_unreg_nvmem;
137 }
138
134 for (i = 0; i < size; i++) 139 for (i = 0; i < size; i++)
135 randomness[i] = sunxi_sid_read_byte(sid, i); 140 randomness[i] = sunxi_sid_read_byte(sid, i);
136 141
@@ -140,6 +145,10 @@ static int sunxi_sid_probe(struct platform_device *pdev)
140 platform_set_drvdata(pdev, nvmem); 145 platform_set_drvdata(pdev, nvmem);
141 146
142 return 0; 147 return 0;
148
149err_unreg_nvmem:
150 nvmem_unregister(nvmem);
151 return ret;
143} 152}
144 153
145static int sunxi_sid_remove(struct platform_device *pdev) 154static int sunxi_sid_remove(struct platform_device *pdev)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d4497141d083..4a7da3c3e035 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1243,6 +1243,10 @@ static void pci_msi_domain_update_chip_ops(struct msi_domain_info *info)
1243 BUG_ON(!chip); 1243 BUG_ON(!chip);
1244 if (!chip->irq_write_msi_msg) 1244 if (!chip->irq_write_msi_msg)
1245 chip->irq_write_msi_msg = pci_msi_domain_write_msg; 1245 chip->irq_write_msi_msg = pci_msi_domain_write_msg;
1246 if (!chip->irq_mask)
1247 chip->irq_mask = pci_msi_mask_irq;
1248 if (!chip->irq_unmask)
1249 chip->irq_unmask = pci_msi_unmask_irq;
1246} 1250}
1247 1251
1248/** 1252/**
diff --git a/drivers/phy/phy-berlin-sata.c b/drivers/phy/phy-berlin-sata.c
index 0062027afb1e..77a2e054fdea 100644
--- a/drivers/phy/phy-berlin-sata.c
+++ b/drivers/phy/phy-berlin-sata.c
@@ -276,6 +276,7 @@ static const struct of_device_id phy_berlin_sata_of_match[] = {
276 { .compatible = "marvell,berlin2q-sata-phy" }, 276 { .compatible = "marvell,berlin2q-sata-phy" },
277 { }, 277 { },
278}; 278};
279MODULE_DEVICE_TABLE(of, phy_berlin_sata_of_match);
279 280
280static struct platform_driver phy_berlin_sata_driver = { 281static struct platform_driver phy_berlin_sata_driver = {
281 .probe = phy_berlin_sata_probe, 282 .probe = phy_berlin_sata_probe,
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 49a1ed0cef56..107cb57c3513 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -432,6 +432,7 @@ out_disable_src:
432out: 432out:
433 return ret; 433 return ret;
434} 434}
435EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_ref_clk);
435 436
436static 437static
437int ufs_qcom_phy_disable_vreg(struct phy *phy, 438int ufs_qcom_phy_disable_vreg(struct phy *phy,
@@ -474,6 +475,7 @@ void ufs_qcom_phy_disable_ref_clk(struct phy *generic_phy)
474 phy->is_ref_clk_enabled = false; 475 phy->is_ref_clk_enabled = false;
475 } 476 }
476} 477}
478EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_ref_clk);
477 479
478#define UFS_REF_CLK_EN (1 << 5) 480#define UFS_REF_CLK_EN (1 << 5)
479 481
@@ -517,11 +519,13 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy)
517{ 519{
518 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true); 520 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
519} 521}
522EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
520 523
521void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy) 524void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
522{ 525{
523 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false); 526 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
524} 527}
528EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
525 529
526/* Turn ON M-PHY RMMI interface clocks */ 530/* Turn ON M-PHY RMMI interface clocks */
527int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy) 531int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
@@ -550,6 +554,7 @@ int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
550out: 554out:
551 return ret; 555 return ret;
552} 556}
557EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_iface_clk);
553 558
554/* Turn OFF M-PHY RMMI interface clocks */ 559/* Turn OFF M-PHY RMMI interface clocks */
555void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy) 560void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
@@ -562,6 +567,7 @@ void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
562 phy->is_iface_clk_enabled = false; 567 phy->is_iface_clk_enabled = false;
563 } 568 }
564} 569}
570EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_iface_clk);
565 571
566int ufs_qcom_phy_start_serdes(struct phy *generic_phy) 572int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
567{ 573{
@@ -578,6 +584,7 @@ int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
578 584
579 return ret; 585 return ret;
580} 586}
587EXPORT_SYMBOL_GPL(ufs_qcom_phy_start_serdes);
581 588
582int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes) 589int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
583{ 590{
@@ -595,6 +602,7 @@ int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
595 602
596 return ret; 603 return ret;
597} 604}
605EXPORT_SYMBOL_GPL(ufs_qcom_phy_set_tx_lane_enable);
598 606
599void ufs_qcom_phy_save_controller_version(struct phy *generic_phy, 607void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
600 u8 major, u16 minor, u16 step) 608 u8 major, u16 minor, u16 step)
@@ -605,6 +613,7 @@ void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
605 ufs_qcom_phy->host_ctrl_rev_minor = minor; 613 ufs_qcom_phy->host_ctrl_rev_minor = minor;
606 ufs_qcom_phy->host_ctrl_rev_step = step; 614 ufs_qcom_phy->host_ctrl_rev_step = step;
607} 615}
616EXPORT_SYMBOL_GPL(ufs_qcom_phy_save_controller_version);
608 617
609int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B) 618int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
610{ 619{
@@ -625,6 +634,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
625 634
626 return ret; 635 return ret;
627} 636}
637EXPORT_SYMBOL_GPL(ufs_qcom_phy_calibrate_phy);
628 638
629int ufs_qcom_phy_remove(struct phy *generic_phy, 639int ufs_qcom_phy_remove(struct phy *generic_phy,
630 struct ufs_qcom_phy *ufs_qcom_phy) 640 struct ufs_qcom_phy *ufs_qcom_phy)
@@ -662,6 +672,7 @@ int ufs_qcom_phy_is_pcs_ready(struct phy *generic_phy)
662 return ufs_qcom_phy->phy_spec_ops-> 672 return ufs_qcom_phy->phy_spec_ops->
663 is_physical_coding_sublayer_ready(ufs_qcom_phy); 673 is_physical_coding_sublayer_ready(ufs_qcom_phy);
664} 674}
675EXPORT_SYMBOL_GPL(ufs_qcom_phy_is_pcs_ready);
665 676
666int ufs_qcom_phy_power_on(struct phy *generic_phy) 677int ufs_qcom_phy_power_on(struct phy *generic_phy)
667{ 678{
diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
index 5a5c073e72fe..91d6f342c565 100644
--- a/drivers/phy/phy-rockchip-usb.c
+++ b/drivers/phy/phy-rockchip-usb.c
@@ -98,6 +98,7 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
98 struct device_node *child; 98 struct device_node *child;
99 struct regmap *grf; 99 struct regmap *grf;
100 unsigned int reg_offset; 100 unsigned int reg_offset;
101 int err;
101 102
102 grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); 103 grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
103 if (IS_ERR(grf)) { 104 if (IS_ERR(grf)) {
@@ -129,6 +130,11 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
129 return PTR_ERR(rk_phy->phy); 130 return PTR_ERR(rk_phy->phy);
130 } 131 }
131 phy_set_drvdata(rk_phy->phy, rk_phy); 132 phy_set_drvdata(rk_phy->phy, rk_phy);
133
134 /* only power up usb phy when it use, so disable it when init*/
135 err = rockchip_usb_phy_power(rk_phy, 1);
136 if (err)
137 return err;
132 } 138 }
133 139
134 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 140 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
diff --git a/drivers/pinctrl/freescale/pinctrl-imx25.c b/drivers/pinctrl/freescale/pinctrl-imx25.c
index faf635654312..293ed4381cc0 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx25.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx25.c
@@ -26,7 +26,8 @@
26#include "pinctrl-imx.h" 26#include "pinctrl-imx.h"
27 27
28enum imx25_pads { 28enum imx25_pads {
29 MX25_PAD_RESERVE0 = 1, 29 MX25_PAD_RESERVE0 = 0,
30 MX25_PAD_RESERVE1 = 1,
30 MX25_PAD_A10 = 2, 31 MX25_PAD_A10 = 2,
31 MX25_PAD_A13 = 3, 32 MX25_PAD_A13 = 3,
32 MX25_PAD_A14 = 4, 33 MX25_PAD_A14 = 4,
@@ -169,6 +170,7 @@ enum imx25_pads {
169/* Pad names for the pinmux subsystem */ 170/* Pad names for the pinmux subsystem */
170static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = { 171static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = {
171 IMX_PINCTRL_PIN(MX25_PAD_RESERVE0), 172 IMX_PINCTRL_PIN(MX25_PAD_RESERVE0),
173 IMX_PINCTRL_PIN(MX25_PAD_RESERVE1),
172 IMX_PINCTRL_PIN(MX25_PAD_A10), 174 IMX_PINCTRL_PIN(MX25_PAD_A10),
173 IMX_PINCTRL_PIN(MX25_PAD_A13), 175 IMX_PINCTRL_PIN(MX25_PAD_A13),
174 IMX_PINCTRL_PIN(MX25_PAD_A14), 176 IMX_PINCTRL_PIN(MX25_PAD_A14),
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c b/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
index 63676617bc59..f9a3f8f446f7 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
@@ -653,7 +653,7 @@ static const struct sunxi_desc_pin sun5i_a10s_pins[] = {
653 SUNXI_FUNCTION(0x0, "gpio_in"), 653 SUNXI_FUNCTION(0x0, "gpio_in"),
654 SUNXI_FUNCTION(0x1, "gpio_out"), 654 SUNXI_FUNCTION(0x1, "gpio_out"),
655 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */ 655 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */
656 SUNXI_FUNCTION(0x3, "uart3"), /* PWM1 */ 656 SUNXI_FUNCTION(0x3, "pwm"), /* PWM1 */
657 SUNXI_FUNCTION(0x5, "uart2"), /* CTS */ 657 SUNXI_FUNCTION(0x5, "uart2"), /* CTS */
658 SUNXI_FUNCTION_IRQ(0x6, 13)), /* EINT13 */ 658 SUNXI_FUNCTION_IRQ(0x6, 13)), /* EINT13 */
659}; 659};
diff --git a/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c b/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
index 7e9dae54fcb2..2df8bbecebfc 100644
--- a/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
+++ b/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
@@ -22,49 +22,49 @@
22#define DRIVER_NAME "ph1-sld8-pinctrl" 22#define DRIVER_NAME "ph1-sld8-pinctrl"
23 23
24static const struct pinctrl_pin_desc ph1_sld8_pins[] = { 24static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
25 UNIPHIER_PINCTRL_PIN(0, "PCA00", UNIPHIER_PIN_IECTRL_NONE, 25 UNIPHIER_PINCTRL_PIN(0, "PCA00", 0,
26 15, UNIPHIER_PIN_DRV_4_8, 26 15, UNIPHIER_PIN_DRV_4_8,
27 15, UNIPHIER_PIN_PULL_DOWN), 27 15, UNIPHIER_PIN_PULL_DOWN),
28 UNIPHIER_PINCTRL_PIN(1, "PCA01", UNIPHIER_PIN_IECTRL_NONE, 28 UNIPHIER_PINCTRL_PIN(1, "PCA01", 0,
29 16, UNIPHIER_PIN_DRV_4_8, 29 16, UNIPHIER_PIN_DRV_4_8,
30 16, UNIPHIER_PIN_PULL_DOWN), 30 16, UNIPHIER_PIN_PULL_DOWN),
31 UNIPHIER_PINCTRL_PIN(2, "PCA02", UNIPHIER_PIN_IECTRL_NONE, 31 UNIPHIER_PINCTRL_PIN(2, "PCA02", 0,
32 17, UNIPHIER_PIN_DRV_4_8, 32 17, UNIPHIER_PIN_DRV_4_8,
33 17, UNIPHIER_PIN_PULL_DOWN), 33 17, UNIPHIER_PIN_PULL_DOWN),
34 UNIPHIER_PINCTRL_PIN(3, "PCA03", UNIPHIER_PIN_IECTRL_NONE, 34 UNIPHIER_PINCTRL_PIN(3, "PCA03", 0,
35 18, UNIPHIER_PIN_DRV_4_8, 35 18, UNIPHIER_PIN_DRV_4_8,
36 18, UNIPHIER_PIN_PULL_DOWN), 36 18, UNIPHIER_PIN_PULL_DOWN),
37 UNIPHIER_PINCTRL_PIN(4, "PCA04", UNIPHIER_PIN_IECTRL_NONE, 37 UNIPHIER_PINCTRL_PIN(4, "PCA04", 0,
38 19, UNIPHIER_PIN_DRV_4_8, 38 19, UNIPHIER_PIN_DRV_4_8,
39 19, UNIPHIER_PIN_PULL_DOWN), 39 19, UNIPHIER_PIN_PULL_DOWN),
40 UNIPHIER_PINCTRL_PIN(5, "PCA05", UNIPHIER_PIN_IECTRL_NONE, 40 UNIPHIER_PINCTRL_PIN(5, "PCA05", 0,
41 20, UNIPHIER_PIN_DRV_4_8, 41 20, UNIPHIER_PIN_DRV_4_8,
42 20, UNIPHIER_PIN_PULL_DOWN), 42 20, UNIPHIER_PIN_PULL_DOWN),
43 UNIPHIER_PINCTRL_PIN(6, "PCA06", UNIPHIER_PIN_IECTRL_NONE, 43 UNIPHIER_PINCTRL_PIN(6, "PCA06", 0,
44 21, UNIPHIER_PIN_DRV_4_8, 44 21, UNIPHIER_PIN_DRV_4_8,
45 21, UNIPHIER_PIN_PULL_DOWN), 45 21, UNIPHIER_PIN_PULL_DOWN),
46 UNIPHIER_PINCTRL_PIN(7, "PCA07", UNIPHIER_PIN_IECTRL_NONE, 46 UNIPHIER_PINCTRL_PIN(7, "PCA07", 0,
47 22, UNIPHIER_PIN_DRV_4_8, 47 22, UNIPHIER_PIN_DRV_4_8,
48 22, UNIPHIER_PIN_PULL_DOWN), 48 22, UNIPHIER_PIN_PULL_DOWN),
49 UNIPHIER_PINCTRL_PIN(8, "PCA08", UNIPHIER_PIN_IECTRL_NONE, 49 UNIPHIER_PINCTRL_PIN(8, "PCA08", 0,
50 23, UNIPHIER_PIN_DRV_4_8, 50 23, UNIPHIER_PIN_DRV_4_8,
51 23, UNIPHIER_PIN_PULL_DOWN), 51 23, UNIPHIER_PIN_PULL_DOWN),
52 UNIPHIER_PINCTRL_PIN(9, "PCA09", UNIPHIER_PIN_IECTRL_NONE, 52 UNIPHIER_PINCTRL_PIN(9, "PCA09", 0,
53 24, UNIPHIER_PIN_DRV_4_8, 53 24, UNIPHIER_PIN_DRV_4_8,
54 24, UNIPHIER_PIN_PULL_DOWN), 54 24, UNIPHIER_PIN_PULL_DOWN),
55 UNIPHIER_PINCTRL_PIN(10, "PCA10", UNIPHIER_PIN_IECTRL_NONE, 55 UNIPHIER_PINCTRL_PIN(10, "PCA10", 0,
56 25, UNIPHIER_PIN_DRV_4_8, 56 25, UNIPHIER_PIN_DRV_4_8,
57 25, UNIPHIER_PIN_PULL_DOWN), 57 25, UNIPHIER_PIN_PULL_DOWN),
58 UNIPHIER_PINCTRL_PIN(11, "PCA11", UNIPHIER_PIN_IECTRL_NONE, 58 UNIPHIER_PINCTRL_PIN(11, "PCA11", 0,
59 26, UNIPHIER_PIN_DRV_4_8, 59 26, UNIPHIER_PIN_DRV_4_8,
60 26, UNIPHIER_PIN_PULL_DOWN), 60 26, UNIPHIER_PIN_PULL_DOWN),
61 UNIPHIER_PINCTRL_PIN(12, "PCA12", UNIPHIER_PIN_IECTRL_NONE, 61 UNIPHIER_PINCTRL_PIN(12, "PCA12", 0,
62 27, UNIPHIER_PIN_DRV_4_8, 62 27, UNIPHIER_PIN_DRV_4_8,
63 27, UNIPHIER_PIN_PULL_DOWN), 63 27, UNIPHIER_PIN_PULL_DOWN),
64 UNIPHIER_PINCTRL_PIN(13, "PCA13", UNIPHIER_PIN_IECTRL_NONE, 64 UNIPHIER_PINCTRL_PIN(13, "PCA13", 0,
65 28, UNIPHIER_PIN_DRV_4_8, 65 28, UNIPHIER_PIN_DRV_4_8,
66 28, UNIPHIER_PIN_PULL_DOWN), 66 28, UNIPHIER_PIN_PULL_DOWN),
67 UNIPHIER_PINCTRL_PIN(14, "PCA14", UNIPHIER_PIN_IECTRL_NONE, 67 UNIPHIER_PINCTRL_PIN(14, "PCA14", 0,
68 29, UNIPHIER_PIN_DRV_4_8, 68 29, UNIPHIER_PIN_DRV_4_8,
69 29, UNIPHIER_PIN_PULL_DOWN), 69 29, UNIPHIER_PIN_PULL_DOWN),
70 UNIPHIER_PINCTRL_PIN(15, "XNFRE_GB", UNIPHIER_PIN_IECTRL_NONE, 70 UNIPHIER_PINCTRL_PIN(15, "XNFRE_GB", UNIPHIER_PIN_IECTRL_NONE,
@@ -118,199 +118,199 @@ static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
118 UNIPHIER_PINCTRL_PIN(31, "NFD7_GB", UNIPHIER_PIN_IECTRL_NONE, 118 UNIPHIER_PINCTRL_PIN(31, "NFD7_GB", UNIPHIER_PIN_IECTRL_NONE,
119 36, UNIPHIER_PIN_DRV_8_12_16_20, 119 36, UNIPHIER_PIN_DRV_8_12_16_20,
120 128, UNIPHIER_PIN_PULL_UP), 120 128, UNIPHIER_PIN_PULL_UP),
121 UNIPHIER_PINCTRL_PIN(32, "SDCLK", UNIPHIER_PIN_IECTRL_NONE, 121 UNIPHIER_PINCTRL_PIN(32, "SDCLK", 8,
122 40, UNIPHIER_PIN_DRV_8_12_16_20, 122 40, UNIPHIER_PIN_DRV_8_12_16_20,
123 -1, UNIPHIER_PIN_PULL_NONE), 123 -1, UNIPHIER_PIN_PULL_NONE),
124 UNIPHIER_PINCTRL_PIN(33, "SDCMD", UNIPHIER_PIN_IECTRL_NONE, 124 UNIPHIER_PINCTRL_PIN(33, "SDCMD", 8,
125 44, UNIPHIER_PIN_DRV_8_12_16_20, 125 44, UNIPHIER_PIN_DRV_8_12_16_20,
126 -1, UNIPHIER_PIN_PULL_NONE), 126 -1, UNIPHIER_PIN_PULL_NONE),
127 UNIPHIER_PINCTRL_PIN(34, "SDDAT0", UNIPHIER_PIN_IECTRL_NONE, 127 UNIPHIER_PINCTRL_PIN(34, "SDDAT0", 8,
128 48, UNIPHIER_PIN_DRV_8_12_16_20, 128 48, UNIPHIER_PIN_DRV_8_12_16_20,
129 -1, UNIPHIER_PIN_PULL_NONE), 129 -1, UNIPHIER_PIN_PULL_NONE),
130 UNIPHIER_PINCTRL_PIN(35, "SDDAT1", UNIPHIER_PIN_IECTRL_NONE, 130 UNIPHIER_PINCTRL_PIN(35, "SDDAT1", 8,
131 52, UNIPHIER_PIN_DRV_8_12_16_20, 131 52, UNIPHIER_PIN_DRV_8_12_16_20,
132 -1, UNIPHIER_PIN_PULL_NONE), 132 -1, UNIPHIER_PIN_PULL_NONE),
133 UNIPHIER_PINCTRL_PIN(36, "SDDAT2", UNIPHIER_PIN_IECTRL_NONE, 133 UNIPHIER_PINCTRL_PIN(36, "SDDAT2", 8,
134 56, UNIPHIER_PIN_DRV_8_12_16_20, 134 56, UNIPHIER_PIN_DRV_8_12_16_20,
135 -1, UNIPHIER_PIN_PULL_NONE), 135 -1, UNIPHIER_PIN_PULL_NONE),
136 UNIPHIER_PINCTRL_PIN(37, "SDDAT3", UNIPHIER_PIN_IECTRL_NONE, 136 UNIPHIER_PINCTRL_PIN(37, "SDDAT3", 8,
137 60, UNIPHIER_PIN_DRV_8_12_16_20, 137 60, UNIPHIER_PIN_DRV_8_12_16_20,
138 -1, UNIPHIER_PIN_PULL_NONE), 138 -1, UNIPHIER_PIN_PULL_NONE),
139 UNIPHIER_PINCTRL_PIN(38, "SDCD", UNIPHIER_PIN_IECTRL_NONE, 139 UNIPHIER_PINCTRL_PIN(38, "SDCD", 8,
140 -1, UNIPHIER_PIN_DRV_FIXED_4, 140 -1, UNIPHIER_PIN_DRV_FIXED_4,
141 129, UNIPHIER_PIN_PULL_DOWN), 141 129, UNIPHIER_PIN_PULL_DOWN),
142 UNIPHIER_PINCTRL_PIN(39, "SDWP", UNIPHIER_PIN_IECTRL_NONE, 142 UNIPHIER_PINCTRL_PIN(39, "SDWP", 8,
143 -1, UNIPHIER_PIN_DRV_FIXED_4, 143 -1, UNIPHIER_PIN_DRV_FIXED_4,
144 130, UNIPHIER_PIN_PULL_DOWN), 144 130, UNIPHIER_PIN_PULL_DOWN),
145 UNIPHIER_PINCTRL_PIN(40, "SDVOLC", UNIPHIER_PIN_IECTRL_NONE, 145 UNIPHIER_PINCTRL_PIN(40, "SDVOLC", 9,
146 -1, UNIPHIER_PIN_DRV_FIXED_4, 146 -1, UNIPHIER_PIN_DRV_FIXED_4,
147 131, UNIPHIER_PIN_PULL_DOWN), 147 131, UNIPHIER_PIN_PULL_DOWN),
148 UNIPHIER_PINCTRL_PIN(41, "USB0VBUS", UNIPHIER_PIN_IECTRL_NONE, 148 UNIPHIER_PINCTRL_PIN(41, "USB0VBUS", 0,
149 37, UNIPHIER_PIN_DRV_4_8, 149 37, UNIPHIER_PIN_DRV_4_8,
150 37, UNIPHIER_PIN_PULL_DOWN), 150 37, UNIPHIER_PIN_PULL_DOWN),
151 UNIPHIER_PINCTRL_PIN(42, "USB0OD", UNIPHIER_PIN_IECTRL_NONE, 151 UNIPHIER_PINCTRL_PIN(42, "USB0OD", 0,
152 38, UNIPHIER_PIN_DRV_4_8, 152 38, UNIPHIER_PIN_DRV_4_8,
153 38, UNIPHIER_PIN_PULL_DOWN), 153 38, UNIPHIER_PIN_PULL_DOWN),
154 UNIPHIER_PINCTRL_PIN(43, "USB1VBUS", UNIPHIER_PIN_IECTRL_NONE, 154 UNIPHIER_PINCTRL_PIN(43, "USB1VBUS", 0,
155 39, UNIPHIER_PIN_DRV_4_8, 155 39, UNIPHIER_PIN_DRV_4_8,
156 39, UNIPHIER_PIN_PULL_DOWN), 156 39, UNIPHIER_PIN_PULL_DOWN),
157 UNIPHIER_PINCTRL_PIN(44, "USB1OD", UNIPHIER_PIN_IECTRL_NONE, 157 UNIPHIER_PINCTRL_PIN(44, "USB1OD", 0,
158 40, UNIPHIER_PIN_DRV_4_8, 158 40, UNIPHIER_PIN_DRV_4_8,
159 40, UNIPHIER_PIN_PULL_DOWN), 159 40, UNIPHIER_PIN_PULL_DOWN),
160 UNIPHIER_PINCTRL_PIN(45, "PCRESET", UNIPHIER_PIN_IECTRL_NONE, 160 UNIPHIER_PINCTRL_PIN(45, "PCRESET", 0,
161 41, UNIPHIER_PIN_DRV_4_8, 161 41, UNIPHIER_PIN_DRV_4_8,
162 41, UNIPHIER_PIN_PULL_DOWN), 162 41, UNIPHIER_PIN_PULL_DOWN),
163 UNIPHIER_PINCTRL_PIN(46, "PCREG", UNIPHIER_PIN_IECTRL_NONE, 163 UNIPHIER_PINCTRL_PIN(46, "PCREG", 0,
164 42, UNIPHIER_PIN_DRV_4_8, 164 42, UNIPHIER_PIN_DRV_4_8,
165 42, UNIPHIER_PIN_PULL_DOWN), 165 42, UNIPHIER_PIN_PULL_DOWN),
166 UNIPHIER_PINCTRL_PIN(47, "PCCE2", UNIPHIER_PIN_IECTRL_NONE, 166 UNIPHIER_PINCTRL_PIN(47, "PCCE2", 0,
167 43, UNIPHIER_PIN_DRV_4_8, 167 43, UNIPHIER_PIN_DRV_4_8,
168 43, UNIPHIER_PIN_PULL_DOWN), 168 43, UNIPHIER_PIN_PULL_DOWN),
169 UNIPHIER_PINCTRL_PIN(48, "PCVS1", UNIPHIER_PIN_IECTRL_NONE, 169 UNIPHIER_PINCTRL_PIN(48, "PCVS1", 0,
170 44, UNIPHIER_PIN_DRV_4_8, 170 44, UNIPHIER_PIN_DRV_4_8,
171 44, UNIPHIER_PIN_PULL_DOWN), 171 44, UNIPHIER_PIN_PULL_DOWN),
172 UNIPHIER_PINCTRL_PIN(49, "PCCD2", UNIPHIER_PIN_IECTRL_NONE, 172 UNIPHIER_PINCTRL_PIN(49, "PCCD2", 0,
173 45, UNIPHIER_PIN_DRV_4_8, 173 45, UNIPHIER_PIN_DRV_4_8,
174 45, UNIPHIER_PIN_PULL_DOWN), 174 45, UNIPHIER_PIN_PULL_DOWN),
175 UNIPHIER_PINCTRL_PIN(50, "PCCD1", UNIPHIER_PIN_IECTRL_NONE, 175 UNIPHIER_PINCTRL_PIN(50, "PCCD1", 0,
176 46, UNIPHIER_PIN_DRV_4_8, 176 46, UNIPHIER_PIN_DRV_4_8,
177 46, UNIPHIER_PIN_PULL_DOWN), 177 46, UNIPHIER_PIN_PULL_DOWN),
178 UNIPHIER_PINCTRL_PIN(51, "PCREADY", UNIPHIER_PIN_IECTRL_NONE, 178 UNIPHIER_PINCTRL_PIN(51, "PCREADY", 0,
179 47, UNIPHIER_PIN_DRV_4_8, 179 47, UNIPHIER_PIN_DRV_4_8,
180 47, UNIPHIER_PIN_PULL_DOWN), 180 47, UNIPHIER_PIN_PULL_DOWN),
181 UNIPHIER_PINCTRL_PIN(52, "PCDOE", UNIPHIER_PIN_IECTRL_NONE, 181 UNIPHIER_PINCTRL_PIN(52, "PCDOE", 0,
182 48, UNIPHIER_PIN_DRV_4_8, 182 48, UNIPHIER_PIN_DRV_4_8,
183 48, UNIPHIER_PIN_PULL_DOWN), 183 48, UNIPHIER_PIN_PULL_DOWN),
184 UNIPHIER_PINCTRL_PIN(53, "PCCE1", UNIPHIER_PIN_IECTRL_NONE, 184 UNIPHIER_PINCTRL_PIN(53, "PCCE1", 0,
185 49, UNIPHIER_PIN_DRV_4_8, 185 49, UNIPHIER_PIN_DRV_4_8,
186 49, UNIPHIER_PIN_PULL_DOWN), 186 49, UNIPHIER_PIN_PULL_DOWN),
187 UNIPHIER_PINCTRL_PIN(54, "PCWE", UNIPHIER_PIN_IECTRL_NONE, 187 UNIPHIER_PINCTRL_PIN(54, "PCWE", 0,
188 50, UNIPHIER_PIN_DRV_4_8, 188 50, UNIPHIER_PIN_DRV_4_8,
189 50, UNIPHIER_PIN_PULL_DOWN), 189 50, UNIPHIER_PIN_PULL_DOWN),
190 UNIPHIER_PINCTRL_PIN(55, "PCOE", UNIPHIER_PIN_IECTRL_NONE, 190 UNIPHIER_PINCTRL_PIN(55, "PCOE", 0,
191 51, UNIPHIER_PIN_DRV_4_8, 191 51, UNIPHIER_PIN_DRV_4_8,
192 51, UNIPHIER_PIN_PULL_DOWN), 192 51, UNIPHIER_PIN_PULL_DOWN),
193 UNIPHIER_PINCTRL_PIN(56, "PCWAIT", UNIPHIER_PIN_IECTRL_NONE, 193 UNIPHIER_PINCTRL_PIN(56, "PCWAIT", 0,
194 52, UNIPHIER_PIN_DRV_4_8, 194 52, UNIPHIER_PIN_DRV_4_8,
195 52, UNIPHIER_PIN_PULL_DOWN), 195 52, UNIPHIER_PIN_PULL_DOWN),
196 UNIPHIER_PINCTRL_PIN(57, "PCIOWR", UNIPHIER_PIN_IECTRL_NONE, 196 UNIPHIER_PINCTRL_PIN(57, "PCIOWR", 0,
197 53, UNIPHIER_PIN_DRV_4_8, 197 53, UNIPHIER_PIN_DRV_4_8,
198 53, UNIPHIER_PIN_PULL_DOWN), 198 53, UNIPHIER_PIN_PULL_DOWN),
199 UNIPHIER_PINCTRL_PIN(58, "PCIORD", UNIPHIER_PIN_IECTRL_NONE, 199 UNIPHIER_PINCTRL_PIN(58, "PCIORD", 0,
200 54, UNIPHIER_PIN_DRV_4_8, 200 54, UNIPHIER_PIN_DRV_4_8,
201 54, UNIPHIER_PIN_PULL_DOWN), 201 54, UNIPHIER_PIN_PULL_DOWN),
202 UNIPHIER_PINCTRL_PIN(59, "HS0DIN0", UNIPHIER_PIN_IECTRL_NONE, 202 UNIPHIER_PINCTRL_PIN(59, "HS0DIN0", 0,
203 55, UNIPHIER_PIN_DRV_4_8, 203 55, UNIPHIER_PIN_DRV_4_8,
204 55, UNIPHIER_PIN_PULL_DOWN), 204 55, UNIPHIER_PIN_PULL_DOWN),
205 UNIPHIER_PINCTRL_PIN(60, "HS0DIN1", UNIPHIER_PIN_IECTRL_NONE, 205 UNIPHIER_PINCTRL_PIN(60, "HS0DIN1", 0,
206 56, UNIPHIER_PIN_DRV_4_8, 206 56, UNIPHIER_PIN_DRV_4_8,
207 56, UNIPHIER_PIN_PULL_DOWN), 207 56, UNIPHIER_PIN_PULL_DOWN),
208 UNIPHIER_PINCTRL_PIN(61, "HS0DIN2", UNIPHIER_PIN_IECTRL_NONE, 208 UNIPHIER_PINCTRL_PIN(61, "HS0DIN2", 0,
209 57, UNIPHIER_PIN_DRV_4_8, 209 57, UNIPHIER_PIN_DRV_4_8,
210 57, UNIPHIER_PIN_PULL_DOWN), 210 57, UNIPHIER_PIN_PULL_DOWN),
211 UNIPHIER_PINCTRL_PIN(62, "HS0DIN3", UNIPHIER_PIN_IECTRL_NONE, 211 UNIPHIER_PINCTRL_PIN(62, "HS0DIN3", 0,
212 58, UNIPHIER_PIN_DRV_4_8, 212 58, UNIPHIER_PIN_DRV_4_8,
213 58, UNIPHIER_PIN_PULL_DOWN), 213 58, UNIPHIER_PIN_PULL_DOWN),
214 UNIPHIER_PINCTRL_PIN(63, "HS0DIN4", UNIPHIER_PIN_IECTRL_NONE, 214 UNIPHIER_PINCTRL_PIN(63, "HS0DIN4", 0,
215 59, UNIPHIER_PIN_DRV_4_8, 215 59, UNIPHIER_PIN_DRV_4_8,
216 59, UNIPHIER_PIN_PULL_DOWN), 216 59, UNIPHIER_PIN_PULL_DOWN),
217 UNIPHIER_PINCTRL_PIN(64, "HS0DIN5", UNIPHIER_PIN_IECTRL_NONE, 217 UNIPHIER_PINCTRL_PIN(64, "HS0DIN5", 0,
218 60, UNIPHIER_PIN_DRV_4_8, 218 60, UNIPHIER_PIN_DRV_4_8,
219 60, UNIPHIER_PIN_PULL_DOWN), 219 60, UNIPHIER_PIN_PULL_DOWN),
220 UNIPHIER_PINCTRL_PIN(65, "HS0DIN6", UNIPHIER_PIN_IECTRL_NONE, 220 UNIPHIER_PINCTRL_PIN(65, "HS0DIN6", 0,
221 61, UNIPHIER_PIN_DRV_4_8, 221 61, UNIPHIER_PIN_DRV_4_8,
222 61, UNIPHIER_PIN_PULL_DOWN), 222 61, UNIPHIER_PIN_PULL_DOWN),
223 UNIPHIER_PINCTRL_PIN(66, "HS0DIN7", UNIPHIER_PIN_IECTRL_NONE, 223 UNIPHIER_PINCTRL_PIN(66, "HS0DIN7", 0,
224 62, UNIPHIER_PIN_DRV_4_8, 224 62, UNIPHIER_PIN_DRV_4_8,
225 62, UNIPHIER_PIN_PULL_DOWN), 225 62, UNIPHIER_PIN_PULL_DOWN),
226 UNIPHIER_PINCTRL_PIN(67, "HS0BCLKIN", UNIPHIER_PIN_IECTRL_NONE, 226 UNIPHIER_PINCTRL_PIN(67, "HS0BCLKIN", 0,
227 63, UNIPHIER_PIN_DRV_4_8, 227 63, UNIPHIER_PIN_DRV_4_8,
228 63, UNIPHIER_PIN_PULL_DOWN), 228 63, UNIPHIER_PIN_PULL_DOWN),
229 UNIPHIER_PINCTRL_PIN(68, "HS0VALIN", UNIPHIER_PIN_IECTRL_NONE, 229 UNIPHIER_PINCTRL_PIN(68, "HS0VALIN", 0,
230 64, UNIPHIER_PIN_DRV_4_8, 230 64, UNIPHIER_PIN_DRV_4_8,
231 64, UNIPHIER_PIN_PULL_DOWN), 231 64, UNIPHIER_PIN_PULL_DOWN),
232 UNIPHIER_PINCTRL_PIN(69, "HS0SYNCIN", UNIPHIER_PIN_IECTRL_NONE, 232 UNIPHIER_PINCTRL_PIN(69, "HS0SYNCIN", 0,
233 65, UNIPHIER_PIN_DRV_4_8, 233 65, UNIPHIER_PIN_DRV_4_8,
234 65, UNIPHIER_PIN_PULL_DOWN), 234 65, UNIPHIER_PIN_PULL_DOWN),
235 UNIPHIER_PINCTRL_PIN(70, "HSDOUT0", UNIPHIER_PIN_IECTRL_NONE, 235 UNIPHIER_PINCTRL_PIN(70, "HSDOUT0", 0,
236 66, UNIPHIER_PIN_DRV_4_8, 236 66, UNIPHIER_PIN_DRV_4_8,
237 66, UNIPHIER_PIN_PULL_DOWN), 237 66, UNIPHIER_PIN_PULL_DOWN),
238 UNIPHIER_PINCTRL_PIN(71, "HSDOUT1", UNIPHIER_PIN_IECTRL_NONE, 238 UNIPHIER_PINCTRL_PIN(71, "HSDOUT1", 0,
239 67, UNIPHIER_PIN_DRV_4_8, 239 67, UNIPHIER_PIN_DRV_4_8,
240 67, UNIPHIER_PIN_PULL_DOWN), 240 67, UNIPHIER_PIN_PULL_DOWN),
241 UNIPHIER_PINCTRL_PIN(72, "HSDOUT2", UNIPHIER_PIN_IECTRL_NONE, 241 UNIPHIER_PINCTRL_PIN(72, "HSDOUT2", 0,
242 68, UNIPHIER_PIN_DRV_4_8, 242 68, UNIPHIER_PIN_DRV_4_8,
243 68, UNIPHIER_PIN_PULL_DOWN), 243 68, UNIPHIER_PIN_PULL_DOWN),
244 UNIPHIER_PINCTRL_PIN(73, "HSDOUT3", UNIPHIER_PIN_IECTRL_NONE, 244 UNIPHIER_PINCTRL_PIN(73, "HSDOUT3", 0,
245 69, UNIPHIER_PIN_DRV_4_8, 245 69, UNIPHIER_PIN_DRV_4_8,
246 69, UNIPHIER_PIN_PULL_DOWN), 246 69, UNIPHIER_PIN_PULL_DOWN),
247 UNIPHIER_PINCTRL_PIN(74, "HSDOUT4", UNIPHIER_PIN_IECTRL_NONE, 247 UNIPHIER_PINCTRL_PIN(74, "HSDOUT4", 0,
248 70, UNIPHIER_PIN_DRV_4_8, 248 70, UNIPHIER_PIN_DRV_4_8,
249 70, UNIPHIER_PIN_PULL_DOWN), 249 70, UNIPHIER_PIN_PULL_DOWN),
250 UNIPHIER_PINCTRL_PIN(75, "HSDOUT5", UNIPHIER_PIN_IECTRL_NONE, 250 UNIPHIER_PINCTRL_PIN(75, "HSDOUT5", 0,
251 71, UNIPHIER_PIN_DRV_4_8, 251 71, UNIPHIER_PIN_DRV_4_8,
252 71, UNIPHIER_PIN_PULL_DOWN), 252 71, UNIPHIER_PIN_PULL_DOWN),
253 UNIPHIER_PINCTRL_PIN(76, "HSDOUT6", UNIPHIER_PIN_IECTRL_NONE, 253 UNIPHIER_PINCTRL_PIN(76, "HSDOUT6", 0,
254 72, UNIPHIER_PIN_DRV_4_8, 254 72, UNIPHIER_PIN_DRV_4_8,
255 72, UNIPHIER_PIN_PULL_DOWN), 255 72, UNIPHIER_PIN_PULL_DOWN),
256 UNIPHIER_PINCTRL_PIN(77, "HSDOUT7", UNIPHIER_PIN_IECTRL_NONE, 256 UNIPHIER_PINCTRL_PIN(77, "HSDOUT7", 0,
257 73, UNIPHIER_PIN_DRV_4_8, 257 73, UNIPHIER_PIN_DRV_4_8,
258 73, UNIPHIER_PIN_PULL_DOWN), 258 73, UNIPHIER_PIN_PULL_DOWN),
259 UNIPHIER_PINCTRL_PIN(78, "HSBCLKOUT", UNIPHIER_PIN_IECTRL_NONE, 259 UNIPHIER_PINCTRL_PIN(78, "HSBCLKOUT", 0,
260 74, UNIPHIER_PIN_DRV_4_8, 260 74, UNIPHIER_PIN_DRV_4_8,
261 74, UNIPHIER_PIN_PULL_DOWN), 261 74, UNIPHIER_PIN_PULL_DOWN),
262 UNIPHIER_PINCTRL_PIN(79, "HSVALOUT", UNIPHIER_PIN_IECTRL_NONE, 262 UNIPHIER_PINCTRL_PIN(79, "HSVALOUT", 0,
263 75, UNIPHIER_PIN_DRV_4_8, 263 75, UNIPHIER_PIN_DRV_4_8,
264 75, UNIPHIER_PIN_PULL_DOWN), 264 75, UNIPHIER_PIN_PULL_DOWN),
265 UNIPHIER_PINCTRL_PIN(80, "HSSYNCOUT", UNIPHIER_PIN_IECTRL_NONE, 265 UNIPHIER_PINCTRL_PIN(80, "HSSYNCOUT", 0,
266 76, UNIPHIER_PIN_DRV_4_8, 266 76, UNIPHIER_PIN_DRV_4_8,
267 76, UNIPHIER_PIN_PULL_DOWN), 267 76, UNIPHIER_PIN_PULL_DOWN),
268 UNIPHIER_PINCTRL_PIN(81, "HS1DIN0", UNIPHIER_PIN_IECTRL_NONE, 268 UNIPHIER_PINCTRL_PIN(81, "HS1DIN0", 0,
269 77, UNIPHIER_PIN_DRV_4_8, 269 77, UNIPHIER_PIN_DRV_4_8,
270 77, UNIPHIER_PIN_PULL_DOWN), 270 77, UNIPHIER_PIN_PULL_DOWN),
271 UNIPHIER_PINCTRL_PIN(82, "HS1DIN1", UNIPHIER_PIN_IECTRL_NONE, 271 UNIPHIER_PINCTRL_PIN(82, "HS1DIN1", 0,
272 78, UNIPHIER_PIN_DRV_4_8, 272 78, UNIPHIER_PIN_DRV_4_8,
273 78, UNIPHIER_PIN_PULL_DOWN), 273 78, UNIPHIER_PIN_PULL_DOWN),
274 UNIPHIER_PINCTRL_PIN(83, "HS1DIN2", UNIPHIER_PIN_IECTRL_NONE, 274 UNIPHIER_PINCTRL_PIN(83, "HS1DIN2", 0,
275 79, UNIPHIER_PIN_DRV_4_8, 275 79, UNIPHIER_PIN_DRV_4_8,
276 79, UNIPHIER_PIN_PULL_DOWN), 276 79, UNIPHIER_PIN_PULL_DOWN),
277 UNIPHIER_PINCTRL_PIN(84, "HS1DIN3", UNIPHIER_PIN_IECTRL_NONE, 277 UNIPHIER_PINCTRL_PIN(84, "HS1DIN3", 0,
278 80, UNIPHIER_PIN_DRV_4_8, 278 80, UNIPHIER_PIN_DRV_4_8,
279 80, UNIPHIER_PIN_PULL_DOWN), 279 80, UNIPHIER_PIN_PULL_DOWN),
280 UNIPHIER_PINCTRL_PIN(85, "HS1DIN4", UNIPHIER_PIN_IECTRL_NONE, 280 UNIPHIER_PINCTRL_PIN(85, "HS1DIN4", 0,
281 81, UNIPHIER_PIN_DRV_4_8, 281 81, UNIPHIER_PIN_DRV_4_8,
282 81, UNIPHIER_PIN_PULL_DOWN), 282 81, UNIPHIER_PIN_PULL_DOWN),
283 UNIPHIER_PINCTRL_PIN(86, "HS1DIN5", UNIPHIER_PIN_IECTRL_NONE, 283 UNIPHIER_PINCTRL_PIN(86, "HS1DIN5", 0,
284 82, UNIPHIER_PIN_DRV_4_8, 284 82, UNIPHIER_PIN_DRV_4_8,
285 82, UNIPHIER_PIN_PULL_DOWN), 285 82, UNIPHIER_PIN_PULL_DOWN),
286 UNIPHIER_PINCTRL_PIN(87, "HS1DIN6", UNIPHIER_PIN_IECTRL_NONE, 286 UNIPHIER_PINCTRL_PIN(87, "HS1DIN6", 0,
287 83, UNIPHIER_PIN_DRV_4_8, 287 83, UNIPHIER_PIN_DRV_4_8,
288 83, UNIPHIER_PIN_PULL_DOWN), 288 83, UNIPHIER_PIN_PULL_DOWN),
289 UNIPHIER_PINCTRL_PIN(88, "HS1DIN7", UNIPHIER_PIN_IECTRL_NONE, 289 UNIPHIER_PINCTRL_PIN(88, "HS1DIN7", 0,
290 84, UNIPHIER_PIN_DRV_4_8, 290 84, UNIPHIER_PIN_DRV_4_8,
291 84, UNIPHIER_PIN_PULL_DOWN), 291 84, UNIPHIER_PIN_PULL_DOWN),
292 UNIPHIER_PINCTRL_PIN(89, "HS1BCLKIN", UNIPHIER_PIN_IECTRL_NONE, 292 UNIPHIER_PINCTRL_PIN(89, "HS1BCLKIN", 0,
293 85, UNIPHIER_PIN_DRV_4_8, 293 85, UNIPHIER_PIN_DRV_4_8,
294 85, UNIPHIER_PIN_PULL_DOWN), 294 85, UNIPHIER_PIN_PULL_DOWN),
295 UNIPHIER_PINCTRL_PIN(90, "HS1VALIN", UNIPHIER_PIN_IECTRL_NONE, 295 UNIPHIER_PINCTRL_PIN(90, "HS1VALIN", 0,
296 86, UNIPHIER_PIN_DRV_4_8, 296 86, UNIPHIER_PIN_DRV_4_8,
297 86, UNIPHIER_PIN_PULL_DOWN), 297 86, UNIPHIER_PIN_PULL_DOWN),
298 UNIPHIER_PINCTRL_PIN(91, "HS1SYNCIN", UNIPHIER_PIN_IECTRL_NONE, 298 UNIPHIER_PINCTRL_PIN(91, "HS1SYNCIN", 0,
299 87, UNIPHIER_PIN_DRV_4_8, 299 87, UNIPHIER_PIN_DRV_4_8,
300 87, UNIPHIER_PIN_PULL_DOWN), 300 87, UNIPHIER_PIN_PULL_DOWN),
301 UNIPHIER_PINCTRL_PIN(92, "AGCI", UNIPHIER_PIN_IECTRL_NONE, 301 UNIPHIER_PINCTRL_PIN(92, "AGCI", 3,
302 -1, UNIPHIER_PIN_DRV_FIXED_4, 302 -1, UNIPHIER_PIN_DRV_FIXED_4,
303 132, UNIPHIER_PIN_PULL_DOWN), 303 132, UNIPHIER_PIN_PULL_DOWN),
304 UNIPHIER_PINCTRL_PIN(93, "AGCR", UNIPHIER_PIN_IECTRL_NONE, 304 UNIPHIER_PINCTRL_PIN(93, "AGCR", 4,
305 -1, UNIPHIER_PIN_DRV_FIXED_4, 305 -1, UNIPHIER_PIN_DRV_FIXED_4,
306 133, UNIPHIER_PIN_PULL_DOWN), 306 133, UNIPHIER_PIN_PULL_DOWN),
307 UNIPHIER_PINCTRL_PIN(94, "AGCBS", UNIPHIER_PIN_IECTRL_NONE, 307 UNIPHIER_PINCTRL_PIN(94, "AGCBS", 5,
308 -1, UNIPHIER_PIN_DRV_FIXED_4, 308 -1, UNIPHIER_PIN_DRV_FIXED_4,
309 134, UNIPHIER_PIN_PULL_DOWN), 309 134, UNIPHIER_PIN_PULL_DOWN),
310 UNIPHIER_PINCTRL_PIN(95, "IECOUT", UNIPHIER_PIN_IECTRL_NONE, 310 UNIPHIER_PINCTRL_PIN(95, "IECOUT", 0,
311 88, UNIPHIER_PIN_DRV_4_8, 311 88, UNIPHIER_PIN_DRV_4_8,
312 88, UNIPHIER_PIN_PULL_DOWN), 312 88, UNIPHIER_PIN_PULL_DOWN),
313 UNIPHIER_PINCTRL_PIN(96, "ASMCK", UNIPHIER_PIN_IECTRL_NONE, 313 UNIPHIER_PINCTRL_PIN(96, "ASMCK", 0,
314 89, UNIPHIER_PIN_DRV_4_8, 314 89, UNIPHIER_PIN_DRV_4_8,
315 89, UNIPHIER_PIN_PULL_DOWN), 315 89, UNIPHIER_PIN_PULL_DOWN),
316 UNIPHIER_PINCTRL_PIN(97, "ABCKO", UNIPHIER_PIN_IECTRL_NONE, 316 UNIPHIER_PINCTRL_PIN(97, "ABCKO", UNIPHIER_PIN_IECTRL_NONE,
@@ -325,31 +325,31 @@ static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
325 UNIPHIER_PINCTRL_PIN(100, "ASDOUT1", UNIPHIER_PIN_IECTRL_NONE, 325 UNIPHIER_PINCTRL_PIN(100, "ASDOUT1", UNIPHIER_PIN_IECTRL_NONE,
326 93, UNIPHIER_PIN_DRV_4_8, 326 93, UNIPHIER_PIN_DRV_4_8,
327 93, UNIPHIER_PIN_PULL_UP), 327 93, UNIPHIER_PIN_PULL_UP),
328 UNIPHIER_PINCTRL_PIN(101, "ARCOUT", UNIPHIER_PIN_IECTRL_NONE, 328 UNIPHIER_PINCTRL_PIN(101, "ARCOUT", 0,
329 94, UNIPHIER_PIN_DRV_4_8, 329 94, UNIPHIER_PIN_DRV_4_8,
330 94, UNIPHIER_PIN_PULL_DOWN), 330 94, UNIPHIER_PIN_PULL_DOWN),
331 UNIPHIER_PINCTRL_PIN(102, "SDA0", UNIPHIER_PIN_IECTRL_NONE, 331 UNIPHIER_PINCTRL_PIN(102, "SDA0", 10,
332 -1, UNIPHIER_PIN_DRV_FIXED_4, 332 -1, UNIPHIER_PIN_DRV_FIXED_4,
333 -1, UNIPHIER_PIN_PULL_NONE), 333 -1, UNIPHIER_PIN_PULL_NONE),
334 UNIPHIER_PINCTRL_PIN(103, "SCL0", UNIPHIER_PIN_IECTRL_NONE, 334 UNIPHIER_PINCTRL_PIN(103, "SCL0", 10,
335 -1, UNIPHIER_PIN_DRV_FIXED_4, 335 -1, UNIPHIER_PIN_DRV_FIXED_4,
336 -1, UNIPHIER_PIN_PULL_NONE), 336 -1, UNIPHIER_PIN_PULL_NONE),
337 UNIPHIER_PINCTRL_PIN(104, "SDA1", UNIPHIER_PIN_IECTRL_NONE, 337 UNIPHIER_PINCTRL_PIN(104, "SDA1", 11,
338 -1, UNIPHIER_PIN_DRV_FIXED_4, 338 -1, UNIPHIER_PIN_DRV_FIXED_4,
339 -1, UNIPHIER_PIN_PULL_NONE), 339 -1, UNIPHIER_PIN_PULL_NONE),
340 UNIPHIER_PINCTRL_PIN(105, "SCL1", UNIPHIER_PIN_IECTRL_NONE, 340 UNIPHIER_PINCTRL_PIN(105, "SCL1", 11,
341 -1, UNIPHIER_PIN_DRV_FIXED_4, 341 -1, UNIPHIER_PIN_DRV_FIXED_4,
342 -1, UNIPHIER_PIN_PULL_NONE), 342 -1, UNIPHIER_PIN_PULL_NONE),
343 UNIPHIER_PINCTRL_PIN(106, "DMDSDA0", UNIPHIER_PIN_IECTRL_NONE, 343 UNIPHIER_PINCTRL_PIN(106, "DMDSDA0", 12,
344 -1, UNIPHIER_PIN_DRV_FIXED_4, 344 -1, UNIPHIER_PIN_DRV_FIXED_4,
345 -1, UNIPHIER_PIN_PULL_NONE), 345 -1, UNIPHIER_PIN_PULL_NONE),
346 UNIPHIER_PINCTRL_PIN(107, "DMDSCL0", UNIPHIER_PIN_IECTRL_NONE, 346 UNIPHIER_PINCTRL_PIN(107, "DMDSCL0", 12,
347 -1, UNIPHIER_PIN_DRV_FIXED_4, 347 -1, UNIPHIER_PIN_DRV_FIXED_4,
348 -1, UNIPHIER_PIN_PULL_NONE), 348 -1, UNIPHIER_PIN_PULL_NONE),
349 UNIPHIER_PINCTRL_PIN(108, "DMDSDA1", UNIPHIER_PIN_IECTRL_NONE, 349 UNIPHIER_PINCTRL_PIN(108, "DMDSDA1", 13,
350 -1, UNIPHIER_PIN_DRV_FIXED_4, 350 -1, UNIPHIER_PIN_DRV_FIXED_4,
351 -1, UNIPHIER_PIN_PULL_NONE), 351 -1, UNIPHIER_PIN_PULL_NONE),
352 UNIPHIER_PINCTRL_PIN(109, "DMDSCL1", UNIPHIER_PIN_IECTRL_NONE, 352 UNIPHIER_PINCTRL_PIN(109, "DMDSCL1", 13,
353 -1, UNIPHIER_PIN_DRV_FIXED_4, 353 -1, UNIPHIER_PIN_DRV_FIXED_4,
354 -1, UNIPHIER_PIN_PULL_NONE), 354 -1, UNIPHIER_PIN_PULL_NONE),
355 UNIPHIER_PINCTRL_PIN(110, "SBO0", UNIPHIER_PIN_IECTRL_NONE, 355 UNIPHIER_PINCTRL_PIN(110, "SBO0", UNIPHIER_PIN_IECTRL_NONE,
@@ -358,76 +358,76 @@ static const struct pinctrl_pin_desc ph1_sld8_pins[] = {
358 UNIPHIER_PINCTRL_PIN(111, "SBI0", UNIPHIER_PIN_IECTRL_NONE, 358 UNIPHIER_PINCTRL_PIN(111, "SBI0", UNIPHIER_PIN_IECTRL_NONE,
359 96, UNIPHIER_PIN_DRV_4_8, 359 96, UNIPHIER_PIN_DRV_4_8,
360 96, UNIPHIER_PIN_PULL_UP), 360 96, UNIPHIER_PIN_PULL_UP),
361 UNIPHIER_PINCTRL_PIN(112, "SBO1", UNIPHIER_PIN_IECTRL_NONE, 361 UNIPHIER_PINCTRL_PIN(112, "SBO1", 0,
362 97, UNIPHIER_PIN_DRV_4_8, 362 97, UNIPHIER_PIN_DRV_4_8,
363 97, UNIPHIER_PIN_PULL_UP), 363 97, UNIPHIER_PIN_PULL_UP),
364 UNIPHIER_PINCTRL_PIN(113, "SBI1", UNIPHIER_PIN_IECTRL_NONE, 364 UNIPHIER_PINCTRL_PIN(113, "SBI1", 0,
365 98, UNIPHIER_PIN_DRV_4_8, 365 98, UNIPHIER_PIN_DRV_4_8,
366 98, UNIPHIER_PIN_PULL_UP), 366 98, UNIPHIER_PIN_PULL_UP),
367 UNIPHIER_PINCTRL_PIN(114, "TXD1", UNIPHIER_PIN_IECTRL_NONE, 367 UNIPHIER_PINCTRL_PIN(114, "TXD1", 0,
368 99, UNIPHIER_PIN_DRV_4_8, 368 99, UNIPHIER_PIN_DRV_4_8,
369 99, UNIPHIER_PIN_PULL_UP), 369 99, UNIPHIER_PIN_PULL_UP),
370 UNIPHIER_PINCTRL_PIN(115, "RXD1", UNIPHIER_PIN_IECTRL_NONE, 370 UNIPHIER_PINCTRL_PIN(115, "RXD1", 0,
371 100, UNIPHIER_PIN_DRV_4_8, 371 100, UNIPHIER_PIN_DRV_4_8,
372 100, UNIPHIER_PIN_PULL_UP), 372 100, UNIPHIER_PIN_PULL_UP),
373 UNIPHIER_PINCTRL_PIN(116, "HIN", UNIPHIER_PIN_IECTRL_NONE, 373 UNIPHIER_PINCTRL_PIN(116, "HIN", 1,
374 -1, UNIPHIER_PIN_DRV_FIXED_5, 374 -1, UNIPHIER_PIN_DRV_FIXED_5,
375 -1, UNIPHIER_PIN_PULL_NONE), 375 -1, UNIPHIER_PIN_PULL_NONE),
376 UNIPHIER_PINCTRL_PIN(117, "VIN", UNIPHIER_PIN_IECTRL_NONE, 376 UNIPHIER_PINCTRL_PIN(117, "VIN", 2,
377 -1, UNIPHIER_PIN_DRV_FIXED_5, 377 -1, UNIPHIER_PIN_DRV_FIXED_5,
378 -1, UNIPHIER_PIN_PULL_NONE), 378 -1, UNIPHIER_PIN_PULL_NONE),
379 UNIPHIER_PINCTRL_PIN(118, "TCON0", UNIPHIER_PIN_IECTRL_NONE, 379 UNIPHIER_PINCTRL_PIN(118, "TCON0", 0,
380 101, UNIPHIER_PIN_DRV_4_8, 380 101, UNIPHIER_PIN_DRV_4_8,
381 101, UNIPHIER_PIN_PULL_DOWN), 381 101, UNIPHIER_PIN_PULL_DOWN),
382 UNIPHIER_PINCTRL_PIN(119, "TCON1", UNIPHIER_PIN_IECTRL_NONE, 382 UNIPHIER_PINCTRL_PIN(119, "TCON1", 0,
383 102, UNIPHIER_PIN_DRV_4_8, 383 102, UNIPHIER_PIN_DRV_4_8,
384 102, UNIPHIER_PIN_PULL_DOWN), 384 102, UNIPHIER_PIN_PULL_DOWN),
385 UNIPHIER_PINCTRL_PIN(120, "TCON2", UNIPHIER_PIN_IECTRL_NONE, 385 UNIPHIER_PINCTRL_PIN(120, "TCON2", 0,
386 103, UNIPHIER_PIN_DRV_4_8, 386 103, UNIPHIER_PIN_DRV_4_8,
387 103, UNIPHIER_PIN_PULL_DOWN), 387 103, UNIPHIER_PIN_PULL_DOWN),
388 UNIPHIER_PINCTRL_PIN(121, "TCON3", UNIPHIER_PIN_IECTRL_NONE, 388 UNIPHIER_PINCTRL_PIN(121, "TCON3", 0,
389 104, UNIPHIER_PIN_DRV_4_8, 389 104, UNIPHIER_PIN_DRV_4_8,
390 104, UNIPHIER_PIN_PULL_DOWN), 390 104, UNIPHIER_PIN_PULL_DOWN),
391 UNIPHIER_PINCTRL_PIN(122, "TCON4", UNIPHIER_PIN_IECTRL_NONE, 391 UNIPHIER_PINCTRL_PIN(122, "TCON4", 0,
392 105, UNIPHIER_PIN_DRV_4_8, 392 105, UNIPHIER_PIN_DRV_4_8,
393 105, UNIPHIER_PIN_PULL_DOWN), 393 105, UNIPHIER_PIN_PULL_DOWN),
394 UNIPHIER_PINCTRL_PIN(123, "TCON5", UNIPHIER_PIN_IECTRL_NONE, 394 UNIPHIER_PINCTRL_PIN(123, "TCON5", 0,
395 106, UNIPHIER_PIN_DRV_4_8, 395 106, UNIPHIER_PIN_DRV_4_8,
396 106, UNIPHIER_PIN_PULL_DOWN), 396 106, UNIPHIER_PIN_PULL_DOWN),
397 UNIPHIER_PINCTRL_PIN(124, "TCON6", UNIPHIER_PIN_IECTRL_NONE, 397 UNIPHIER_PINCTRL_PIN(124, "TCON6", 0,
398 107, UNIPHIER_PIN_DRV_4_8, 398 107, UNIPHIER_PIN_DRV_4_8,
399 107, UNIPHIER_PIN_PULL_DOWN), 399 107, UNIPHIER_PIN_PULL_DOWN),
400 UNIPHIER_PINCTRL_PIN(125, "TCON7", UNIPHIER_PIN_IECTRL_NONE, 400 UNIPHIER_PINCTRL_PIN(125, "TCON7", 0,
401 108, UNIPHIER_PIN_DRV_4_8, 401 108, UNIPHIER_PIN_DRV_4_8,
402 108, UNIPHIER_PIN_PULL_DOWN), 402 108, UNIPHIER_PIN_PULL_DOWN),
403 UNIPHIER_PINCTRL_PIN(126, "TCON8", UNIPHIER_PIN_IECTRL_NONE, 403 UNIPHIER_PINCTRL_PIN(126, "TCON8", 0,
404 109, UNIPHIER_PIN_DRV_4_8, 404 109, UNIPHIER_PIN_DRV_4_8,
405 109, UNIPHIER_PIN_PULL_DOWN), 405 109, UNIPHIER_PIN_PULL_DOWN),
406 UNIPHIER_PINCTRL_PIN(127, "PWMA", UNIPHIER_PIN_IECTRL_NONE, 406 UNIPHIER_PINCTRL_PIN(127, "PWMA", 0,
407 110, UNIPHIER_PIN_DRV_4_8, 407 110, UNIPHIER_PIN_DRV_4_8,
408 110, UNIPHIER_PIN_PULL_DOWN), 408 110, UNIPHIER_PIN_PULL_DOWN),
409 UNIPHIER_PINCTRL_PIN(128, "XIRQ0", UNIPHIER_PIN_IECTRL_NONE, 409 UNIPHIER_PINCTRL_PIN(128, "XIRQ0", 0,
410 111, UNIPHIER_PIN_DRV_4_8, 410 111, UNIPHIER_PIN_DRV_4_8,
411 111, UNIPHIER_PIN_PULL_DOWN), 411 111, UNIPHIER_PIN_PULL_DOWN),
412 UNIPHIER_PINCTRL_PIN(129, "XIRQ1", UNIPHIER_PIN_IECTRL_NONE, 412 UNIPHIER_PINCTRL_PIN(129, "XIRQ1", 0,
413 112, UNIPHIER_PIN_DRV_4_8, 413 112, UNIPHIER_PIN_DRV_4_8,
414 112, UNIPHIER_PIN_PULL_DOWN), 414 112, UNIPHIER_PIN_PULL_DOWN),
415 UNIPHIER_PINCTRL_PIN(130, "XIRQ2", UNIPHIER_PIN_IECTRL_NONE, 415 UNIPHIER_PINCTRL_PIN(130, "XIRQ2", 0,
416 113, UNIPHIER_PIN_DRV_4_8, 416 113, UNIPHIER_PIN_DRV_4_8,
417 113, UNIPHIER_PIN_PULL_DOWN), 417 113, UNIPHIER_PIN_PULL_DOWN),
418 UNIPHIER_PINCTRL_PIN(131, "XIRQ3", UNIPHIER_PIN_IECTRL_NONE, 418 UNIPHIER_PINCTRL_PIN(131, "XIRQ3", 0,
419 114, UNIPHIER_PIN_DRV_4_8, 419 114, UNIPHIER_PIN_DRV_4_8,
420 114, UNIPHIER_PIN_PULL_DOWN), 420 114, UNIPHIER_PIN_PULL_DOWN),
421 UNIPHIER_PINCTRL_PIN(132, "XIRQ4", UNIPHIER_PIN_IECTRL_NONE, 421 UNIPHIER_PINCTRL_PIN(132, "XIRQ4", 0,
422 115, UNIPHIER_PIN_DRV_4_8, 422 115, UNIPHIER_PIN_DRV_4_8,
423 115, UNIPHIER_PIN_PULL_DOWN), 423 115, UNIPHIER_PIN_PULL_DOWN),
424 UNIPHIER_PINCTRL_PIN(133, "XIRQ5", UNIPHIER_PIN_IECTRL_NONE, 424 UNIPHIER_PINCTRL_PIN(133, "XIRQ5", 0,
425 116, UNIPHIER_PIN_DRV_4_8, 425 116, UNIPHIER_PIN_DRV_4_8,
426 116, UNIPHIER_PIN_PULL_DOWN), 426 116, UNIPHIER_PIN_PULL_DOWN),
427 UNIPHIER_PINCTRL_PIN(134, "XIRQ6", UNIPHIER_PIN_IECTRL_NONE, 427 UNIPHIER_PINCTRL_PIN(134, "XIRQ6", 0,
428 117, UNIPHIER_PIN_DRV_4_8, 428 117, UNIPHIER_PIN_DRV_4_8,
429 117, UNIPHIER_PIN_PULL_DOWN), 429 117, UNIPHIER_PIN_PULL_DOWN),
430 UNIPHIER_PINCTRL_PIN(135, "XIRQ7", UNIPHIER_PIN_IECTRL_NONE, 430 UNIPHIER_PINCTRL_PIN(135, "XIRQ7", 0,
431 118, UNIPHIER_PIN_DRV_4_8, 431 118, UNIPHIER_PIN_DRV_4_8,
432 118, UNIPHIER_PIN_PULL_DOWN), 432 118, UNIPHIER_PIN_PULL_DOWN),
433}; 433};
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 01bf3476a791..a9567af7cec0 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -192,9 +192,9 @@ static const struct regulator_desc axp22x_regulators[] = {
192 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20, 192 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
193 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 193 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
194 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20, 194 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
195 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 195 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
196 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, 196 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
197 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(4)), 197 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
198 /* secondary switchable output of DCDC1 */ 198 /* secondary switchable output of DCDC1 */
199 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100, 199 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100,
200 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)), 200 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7849187d91ae..8a34f6acc801 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1403,6 +1403,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
1403 return 0; 1403 return 0;
1404 } 1404 }
1405 1405
1406 /* Did the lookup explicitly defer for us? */
1407 if (ret == -EPROBE_DEFER)
1408 return ret;
1409
1406 if (have_full_constraints()) { 1410 if (have_full_constraints()) {
1407 r = dummy_regulator_rdev; 1411 r = dummy_regulator_rdev;
1408 } else { 1412 } else {
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index add419d6ff34..a56a7b243e91 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -212,6 +212,17 @@ static const struct file_operations twa_fops = {
212 .llseek = noop_llseek, 212 .llseek = noop_llseek,
213}; 213};
214 214
215/*
216 * The controllers use an inline buffer instead of a mapped SGL for small,
217 * single entry buffers. Note that we treat a zero-length transfer like
218 * a mapped SGL.
219 */
220static bool twa_command_mapped(struct scsi_cmnd *cmd)
221{
222 return scsi_sg_count(cmd) != 1 ||
223 scsi_bufflen(cmd) >= TW_MIN_SGL_LENGTH;
224}
225
215/* This function will complete an aen request from the isr */ 226/* This function will complete an aen request from the isr */
216static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) 227static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)
217{ 228{
@@ -1339,7 +1350,8 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1339 } 1350 }
1340 1351
1341 /* Now complete the io */ 1352 /* Now complete the io */
1342 scsi_dma_unmap(cmd); 1353 if (twa_command_mapped(cmd))
1354 scsi_dma_unmap(cmd);
1343 cmd->scsi_done(cmd); 1355 cmd->scsi_done(cmd);
1344 tw_dev->state[request_id] = TW_S_COMPLETED; 1356 tw_dev->state[request_id] = TW_S_COMPLETED;
1345 twa_free_request_id(tw_dev, request_id); 1357 twa_free_request_id(tw_dev, request_id);
@@ -1582,7 +1594,8 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
1582 struct scsi_cmnd *cmd = tw_dev->srb[i]; 1594 struct scsi_cmnd *cmd = tw_dev->srb[i];
1583 1595
1584 cmd->result = (DID_RESET << 16); 1596 cmd->result = (DID_RESET << 16);
1585 scsi_dma_unmap(cmd); 1597 if (twa_command_mapped(cmd))
1598 scsi_dma_unmap(cmd);
1586 cmd->scsi_done(cmd); 1599 cmd->scsi_done(cmd);
1587 } 1600 }
1588 } 1601 }
@@ -1765,12 +1778,14 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1765 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); 1778 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
1766 switch (retval) { 1779 switch (retval) {
1767 case SCSI_MLQUEUE_HOST_BUSY: 1780 case SCSI_MLQUEUE_HOST_BUSY:
1768 scsi_dma_unmap(SCpnt); 1781 if (twa_command_mapped(SCpnt))
1782 scsi_dma_unmap(SCpnt);
1769 twa_free_request_id(tw_dev, request_id); 1783 twa_free_request_id(tw_dev, request_id);
1770 break; 1784 break;
1771 case 1: 1785 case 1:
1772 SCpnt->result = (DID_ERROR << 16); 1786 SCpnt->result = (DID_ERROR << 16);
1773 scsi_dma_unmap(SCpnt); 1787 if (twa_command_mapped(SCpnt))
1788 scsi_dma_unmap(SCpnt);
1774 done(SCpnt); 1789 done(SCpnt);
1775 tw_dev->state[request_id] = TW_S_COMPLETED; 1790 tw_dev->state[request_id] = TW_S_COMPLETED;
1776 twa_free_request_id(tw_dev, request_id); 1791 twa_free_request_id(tw_dev, request_id);
@@ -1831,8 +1846,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
1831 /* Map sglist from scsi layer to cmd packet */ 1846 /* Map sglist from scsi layer to cmd packet */
1832 1847
1833 if (scsi_sg_count(srb)) { 1848 if (scsi_sg_count(srb)) {
1834 if ((scsi_sg_count(srb) == 1) && 1849 if (!twa_command_mapped(srb)) {
1835 (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) {
1836 if (srb->sc_data_direction == DMA_TO_DEVICE || 1850 if (srb->sc_data_direction == DMA_TO_DEVICE ||
1837 srb->sc_data_direction == DMA_BIDIRECTIONAL) 1851 srb->sc_data_direction == DMA_BIDIRECTIONAL)
1838 scsi_sg_copy_to_buffer(srb, 1852 scsi_sg_copy_to_buffer(srb,
@@ -1905,7 +1919,7 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re
1905{ 1919{
1906 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; 1920 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1907 1921
1908 if (scsi_bufflen(cmd) < TW_MIN_SGL_LENGTH && 1922 if (!twa_command_mapped(cmd) &&
1909 (cmd->sc_data_direction == DMA_FROM_DEVICE || 1923 (cmd->sc_data_direction == DMA_FROM_DEVICE ||
1910 cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { 1924 cmd->sc_data_direction == DMA_BIDIRECTIONAL)) {
1911 if (scsi_sg_count(cmd) == 1) { 1925 if (scsi_sg_count(cmd) == 1) {
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 33c74d3436c9..6bffd91b973a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -976,13 +976,13 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
976 wake_up(&conn->ehwait); 976 wake_up(&conn->ehwait);
977} 977}
978 978
979static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) 979static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
980{ 980{
981 struct iscsi_nopout hdr; 981 struct iscsi_nopout hdr;
982 struct iscsi_task *task; 982 struct iscsi_task *task;
983 983
984 if (!rhdr && conn->ping_task) 984 if (!rhdr && conn->ping_task)
985 return; 985 return -EINVAL;
986 986
987 memset(&hdr, 0, sizeof(struct iscsi_nopout)); 987 memset(&hdr, 0, sizeof(struct iscsi_nopout));
988 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; 988 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
@@ -996,13 +996,16 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
996 hdr.ttt = RESERVED_ITT; 996 hdr.ttt = RESERVED_ITT;
997 997
998 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); 998 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0);
999 if (!task) 999 if (!task) {
1000 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); 1000 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n");
1001 else if (!rhdr) { 1001 return -EIO;
1002 } else if (!rhdr) {
1002 /* only track our nops */ 1003 /* only track our nops */
1003 conn->ping_task = task; 1004 conn->ping_task = task;
1004 conn->last_ping = jiffies; 1005 conn->last_ping = jiffies;
1005 } 1006 }
1007
1008 return 0;
1006} 1009}
1007 1010
1008static int iscsi_nop_out_rsp(struct iscsi_task *task, 1011static int iscsi_nop_out_rsp(struct iscsi_task *task,
@@ -2092,8 +2095,10 @@ static void iscsi_check_transport_timeouts(unsigned long data)
2092 if (time_before_eq(last_recv + recv_timeout, jiffies)) { 2095 if (time_before_eq(last_recv + recv_timeout, jiffies)) {
2093 /* send a ping to try to provoke some traffic */ 2096 /* send a ping to try to provoke some traffic */
2094 ISCSI_DBG_CONN(conn, "Sending nopout as ping\n"); 2097 ISCSI_DBG_CONN(conn, "Sending nopout as ping\n");
2095 iscsi_send_nopout(conn, NULL); 2098 if (iscsi_send_nopout(conn, NULL))
2096 next_timeout = conn->last_ping + (conn->ping_timeout * HZ); 2099 next_timeout = jiffies + (1 * HZ);
2100 else
2101 next_timeout = conn->last_ping + (conn->ping_timeout * HZ);
2097 } else 2102 } else
2098 next_timeout = last_recv + recv_timeout; 2103 next_timeout = last_recv + recv_timeout;
2099 2104
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index edb044a7b56d..0a2168e69bbc 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -111,7 +111,7 @@ static struct scsi_device_handler *scsi_dh_lookup(const char *name)
111 111
112 dh = __scsi_dh_lookup(name); 112 dh = __scsi_dh_lookup(name);
113 if (!dh) { 113 if (!dh) {
114 request_module(name); 114 request_module("scsi_dh_%s", name);
115 dh = __scsi_dh_lookup(name); 115 dh = __scsi_dh_lookup(name);
116 } 116 }
117 117
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index cbfc5990052b..126a48c6431e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1957,7 +1957,7 @@ static int scsi_mq_prep_fn(struct request *req)
1957static void scsi_mq_done(struct scsi_cmnd *cmd) 1957static void scsi_mq_done(struct scsi_cmnd *cmd)
1958{ 1958{
1959 trace_scsi_dispatch_cmd_done(cmd); 1959 trace_scsi_dispatch_cmd_done(cmd);
1960 blk_mq_complete_request(cmd->request); 1960 blk_mq_complete_request(cmd->request, cmd->request->errors);
1961} 1961}
1962 1962
1963static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, 1963static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 3cf9faa6cc3f..a85d863d4a44 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -992,11 +992,12 @@ static int davinci_spi_probe(struct platform_device *pdev)
992 goto free_master; 992 goto free_master;
993 } 993 }
994 994
995 dspi->irq = platform_get_irq(pdev, 0); 995 ret = platform_get_irq(pdev, 0);
996 if (dspi->irq <= 0) { 996 if (ret == 0)
997 ret = -EINVAL; 997 ret = -EINVAL;
998 if (ret < 0)
998 goto free_master; 999 goto free_master;
999 } 1000 dspi->irq = ret;
1000 1001
1001 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq, 1002 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq,
1002 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi); 1003 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 769b61193d87..a9bc6e23fc25 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -224,7 +224,7 @@ static int ll_dir_filler(void *_hash, struct page *page0)
224 224
225 prefetchw(&page->flags); 225 prefetchw(&page->flags);
226 ret = add_to_page_cache_lru(page, inode->i_mapping, offset, 226 ret = add_to_page_cache_lru(page, inode->i_mapping, offset,
227 GFP_KERNEL); 227 GFP_NOFS);
228 if (ret == 0) { 228 if (ret == 0) {
229 unlock_page(page); 229 unlock_page(page);
230 } else { 230 } else {
diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c
index 4299cf45f947..5e1f16c36b49 100644
--- a/drivers/staging/speakup/fakekey.c
+++ b/drivers/staging/speakup/fakekey.c
@@ -81,6 +81,7 @@ void speakup_fake_down_arrow(void)
81 __this_cpu_write(reporting_keystroke, true); 81 __this_cpu_write(reporting_keystroke, true);
82 input_report_key(virt_keyboard, KEY_DOWN, PRESSED); 82 input_report_key(virt_keyboard, KEY_DOWN, PRESSED);
83 input_report_key(virt_keyboard, KEY_DOWN, RELEASED); 83 input_report_key(virt_keyboard, KEY_DOWN, RELEASED);
84 input_sync(virt_keyboard);
84 __this_cpu_write(reporting_keystroke, false); 85 __this_cpu_write(reporting_keystroke, false);
85 86
86 /* reenable preemption */ 87 /* reenable preemption */
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 20932cc9c8f7..b09023b07169 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -343,8 +343,7 @@ static void n_tty_packet_mode_flush(struct tty_struct *tty)
343 spin_lock_irqsave(&tty->ctrl_lock, flags); 343 spin_lock_irqsave(&tty->ctrl_lock, flags);
344 tty->ctrl_status |= TIOCPKT_FLUSHREAD; 344 tty->ctrl_status |= TIOCPKT_FLUSHREAD;
345 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 345 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
346 if (waitqueue_active(&tty->link->read_wait)) 346 wake_up_interruptible(&tty->link->read_wait);
347 wake_up_interruptible(&tty->link->read_wait);
348 } 347 }
349} 348}
350 349
@@ -1382,8 +1381,7 @@ handle_newline:
1382 put_tty_queue(c, ldata); 1381 put_tty_queue(c, ldata);
1383 smp_store_release(&ldata->canon_head, ldata->read_head); 1382 smp_store_release(&ldata->canon_head, ldata->read_head);
1384 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1383 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1385 if (waitqueue_active(&tty->read_wait)) 1384 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1386 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1387 return 0; 1385 return 0;
1388 } 1386 }
1389 } 1387 }
@@ -1667,8 +1665,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
1667 1665
1668 if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) { 1666 if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) {
1669 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1667 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1670 if (waitqueue_active(&tty->read_wait)) 1668 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1671 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1672 } 1669 }
1673} 1670}
1674 1671
@@ -1887,10 +1884,8 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1887 } 1884 }
1888 1885
1889 /* The termios change make the tty ready for I/O */ 1886 /* The termios change make the tty ready for I/O */
1890 if (waitqueue_active(&tty->write_wait)) 1887 wake_up_interruptible(&tty->write_wait);
1891 wake_up_interruptible(&tty->write_wait); 1888 wake_up_interruptible(&tty->read_wait);
1892 if (waitqueue_active(&tty->read_wait))
1893 wake_up_interruptible(&tty->read_wait);
1894} 1889}
1895 1890
1896/** 1891/**
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index b1e0ba3e525b..0bbf34035d6a 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -261,6 +261,14 @@ configured less than Maximum supported fifo bytes */
261 UART_FCR7_64BYTE, 261 UART_FCR7_64BYTE,
262 .flags = UART_CAP_FIFO, 262 .flags = UART_CAP_FIFO,
263 }, 263 },
264 [PORT_RT2880] = {
265 .name = "Palmchip BK-3103",
266 .fifo_size = 16,
267 .tx_loadsz = 16,
268 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
269 .rxtrig_bytes = {1, 4, 8, 14},
270 .flags = UART_CAP_FIFO,
271 },
264}; 272};
265 273
266/* Uart divisor latch read */ 274/* Uart divisor latch read */
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 5ca5cf3e9359..538ea03bc101 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2786,7 +2786,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
2786 ret = atmel_init_gpios(port, &pdev->dev); 2786 ret = atmel_init_gpios(port, &pdev->dev);
2787 if (ret < 0) { 2787 if (ret < 0) {
2788 dev_err(&pdev->dev, "Failed to initialize GPIOs."); 2788 dev_err(&pdev->dev, "Failed to initialize GPIOs.");
2789 goto err; 2789 goto err_clear_bit;
2790 } 2790 }
2791 2791
2792 ret = atmel_init_port(port, pdev); 2792 ret = atmel_init_port(port, pdev);
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index fe3d41cc8416..d0388a071ba1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1631,12 +1631,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1631 int locked = 1; 1631 int locked = 1;
1632 int retval; 1632 int retval;
1633 1633
1634 retval = clk_prepare_enable(sport->clk_per); 1634 retval = clk_enable(sport->clk_per);
1635 if (retval) 1635 if (retval)
1636 return; 1636 return;
1637 retval = clk_prepare_enable(sport->clk_ipg); 1637 retval = clk_enable(sport->clk_ipg);
1638 if (retval) { 1638 if (retval) {
1639 clk_disable_unprepare(sport->clk_per); 1639 clk_disable(sport->clk_per);
1640 return; 1640 return;
1641 } 1641 }
1642 1642
@@ -1675,8 +1675,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1675 if (locked) 1675 if (locked)
1676 spin_unlock_irqrestore(&sport->port.lock, flags); 1676 spin_unlock_irqrestore(&sport->port.lock, flags);
1677 1677
1678 clk_disable_unprepare(sport->clk_ipg); 1678 clk_disable(sport->clk_ipg);
1679 clk_disable_unprepare(sport->clk_per); 1679 clk_disable(sport->clk_per);
1680} 1680}
1681 1681
1682/* 1682/*
@@ -1777,7 +1777,15 @@ imx_console_setup(struct console *co, char *options)
1777 1777
1778 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); 1778 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow);
1779 1779
1780 clk_disable_unprepare(sport->clk_ipg); 1780 clk_disable(sport->clk_ipg);
1781 if (retval) {
1782 clk_unprepare(sport->clk_ipg);
1783 goto error_console;
1784 }
1785
1786 retval = clk_prepare(sport->clk_per);
1787 if (retval)
1788 clk_disable_unprepare(sport->clk_ipg);
1781 1789
1782error_console: 1790error_console:
1783 return retval; 1791 return retval;
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 5a3fa8913880..a660ab181cca 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -242,7 +242,10 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld)
242 atomic_inc(&buf->priority); 242 atomic_inc(&buf->priority);
243 243
244 mutex_lock(&buf->lock); 244 mutex_lock(&buf->lock);
245 while ((next = buf->head->next) != NULL) { 245 /* paired w/ release in __tty_buffer_request_room; ensures there are
246 * no pending memory accesses to the freed buffer
247 */
248 while ((next = smp_load_acquire(&buf->head->next)) != NULL) {
246 tty_buffer_free(port, buf->head); 249 tty_buffer_free(port, buf->head);
247 buf->head = next; 250 buf->head = next;
248 } 251 }
@@ -290,7 +293,10 @@ static int __tty_buffer_request_room(struct tty_port *port, size_t size,
290 if (n != NULL) { 293 if (n != NULL) {
291 n->flags = flags; 294 n->flags = flags;
292 buf->tail = n; 295 buf->tail = n;
293 b->commit = b->used; 296 /* paired w/ acquire in flush_to_ldisc(); ensures
297 * flush_to_ldisc() sees buffer data.
298 */
299 smp_store_release(&b->commit, b->used);
294 /* paired w/ acquire in flush_to_ldisc(); ensures the 300 /* paired w/ acquire in flush_to_ldisc(); ensures the
295 * latest commit value can be read before the head is 301 * latest commit value can be read before the head is
296 * advanced to the next buffer 302 * advanced to the next buffer
@@ -393,7 +399,10 @@ void tty_schedule_flip(struct tty_port *port)
393{ 399{
394 struct tty_bufhead *buf = &port->buf; 400 struct tty_bufhead *buf = &port->buf;
395 401
396 buf->tail->commit = buf->tail->used; 402 /* paired w/ acquire in flush_to_ldisc(); ensures
403 * flush_to_ldisc() sees buffer data.
404 */
405 smp_store_release(&buf->tail->commit, buf->tail->used);
397 schedule_work(&buf->work); 406 schedule_work(&buf->work);
398} 407}
399EXPORT_SYMBOL(tty_schedule_flip); 408EXPORT_SYMBOL(tty_schedule_flip);
@@ -467,7 +476,7 @@ static void flush_to_ldisc(struct work_struct *work)
467 struct tty_struct *tty; 476 struct tty_struct *tty;
468 struct tty_ldisc *disc; 477 struct tty_ldisc *disc;
469 478
470 tty = port->itty; 479 tty = READ_ONCE(port->itty);
471 if (tty == NULL) 480 if (tty == NULL)
472 return; 481 return;
473 482
@@ -491,7 +500,10 @@ static void flush_to_ldisc(struct work_struct *work)
491 * is advancing to the next buffer 500 * is advancing to the next buffer
492 */ 501 */
493 next = smp_load_acquire(&head->next); 502 next = smp_load_acquire(&head->next);
494 count = head->commit - head->read; 503 /* paired w/ release in __tty_buffer_request_room() or in
504 * tty_buffer_flush(); ensures we see the committed buffer data
505 */
506 count = smp_load_acquire(&head->commit) - head->read;
495 if (!count) { 507 if (!count) {
496 if (next == NULL) { 508 if (next == NULL) {
497 check_other_closed(tty); 509 check_other_closed(tty);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 02785d844354..2eefaa6e3e3a 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2128,8 +2128,24 @@ retry_open:
2128 if (!noctty && 2128 if (!noctty &&
2129 current->signal->leader && 2129 current->signal->leader &&
2130 !current->signal->tty && 2130 !current->signal->tty &&
2131 tty->session == NULL) 2131 tty->session == NULL) {
2132 __proc_set_tty(tty); 2132 /*
2133 * Don't let a process that only has write access to the tty
2134 * obtain the privileges associated with having a tty as
2135 * controlling terminal (being able to reopen it with full
2136 * access through /dev/tty, being able to perform pushback).
2137 * Many distributions set the group of all ttys to "tty" and
2138 * grant write-only access to all terminals for setgid tty
2139 * binaries, which should not imply full privileges on all ttys.
2140 *
2141 * This could theoretically break old code that performs open()
2142 * on a write-only file descriptor. In that case, it might be
2143 * necessary to also permit this if
2144 * inode_permission(inode, MAY_READ) == 0.
2145 */
2146 if (filp->f_mode & FMODE_READ)
2147 __proc_set_tty(tty);
2148 }
2133 spin_unlock_irq(&current->sighand->siglock); 2149 spin_unlock_irq(&current->sighand->siglock);
2134 read_unlock(&tasklist_lock); 2150 read_unlock(&tasklist_lock);
2135 tty_unlock(tty); 2151 tty_unlock(tty);
@@ -2418,7 +2434,7 @@ static int fionbio(struct file *file, int __user *p)
2418 * Takes ->siglock() when updating signal->tty 2434 * Takes ->siglock() when updating signal->tty
2419 */ 2435 */
2420 2436
2421static int tiocsctty(struct tty_struct *tty, int arg) 2437static int tiocsctty(struct tty_struct *tty, struct file *file, int arg)
2422{ 2438{
2423 int ret = 0; 2439 int ret = 0;
2424 2440
@@ -2452,6 +2468,13 @@ static int tiocsctty(struct tty_struct *tty, int arg)
2452 goto unlock; 2468 goto unlock;
2453 } 2469 }
2454 } 2470 }
2471
2472 /* See the comment in tty_open(). */
2473 if ((file->f_mode & FMODE_READ) == 0 && !capable(CAP_SYS_ADMIN)) {
2474 ret = -EPERM;
2475 goto unlock;
2476 }
2477
2455 proc_set_tty(tty); 2478 proc_set_tty(tty);
2456unlock: 2479unlock:
2457 read_unlock(&tasklist_lock); 2480 read_unlock(&tasklist_lock);
@@ -2844,7 +2867,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2844 no_tty(); 2867 no_tty();
2845 return 0; 2868 return 0;
2846 case TIOCSCTTY: 2869 case TIOCSCTTY:
2847 return tiocsctty(tty, arg); 2870 return tiocsctty(tty, file, arg);
2848 case TIOCGPGRP: 2871 case TIOCGPGRP:
2849 return tiocgpgrp(tty, real_tty, p); 2872 return tiocgpgrp(tty, real_tty, p);
2850 case TIOCSPGRP: 2873 case TIOCSPGRP:
@@ -3151,13 +3174,18 @@ struct class *tty_class;
3151static int tty_cdev_add(struct tty_driver *driver, dev_t dev, 3174static int tty_cdev_add(struct tty_driver *driver, dev_t dev,
3152 unsigned int index, unsigned int count) 3175 unsigned int index, unsigned int count)
3153{ 3176{
3177 int err;
3178
3154 /* init here, since reused cdevs cause crashes */ 3179 /* init here, since reused cdevs cause crashes */
3155 driver->cdevs[index] = cdev_alloc(); 3180 driver->cdevs[index] = cdev_alloc();
3156 if (!driver->cdevs[index]) 3181 if (!driver->cdevs[index])
3157 return -ENOMEM; 3182 return -ENOMEM;
3158 cdev_init(driver->cdevs[index], &tty_fops); 3183 driver->cdevs[index]->ops = &tty_fops;
3159 driver->cdevs[index]->owner = driver->owner; 3184 driver->cdevs[index]->owner = driver->owner;
3160 return cdev_add(driver->cdevs[index], dev, count); 3185 err = cdev_add(driver->cdevs[index], dev, count);
3186 if (err)
3187 kobject_put(&driver->cdevs[index]->kobj);
3188 return err;
3161} 3189}
3162 3190
3163/** 3191/**
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d85abfed84cc..f5a381945db2 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -54,6 +54,13 @@ static const struct usb_device_id usb_quirk_list[] = {
54 { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, 54 { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
55 { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, 55 { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
56 56
57 /* Logitech ConferenceCam CC3000e */
58 { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
59 { USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT },
60
61 /* Logitech PTZ Pro Camera */
62 { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
63
57 /* Logitech Quickcam Fusion */ 64 /* Logitech Quickcam Fusion */
58 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, 65 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
59 66
@@ -78,6 +85,12 @@ static const struct usb_device_id usb_quirk_list[] = {
78 /* Philips PSC805 audio device */ 85 /* Philips PSC805 audio device */
79 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 86 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
80 87
88 /* Plantronic Audio 655 DSP */
89 { USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME },
90
91 /* Plantronic Audio 648 USB */
92 { USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME },
93
81 /* Artisman Watchdog Dongle */ 94 /* Artisman Watchdog Dongle */
82 { USB_DEVICE(0x04b4, 0x0526), .driver_info = 95 { USB_DEVICE(0x04b4, 0x0526), .driver_info =
83 USB_QUIRK_CONFIG_INTF_STRINGS }, 96 USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index d1b81539d632..d6199507f861 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
159 bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool, 159 bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
160 GFP_ATOMIC, 160 GFP_ATOMIC,
161 &dma); 161 &dma);
162 if (!bd_table->start_bd) 162 if (!bd_table->start_bd) {
163 kfree(bd_table);
163 goto fail; 164 goto fail;
165 }
164 166
165 bd_table->dma = dma; 167 bd_table->dma = dma;
166 168
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 3ad5d19e4d04..23c794813e6a 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -472,7 +472,7 @@ static int chaoskey_rng_read(struct hwrng *rng, void *data,
472 if (this_time > max) 472 if (this_time > max)
473 this_time = max; 473 this_time = max;
474 474
475 memcpy(data, dev->buf, this_time); 475 memcpy(data, dev->buf + dev->used, this_time);
476 476
477 dev->used += this_time; 477 dev->used += this_time;
478 478
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 7b98e1d9194c..d82fa36c3465 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -476,6 +476,11 @@ static const struct of_device_id usbhs_of_match[] = {
476 .compatible = "renesas,usbhs-r8a7794", 476 .compatible = "renesas,usbhs-r8a7794",
477 .data = (void *)USBHS_TYPE_RCAR_GEN2, 477 .data = (void *)USBHS_TYPE_RCAR_GEN2,
478 }, 478 },
479 {
480 /* Gen3 is compatible with Gen2 */
481 .compatible = "renesas,usbhs-r8a7795",
482 .data = (void *)USBHS_TYPE_RCAR_GEN2,
483 },
479 { }, 484 { },
480}; 485};
481MODULE_DEVICE_TABLE(of, usbhs_of_match); 486MODULE_DEVICE_TABLE(of, usbhs_of_match);
@@ -493,7 +498,7 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
493 return NULL; 498 return NULL;
494 499
495 dparam = &info->driver_param; 500 dparam = &info->driver_param;
496 dparam->type = of_id ? (u32)of_id->data : 0; 501 dparam->type = of_id ? (uintptr_t)of_id->data : 0;
497 if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp)) 502 if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
498 dparam->buswait_bwait = tmp; 503 dparam->buswait_bwait = tmp;
499 gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0, 504 gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0,
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
index 0e5fde1d3ffb..9f9a7bef1ff6 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -752,7 +752,7 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev,
752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) { 752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) {
753 dev_err(dev, "Invalid waveform\n"); 753 dev_err(dev, "Invalid waveform\n");
754 err = -EINVAL; 754 err = -EINVAL;
755 goto err_failed; 755 goto err_fw;
756 } 756 }
757 757
758 mutex_lock(&(par->io_lock)); 758 mutex_lock(&(par->io_lock));
@@ -762,13 +762,15 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev,
762 mutex_unlock(&(par->io_lock)); 762 mutex_unlock(&(par->io_lock));
763 if (err < 0) { 763 if (err < 0) {
764 dev_err(dev, "Failed to store broadsheet waveform\n"); 764 dev_err(dev, "Failed to store broadsheet waveform\n");
765 goto err_failed; 765 goto err_fw;
766 } 766 }
767 767
768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size); 768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size);
769 769
770 return len; 770 err = len;
771 771
772err_fw:
773 release_firmware(fw_entry);
772err_failed: 774err_failed:
773 return err; 775 return err;
774} 776}
diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 7fa2e6f9e322..b335c1ae8625 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1628,9 +1628,16 @@ static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
1628static int fsl_diu_resume(struct platform_device *ofdev) 1628static int fsl_diu_resume(struct platform_device *ofdev)
1629{ 1629{
1630 struct fsl_diu_data *data; 1630 struct fsl_diu_data *data;
1631 unsigned int i;
1631 1632
1632 data = dev_get_drvdata(&ofdev->dev); 1633 data = dev_get_drvdata(&ofdev->dev);
1633 enable_lcdc(data->fsl_diu_info); 1634
1635 fsl_diu_enable_interrupts(data);
1636 update_lcdc(data->fsl_diu_info);
1637 for (i = 0; i < NUM_AOIS; i++) {
1638 if (data->mfb[i].count)
1639 fsl_diu_enable_panel(&data->fsl_diu_info[i]);
1640 }
1634 1641
1635 return 0; 1642 return 0;
1636} 1643}
diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index 9b8bebdf8f86..f9ec5c0484fa 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -831,6 +831,7 @@ static struct of_device_id of_platform_mb862xx_tbl[] = {
831 { .compatible = "fujitsu,coral", }, 831 { .compatible = "fujitsu,coral", },
832 { /* end */ } 832 { /* end */ }
833}; 833};
834MODULE_DEVICE_TABLE(of, of_platform_mb862xx_tbl);
834 835
835static struct platform_driver of_platform_mb862xxfb_driver = { 836static struct platform_driver of_platform_mb862xxfb_driver = {
836 .driver = { 837 .driver = {
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
index a8ce920fa797..d811e6dcaef7 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
@@ -294,7 +294,7 @@ static int dvic_probe_of(struct platform_device *pdev)
294 294
295 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); 295 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
296 if (adapter_node) { 296 if (adapter_node) {
297 adapter = of_find_i2c_adapter_by_node(adapter_node); 297 adapter = of_get_i2c_adapter_by_node(adapter_node);
298 if (adapter == NULL) { 298 if (adapter == NULL) {
299 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); 299 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
300 omap_dss_put_device(ddata->in); 300 omap_dss_put_device(ddata->in);
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index 90cbc4c3406c..c581231c74a5 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -898,6 +898,7 @@ static const struct of_device_id acx565akm_of_match[] = {
898 { .compatible = "omapdss,sony,acx565akm", }, 898 { .compatible = "omapdss,sony,acx565akm", },
899 {}, 899 {},
900}; 900};
901MODULE_DEVICE_TABLE(of, acx565akm_of_match);
901 902
902static struct spi_driver acx565akm_driver = { 903static struct spi_driver acx565akm_driver = {
903 .driver = { 904 .driver = {
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 7ed9a227f5ea..01b43e9ce941 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -226,7 +226,7 @@ static void blade_image_blit(struct tridentfb_par *par, const char *data,
226 writemmr(par, DST1, point(x, y)); 226 writemmr(par, DST1, point(x, y));
227 writemmr(par, DST2, point(x + w - 1, y + h - 1)); 227 writemmr(par, DST2, point(x + w - 1, y + h - 1));
228 228
229 memcpy(par->io_virt + 0x10000, data, 4 * size); 229 iowrite32_rep(par->io_virt + 0x10000, data, size);
230} 230}
231 231
232static void blade_copy_rect(struct tridentfb_par *par, 232static void blade_copy_rect(struct tridentfb_par *par,
@@ -673,8 +673,14 @@ static int get_nativex(struct tridentfb_par *par)
673static inline void set_lwidth(struct tridentfb_par *par, int width) 673static inline void set_lwidth(struct tridentfb_par *par, int width)
674{ 674{
675 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF); 675 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF);
676 write3X4(par, AddColReg, 676 /* chips older than TGUI9660 have only 1 width bit in AddColReg */
677 (read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4)); 677 /* touching the other one breaks I2C/DDC */
678 if (par->chip_id == TGUI9440 || par->chip_id == CYBER9320)
679 write3X4(par, AddColReg,
680 (read3X4(par, AddColReg) & 0xEF) | ((width & 0x100) >> 4));
681 else
682 write3X4(par, AddColReg,
683 (read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4));
678} 684}
679 685
680/* For resolutions smaller than FP resolution stretch */ 686/* For resolutions smaller than FP resolution stretch */
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 32d8275e4c88..8a1076beecd3 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -210,6 +210,7 @@ struct display_timings *of_get_display_timings(struct device_node *np)
210 */ 210 */
211 pr_err("%s: error in timing %d\n", 211 pr_err("%s: error in timing %d\n",
212 of_node_full_name(np), disp->num_timings + 1); 212 of_node_full_name(np), disp->num_timings + 1);
213 kfree(dt);
213 goto timingfail; 214 goto timingfail;
214 } 215 }
215 216