]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 14 Nov 2016 16:39:56 +0000 (08:39 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 14 Nov 2016 16:39:56 +0000 (08:39 -0800)
Pull x86 fixes from Ingo Molnar:
 "Misc fixes:

   - fix an Intel/MID boot crash/hang bug

   - fix a cache topology mis-parsing bug on certain AMD CPUs

   - fix a virtualization firmware bug by adding a check+quirk
     workaround on the kernel side"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/cpu: Deal with broken firmware (VMWare/XEN)
  x86/cpu/AMD: Fix cpu_llc_id for AMD Fam17h systems
  x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook

259 files changed:
Documentation/ABI/testing/sysfs-devices-system-ibm-rtl
Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
Documentation/devicetree/bindings/pci/rockchip-pcie.txt
Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt
Documentation/filesystems/Locking
Documentation/filesystems/vfs.txt
MAINTAINERS
Makefile
arch/arc/Makefile
arch/arc/boot/dts/axc001.dtsi
arch/arc/boot/dts/nsim_700.dts
arch/arc/boot/dts/nsimosci.dts
arch/arc/configs/nsim_700_defconfig
arch/arc/configs/nsim_hs_defconfig
arch/arc/configs/nsim_hs_smp_defconfig
arch/arc/configs/nsimosci_defconfig
arch/arc/configs/nsimosci_hs_defconfig
arch/arc/configs/nsimosci_hs_smp_defconfig
arch/arc/include/asm/arcregs.h
arch/arc/include/asm/smp.h
arch/arc/kernel/devtree.c
arch/arc/kernel/mcip.c
arch/arc/kernel/process.c
arch/arc/kernel/smp.c
arch/arc/kernel/time.c
arch/arc/mm/dma.c
arch/arc/plat-eznps/smp.c
arch/arm/include/asm/kvm_asm.h
arch/arm/include/asm/kvm_host.h
arch/arm/include/asm/kvm_hyp.h
arch/arm/kvm/arm.c
arch/arm/kvm/hyp/tlb.c
arch/arm64/boot/dts/rockchip/rk3399.dtsi
arch/arm64/include/asm/alternative.h
arch/arm64/include/asm/cpucaps.h [new file with mode: 0644]
arch/arm64/include/asm/cpufeature.h
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_mmu.h
arch/arm64/include/asm/lse.h
arch/arm64/kvm/hyp/tlb.c
arch/nios2/kernel/time.c
arch/openrisc/include/asm/cache.h
arch/s390/hypfs/hypfs_diag.c
arch/s390/kernel/vmlinux.lds.S
arch/s390/pci/pci_dma.c
arch/x86/crypto/aesni-intel_glue.c
arch/x86/events/intel/uncore_snb.c
arch/x86/kernel/apm_32.c
arch/x86/platform/efi/efi.c
arch/x86/platform/efi/efi_64.c
drivers/acpi/acpi_apd.c
drivers/acpi/acpi_lpss.c
drivers/acpi/acpi_platform.c
drivers/acpi/dptf/int340x_thermal.c
drivers/acpi/scan.c
drivers/base/dd.c
drivers/base/power/main.c
drivers/block/aoe/aoecmd.c
drivers/block/drbd/drbd_main.c
drivers/block/nbd.c
drivers/char/ppdev.c
drivers/clk/clk-qoriq.c
drivers/clk/clk-xgene.c
drivers/clk/imx/clk-pllv3.c
drivers/clk/mmp/clk-of-mmp2.c
drivers/clk/mmp/clk-of-pxa168.c
drivers/clk/mmp/clk-of-pxa910.c
drivers/clk/rockchip/clk-ddr.c
drivers/clk/samsung/clk-exynos-clkout.c
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/vi.c
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
drivers/gpu/drm/amd/scheduler/sched_fence.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_runtime_pm.c
drivers/gpu/drm/imx/ipuv3-crtc.c
drivers/gpu/drm/msm/dsi/dsi_host.c
drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c
drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c
drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c
drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_gem_shrinker.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/radeon/radeon_device.c
drivers/gpu/drm/udl/udl_main.c
drivers/hid/hid-ids.h
drivers/hid/hid-sensor-custom.c
drivers/hid/hid-sensor-hub.c
drivers/hid/intel-ish-hid/ipc/ipc.c
drivers/hid/intel-ish-hid/ipc/pci-ish.c
drivers/hid/usbhid/hid-quirks.c
drivers/hv/vmbus_drv.c
drivers/hwmon/hwmon.c
drivers/iio/accel/st_accel_core.c
drivers/iio/common/hid-sensors/hid-sensor-attributes.c
drivers/iio/common/st_sensors/st_sensors_core.c
drivers/iio/orientation/hid-sensor-rotation.c
drivers/iio/temperature/maxim_thermocouple.c
drivers/infiniband/core/cma.c
drivers/iommu/arm-smmu-v3.c
drivers/iommu/arm-smmu.c
drivers/iommu/intel-iommu.c
drivers/media/dvb-frontends/Kconfig
drivers/media/dvb-frontends/Makefile
drivers/media/dvb-frontends/gp8psk-fe.c [moved from drivers/media/usb/dvb-usb/gp8psk-fe.c with 72% similarity]
drivers/media/dvb-frontends/gp8psk-fe.h [new file with mode: 0644]
drivers/media/i2c/ir-kbd-i2c.c
drivers/media/usb/dvb-usb/Makefile
drivers/media/usb/dvb-usb/af9005.c
drivers/media/usb/dvb-usb/cinergyT2-core.c
drivers/media/usb/dvb-usb/cxusb.c
drivers/media/usb/dvb-usb/cxusb.h
drivers/media/usb/dvb-usb/dib0700_core.c
drivers/media/usb/dvb-usb/dtt200u.c
drivers/media/usb/dvb-usb/dvb-usb-init.c
drivers/media/usb/dvb-usb/dvb-usb.h
drivers/media/usb/dvb-usb/gp8psk.c
drivers/media/usb/dvb-usb/gp8psk.h
drivers/misc/mei/bus-fixup.c
drivers/mmc/card/mmc_test.c
drivers/mmc/core/mmc.c
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/mxs-mmc.c
drivers/mmc/host/sdhci.c
drivers/nfc/mei_phy.c
drivers/ntb/hw/intel/ntb_hw_intel.c
drivers/ntb/ntb_transport.c
drivers/ntb/test/ntb_perf.c
drivers/ntb/test/ntb_pingpong.c
drivers/nvme/host/lightnvm.c
drivers/of/base.c
drivers/pci/host/pcie-rockchip.c
drivers/pci/setup-res.c
drivers/pcmcia/soc_common.c
drivers/phy/phy-da8xx-usb.c
drivers/phy/phy-rockchip-pcie.c
drivers/phy/phy-sun4i-usb.c
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
drivers/pinctrl/bcm/pinctrl-nsp-gpio.c
drivers/pinctrl/freescale/pinctrl-imx.c
drivers/pinctrl/intel/pinctrl-cherryview.c
drivers/pinctrl/pinctrl-st.c
drivers/pinctrl/stm32/pinctrl-stm32.c
drivers/platform/x86/ideapad-laptop.c
drivers/platform/x86/intel-hid.c
drivers/platform/x86/intel-vbtn.c
drivers/platform/x86/toshiba-wmi.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/device_handler/scsi_dh_alua.c
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/vmw_pvscsi.c
drivers/scsi/vmw_pvscsi.h
drivers/staging/comedi/drivers/ni_tio.c
drivers/staging/greybus/arche-platform.c
drivers/staging/iio/impedance-analyzer/ad5933.c
drivers/staging/nvec/nvec_ps2.c
drivers/staging/sm750fb/ddk750_reg.h
drivers/usb/class/cdc-acm.c
drivers/usb/dwc3/core.c
drivers/usb/dwc3/dwc3-st.c
drivers/usb/gadget/function/u_ether.c
drivers/usb/host/pci-quirks.c
drivers/usb/musb/da8xx.c
drivers/usb/musb/musb_core.c
drivers/uwb/lc-rc.c
drivers/uwb/pal.c
fs/aio.c
fs/ceph/file.c
fs/coredump.c
fs/nfs/client.c
fs/nfs/namespace.c
fs/nfs/nfs4session.c
fs/nfs/pnfs.c
fs/ntfs/dir.c
fs/ocfs2/dir.c
fs/orangefs/orangefs-debugfs.c
fs/orangefs/orangefs-mod.c
fs/splice.c
fs/xfs/libxfs/xfs_defer.c
include/asm-generic/percpu.h
include/asm-generic/sections.h
include/asm-generic/vmlinux.lds.h
include/linux/acpi.h
include/linux/ceph/osd_client.h
include/linux/console.h
include/linux/frontswap.h
include/linux/fs.h
include/linux/phy/phy.h
include/uapi/sound/asoc.h
kernel/irq/manage.c
kernel/power/suspend_test.c
kernel/printk/printk.c
lib/stackdepot.c
mm/cma.c
mm/filemap.c
mm/hugetlb.c
mm/kmemleak.c
mm/memory-failure.c
mm/page_alloc.c
mm/shmem.c
mm/slab_common.c
mm/swapfile.c
net/ceph/ceph_fs.c
net/ceph/osd_client.c
net/sunrpc/clnt.c
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/xprt_rdma.h
scripts/Makefile.extrawarn
scripts/Makefile.ubsan
scripts/bloat-o-meter
sound/core/info.c
sound/soc/codecs/cs4270.c
sound/soc/codecs/da7219.c
sound/soc/codecs/hdmi-codec.c
sound/soc/codecs/rt298.c
sound/soc/codecs/rt5663.c
sound/soc/codecs/sti-sas.c
sound/soc/codecs/tas571x.c
sound/soc/intel/Kconfig
sound/soc/intel/atom/sst/sst_acpi.c
sound/soc/intel/boards/bxt_da7219_max98357a.c
sound/soc/intel/skylake/skl.c
sound/soc/pxa/Kconfig
sound/soc/qcom/lpass-cpu.c
sound/soc/qcom/lpass-platform.c
sound/soc/qcom/lpass.h
sound/soc/samsung/ac97.c
sound/soc/samsung/i2s.c
sound/soc/samsung/pcm.c
sound/soc/samsung/s3c2412-i2s.c
sound/soc/samsung/s3c24xx-i2s.c
sound/soc/samsung/spdif.c
sound/soc/sti/uniperif_player.c
sound/soc/sunxi/sun4i-codec.c
tools/perf/ui/browsers/hists.c
tools/perf/util/hist.c
tools/power/cpupower/utils/cpufreq-set.c
virt/kvm/arm/vgic/vgic-mmio.c
virt/kvm/arm/vgic/vgic-mmio.h
virt/kvm/arm/vgic/vgic.c

index b82deeaec314b8ff711b122282396340496946c8..470def06ab0a42e40f860d1fe54f8e0d489ec4c3 100644 (file)
@@ -1,4 +1,4 @@
-What:           state
+What:           /sys/devices/system/ibm_rtl/state
 Date:           Sep 2010
 KernelVersion:  2.6.37
 Contact:        Vernon Mauery <vernux@us.ibm.com>
@@ -10,7 +10,7 @@ Description:    The state file allows a means by which to change in and
 Users:          The ibm-prtm userspace daemon uses this interface.
 
 
-What:           version
+What:           /sys/devices/system/ibm_rtl/version
 Date:           Sep 2010
 KernelVersion:  2.6.37
 Contact:        Vernon Mauery <vernux@us.ibm.com>
index 4e00e859e885a0ce8ae59ae234b2637f2e894e70..bfa461aaac99b3e3033727572009c308efc3b6bf 100644 (file)
@@ -43,6 +43,9 @@ Optional properties:
   reset signal present internally in some host controller IC designs.
   See Documentation/devicetree/bindings/reset/reset.txt for details.
 
+* reset-names: request name for using "resets" property. Must be "reset".
+       (It will be used together with "resets" property.)
+
 * clocks: from common clock binding: handle to biu and ciu clocks for the
   bus interface unit clock and the card interface unit clock.
 
@@ -103,6 +106,8 @@ board specific portions as listed below.
                interrupts = <0 75 0>;
                #address-cells = <1>;
                #size-cells = <0>;
+               resets = <&rst 20>;
+               reset-names = "reset";
        };
 
 [board specific internal DMA resources]
index ba67b39939c10b15f7e1a99291c935a1c2c81bf8..71aeda1ca05598d74e8db3f429f212d0095f702a 100644 (file)
@@ -26,13 +26,16 @@ Required properties:
        - "sys"
        - "legacy"
        - "client"
-- resets: Must contain five entries for each entry in reset-names.
+- resets: Must contain seven entries for each entry in reset-names.
           See ../reset/reset.txt for details.
 - reset-names: Must include the following names
        - "core"
        - "mgmt"
        - "mgmt-sticky"
        - "pipe"
+       - "pm"
+       - "aclk"
+       - "pclk"
 - pinctrl-names : The pin control state names
 - pinctrl-0: The "default" pinctrl state
 - #interrupt-cells: specifies the number of cells needed to encode an
@@ -86,8 +89,10 @@ pcie0: pcie@f8000000 {
        reg = <0x0 0xf8000000 0x0 0x2000000>, <0x0 0xfd000000 0x0 0x1000000>;
        reg-names = "axi-base", "apb-base";
        resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>,
-                <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>;
-       reset-names = "core", "mgmt", "mgmt-sticky", "pipe";
+                <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE> ,
+                <&cru SRST_PCIE_PM>, <&cru SRST_P_PCIE>, <&cru SRST_A_PCIE>;
+       reset-names = "core", "mgmt", "mgmt-sticky", "pipe",
+                     "pm", "pclk", "aclk";
        phys = <&pcie_phy>;
        phy-names = "pcie-phy";
        pinctrl-names = "default";
index f9753c416974d553cce347f2fbf3c82bc56d9afc..b24583aa34c3bf45363e3eee4ceac292d713b67d 100644 (file)
@@ -14,11 +14,6 @@ Required properies:
  - #size-cells : The value of this property must be 1
  - ranges      : defines mapping between pin controller node (parent) to
    gpio-bank node (children).
- - interrupt-parent: phandle of the interrupt parent to which the external
-   GPIO interrupts are forwarded to.
- - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node
-   which includes IRQ mux selection register, and the offset of the IRQ mux
-   selection register.
  - pins-are-numbered: Specify the subnodes are using numbered pinmux to
    specify pins.
 
@@ -37,6 +32,11 @@ Required properties:
 
 Optional properties:
  - reset:        : Reference to the reset controller
+ - interrupt-parent: phandle of the interrupt parent to which the external
+   GPIO interrupts are forwarded to.
+ - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node
+   which includes IRQ mux selection register, and the offset of the IRQ mux
+   selection register.
 
 Example:
 #include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
index 14cdc101d165d94bb6114763989322ac1958848c..1b5f15653b1bb82ca0fc7801fe01fe8c4c75047a 100644 (file)
@@ -447,7 +447,6 @@ prototypes:
        int (*flush) (struct file *);
        int (*release) (struct inode *, struct file *);
        int (*fsync) (struct file *, loff_t start, loff_t end, int datasync);
-       int (*aio_fsync) (struct kiocb *, int datasync);
        int (*fasync) (int, struct file *, int);
        int (*lock) (struct file *, int, struct file_lock *);
        ssize_t (*readv) (struct file *, const struct iovec *, unsigned long,
index d619c8d71966e255474b3bce54f2b277dd1b337d..b5039a00caafae44660514da3829994436a35e84 100644 (file)
@@ -828,7 +828,6 @@ struct file_operations {
        int (*flush) (struct file *, fl_owner_t id);
        int (*release) (struct inode *, struct file *);
        int (*fsync) (struct file *, loff_t, loff_t, int datasync);
-       int (*aio_fsync) (struct kiocb *, int datasync);
        int (*fasync) (int, struct file *, int);
        int (*lock) (struct file *, int, struct file_lock *);
        ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
index 411e3b87b8c2c137e201996060e1741b8fd73484..851b89b9edcb5e99e84270e67510e10a19418b21 100644 (file)
@@ -9335,7 +9335,7 @@ PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD)
 M:     Keith Busch <keith.busch@intel.com>
 L:     linux-pci@vger.kernel.org
 S:     Supported
-F:     arch/x86/pci/vmd.c
+F:     drivers/pci/host/vmd.c
 
 PCIE DRIVER FOR ST SPEAR13XX
 M:     Pratyush Anand <pratyush.anand@gmail.com>
index f97f786de58dd8497db3599279d9e2c3d40e121b..247430abfc733cb30930403103375b797f526f6f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 4
 PATCHLEVEL = 9
 SUBLEVEL = 0
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc5
 NAME = Psychotic Stoned Sheep
 
 # *DOCUMENTATION*
@@ -370,7 +370,7 @@ LDFLAGS_MODULE  =
 CFLAGS_KERNEL  =
 AFLAGS_KERNEL  =
 LDFLAGS_vmlinux =
-CFLAGS_GCOV    = -fprofile-arcs -ftest-coverage -fno-tree-loop-im
+CFLAGS_GCOV    = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized
 CFLAGS_KCOV    := $(call cc-option,-fsanitize-coverage=trace-pc,)
 
 
@@ -620,7 +620,6 @@ ARCH_CFLAGS :=
 include arch/$(SRCARCH)/Makefile
 
 KBUILD_CFLAGS  += $(call cc-option,-fno-delete-null-pointer-checks,)
-KBUILD_CFLAGS  += $(call cc-disable-warning,maybe-uninitialized,)
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
@@ -629,15 +628,18 @@ KBUILD_CFLAGS     += $(call cc-option,-fdata-sections,)
 endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS  += -Os
+KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
 ifdef CONFIG_PROFILE_ALL_BRANCHES
-KBUILD_CFLAGS  += -O2
+KBUILD_CFLAGS  += -O2 $(call cc-disable-warning,maybe-uninitialized,)
 else
 KBUILD_CFLAGS   += -O2
 endif
 endif
 
+KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
+                       $(call cc-disable-warning,maybe-uninitialized,))
+
 # Tell gcc to never replace conditional load with a non-conditional one
 KBUILD_CFLAGS  += $(call cc-option,--param=allow-store-data-races=0)
 
index 864adad522803cfdec31983d062514d7c50f19c3..19cce226d1a830793b54b98fba6f56c6a5a6a88d 100644 (file)
@@ -50,6 +50,9 @@ atleast_gcc44 :=  $(call cc-ifversion, -ge, 0404, y)
 
 cflags-$(atleast_gcc44)                        += -fsection-anchors
 
+cflags-$(CONFIG_ARC_HAS_LLSC)          += -mlock
+cflags-$(CONFIG_ARC_HAS_SWAPE)         += -mswape
+
 ifdef CONFIG_ISA_ARCV2
 
 ifndef CONFIG_ARC_HAS_LL64
@@ -68,7 +71,9 @@ cflags-$(CONFIG_ARC_DW2_UNWIND)               += -fasynchronous-unwind-tables $(cfi)
 ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
 # Generic build system uses -O2, we want -O3
 # Note: No need to add to cflags-y as that happens anyways
-ARCH_CFLAGS += -O3
+#
+# Disable the false maybe-uninitialized warings gcc spits out at -O3
+ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
 endif
 
 # small data is default for elf32 tool-chain. If not usable, disable it
index 6ae2c476ad825aee57fadb1e557b95a0bb082647..53ce226f77a59857615f8fc53fca3ba1c4f09749 100644 (file)
@@ -71,7 +71,7 @@ debug_uart: dw-apb-uart@0x5000 {
                        reg-io-width = <4>;
                };
 
-               arcpmu0: pmu {
+               arcpct0: pct {
                        compatible = "snps,arc700-pct";
                };
        };
index ce0ccd20b5bfc821b1e2c96d043b6a6e85c7ada8..5ee96b067c085ce1f061e0aac02732d63d4ecf7e 100644 (file)
@@ -69,7 +69,7 @@ phy0: ethernet-phy@0 {
                        };
                };
 
-               arcpmu0: pmu {
+               arcpct0: pct {
                        compatible = "snps,arc700-pct";
                };
        };
index bcf603142a33c08d6a0dbc7a50f47b7c84a20e1a..3c391ba565ed080cfad8b66f4c3395975eec90da 100644 (file)
@@ -83,5 +83,9 @@ eth0: ethernet@f0003000 {
                        reg = <0xf0003000 0x44>;
                        interrupts = <7>;
                };
+
+               arcpct0: pct {
+                       compatible = "snps,arc700-pct";
+               };
        };
 };
index 7314f538847bd13cf75ee94689b2612c19045e1a..b0066a749d4c49d8a23e3bd33b4a52789789c913 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE="../arc_initramfs/"
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_KPROBES=y
index 65ab9fbf83f25ab89fd6cf74e7fefb66226b2bf6..ebe9ebb92933302af79f98dae000e8567b86ec6b 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/"
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_KPROBES=y
index 3b3990cddbe10bc21eeb485521d08a64c61ca457..4bde43278be6757c5c739bfd58a9f030a80c7568 100644 (file)
@@ -12,6 +12,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/"
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_KPROBES=y
index 98cf20933bbb3232da17fe94fdfe0ad3ddf38379..f6fb3d26557eb7c63b2f77263acfed80f0b45387 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE="../arc_initramfs/"
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_KPROBES=y
index ddf8b96d494e90f4a776cdbea8276c54f0babc13..b9f0fe00044b6c44d62a81a91064583cd9badee3 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/"
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
 CONFIG_KPROBES=y
index ceb90745326e52d85f3ca0a9092962c23b740910..6da71ba253a932275c133e55fe68fd19c7ec4379 100644 (file)
@@ -10,6 +10,7 @@ CONFIG_IKCONFIG_PROC=y
 # CONFIG_PID_NS is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/"
+CONFIG_PERF_EVENTS=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_KPROBES=y
 CONFIG_MODULES=y
@@ -34,7 +35,6 @@ CONFIG_INET=y
 # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
-# CONFIG_INET_LRO is not set
 # CONFIG_IPV6 is not set
 # CONFIG_WIRELESS is not set
 CONFIG_DEVTMPFS=y
@@ -72,7 +72,6 @@ CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HWMON is not set
 CONFIG_DRM=y
 CONFIG_DRM_ARCPGU=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 # CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
index 7f3f9f63708cf4c3b0e1d77f9b1ac17e3505c4ba..1bd24ec3e350243de4abd0a45cee201027ccf52a 100644 (file)
 #define STATUS_AE_BIT          5       /* Exception active */
 #define STATUS_DE_BIT          6       /* PC is in delay slot */
 #define STATUS_U_BIT           7       /* User/Kernel mode */
+#define STATUS_Z_BIT            11
 #define STATUS_L_BIT           12      /* Loop inhibit */
 
 /* These masks correspond to the status word(STATUS_32) bits */
 #define STATUS_AE_MASK         (1<<STATUS_AE_BIT)
 #define STATUS_DE_MASK         (1<<STATUS_DE_BIT)
 #define STATUS_U_MASK          (1<<STATUS_U_BIT)
+#define STATUS_Z_MASK          (1<<STATUS_Z_BIT)
 #define STATUS_L_MASK          (1<<STATUS_L_BIT)
 
 /*
index 89fdd1b0a76ebe672094daa10134204cb96cf925..0861007d9ef33b9dbb19a6d2123c3b5d717d3733 100644 (file)
@@ -37,9 +37,9 @@ extern const char *arc_platform_smp_cpuinfo(void);
  * API expected BY platform smp code (FROM arch smp code)
  *
  * smp_ipi_irq_setup:
- *     Takes @cpu and @irq to which the arch-common ISR is hooked up
+ *     Takes @cpu and @hwirq to which the arch-common ISR is hooked up
  */
-extern int smp_ipi_irq_setup(int cpu, int irq);
+extern int smp_ipi_irq_setup(int cpu, irq_hw_number_t hwirq);
 
 /*
  * struct plat_smp_ops - SMP callbacks provided by platform to ARC SMP
index f1e07c2344f84cbd6fb351ad65e9a542fc8f1b4e..3b67f538f1425699219fb2cd481be592ba047731 100644 (file)
@@ -31,6 +31,8 @@ static void __init arc_set_early_base_baud(unsigned long dt_root)
                arc_base_baud = 166666666;      /* Fixed 166.6MHz clk (TB10x) */
        else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp"))
                arc_base_baud = 33333333;       /* Fixed 33MHz clk (AXS10x) */
+       else if (of_flat_dt_is_compatible(dt_root, "ezchip,arc-nps"))
+               arc_base_baud = 800000000;      /* Fixed 800MHz clk (NPS) */
        else
                arc_base_baud = 50000000;       /* Fixed default 50MHz */
 }
index c424d5abc318a220f07d4724b8796a35280f4e7e..f39142acc89e032627ef88431ac4775e71949ed2 100644 (file)
@@ -181,6 +181,8 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
 {
        unsigned long flags;
        cpumask_t online;
+       unsigned int destination_bits;
+       unsigned int distribution_mode;
 
        /* errout if no online cpu per @cpumask */
        if (!cpumask_and(&online, cpumask, cpu_online_mask))
@@ -188,8 +190,15 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
 
        raw_spin_lock_irqsave(&mcip_lock, flags);
 
-       idu_set_dest(data->hwirq, cpumask_bits(&online)[0]);
-       idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
+       destination_bits = cpumask_bits(&online)[0];
+       idu_set_dest(data->hwirq, destination_bits);
+
+       if (ffs(destination_bits) == fls(destination_bits))
+               distribution_mode = IDU_M_DISTRI_DEST;
+       else
+               distribution_mode = IDU_M_DISTRI_RR;
+
+       idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, distribution_mode);
 
        raw_spin_unlock_irqrestore(&mcip_lock, flags);
 
@@ -207,16 +216,15 @@ static struct irq_chip idu_irq_chip = {
 
 };
 
-static int idu_first_irq;
+static irq_hw_number_t idu_first_hwirq;
 
 static void idu_cascade_isr(struct irq_desc *desc)
 {
-       struct irq_domain *domain = irq_desc_get_handler_data(desc);
-       unsigned int core_irq = irq_desc_get_irq(desc);
-       unsigned int idu_irq;
+       struct irq_domain *idu_domain = irq_desc_get_handler_data(desc);
+       irq_hw_number_t core_hwirq = irqd_to_hwirq(irq_desc_get_irq_data(desc));
+       irq_hw_number_t idu_hwirq = core_hwirq - idu_first_hwirq;
 
-       idu_irq = core_irq - idu_first_irq;
-       generic_handle_irq(irq_find_mapping(domain, idu_irq));
+       generic_handle_irq(irq_find_mapping(idu_domain, idu_hwirq));
 }
 
 static int idu_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hwirq)
@@ -282,7 +290,7 @@ idu_of_init(struct device_node *intc, struct device_node *parent)
        struct irq_domain *domain;
        /* Read IDU BCR to confirm nr_irqs */
        int nr_irqs = of_irq_count(intc);
-       int i, irq;
+       int i, virq;
        struct mcip_bcr mp;
 
        READ_BCR(ARC_REG_MCIP_BCR, mp);
@@ -303,11 +311,11 @@ idu_of_init(struct device_node *intc, struct device_node *parent)
                 * however we need it to get the parent virq and set IDU handler
                 * as first level isr
                 */
-               irq = irq_of_parse_and_map(intc, i);
+               virq = irq_of_parse_and_map(intc, i);
                if (!i)
-                       idu_first_irq = irq;
+                       idu_first_hwirq = irqd_to_hwirq(irq_get_irq_data(virq));
 
-               irq_set_chained_handler_and_data(irq, idu_cascade_isr, domain);
+               irq_set_chained_handler_and_data(virq, idu_cascade_isr, domain);
        }
 
        __mcip_cmd(CMD_IDU_ENABLE, 0);
index 59aa43cb146e732e01544790913f0b018a923cc6..a41a79a4f4feaca96306577077bd4745d6cd8537 100644 (file)
@@ -43,8 +43,8 @@ SYSCALL_DEFINE0(arc_gettls)
 
 SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
 {
-       int uval;
-       int ret;
+       struct pt_regs *regs = current_pt_regs();
+       int uval = -EFAULT;
 
        /*
         * This is only for old cores lacking LLOCK/SCOND, which by defintion
@@ -54,24 +54,26 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
         */
        WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP));
 
+       /* Z indicates to userspace if operation succeded */
+       regs->status32 &= ~STATUS_Z_MASK;
+
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
                return -EFAULT;
 
        preempt_disable();
 
-       ret = __get_user(uval, uaddr);
-       if (ret)
+       if (__get_user(uval, uaddr))
                goto done;
 
-       if (uval != expected)
-               ret = -EAGAIN;
-       else
-               ret = __put_user(new, uaddr);
+       if (uval == expected) {
+               if (!__put_user(new, uaddr))
+                       regs->status32 |= STATUS_Z_MASK;
+       }
 
 done:
        preempt_enable();
 
-       return ret;
+       return uval;
 }
 
 void arch_cpu_idle(void)
index f183cc648851e53d0db2736925cdf466d900946a..88674d972c9d056f33f87205aa77049c11006129 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/atomic.h>
 #include <linux/cpumask.h>
 #include <linux/reboot.h>
+#include <linux/irqdomain.h>
 #include <asm/processor.h>
 #include <asm/setup.h>
 #include <asm/mach_desc.h>
@@ -67,11 +68,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        int i;
 
        /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
+        * if platform didn't set the present map already, do it now
+        * boot cpu is set to present already by init/main.c
         */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
+       if (num_present_cpus() <= 1) {
+               for (i = 0; i < max_cpus; i++)
+                       set_cpu_present(i, true);
+       }
 }
 
 void __init smp_cpus_done(unsigned int max_cpus)
@@ -351,20 +354,24 @@ irqreturn_t do_IPI(int irq, void *dev_id)
  */
 static DEFINE_PER_CPU(int, ipi_dev);
 
-int smp_ipi_irq_setup(int cpu, int irq)
+int smp_ipi_irq_setup(int cpu, irq_hw_number_t hwirq)
 {
        int *dev = per_cpu_ptr(&ipi_dev, cpu);
+       unsigned int virq = irq_find_mapping(NULL, hwirq);
+
+       if (!virq)
+               panic("Cannot find virq for root domain and hwirq=%lu", hwirq);
 
        /* Boot cpu calls request, all call enable */
        if (!cpu) {
                int rc;
 
-               rc = request_percpu_irq(irq, do_IPI, "IPI Interrupt", dev);
+               rc = request_percpu_irq(virq, do_IPI, "IPI Interrupt", dev);
                if (rc)
-                       panic("Percpu IRQ request failed for %d\n", irq);
+                       panic("Percpu IRQ request failed for %u\n", virq);
        }
 
-       enable_percpu_irq(irq, 0);
+       enable_percpu_irq(virq, 0);
 
        return 0;
 }
index f927b8dc6eddf614aecbd03138730badf4f3156c..c10390d1ddb6b32abe8d622870350f7be30c57df 100644 (file)
@@ -152,14 +152,17 @@ static cycle_t arc_read_rtc(struct clocksource *cs)
                cycle_t  full;
        } stamp;
 
-
-       __asm__ __volatile(
-       "1:                                             \n"
-       "       lr              %0, [AUX_RTC_LOW]       \n"
-       "       lr              %1, [AUX_RTC_HIGH]      \n"
-       "       lr              %2, [AUX_RTC_CTRL]      \n"
-       "       bbit0.nt        %2, 31, 1b              \n"
-       : "=r" (stamp.low), "=r" (stamp.high), "=r" (status));
+       /*
+        * hardware has an internal state machine which tracks readout of
+        * low/high and updates the CTRL.status if
+        *  - interrupt/exception taken between the two reads
+        *  - high increments after low has been read
+        */
+       do {
+               stamp.low = read_aux_reg(AUX_RTC_LOW);
+               stamp.high = read_aux_reg(AUX_RTC_HIGH);
+               status = read_aux_reg(AUX_RTC_CTRL);
+       } while (!(status & _BITUL(31)));
 
        return stamp.full;
 }
index 60aab5a7522b50c75e9e008214586a9fee182b10..cd8aad8226dd5c151989e1233603d9cb42781bf8 100644 (file)
@@ -105,6 +105,31 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
        __free_pages(page, get_order(size));
 }
 
+static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+                       void *cpu_addr, dma_addr_t dma_addr, size_t size,
+                       unsigned long attrs)
+{
+       unsigned long user_count = vma_pages(vma);
+       unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
+       unsigned long pfn = __phys_to_pfn(plat_dma_to_phys(dev, dma_addr));
+       unsigned long off = vma->vm_pgoff;
+       int ret = -ENXIO;
+
+       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+       if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret))
+               return ret;
+
+       if (off < count && user_count <= (count - off)) {
+               ret = remap_pfn_range(vma, vma->vm_start,
+                                     pfn + off,
+                                     user_count << PAGE_SHIFT,
+                                     vma->vm_page_prot);
+       }
+
+       return ret;
+}
+
 /*
  * streaming DMA Mapping API...
  * CPU accesses page via normal paddr, thus needs to explicitly made
@@ -193,6 +218,7 @@ static int arc_dma_supported(struct device *dev, u64 dma_mask)
 struct dma_map_ops arc_dma_ops = {
        .alloc                  = arc_dma_alloc,
        .free                   = arc_dma_free,
+       .mmap                   = arc_dma_mmap,
        .map_page               = arc_dma_map_page,
        .map_sg                 = arc_dma_map_sg,
        .sync_single_for_device = arc_dma_sync_single_for_device,
index 5e901f86e4bd068af0b665bd3d1a3ee3ea6c773d..56a4c8522f111cc5221e2ead6b6574100cd3f685 100644 (file)
@@ -140,16 +140,10 @@ static void eznps_init_per_cpu(int cpu)
        mtm_enable_core(cpu);
 }
 
-static void eznps_ipi_clear(int irq)
-{
-       write_aux_reg(CTOP_AUX_IACK, 1 << irq);
-}
-
 struct plat_smp_ops plat_smp_ops = {
        .info           = smp_cpuinfo_buf,
        .init_early_smp = eznps_init_cpumasks,
        .cpu_kick       = eznps_smp_wakeup_cpu,
        .ipi_send       = eznps_ipi_send,
        .init_per_cpu   = eznps_init_per_cpu,
-       .ipi_clear      = eznps_ipi_clear,
 };
index d7ea6bcb29bf68489323f1c777e057de0b81e364..8ef05381984b1b6ba977035c82607423b37835c0 100644 (file)
@@ -66,6 +66,7 @@ extern char __kvm_hyp_vector[];
 extern void __kvm_flush_vm_context(void);
 extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
 extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
+extern void __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu);
 
 extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
 
index 2d19e02d03fd69e75f327659f582d8abbdf909e9..d5423ab15ed5be1c705817e13d4a7d7fe35b465b 100644 (file)
@@ -57,6 +57,9 @@ struct kvm_arch {
        /* VTTBR value associated with below pgd and vmid */
        u64    vttbr;
 
+       /* The last vcpu id that ran on each physical CPU */
+       int __percpu *last_vcpu_ran;
+
        /* Timer */
        struct arch_timer_kvm   timer;
 
index 343135ede5fa01d848ec609f0eafc08f610f5aab..58508900c4bb264be2a874299b829b31a9cb5601 100644 (file)
@@ -71,6 +71,7 @@
 #define ICIALLUIS      __ACCESS_CP15(c7, 0, c1, 0)
 #define ATS1CPR                __ACCESS_CP15(c7, 0, c8, 0)
 #define TLBIALLIS      __ACCESS_CP15(c8, 0, c3, 0)
+#define TLBIALL                __ACCESS_CP15(c8, 0, c7, 0)
 #define TLBIALLNSNHIS  __ACCESS_CP15(c8, 4, c3, 4)
 #define PRRR           __ACCESS_CP15(c10, 0, c2, 0)
 #define NMRR           __ACCESS_CP15(c10, 0, c2, 1)
index 08bb84f2ad58e6be8caf539f6d8189c1b450cfa1..19b5f5c1c0ff3ef8fa68300f5ec87fe5564c916e 100644 (file)
@@ -114,11 +114,18 @@ void kvm_arch_check_processor_compat(void *rtn)
  */
 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 {
-       int ret = 0;
+       int ret, cpu;
 
        if (type)
                return -EINVAL;
 
+       kvm->arch.last_vcpu_ran = alloc_percpu(typeof(*kvm->arch.last_vcpu_ran));
+       if (!kvm->arch.last_vcpu_ran)
+               return -ENOMEM;
+
+       for_each_possible_cpu(cpu)
+               *per_cpu_ptr(kvm->arch.last_vcpu_ran, cpu) = -1;
+
        ret = kvm_alloc_stage2_pgd(kvm);
        if (ret)
                goto out_fail_alloc;
@@ -141,6 +148,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 out_free_stage2_pgd:
        kvm_free_stage2_pgd(kvm);
 out_fail_alloc:
+       free_percpu(kvm->arch.last_vcpu_ran);
+       kvm->arch.last_vcpu_ran = NULL;
        return ret;
 }
 
@@ -168,6 +177,9 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 {
        int i;
 
+       free_percpu(kvm->arch.last_vcpu_ran);
+       kvm->arch.last_vcpu_ran = NULL;
+
        for (i = 0; i < KVM_MAX_VCPUS; ++i) {
                if (kvm->vcpus[i]) {
                        kvm_arch_vcpu_free(kvm->vcpus[i]);
@@ -312,6 +324,19 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 
 void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 {
+       int *last_ran;
+
+       last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran);
+
+       /*
+        * We might get preempted before the vCPU actually runs, but
+        * over-invalidation doesn't affect correctness.
+        */
+       if (*last_ran != vcpu->vcpu_id) {
+               kvm_call_hyp(__kvm_tlb_flush_local_vmid, vcpu);
+               *last_ran = vcpu->vcpu_id;
+       }
+
        vcpu->cpu = cpu;
        vcpu->arch.host_cpu_context = this_cpu_ptr(kvm_host_cpu_state);
 
index 729652854f9098d677bd59871452c7b8c1ea240b..6d810af2d9fd7c630603ee5bfa8108c42a9992d8 100644 (file)
@@ -55,6 +55,21 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
        __kvm_tlb_flush_vmid(kvm);
 }
 
+void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
+{
+       struct kvm *kvm = kern_hyp_va(kern_hyp_va(vcpu)->kvm);
+
+       /* Switch to requested VMID */
+       write_sysreg(kvm->arch.vttbr, VTTBR);
+       isb();
+
+       write_sysreg(0, TLBIALL);
+       dsb(nsh);
+       isb();
+
+       write_sysreg(0, VTTBR);
+}
+
 void __hyp_text __kvm_flush_vm_context(void)
 {
        write_sysreg(0, TLBIALLNSNHIS);
index b65c193dc64effabd9d50f00a2ea176dd083dabe..7afbfb0f96a3cc6459b709b623c916650d12bc49 100644 (file)
@@ -300,8 +300,11 @@ pcie0: pcie@f8000000 {
                ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x600000
                          0x81000000 0x0 0xfa600000 0x0 0xfa600000 0x0 0x100000>;
                resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>,
-                        <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>;
-               reset-names = "core", "mgmt", "mgmt-sticky", "pipe";
+                        <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>,
+                        <&cru SRST_PCIE_PM>, <&cru SRST_P_PCIE>,
+                        <&cru SRST_A_PCIE>;
+               reset-names = "core", "mgmt", "mgmt-sticky", "pipe",
+                             "pm", "pclk", "aclk";
                status = "disabled";
 
                pcie0_intc: interrupt-controller {
index 39feb85a6931093b064fa548b1778808186d0924..6e1cb8c5af4d6465e81fbdce2e2bd61920cb41e9 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __ASM_ALTERNATIVE_H
 #define __ASM_ALTERNATIVE_H
 
-#include <asm/cpufeature.h>
+#include <asm/cpucaps.h>
 #include <asm/insn.h>
 
 #ifndef __ASSEMBLY__
diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h
new file mode 100644 (file)
index 0000000..87b4465
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * arch/arm64/include/asm/cpucaps.h
+ *
+ * Copyright (C) 2016 ARM Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __ASM_CPUCAPS_H
+#define __ASM_CPUCAPS_H
+
+#define ARM64_WORKAROUND_CLEAN_CACHE           0
+#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE   1
+#define ARM64_WORKAROUND_845719                        2
+#define ARM64_HAS_SYSREG_GIC_CPUIF             3
+#define ARM64_HAS_PAN                          4
+#define ARM64_HAS_LSE_ATOMICS                  5
+#define ARM64_WORKAROUND_CAVIUM_23154          6
+#define ARM64_WORKAROUND_834220                        7
+#define ARM64_HAS_NO_HW_PREFETCH               8
+#define ARM64_HAS_UAO                          9
+#define ARM64_ALT_PAN_NOT_UAO                  10
+#define ARM64_HAS_VIRT_HOST_EXTN               11
+#define ARM64_WORKAROUND_CAVIUM_27456          12
+#define ARM64_HAS_32BIT_EL0                    13
+#define ARM64_HYP_OFFSET_LOW                   14
+#define ARM64_MISMATCHED_CACHE_LINE_SIZE       15
+
+#define ARM64_NCAPS                            16
+
+#endif /* __ASM_CPUCAPS_H */
index a27c3245ba218d7849f97a084265a9cf1168a01b..0bc0b1de90c452b369c8562e252d841bb9590a90 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/jump_label.h>
 
+#include <asm/cpucaps.h>
 #include <asm/hwcap.h>
 #include <asm/sysreg.h>
 
 #define MAX_CPU_FEATURES       (8 * sizeof(elf_hwcap))
 #define cpu_feature(x)         ilog2(HWCAP_ ## x)
 
-#define ARM64_WORKAROUND_CLEAN_CACHE           0
-#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE   1
-#define ARM64_WORKAROUND_845719                        2
-#define ARM64_HAS_SYSREG_GIC_CPUIF             3
-#define ARM64_HAS_PAN                          4
-#define ARM64_HAS_LSE_ATOMICS                  5
-#define ARM64_WORKAROUND_CAVIUM_23154          6
-#define ARM64_WORKAROUND_834220                        7
-#define ARM64_HAS_NO_HW_PREFETCH               8
-#define ARM64_HAS_UAO                          9
-#define ARM64_ALT_PAN_NOT_UAO                  10
-#define ARM64_HAS_VIRT_HOST_EXTN               11
-#define ARM64_WORKAROUND_CAVIUM_27456          12
-#define ARM64_HAS_32BIT_EL0                    13
-#define ARM64_HYP_OFFSET_LOW                   14
-#define ARM64_MISMATCHED_CACHE_LINE_SIZE       15
-
-#define ARM64_NCAPS                            16
-
 #ifndef __ASSEMBLY__
 
 #include <linux/kernel.h>
index 18f746551bf632cc88a3a406359463e9d49340eb..ec3553eb9349093a9c7675f7fbe4de38dba396c7 100644 (file)
@@ -54,6 +54,7 @@ extern char __kvm_hyp_vector[];
 extern void __kvm_flush_vm_context(void);
 extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
 extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
+extern void __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu);
 
 extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
 
index bd94e67667599dc1ce499ab30de2cca91f4e97be..e5050388e062209868bac64cab1740ece15b3e13 100644 (file)
@@ -62,6 +62,9 @@ struct kvm_arch {
        /* VTTBR value associated with above pgd and vmid */
        u64    vttbr;
 
+       /* The last vcpu id that ran on each physical CPU */
+       int __percpu *last_vcpu_ran;
+
        /* The maximum number of vCPUs depends on the used GIC model */
        int max_vcpus;
 
index a79b969c26fca7dcd73e06c4bfc36c6519cb646b..6f72fe8b0e3ee477a076fa5f9ef02d13c3d8eef3 100644 (file)
@@ -128,7 +128,7 @@ static inline unsigned long __kern_hyp_va(unsigned long v)
        return v;
 }
 
-#define kern_hyp_va(v)         (typeof(v))(__kern_hyp_va((unsigned long)(v)))
+#define kern_hyp_va(v)         ((typeof(v))(__kern_hyp_va((unsigned long)(v))))
 
 /*
  * We currently only support a 40bit IPA.
index 23acc00be32d019a9f0f71b75153b5b32996b083..fc756e22c84cd718278d4f0ba8ebc6a32ff4739e 100644 (file)
@@ -5,7 +5,6 @@
 
 #include <linux/stringify.h>
 #include <asm/alternative.h>
-#include <asm/cpufeature.h>
 
 #ifdef __ASSEMBLER__
 
index 9cc0ea784ae60a0a5086f1c5f6d129cd7d360f13..88e2f2b938f070c7570a8d76ae9ca348b1fd71e9 100644 (file)
@@ -64,6 +64,21 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm)
        write_sysreg(0, vttbr_el2);
 }
 
+void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
+{
+       struct kvm *kvm = kern_hyp_va(kern_hyp_va(vcpu)->kvm);
+
+       /* Switch to requested VMID */
+       write_sysreg(kvm->arch.vttbr, vttbr_el2);
+       isb();
+
+       asm volatile("tlbi vmalle1" : : );
+       dsb(nsh);
+       isb();
+
+       write_sysreg(0, vttbr_el2);
+}
+
 void __hyp_text __kvm_flush_vm_context(void)
 {
        dsb(ishst);
index d9563ddb337eab4e44d052ebd285206b09788f13..746bf5caaffc7989884813b16bc3fd3fce85d0ef 100644 (file)
@@ -324,6 +324,7 @@ static int __init nios2_time_init(struct device_node *timer)
                ret = nios2_clocksource_init(timer);
                break;
        default:
+               ret = 0;
                break;
        }
 
index 4ce7a01a252dc6a2c191917e2516a5ffe27aa1d1..5f55da9cbfd5ce8ff72d9baea51671bcedd44732 100644 (file)
@@ -23,6 +23,8 @@
  * they shouldn't be hard-coded!
  */
 
+#define __ro_after_init __read_mostly
+
 #define L1_CACHE_BYTES 16
 #define L1_CACHE_SHIFT 4
 
index 28f03ca60100a3399b501721851b789871c787e2..794bebb43d23d285370138d70bef7aab8a1e905a 100644 (file)
@@ -363,11 +363,11 @@ static void *diag204_store(void)
 static int diag224_get_name_table(void)
 {
        /* memory must be below 2GB */
-       diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
+       diag224_cpu_names = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
        if (!diag224_cpu_names)
                return -ENOMEM;
        if (diag224(diag224_cpu_names)) {
-               kfree(diag224_cpu_names);
+               free_page((unsigned long) diag224_cpu_names);
                return -EOPNOTSUPP;
        }
        EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
@@ -376,7 +376,7 @@ static int diag224_get_name_table(void)
 
 static void diag224_delete_name_table(void)
 {
-       kfree(diag224_cpu_names);
+       free_page((unsigned long) diag224_cpu_names);
 }
 
 static int diag224_idx2name(int index, char *name)
index 000e6e91f6a0630c53f35519d450fccf02479e55..3667d20e997f3ccac943438ad2e03588795afb33 100644 (file)
@@ -62,9 +62,11 @@ SECTIONS
 
        . = ALIGN(PAGE_SIZE);
        __start_ro_after_init = .;
+       __start_data_ro_after_init = .;
        .data..ro_after_init : {
                 *(.data..ro_after_init)
        }
+       __end_data_ro_after_init = .;
        EXCEPTION_TABLE(16)
        . = ALIGN(PAGE_SIZE);
        __end_ro_after_init = .;
index 7350c8bc13a290ca362ad25b69cdb050c72ab3f4..6b2f72f523b91bb6c68347602b33ca2446807229 100644 (file)
@@ -423,7 +423,7 @@ static int __s390_dma_map_sg(struct device *dev, struct scatterlist *sg,
        dma_addr_t dma_addr_base, dma_addr;
        int flags = ZPCI_PTE_VALID;
        struct scatterlist *s;
-       unsigned long pa;
+       unsigned long pa = 0;
        int ret;
 
        size = PAGE_ALIGN(size);
index 0ab5ee1c26af057d9965470d42d5a9edd65c9ae7..aa8b0672f87a451865283f5f3e9f3d2c03992870 100644 (file)
@@ -888,7 +888,7 @@ static int helper_rfc4106_encrypt(struct aead_request *req)
        unsigned long auth_tag_len = crypto_aead_authsize(tfm);
        u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
        struct scatter_walk src_sg_walk;
-       struct scatter_walk dst_sg_walk;
+       struct scatter_walk dst_sg_walk = {};
        unsigned int i;
 
        /* Assuming we are supporting rfc4106 64-bit extended */
@@ -968,7 +968,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req)
        u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
        u8 authTag[16];
        struct scatter_walk src_sg_walk;
-       struct scatter_walk dst_sg_walk;
+       struct scatter_walk dst_sg_walk = {};
        unsigned int i;
 
        if (unlikely(req->assoclen != 16 && req->assoclen != 20))
index 5f845eef9a4d682a3598c13946dbdec9fb70adeb..81195cca7eaecb5da2ff7924ea0a0e5d994c27cf 100644 (file)
@@ -8,8 +8,12 @@
 #define PCI_DEVICE_ID_INTEL_HSW_IMC    0x0c00
 #define PCI_DEVICE_ID_INTEL_HSW_U_IMC  0x0a04
 #define PCI_DEVICE_ID_INTEL_BDW_IMC    0x1604
-#define PCI_DEVICE_ID_INTEL_SKL_IMC    0x191f
-#define PCI_DEVICE_ID_INTEL_SKL_U_IMC  0x190c
+#define PCI_DEVICE_ID_INTEL_SKL_U_IMC  0x1904
+#define PCI_DEVICE_ID_INTEL_SKL_Y_IMC  0x190c
+#define PCI_DEVICE_ID_INTEL_SKL_HD_IMC 0x1900
+#define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910
+#define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f
+#define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f
 
 /* SNB event control */
 #define SNB_UNC_CTL_EV_SEL_MASK                        0x000000ff
@@ -616,13 +620,29 @@ static const struct pci_device_id bdw_uncore_pci_ids[] = {
 
 static const struct pci_device_id skl_uncore_pci_ids[] = {
        { /* IMC */
-               PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_IMC),
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_Y_IMC),
                .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
        },
        { /* IMC */
                PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_U_IMC),
                .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
        },
+       { /* IMC */
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_HD_IMC),
+               .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
+       },
+       { /* IMC */
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_HQ_IMC),
+               .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
+       },
+       { /* IMC */
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SD_IMC),
+               .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
+       },
+       { /* IMC */
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC),
+               .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
+       },
 
        { /* end: all zeroes */ },
 };
@@ -666,8 +686,12 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = {
        IMC_DEV(HSW_IMC, &hsw_uncore_pci_driver),    /* 4th Gen Core Processor */
        IMC_DEV(HSW_U_IMC, &hsw_uncore_pci_driver),  /* 4th Gen Core ULT Mobile Processor */
        IMC_DEV(BDW_IMC, &bdw_uncore_pci_driver),    /* 5th Gen Core U */
-       IMC_DEV(SKL_IMC, &skl_uncore_pci_driver),    /* 6th Gen Core */
+       IMC_DEV(SKL_Y_IMC, &skl_uncore_pci_driver),  /* 6th Gen Core Y */
        IMC_DEV(SKL_U_IMC, &skl_uncore_pci_driver),  /* 6th Gen Core U */
+       IMC_DEV(SKL_HD_IMC, &skl_uncore_pci_driver),  /* 6th Gen Core H Dual Core */
+       IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver),  /* 6th Gen Core H Quad Core */
+       IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver),  /* 6th Gen Core S Dual Core */
+       IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver),  /* 6th Gen Core S Quad Core */
        {  /* end marker */ }
 };
 
index c7364bd633e1d8c1a346c69534ded295bc2ba48d..51287cd90bf65f4ffa6215c4dea0c112aa5f6697 100644 (file)
@@ -1042,8 +1042,11 @@ static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
 
        if (apm_info.get_power_status_broken)
                return APM_32_UNSUPPORTED;
-       if (apm_bios_call(&call))
+       if (apm_bios_call(&call)) {
+               if (!call.err)
+                       return APM_NO_ERROR;
                return call.err;
+       }
        *status = call.ebx;
        *bat = call.ecx;
        if (apm_info.get_power_status_swabinminutes) {
index bf99aa7005eb3eda505893352be0bd6a02f312b1..936a488d6cf6df3c2aadbbdbc036b8eb06701cb0 100644 (file)
@@ -861,7 +861,7 @@ static void __init __efi_enter_virtual_mode(void)
        int count = 0, pg_shift = 0;
        void *new_memmap = NULL;
        efi_status_t status;
-       phys_addr_t pa;
+       unsigned long pa;
 
        efi.systab = NULL;
 
index 58b0f801f66f97212fb9904c77d88ad44c2703de..319148bd4b05091d24576a7535b10aad7bec0c2d 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/io.h>
 #include <linux/reboot.h>
 #include <linux/slab.h>
+#include <linux/ucs2_string.h>
 
 #include <asm/setup.h>
 #include <asm/page.h>
@@ -211,6 +212,35 @@ void efi_sync_low_kernel_mappings(void)
        memcpy(pud_efi, pud_k, sizeof(pud_t) * num_entries);
 }
 
+/*
+ * Wrapper for slow_virt_to_phys() that handles NULL addresses.
+ */
+static inline phys_addr_t
+virt_to_phys_or_null_size(void *va, unsigned long size)
+{
+       bool bad_size;
+
+       if (!va)
+               return 0;
+
+       if (virt_addr_valid(va))
+               return virt_to_phys(va);
+
+       /*
+        * A fully aligned variable on the stack is guaranteed not to
+        * cross a page bounary. Try to catch strings on the stack by
+        * checking that 'size' is a power of two.
+        */
+       bad_size = size > PAGE_SIZE || !is_power_of_2(size);
+
+       WARN_ON(!IS_ALIGNED((unsigned long)va, size) || bad_size);
+
+       return slow_virt_to_phys(va);
+}
+
+#define virt_to_phys_or_null(addr)                             \
+       virt_to_phys_or_null_size((addr), sizeof(*(addr)))
+
 int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
 {
        unsigned long pfn, text;
@@ -494,8 +524,8 @@ static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 
        spin_lock(&rtc_lock);
 
-       phys_tm = virt_to_phys(tm);
-       phys_tc = virt_to_phys(tc);
+       phys_tm = virt_to_phys_or_null(tm);
+       phys_tc = virt_to_phys_or_null(tc);
 
        status = efi_thunk(get_time, phys_tm, phys_tc);
 
@@ -511,7 +541,7 @@ static efi_status_t efi_thunk_set_time(efi_time_t *tm)
 
        spin_lock(&rtc_lock);
 
-       phys_tm = virt_to_phys(tm);
+       phys_tm = virt_to_phys_or_null(tm);
 
        status = efi_thunk(set_time, phys_tm);
 
@@ -529,9 +559,9 @@ efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
 
        spin_lock(&rtc_lock);
 
-       phys_enabled = virt_to_phys(enabled);
-       phys_pending = virt_to_phys(pending);
-       phys_tm = virt_to_phys(tm);
+       phys_enabled = virt_to_phys_or_null(enabled);
+       phys_pending = virt_to_phys_or_null(pending);
+       phys_tm = virt_to_phys_or_null(tm);
 
        status = efi_thunk(get_wakeup_time, phys_enabled,
                             phys_pending, phys_tm);
@@ -549,7 +579,7 @@ efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
 
        spin_lock(&rtc_lock);
 
-       phys_tm = virt_to_phys(tm);
+       phys_tm = virt_to_phys_or_null(tm);
 
        status = efi_thunk(set_wakeup_time, enabled, phys_tm);
 
@@ -558,6 +588,10 @@ efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
        return status;
 }
 
+static unsigned long efi_name_size(efi_char16_t *name)
+{
+       return ucs2_strsize(name, EFI_VAR_NAME_LEN) + 1;
+}
 
 static efi_status_t
 efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
@@ -567,11 +601,11 @@ efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
        u32 phys_name, phys_vendor, phys_attr;
        u32 phys_data_size, phys_data;
 
-       phys_data_size = virt_to_phys(data_size);
-       phys_vendor = virt_to_phys(vendor);
-       phys_name = virt_to_phys(name);
-       phys_attr = virt_to_phys(attr);
-       phys_data = virt_to_phys(data);
+       phys_data_size = virt_to_phys_or_null(data_size);
+       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
+       phys_attr = virt_to_phys_or_null(attr);
+       phys_data = virt_to_phys_or_null_size(data, *data_size);
 
        status = efi_thunk(get_variable, phys_name, phys_vendor,
                           phys_attr, phys_data_size, phys_data);
@@ -586,9 +620,9 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
        u32 phys_name, phys_vendor, phys_data;
        efi_status_t status;
 
-       phys_name = virt_to_phys(name);
-       phys_vendor = virt_to_phys(vendor);
-       phys_data = virt_to_phys(data);
+       phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
+       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_data = virt_to_phys_or_null_size(data, data_size);
 
        /* If data_size is > sizeof(u32) we've got problems */
        status = efi_thunk(set_variable, phys_name, phys_vendor,
@@ -605,9 +639,9 @@ efi_thunk_get_next_variable(unsigned long *name_size,
        efi_status_t status;
        u32 phys_name_size, phys_name, phys_vendor;
 
-       phys_name_size = virt_to_phys(name_size);
-       phys_vendor = virt_to_phys(vendor);
-       phys_name = virt_to_phys(name);
+       phys_name_size = virt_to_phys_or_null(name_size);
+       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_name = virt_to_phys_or_null_size(name, *name_size);
 
        status = efi_thunk(get_next_variable, phys_name_size,
                           phys_name, phys_vendor);
@@ -621,7 +655,7 @@ efi_thunk_get_next_high_mono_count(u32 *count)
        efi_status_t status;
        u32 phys_count;
 
-       phys_count = virt_to_phys(count);
+       phys_count = virt_to_phys_or_null(count);
        status = efi_thunk(get_next_high_mono_count, phys_count);
 
        return status;
@@ -633,7 +667,7 @@ efi_thunk_reset_system(int reset_type, efi_status_t status,
 {
        u32 phys_data;
 
-       phys_data = virt_to_phys(data);
+       phys_data = virt_to_phys_or_null_size(data, data_size);
 
        efi_thunk(reset_system, reset_type, status, data_size, phys_data);
 }
@@ -661,9 +695,9 @@ efi_thunk_query_variable_info(u32 attr, u64 *storage_space,
        if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
                return EFI_UNSUPPORTED;
 
-       phys_storage = virt_to_phys(storage_space);
-       phys_remaining = virt_to_phys(remaining_space);
-       phys_max = virt_to_phys(max_variable_size);
+       phys_storage = virt_to_phys_or_null(storage_space);
+       phys_remaining = virt_to_phys_or_null(remaining_space);
+       phys_max = virt_to_phys_or_null(max_variable_size);
 
        status = efi_thunk(query_variable_info, attr, phys_storage,
                           phys_remaining, phys_max);
index d58fbf7f04e6c7f4d901f648d9f26a0708cc6f15..7dd70927991e7e9e0de14a3af89db442eca8d175 100644 (file)
@@ -122,7 +122,7 @@ static int acpi_apd_create_device(struct acpi_device *adev,
        int ret;
 
        if (!dev_desc) {
-               pdev = acpi_create_platform_device(adev);
+               pdev = acpi_create_platform_device(adev, NULL);
                return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
        }
 
@@ -139,14 +139,8 @@ static int acpi_apd_create_device(struct acpi_device *adev,
                        goto err_out;
        }
 
-       if (dev_desc->properties) {
-               ret = device_add_properties(&adev->dev, dev_desc->properties);
-               if (ret)
-                       goto err_out;
-       }
-
        adev->driver_data = pdata;
-       pdev = acpi_create_platform_device(adev);
+       pdev = acpi_create_platform_device(adev, dev_desc->properties);
        if (!IS_ERR_OR_NULL(pdev))
                return 1;
 
index 5520102881357e005361ffd879dc7a245d2fd253..373657f7e35a9cac3a2a951cd030c00ef6fbd06d 100644 (file)
@@ -395,7 +395,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
 
        dev_desc = (const struct lpss_device_desc *)id->driver_data;
        if (!dev_desc) {
-               pdev = acpi_create_platform_device(adev);
+               pdev = acpi_create_platform_device(adev, NULL);
                return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
        }
        pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
@@ -451,14 +451,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
                goto err_out;
        }
 
-       if (dev_desc->properties) {
-               ret = device_add_properties(&adev->dev, dev_desc->properties);
-               if (ret)
-                       goto err_out;
-       }
-
        adev->driver_data = pdata;
-       pdev = acpi_create_platform_device(adev);
+       pdev = acpi_create_platform_device(adev, dev_desc->properties);
        if (!IS_ERR_OR_NULL(pdev)) {
                return 1;
        }
index b200ae1f3c6fb0fbef0a38135fd0b27e6da45041..b4c1a6a51da482a953051959279fc9d39cd29d49 100644 (file)
@@ -50,6 +50,7 @@ static void acpi_platform_fill_resource(struct acpi_device *adev,
 /**
  * acpi_create_platform_device - Create platform device for ACPI device node
  * @adev: ACPI device node to create a platform device for.
+ * @properties: Optional collection of build-in properties.
  *
  * Check if the given @adev can be represented as a platform device and, if
  * that's the case, create and register a platform device, populate its common
@@ -57,7 +58,8 @@ static void acpi_platform_fill_resource(struct acpi_device *adev,
  *
  * Name of the platform device will be the same as @adev's.
  */
-struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
+struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
+                                       struct property_entry *properties)
 {
        struct platform_device *pdev = NULL;
        struct platform_device_info pdevinfo;
@@ -106,6 +108,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
        pdevinfo.res = resources;
        pdevinfo.num_res = count;
        pdevinfo.fwnode = acpi_fwnode_handle(adev);
+       pdevinfo.properties = properties;
 
        if (acpi_dma_supported(adev))
                pdevinfo.dma_mask = DMA_BIT_MASK(32);
index 33505c651f62792e136cedc73a8b022c10f2ba21..86364097e236e5d2d7d99b4e4e94f67b7560ebfd 100644 (file)
@@ -34,11 +34,11 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev,
                                        const struct acpi_device_id *id)
 {
        if (IS_ENABLED(CONFIG_INT340X_THERMAL))
-               acpi_create_platform_device(adev);
+               acpi_create_platform_device(adev, NULL);
        /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */
        else if (IS_ENABLED(CONFIG_INTEL_SOC_DTS_THERMAL) &&
                 id->driver_data == INT3401_DEVICE)
-               acpi_create_platform_device(adev);
+               acpi_create_platform_device(adev, NULL);
        return 1;
 }
 
index 035ac646d8db55272bf2182f690e0452b8d7a485..3d1856f1f4d03eb8c47e5e4043684d7b5b76b046 100644 (file)
@@ -1734,7 +1734,7 @@ static void acpi_default_enumeration(struct acpi_device *device)
                               &is_spi_i2c_slave);
        acpi_dev_free_resource_list(&resource_list);
        if (!is_spi_i2c_slave) {
-               acpi_create_platform_device(device);
+               acpi_create_platform_device(device, NULL);
                acpi_device_set_enumerated(device);
        } else {
                blocking_notifier_call_chain(&acpi_reconfig_chain,
index d22a7260f42b26f498037f35c943b547300181dc..d76cd97a98b6badff85740180dfec97c8966754a 100644 (file)
@@ -324,7 +324,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 {
        int ret = -EPROBE_DEFER;
        int local_trigger_count = atomic_read(&deferred_trigger_count);
-       bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE);
+       bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
+                          !drv->suppress_bind_attrs;
 
        if (defer_all_probes) {
                /*
@@ -383,7 +384,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
        if (test_remove) {
                test_remove = false;
 
-               if (dev->bus && dev->bus->remove)
+               if (dev->bus->remove)
                        dev->bus->remove(dev);
                else if (drv->remove)
                        drv->remove(dev);
index e44944f4be77d0a573e4e46850849b52ba09a349..2932a5bd892f7e2b400d5b806c7df36b3cdc30a8 100644 (file)
@@ -1027,6 +1027,8 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
        TRACE_DEVICE(dev);
        TRACE_SUSPEND(0);
 
+       dpm_wait_for_children(dev, async);
+
        if (async_error)
                goto Complete;
 
@@ -1038,8 +1040,6 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a
        if (dev->power.syscore || dev->power.direct_complete)
                goto Complete;
 
-       dpm_wait_for_children(dev, async);
-
        if (dev->pm_domain) {
                info = "noirq power domain ";
                callback = pm_noirq_op(&dev->pm_domain->ops, state);
@@ -1174,6 +1174,8 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
 
        __pm_runtime_disable(dev, false);
 
+       dpm_wait_for_children(dev, async);
+
        if (async_error)
                goto Complete;
 
@@ -1185,8 +1187,6 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
        if (dev->power.syscore || dev->power.direct_complete)
                goto Complete;
 
-       dpm_wait_for_children(dev, async);
-
        if (dev->pm_domain) {
                info = "late power domain ";
                callback = pm_late_early_op(&dev->pm_domain->ops, state);
index ab19adb07a126ae0cae4f0d37170a2929367b115..3c606c09fd5acbd2897c680c3249929f30b6a9a8 100644 (file)
@@ -853,45 +853,6 @@ rqbiocnt(struct request *r)
        return n;
 }
 
-/* This can be removed if we are certain that no users of the block
- * layer will ever use zero-count pages in bios.  Otherwise we have to
- * protect against the put_page sometimes done by the network layer.
- *
- * See http://oss.sgi.com/archives/xfs/2007-01/msg00594.html for
- * discussion.
- *
- * We cannot use get_page in the workaround, because it insists on a
- * positive page count as a precondition.  So we use _refcount directly.
- */
-static void
-bio_pageinc(struct bio *bio)
-{
-       struct bio_vec bv;
-       struct page *page;
-       struct bvec_iter iter;
-
-       bio_for_each_segment(bv, bio, iter) {
-               /* Non-zero page count for non-head members of
-                * compound pages is no longer allowed by the kernel.
-                */
-               page = compound_head(bv.bv_page);
-               page_ref_inc(page);
-       }
-}
-
-static void
-bio_pagedec(struct bio *bio)
-{
-       struct page *page;
-       struct bio_vec bv;
-       struct bvec_iter iter;
-
-       bio_for_each_segment(bv, bio, iter) {
-               page = compound_head(bv.bv_page);
-               page_ref_dec(page);
-       }
-}
-
 static void
 bufinit(struct buf *buf, struct request *rq, struct bio *bio)
 {
@@ -899,7 +860,6 @@ bufinit(struct buf *buf, struct request *rq, struct bio *bio)
        buf->rq = rq;
        buf->bio = bio;
        buf->iter = bio->bi_iter;
-       bio_pageinc(bio);
 }
 
 static struct buf *
@@ -1127,7 +1087,6 @@ aoe_end_buf(struct aoedev *d, struct buf *buf)
        if (buf == d->ip.buf)
                d->ip.buf = NULL;
        rq = buf->rq;
-       bio_pagedec(buf->bio);
        mempool_free(buf, d->bufpool);
        n = (unsigned long) rq->special;
        rq->special = (void *) --n;
index 100be556e6137ce1e5731fd68eec5b317ed3bcc8..83482721bc012739cf25ee627fd2b85b2fd094ab 100644 (file)
@@ -1871,7 +1871,7 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock,
                drbd_update_congested(connection);
        }
        do {
-               rv = kernel_sendmsg(sock, &msg, &iov, 1, size);
+               rv = kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len);
                if (rv == -EAGAIN) {
                        if (we_should_drop_the_connection(connection, sock))
                                break;
index 19a16b2dbb917afea67225290ee2d8da654db41d..7a104875591400a896ab3025e5feb4e37ec3e86a 100644 (file)
@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
                        return -EINVAL;
 
                sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0);
-               if (!sreq)
+               if (IS_ERR(sreq))
                        return -ENOMEM;
 
                mutex_unlock(&nbd->tx_lock);
index d23368874710f726d485917e4d3f1ef93f3e3843..6af1ce04b3dac9ab1fd2e20d52d1930e6798502b 100644 (file)
@@ -748,10 +748,7 @@ static int pp_release(struct inode *inode, struct file *file)
        }
 
        if (pp->pdev) {
-               const char *name = pp->pdev->name;
-
                parport_unregister_device(pp->pdev);
-               kfree(name);
                pp->pdev = NULL;
                pr_debug(CHRDEV "%x: unregistered pardevice\n", minor);
        }
index 20b105584f82fb9bad9ba17ec4b1a6136affc656..80ae2a51452d7410c1edc856f8126d6451c75913 100644 (file)
@@ -700,6 +700,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
                                             struct mux_hwclock *hwc,
                                             const struct clk_ops *ops,
                                             unsigned long min_rate,
+                                            unsigned long max_rate,
                                             unsigned long pct80_rate,
                                             const char *fmt, int idx)
 {
@@ -728,6 +729,8 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
                        continue;
                if (rate < min_rate)
                        continue;
+               if (rate > max_rate)
+                       continue;
 
                parent_names[j] = div->name;
                hwc->parent_to_clksel[j] = i;
@@ -759,7 +762,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
        struct mux_hwclock *hwc;
        const struct clockgen_pll_div *div;
        unsigned long plat_rate, min_rate;
-       u64 pct80_rate;
+       u64 max_rate, pct80_rate;
        u32 clksel;
 
        hwc = kzalloc(sizeof(*hwc), GFP_KERNEL);
@@ -787,8 +790,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
                return NULL;
        }
 
-       pct80_rate = clk_get_rate(div->clk);
-       pct80_rate *= 8;
+       max_rate = clk_get_rate(div->clk);
+       pct80_rate = max_rate * 8;
        do_div(pct80_rate, 10);
 
        plat_rate = clk_get_rate(cg->pll[PLATFORM_PLL].div[PLL_DIV1].clk);
@@ -798,7 +801,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
        else
                min_rate = plat_rate / 2;
 
-       return create_mux_common(cg, hwc, &cmux_ops, min_rate,
+       return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate,
                                 pct80_rate, "cg-cmux%d", idx);
 }
 
@@ -813,7 +816,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
        hwc->reg = cg->regs + 0x20 * idx + 0x10;
        hwc->info = cg->info.hwaccel[idx];
 
-       return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0,
+       return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0,
                                 "cg-hwaccel%d", idx);
 }
 
index 5daddf5ecc4b2ca403203d5e5cae5eabf825915f..bc37030e38ba62833316302a383d86cdfd671921 100644 (file)
@@ -463,22 +463,20 @@ static int xgene_clk_enable(struct clk_hw *hw)
        struct xgene_clk *pclk = to_xgene_clk(hw);
        unsigned long flags = 0;
        u32 data;
-       phys_addr_t reg;
 
        if (pclk->lock)
                spin_lock_irqsave(pclk->lock, flags);
 
        if (pclk->param.csr_reg != NULL) {
                pr_debug("%s clock enabled\n", clk_hw_get_name(hw));
-               reg = __pa(pclk->param.csr_reg);
                /* First enable the clock */
                data = xgene_clk_read(pclk->param.csr_reg +
                                        pclk->param.reg_clk_offset);
                data |= pclk->param.reg_clk_mask;
                xgene_clk_write(data, pclk->param.csr_reg +
                                        pclk->param.reg_clk_offset);
-               pr_debug("%s clock PADDR base %pa clk offset 0x%08X mask 0x%08X value 0x%08X\n",
-                       clk_hw_get_name(hw), &reg,
+               pr_debug("%s clk offset 0x%08X mask 0x%08X value 0x%08X\n",
+                       clk_hw_get_name(hw),
                        pclk->param.reg_clk_offset, pclk->param.reg_clk_mask,
                        data);
 
@@ -488,8 +486,8 @@ static int xgene_clk_enable(struct clk_hw *hw)
                data &= ~pclk->param.reg_csr_mask;
                xgene_clk_write(data, pclk->param.csr_reg +
                                        pclk->param.reg_csr_offset);
-               pr_debug("%s CSR RESET PADDR base %pa csr offset 0x%08X mask 0x%08X value 0x%08X\n",
-                       clk_hw_get_name(hw), &reg,
+               pr_debug("%s csr offset 0x%08X mask 0x%08X value 0x%08X\n",
+                       clk_hw_get_name(hw),
                        pclk->param.reg_csr_offset, pclk->param.reg_csr_mask,
                        data);
        }
index 19f9b622981a5281bc375a756d437cc117c63640..7a6acc3e4a927c1ae874bdb74bbe826284602c3a 100644 (file)
@@ -223,7 +223,7 @@ static unsigned long clk_pllv3_av_recalc_rate(struct clk_hw *hw,
        temp64 *= mfn;
        do_div(temp64, mfd);
 
-       return (parent_rate * div) + (u32)temp64;
+       return parent_rate * div + (unsigned long)temp64;
 }
 
 static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
@@ -247,7 +247,11 @@ static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
        do_div(temp64, parent_rate);
        mfn = temp64;
 
-       return parent_rate * div + parent_rate * mfn / mfd;
+       temp64 = (u64)parent_rate;
+       temp64 *= mfn;
+       do_div(temp64, mfd);
+
+       return parent_rate * div + (unsigned long)temp64;
 }
 
 static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
index 3a51fff1b0e76b7bbebdbc969d7f1d67fe796887..9adaf48aea2317625a520bb42635fa8362946893 100644 (file)
@@ -313,7 +313,7 @@ static void __init mmp2_clk_init(struct device_node *np)
        }
 
        pxa_unit->apmu_base = of_iomap(np, 1);
-       if (!pxa_unit->mpmu_base) {
+       if (!pxa_unit->apmu_base) {
                pr_err("failed to map apmu registers\n");
                return;
        }
index 87f2317b2a005aca6aed18a39de7509010edd19e..f110c02e83cb6142c0653357f4c13d05b0f17018 100644 (file)
@@ -262,7 +262,7 @@ static void __init pxa168_clk_init(struct device_node *np)
        }
 
        pxa_unit->apmu_base = of_iomap(np, 1);
-       if (!pxa_unit->mpmu_base) {
+       if (!pxa_unit->apmu_base) {
                pr_err("failed to map apmu registers\n");
                return;
        }
index e22a67f76d932546eba42aec3b69be266d775238..64d1ef49caebedd9d35226afcec9e0a624f0965f 100644 (file)
@@ -282,7 +282,7 @@ static void __init pxa910_clk_init(struct device_node *np)
        }
 
        pxa_unit->apmu_base = of_iomap(np, 1);
-       if (!pxa_unit->mpmu_base) {
+       if (!pxa_unit->apmu_base) {
                pr_err("failed to map apmu registers\n");
                return;
        }
@@ -294,7 +294,7 @@ static void __init pxa910_clk_init(struct device_node *np)
        }
 
        pxa_unit->apbcp_base = of_iomap(np, 3);
-       if (!pxa_unit->mpmu_base) {
+       if (!pxa_unit->apbcp_base) {
                pr_err("failed to map apbcp registers\n");
                return;
        }
index 8feba93672c5e4248a98c7116887995756bc77f5..e8075359366b0d9ef9cf84611d6c36b19fc22c4a 100644 (file)
@@ -144,11 +144,8 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
        ddrclk->ddr_flag = ddr_flag;
 
        clk = clk_register(NULL, &ddrclk->hw);
-       if (IS_ERR(clk)) {
-               pr_err("%s: could not register ddrclk %s\n", __func__,  name);
+       if (IS_ERR(clk))
                kfree(ddrclk);
-               return NULL;
-       }
 
        return clk;
 }
index 96fab6cfb2027f805e8ed941012a464d58cbb3dd..6c6afb87b4ce3babf8d7625581a5f7a288b1a1d5 100644 (file)
@@ -132,28 +132,34 @@ static void __init exynos_clkout_init(struct device_node *node, u32 mux_mask)
        pr_err("%s: failed to register clkout clock\n", __func__);
 }
 
+/*
+ * We use CLK_OF_DECLARE_DRIVER initialization method to avoid setting
+ * the OF_POPULATED flag on the pmu device tree node, so later the
+ * Exynos PMU platform device can be properly probed with PMU driver.
+ */
+
 static void __init exynos4_clkout_init(struct device_node *node)
 {
        exynos_clkout_init(node, EXYNOS4_CLKOUT_MUX_MASK);
 }
-CLK_OF_DECLARE(exynos4210_clkout, "samsung,exynos4210-pmu",
+CLK_OF_DECLARE_DRIVER(exynos4210_clkout, "samsung,exynos4210-pmu",
                exynos4_clkout_init);
-CLK_OF_DECLARE(exynos4212_clkout, "samsung,exynos4212-pmu",
+CLK_OF_DECLARE_DRIVER(exynos4212_clkout, "samsung,exynos4212-pmu",
                exynos4_clkout_init);
-CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu",
+CLK_OF_DECLARE_DRIVER(exynos4412_clkout, "samsung,exynos4412-pmu",
                exynos4_clkout_init);
-CLK_OF_DECLARE(exynos3250_clkout, "samsung,exynos3250-pmu",
+CLK_OF_DECLARE_DRIVER(exynos3250_clkout, "samsung,exynos3250-pmu",
                exynos4_clkout_init);
 
 static void __init exynos5_clkout_init(struct device_node *node)
 {
        exynos_clkout_init(node, EXYNOS5_CLKOUT_MUX_MASK);
 }
-CLK_OF_DECLARE(exynos5250_clkout, "samsung,exynos5250-pmu",
+CLK_OF_DECLARE_DRIVER(exynos5250_clkout, "samsung,exynos5250-pmu",
                exynos5_clkout_init);
-CLK_OF_DECLARE(exynos5410_clkout, "samsung,exynos5410-pmu",
+CLK_OF_DECLARE_DRIVER(exynos5410_clkout, "samsung,exynos5410-pmu",
                exynos5_clkout_init);
-CLK_OF_DECLARE(exynos5420_clkout, "samsung,exynos5420-pmu",
+CLK_OF_DECLARE_DRIVER(exynos5420_clkout, "samsung,exynos5420-pmu",
                exynos5_clkout_init);
-CLK_OF_DECLARE(exynos5433_clkout, "samsung,exynos5433-pmu",
+CLK_OF_DECLARE_DRIVER(exynos5433_clkout, "samsung,exynos5433-pmu",
                exynos5_clkout_init);
index 892d60fb225b56b25d7a44edec959ab56f45ed90..2057683f7b5998d3641cf20af336838ee72d27d2 100644 (file)
@@ -395,9 +395,12 @@ static int acp_hw_fini(void *handle)
 {
        int i, ret;
        struct device *dev;
-
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* return early if no ACP */
+       if (!adev->acp.acp_genpd)
+               return 0;
+
        for (i = 0; i < ACP_DEVS ; i++) {
                dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i);
                ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev);
index 7a8bfa34682fdd8a92959d43328a7de058b42b7f..662976292535856d57dde4788364c20f7fba38e5 100644 (file)
@@ -795,10 +795,19 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
                if (!adev->pm.fw) {
                        switch (adev->asic_type) {
                        case CHIP_TOPAZ:
-                               strcpy(fw_name, "amdgpu/topaz_smc.bin");
+                               if (((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x81)) ||
+                                   ((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x83)) ||
+                                   ((adev->pdev->device == 0x6907) && (adev->pdev->revision == 0x87)))
+                                       strcpy(fw_name, "amdgpu/topaz_k_smc.bin");
+                               else
+                                       strcpy(fw_name, "amdgpu/topaz_smc.bin");
                                break;
                        case CHIP_TONGA:
-                               strcpy(fw_name, "amdgpu/tonga_smc.bin");
+                               if (((adev->pdev->device == 0x6939) && (adev->pdev->revision == 0xf1)) ||
+                                   ((adev->pdev->device == 0x6938) && (adev->pdev->revision == 0xf1)))
+                                       strcpy(fw_name, "amdgpu/tonga_k_smc.bin");
+                               else
+                                       strcpy(fw_name, "amdgpu/tonga_smc.bin");
                                break;
                        case CHIP_FIJI:
                                strcpy(fw_name, "amdgpu/fiji_smc.bin");
index e3281d4e3e414cc9d693932911215c6fc7216d6f..086aa5c9c6348c45888d0b732f9417c0ec964cbe 100644 (file)
@@ -769,7 +769,7 @@ static void amdgpu_connector_unregister(struct drm_connector *connector)
 {
        struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
 
-       if (amdgpu_connector->ddc_bus->has_aux) {
+       if (amdgpu_connector->ddc_bus && amdgpu_connector->ddc_bus->has_aux) {
                drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
                amdgpu_connector->ddc_bus->has_aux = false;
        }
index 71ed27eb3ddebd3d2463cc136fb268db74aceb60..02ff0747197c13e91ee378696a0fc46fe2b193f0 100644 (file)
@@ -735,8 +735,20 @@ static struct pci_driver amdgpu_kms_pci_driver = {
 
 static int __init amdgpu_init(void)
 {
-       amdgpu_sync_init();
-       amdgpu_fence_slab_init();
+       int r;
+
+       r = amdgpu_sync_init();
+       if (r)
+               goto error_sync;
+
+       r = amdgpu_fence_slab_init();
+       if (r)
+               goto error_fence;
+
+       r = amd_sched_fence_slab_init();
+       if (r)
+               goto error_sched;
+
        if (vgacon_text_force()) {
                DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
                return -EINVAL;
@@ -748,6 +760,15 @@ static int __init amdgpu_init(void)
        amdgpu_register_atpx_handler();
        /* let modprobe override vga console setting */
        return drm_pci_init(driver, pdriver);
+
+error_sched:
+       amdgpu_fence_slab_fini();
+
+error_fence:
+       amdgpu_sync_fini();
+
+error_sync:
+       return r;
 }
 
 static void __exit amdgpu_exit(void)
@@ -756,6 +777,7 @@ static void __exit amdgpu_exit(void)
        drm_pci_exit(driver, pdriver);
        amdgpu_unregister_atpx_handler();
        amdgpu_sync_fini();
+       amd_sched_fence_slab_fini();
        amdgpu_fence_slab_fini();
 }
 
index 203d98b00555762f1f4a0d5574617beabc2d6917..3938fca1ea8e5f4c69fd5e0746fcc7ec60c6d2f1 100644 (file)
@@ -99,6 +99,8 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
 
        if ((amdgpu_runtime_pm != 0) &&
            amdgpu_has_atpx() &&
+           (amdgpu_is_atpx_hybrid() ||
+            amdgpu_has_atpx_dgpu_power_cntl()) &&
            ((flags & AMD_IS_APU) == 0))
                flags |= AMD_IS_PX;
 
index 7c13090df7c0dec22585480405b0d7ef1daaa654..f62f1a74f890d0d806506f343bb14ec6090578e9 100644 (file)
@@ -80,7 +80,9 @@
 #include "dce_virtual.h"
 
 MODULE_FIRMWARE("amdgpu/topaz_smc.bin");
+MODULE_FIRMWARE("amdgpu/topaz_k_smc.bin");
 MODULE_FIRMWARE("amdgpu/tonga_smc.bin");
+MODULE_FIRMWARE("amdgpu/tonga_k_smc.bin");
 MODULE_FIRMWARE("amdgpu/fiji_smc.bin");
 MODULE_FIRMWARE("amdgpu/polaris10_smc.bin");
 MODULE_FIRMWARE("amdgpu/polaris10_smc_sk.bin");
index 14f8c1f4da3d7a385202f2e8ec24ee5e6ab0f3ad..0723758ed0650616ee111af60e9ac14287f73ae2 100644 (file)
@@ -272,7 +272,7 @@ bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hw
        PHM_FUNC_CHECK(hwmgr);
 
        if (hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration == NULL)
-               return -EINVAL;
+               return false;
 
        return hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration(hwmgr);
 }
index 2ba7937d254576137daf0a4992a5299f4909a835..e03dcb6ea9c17c0a3ea5dbf7dc547bf8b55464af 100644 (file)
@@ -710,8 +710,10 @@ int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
        uint32_t vol;
        int ret = 0;
 
-       if (hwmgr->chip_id < CHIP_POLARIS10) {
-               atomctrl_get_voltage_evv_on_sclk(hwmgr, voltage_type, sclk, id, voltage);
+       if (hwmgr->chip_id < CHIP_TONGA) {
+               ret = atomctrl_get_voltage_evv(hwmgr, id, voltage);
+       } else if (hwmgr->chip_id < CHIP_POLARIS10) {
+               ret = atomctrl_get_voltage_evv_on_sclk(hwmgr, voltage_type, sclk, id, voltage);
                if (*voltage >= 2000 || *voltage == 0)
                        *voltage = 1150;
        } else {
index 75854021f40337aa43c8f302dc880832b16167b3..b0c929dd8beb380a1742acbfd0ff652a2af84ada 100644 (file)
@@ -1460,19 +1460,19 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr)
        struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = NULL;
 
 
-       if (table_info == NULL)
-               return -EINVAL;
-
-       sclk_table = table_info->vdd_dep_on_sclk;
-
        for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) {
                vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i;
 
                if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) {
-                       if (0 == phm_get_sclk_for_voltage_evv(hwmgr,
+                       if ((hwmgr->pp_table_version == PP_TABLE_V1)
+                           && !phm_get_sclk_for_voltage_evv(hwmgr,
                                                table_info->vddgfx_lookup_table, vv_id, &sclk)) {
                                if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
                                                        PHM_PlatformCaps_ClockStretcher)) {
+                                       if (table_info == NULL)
+                                               return -EINVAL;
+                                       sclk_table = table_info->vdd_dep_on_sclk;
+
                                        for (j = 1; j < sclk_table->count; j++) {
                                                if (sclk_table->entries[j].clk == sclk &&
                                                                sclk_table->entries[j].cks_enable == 0) {
@@ -1498,12 +1498,15 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr)
                                }
                        }
                } else {
-
                        if ((hwmgr->pp_table_version == PP_TABLE_V0)
                                || !phm_get_sclk_for_voltage_evv(hwmgr,
                                        table_info->vddc_lookup_table, vv_id, &sclk)) {
                                if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
                                                PHM_PlatformCaps_ClockStretcher)) {
+                                       if (table_info == NULL)
+                                               return -EINVAL;
+                                       sclk_table = table_info->vdd_dep_on_sclk;
+
                                        for (j = 1; j < sclk_table->count; j++) {
                                                if (sclk_table->entries[j].clk == sclk &&
                                                                sclk_table->entries[j].cks_enable == 0) {
@@ -2133,9 +2136,11 @@ static int smu7_patch_limits_vddc(struct pp_hwmgr *hwmgr,
        struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
        if (tab) {
+               vddc = tab->vddc;
                smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddc,
                                                   &data->vddc_leakage);
                tab->vddc = vddc;
+               vddci = tab->vddci;
                smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddci,
                                                   &data->vddci_leakage);
                tab->vddci = vddci;
@@ -4228,18 +4233,26 @@ static int smu7_get_sclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks)
 {
        struct phm_ppt_v1_information *table_info =
                        (struct phm_ppt_v1_information *)hwmgr->pptable;
-       struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table;
+       struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = NULL;
+       struct phm_clock_voltage_dependency_table *sclk_table;
        int i;
 
-       if (table_info == NULL)
-               return -EINVAL;
-
-       dep_sclk_table = table_info->vdd_dep_on_sclk;
-
-       for (i = 0; i < dep_sclk_table->count; i++) {
-               clocks->clock[i] = dep_sclk_table->entries[i].clk;
-               clocks->count++;
+       if (hwmgr->pp_table_version == PP_TABLE_V1) {
+               if (table_info == NULL || table_info->vdd_dep_on_sclk == NULL)
+                       return -EINVAL;
+               dep_sclk_table = table_info->vdd_dep_on_sclk;
+               for (i = 0; i < dep_sclk_table->count; i++) {
+                       clocks->clock[i] = dep_sclk_table->entries[i].clk;
+                       clocks->count++;
+               }
+       } else if (hwmgr->pp_table_version == PP_TABLE_V0) {
+               sclk_table = hwmgr->dyn_state.vddc_dependency_on_sclk;
+               for (i = 0; i < sclk_table->count; i++) {
+                       clocks->clock[i] = sclk_table->entries[i].clk;
+                       clocks->count++;
+               }
        }
+
        return 0;
 }
 
@@ -4261,17 +4274,24 @@ static int smu7_get_mclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks)
                        (struct phm_ppt_v1_information *)hwmgr->pptable;
        struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table;
        int i;
+       struct phm_clock_voltage_dependency_table *mclk_table;
 
-       if (table_info == NULL)
-               return -EINVAL;
-
-       dep_mclk_table = table_info->vdd_dep_on_mclk;
-
-       for (i = 0; i < dep_mclk_table->count; i++) {
-               clocks->clock[i] = dep_mclk_table->entries[i].clk;
-               clocks->latency[i] = smu7_get_mem_latency(hwmgr,
+       if (hwmgr->pp_table_version == PP_TABLE_V1) {
+               if (table_info == NULL)
+                       return -EINVAL;
+               dep_mclk_table = table_info->vdd_dep_on_mclk;
+               for (i = 0; i < dep_mclk_table->count; i++) {
+                       clocks->clock[i] = dep_mclk_table->entries[i].clk;
+                       clocks->latency[i] = smu7_get_mem_latency(hwmgr,
                                                dep_mclk_table->entries[i].clk);
-               clocks->count++;
+                       clocks->count++;
+               }
+       } else if (hwmgr->pp_table_version == PP_TABLE_V0) {
+               mclk_table = hwmgr->dyn_state.vddc_dependency_on_mclk;
+               for (i = 0; i < mclk_table->count; i++) {
+                       clocks->clock[i] = mclk_table->entries[i].clk;
+                       clocks->count++;
+               }
        }
        return 0;
 }
index fb6c6f6106d5fe233e8df5bc1f29cf12385b6b7d..29d0319b22e6c68cfa46466ad13d795a7a7f37cf 100644 (file)
@@ -30,7 +30,7 @@ int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr,
                struct phm_fan_speed_info *fan_speed_info)
 {
        if (hwmgr->thermal_controller.fanInfo.bNoFan)
-               return 0;
+               return -ENODEV;
 
        fan_speed_info->supports_percent_read = true;
        fan_speed_info->supports_percent_write = true;
@@ -60,7 +60,7 @@ int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr,
        uint64_t tmp64;
 
        if (hwmgr->thermal_controller.fanInfo.bNoFan)
-               return 0;
+               return -ENODEV;
 
        duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
                        CG_FDO_CTRL1, FMAX_DUTY100);
@@ -89,7 +89,7 @@ int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed)
        if (hwmgr->thermal_controller.fanInfo.bNoFan ||
                        (hwmgr->thermal_controller.fanInfo.
                                ucTachometerPulsesPerRevolution == 0))
-               return 0;
+               return -ENODEV;
 
        tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC,
                        CG_TACH_STATUS, TACH_PERIOD);
index 910b8d5b21c56595a9cb858c6564c711134c2645..ffe1f85ce30019dc75b7aff2550ad60c6e70a5f1 100644 (file)
@@ -34,9 +34,6 @@ static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity);
 static void amd_sched_wakeup(struct amd_gpu_scheduler *sched);
 static void amd_sched_process_job(struct fence *f, struct fence_cb *cb);
 
-struct kmem_cache *sched_fence_slab;
-atomic_t sched_fence_slab_ref = ATOMIC_INIT(0);
-
 /* Initialize a given run queue struct */
 static void amd_sched_rq_init(struct amd_sched_rq *rq)
 {
@@ -618,13 +615,6 @@ int amd_sched_init(struct amd_gpu_scheduler *sched,
        INIT_LIST_HEAD(&sched->ring_mirror_list);
        spin_lock_init(&sched->job_list_lock);
        atomic_set(&sched->hw_rq_count, 0);
-       if (atomic_inc_return(&sched_fence_slab_ref) == 1) {
-               sched_fence_slab = kmem_cache_create(
-                       "amd_sched_fence", sizeof(struct amd_sched_fence), 0,
-                       SLAB_HWCACHE_ALIGN, NULL);
-               if (!sched_fence_slab)
-                       return -ENOMEM;
-       }
 
        /* Each scheduler will run on a seperate kernel thread */
        sched->thread = kthread_run(amd_sched_main, sched, sched->name);
@@ -645,7 +635,4 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched)
 {
        if (sched->thread)
                kthread_stop(sched->thread);
-       rcu_barrier();
-       if (atomic_dec_and_test(&sched_fence_slab_ref))
-               kmem_cache_destroy(sched_fence_slab);
 }
index 7cbbbfb502ef1342caa2a5b36aa970368fed5055..51068e6c3d9af4746e40ebca3f81384e95d5c16c 100644 (file)
@@ -30,9 +30,6 @@
 struct amd_gpu_scheduler;
 struct amd_sched_rq;
 
-extern struct kmem_cache *sched_fence_slab;
-extern atomic_t sched_fence_slab_ref;
-
 /**
  * A scheduler entity is a wrapper around a job queue or a group
  * of other entities. Entities take turns emitting jobs from their
@@ -145,6 +142,9 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
                           struct amd_sched_entity *entity);
 void amd_sched_entity_push_job(struct amd_sched_job *sched_job);
 
+int amd_sched_fence_slab_init(void);
+void amd_sched_fence_slab_fini(void);
+
 struct amd_sched_fence *amd_sched_fence_create(
        struct amd_sched_entity *s_entity, void *owner);
 void amd_sched_fence_scheduled(struct amd_sched_fence *fence);
index 3653b5a40494dc96dc49d195722b681060fe03f1..88fc2d66257990876507b8ab65391ad2a6deca0f 100644 (file)
 #include <drm/drmP.h>
 #include "gpu_scheduler.h"
 
+static struct kmem_cache *sched_fence_slab;
+
+int amd_sched_fence_slab_init(void)
+{
+       sched_fence_slab = kmem_cache_create(
+               "amd_sched_fence", sizeof(struct amd_sched_fence), 0,
+               SLAB_HWCACHE_ALIGN, NULL);
+       if (!sched_fence_slab)
+               return -ENOMEM;
+
+       return 0;
+}
+
+void amd_sched_fence_slab_fini(void)
+{
+       rcu_barrier();
+       kmem_cache_destroy(sched_fence_slab);
+}
+
 struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *entity,
                                               void *owner)
 {
index 23960de81b575af7b98bf3c7add253c4b1fc3a70..91ab7e9d6d2ead0827c0b452f119062d8be50a0a 100644 (file)
@@ -1806,7 +1806,7 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
                /* Use a partial view if it is bigger than available space */
                chunk_size = MIN_CHUNK_PAGES;
                if (i915_gem_object_is_tiled(obj))
-                       chunk_size = max(chunk_size, tile_row_pages(obj));
+                       chunk_size = roundup(chunk_size, tile_row_pages(obj));
 
                memset(&view, 0, sizeof(view));
                view.type = I915_GGTT_VIEW_PARTIAL;
@@ -3543,8 +3543,22 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
        if (view->type == I915_GGTT_VIEW_NORMAL)
                vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment,
                                               PIN_MAPPABLE | PIN_NONBLOCK);
-       if (IS_ERR(vma))
-               vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, 0);
+       if (IS_ERR(vma)) {
+               struct drm_i915_private *i915 = to_i915(obj->base.dev);
+               unsigned int flags;
+
+               /* Valleyview is definitely limited to scanning out the first
+                * 512MiB. Lets presume this behaviour was inherited from the
+                * g4x display engine and that all earlier gen are similarly
+                * limited. Testing suggests that it is a little more
+                * complicated than this. For example, Cherryview appears quite
+                * happy to scanout from anywhere within its global aperture.
+                */
+               flags = 0;
+               if (HAS_GMCH_DISPLAY(i915))
+                       flags = PIN_MAPPABLE;
+               vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, flags);
+       }
        if (IS_ERR(vma))
                goto err_unpin_display;
 
index 0ad1879bfd9d3b5dc9780ee1d2f160051cbe494c..81c11499bcf059356669cf77778bb53ae17bb0e6 100644 (file)
@@ -10243,6 +10243,29 @@ static void bxt_modeset_commit_cdclk(struct drm_atomic_state *old_state)
        bxt_set_cdclk(to_i915(dev), req_cdclk);
 }
 
+static int bdw_adjust_min_pipe_pixel_rate(struct intel_crtc_state *crtc_state,
+                                         int pixel_rate)
+{
+       struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
+
+       /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
+       if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
+               pixel_rate = DIV_ROUND_UP(pixel_rate * 100, 95);
+
+       /* BSpec says "Do not use DisplayPort with CDCLK less than
+        * 432 MHz, audio enabled, port width x4, and link rate
+        * HBR2 (5.4 GHz), or else there may be audio corruption or
+        * screen corruption."
+        */
+       if (intel_crtc_has_dp_encoder(crtc_state) &&
+           crtc_state->has_audio &&
+           crtc_state->port_clock >= 540000 &&
+           crtc_state->lane_count == 4)
+               pixel_rate = max(432000, pixel_rate);
+
+       return pixel_rate;
+}
+
 /* compute the max rate for new configuration */
 static int ilk_max_pixel_rate(struct drm_atomic_state *state)
 {
@@ -10268,9 +10291,9 @@ static int ilk_max_pixel_rate(struct drm_atomic_state *state)
 
                pixel_rate = ilk_pipe_pixel_rate(crtc_state);
 
-               /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
-               if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
-                       pixel_rate = DIV_ROUND_UP(pixel_rate * 100, 95);
+               if (IS_BROADWELL(dev_priv) || IS_GEN9(dev_priv))
+                       pixel_rate = bdw_adjust_min_pipe_pixel_rate(crtc_state,
+                                                                   pixel_rate);
 
                intel_state->min_pixclk[i] = pixel_rate;
        }
index f40a35f2913a8222f2800bfa081b3adb1c636288..13c306173f27b9be7dde7e831d1dca942b59a4e0 100644 (file)
@@ -1799,6 +1799,50 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
        intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
+static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
+                            enum port port)
+{
+       const struct ddi_vbt_port_info *info =
+               &dev_priv->vbt.ddi_port_info[port];
+       u8 ddc_pin;
+
+       if (info->alternate_ddc_pin) {
+               DRM_DEBUG_KMS("Using DDC pin 0x%x for port %c (VBT)\n",
+                             info->alternate_ddc_pin, port_name(port));
+               return info->alternate_ddc_pin;
+       }
+
+       switch (port) {
+       case PORT_B:
+               if (IS_BROXTON(dev_priv))
+                       ddc_pin = GMBUS_PIN_1_BXT;
+               else
+                       ddc_pin = GMBUS_PIN_DPB;
+               break;
+       case PORT_C:
+               if (IS_BROXTON(dev_priv))
+                       ddc_pin = GMBUS_PIN_2_BXT;
+               else
+                       ddc_pin = GMBUS_PIN_DPC;
+               break;
+       case PORT_D:
+               if (IS_CHERRYVIEW(dev_priv))
+                       ddc_pin = GMBUS_PIN_DPD_CHV;
+               else
+                       ddc_pin = GMBUS_PIN_DPD;
+               break;
+       default:
+               MISSING_CASE(port);
+               ddc_pin = GMBUS_PIN_DPB;
+               break;
+       }
+
+       DRM_DEBUG_KMS("Using DDC pin 0x%x for port %c (platform default)\n",
+                     ddc_pin, port_name(port));
+
+       return ddc_pin;
+}
+
 void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
                               struct intel_connector *intel_connector)
 {
@@ -1808,7 +1852,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
        struct drm_device *dev = intel_encoder->base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
        enum port port = intel_dig_port->port;
-       uint8_t alternate_ddc_pin;
 
        DRM_DEBUG_KMS("Adding HDMI connector on port %c\n",
                      port_name(port));
@@ -1826,12 +1869,10 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
        connector->doublescan_allowed = 0;
        connector->stereo_allowed = 1;
 
+       intel_hdmi->ddc_bus = intel_hdmi_ddc_pin(dev_priv, port);
+
        switch (port) {
        case PORT_B:
-               if (IS_BROXTON(dev_priv))
-                       intel_hdmi->ddc_bus = GMBUS_PIN_1_BXT;
-               else
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
                /*
                 * On BXT A0/A1, sw needs to activate DDIA HPD logic and
                 * interrupts to check the external panel connection.
@@ -1842,46 +1883,17 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
                        intel_encoder->hpd_pin = HPD_PORT_B;
                break;
        case PORT_C:
-               if (IS_BROXTON(dev_priv))
-                       intel_hdmi->ddc_bus = GMBUS_PIN_2_BXT;
-               else
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
                intel_encoder->hpd_pin = HPD_PORT_C;
                break;
        case PORT_D:
-               if (WARN_ON(IS_BROXTON(dev_priv)))
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DISABLED;
-               else if (IS_CHERRYVIEW(dev_priv))
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPD_CHV;
-               else
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
                intel_encoder->hpd_pin = HPD_PORT_D;
                break;
        case PORT_E:
-               /* On SKL PORT E doesn't have seperate GMBUS pin
-                *  We rely on VBT to set a proper alternate GMBUS pin. */
-               alternate_ddc_pin =
-                       dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin;
-               switch (alternate_ddc_pin) {
-               case DDC_PIN_B:
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
-                       break;
-               case DDC_PIN_C:
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
-                       break;
-               case DDC_PIN_D:
-                       intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
-                       break;
-               default:
-                       MISSING_CASE(alternate_ddc_pin);
-               }
                intel_encoder->hpd_pin = HPD_PORT_E;
                break;
-       case PORT_A:
-               intel_encoder->hpd_pin = HPD_PORT_A;
-               /* Internal port only for eDP. */
        default:
-               BUG();
+               MISSING_CASE(port);
+               return;
        }
 
        if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {
index 6c11168facd63c7fd18eeb64e49abfa283e9c87a..a38c2fefe85a6fc2abb1fcaabe2143da3c95be3a 100644 (file)
@@ -1139,7 +1139,9 @@ static void vlv_display_power_well_deinit(struct drm_i915_private *dev_priv)
 
        intel_power_sequencer_reset(dev_priv);
 
-       intel_hpd_poll_init(dev_priv);
+       /* Prevent us from re-enabling polling on accident in late suspend */
+       if (!dev_priv->drm.dev->power.is_suspended)
+               intel_hpd_poll_init(dev_priv);
 }
 
 static void vlv_display_power_well_enable(struct drm_i915_private *dev_priv,
index 4e1ae3fc462dc65591d2fa5b3f6dffe3ee8a4ad4..6be515a9fb694b5fdac53d880430ba218b08e544 100644 (file)
@@ -68,6 +68,12 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc,
 
        ipu_dc_disable_channel(ipu_crtc->dc);
        ipu_di_disable(ipu_crtc->di);
+       /*
+        * Planes must be disabled before DC clock is removed, as otherwise the
+        * attached IDMACs will be left in undefined state, possibly hanging
+        * the IPU or even system.
+        */
+       drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, false);
        ipu_dc_disable(ipu);
 
        spin_lock_irq(&crtc->dev->event_lock);
@@ -77,9 +83,6 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc,
        }
        spin_unlock_irq(&crtc->dev->event_lock);
 
-       /* always disable planes on the CRTC */
-       drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, true);
-
        drm_crtc_vblank_off(crtc);
 }
 
index f05ed0e1f3d655d0009438fd923e9438c79be1d5..6f240021705b0c493457560f1782fdd9483c5b98 100644 (file)
@@ -139,6 +139,7 @@ struct msm_dsi_host {
 
        u32 err_work_state;
        struct work_struct err_work;
+       struct work_struct hpd_work;
        struct workqueue_struct *workqueue;
 
        /* DSI 6G TX buffer*/
@@ -1294,6 +1295,14 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)
        wmb();  /* make sure dsi controller enabled again */
 }
 
+static void dsi_hpd_worker(struct work_struct *work)
+{
+       struct msm_dsi_host *msm_host =
+               container_of(work, struct msm_dsi_host, hpd_work);
+
+       drm_helper_hpd_irq_event(msm_host->dev);
+}
+
 static void dsi_err_worker(struct work_struct *work)
 {
        struct msm_dsi_host *msm_host =
@@ -1480,7 +1489,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
 
        DBG("id=%d", msm_host->id);
        if (msm_host->dev)
-               drm_helper_hpd_irq_event(msm_host->dev);
+               queue_work(msm_host->workqueue, &msm_host->hpd_work);
 
        return 0;
 }
@@ -1494,7 +1503,7 @@ static int dsi_host_detach(struct mipi_dsi_host *host,
 
        DBG("id=%d", msm_host->id);
        if (msm_host->dev)
-               drm_helper_hpd_irq_event(msm_host->dev);
+               queue_work(msm_host->workqueue, &msm_host->hpd_work);
 
        return 0;
 }
@@ -1748,6 +1757,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
        /* setup workqueue */
        msm_host->workqueue = alloc_ordered_workqueue("dsi_drm_work", 0);
        INIT_WORK(&msm_host->err_work, dsi_err_worker);
+       INIT_WORK(&msm_host->hpd_work, dsi_hpd_worker);
 
        msm_dsi->host = &msm_host->base;
        msm_dsi->id = msm_host->id;
index 598fdaff0a41a051fa165d79e386aab7a7f9bd84..26e3a01a99c2b71dde9fed5bd548ee17b61e2df4 100644 (file)
@@ -521,6 +521,7 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm)
                .parent_names = (const char *[]){ "xo" },
                .num_parents = 1,
                .name = vco_name,
+               .flags = CLK_IGNORE_UNUSED,
                .ops = &clk_ops_dsi_pll_28nm_vco,
        };
        struct device *dev = &pll_28nm->pdev->dev;
index 38c90e1eb00286b4ce0bb9dd49e30115f60869bc..49008451085b86ccb84ee3760c406554db51fd49 100644 (file)
@@ -412,6 +412,7 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm)
        struct clk_init_data vco_init = {
                .parent_names = (const char *[]){ "pxo" },
                .num_parents = 1,
+               .flags = CLK_IGNORE_UNUSED,
                .ops = &clk_ops_dsi_pll_28nm_vco,
        };
        struct device *dev = &pll_28nm->pdev->dev;
index aa94a553794f50eed7d5c49dd01d594c96113baa..143eab46ba687b0b1a89969598736bc75e750809 100644 (file)
@@ -702,6 +702,7 @@ static struct clk_init_data pll_init = {
        .ops = &hdmi_8996_pll_ops,
        .parent_names = hdmi_pll_parents,
        .num_parents = ARRAY_SIZE(hdmi_pll_parents),
+       .flags = CLK_IGNORE_UNUSED,
 };
 
 int msm_hdmi_pll_8996_init(struct platform_device *pdev)
index 92da69aa6187e64fa6cbb515a4698bf32f57db54..99590758c68b7cf8e296928db1bab5ce5b2df4c4 100644 (file)
@@ -424,6 +424,7 @@ static struct clk_init_data pll_init = {
        .ops = &hdmi_pll_ops,
        .parent_names = hdmi_pll_parents,
        .num_parents = ARRAY_SIZE(hdmi_pll_parents),
+       .flags = CLK_IGNORE_UNUSED,
 };
 
 int msm_hdmi_pll_8960_init(struct platform_device *pdev)
index ac9e4cde13804f78333d5d6e101b37511949a5e8..8b4e3004f4518d19341b24c140606404853e379b 100644 (file)
@@ -272,7 +272,7 @@ const struct mdp5_cfg_hw msm8x16_config = {
                .count = 2,
                .base = { 0x14000, 0x16000 },
                .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP |
-                               MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION,
+                               MDP_PIPE_CAP_DECIMATION,
        },
        .pipe_dma = {
                .count = 1,
@@ -282,7 +282,7 @@ const struct mdp5_cfg_hw msm8x16_config = {
        .lm = {
                .count = 2, /* LM0 and LM3 */
                .base = { 0x44000, 0x47000 },
-               .nb_stages = 5,
+               .nb_stages = 8,
                .max_width = 2048,
                .max_height = 0xFFFF,
        },
index fa2be7ce9468768eb6737a12ec29d11fc52f49f0..c205c360e16dcbdf83120e102e0a6854b852959f 100644 (file)
@@ -223,12 +223,7 @@ static void blend_setup(struct drm_crtc *crtc)
                plane_cnt++;
        }
 
-       /*
-       * If there is no base layer, enable border color.
-       * Although it's not possbile in current blend logic,
-       * put it here as a reminder.
-       */
-       if (!pstates[STAGE_BASE] && plane_cnt) {
+       if (!pstates[STAGE_BASE]) {
                ctl_blend_flags |= MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT;
                DBG("Border Color is enabled");
        }
@@ -365,6 +360,15 @@ static int pstate_cmp(const void *a, const void *b)
        return pa->state->zpos - pb->state->zpos;
 }
 
+/* is there a helper for this? */
+static bool is_fullscreen(struct drm_crtc_state *cstate,
+               struct drm_plane_state *pstate)
+{
+       return (pstate->crtc_x <= 0) && (pstate->crtc_y <= 0) &&
+               ((pstate->crtc_x + pstate->crtc_w) >= cstate->mode.hdisplay) &&
+               ((pstate->crtc_y + pstate->crtc_h) >= cstate->mode.vdisplay);
+}
+
 static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
                struct drm_crtc_state *state)
 {
@@ -375,21 +379,11 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
        struct plane_state pstates[STAGE_MAX + 1];
        const struct mdp5_cfg_hw *hw_cfg;
        const struct drm_plane_state *pstate;
-       int cnt = 0, i;
+       int cnt = 0, base = 0, i;
 
        DBG("%s: check", mdp5_crtc->name);
 
-       /* verify that there are not too many planes attached to crtc
-        * and that we don't have conflicting mixer stages:
-        */
-       hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
        drm_atomic_crtc_state_for_each_plane_state(plane, pstate, state) {
-               if (cnt >= (hw_cfg->lm.nb_stages)) {
-                       dev_err(dev->dev, "too many planes!\n");
-                       return -EINVAL;
-               }
-
-
                pstates[cnt].plane = plane;
                pstates[cnt].state = to_mdp5_plane_state(pstate);
 
@@ -399,8 +393,24 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
        /* assign a stage based on sorted zpos property */
        sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL);
 
+       /* if the bottom-most layer is not fullscreen, we need to use
+        * it for solid-color:
+        */
+       if ((cnt > 0) && !is_fullscreen(state, &pstates[0].state->base))
+               base++;
+
+       /* verify that there are not too many planes attached to crtc
+        * and that we don't have conflicting mixer stages:
+        */
+       hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
+
+       if ((cnt + base) >= hw_cfg->lm.nb_stages) {
+               dev_err(dev->dev, "too many planes!\n");
+               return -EINVAL;
+       }
+
        for (i = 0; i < cnt; i++) {
-               pstates[i].state->stage = STAGE_BASE + i;
+               pstates[i].state->stage = STAGE_BASE + i + base;
                DBG("%s: assign pipe %s on stage=%d", mdp5_crtc->name,
                                pipe2name(mdp5_plane_pipe(pstates[i].plane)),
                                pstates[i].state->stage);
index 951c002b05df2701977eb3f8570aa004f1cddd28..83bf997dda03cd9df09bd356ae661156351aaee2 100644 (file)
@@ -292,8 +292,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
                format = to_mdp_format(msm_framebuffer_format(state->fb));
                if (MDP_FORMAT_IS_YUV(format) &&
                        !pipe_supports_yuv(mdp5_plane->caps)) {
-                       dev_err(plane->dev->dev,
-                               "Pipe doesn't support YUV\n");
+                       DBG("Pipe doesn't support YUV\n");
 
                        return -EINVAL;
                }
@@ -301,8 +300,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
                if (!(mdp5_plane->caps & MDP_PIPE_CAP_SCALE) &&
                        (((state->src_w >> 16) != state->crtc_w) ||
                        ((state->src_h >> 16) != state->crtc_h))) {
-                       dev_err(plane->dev->dev,
-                               "Pipe doesn't support scaling (%dx%d -> %dx%d)\n",
+                       DBG("Pipe doesn't support scaling (%dx%d -> %dx%d)\n",
                                state->src_w >> 16, state->src_h >> 16,
                                state->crtc_w, state->crtc_h);
 
@@ -313,8 +311,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
                vflip = !!(state->rotation & DRM_REFLECT_Y);
                if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) ||
                        (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) {
-                       dev_err(plane->dev->dev,
-                               "Pipe doesn't support flip\n");
+                       DBG("Pipe doesn't support flip\n");
 
                        return -EINVAL;
                }
index fb5c0b0a7594adcb0f38858cce0fc87d786f4eaa..46568fc80848f1376122d4936e662310e6cdb4b4 100644 (file)
@@ -228,7 +228,7 @@ static int msm_drm_uninit(struct device *dev)
        flush_workqueue(priv->atomic_wq);
        destroy_workqueue(priv->atomic_wq);
 
-       if (kms)
+       if (kms && kms->funcs)
                kms->funcs->destroy(kms);
 
        if (gpu) {
index 283d2841ba58137efa28ea4c2cef3872b4cb5202..192b2d3a79cb221e4b067b5b153d3a913edd6ffc 100644 (file)
@@ -163,6 +163,9 @@ void msm_gem_shrinker_init(struct drm_device *dev)
 void msm_gem_shrinker_cleanup(struct drm_device *dev)
 {
        struct msm_drm_private *priv = dev->dev_private;
-       WARN_ON(unregister_vmap_purge_notifier(&priv->vmap_notifier));
-       unregister_shrinker(&priv->shrinker);
+
+       if (priv->shrinker.nr_deferred) {
+               WARN_ON(unregister_vmap_purge_notifier(&priv->vmap_notifier));
+               unregister_shrinker(&priv->shrinker);
+       }
 }
index e18839d52e3e9036c53846b4cb67e5670a52ba7a..27affbde058c626eec6ae5b5b77cd9a2d4601ba9 100644 (file)
@@ -931,7 +931,7 @@ static void radeon_connector_unregister(struct drm_connector *connector)
 {
        struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 
-       if (radeon_connector->ddc_bus->has_aux) {
+       if (radeon_connector->ddc_bus && radeon_connector->ddc_bus->has_aux) {
                drm_dp_aux_unregister(&radeon_connector->ddc_bus->aux);
                radeon_connector->ddc_bus->has_aux = false;
        }
index eb92aef46e3cfcf99a07d26272fac7725d0cfaa8..621af069a3d2a5f1175bac236d4421db594eca07 100644 (file)
@@ -104,6 +104,14 @@ static const char radeon_family_name[][16] = {
        "LAST",
 };
 
+#if defined(CONFIG_VGA_SWITCHEROO)
+bool radeon_has_atpx_dgpu_power_cntl(void);
+bool radeon_is_atpx_hybrid(void);
+#else
+static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; }
+static inline bool radeon_is_atpx_hybrid(void) { return false; }
+#endif
+
 #define RADEON_PX_QUIRK_DISABLE_PX  (1 << 0)
 #define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1)
 
@@ -160,6 +168,11 @@ static void radeon_device_handle_px_quirks(struct radeon_device *rdev)
 
        if (rdev->px_quirk_flags & RADEON_PX_QUIRK_DISABLE_PX)
                rdev->flags &= ~RADEON_IS_PX;
+
+       /* disable PX is the system doesn't support dGPU power control or hybrid gfx */
+       if (!radeon_is_atpx_hybrid() &&
+           !radeon_has_atpx_dgpu_power_cntl())
+               rdev->flags &= ~RADEON_IS_PX;
 }
 
 /**
index 29f0207fa677064dc4b7bd93ea360fd5d3f414a4..873f010d9616f702deb3d59947831c28a899b853 100644 (file)
@@ -98,17 +98,23 @@ static int udl_parse_vendor_descriptor(struct drm_device *dev,
 static int udl_select_std_channel(struct udl_device *udl)
 {
        int ret;
-       u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7,
-                           0x1C, 0x88, 0x5E, 0x15,
-                           0x60, 0xFE, 0xC6, 0x97,
-                           0x16, 0x3D, 0x47, 0xF2};
+       static const u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7,
+                                        0x1C, 0x88, 0x5E, 0x15,
+                                        0x60, 0xFE, 0xC6, 0x97,
+                                        0x16, 0x3D, 0x47, 0xF2};
+       void *sendbuf;
+
+       sendbuf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL);
+       if (!sendbuf)
+               return -ENOMEM;
 
        ret = usb_control_msg(udl->udev,
                              usb_sndctrlpipe(udl->udev, 0),
                              NR_USB_REQUEST_CHANNEL,
                              (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0,
-                             set_def_chn, sizeof(set_def_chn),
+                             sendbuf, sizeof(set_def_chn),
                              USB_CTRL_SET_TIMEOUT);
+       kfree(sendbuf);
        return ret < 0 ? ret : 0;
 }
 
index 6cfb5cacc2533b3f5a21c488ff7257c44d3b43df..575aa65436d182c31fb874a432807688747dd785 100644 (file)
 #define USB_DEVICE_ID_ATEN_4PORTKVM    0x2205
 #define USB_DEVICE_ID_ATEN_4PORTKVMC   0x2208
 #define USB_DEVICE_ID_ATEN_CS682       0x2213
+#define USB_DEVICE_ID_ATEN_CS692       0x8021
 
 #define USB_VENDOR_ID_ATMEL            0x03eb
 #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
index 5614fee82347f34b0ad96d906d800d3de7906052..3a84aaf1418b45c725531903b41e29ae4ce62236 100644 (file)
@@ -292,11 +292,11 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
        bool input = false;
        int value = 0;
 
-       if (sscanf(attr->attr.name, "feature-%d-%x-%s", &index, &usage,
+       if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
                   name) == 3) {
                feature = true;
                field_index = index + sensor_inst->input_field_count;
-       } else if (sscanf(attr->attr.name, "input-%d-%x-%s", &index, &usage,
+       } else if (sscanf(attr->attr.name, "input-%x-%x-%s", &index, &usage,
                   name) == 3) {
                input = true;
                field_index = index;
@@ -398,7 +398,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
        char name[HID_CUSTOM_NAME_LENGTH];
        int value;
 
-       if (sscanf(attr->attr.name, "feature-%d-%x-%s", &index, &usage,
+       if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
                   name) == 3) {
                field_index = index + sensor_inst->input_field_count;
        } else
index 658a607dc6d9eb1f7c57da3c4afe065e32ffd156..c5c3d6111729952a7c35ce37837e1289c6c00a58 100644 (file)
@@ -251,6 +251,9 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
        struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev);
        int report_size;
        int ret = 0;
+       u8 *val_ptr;
+       int buffer_index = 0;
+       int i;
 
        mutex_lock(&data->mutex);
        report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
@@ -271,7 +274,17 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
                goto done_proc;
        }
        ret = min(report_size, buffer_size);
-       memcpy(buffer, report->field[field_index]->value, ret);
+
+       val_ptr = (u8 *)report->field[field_index]->value;
+       for (i = 0; i < report->field[field_index]->report_count; ++i) {
+               if (buffer_index >= ret)
+                       break;
+
+               memcpy(&((u8 *)buffer)[buffer_index], val_ptr,
+                      report->field[field_index]->report_size / 8);
+               val_ptr += sizeof(__s32);
+               buffer_index += (report->field[field_index]->report_size / 8);
+       }
 
 done_proc:
        mutex_unlock(&data->mutex);
index e2517c11e0ee053c68ff27c5f11325bcf601ba2a..0c9ac4d5d85007e52e45c7f2a3c413c304901264 100644 (file)
@@ -637,6 +637,58 @@ irqreturn_t ish_irq_handler(int irq, void *dev_id)
        return  IRQ_HANDLED;
 }
 
+/**
+ * ish_disable_dma() - disable dma communication between host and ISHFW
+ * @dev: ishtp device pointer
+ *
+ * Clear the dma enable bit and wait for dma inactive.
+ *
+ * Return: 0 for success else error code.
+ */
+static int ish_disable_dma(struct ishtp_device *dev)
+{
+       unsigned int    dma_delay;
+
+       /* Clear the dma enable bit */
+       ish_reg_write(dev, IPC_REG_ISH_RMP2, 0);
+
+       /* wait for dma inactive */
+       for (dma_delay = 0; dma_delay < MAX_DMA_DELAY &&
+               _ish_read_fw_sts_reg(dev) & (IPC_ISH_IN_DMA);
+               dma_delay += 5)
+               mdelay(5);
+
+       if (dma_delay >= MAX_DMA_DELAY) {
+               dev_err(dev->devc,
+                       "Wait for DMA inactive timeout\n");
+               return  -EBUSY;
+       }
+
+       return 0;
+}
+
+/**
+ * ish_wakeup() - wakeup ishfw from waiting-for-host state
+ * @dev: ishtp device pointer
+ *
+ * Set the dma enable bit and send a void message to FW,
+ * it wil wakeup FW from waiting-for-host state.
+ */
+static void ish_wakeup(struct ishtp_device *dev)
+{
+       /* Set dma enable bit */
+       ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
+
+       /*
+        * Send 0 IPC message so that ISH FW wakes up if it was already
+        * asleep.
+        */
+       ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
+
+       /* Flush writes to doorbell and REMAP2 */
+       ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
+}
+
 /**
  * _ish_hw_reset() - HW reset
  * @dev: ishtp device pointer
@@ -649,7 +701,6 @@ static int _ish_hw_reset(struct ishtp_device *dev)
 {
        struct pci_dev *pdev = dev->pdev;
        int     rv;
-       unsigned int    dma_delay;
        uint16_t csr;
 
        if (!pdev)
@@ -664,15 +715,8 @@ static int _ish_hw_reset(struct ishtp_device *dev)
                return  -EINVAL;
        }
 
-       /* Now trigger reset to FW */
-       ish_reg_write(dev, IPC_REG_ISH_RMP2, 0);
-
-       for (dma_delay = 0; dma_delay < MAX_DMA_DELAY &&
-               _ish_read_fw_sts_reg(dev) & (IPC_ISH_IN_DMA);
-               dma_delay += 5)
-               mdelay(5);
-
-       if (dma_delay >= MAX_DMA_DELAY) {
+       /* Disable dma communication between FW and host */
+       if (ish_disable_dma(dev)) {
                dev_err(&pdev->dev,
                        "Can't reset - stuck with DMA in-progress\n");
                return  -EBUSY;
@@ -690,16 +734,8 @@ static int _ish_hw_reset(struct ishtp_device *dev)
        csr |= PCI_D0;
        pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr);
 
-       ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
-
-       /*
-        * Send 0 IPC message so that ISH FW wakes up if it was already
-        * asleep
-        */
-       ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
-
-       /* Flush writes to doorbell and REMAP2 */
-       ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
+       /* Now we can enable ISH DMA operation and wakeup ISHFW */
+       ish_wakeup(dev);
 
        return  0;
 }
@@ -758,16 +794,9 @@ static int _ish_ipc_reset(struct ishtp_device *dev)
 int ish_hw_start(struct ishtp_device *dev)
 {
        ish_set_host_rdy(dev);
-       /* After that we can enable ISH DMA operation */
-       ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
 
-       /*
-        * Send 0 IPC message so that ISH FW wakes up if it was already
-        * asleep
-        */
-       ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
-       /* Flush write to doorbell */
-       ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
+       /* After that we can enable ISH DMA operation and wakeup ISHFW */
+       ish_wakeup(dev);
 
        set_host_ready(dev);
 
@@ -876,6 +905,21 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
  */
 void   ish_device_disable(struct ishtp_device *dev)
 {
+       struct pci_dev *pdev = dev->pdev;
+
+       if (!pdev)
+               return;
+
+       /* Disable dma communication between FW and host */
+       if (ish_disable_dma(dev)) {
+               dev_err(&pdev->dev,
+                       "Can't reset - stuck with DMA in-progress\n");
+               return;
+       }
+
+       /* Put ISH to D3hot state for power saving */
+       pci_set_power_state(pdev, PCI_D3hot);
+
        dev->dev_state = ISHTP_DEV_DISABLED;
        ish_clr_host_rdy(dev);
 }
index 42f0beeb09fd4e2ab4fe6ad246f9f21786bf3e3d..20d647d2dd2cbfa5fb57fbc85de236147cf448ab 100644 (file)
@@ -146,7 +146,7 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
 
        /* request and enable interrupt */
-       ret = request_irq(pdev->irq, ish_irq_handler, IRQF_NO_SUSPEND,
+       ret = request_irq(pdev->irq, ish_irq_handler, IRQF_SHARED,
                          KBUILD_MODNAME, dev);
        if (ret) {
                dev_err(&pdev->dev, "ISH: request IRQ failure (%d)\n",
@@ -202,6 +202,7 @@ static void ish_remove(struct pci_dev *pdev)
        kfree(ishtp_dev);
 }
 
+#ifdef CONFIG_PM
 static struct device *ish_resume_device;
 
 /**
@@ -293,7 +294,6 @@ static int ish_resume(struct device *device)
        return 0;
 }
 
-#ifdef CONFIG_PM
 static const struct dev_pm_ops ish_pm_ops = {
        .suspend = ish_suspend,
        .resume = ish_resume,
@@ -301,7 +301,7 @@ static const struct dev_pm_ops ish_pm_ops = {
 #define ISHTP_ISH_PM_OPS       (&ish_pm_ops)
 #else
 #define ISHTP_ISH_PM_OPS       NULL
-#endif
+#endif /* CONFIG_PM */
 
 static struct pci_driver ish_driver = {
        .name = KBUILD_MODNAME,
index 354d49ea36dd9d434452cff07e2b0fb15356035e..e6cfd323babc62d653146730e4d7325ee8a24696 100644 (file)
@@ -63,6 +63,7 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS692, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET },
index a259e18d22d5b0e3293230e97979a5120d3265fa..0276d2ef06ee5f3d61811b38b77249df1c03f581 100644 (file)
@@ -961,7 +961,7 @@ int vmbus_device_register(struct hv_device *child_device_obj)
 {
        int ret = 0;
 
-       dev_set_name(&child_device_obj->device, "vmbus-%pUl",
+       dev_set_name(&child_device_obj->device, "%pUl",
                     child_device_obj->channel->offermsg.offer.if_instance.b);
 
        child_device_obj->device.bus = &hv_bus;
index adae6848ffb2311b46d59a509fb0883e49cfd6e5..a74c075a30ec49608308ddd45715f1addc104c84 100644 (file)
@@ -536,8 +536,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
 
                hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups),
                                             GFP_KERNEL);
-               if (!hwdev->groups)
-                       return ERR_PTR(-ENOMEM);
+               if (!hwdev->groups) {
+                       err = -ENOMEM;
+                       goto free_hwmon;
+               }
 
                attrs = __hwmon_create_attrs(dev, drvdata, chip);
                if (IS_ERR(attrs)) {
index da3fb069ec5c06dc2bdd99868ee1ad4e114b471a..ce69048c88e98ba9825fbee17e8fd186b94e8d8f 100644 (file)
@@ -743,8 +743,8 @@ static int st_accel_read_raw(struct iio_dev *indio_dev,
 
                return IIO_VAL_INT;
        case IIO_CHAN_INFO_SCALE:
-               *val = 0;
-               *val2 = adata->current_fullscale->gain;
+               *val = adata->current_fullscale->gain / 1000000;
+               *val2 = adata->current_fullscale->gain % 1000000;
                return IIO_VAL_INT_PLUS_MICRO;
        case IIO_CHAN_INFO_SAMP_FREQ:
                *val = adata->odr;
@@ -763,9 +763,13 @@ static int st_accel_write_raw(struct iio_dev *indio_dev,
        int err;
 
        switch (mask) {
-       case IIO_CHAN_INFO_SCALE:
-               err = st_sensors_set_fullscale_by_gain(indio_dev, val2);
+       case IIO_CHAN_INFO_SCALE: {
+               int gain;
+
+               gain = val * 1000000 + val2;
+               err = st_sensors_set_fullscale_by_gain(indio_dev, gain);
                break;
+       }
        case IIO_CHAN_INFO_SAMP_FREQ:
                if (val2)
                        return -EINVAL;
index dc33c1dd5191a57aaa8c3c66cdaa75a31866463c..b5beea53d6f6551aba68e570be25deca87d8288c 100644 (file)
@@ -30,26 +30,26 @@ static struct {
        u32 usage_id;
        int unit; /* 0 for default others from HID sensor spec */
        int scale_val0; /* scale, whole number */
-       int scale_val1; /* scale, fraction in micros */
+       int scale_val1; /* scale, fraction in nanos */
 } unit_conversion[] = {
-       {HID_USAGE_SENSOR_ACCEL_3D, 0, 9, 806650},
+       {HID_USAGE_SENSOR_ACCEL_3D, 0, 9, 806650000},
        {HID_USAGE_SENSOR_ACCEL_3D,
                HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD, 1, 0},
        {HID_USAGE_SENSOR_ACCEL_3D,
-               HID_USAGE_SENSOR_UNITS_G, 9, 806650},
+               HID_USAGE_SENSOR_UNITS_G, 9, 806650000},
 
-       {HID_USAGE_SENSOR_GYRO_3D, 0, 0, 17453},
+       {HID_USAGE_SENSOR_GYRO_3D, 0, 0, 17453293},
        {HID_USAGE_SENSOR_GYRO_3D,
                HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND, 1, 0},
        {HID_USAGE_SENSOR_GYRO_3D,
-               HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND, 0, 17453},
+               HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND, 0, 17453293},
 
-       {HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000},
+       {HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000000},
        {HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0},
 
-       {HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453},
+       {HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453293},
        {HID_USAGE_SENSOR_INCLINOMETER_3D,
-               HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453},
+               HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453293},
        {HID_USAGE_SENSOR_INCLINOMETER_3D,
                HID_USAGE_SENSOR_UNITS_RADIANS, 1, 0},
 
@@ -57,7 +57,7 @@ static struct {
        {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0},
 
        {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0},
-       {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000},
+       {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000000},
 };
 
 static int pow_10(unsigned power)
@@ -266,15 +266,15 @@ EXPORT_SYMBOL(hid_sensor_write_raw_hyst_value);
 /*
  * This fuction applies the unit exponent to the scale.
  * For example:
- * 9.806650 ->exp:2-> val0[980]val1[665000]
- * 9.000806 ->exp:2-> val0[900]val1[80600]
- * 0.174535 ->exp:2-> val0[17]val1[453500]
- * 1.001745 ->exp:0-> val0[1]val1[1745]
- * 1.001745 ->exp:2-> val0[100]val1[174500]
- * 1.001745 ->exp:4-> val0[10017]val1[450000]
- * 9.806650 ->exp:-2-> val0[0]val1[98066]
+ * 9.806650000 ->exp:2-> val0[980]val1[665000000]
+ * 9.000806000 ->exp:2-> val0[900]val1[80600000]
+ * 0.174535293 ->exp:2-> val0[17]val1[453529300]
+ * 1.001745329 ->exp:0-> val0[1]val1[1745329]
+ * 1.001745329 ->exp:2-> val0[100]val1[174532900]
+ * 1.001745329 ->exp:4-> val0[10017]val1[453290000]
+ * 9.806650000 ->exp:-2-> val0[0]val1[98066500]
  */
-static void adjust_exponent_micro(int *val0, int *val1, int scale0,
+static void adjust_exponent_nano(int *val0, int *val1, int scale0,
                                  int scale1, int exp)
 {
        int i;
@@ -285,32 +285,32 @@ static void adjust_exponent_micro(int *val0, int *val1, int scale0,
        if (exp > 0) {
                *val0 = scale0 * pow_10(exp);
                res = 0;
-               if (exp > 6) {
+               if (exp > 9) {
                        *val1 = 0;
                        return;
                }
                for (i = 0; i < exp; ++i) {
-                       x = scale1 / pow_10(5 - i);
+                       x = scale1 / pow_10(8 - i);
                        res += (pow_10(exp - 1 - i) * x);
-                       scale1 = scale1 % pow_10(5 - i);
+                       scale1 = scale1 % pow_10(8 - i);
                }
                *val0 += res;
                        *val1 = scale1 * pow_10(exp);
        } else if (exp < 0) {
                exp = abs(exp);
-               if (exp > 6) {
+               if (exp > 9) {
                        *val0 = *val1 = 0;
                        return;
                }
                *val0 = scale0 / pow_10(exp);
                rem = scale0 % pow_10(exp);
                res = 0;
-               for (i = 0; i < (6 - exp); ++i) {
-                       x = scale1 / pow_10(5 - i);
-                       res += (pow_10(5 - exp - i) * x);
-                       scale1 = scale1 % pow_10(5 - i);
+               for (i = 0; i < (9 - exp); ++i) {
+                       x = scale1 / pow_10(8 - i);
+                       res += (pow_10(8 - exp - i) * x);
+                       scale1 = scale1 % pow_10(8 - i);
                }
-               *val1 = rem * pow_10(6 - exp) + res;
+               *val1 = rem * pow_10(9 - exp) + res;
        } else {
                *val0 = scale0;
                *val1 = scale1;
@@ -332,14 +332,14 @@ int hid_sensor_format_scale(u32 usage_id,
                        unit_conversion[i].unit == attr_info->units) {
                        exp  = hid_sensor_convert_exponent(
                                                attr_info->unit_expo);
-                       adjust_exponent_micro(val0, val1,
+                       adjust_exponent_nano(val0, val1,
                                        unit_conversion[i].scale_val0,
                                        unit_conversion[i].scale_val1, exp);
                        break;
                }
        }
 
-       return IIO_VAL_INT_PLUS_MICRO;
+       return IIO_VAL_INT_PLUS_NANO;
 }
 EXPORT_SYMBOL(hid_sensor_format_scale);
 
index 285a64a589d7137e7c2f188a851e4a36526a2824..975a1f19f74760e5e1c17c786e36d9a86ae5a2a6 100644 (file)
@@ -612,7 +612,7 @@ EXPORT_SYMBOL(st_sensors_sysfs_sampling_frequency_avail);
 ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
                                struct device_attribute *attr, char *buf)
 {
-       int i, len = 0;
+       int i, len = 0, q, r;
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct st_sensor_data *sdata = iio_priv(indio_dev);
 
@@ -621,8 +621,10 @@ ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
                if (sdata->sensor_settings->fs.fs_avl[i].num == 0)
                        break;
 
-               len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ",
-                               sdata->sensor_settings->fs.fs_avl[i].gain);
+               q = sdata->sensor_settings->fs.fs_avl[i].gain / 1000000;
+               r = sdata->sensor_settings->fs.fs_avl[i].gain % 1000000;
+
+               len += scnprintf(buf + len, PAGE_SIZE - len, "%u.%06u ", q, r);
        }
        mutex_unlock(&indio_dev->mlock);
        buf[len - 1] = '\n';
index b98b9d94d184cd058b7ddff7c40e7b9d87f965ac..a97e802ca523138227e9930a585357fd2f873e94 100644 (file)
@@ -335,6 +335,7 @@ static struct platform_driver hid_dev_rot_platform_driver = {
        .id_table = hid_dev_rot_ids,
        .driver = {
                .name   = KBUILD_MODNAME,
+               .pm     = &hid_sensor_pm_ops,
        },
        .probe          = hid_dev_rot_probe,
        .remove         = hid_dev_rot_remove,
index 066161a4bccd90e7df35fd0c20e2648dee551a18..f962f31a5eb223c4f41d273743ed75f30e648a18 100644 (file)
@@ -136,6 +136,8 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
                ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
                *val = be32_to_cpu(buf32);
                break;
+       default:
+               ret = -EINVAL;
        }
 
        if (ret)
index 36bf50ebb187eb40195f0ede0d2d3abcc47d8ccb..89a6b05468045cbca835573fd450d4e4466f75d7 100644 (file)
@@ -1094,47 +1094,47 @@ static void cma_save_ib_info(struct sockaddr *src_addr,
        }
 }
 
-static void cma_save_ip4_info(struct sockaddr *src_addr,
-                             struct sockaddr *dst_addr,
+static void cma_save_ip4_info(struct sockaddr_in *src_addr,
+                             struct sockaddr_in *dst_addr,
                              struct cma_hdr *hdr,
                              __be16 local_port)
 {
-       struct sockaddr_in *ip4;
-
        if (src_addr) {
-               ip4 = (struct sockaddr_in *)src_addr;
-               ip4->sin_family = AF_INET;
-               ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr;
-               ip4->sin_port = local_port;
+               *src_addr = (struct sockaddr_in) {
+                       .sin_family = AF_INET,
+                       .sin_addr.s_addr = hdr->dst_addr.ip4.addr,
+                       .sin_port = local_port,
+               };
        }
 
        if (dst_addr) {
-               ip4 = (struct sockaddr_in *)dst_addr;
-               ip4->sin_family = AF_INET;
-               ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr;
-               ip4->sin_port = hdr->port;
+               *dst_addr = (struct sockaddr_in) {
+                       .sin_family = AF_INET,
+                       .sin_addr.s_addr = hdr->src_addr.ip4.addr,
+                       .sin_port = hdr->port,
+               };
        }
 }
 
-static void cma_save_ip6_info(struct sockaddr *src_addr,
-                             struct sockaddr *dst_addr,
+static void cma_save_ip6_info(struct sockaddr_in6 *src_addr,
+                             struct sockaddr_in6 *dst_addr,
                              struct cma_hdr *hdr,
                              __be16 local_port)
 {
-       struct sockaddr_in6 *ip6;
-
        if (src_addr) {
-               ip6 = (struct sockaddr_in6 *)src_addr;
-               ip6->sin6_family = AF_INET6;
-               ip6->sin6_addr = hdr->dst_addr.ip6;
-               ip6->sin6_port = local_port;
+               *src_addr = (struct sockaddr_in6) {
+                       .sin6_family = AF_INET6,
+                       .sin6_addr = hdr->dst_addr.ip6,
+                       .sin6_port = local_port,
+               };
        }
 
        if (dst_addr) {
-               ip6 = (struct sockaddr_in6 *)dst_addr;
-               ip6->sin6_family = AF_INET6;
-               ip6->sin6_addr = hdr->src_addr.ip6;
-               ip6->sin6_port = hdr->port;
+               *dst_addr = (struct sockaddr_in6) {
+                       .sin6_family = AF_INET6,
+                       .sin6_addr = hdr->src_addr.ip6,
+                       .sin6_port = hdr->port,
+               };
        }
 }
 
@@ -1159,10 +1159,12 @@ static int cma_save_ip_info(struct sockaddr *src_addr,
 
        switch (cma_get_ip_ver(hdr)) {
        case 4:
-               cma_save_ip4_info(src_addr, dst_addr, hdr, port);
+               cma_save_ip4_info((struct sockaddr_in *)src_addr,
+                                 (struct sockaddr_in *)dst_addr, hdr, port);
                break;
        case 6:
-               cma_save_ip6_info(src_addr, dst_addr, hdr, port);
+               cma_save_ip6_info((struct sockaddr_in6 *)src_addr,
+                                 (struct sockaddr_in6 *)dst_addr, hdr, port);
                break;
        default:
                return -EAFNOSUPPORT;
index 15c01c3cd540b6b0416002ca39c8a72951b3cc75..e6f9b2d745ca0eefbe02cb5e9c2680dcff60af46 100644 (file)
@@ -2636,17 +2636,26 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
        /* And we're up. Go go go! */
        of_iommu_set_ops(dev->of_node, &arm_smmu_ops);
 #ifdef CONFIG_PCI
-       pci_request_acs();
-       ret = bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
-       if (ret)
-               return ret;
+       if (pci_bus_type.iommu_ops != &arm_smmu_ops) {
+               pci_request_acs();
+               ret = bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
+               if (ret)
+                       return ret;
+       }
 #endif
 #ifdef CONFIG_ARM_AMBA
-       ret = bus_set_iommu(&amba_bustype, &arm_smmu_ops);
-       if (ret)
-               return ret;
+       if (amba_bustype.iommu_ops != &arm_smmu_ops) {
+               ret = bus_set_iommu(&amba_bustype, &arm_smmu_ops);
+               if (ret)
+                       return ret;
+       }
 #endif
-       return bus_set_iommu(&platform_bus_type, &arm_smmu_ops);
+       if (platform_bus_type.iommu_ops != &arm_smmu_ops) {
+               ret = bus_set_iommu(&platform_bus_type, &arm_smmu_ops);
+               if (ret)
+                       return ret;
+       }
+       return 0;
 }
 
 static int arm_smmu_device_remove(struct platform_device *pdev)
index c841eb7a1a7417af301e6c51a9ba464d05b1472a..8f7281444551dfc8a7b1a1bbfdb66a81f28e01ca 100644 (file)
@@ -324,8 +324,10 @@ struct arm_smmu_master_cfg {
 #define INVALID_SMENDX                 -1
 #define __fwspec_cfg(fw) ((struct arm_smmu_master_cfg *)fw->iommu_priv)
 #define fwspec_smmu(fw)  (__fwspec_cfg(fw)->smmu)
+#define fwspec_smendx(fw, i) \
+       (i >= fw->num_ids ? INVALID_SMENDX : __fwspec_cfg(fw)->smendx[i])
 #define for_each_cfg_sme(fw, i, idx) \
-       for (i = 0; idx = __fwspec_cfg(fw)->smendx[i], i < fw->num_ids; ++i)
+       for (i = 0; idx = fwspec_smendx(fw, i), i < fw->num_ids; ++i)
 
 struct arm_smmu_device {
        struct device                   *dev;
@@ -1228,6 +1230,16 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
                return -ENXIO;
        }
 
+       /*
+        * FIXME: The arch/arm DMA API code tries to attach devices to its own
+        * domains between of_xlate() and add_device() - we have no way to cope
+        * with that, so until ARM gets converted to rely on groups and default
+        * domains, just say no (but more politely than by dereferencing NULL).
+        * This should be at least a WARN_ON once that's sorted.
+        */
+       if (!fwspec->iommu_priv)
+               return -ENODEV;
+
        smmu = fwspec_smmu(fwspec);
        /* Ensure that the domain is finalised */
        ret = arm_smmu_init_domain_context(domain, smmu);
@@ -1390,7 +1402,7 @@ static int arm_smmu_add_device(struct device *dev)
                fwspec = dev->iommu_fwspec;
                if (ret)
                        goto out_free;
-       } else if (fwspec) {
+       } else if (fwspec && fwspec->ops == &arm_smmu_ops) {
                smmu = arm_smmu_get_by_node(to_of_node(fwspec->iommu_fwnode));
        } else {
                return -ENODEV;
index a4407eabf0e64fbacba5573bc3eb91204c97a19c..3965e73db51cef0f3d3b5593da18c9d9fe25fd9e 100644 (file)
@@ -1711,6 +1711,7 @@ static void disable_dmar_iommu(struct intel_iommu *iommu)
        if (!iommu->domains || !iommu->domain_ids)
                return;
 
+again:
        spin_lock_irqsave(&device_domain_lock, flags);
        list_for_each_entry_safe(info, tmp, &device_domain_list, global) {
                struct dmar_domain *domain;
@@ -1723,10 +1724,19 @@ static void disable_dmar_iommu(struct intel_iommu *iommu)
 
                domain = info->domain;
 
-               dmar_remove_one_dev_info(domain, info->dev);
+               __dmar_remove_one_dev_info(info);
 
-               if (!domain_type_is_vm_or_si(domain))
+               if (!domain_type_is_vm_or_si(domain)) {
+                       /*
+                        * The domain_exit() function  can't be called under
+                        * device_domain_lock, as it takes this lock itself.
+                        * So release the lock here and re-run the loop
+                        * afterwards.
+                        */
+                       spin_unlock_irqrestore(&device_domain_lock, flags);
                        domain_exit(domain);
+                       goto again;
+               }
        }
        spin_unlock_irqrestore(&device_domain_lock, flags);
 
index 012225587c258abb18f6946e31757112ca7f8981..b71b747ee0baae22a68c081b24132bef5f05bf2a 100644 (file)
@@ -513,6 +513,11 @@ config DVB_AS102_FE
        depends on DVB_CORE
        default DVB_AS102
 
+config DVB_GP8PSK_FE
+       tristate
+       depends on DVB_CORE
+       default DVB_USB_GP8PSK
+
 comment "DVB-C (cable) frontends"
        depends on DVB_CORE
 
index e90165ad361bbae7324cb966a1d668187be471ca..93921a4eaa275997a5ed4178de1acb1a54409430 100644 (file)
@@ -121,6 +121,7 @@ obj-$(CONFIG_DVB_RTL2832_SDR) += rtl2832_sdr.o
 obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
 obj-$(CONFIG_DVB_AF9033) += af9033.o
 obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o
+obj-$(CONFIG_DVB_GP8PSK_FE) += gp8psk-fe.o
 obj-$(CONFIG_DVB_TC90522) += tc90522.o
 obj-$(CONFIG_DVB_HORUS3A) += horus3a.o
 obj-$(CONFIG_DVB_ASCOT2E) += ascot2e.o
similarity index 72%
rename from drivers/media/usb/dvb-usb/gp8psk-fe.c
rename to drivers/media/dvb-frontends/gp8psk-fe.c
index db6eb79cde0737deba4d841da8ad85289c658282..be19afeed7a96190265127cd17ee5b5028d090e8 100644 (file)
  *
  * see Documentation/dvb/README.dvb-usb for more information
  */
-#include "gp8psk.h"
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include "gp8psk-fe.h"
+#include "dvb_frontend.h"
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
+
+#define dprintk(fmt, arg...) do {                                      \
+       if (debug)                                                      \
+               printk(KERN_DEBUG pr_fmt("%s: " fmt),                   \
+                      __func__, ##arg);                                \
+} while (0)
 
 struct gp8psk_fe_state {
        struct dvb_frontend fe;
-       struct dvb_usb_device *d;
+       void *priv;
+       const struct gp8psk_fe_ops *ops;
+       bool is_rev1;
        u8 lock;
        u16 snr;
        unsigned long next_status_check;
@@ -29,22 +45,24 @@ static int gp8psk_tuned_to_DCII(struct dvb_frontend *fe)
 {
        struct gp8psk_fe_state *st = fe->demodulator_priv;
        u8 status;
-       gp8psk_usb_in_op(st->d, GET_8PSK_CONFIG, 0, 0, &status, 1);
+
+       st->ops->in(st->priv, GET_8PSK_CONFIG, 0, 0, &status, 1);
        return status & bmDCtuned;
 }
 
 static int gp8psk_set_tuner_mode(struct dvb_frontend *fe, int mode)
 {
-       struct gp8psk_fe_state *state = fe->demodulator_priv;
-       return gp8psk_usb_out_op(state->d, SET_8PSK_CONFIG, mode, 0, NULL, 0);
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
+
+       return st->ops->out(st->priv, SET_8PSK_CONFIG, mode, 0, NULL, 0);
 }
 
 static int gp8psk_fe_update_status(struct gp8psk_fe_state *st)
 {
        u8 buf[6];
        if (time_after(jiffies,st->next_status_check)) {
-               gp8psk_usb_in_op(st->d, GET_SIGNAL_LOCK, 0,0,&st->lock,1);
-               gp8psk_usb_in_op(st->d, GET_SIGNAL_STRENGTH, 0,0,buf,6);
+               st->ops->in(st->priv, GET_SIGNAL_LOCK, 0, 0, &st->lock, 1);
+               st->ops->in(st->priv, GET_SIGNAL_STRENGTH, 0, 0, buf, 6);
                st->snr = (buf[1]) << 8 | buf[0];
                st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000;
        }
@@ -116,13 +134,12 @@ static int gp8psk_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_front
 
 static int gp8psk_fe_set_frontend(struct dvb_frontend *fe)
 {
-       struct gp8psk_fe_state *state = fe->demodulator_priv;
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
        struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        u8 cmd[10];
        u32 freq = c->frequency * 1000;
-       int gp_product_id = le16_to_cpu(state->d->udev->descriptor.idProduct);
 
-       deb_fe("%s()\n", __func__);
+       dprintk("%s()\n", __func__);
 
        cmd[4] = freq         & 0xff;
        cmd[5] = (freq >> 8)  & 0xff;
@@ -136,21 +153,21 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend *fe)
        switch (c->delivery_system) {
        case SYS_DVBS:
                if (c->modulation != QPSK) {
-                       deb_fe("%s: unsupported modulation selected (%d)\n",
+                       dprintk("%s: unsupported modulation selected (%d)\n",
                                __func__, c->modulation);
                        return -EOPNOTSUPP;
                }
                c->fec_inner = FEC_AUTO;
                break;
        case SYS_DVBS2: /* kept for backwards compatibility */
-               deb_fe("%s: DVB-S2 delivery system selected\n", __func__);
+               dprintk("%s: DVB-S2 delivery system selected\n", __func__);
                break;
        case SYS_TURBO:
-               deb_fe("%s: Turbo-FEC delivery system selected\n", __func__);
+               dprintk("%s: Turbo-FEC delivery system selected\n", __func__);
                break;
 
        default:
-               deb_fe("%s: unsupported delivery system selected (%d)\n",
+               dprintk("%s: unsupported delivery system selected (%d)\n",
                        __func__, c->delivery_system);
                return -EOPNOTSUPP;
        }
@@ -161,9 +178,9 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend *fe)
        cmd[3] = (c->symbol_rate >> 24) & 0xff;
        switch (c->modulation) {
        case QPSK:
-               if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
+               if (st->is_rev1)
                        if (gp8psk_tuned_to_DCII(fe))
-                               gp8psk_bcm4500_reload(state->d);
+                               st->ops->reload(st->priv);
                switch (c->fec_inner) {
                case FEC_1_2:
                        cmd[9] = 0; break;
@@ -207,18 +224,18 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend *fe)
                cmd[9] = 0;
                break;
        default: /* Unknown modulation */
-               deb_fe("%s: unsupported modulation selected (%d)\n",
+               dprintk("%s: unsupported modulation selected (%d)\n",
                        __func__, c->modulation);
                return -EOPNOTSUPP;
        }
 
-       if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
+       if (st->is_rev1)
                gp8psk_set_tuner_mode(fe, 0);
-       gp8psk_usb_out_op(state->d, TUNE_8PSK, 0, 0, cmd, 10);
+       st->ops->out(st->priv, TUNE_8PSK, 0, 0, cmd, 10);
 
-       state->lock = 0;
-       state->next_status_check = jiffies;
-       state->status_check_interval = 200;
+       st->lock = 0;
+       st->next_status_check = jiffies;
+       st->status_check_interval = 200;
 
        return 0;
 }
@@ -228,9 +245,9 @@ static int gp8psk_fe_send_diseqc_msg (struct dvb_frontend* fe,
 {
        struct gp8psk_fe_state *st = fe->demodulator_priv;
 
-       deb_fe("%s\n",__func__);
+       dprintk("%s\n", __func__);
 
-       if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, m->msg[0], 0,
+       if (st->ops->out(st->priv, SEND_DISEQC_COMMAND, m->msg[0], 0,
                        m->msg, m->msg_len)) {
                return -EINVAL;
        }
@@ -243,12 +260,12 @@ static int gp8psk_fe_send_diseqc_burst(struct dvb_frontend *fe,
        struct gp8psk_fe_state *st = fe->demodulator_priv;
        u8 cmd;
 
-       deb_fe("%s\n",__func__);
+       dprintk("%s\n", __func__);
 
        /* These commands are certainly wrong */
        cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01;
 
-       if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, cmd, 0,
+       if (st->ops->out(st->priv, SEND_DISEQC_COMMAND, cmd, 0,
                        &cmd, 0)) {
                return -EINVAL;
        }
@@ -258,10 +275,10 @@ static int gp8psk_fe_send_diseqc_burst(struct dvb_frontend *fe,
 static int gp8psk_fe_set_tone(struct dvb_frontend *fe,
                              enum fe_sec_tone_mode tone)
 {
-       struct gp8psk_fe_state* state = fe->demodulator_priv;
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
 
-       if (gp8psk_usb_out_op(state->d,SET_22KHZ_TONE,
-                (tone == SEC_TONE_ON), 0, NULL, 0)) {
+       if (st->ops->out(st->priv, SET_22KHZ_TONE,
+                        (tone == SEC_TONE_ON), 0, NULL, 0)) {
                return -EINVAL;
        }
        return 0;
@@ -270,9 +287,9 @@ static int gp8psk_fe_set_tone(struct dvb_frontend *fe,
 static int gp8psk_fe_set_voltage(struct dvb_frontend *fe,
                                 enum fe_sec_voltage voltage)
 {
-       struct gp8psk_fe_state* state = fe->demodulator_priv;
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
 
-       if (gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE,
+       if (st->ops->out(st->priv, SET_LNB_VOLTAGE,
                         voltage == SEC_VOLTAGE_18, 0, NULL, 0)) {
                return -EINVAL;
        }
@@ -281,52 +298,60 @@ static int gp8psk_fe_set_voltage(struct dvb_frontend *fe,
 
 static int gp8psk_fe_enable_high_lnb_voltage(struct dvb_frontend* fe, long onoff)
 {
-       struct gp8psk_fe_state* state = fe->demodulator_priv;
-       return gp8psk_usb_out_op(state->d, USE_EXTRA_VOLT, onoff, 0,NULL,0);
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
+
+       return st->ops->out(st->priv, USE_EXTRA_VOLT, onoff, 0, NULL, 0);
 }
 
 static int gp8psk_fe_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long sw_cmd)
 {
-       struct gp8psk_fe_state* state = fe->demodulator_priv;
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
        u8 cmd = sw_cmd & 0x7f;
 
-       if (gp8psk_usb_out_op(state->d,SET_DN_SWITCH, cmd, 0,
-                       NULL, 0)) {
+       if (st->ops->out(st->priv, SET_DN_SWITCH, cmd, 0, NULL, 0))
                return -EINVAL;
-       }
-       if (gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE, !!(sw_cmd & 0x80),
-                       0, NULL, 0)) {
+
+       if (st->ops->out(st->priv, SET_LNB_VOLTAGE, !!(sw_cmd & 0x80),
+                       0, NULL, 0))
                return -EINVAL;
-       }
 
        return 0;
 }
 
 static void gp8psk_fe_release(struct dvb_frontend* fe)
 {
-       struct gp8psk_fe_state *state = fe->demodulator_priv;
-       kfree(state);
+       struct gp8psk_fe_state *st = fe->demodulator_priv;
+
+       kfree(st);
 }
 
 static struct dvb_frontend_ops gp8psk_fe_ops;
 
-struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d)
+struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops,
+                                     void *priv, bool is_rev1)
 {
-       struct gp8psk_fe_state *s = kzalloc(sizeof(struct gp8psk_fe_state), GFP_KERNEL);
-       if (s == NULL)
-               goto error;
-
-       s->d = d;
-       memcpy(&s->fe.ops, &gp8psk_fe_ops, sizeof(struct dvb_frontend_ops));
-       s->fe.demodulator_priv = s;
-
-       goto success;
-error:
-       return NULL;
-success:
-       return &s->fe;
-}
+       struct gp8psk_fe_state *st;
 
+       if (!ops || !ops->in || !ops->out || !ops->reload) {
+               pr_err("Error! gp8psk-fe ops not defined.\n");
+               return NULL;
+       }
+
+       st = kzalloc(sizeof(struct gp8psk_fe_state), GFP_KERNEL);
+       if (!st)
+               return NULL;
+
+       memcpy(&st->fe.ops, &gp8psk_fe_ops, sizeof(struct dvb_frontend_ops));
+       st->fe.demodulator_priv = st;
+       st->ops = ops;
+       st->priv = priv;
+       st->is_rev1 = is_rev1;
+
+       pr_info("Frontend %sattached\n", is_rev1 ? "revision 1 " : "");
+
+       return &st->fe;
+}
+EXPORT_SYMBOL_GPL(gp8psk_fe_attach);
 
 static struct dvb_frontend_ops gp8psk_fe_ops = {
        .delsys = { SYS_DVBS },
diff --git a/drivers/media/dvb-frontends/gp8psk-fe.h b/drivers/media/dvb-frontends/gp8psk-fe.h
new file mode 100644 (file)
index 0000000..6c7944b
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * gp8psk_fe driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef GP8PSK_FE_H
+#define GP8PSK_FE_H
+
+#include <linux/types.h>
+
+/* gp8psk commands */
+
+#define GET_8PSK_CONFIG                 0x80    /* in */
+#define SET_8PSK_CONFIG                 0x81
+#define I2C_WRITE                      0x83
+#define I2C_READ                       0x84
+#define ARM_TRANSFER                    0x85
+#define TUNE_8PSK                       0x86
+#define GET_SIGNAL_STRENGTH             0x87    /* in */
+#define LOAD_BCM4500                    0x88
+#define BOOT_8PSK                       0x89    /* in */
+#define START_INTERSIL                  0x8A    /* in */
+#define SET_LNB_VOLTAGE                 0x8B
+#define SET_22KHZ_TONE                  0x8C
+#define SEND_DISEQC_COMMAND             0x8D
+#define SET_DVB_MODE                    0x8E
+#define SET_DN_SWITCH                   0x8F
+#define GET_SIGNAL_LOCK                 0x90    /* in */
+#define GET_FW_VERS                    0x92
+#define GET_SERIAL_NUMBER               0x93    /* in */
+#define USE_EXTRA_VOLT                  0x94
+#define GET_FPGA_VERS                  0x95
+#define CW3K_INIT                      0x9d
+
+/* PSK_configuration bits */
+#define bm8pskStarted                   0x01
+#define bm8pskFW_Loaded                 0x02
+#define bmIntersilOn                    0x04
+#define bmDVBmode                       0x08
+#define bm22kHz                         0x10
+#define bmSEL18V                        0x20
+#define bmDCtuned                       0x40
+#define bmArmed                         0x80
+
+/* Satellite modulation modes */
+#define ADV_MOD_DVB_QPSK 0     /* DVB-S QPSK */
+#define ADV_MOD_TURBO_QPSK 1   /* Turbo QPSK */
+#define ADV_MOD_TURBO_8PSK 2   /* Turbo 8PSK (also used for Trellis 8PSK) */
+#define ADV_MOD_TURBO_16QAM 3  /* Turbo 16QAM (also used for Trellis 8PSK) */
+
+#define ADV_MOD_DCII_C_QPSK 4  /* Digicipher II Combo */
+#define ADV_MOD_DCII_I_QPSK 5  /* Digicipher II I-stream */
+#define ADV_MOD_DCII_Q_QPSK 6  /* Digicipher II Q-stream */
+#define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */
+#define ADV_MOD_DSS_QPSK 8     /* DSS (DIRECTV) QPSK */
+#define ADV_MOD_DVB_BPSK 9     /* DVB-S BPSK */
+
+/* firmware revision id's */
+#define GP8PSK_FW_REV1                 0x020604
+#define GP8PSK_FW_REV2                 0x020704
+#define GP8PSK_FW_VERS(_fw_vers) \
+       ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0])
+
+struct gp8psk_fe_ops {
+       int (*in)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen);
+       int (*out)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen);
+       int (*reload)(void *priv);
+};
+
+struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops,
+                                     void *priv, bool is_rev1);
+
+#endif
index f95a6bc839d58f5f6cde8c37170f297f24ca8b3b..cede3975d04bd90441abcb29e6f169857561f935 100644 (file)
@@ -118,7 +118,7 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
                        *protocol = RC_TYPE_RC6_MCE;
                        dev &= 0x7f;
                        dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n",
-                                               toggle, vendor, dev, code);
+                                               *ptoggle, vendor, dev, code);
                } else {
                        *ptoggle = 0;
                        *protocol = RC_TYPE_RC6_6A_32;
index 2a7b5a963acfd902f832e8af5f7fbaa9f0f4a76c..3b3f32b426d192af84b874c0c329ce52bb8baec7 100644 (file)
@@ -8,7 +8,7 @@ obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o
 dvb-usb-vp702x-objs := vp702x.o vp702x-fe.o
 obj-$(CONFIG_DVB_USB_VP702X) += dvb-usb-vp702x.o
 
-dvb-usb-gp8psk-objs := gp8psk.o gp8psk-fe.o
+dvb-usb-gp8psk-objs := gp8psk.o
 obj-$(CONFIG_DVB_USB_GP8PSK) += dvb-usb-gp8psk.o
 
 dvb-usb-dtt200u-objs := dtt200u.o dtt200u-fe.o
index b257780fb380a7592b46f84a393209dc66f2edac..7853261906b1afd3334e8e67e74a3f4a5311a13e 100644 (file)
@@ -53,7 +53,6 @@ struct af9005_device_state {
        u8 sequence;
        int led_state;
        unsigned char data[256];
-       struct mutex data_mutex;
 };
 
 static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg,
@@ -72,7 +71,7 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg,
                return -EINVAL;
        }
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = 14;               /* rest of buffer length low */
        st->data[1] = 0;                /* rest of buffer length high */
 
@@ -140,7 +139,7 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg,
                        values[i] = st->data[8 + i];
 
 ret:
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 
 }
@@ -481,7 +480,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf,
        }
        packet_len = wlen + 5;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
 
        st->data[0] = (u8) (packet_len & 0xff);
        st->data[1] = (u8) ((packet_len & 0xff00) >> 8);
@@ -512,7 +511,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf,
                        rbuf[i] = st->data[i + 7];
        }
 
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 }
 
@@ -523,7 +522,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values,
        u8 seq;
        int ret, i;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
 
        memset(st->data, 0, sizeof(st->data));
 
@@ -559,7 +558,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values,
                for (i = 0; i < len; i++)
                        values[i] = st->data[6 + i];
        }
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
 
        return ret;
 }
@@ -847,7 +846,7 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
                return 0;
        }
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
 
        /* deb_info("rc_query\n"); */
        st->data[0] = 3;                /* rest of packet length low */
@@ -890,7 +889,7 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
        }
 
 ret:
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 }
 
@@ -1004,20 +1003,8 @@ static struct dvb_usb_device_properties af9005_properties;
 static int af9005_usb_probe(struct usb_interface *intf,
                            const struct usb_device_id *id)
 {
-       struct dvb_usb_device *d;
-       struct af9005_device_state *st;
-       int ret;
-
-       ret = dvb_usb_device_init(intf, &af9005_properties,
-                                 THIS_MODULE, &d, adapter_nr);
-
-       if (ret < 0)
-               return ret;
-
-       st = d->priv;
-       mutex_init(&st->data_mutex);
-
-       return 0;
+       return dvb_usb_device_init(intf, &af9005_properties,
+                                 THIS_MODULE, NULL, adapter_nr);
 }
 
 enum af9005_usb_table_entry {
index 8ac825413d5ac09a17f33f9a6537e0cd69e4564c..290275bc7fdee038be993754f9f103c2e22cef36 100644 (file)
@@ -42,7 +42,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 struct cinergyt2_state {
        u8 rc_counter;
        unsigned char data[64];
-       struct mutex data_mutex;
 };
 
 /* We are missing a release hook with usb_device data */
@@ -56,12 +55,12 @@ static int cinergyt2_streaming_ctrl(struct dvb_usb_adapter *adap, int enable)
        struct cinergyt2_state *st = d->priv;
        int ret;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = CINERGYT2_EP1_CONTROL_STREAM_TRANSFER;
        st->data[1] = enable ? 1 : 0;
 
        ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 64, 0);
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
 
        return ret;
 }
@@ -71,12 +70,12 @@ static int cinergyt2_power_ctrl(struct dvb_usb_device *d, int enable)
        struct cinergyt2_state *st = d->priv;
        int ret;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = CINERGYT2_EP1_SLEEP_MODE;
        st->data[1] = enable ? 0 : 1;
 
        ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 3, 0);
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
 
        return ret;
 }
@@ -89,7 +88,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap)
 
        adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev);
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = CINERGYT2_EP1_GET_FIRMWARE_VERSION;
 
        ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 3, 0);
@@ -97,7 +96,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap)
                deb_rc("cinergyt2_power_ctrl() Failed to retrieve sleep "
                        "state info\n");
        }
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
 
        /* Copy this pointer as we are gonna need it in the release phase */
        cinergyt2_usb_device = adap->dev;
@@ -166,7 +165,7 @@ static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 
        *state = REMOTE_NO_KEY_PRESSED;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS;
 
        ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
@@ -202,29 +201,17 @@ static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
        }
 
 ret:
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 }
 
 static int cinergyt2_usb_probe(struct usb_interface *intf,
                                const struct usb_device_id *id)
 {
-       struct dvb_usb_device *d;
-       struct cinergyt2_state *st;
-       int ret;
-
-       ret = dvb_usb_device_init(intf, &cinergyt2_properties,
-                                 THIS_MODULE, &d, adapter_nr);
-       if (ret < 0)
-               return ret;
-
-       st = d->priv;
-       mutex_init(&st->data_mutex);
-
-       return 0;
+       return dvb_usb_device_init(intf, &cinergyt2_properties,
+                                  THIS_MODULE, NULL, adapter_nr);
 }
 
-
 static struct usb_device_id cinergyt2_usb_table[] = {
        { USB_DEVICE(USB_VID_TERRATEC, 0x0038) },
        { 0 }
index 39772812269dc81845d85954d1c52f2f3cc429e0..243403081fa53f2860a5b67469593b5ecffae62a 100644 (file)
@@ -68,7 +68,7 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d,
 
        wo = (rbuf == NULL || rlen == 0); /* write-only */
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = cmd;
        memcpy(&st->data[1], wbuf, wlen);
        if (wo)
@@ -77,7 +77,7 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d,
                ret = dvb_usb_generic_rw(d, st->data, 1 + wlen,
                                         rbuf, rlen, 0);
 
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 }
 
@@ -1461,43 +1461,36 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
 static int cxusb_probe(struct usb_interface *intf,
                       const struct usb_device_id *id)
 {
-       struct dvb_usb_device *d;
-       struct cxusb_state *st;
-
        if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf,
                                &cxusb_bluebird_nano2_needsfirmware_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf,
                                     &cxusb_bluebird_dualdig4_rev2_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
-           0) {
-               st = d->priv;
-               mutex_init(&st->data_mutex);
-
+                                    THIS_MODULE, NULL, adapter_nr) ||
+           0)
                return 0;
-       }
 
        return -EINVAL;
 }
index 9f3ee0e47d5c63be2be07af579be384d65b3a80c..18acda19527a644fc31e0596e7206c70193cf1d0 100644 (file)
@@ -37,7 +37,6 @@ struct cxusb_state {
        struct i2c_client *i2c_client_tuner;
 
        unsigned char data[MAX_XFER_SIZE];
-       struct mutex data_mutex;
 };
 
 #endif
index 92d5408684ac1cdc33f65f578b5ee2ce525968b0..47ce9d5de4c678e78d1cd6cc075661ddaf40b0f6 100644 (file)
@@ -704,7 +704,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
        struct dvb_usb_device *d = purb->context;
        struct dib0700_rc_response *poll_reply;
        enum rc_type protocol;
-       u32 uninitialized_var(keycode);
+       u32 keycode;
        u8 toggle;
 
        deb_info("%s()\n", __func__);
@@ -745,7 +745,8 @@ static void dib0700_rc_urb_completion(struct urb *purb)
                    poll_reply->nec.data       == 0x00 &&
                    poll_reply->nec.not_data   == 0xff) {
                        poll_reply->data_state = 2;
-                       break;
+                       rc_repeat(d->rc_dev);
+                       goto resubmit;
                }
 
                if ((poll_reply->nec.data ^ poll_reply->nec.not_data) != 0xff) {
index f88572c7ae7cbd6aa10e4e9fc430a584fc6a63b0..fcbff7fb0c4e192b9409b23bc10e7e1c66222d44 100644 (file)
@@ -22,7 +22,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 struct dtt200u_state {
        unsigned char data[80];
-       struct mutex data_mutex;
 };
 
 static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
@@ -30,23 +29,24 @@ static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
        struct dtt200u_state *st = d->priv;
        int ret = 0;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
 
        st->data[0] = SET_INIT;
 
        if (onoff)
                ret = dvb_usb_generic_write(d, st->data, 2);
 
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 }
 
 static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 {
-       struct dtt200u_state *st = adap->dev->priv;
+       struct dvb_usb_device *d = adap->dev;
+       struct dtt200u_state *st = d->priv;
        int ret;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = SET_STREAMING;
        st->data[1] = onoff;
 
@@ -61,26 +61,27 @@ static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
        ret = dvb_usb_generic_write(adap->dev, st->data, 1);
 
 ret:
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
 
        return ret;
 }
 
 static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
 {
-       struct dtt200u_state *st = adap->dev->priv;
+       struct dvb_usb_device *d = adap->dev;
+       struct dtt200u_state *st = d->priv;
        int ret;
 
        pid = onoff ? pid : 0;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = SET_PID_FILTER;
        st->data[1] = index;
        st->data[2] = pid & 0xff;
        st->data[3] = (pid >> 8) & 0x1f;
 
        ret = dvb_usb_generic_write(adap->dev, st->data, 4);
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
 
        return ret;
 }
@@ -91,7 +92,7 @@ static int dtt200u_rc_query(struct dvb_usb_device *d)
        u32 scancode;
        int ret;
 
-       mutex_lock(&st->data_mutex);
+       mutex_lock(&d->data_mutex);
        st->data[0] = GET_RC_CODE;
 
        ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0);
@@ -126,7 +127,7 @@ static int dtt200u_rc_query(struct dvb_usb_device *d)
                deb_info("st->data: %*ph\n", 5, st->data);
 
 ret:
-       mutex_unlock(&st->data_mutex);
+       mutex_unlock(&d->data_mutex);
        return ret;
 }
 
@@ -145,24 +146,17 @@ static struct dvb_usb_device_properties wt220u_miglia_properties;
 static int dtt200u_usb_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
-       struct dvb_usb_device *d;
-       struct dtt200u_state *st;
-
        if (0 == dvb_usb_device_init(intf, &dtt200u_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &wt220u_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &wt220u_fc_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties,
-                                    THIS_MODULE, &d, adapter_nr) ||
+                                    THIS_MODULE, NULL, adapter_nr) ||
            0 == dvb_usb_device_init(intf, &wt220u_miglia_properties,
-                                    THIS_MODULE, &d, adapter_nr)) {
-               st = d->priv;
-               mutex_init(&st->data_mutex);
-
+                                    THIS_MODULE, NULL, adapter_nr))
                return 0;
-       }
 
        return -ENODEV;
 }
index 3896ba9a4179670687eadb63bdd199e251dc904e..84308569e7dc12a7911304fc4c8c2abb72b49082 100644 (file)
@@ -142,6 +142,7 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums)
 {
        int ret = 0;
 
+       mutex_init(&d->data_mutex);
        mutex_init(&d->usb_mutex);
        mutex_init(&d->i2c_mutex);
 
index 639c4678c65b96c82293f7546919768401f43dbd..107255b08b2b1f5c5454286938319d63b48208a9 100644 (file)
@@ -404,8 +404,12 @@ struct dvb_usb_adapter {
  *  Powered is in/decremented for each call to modify the state.
  * @udev: pointer to the device's struct usb_device.
  *
- * @usb_mutex: semaphore of USB control messages (reading needs two messages)
- * @i2c_mutex: semaphore for i2c-transfers
+ * @data_mutex: mutex to protect the data structure used to store URB data
+ * @usb_mutex: mutex of USB control messages (reading needs two messages).
+ *     Please notice that this mutex is used internally at the generic
+ *     URB control functions. So, drivers using dvb_usb_generic_rw() and
+ *     derivated functions should not lock it internally.
+ * @i2c_mutex: mutex for i2c-transfers
  *
  * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
  *
@@ -433,6 +437,7 @@ struct dvb_usb_device {
        int powered;
 
        /* locking */
+       struct mutex data_mutex;
        struct mutex usb_mutex;
 
        /* i2c */
index adfd764914517bdbbbff823ee31e5d08ebcac7fb..993bb7a72985f05140b311c811f335db7258b7ec 100644 (file)
@@ -15,6 +15,7 @@
  * see Documentation/dvb/README.dvb-usb for more information
  */
 #include "gp8psk.h"
+#include "gp8psk-fe.h"
 
 /* debug */
 static char bcm4500_firmware[] = "dvb-usb-gp8psk-02.fw";
@@ -28,34 +29,8 @@ struct gp8psk_state {
        unsigned char data[80];
 };
 
-static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers)
-{
-       return (gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6));
-}
-
-static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers)
-{
-       return (gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1));
-}
-
-static void gp8psk_info(struct dvb_usb_device *d)
-{
-       u8 fpga_vers, fw_vers[6];
-
-       if (!gp8psk_get_fw_version(d, fw_vers))
-               info("FW Version = %i.%02i.%i (0x%x)  Build %4i/%02i/%02i",
-               fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers),
-               2000 + fw_vers[5], fw_vers[4], fw_vers[3]);
-       else
-               info("failed to get FW version");
-
-       if (!gp8psk_get_fpga_version(d, &fpga_vers))
-               info("FPGA Version = %i", fpga_vers);
-       else
-               info("failed to get FPGA version");
-}
-
-int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
+static int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,
+                           u16 index, u8 *b, int blen)
 {
        struct gp8psk_state *st = d->priv;
        int ret = 0,try = 0;
@@ -67,7 +42,6 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8
                return ret;
 
        while (ret >= 0 && ret != blen && try < 3) {
-               memcpy(st->data, b, blen);
                ret = usb_control_msg(d->udev,
                        usb_rcvctrlpipe(d->udev,0),
                        req,
@@ -81,8 +55,10 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8
        if (ret < 0 || ret != blen) {
                warn("usb in %d operation failed.", req);
                ret = -EIO;
-       } else
+       } else {
                ret = 0;
+               memcpy(b, st->data, blen);
+       }
 
        deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
        debug_dump(b,blen,deb_xfer);
@@ -92,7 +68,7 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8
        return ret;
 }
 
-int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
+static int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
                             u16 index, u8 *b, int blen)
 {
        struct gp8psk_state *st = d->priv;
@@ -123,6 +99,34 @@ int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
        return ret;
 }
 
+
+static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers)
+{
+       return gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6);
+}
+
+static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers)
+{
+       return gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1);
+}
+
+static void gp8psk_info(struct dvb_usb_device *d)
+{
+       u8 fpga_vers, fw_vers[6];
+
+       if (!gp8psk_get_fw_version(d, fw_vers))
+               info("FW Version = %i.%02i.%i (0x%x)  Build %4i/%02i/%02i",
+               fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers),
+               2000 + fw_vers[5], fw_vers[4], fw_vers[3]);
+       else
+               info("failed to get FW version");
+
+       if (!gp8psk_get_fpga_version(d, &fpga_vers))
+               info("FPGA Version = %i", fpga_vers);
+       else
+               info("failed to get FPGA version");
+}
+
 static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d)
 {
        int ret;
@@ -225,10 +229,13 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
        return 0;
 }
 
-int gp8psk_bcm4500_reload(struct dvb_usb_device *d)
+static int gp8psk_bcm4500_reload(struct dvb_usb_device *d)
 {
        u8 buf;
        int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct);
+
+       deb_xfer("reloading firmware\n");
+
        /* Turn off 8psk power */
        if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1))
                return -EINVAL;
@@ -247,9 +254,47 @@ static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
        return gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0);
 }
 
+/* Callbacks for gp8psk-fe.c */
+
+static int gp8psk_fe_in(void *priv, u8 req, u16 value,
+                           u16 index, u8 *b, int blen)
+{
+       struct dvb_usb_device *d = priv;
+
+       return gp8psk_usb_in_op(d, req, value, index, b, blen);
+}
+
+static int gp8psk_fe_out(void *priv, u8 req, u16 value,
+                           u16 index, u8 *b, int blen)
+{
+       struct dvb_usb_device *d = priv;
+
+       return gp8psk_usb_out_op(d, req, value, index, b, blen);
+}
+
+static int gp8psk_fe_reload(void *priv)
+{
+       struct dvb_usb_device *d = priv;
+
+       return gp8psk_bcm4500_reload(d);
+}
+
+const struct gp8psk_fe_ops gp8psk_fe_ops = {
+       .in = gp8psk_fe_in,
+       .out = gp8psk_fe_out,
+       .reload = gp8psk_fe_reload,
+};
+
 static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap)
 {
-       adap->fe_adap[0].fe = gp8psk_fe_attach(adap->dev);
+       struct dvb_usb_device *d = adap->dev;
+       int id = le16_to_cpu(d->udev->descriptor.idProduct);
+       int is_rev1;
+
+       is_rev1 = (id == USB_PID_GENPIX_8PSK_REV_1_WARM) ? true : false;
+
+       adap->fe_adap[0].fe = dvb_attach(gp8psk_fe_attach,
+                                        &gp8psk_fe_ops, d, is_rev1);
        return 0;
 }
 
index ed32b9da484364d8f49e94f4c29342149ef563da..d8975b866deeceda0e3820a7810f5cfc2b7205d6 100644 (file)
@@ -24,58 +24,6 @@ extern int dvb_usb_gp8psk_debug;
 #define deb_info(args...) dprintk(dvb_usb_gp8psk_debug,0x01,args)
 #define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args)
 #define deb_rc(args...)   dprintk(dvb_usb_gp8psk_debug,0x04,args)
-#define deb_fe(args...)   dprintk(dvb_usb_gp8psk_debug,0x08,args)
-
-/* Twinhan Vendor requests */
-#define TH_COMMAND_IN                     0xC0
-#define TH_COMMAND_OUT                    0xC1
-
-/* gp8psk commands */
-
-#define GET_8PSK_CONFIG                 0x80    /* in */
-#define SET_8PSK_CONFIG                 0x81
-#define I2C_WRITE                      0x83
-#define I2C_READ                       0x84
-#define ARM_TRANSFER                    0x85
-#define TUNE_8PSK                       0x86
-#define GET_SIGNAL_STRENGTH             0x87    /* in */
-#define LOAD_BCM4500                    0x88
-#define BOOT_8PSK                       0x89    /* in */
-#define START_INTERSIL                  0x8A    /* in */
-#define SET_LNB_VOLTAGE                 0x8B
-#define SET_22KHZ_TONE                  0x8C
-#define SEND_DISEQC_COMMAND             0x8D
-#define SET_DVB_MODE                    0x8E
-#define SET_DN_SWITCH                   0x8F
-#define GET_SIGNAL_LOCK                 0x90    /* in */
-#define GET_FW_VERS                    0x92
-#define GET_SERIAL_NUMBER               0x93    /* in */
-#define USE_EXTRA_VOLT                  0x94
-#define GET_FPGA_VERS                  0x95
-#define CW3K_INIT                      0x9d
-
-/* PSK_configuration bits */
-#define bm8pskStarted                   0x01
-#define bm8pskFW_Loaded                 0x02
-#define bmIntersilOn                    0x04
-#define bmDVBmode                       0x08
-#define bm22kHz                         0x10
-#define bmSEL18V                        0x20
-#define bmDCtuned                       0x40
-#define bmArmed                         0x80
-
-/* Satellite modulation modes */
-#define ADV_MOD_DVB_QPSK 0     /* DVB-S QPSK */
-#define ADV_MOD_TURBO_QPSK 1   /* Turbo QPSK */
-#define ADV_MOD_TURBO_8PSK 2   /* Turbo 8PSK (also used for Trellis 8PSK) */
-#define ADV_MOD_TURBO_16QAM 3  /* Turbo 16QAM (also used for Trellis 8PSK) */
-
-#define ADV_MOD_DCII_C_QPSK 4  /* Digicipher II Combo */
-#define ADV_MOD_DCII_I_QPSK 5  /* Digicipher II I-stream */
-#define ADV_MOD_DCII_Q_QPSK 6  /* Digicipher II Q-stream */
-#define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */
-#define ADV_MOD_DSS_QPSK 8     /* DSS (DIRECTV) QPSK */
-#define ADV_MOD_DVB_BPSK 9     /* DVB-S BPSK */
 
 #define GET_USB_SPEED                     0x07
 
@@ -86,15 +34,4 @@ extern int dvb_usb_gp8psk_debug;
 #define PRODUCT_STRING_READ               0x0D
 #define FW_BCD_VERSION_READ               0x14
 
-/* firmware revision id's */
-#define GP8PSK_FW_REV1                 0x020604
-#define GP8PSK_FW_REV2                 0x020704
-#define GP8PSK_FW_VERS(_fw_vers)       ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0])
-
-extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d);
-extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
-extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
-                            u16 index, u8 *b, int blen);
-extern int gp8psk_bcm4500_reload(struct dvb_usb_device *d);
-
 #endif
index e9e6ea3ab73cf3500657d8c6001cb4eff5712568..75b9d4ac8b1e37fa3eb317aa728a4024c530539e 100644 (file)
@@ -178,7 +178,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
 
        ret = 0;
        bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
-       if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
+       if (bytes_recv < if_version_length) {
                dev_err(bus->dev, "Could not read IF version\n");
                ret = -EIO;
                goto err;
index 5a8dc5a76e0dffae3fef30d3eb93591994d733c8..3678220964fe62948a9a4d1aa2fed06b9c1a3a66 100644 (file)
@@ -2347,7 +2347,7 @@ static int mmc_test_ongoing_transfer(struct mmc_test_card *test,
        struct mmc_test_req *rq = mmc_test_req_alloc();
        struct mmc_host *host = test->card->host;
        struct mmc_test_area *t = &test->area;
-       struct mmc_async_req areq;
+       struct mmc_test_async_req test_areq = { .test = test };
        struct mmc_request *mrq;
        unsigned long timeout;
        bool expired = false;
@@ -2363,8 +2363,8 @@ static int mmc_test_ongoing_transfer(struct mmc_test_card *test,
                mrq->sbc = &rq->sbc;
        mrq->cap_cmd_during_tfr = true;
 
-       areq.mrq = mrq;
-       areq.err_check = mmc_test_check_result_async;
+       test_areq.areq.mrq = mrq;
+       test_areq.areq.err_check = mmc_test_check_result_async;
 
        mmc_test_prepare_mrq(test, mrq, t->sg, t->sg_len, dev_addr, t->blocks,
                             512, write);
@@ -2378,7 +2378,7 @@ static int mmc_test_ongoing_transfer(struct mmc_test_card *test,
 
        /* Start ongoing data request */
        if (use_areq) {
-               mmc_start_req(host, &areq, &ret);
+               mmc_start_req(host, &test_areq.areq, &ret);
                if (ret)
                        goto out_free;
        } else {
index 39fc5b2b96c59f826fb8819fb3415ea6c2ac8e99..df19777068a6237f388bb4bb9c1a8ee6917ea64b 100644 (file)
@@ -26,6 +26,8 @@
 #include "mmc_ops.h"
 #include "sd_ops.h"
 
+#define DEFAULT_CMD6_TIMEOUT_MS        500
+
 static const unsigned int tran_exp[] = {
        10000,          100000,         1000000,        10000000,
        0,              0,              0,              0
@@ -571,6 +573,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
                card->erased_byte = 0x0;
 
        /* eMMC v4.5 or later */
+       card->ext_csd.generic_cmd6_time = DEFAULT_CMD6_TIMEOUT_MS;
        if (card->ext_csd.rev >= 6) {
                card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
 
index 4fcbc4012ed03b554185cf42eeb1567b915745f6..50a674be665586af87750896f7f01924d76a6e66 100644 (file)
@@ -2940,7 +2940,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
                return ERR_PTR(-ENOMEM);
 
        /* find reset controller when exist */
-       pdata->rstc = devm_reset_control_get_optional(dev, NULL);
+       pdata->rstc = devm_reset_control_get_optional(dev, "reset");
        if (IS_ERR(pdata->rstc)) {
                if (PTR_ERR(pdata->rstc) == -EPROBE_DEFER)
                        return ERR_PTR(-EPROBE_DEFER);
index d839147e591d24f5d5d0a97d389ea04ffbaa9883..44ecebd1ea8c1834a5d311fbe36ddfc8383e3ecd 100644 (file)
@@ -661,13 +661,13 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, mmc);
 
+       spin_lock_init(&host->lock);
+
        ret = devm_request_irq(&pdev->dev, irq_err, mxs_mmc_irq_handler, 0,
                               dev_name(&pdev->dev), host);
        if (ret)
                goto out_free_dma;
 
-       spin_lock_init(&host->lock);
-
        ret = mmc_add_host(mmc);
        if (ret)
                goto out_free_dma;
index 71654b90227f6c1eac7115c84276d8490e02e550..42ef3ebb1d8cf9d57f30e48d21c3a5250aea16ea 100644 (file)
@@ -2086,6 +2086,10 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
                if (!host->tuning_done) {
                        pr_info(DRIVER_NAME ": Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock\n");
+
+                       sdhci_do_reset(host, SDHCI_RESET_CMD);
+                       sdhci_do_reset(host, SDHCI_RESET_DATA);
+
                        ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
                        ctrl &= ~SDHCI_CTRL_TUNED_CLK;
                        ctrl &= ~SDHCI_CTRL_EXEC_TUNING;
@@ -2286,10 +2290,8 @@ static bool sdhci_request_done(struct sdhci_host *host)
 
        for (i = 0; i < SDHCI_MAX_MRQS; i++) {
                mrq = host->mrqs_done[i];
-               if (mrq) {
-                       host->mrqs_done[i] = NULL;
+               if (mrq)
                        break;
-               }
        }
 
        if (!mrq) {
@@ -2320,6 +2322,17 @@ static bool sdhci_request_done(struct sdhci_host *host)
         * upon error conditions.
         */
        if (sdhci_needs_reset(host, mrq)) {
+               /*
+                * Do not finish until command and data lines are available for
+                * reset. Note there can only be one other mrq, so it cannot
+                * also be in mrqs_done, otherwise host->cmd and host->data_cmd
+                * would both be null.
+                */
+               if (host->cmd || host->data_cmd) {
+                       spin_unlock_irqrestore(&host->lock, flags);
+                       return true;
+               }
+
                /* Some controllers need this kick or reset won't work here */
                if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET)
                        /* This is to force an update */
@@ -2327,10 +2340,8 @@ static bool sdhci_request_done(struct sdhci_host *host)
 
                /* Spec says we should do both at the same time, but Ricoh
                   controllers do not like that. */
-               if (!host->cmd)
-                       sdhci_do_reset(host, SDHCI_RESET_CMD);
-               if (!host->data_cmd)
-                       sdhci_do_reset(host, SDHCI_RESET_DATA);
+               sdhci_do_reset(host, SDHCI_RESET_CMD);
+               sdhci_do_reset(host, SDHCI_RESET_DATA);
 
                host->pending_reset = false;
        }
@@ -2338,6 +2349,8 @@ static bool sdhci_request_done(struct sdhci_host *host)
        if (!sdhci_has_requests(host))
                sdhci_led_deactivate(host);
 
+       host->mrqs_done[i] = NULL;
+
        mmiowb();
        spin_unlock_irqrestore(&host->lock, flags);
 
@@ -2512,9 +2525,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
        if (!host->data) {
                struct mmc_command *data_cmd = host->data_cmd;
 
-               if (data_cmd)
-                       host->data_cmd = NULL;
-
                /*
                 * The "data complete" interrupt is also used to
                 * indicate that a busy state has ended. See comment
@@ -2522,11 +2532,13 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
                 */
                if (data_cmd && (data_cmd->flags & MMC_RSP_BUSY)) {
                        if (intmask & SDHCI_INT_DATA_TIMEOUT) {
+                               host->data_cmd = NULL;
                                data_cmd->error = -ETIMEDOUT;
                                sdhci_finish_mrq(host, data_cmd->mrq);
                                return;
                        }
                        if (intmask & SDHCI_INT_DATA_END) {
+                               host->data_cmd = NULL;
                                /*
                                 * Some cards handle busy-end interrupt
                                 * before the command completed, so make
@@ -2912,6 +2924,10 @@ int sdhci_runtime_resume_host(struct sdhci_host *host)
                spin_unlock_irqrestore(&host->lock, flags);
        }
 
+       if ((mmc->caps2 & MMC_CAP2_HS400_ES) &&
+           mmc->ops->hs400_enhanced_strobe)
+               mmc->ops->hs400_enhanced_strobe(mmc, &mmc->ios);
+
        spin_lock_irqsave(&host->lock, flags);
 
        host->runtime_suspended = false;
index 83deda4bb4d6d52d4b529b71712f71114aac1445..6f9563a9648852e48929a39b29982a7bbef52c0e 100644 (file)
@@ -133,7 +133,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy)
                return -ENOMEM;
 
        bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply, if_version_length);
-       if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
+       if (bytes_recv < 0 || bytes_recv < if_version_length) {
                pr_err("Could not read IF version\n");
                r = -EIO;
                goto err;
index 0d5c29ae51def6735e21aafb6579cda7c56ebd6f..7310a261c858bab090bab14ecf3646626aac7651 100644 (file)
@@ -112,17 +112,17 @@ MODULE_PARM_DESC(xeon_b2b_usd_bar2_addr64,
 
 module_param_named(xeon_b2b_usd_bar4_addr64,
                   xeon_b2b_usd_addr.bar4_addr64, ullong, 0644);
-MODULE_PARM_DESC(xeon_b2b_usd_bar2_addr64,
+MODULE_PARM_DESC(xeon_b2b_usd_bar4_addr64,
                 "XEON B2B USD BAR 4 64-bit address");
 
 module_param_named(xeon_b2b_usd_bar4_addr32,
                   xeon_b2b_usd_addr.bar4_addr32, ullong, 0644);
-MODULE_PARM_DESC(xeon_b2b_usd_bar2_addr64,
+MODULE_PARM_DESC(xeon_b2b_usd_bar4_addr32,
                 "XEON B2B USD split-BAR 4 32-bit address");
 
 module_param_named(xeon_b2b_usd_bar5_addr32,
                   xeon_b2b_usd_addr.bar5_addr32, ullong, 0644);
-MODULE_PARM_DESC(xeon_b2b_usd_bar2_addr64,
+MODULE_PARM_DESC(xeon_b2b_usd_bar5_addr32,
                 "XEON B2B USD split-BAR 5 32-bit address");
 
 module_param_named(xeon_b2b_dsd_bar2_addr64,
@@ -132,17 +132,17 @@ MODULE_PARM_DESC(xeon_b2b_dsd_bar2_addr64,
 
 module_param_named(xeon_b2b_dsd_bar4_addr64,
                   xeon_b2b_dsd_addr.bar4_addr64, ullong, 0644);
-MODULE_PARM_DESC(xeon_b2b_dsd_bar2_addr64,
+MODULE_PARM_DESC(xeon_b2b_dsd_bar4_addr64,
                 "XEON B2B DSD BAR 4 64-bit address");
 
 module_param_named(xeon_b2b_dsd_bar4_addr32,
                   xeon_b2b_dsd_addr.bar4_addr32, ullong, 0644);
-MODULE_PARM_DESC(xeon_b2b_dsd_bar2_addr64,
+MODULE_PARM_DESC(xeon_b2b_dsd_bar4_addr32,
                 "XEON B2B DSD split-BAR 4 32-bit address");
 
 module_param_named(xeon_b2b_dsd_bar5_addr32,
                   xeon_b2b_dsd_addr.bar5_addr32, ullong, 0644);
-MODULE_PARM_DESC(xeon_b2b_dsd_bar2_addr64,
+MODULE_PARM_DESC(xeon_b2b_dsd_bar5_addr32,
                 "XEON B2B DSD split-BAR 5 32-bit address");
 
 #ifndef ioread64
@@ -1755,6 +1755,8 @@ static int xeon_setup_b2b_mw(struct intel_ntb_dev *ndev,
                                            XEON_B2B_MIN_SIZE);
                if (!ndev->peer_mmio)
                        return -EIO;
+
+               ndev->peer_addr = pci_resource_start(pdev, b2b_bar);
        }
 
        return 0;
@@ -2019,6 +2021,7 @@ static int intel_ntb_init_pci(struct intel_ntb_dev *ndev, struct pci_dev *pdev)
                goto err_mmio;
        }
        ndev->peer_mmio = ndev->self_mmio;
+       ndev->peer_addr = pci_resource_start(pdev, 0);
 
        return 0;
 
index 8601c10acf74e3267d1d5501e20149ce74cdb38b..4eb8adb345084430947ccabdf6962c1099fbb703 100644 (file)
@@ -257,7 +257,7 @@ enum {
 #define NTB_QP_DEF_NUM_ENTRIES 100
 #define NTB_LINK_DOWN_TIMEOUT  10
 #define DMA_RETRIES            20
-#define DMA_OUT_RESOURCE_TO    50
+#define DMA_OUT_RESOURCE_TO    msecs_to_jiffies(50)
 
 static void ntb_transport_rxc_db(unsigned long data);
 static const struct ntb_ctx_ops ntb_transport_ops;
index 6a50f20bf1cde0e080f766ede5df147a9ea11a7b..e75d4fdc08663905eace859cff6cdebdb97e92b5 100644 (file)
@@ -72,7 +72,7 @@
 #define MAX_THREADS            32
 #define MAX_TEST_SIZE          SZ_1M
 #define MAX_SRCS               32
-#define DMA_OUT_RESOURCE_TO    50
+#define DMA_OUT_RESOURCE_TO    msecs_to_jiffies(50)
 #define DMA_RETRIES            20
 #define SZ_4G                  (1ULL << 32)
 #define MAX_SEG_ORDER          20 /* no larger than 1M for kmalloc buffer */
@@ -589,7 +589,7 @@ static ssize_t debugfs_run_read(struct file *filp, char __user *ubuf,
                return -ENOMEM;
 
        if (mutex_is_locked(&perf->run_mutex)) {
-               out_off = snprintf(buf, 64, "running\n");
+               out_off = scnprintf(buf, 64, "running\n");
                goto read_from_buf;
        }
 
@@ -600,14 +600,14 @@ static ssize_t debugfs_run_read(struct file *filp, char __user *ubuf,
                        break;
 
                if (pctx->status) {
-                       out_off += snprintf(buf + out_off, 1024 - out_off,
+                       out_off += scnprintf(buf + out_off, 1024 - out_off,
                                            "%d: error %d\n", i,
                                            pctx->status);
                        continue;
                }
 
                rate = div64_u64(pctx->copied, pctx->diff_us);
-               out_off += snprintf(buf + out_off, 1024 - out_off,
+               out_off += scnprintf(buf + out_off, 1024 - out_off,
                        "%d: copied %llu bytes in %llu usecs, %llu MBytes/s\n",
                        i, pctx->copied, pctx->diff_us, rate);
        }
index 7d311799fca1696ee7c5884fa2d58af2f2061816..435861189d97f87fc07397e6a174571d524bdb6f 100644 (file)
@@ -88,7 +88,7 @@ MODULE_PARM_DESC(delay_ms, "Milliseconds to delay the response to peer");
 
 static unsigned long db_init = 0x7;
 module_param(db_init, ulong, 0644);
-MODULE_PARM_DESC(delay_ms, "Initial doorbell bits to ring on the peer");
+MODULE_PARM_DESC(db_init, "Initial doorbell bits to ring on the peer");
 
 struct pp_ctx {
        struct ntb_dev                  *ntb;
index f5e3011e31fcdfea4c4e067ca8b808bc66a2fffd..5daf2f4be0cd74d5cc1360ed95ceb7c9a10385ea 100644 (file)
@@ -612,7 +612,7 @@ int nvme_nvm_register(struct nvme_ns *ns, char *disk_name, int node,
 
        ret = nvm_register(dev);
 
-       ns->lba_shift = ilog2(dev->sec_size) - 9;
+       ns->lba_shift = ilog2(dev->sec_size);
 
        if (sysfs_create_group(&dev->dev.kobj, attrs))
                pr_warn("%s: failed to create sysfs group for identification\n",
index d687e6de24a07e11a2c2cecd94e7711610d52005..a0bccb54a9bd1d762d42967e6722b43d1b4a93ec 100644 (file)
@@ -2077,8 +2077,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
                        name = of_get_property(of_aliases, "stdout", NULL);
                if (name)
                        of_stdout = of_find_node_opts_by_path(name, &of_stdout_options);
-               if (of_stdout)
-                       console_set_by_of();
        }
 
        if (!of_aliases)
index e0b22dab9b7ac37c81d380bfe00751f4496f4516..e04f69beb42d0f8ef04de5da85702f238ff2a8a5 100644 (file)
@@ -190,6 +190,9 @@ struct rockchip_pcie {
        struct  reset_control *mgmt_rst;
        struct  reset_control *mgmt_sticky_rst;
        struct  reset_control *pipe_rst;
+       struct  reset_control *pm_rst;
+       struct  reset_control *aclk_rst;
+       struct  reset_control *pclk_rst;
        struct  clk *aclk_pcie;
        struct  clk *aclk_perf_pcie;
        struct  clk *hclk_pcie;
@@ -408,6 +411,44 @@ static int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
 
        gpiod_set_value(rockchip->ep_gpio, 0);
 
+       err = reset_control_assert(rockchip->aclk_rst);
+       if (err) {
+               dev_err(dev, "assert aclk_rst err %d\n", err);
+               return err;
+       }
+
+       err = reset_control_assert(rockchip->pclk_rst);
+       if (err) {
+               dev_err(dev, "assert pclk_rst err %d\n", err);
+               return err;
+       }
+
+       err = reset_control_assert(rockchip->pm_rst);
+       if (err) {
+               dev_err(dev, "assert pm_rst err %d\n", err);
+               return err;
+       }
+
+       udelay(10);
+
+       err = reset_control_deassert(rockchip->pm_rst);
+       if (err) {
+               dev_err(dev, "deassert pm_rst err %d\n", err);
+               return err;
+       }
+
+       err = reset_control_deassert(rockchip->aclk_rst);
+       if (err) {
+               dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err);
+               return err;
+       }
+
+       err = reset_control_deassert(rockchip->pclk_rst);
+       if (err) {
+               dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err);
+               return err;
+       }
+
        err = phy_init(rockchip->phy);
        if (err < 0) {
                dev_err(dev, "fail to init phy, err %d\n", err);
@@ -781,6 +822,27 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
                return PTR_ERR(rockchip->pipe_rst);
        }
 
+       rockchip->pm_rst = devm_reset_control_get(dev, "pm");
+       if (IS_ERR(rockchip->pm_rst)) {
+               if (PTR_ERR(rockchip->pm_rst) != -EPROBE_DEFER)
+                       dev_err(dev, "missing pm reset property in node\n");
+               return PTR_ERR(rockchip->pm_rst);
+       }
+
+       rockchip->pclk_rst = devm_reset_control_get(dev, "pclk");
+       if (IS_ERR(rockchip->pclk_rst)) {
+               if (PTR_ERR(rockchip->pclk_rst) != -EPROBE_DEFER)
+                       dev_err(dev, "missing pclk reset property in node\n");
+               return PTR_ERR(rockchip->pclk_rst);
+       }
+
+       rockchip->aclk_rst = devm_reset_control_get(dev, "aclk");
+       if (IS_ERR(rockchip->aclk_rst)) {
+               if (PTR_ERR(rockchip->aclk_rst) != -EPROBE_DEFER)
+                       dev_err(dev, "missing aclk reset property in node\n");
+               return PTR_ERR(rockchip->aclk_rst);
+       }
+
        rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH);
        if (IS_ERR(rockchip->ep_gpio)) {
                dev_err(dev, "missing ep-gpios property in node\n");
index 66c4d8f4223377d6bb54849d7794fc8172b1e0a2..9526e341988ba469cdfbe48ff23591e3180d1119 100644 (file)
@@ -121,6 +121,14 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
                return -EINVAL;
        }
 
+       /*
+        * If we have a shadow copy in RAM, the PCI device doesn't respond
+        * to the shadow range, so we don't need to claim it, and upstream
+        * bridges don't need to route the range to the device.
+        */
+       if (res->flags & IORESOURCE_ROM_SHADOW)
+               return 0;
+
        root = pci_find_parent_resource(dev, res);
        if (!root) {
                dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n",
index 153f3122283deb9fa4260c0e1da0c443a5fde2c0..b6b316de055c7129648904cbdae92cafb593e8dd 100644 (file)
@@ -107,7 +107,7 @@ int soc_pcmcia_regulator_set(struct soc_pcmcia_socket *skt,
 
                ret = regulator_enable(r->reg);
        } else {
-               regulator_disable(r->reg);
+               ret = regulator_disable(r->reg);
        }
        if (ret == 0)
                r->on = on;
index 32ae78c8ca17655d877a66952d098d56a0eacf3c..c85fb0b59729de9febdbbcbeec59e2bcd80d1a2d 100644 (file)
@@ -198,7 +198,8 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev)
        } else {
                int ret;
 
-               ret = phy_create_lookup(d_phy->usb11_phy, "usb-phy", "ohci.0");
+               ret = phy_create_lookup(d_phy->usb11_phy, "usb-phy",
+                                       "ohci-da8xx");
                if (ret)
                        dev_warn(dev, "Failed to create usb11 phy lookup\n");
                ret = phy_create_lookup(d_phy->usb20_phy, "usb-phy",
@@ -216,7 +217,7 @@ static int da8xx_usb_phy_remove(struct platform_device *pdev)
 
        if (!pdev->dev.of_node) {
                phy_remove_lookup(d_phy->usb20_phy, "usb-phy", "musb-da8xx");
-               phy_remove_lookup(d_phy->usb11_phy, "usb-phy", "ohci.0");
+               phy_remove_lookup(d_phy->usb11_phy, "usb-phy", "ohci-da8xx");
        }
 
        return 0;
index a2b4c6b58aea66d0b06cb153359ea3c31d4f6e66..6904633cad687d114cf19eb3292aba9896feb408 100644 (file)
@@ -249,21 +249,10 @@ static int rockchip_pcie_phy_init(struct phy *phy)
 static int rockchip_pcie_phy_exit(struct phy *phy)
 {
        struct rockchip_pcie_phy *rk_phy = phy_get_drvdata(phy);
-       int err = 0;
 
        clk_disable_unprepare(rk_phy->clk_pciephy_ref);
 
-       err = reset_control_deassert(rk_phy->phy_rst);
-       if (err) {
-               dev_err(&phy->dev, "deassert phy_rst err %d\n", err);
-               goto err_reset;
-       }
-
-       return err;
-
-err_reset:
-       clk_prepare_enable(rk_phy->clk_pciephy_ref);
-       return err;
+       return 0;
 }
 
 static const struct phy_ops ops = {
index b9342a2af7b3666f86471d649bd134a4baa9ff13..fec34f5213c46739b5231f34bfe628731c231a9a 100644 (file)
@@ -264,7 +264,7 @@ static int sun4i_usb_phy_init(struct phy *_phy)
                return ret;
        }
 
-       if (data->cfg->enable_pmu_unk1) {
+       if (phy->pmu && data->cfg->enable_pmu_unk1) {
                val = readl(phy->pmu + REG_PMU_UNK1);
                writel(val & ~2, phy->pmu + REG_PMU_UNK1);
        }
index c8c72e8259d38bc47c83a4222c7311f6e97e7036..87b46390b69597a3299143f3ec4e0ab282475718 100644 (file)
@@ -26,7 +26,7 @@
 
 #define ASPEED_G5_NR_PINS 228
 
-#define COND1          SIG_DESC_BIT(SCU90, 6, 0)
+#define COND1          { SCU90, BIT(6), 0, 0 }
 #define COND2          { SCU94, GENMASK(1, 0), 0, 0 }
 
 #define B14 0
index 7f77007163985762abc6110f282eec762bdc8a92..5d1e505c3c63d76a85af0dcb7051b9a3da15c2e5 100644 (file)
@@ -844,6 +844,6 @@ static struct platform_driver iproc_gpio_driver = {
 
 static int __init iproc_gpio_init(void)
 {
-       return platform_driver_probe(&iproc_gpio_driver, iproc_gpio_probe);
+       return platform_driver_register(&iproc_gpio_driver);
 }
 arch_initcall_sync(iproc_gpio_init);
index 35783db1c10bad5f50bb8ac41a59307dc97b852e..c8deb8be1da785fd15d8f5182b3b19143ca3c33f 100644 (file)
@@ -741,6 +741,6 @@ static struct platform_driver nsp_gpio_driver = {
 
 static int __init nsp_gpio_init(void)
 {
-       return platform_driver_probe(&nsp_gpio_driver, nsp_gpio_probe);
+       return platform_driver_register(&nsp_gpio_driver);
 }
 arch_initcall_sync(nsp_gpio_init);
index 47613201269af42dd3fff670c92008333bf0adf0..79c4e14a5a75e94fec9315588896bcfe9a104c11 100644 (file)
@@ -687,6 +687,7 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev,
        if (!info->functions)
                return -ENOMEM;
 
+       info->group_index = 0;
        if (flat_funcs) {
                info->ngroups = of_get_child_count(np);
        } else {
index 30389f4ccab4935c20ddcbed2c5a543e77d33fc5..c43b1e9a06aff0ba3fa94f49967ca4259ed77ced 100644 (file)
@@ -1652,12 +1652,15 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int chv_pinctrl_suspend(struct device *dev)
+static int chv_pinctrl_suspend_noirq(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
+       unsigned long flags;
        int i;
 
+       raw_spin_lock_irqsave(&chv_lock, flags);
+
        pctrl->saved_intmask = readl(pctrl->regs + CHV_INTMASK);
 
        for (i = 0; i < pctrl->community->npins; i++) {
@@ -1678,15 +1681,20 @@ static int chv_pinctrl_suspend(struct device *dev)
                ctx->padctrl1 = readl(reg);
        }
 
+       raw_spin_unlock_irqrestore(&chv_lock, flags);
+
        return 0;
 }
 
-static int chv_pinctrl_resume(struct device *dev)
+static int chv_pinctrl_resume_noirq(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
        struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
+       unsigned long flags;
        int i;
 
+       raw_spin_lock_irqsave(&chv_lock, flags);
+
        /*
         * Mask all interrupts before restoring per-pin configuration
         * registers because we don't know in which state BIOS left them
@@ -1731,12 +1739,15 @@ static int chv_pinctrl_resume(struct device *dev)
        chv_writel(0xffff, pctrl->regs + CHV_INTSTAT);
        chv_writel(pctrl->saved_intmask, pctrl->regs + CHV_INTMASK);
 
+       raw_spin_unlock_irqrestore(&chv_lock, flags);
+
        return 0;
 }
 #endif
 
 static const struct dev_pm_ops chv_pinctrl_pm_ops = {
-       SET_LATE_SYSTEM_SLEEP_PM_OPS(chv_pinctrl_suspend, chv_pinctrl_resume)
+       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(chv_pinctrl_suspend_noirq,
+                                     chv_pinctrl_resume_noirq)
 };
 
 static const struct acpi_device_id chv_pinctrl_acpi_match[] = {
index 99da4cf91031b49757cc24735057b72c3d4f760e..b7bb371679692e5dd76186be130ed4b4a6a86cb3 100644 (file)
@@ -1512,7 +1512,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info,
        if (info->irqmux_base || gpio_irq > 0) {
                err = gpiochip_irqchip_add(&bank->gpio_chip, &st_gpio_irqchip,
                                           0, handle_simple_irq,
-                                          IRQ_TYPE_LEVEL_LOW);
+                                          IRQ_TYPE_NONE);
                if (err) {
                        gpiochip_remove(&bank->gpio_chip);
                        dev_info(dev, "could not add irqchip\n");
index 200667f08c373eb027f2bcc4253f564563586e96..efc43711ff5cbcff2c94838e06ead49623ab9118 100644 (file)
@@ -1092,9 +1092,11 @@ int stm32_pctl_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       ret = stm32_pctrl_dt_setup_irq(pdev, pctl);
-       if (ret)
-               return ret;
+       if (of_find_property(np, "interrupt-parent", NULL)) {
+               ret = stm32_pctrl_dt_setup_irq(pdev, pctl);
+               if (ret)
+                       return ret;
+       }
 
        for_each_child_of_node(np, child)
                if (of_property_read_bool(child, "gpio-controller"))
index a2323941e67707711f6e2c2738057d2f21744e4d..a7614fc542b52aaaa4f58d91ea43bd9625e8de32 100644 (file)
@@ -933,6 +933,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = {
                        DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 900"),
                },
        },
+       {
+               .ident = "Lenovo Yoga 900",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_BOARD_NAME, "VIUU4"),
+               },
+       },
        {
                .ident = "Lenovo YOGA 910-13IKB",
                .matches = {
index ed5874217ee76cf4364d8bbd6f8e49f26e19c215..12dbb50633761b40253adff49f0c3881b40fed90 100644 (file)
@@ -264,7 +264,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
                return AE_OK;
 
        if (acpi_match_device_ids(dev, ids) == 0)
-               if (acpi_create_platform_device(dev))
+               if (acpi_create_platform_device(dev, NULL))
                        dev_info(&dev->dev,
                                 "intel-hid: created platform device\n");
 
index 146d02f8c9bc01c99c791bb45ba8df77ce7bb64b..78080763df51768f04548e1627d3baded9bbac14 100644 (file)
@@ -164,7 +164,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
                return AE_OK;
 
        if (acpi_match_device_ids(dev, ids) == 0)
-               if (acpi_create_platform_device(dev))
+               if (acpi_create_platform_device(dev, NULL))
                        dev_info(&dev->dev,
                                 "intel-vbtn: created platform device\n");
 
index feac4576b837101c35cf7442ca07ee47496633fe..2df07ee8f3c33e9f5e92fd776554bd44e614e836 100644 (file)
 #include <linux/acpi.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
+#include <linux/dmi.h>
 
 MODULE_AUTHOR("Azael Avalos");
 MODULE_DESCRIPTION("Toshiba WMI Hotkey Driver");
 MODULE_LICENSE("GPL");
 
-#define TOSHIBA_WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
+#define WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
 
-MODULE_ALIAS("wmi:"TOSHIBA_WMI_EVENT_GUID);
+MODULE_ALIAS("wmi:"WMI_EVENT_GUID);
 
 static struct input_dev *toshiba_wmi_input_dev;
 
@@ -63,6 +64,16 @@ static void toshiba_wmi_notify(u32 value, void *context)
        kfree(response.pointer);
 }
 
+static struct dmi_system_id toshiba_wmi_dmi_table[] __initdata = {
+       {
+               .ident = "Toshiba laptop",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+               },
+       },
+       {}
+};
+
 static int __init toshiba_wmi_input_setup(void)
 {
        acpi_status status;
@@ -81,7 +92,7 @@ static int __init toshiba_wmi_input_setup(void)
        if (err)
                goto err_free_dev;
 
-       status = wmi_install_notify_handler(TOSHIBA_WMI_EVENT_GUID,
+       status = wmi_install_notify_handler(WMI_EVENT_GUID,
                                            toshiba_wmi_notify, NULL);
        if (ACPI_FAILURE(status)) {
                err = -EIO;
@@ -95,7 +106,7 @@ static int __init toshiba_wmi_input_setup(void)
        return 0;
 
  err_remove_notifier:
-       wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
+       wmi_remove_notify_handler(WMI_EVENT_GUID);
  err_free_keymap:
        sparse_keymap_free(toshiba_wmi_input_dev);
  err_free_dev:
@@ -105,7 +116,7 @@ static int __init toshiba_wmi_input_setup(void)
 
 static void toshiba_wmi_input_destroy(void)
 {
-       wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
+       wmi_remove_notify_handler(WMI_EVENT_GUID);
        sparse_keymap_free(toshiba_wmi_input_dev);
        input_unregister_device(toshiba_wmi_input_dev);
 }
@@ -114,7 +125,8 @@ static int __init toshiba_wmi_init(void)
 {
        int ret;
 
-       if (!wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
+       if (!wmi_has_guid(WMI_EVENT_GUID) ||
+           !dmi_check_system(toshiba_wmi_dmi_table))
                return -ENODEV;
 
        ret = toshiba_wmi_input_setup();
@@ -130,7 +142,7 @@ static int __init toshiba_wmi_init(void)
 
 static void __exit toshiba_wmi_exit(void)
 {
-       if (wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
+       if (wmi_has_guid(WMI_EVENT_GUID))
                toshiba_wmi_input_destroy();
 }
 
index d1421139e6eac615d1e3ae2a9af1e02ee78d0822..2ffe029ff2b6ff29fbaaada58d277d89d2643f31 100644 (file)
@@ -2081,9 +2081,10 @@ void cxgbi_cleanup_task(struct iscsi_task *task)
        /*  never reached the xmit task callout */
        if (tdata->skb)
                __kfree_skb(tdata->skb);
-       memset(tdata, 0, sizeof(*tdata));
 
        task_release_itt(task, task->hdr_itt);
+       memset(tdata, 0, sizeof(*tdata));
+
        iscsi_tcp_cleanup_task(task);
 }
 EXPORT_SYMBOL_GPL(cxgbi_cleanup_task);
index 241829e596680f8be89941fc43ce0db642e29b18..7bb20684e9fabc3b8b950f45aee0a94d1c4e1589 100644 (file)
@@ -793,6 +793,7 @@ static void alua_rtpg_work(struct work_struct *work)
                WARN_ON(pg->flags & ALUA_PG_RUN_RTPG);
                WARN_ON(pg->flags & ALUA_PG_RUN_STPG);
                spin_unlock_irqrestore(&pg->lock, flags);
+               kref_put(&pg->kref, release_port_group);
                return;
        }
        if (pg->flags & ALUA_SYNC_STPG)
@@ -890,6 +891,7 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
                /* Do not queue if the worker is already running */
                if (!(pg->flags & ALUA_PG_RUNNING)) {
                        kref_get(&pg->kref);
+                       sdev = NULL;
                        start_queue = 1;
                }
        }
@@ -901,7 +903,8 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
        if (start_queue &&
            !queue_delayed_work(alua_wq, &pg->rtpg_work,
                                msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS))) {
-               scsi_device_put(sdev);
+               if (sdev)
+                       scsi_device_put(sdev);
                kref_put(&pg->kref, release_port_group);
        }
 }
index ca86c885dfaab4f0fb6ae3595922d6f1a77974be..3aaea713bf3712b2ad8874aaecf8a6337b7a2119 100644 (file)
@@ -2233,7 +2233,7 @@ struct megasas_instance_template {
 };
 
 #define MEGASAS_IS_LOGICAL(scp)                                                \
-       (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
+       ((scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1)
 
 #define MEGASAS_DEV_INDEX(scp)                                         \
        (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) +   \
index 209a969a979d8768fa5d0dc15bc5f921f2c4ec1c..8aa769a2d919d31f45619d32c4346a36753281d7 100644 (file)
@@ -1273,9 +1273,9 @@ scsih_target_alloc(struct scsi_target *starget)
                        sas_target_priv_data->handle = raid_device->handle;
                        sas_target_priv_data->sas_address = raid_device->wwid;
                        sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME;
-                       sas_target_priv_data->raid_device = raid_device;
                        if (ioc->is_warpdrive)
-                               raid_device->starget = starget;
+                               sas_target_priv_data->raid_device = raid_device;
+                       raid_device->starget = starget;
                }
                spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
                return 0;
index ace65db1d2a25becd6dc3c4a158d932f7dab8fff..567fa080e261c693845a2755093f7b5042b68b9d 100644 (file)
@@ -707,6 +707,11 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
        srb_t *sp;
        int rval;
 
+       if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) {
+               cmd->result = DID_NO_CONNECT << 16;
+               goto qc24_fail_command;
+       }
+
        if (ha->flags.eeh_busy) {
                if (ha->flags.pci_channel_io_perm_failure) {
                        ql_dbg(ql_dbg_aer, vha, 0x9010,
@@ -1451,6 +1456,15 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
                for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
                        sp = req->outstanding_cmds[cnt];
                        if (sp) {
+                               /* Get a reference to the sp and drop the lock.
+                                * The reference ensures this sp->done() call
+                                * - and not the call in qla2xxx_eh_abort() -
+                                * ends the SCSI command (with result 'res').
+                                */
+                               sp_get(sp);
+                               spin_unlock_irqrestore(&ha->hardware_lock, flags);
+                               qla2xxx_eh_abort(GET_CMD_SP(sp));
+                               spin_lock_irqsave(&ha->hardware_lock, flags);
                                req->outstanding_cmds[cnt] = NULL;
                                sp->done(vha, sp, res);
                        }
@@ -2341,6 +2355,8 @@ qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)
 {
        scsi_qla_host_t *vha = shost_priv(shost);
 
+       if (test_bit(UNLOADING, &vha->dpc_flags))
+               return 1;
        if (!vha->host)
                return 1;
        if (time > vha->hw->loop_reset_delay * HZ)
index 4a0d3cdc607cd5d8bfdb28867187fd7d12df0919..15ca09cd16f34ad6f7a8ece088e1dababef3a1b5 100644 (file)
@@ -793,6 +793,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
        unsigned long flags;
        int result = SUCCESS;
        DECLARE_COMPLETION_ONSTACK(abort_cmp);
+       int done;
 
        scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n",
                    adapter->host->host_no, cmd);
@@ -824,10 +825,10 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
        pvscsi_abort_cmd(adapter, ctx);
        spin_unlock_irqrestore(&adapter->hw_lock, flags);
        /* Wait for 2 secs for the completion. */
-       wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
+       done = wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
        spin_lock_irqsave(&adapter->hw_lock, flags);
 
-       if (!completion_done(&abort_cmp)) {
+       if (!done) {
                /*
                 * Failed to abort the command, unmark the fact that it
                 * was requested to be aborted.
index c097d2ccbde3163eaa9d1ab0a20f402446c79002..d41292ef85f2ff93b879237a8da7f2357c489b24 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <linux/types.h>
 
-#define PVSCSI_DRIVER_VERSION_STRING   "1.0.6.0-k"
+#define PVSCSI_DRIVER_VERSION_STRING   "1.0.7.0-k"
 
 #define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128
 
index 7043eb0543f6b15c98161e341b354a05e7748e02..5ab49a798164bfb8c400609ed4f36fa2c0126cc6 100644 (file)
@@ -207,7 +207,8 @@ static int ni_tio_clock_period_ps(const struct ni_gpct *counter,
                 * clock period is specified by user with prescaling
                 * already taken into account.
                 */
-               return counter->clock_period_ps;
+               *period_ps = counter->clock_period_ps;
+               return 0;
        }
 
        switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) {
index 34307ac3f2558b1e30794bd77c7c2b85ae4839e3..d33d6fe078ad730ae3cdb4c7d9291c23d3711397 100644 (file)
@@ -186,6 +186,7 @@ int arche_platform_change_state(enum arche_platform_state state,
 exit:
        spin_unlock_irqrestore(&arche_pdata->wake_lock, flags);
        mutex_unlock(&arche_pdata->platform_state_mutex);
+       put_device(&pdev->dev);
        of_node_put(np);
        return ret;
 }
index 5eecf1cb1028892796872ad592daf3a5e4d89e3c..3892a747041082518f3c1cbec66755b180124e24 100644 (file)
@@ -655,6 +655,7 @@ static void ad5933_work(struct work_struct *work)
        __be16 buf[2];
        int val[2];
        unsigned char status;
+       int ret;
 
        mutex_lock(&indio_dev->mlock);
        if (st->state == AD5933_CTRL_INIT_START_FREQ) {
@@ -662,19 +663,22 @@ static void ad5933_work(struct work_struct *work)
                ad5933_cmd(st, AD5933_CTRL_START_SWEEP);
                st->state = AD5933_CTRL_START_SWEEP;
                schedule_delayed_work(&st->work, st->poll_time_jiffies);
-               mutex_unlock(&indio_dev->mlock);
-               return;
+               goto out;
        }
 
-       ad5933_i2c_read(st->client, AD5933_REG_STATUS, 1, &status);
+       ret = ad5933_i2c_read(st->client, AD5933_REG_STATUS, 1, &status);
+       if (ret)
+               goto out;
 
        if (status & AD5933_STAT_DATA_VALID) {
                int scan_count = bitmap_weight(indio_dev->active_scan_mask,
                                               indio_dev->masklength);
-               ad5933_i2c_read(st->client,
+               ret = ad5933_i2c_read(st->client,
                                test_bit(1, indio_dev->active_scan_mask) ?
                                AD5933_REG_REAL_DATA : AD5933_REG_IMAG_DATA,
                                scan_count * 2, (u8 *)buf);
+               if (ret)
+                       goto out;
 
                if (scan_count == 2) {
                        val[0] = be16_to_cpu(buf[0]);
@@ -686,8 +690,7 @@ static void ad5933_work(struct work_struct *work)
        } else {
                /* no data available - try again later */
                schedule_delayed_work(&st->work, st->poll_time_jiffies);
-               mutex_unlock(&indio_dev->mlock);
-               return;
+               goto out;
        }
 
        if (status & AD5933_STAT_SWEEP_DONE) {
@@ -700,7 +703,7 @@ static void ad5933_work(struct work_struct *work)
                ad5933_cmd(st, AD5933_CTRL_INC_FREQ);
                schedule_delayed_work(&st->work, st->poll_time_jiffies);
        }
-
+out:
        mutex_unlock(&indio_dev->mlock);
 }
 
index a324322ee0ad1ebec13e280368538056a691fb18..499952c8ef3915ba54afe52347bc220cbad1387c 100644 (file)
@@ -106,13 +106,12 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 {
        struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
        struct serio *ser_dev;
-       char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
 
-       ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
+       ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL);
        if (!ser_dev)
                return -ENOMEM;
 
-       ser_dev->id.type = SERIO_PS_PSTHRU;
+       ser_dev->id.type = SERIO_8042;
        ser_dev->write = ps2_sendcommand;
        ser_dev->start = ps2_startstreaming;
        ser_dev->stop = ps2_stopstreaming;
@@ -127,9 +126,6 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 
        serio_register_port(ser_dev);
 
-       /* mouse reset */
-       nvec_write_async(nvec, mouse_reset, sizeof(mouse_reset));
-
        return 0;
 }
 
index 955247979aaa4d9a72575d9ed3c9f1c13995cb5a..4ed6d8d7712ae1077395f6921430d9319e3a9df2 100644 (file)
 
 #define PANEL_PLANE_TL                                0x08001C
 #define PANEL_PLANE_TL_TOP_SHIFT                      16
-#define PANEL_PLANE_TL_TOP_MASK                       (0xeff << 16)
-#define PANEL_PLANE_TL_LEFT_MASK                      0xeff
+#define PANEL_PLANE_TL_TOP_MASK                       (0x7ff << 16)
+#define PANEL_PLANE_TL_LEFT_MASK                      0x7ff
 
 #define PANEL_PLANE_BR                                0x080020
 #define PANEL_PLANE_BR_BOTTOM_SHIFT                   16
-#define PANEL_PLANE_BR_BOTTOM_MASK                    (0xeff << 16)
-#define PANEL_PLANE_BR_RIGHT_MASK                     0xeff
+#define PANEL_PLANE_BR_BOTTOM_MASK                    (0x7ff << 16)
+#define PANEL_PLANE_BR_RIGHT_MASK                     0x7ff
 
 #define PANEL_HORIZONTAL_TOTAL                        0x080024
 #define PANEL_HORIZONTAL_TOTAL_TOTAL_SHIFT            16
index 78f0f85bebdc25ef971405175feb621865f4cad1..fada988512a1622a9551a5d6d5ae7482d78ac35f 100644 (file)
@@ -932,8 +932,6 @@ static int wait_serial_change(struct acm *acm, unsigned long arg)
        DECLARE_WAITQUEUE(wait, current);
        struct async_icount old, new;
 
-       if (arg & (TIOCM_DSR | TIOCM_RI | TIOCM_CD))
-               return -EINVAL;
        do {
                spin_lock_irq(&acm->read_lock);
                old = acm->oldcount;
@@ -1161,6 +1159,8 @@ static int acm_probe(struct usb_interface *intf,
        if (quirks == IGNORE_DEVICE)
                return -ENODEV;
 
+       memset(&h, 0x00, sizeof(struct usb_cdc_parsed_header));
+
        num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR;
 
        /* handle quirks deadly to normal probing*/
index 7287a763cd0cc4ca5a114ed687e6c34b0bdd643d..fea446900cadd06dcf857bb9cdaa3c9b0ba79025 100644 (file)
@@ -769,15 +769,14 @@ static int dwc3_core_init(struct dwc3 *dwc)
        return 0;
 
 err4:
-       phy_power_off(dwc->usb2_generic_phy);
+       phy_power_off(dwc->usb3_generic_phy);
 
 err3:
-       phy_power_off(dwc->usb3_generic_phy);
+       phy_power_off(dwc->usb2_generic_phy);
 
 err2:
        usb_phy_set_suspend(dwc->usb2_phy, 1);
        usb_phy_set_suspend(dwc->usb3_phy, 1);
-       dwc3_core_exit(dwc);
 
 err1:
        usb_phy_shutdown(dwc->usb2_phy);
index 89a2f712fdfe32f5fc0a6fc0681b0d8db005e2a2..aaaf256f71dd63091aec15f0e6b64eaec03ef8f0 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/slab.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/usb/of.h>
 
 #include "core.h"
index fe1811650dbc3d9fb0fc6a983486cbae3b653475..5d1bd13a56c11f61b50c0b0ec4a772311946672b 100644 (file)
@@ -588,14 +588,6 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
 
        req->length = length;
 
-       /* throttle high/super speed IRQ rate back slightly */
-       if (gadget_is_dualspeed(dev->gadget))
-               req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH ||
-                                      dev->gadget->speed == USB_SPEED_SUPER)) &&
-                                       !list_empty(&dev->tx_reqs))
-                       ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0)
-                       : 0;
-
        retval = usb_ep_queue(in, req, GFP_ATOMIC);
        switch (retval) {
        default:
index d793f548dfe26aef387d13b703454abe67beb5be..a9a1e4c40480cf2c5c7c7995aa5d337d3ef3ee87 100644 (file)
@@ -995,6 +995,14 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
        }
        val = readl(base + ext_cap_offset);
 
+       /* Auto handoff never worked for these devices. Force it and continue */
+       if ((pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) ||
+                       (pdev->vendor == PCI_VENDOR_ID_RENESAS
+                        && pdev->device == 0x0014)) {
+               val = (val | XHCI_HC_OS_OWNED) & ~XHCI_HC_BIOS_OWNED;
+               writel(val, base + ext_cap_offset);
+       }
+
        /* If the BIOS owns the HC, signal that the OS wants it, and wait */
        if (val & XHCI_HC_BIOS_OWNED) {
                writel(val | XHCI_HC_OS_OWNED, base + ext_cap_offset);
index 210b7e43a6fd40bb6a626a9f300fc2bbe1eb0200..2440f88e07a35781433ba501fd60d8cf0b246431 100644 (file)
@@ -479,7 +479,8 @@ static int da8xx_probe(struct platform_device *pdev)
 
        glue->phy = devm_phy_get(&pdev->dev, "usb-phy");
        if (IS_ERR(glue->phy)) {
-               dev_err(&pdev->dev, "failed to get phy\n");
+               if (PTR_ERR(glue->phy) != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "failed to get phy\n");
                return PTR_ERR(glue->phy);
        }
 
index 27dadc0d9114bf14d6034906153d7f1df60be4a5..e01116e4c0671c18f0c3905c9474ac4ca1f7375a 100644 (file)
@@ -2114,11 +2114,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                musb->io.ep_offset = musb_flat_ep_offset;
                musb->io.ep_select = musb_flat_ep_select;
        }
-       /* And override them with platform specific ops if specified. */
-       if (musb->ops->ep_offset)
-               musb->io.ep_offset = musb->ops->ep_offset;
-       if (musb->ops->ep_select)
-               musb->io.ep_select = musb->ops->ep_select;
 
        /* At least tusb6010 has its own offsets */
        if (musb->ops->ep_offset)
index d059ad4d0dbdc76f8fbbdbfc47dfd990d2006fc5..97ee1b46db698f03dee8ea50beb00e864bff0579 100644 (file)
@@ -56,8 +56,11 @@ static struct uwb_rc *uwb_rc_find_by_index(int index)
        struct uwb_rc *rc = NULL;
 
        dev = class_find_device(&uwb_rc_class, NULL, &index, uwb_rc_index_match);
-       if (dev)
+       if (dev) {
                rc = dev_get_drvdata(dev);
+               put_device(dev);
+       }
+
        return rc;
 }
 
@@ -467,7 +470,9 @@ struct uwb_rc *__uwb_rc_try_get(struct uwb_rc *target_rc)
        if (dev) {
                rc = dev_get_drvdata(dev);
                __uwb_rc_get(rc);
+               put_device(dev);
        }
+
        return rc;
 }
 EXPORT_SYMBOL_GPL(__uwb_rc_try_get);
@@ -520,8 +525,11 @@ struct uwb_rc *uwb_rc_get_by_grandpa(const struct device *grandpa_dev)
 
        dev = class_find_device(&uwb_rc_class, NULL, grandpa_dev,
                                find_rc_grandpa);
-       if (dev)
+       if (dev) {
                rc = dev_get_drvdata(dev);
+               put_device(dev);
+       }
+
        return rc;
 }
 EXPORT_SYMBOL_GPL(uwb_rc_get_by_grandpa);
@@ -553,8 +561,10 @@ struct uwb_rc *uwb_rc_get_by_dev(const struct uwb_dev_addr *addr)
        struct uwb_rc *rc = NULL;
 
        dev = class_find_device(&uwb_rc_class, NULL, addr, find_rc_dev);
-       if (dev)
+       if (dev) {
                rc = dev_get_drvdata(dev);
+               put_device(dev);
+       }
 
        return rc;
 }
index c1304b8d498530124c7ca30319c12cc823e84d6e..678e93741ae156bf5d2c41b7a52f7b215262210d 100644 (file)
@@ -97,6 +97,8 @@ static bool uwb_rc_class_device_exists(struct uwb_rc *target_rc)
 
        dev = class_find_device(&uwb_rc_class, NULL, target_rc, find_rc);
 
+       put_device(dev);
+
        return (dev != NULL);
 }
 
index 1157e13a36d681ecba8e926bb9e91943cfeb6723..428484f2f8413dc6972da9857b3392264b9e6421 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1078,6 +1078,17 @@ static void aio_complete(struct kiocb *kiocb, long res, long res2)
        unsigned tail, pos, head;
        unsigned long   flags;
 
+       if (kiocb->ki_flags & IOCB_WRITE) {
+               struct file *file = kiocb->ki_filp;
+
+               /*
+                * Tell lockdep we inherited freeze protection from submission
+                * thread.
+                */
+               __sb_writers_acquired(file_inode(file)->i_sb, SB_FREEZE_WRITE);
+               file_end_write(file);
+       }
+
        /*
         * Special case handling for sync iocbs:
         *  - events go directly into the iocb for fast handling
@@ -1392,122 +1403,106 @@ SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
        return -EINVAL;
 }
 
-typedef ssize_t (rw_iter_op)(struct kiocb *, struct iov_iter *);
-
-static int aio_setup_vectored_rw(int rw, char __user *buf, size_t len,
-                                struct iovec **iovec,
-                                bool compat,
-                                struct iov_iter *iter)
+static int aio_setup_rw(int rw, struct iocb *iocb, struct iovec **iovec,
+               bool vectored, bool compat, struct iov_iter *iter)
 {
+       void __user *buf = (void __user *)(uintptr_t)iocb->aio_buf;
+       size_t len = iocb->aio_nbytes;
+
+       if (!vectored) {
+               ssize_t ret = import_single_range(rw, buf, len, *iovec, iter);
+               *iovec = NULL;
+               return ret;
+       }
 #ifdef CONFIG_COMPAT
        if (compat)
-               return compat_import_iovec(rw,
-                               (struct compat_iovec __user *)buf,
-                               len, UIO_FASTIOV, iovec, iter);
+               return compat_import_iovec(rw, buf, len, UIO_FASTIOV, iovec,
+                               iter);
 #endif
-       return import_iovec(rw, (struct iovec __user *)buf,
-                               len, UIO_FASTIOV, iovec, iter);
+       return import_iovec(rw, buf, len, UIO_FASTIOV, iovec, iter);
 }
 
-/*
- * aio_run_iocb:
- *     Performs the initial checks and io submission.
- */
-static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode,
-                           char __user *buf, size_t len, bool compat)
+static inline ssize_t aio_ret(struct kiocb *req, ssize_t ret)
+{
+       switch (ret) {
+       case -EIOCBQUEUED:
+               return ret;
+       case -ERESTARTSYS:
+       case -ERESTARTNOINTR:
+       case -ERESTARTNOHAND:
+       case -ERESTART_RESTARTBLOCK:
+               /*
+                * There's no easy way to restart the syscall since other AIO's
+                * may be already running. Just fail this IO with EINTR.
+                */
+               ret = -EINTR;
+               /*FALLTHRU*/
+       default:
+               aio_complete(req, ret, 0);
+               return 0;
+       }
+}
+
+static ssize_t aio_read(struct kiocb *req, struct iocb *iocb, bool vectored,
+               bool compat)
 {
        struct file *file = req->ki_filp;
-       ssize_t ret;
-       int rw;
-       fmode_t mode;
-       rw_iter_op *iter_op;
        struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
        struct iov_iter iter;
+       ssize_t ret;
 
-       switch (opcode) {
-       case IOCB_CMD_PREAD:
-       case IOCB_CMD_PREADV:
-               mode    = FMODE_READ;
-               rw      = READ;
-               iter_op = file->f_op->read_iter;
-               goto rw_common;
-
-       case IOCB_CMD_PWRITE:
-       case IOCB_CMD_PWRITEV:
-               mode    = FMODE_WRITE;
-               rw      = WRITE;
-               iter_op = file->f_op->write_iter;
-               goto rw_common;
-rw_common:
-               if (unlikely(!(file->f_mode & mode)))
-                       return -EBADF;
-
-               if (!iter_op)
-                       return -EINVAL;
-
-               if (opcode == IOCB_CMD_PREADV || opcode == IOCB_CMD_PWRITEV)
-                       ret = aio_setup_vectored_rw(rw, buf, len,
-                                               &iovec, compat, &iter);
-               else {
-                       ret = import_single_range(rw, buf, len, iovec, &iter);
-                       iovec = NULL;
-               }
-               if (!ret)
-                       ret = rw_verify_area(rw, file, &req->ki_pos,
-                                            iov_iter_count(&iter));
-               if (ret < 0) {
-                       kfree(iovec);
-                       return ret;
-               }
-
-               if (rw == WRITE)
-                       file_start_write(file);
-
-               ret = iter_op(req, &iter);
-
-               if (rw == WRITE)
-                       file_end_write(file);
-               kfree(iovec);
-               break;
-
-       case IOCB_CMD_FDSYNC:
-               if (!file->f_op->aio_fsync)
-                       return -EINVAL;
-
-               ret = file->f_op->aio_fsync(req, 1);
-               break;
+       if (unlikely(!(file->f_mode & FMODE_READ)))
+               return -EBADF;
+       if (unlikely(!file->f_op->read_iter))
+               return -EINVAL;
 
-       case IOCB_CMD_FSYNC:
-               if (!file->f_op->aio_fsync)
-                       return -EINVAL;
+       ret = aio_setup_rw(READ, iocb, &iovec, vectored, compat, &iter);
+       if (ret)
+               return ret;
+       ret = rw_verify_area(READ, file, &req->ki_pos, iov_iter_count(&iter));
+       if (!ret)
+               ret = aio_ret(req, file->f_op->read_iter(req, &iter));
+       kfree(iovec);
+       return ret;
+}
 
-               ret = file->f_op->aio_fsync(req, 0);
-               break;
+static ssize_t aio_write(struct kiocb *req, struct iocb *iocb, bool vectored,
+               bool compat)
+{
+       struct file *file = req->ki_filp;
+       struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
+       struct iov_iter iter;
+       ssize_t ret;
 
-       default:
-               pr_debug("EINVAL: no operation provided\n");
+       if (unlikely(!(file->f_mode & FMODE_WRITE)))
+               return -EBADF;
+       if (unlikely(!file->f_op->write_iter))
                return -EINVAL;
-       }
 
-       if (ret != -EIOCBQUEUED) {
+       ret = aio_setup_rw(WRITE, iocb, &iovec, vectored, compat, &iter);
+       if (ret)
+               return ret;
+       ret = rw_verify_area(WRITE, file, &req->ki_pos, iov_iter_count(&iter));
+       if (!ret) {
+               req->ki_flags |= IOCB_WRITE;
+               file_start_write(file);
+               ret = aio_ret(req, file->f_op->write_iter(req, &iter));
                /*
-                * There's no easy way to restart the syscall since other AIO's
-                * may be already running. Just fail this IO with EINTR.
+                * We release freeze protection in aio_complete().  Fool lockdep
+                * by telling it the lock got released so that it doesn't
+                * complain about held lock when we return to userspace.
                 */
-               if (unlikely(ret == -ERESTARTSYS || ret == -ERESTARTNOINTR ||
-                            ret == -ERESTARTNOHAND ||
-                            ret == -ERESTART_RESTARTBLOCK))
-                       ret = -EINTR;
-               aio_complete(req, ret, 0);
+               __sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE);
        }
-
-       return 0;
+       kfree(iovec);
+       return ret;
 }
 
 static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
                         struct iocb *iocb, bool compat)
 {
        struct aio_kiocb *req;
+       struct file *file;
        ssize_t ret;
 
        /* enforce forwards compatibility on users */
@@ -1530,7 +1525,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
        if (unlikely(!req))
                return -EAGAIN;
 
-       req->common.ki_filp = fget(iocb->aio_fildes);
+       req->common.ki_filp = file = fget(iocb->aio_fildes);
        if (unlikely(!req->common.ki_filp)) {
                ret = -EBADF;
                goto out_put_req;
@@ -1565,13 +1560,29 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
        req->ki_user_iocb = user_iocb;
        req->ki_user_data = iocb->aio_data;
 
-       ret = aio_run_iocb(&req->common, iocb->aio_lio_opcode,
-                          (char __user *)(unsigned long)iocb->aio_buf,
-                          iocb->aio_nbytes,
-                          compat);
-       if (ret)
-               goto out_put_req;
+       get_file(file);
+       switch (iocb->aio_lio_opcode) {
+       case IOCB_CMD_PREAD:
+               ret = aio_read(&req->common, iocb, false, compat);
+               break;
+       case IOCB_CMD_PWRITE:
+               ret = aio_write(&req->common, iocb, false, compat);
+               break;
+       case IOCB_CMD_PREADV:
+               ret = aio_read(&req->common, iocb, true, compat);
+               break;
+       case IOCB_CMD_PWRITEV:
+               ret = aio_write(&req->common, iocb, true, compat);
+               break;
+       default:
+               pr_debug("invalid aio operation %d\n", iocb->aio_lio_opcode);
+               ret = -EINVAL;
+               break;
+       }
+       fput(file);
 
+       if (ret && ret != -EIOCBQUEUED)
+               goto out_put_req;
        return 0;
 out_put_req:
        put_reqs_available(ctx, 1);
index 18630e80020809f18a6a534b2a88249bfa81bd80..f995e3528a33107bfa1caab3b09b2b5f5af8cf32 100644 (file)
@@ -1770,7 +1770,6 @@ const struct file_operations ceph_file_fops = {
        .fsync = ceph_fsync,
        .lock = ceph_lock,
        .flock = ceph_flock,
-       .splice_read = generic_file_splice_read,
        .splice_write = iter_file_splice_write,
        .unlocked_ioctl = ceph_ioctl,
        .compat_ioctl   = ceph_ioctl,
index 281b768000e664e4d4ef9092d4bb567d003623a0..eb9c92c9b20f5de5e325d7a05e5d055d0816989e 100644 (file)
@@ -1,6 +1,7 @@
 #include <linux/slab.h>
 #include <linux/file.h>
 #include <linux/fdtable.h>
+#include <linux/freezer.h>
 #include <linux/mm.h>
 #include <linux/stat.h>
 #include <linux/fcntl.h>
@@ -423,7 +424,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
        if (core_waiters > 0) {
                struct core_thread *ptr;
 
+               freezer_do_not_count();
                wait_for_completion(&core_state->startup);
+               freezer_count();
                /*
                 * Wait for all the threads to become inactive, so that
                 * all the thread context (extended register state, like
index 7555ba889d1fce916cc96b8f23c03ad4d6037366..ebecfb8fba067cd4316e1c59e12c472c97d930a6 100644 (file)
@@ -314,7 +314,8 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
                /* Match the full socket address */
                if (!rpc_cmp_addr_port(sap, clap))
                        /* Match all xprt_switch full socket addresses */
-                       if (!rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient,
+                       if (IS_ERR(clp->cl_rpcclient) ||
+                            !rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient,
                                                           sap))
                                continue;
 
index c8162c660c440bb28eb7e31fbd33ce1b4c3b1438..5551e8ef67fd0b64faa92688a8fa38b05bbb0c78 100644 (file)
@@ -98,7 +98,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,
                return end;
        }
        namelen = strlen(base);
-       if (flags & NFS_PATH_CANONICAL) {
+       if (*end == '/') {
                /* Strip off excess slashes in base string */
                while (namelen > 0 && base[namelen - 1] == '/')
                        namelen--;
index b62973045a3e048016f1af48f761fdb152f3908d..a61350f75c741d734475cfa38903118d673b76aa 100644 (file)
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
        __must_hold(&tbl->slot_tbl_lock)
 {
        struct nfs4_slot *slot;
+       int ret;
 
        slot = nfs4_lookup_slot(tbl, slotid);
-       if (IS_ERR(slot))
-               return PTR_ERR(slot);
-       *seq_nr = slot->seq_nr;
-       return 0;
+       ret = PTR_ERR_OR_ZERO(slot);
+       if (!ret)
+               *seq_nr = slot->seq_nr;
+
+       return ret;
 }
 
 /*
@@ -196,7 +198,7 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
 static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl,
                u32 slotid, u32 seq_nr)
 {
-       u32 cur_seq;
+       u32 cur_seq = 0;
        bool ret = false;
 
        spin_lock(&tbl->slot_tbl_lock);
index 56b2d96f9103e42c57e5dd490f2561c8a10c554a..259ef85f435aa7f9e0b0e4d06d3ce24a9e7a3ad3 100644 (file)
@@ -146,6 +146,8 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh,
        u32 id;
        int i;
 
+       if (fsinfo->nlayouttypes == 0)
+               goto out_no_driver;
        if (!(server->nfs_client->cl_exchange_flags &
                 (EXCHGID4_FLAG_USE_NON_PNFS | EXCHGID4_FLAG_USE_PNFS_MDS))) {
                printk(KERN_ERR "NFS: %s: cl_exchange_flags 0x%x\n",
index a1861357900127e19182932c39322c55d17fe5fe..0ee19ecc982d4e4ef8137836ba4d753559eb7612 100644 (file)
@@ -1544,8 +1544,6 @@ const struct file_operations ntfs_dir_ops = {
        .iterate        = ntfs_readdir,         /* Read directory contents. */
 #ifdef NTFS_RW
        .fsync          = ntfs_dir_fsync,       /* Sync a directory to disk. */
-       /*.aio_fsync    = ,*/                   /* Sync all outstanding async
-                                                  i/o operations on a kiocb. */
 #endif /* NTFS_RW */
        /*.ioctl        = ,*/                   /* Perform function on the
                                                   mounted filesystem. */
index e7054e2ac9227dc4687a98beea6e005c2d03d988..3ecb9f337b7d318868ad1c1ebaaf7ea331aeb623 100644 (file)
@@ -3699,7 +3699,7 @@ static void ocfs2_dx_dir_transfer_leaf(struct inode *dir, u32 split_hash,
 static int ocfs2_dx_dir_rebalance_credits(struct ocfs2_super *osb,
                                          struct ocfs2_dx_root_block *dx_root)
 {
-       int credits = ocfs2_clusters_to_blocks(osb->sb, 2);
+       int credits = ocfs2_clusters_to_blocks(osb->sb, 3);
 
        credits += ocfs2_calc_extend_credits(osb->sb, &dx_root->dr_list);
        credits += ocfs2_quota_trans_credits(osb->sb);
index eb09aa026723820099a91ed4563caff0e22b8512..d484068ca716022441df1b275e4e56374c64afc5 100644 (file)
@@ -141,6 +141,9 @@ static struct client_debug_mask client_debug_mask;
  */
 static DEFINE_MUTEX(orangefs_debug_lock);
 
+/* Used to protect data in ORANGEFS_KMOD_DEBUG_HELP_FILE */
+static DEFINE_MUTEX(orangefs_help_file_lock);
+
 /*
  * initialize kmod debug operations, create orangefs debugfs dir and
  * ORANGEFS_KMOD_DEBUG_HELP_FILE.
@@ -289,6 +292,8 @@ static void *help_start(struct seq_file *m, loff_t *pos)
 
        gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_start: start\n");
 
+       mutex_lock(&orangefs_help_file_lock);
+
        if (*pos == 0)
                payload = m->private;
 
@@ -305,6 +310,7 @@ static void *help_next(struct seq_file *m, void *v, loff_t *pos)
 static void help_stop(struct seq_file *m, void *p)
 {
        gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_stop: start\n");
+       mutex_unlock(&orangefs_help_file_lock);
 }
 
 static int help_show(struct seq_file *m, void *v)
@@ -610,32 +616,54 @@ static int orangefs_prepare_cdm_array(char *debug_array_string)
  * /sys/kernel/debug/orangefs/debug-help can be catted to
  * see all the available kernel and client debug keywords.
  *
- * When the kernel boots, we have no idea what keywords the
+ * When orangefs.ko initializes, we have no idea what keywords the
  * client supports, nor their associated masks.
  *
- * We pass through this function once at boot and stamp a
+ * We pass through this function once at module-load and stamp a
  * boilerplate "we don't know" message for the client in the
  * debug-help file. We pass through here again when the client
  * starts and then we can fill out the debug-help file fully.
  *
  * The client might be restarted any number of times between
- * reboots, we only build the debug-help file the first time.
+ * module reloads, we only build the debug-help file the first time.
  */
 int orangefs_prepare_debugfs_help_string(int at_boot)
 {
-       int rc = -EINVAL;
-       int i;
-       int byte_count = 0;
        char *client_title = "Client Debug Keywords:\n";
        char *kernel_title = "Kernel Debug Keywords:\n";
+       size_t string_size =  DEBUG_HELP_STRING_SIZE;
+       size_t result_size;
+       size_t i;
+       char *new;
+       int rc = -EINVAL;
 
        gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
 
-       if (at_boot) {
-               byte_count += strlen(HELP_STRING_UNINITIALIZED);
+       if (at_boot)
                client_title = HELP_STRING_UNINITIALIZED;
-       } else {
-               /*
+
+       /* build a new debug_help_string. */
+       new = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL);
+       if (!new) {
+               rc = -ENOMEM;
+               goto out;
+       }
+
+       /*
+        * strlcat(dst, src, size) will append at most
+        * "size - strlen(dst) - 1" bytes of src onto dst,
+        * null terminating the result, and return the total
+        * length of the string it tried to create.
+        *
+        * We'll just plow through here building our new debug
+        * help string and let strlcat take care of assuring that
+        * dst doesn't overflow.
+        */
+       strlcat(new, client_title, string_size);
+
+       if (!at_boot) {
+
+                /*
                 * fill the client keyword/mask array and remember
                 * how many elements there were.
                 */
@@ -644,64 +672,40 @@ int orangefs_prepare_debugfs_help_string(int at_boot)
                if (cdm_element_count <= 0)
                        goto out;
 
-               /* Count the bytes destined for debug_help_string. */
-               byte_count += strlen(client_title);
-
                for (i = 0; i < cdm_element_count; i++) {
-                       byte_count += strlen(cdm_array[i].keyword + 2);
-                       if (byte_count >= DEBUG_HELP_STRING_SIZE) {
-                               pr_info("%s: overflow 1!\n", __func__);
-                               goto out;
-                       }
+                       strlcat(new, "\t", string_size);
+                       strlcat(new, cdm_array[i].keyword, string_size);
+                       strlcat(new, "\n", string_size);
                }
-
-               gossip_debug(GOSSIP_UTILS_DEBUG,
-                            "%s: cdm_element_count:%d:\n",
-                            __func__,
-                            cdm_element_count);
        }
 
-       byte_count += strlen(kernel_title);
+       strlcat(new, "\n", string_size);
+       strlcat(new, kernel_title, string_size);
+
        for (i = 0; i < num_kmod_keyword_mask_map; i++) {
-               byte_count +=
-                       strlen(s_kmod_keyword_mask_map[i].keyword + 2);
-               if (byte_count >= DEBUG_HELP_STRING_SIZE) {
-                       pr_info("%s: overflow 2!\n", __func__);
-                       goto out;
-               }
+               strlcat(new, "\t", string_size);
+               strlcat(new, s_kmod_keyword_mask_map[i].keyword, string_size);
+               result_size = strlcat(new, "\n", string_size);
        }
 
-       /* build debug_help_string. */
-       debug_help_string = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL);
-       if (!debug_help_string) {
-               rc = -ENOMEM;
+       /* See if we tried to put too many bytes into "new"... */
+       if (result_size >= string_size) {
+               kfree(new);
                goto out;
        }
 
-       strcat(debug_help_string, client_title);
-
-       if (!at_boot) {
-               for (i = 0; i < cdm_element_count; i++) {
-                       strcat(debug_help_string, "\t");
-                       strcat(debug_help_string, cdm_array[i].keyword);
-                       strcat(debug_help_string, "\n");
-               }
-       }
-
-       strcat(debug_help_string, "\n");
-       strcat(debug_help_string, kernel_title);
-
-       for (i = 0; i < num_kmod_keyword_mask_map; i++) {
-               strcat(debug_help_string, "\t");
-               strcat(debug_help_string, s_kmod_keyword_mask_map[i].keyword);
-               strcat(debug_help_string, "\n");
+       if (at_boot) {
+               debug_help_string = new;
+       } else {
+               mutex_lock(&orangefs_help_file_lock);
+               memset(debug_help_string, 0, DEBUG_HELP_STRING_SIZE);
+               strlcat(debug_help_string, new, string_size);
+               mutex_unlock(&orangefs_help_file_lock);
        }
 
        rc = 0;
 
-out:
-
-       return rc;
+out:   return rc;
 
 }
 
@@ -959,8 +963,12 @@ int orangefs_debugfs_new_client_string(void __user *arg)
        ret = copy_from_user(&client_debug_array_string,
                                      (void __user *)arg,
                                      ORANGEFS_MAX_DEBUG_STRING_LEN);
-       if (ret != 0)
+
+       if (ret != 0) {
+               pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
+                       __func__);
                return -EIO;
+       }
 
        /*
         * The real client-core makes an effort to ensure
@@ -975,45 +983,18 @@ int orangefs_debugfs_new_client_string(void __user *arg)
        client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] =
                '\0';
        
-       if (ret != 0) {
-               pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
-                       __func__);
-               return -EIO;
-       }
-
        pr_info("%s: client debug array string has been received.\n",
                __func__);
 
        if (!help_string_initialized) {
 
-               /* Free the "we don't know yet" default string... */
-               kfree(debug_help_string);
-
-               /* build a proper debug help string */
+               /* Build a proper debug help string. */
                if (orangefs_prepare_debugfs_help_string(0)) {
                        gossip_err("%s: no debug help string \n",
                                   __func__);
                        return -EIO;
                }
 
-               /* Replace the boilerplate boot-time debug-help file. */
-               debugfs_remove(help_file_dentry);
-
-               help_file_dentry =
-                       debugfs_create_file(
-                               ORANGEFS_KMOD_DEBUG_HELP_FILE,
-                               0444,
-                               debug_dir,
-                               debug_help_string,
-                               &debug_help_fops);
-
-               if (!help_file_dentry) {
-                       gossip_err("%s: debugfs_create_file failed for"
-                                  " :%s:!\n",
-                                  __func__,
-                                  ORANGEFS_KMOD_DEBUG_HELP_FILE);
-                       return -EIO;
-               }
        }
 
        debug_mask_to_string(&client_debug_mask, 1);
index 2e5b03065f345a3e9f48d0401f0def348eeaa1e6..4113eb0495bf90549daca478dd0f8c5a7940680a 100644 (file)
@@ -124,7 +124,7 @@ static int __init orangefs_init(void)
         * unknown at boot time.
         *
         * orangefs_prepare_debugfs_help_string will be used again
-        * later to rebuild the debug-help file after the client starts
+        * later to rebuild the debug-help-string after the client starts
         * and passes along the needed info. The argument signifies
         * which time orangefs_prepare_debugfs_help_string is being
         * called.
@@ -152,7 +152,9 @@ static int __init orangefs_init(void)
 
        ret = register_filesystem(&orangefs_fs_type);
        if (ret == 0) {
-               pr_info("orangefs: module version %s loaded\n", ORANGEFS_VERSION);
+               pr_info("%s: module version %s loaded\n",
+                       __func__,
+                       ORANGEFS_VERSION);
                ret = 0;
                goto out;
        }
index 153d4f3bd441febd7004b1862cd218afc0ee6252..dcaf185a5731130ab67bd7076a9be26dd4f0d7f0 100644 (file)
@@ -299,13 +299,8 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
 {
        struct iov_iter to;
        struct kiocb kiocb;
-       loff_t isize;
        int idx, ret;
 
-       isize = i_size_read(in->f_mapping->host);
-       if (unlikely(*ppos >= isize))
-               return 0;
-
        iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len);
        idx = to.idx;
        init_sync_kiocb(&kiocb, in);
index 613c5cf1943646764880ba3beeffb98667dc5268..5c2929f94bd3bf27411f860b57697b9d899312d1 100644 (file)
@@ -199,9 +199,9 @@ xfs_defer_intake_work(
        struct xfs_defer_pending        *dfp;
 
        list_for_each_entry(dfp, &dop->dop_intake, dfp_list) {
-               trace_xfs_defer_intake_work(tp->t_mountp, dfp);
                dfp->dfp_intent = dfp->dfp_type->create_intent(tp,
                                dfp->dfp_count);
+               trace_xfs_defer_intake_work(tp->t_mountp, dfp);
                list_sort(tp->t_mountp, &dfp->dfp_work,
                                dfp->dfp_type->diff_items);
                list_for_each(li, &dfp->dfp_work)
@@ -221,21 +221,14 @@ xfs_defer_trans_abort(
        struct xfs_defer_pending        *dfp;
 
        trace_xfs_defer_trans_abort(tp->t_mountp, dop);
-       /*
-        * If the transaction was committed, drop the intent reference
-        * since we're bailing out of here. The other reference is
-        * dropped when the intent hits the AIL.  If the transaction
-        * was not committed, the intent is freed by the intent item
-        * unlock handler on abort.
-        */
-       if (!dop->dop_committed)
-               return;
 
-       /* Abort intent items. */
+       /* Abort intent items that don't have a done item. */
        list_for_each_entry(dfp, &dop->dop_pending, dfp_list) {
                trace_xfs_defer_pending_abort(tp->t_mountp, dfp);
-               if (!dfp->dfp_done)
+               if (dfp->dfp_intent && !dfp->dfp_done) {
                        dfp->dfp_type->abort_intent(dfp->dfp_intent);
+                       dfp->dfp_intent = NULL;
+               }
        }
 
        /* Shut down FS. */
index 40e887068da213e595951f16caf8eb7ca83d3179..0504ef8f3aa31d5e7a9f0d86d1cb3fc130fee9e0 100644 (file)
@@ -118,9 +118,9 @@ do {                                                                        \
 #define this_cpu_generic_read(pcp)                                     \
 ({                                                                     \
        typeof(pcp) __ret;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        __ret = raw_cpu_generic_read(pcp);                              \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        __ret;                                                          \
 })
 
index af0254c0942476f67e92c08f8e75918e529b4994..4df64a1fc09e7aab7f88cd4afe73928228930147 100644 (file)
@@ -14,6 +14,8 @@
  * [_sdata, _edata]: contains .data.* sections, may also contain .rodata.*
  *                   and/or .init.* sections.
  * [__start_rodata, __end_rodata]: contains .rodata.* sections
+ * [__start_data_ro_after_init, __end_data_ro_after_init]:
+ *                  contains data.ro_after_init section
  * [__init_begin, __init_end]: contains .init.* sections, but .init.text.*
  *                   may be out of this range on some architectures.
  * [_sinittext, _einittext]: contains .init.text.* sections
@@ -31,6 +33,7 @@ extern char _data[], _sdata[], _edata[];
 extern char __bss_start[], __bss_stop[];
 extern char __init_begin[], __init_end[];
 extern char _sinittext[], _einittext[];
+extern char __start_data_ro_after_init[], __end_data_ro_after_init[];
 extern char _end[];
 extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
 extern char __kprobes_text_start[], __kprobes_text_end[];
index 30747960bc54a29496eb134ebff26bfcb67e2fd7..31e1d639abedacd87828613416bce5c459694fc8 100644 (file)
  * own by defining an empty RO_AFTER_INIT_DATA.
  */
 #ifndef RO_AFTER_INIT_DATA
-#define RO_AFTER_INIT_DATA *(.data..ro_after_init)
+#define RO_AFTER_INIT_DATA                                             \
+       __start_data_ro_after_init = .;                                 \
+       *(.data..ro_after_init)                                         \
+       __end_data_ro_after_init = .;
 #endif
 
 /*
index 689a8b9b9c8fdc985401bf253dfe55ab80aa833f..61a3d90f32b338a030c3a064b50c403a48464293 100644 (file)
@@ -555,7 +555,8 @@ int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
 int acpi_device_modalias(struct device *, char *, int);
 void acpi_walk_dep_device_list(acpi_handle handle);
 
-struct platform_device *acpi_create_platform_device(struct acpi_device *);
+struct platform_device *acpi_create_platform_device(struct acpi_device *,
+                                                   struct property_entry *);
 #define ACPI_PTR(_ptr) (_ptr)
 
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
index 96337b15a60d59cd12e342b101d70efc1cd380d1..a8e66344bacc225642acc872c614b3017c314218 100644 (file)
@@ -258,6 +258,8 @@ struct ceph_watch_item {
        struct ceph_entity_addr addr;
 };
 
+#define CEPH_LINGER_ID_START   0xffff000000000000ULL
+
 struct ceph_osd_client {
        struct ceph_client     *client;
 
index 3672809234a728ea9e7779b0456cbd57647d7150..d530c4627e54ef1091be820a78d3616166ca8906 100644 (file)
@@ -173,12 +173,6 @@ static inline void console_sysfs_notify(void)
 #endif
 extern bool console_suspend_enabled;
 
-#ifdef CONFIG_OF
-extern void console_set_by_of(void);
-#else
-static inline void console_set_by_of(void) {}
-#endif
-
 /* Suspend and resume console messages over PM events */
 extern void suspend_console(void);
 extern void resume_console(void);
index c46d2aa16d81221c240ec46cf5c7fec6dbfe4bdd..1d18af0345543aaecbfc46a04230735c2b0b0cf7 100644 (file)
@@ -106,8 +106,9 @@ static inline void frontswap_invalidate_area(unsigned type)
 
 static inline void frontswap_init(unsigned type, unsigned long *map)
 {
-       if (frontswap_enabled())
-               __frontswap_init(type, map);
+#ifdef CONFIG_FRONTSWAP
+       __frontswap_init(type, map);
+#endif
 }
 
 #endif /* _LINUX_FRONTSWAP_H */
index 16d2b6e874d679597478e653f3ef23974e0c33de..dc0478c07b2abd3887d7f5b1b84818a4ee24162e 100644 (file)
@@ -321,6 +321,7 @@ struct writeback_control;
 #define IOCB_HIPRI             (1 << 3)
 #define IOCB_DSYNC             (1 << 4)
 #define IOCB_SYNC              (1 << 5)
+#define IOCB_WRITE             (1 << 6)
 
 struct kiocb {
        struct file             *ki_filp;
@@ -1709,7 +1710,6 @@ struct file_operations {
        int (*flush) (struct file *, fl_owner_t id);
        int (*release) (struct inode *, struct file *);
        int (*fsync) (struct file *, loff_t, loff_t, int datasync);
-       int (*aio_fsync) (struct kiocb *, int datasync);
        int (*fasync) (int, struct file *, int);
        int (*lock) (struct file *, int, struct file_lock *);
        ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
index ee1bed7dbfc634c5e490e00b694b5b170087decd..78bb0d7f6b11ac0a78e02eb35d12c9cbc0545a53 100644 (file)
@@ -253,6 +253,13 @@ static inline int phy_set_mode(struct phy *phy, enum phy_mode mode)
        return -ENOSYS;
 }
 
+static inline int phy_reset(struct phy *phy)
+{
+       if (!phy)
+               return 0;
+       return -ENOSYS;
+}
+
 static inline int phy_get_bus_width(struct phy *phy)
 {
        return -ENOSYS;
index 33d00a4ce6567f03f1cb52b08a5e72bda04efbaf..819d895edfdca7f9b146f187b0636410eb5bde7f 100644 (file)
 #include <linux/types.h>
 #include <sound/asound.h>
 
-#ifndef __KERNEL__
-#error This API is an early revision and not enabled in the current
-#error kernel release, it will be enabled in a future kernel version
-#error with incompatible changes to what is here.
-#endif
-
 /*
  * Maximum number of channels topology kcontrol can represent.
  */
index 9c4d304832648a2aa526597c87804e22e2cb715e..6b669593e7eb18b18743a771415976a8c17b6920 100644 (file)
@@ -1341,12 +1341,12 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 
        } else if (new->flags & IRQF_TRIGGER_MASK) {
                unsigned int nmsk = new->flags & IRQF_TRIGGER_MASK;
-               unsigned int omsk = irq_settings_get_trigger_mask(desc);
+               unsigned int omsk = irqd_get_trigger_type(&desc->irq_data);
 
                if (nmsk != omsk)
                        /* hope the handler works with current  trigger mode */
                        pr_warn("irq %d uses trigger mode %u; requested %u\n",
-                               irq, nmsk, omsk);
+                               irq, omsk, nmsk);
        }
 
        *old_ptr = new;
index 084452e34a125ff24da375e6dce25c1224b46310..bdff5ed57f10a5ef57a015856830471422f3918a 100644 (file)
@@ -203,8 +203,10 @@ static int __init test_suspend(void)
 
        /* RTCs have initialized by now too ... can we use one? */
        dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm);
-       if (dev)
+       if (dev) {
                rtc = rtc_class_open(dev_name(dev));
+               put_device(dev);
+       }
        if (!rtc) {
                printk(warn_no_rtc);
                return 0;
index de08fc90baafaf86d3053831d2cc0acd5cb9828e..5028f4fd504acd5a46747103c3f0ce9fb572c36c 100644 (file)
@@ -253,17 +253,6 @@ static int preferred_console = -1;
 int console_set_on_cmdline;
 EXPORT_SYMBOL(console_set_on_cmdline);
 
-#ifdef CONFIG_OF
-static bool of_specified_console;
-
-void console_set_by_of(void)
-{
-       of_specified_console = true;
-}
-#else
-# define of_specified_console false
-#endif
-
 /* Flag: console code may call schedule() */
 static int console_may_schedule;
 
@@ -2657,7 +2646,7 @@ void register_console(struct console *newcon)
         *      didn't select a console we take the first one
         *      that registers here.
         */
-       if (preferred_console < 0 && !of_specified_console) {
+       if (preferred_console < 0) {
                if (newcon->index < 0)
                        newcon->index = 0;
                if (newcon->setup == NULL ||
index 4d830e29998937c8c800445815d665f2e683b84c..f87d138e96724a43d219231bb98d6b1a863a0f0a 100644 (file)
@@ -192,6 +192,7 @@ void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace *trace)
        trace->entries = stack->entries;
        trace->skip = 0;
 }
+EXPORT_SYMBOL_GPL(depot_fetch_stack);
 
 /**
  * depot_save_stack - save stack in a stack depot.
@@ -283,3 +284,4 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace,
 fast_exit:
        return retval;
 }
+EXPORT_SYMBOL_GPL(depot_save_stack);
index 384c2cb51b56bf75ab2c132d0087e3757a71c276..c960459eda7e640ea55be1d4ed80c6a9125a8877 100644 (file)
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -385,6 +385,9 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align)
        bitmap_maxno = cma_bitmap_maxno(cma);
        bitmap_count = cma_bitmap_pages_to_bits(cma, count);
 
+       if (bitmap_count > bitmap_maxno)
+               return NULL;
+
        for (;;) {
                mutex_lock(&cma->lock);
                bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap,
index c7fe2f16503f9f906e3f01be0155818ef86c522e..50b52fe51937ca70e62a33ab1553aef9b77ad1a0 100644 (file)
@@ -1732,6 +1732,9 @@ static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos,
                        if (inode->i_blkbits == PAGE_SHIFT ||
                                        !mapping->a_ops->is_partially_uptodate)
                                goto page_not_up_to_date;
+                       /* pipes can't handle partially uptodate pages */
+                       if (unlikely(iter->type & ITER_PIPE))
+                               goto page_not_up_to_date;
                        if (!trylock_page(page))
                                goto page_not_up_to_date;
                        /* Did it get truncated before we got the lock? */
index ec49d9ef1eefd0155f099d813ed547c16172d69e..418bf01a50ed1f9dde0ca6c083aafa86c1869f23 100644 (file)
@@ -1826,11 +1826,17 @@ static void return_unused_surplus_pages(struct hstate *h,
  * is not the case is if a reserve map was changed between calls.  It
  * is the responsibility of the caller to notice the difference and
  * take appropriate action.
+ *
+ * vma_add_reservation is used in error paths where a reservation must
+ * be restored when a newly allocated huge page must be freed.  It is
+ * to be called after calling vma_needs_reservation to determine if a
+ * reservation exists.
  */
 enum vma_resv_mode {
        VMA_NEEDS_RESV,
        VMA_COMMIT_RESV,
        VMA_END_RESV,
+       VMA_ADD_RESV,
 };
 static long __vma_reservation_common(struct hstate *h,
                                struct vm_area_struct *vma, unsigned long addr,
@@ -1856,6 +1862,14 @@ static long __vma_reservation_common(struct hstate *h,
                region_abort(resv, idx, idx + 1);
                ret = 0;
                break;
+       case VMA_ADD_RESV:
+               if (vma->vm_flags & VM_MAYSHARE)
+                       ret = region_add(resv, idx, idx + 1);
+               else {
+                       region_abort(resv, idx, idx + 1);
+                       ret = region_del(resv, idx, idx + 1);
+               }
+               break;
        default:
                BUG();
        }
@@ -1903,6 +1917,56 @@ static void vma_end_reservation(struct hstate *h,
        (void)__vma_reservation_common(h, vma, addr, VMA_END_RESV);
 }
 
+static long vma_add_reservation(struct hstate *h,
+                       struct vm_area_struct *vma, unsigned long addr)
+{
+       return __vma_reservation_common(h, vma, addr, VMA_ADD_RESV);
+}
+
+/*
+ * This routine is called to restore a reservation on error paths.  In the
+ * specific error paths, a huge page was allocated (via alloc_huge_page)
+ * and is about to be freed.  If a reservation for the page existed,
+ * alloc_huge_page would have consumed the reservation and set PagePrivate
+ * in the newly allocated page.  When the page is freed via free_huge_page,
+ * the global reservation count will be incremented if PagePrivate is set.
+ * However, free_huge_page can not adjust the reserve map.  Adjust the
+ * reserve map here to be consistent with global reserve count adjustments
+ * to be made by free_huge_page.
+ */
+static void restore_reserve_on_error(struct hstate *h,
+                       struct vm_area_struct *vma, unsigned long address,
+                       struct page *page)
+{
+       if (unlikely(PagePrivate(page))) {
+               long rc = vma_needs_reservation(h, vma, address);
+
+               if (unlikely(rc < 0)) {
+                       /*
+                        * Rare out of memory condition in reserve map
+                        * manipulation.  Clear PagePrivate so that
+                        * global reserve count will not be incremented
+                        * by free_huge_page.  This will make it appear
+                        * as though the reservation for this page was
+                        * consumed.  This may prevent the task from
+                        * faulting in the page at a later time.  This
+                        * is better than inconsistent global huge page
+                        * accounting of reserve counts.
+                        */
+                       ClearPagePrivate(page);
+               } else if (rc) {
+                       rc = vma_add_reservation(h, vma, address);
+                       if (unlikely(rc < 0))
+                               /*
+                                * See above comment about rare out of
+                                * memory condition.
+                                */
+                               ClearPagePrivate(page);
+               } else
+                       vma_end_reservation(h, vma, address);
+       }
+}
+
 struct page *alloc_huge_page(struct vm_area_struct *vma,
                                    unsigned long addr, int avoid_reserve)
 {
@@ -3498,6 +3562,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
        spin_unlock(ptl);
        mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
 out_release_all:
+       restore_reserve_on_error(h, vma, address, new_page);
        put_page(new_page);
 out_release_old:
        put_page(old_page);
@@ -3680,6 +3745,7 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
        spin_unlock(ptl);
 backout_unlocked:
        unlock_page(page);
+       restore_reserve_on_error(h, vma, address, page);
        put_page(page);
        goto out;
 }
index e5355a5b423fa9fd61a77ebf7b94819ec2e199df..d1380ed93fdf084d5043a2fb1f8bb3e476cb7bf9 100644 (file)
@@ -1414,6 +1414,7 @@ static void kmemleak_scan(void)
        /* data/bss scanning */
        scan_large_block(_sdata, _edata);
        scan_large_block(__bss_start, __bss_stop);
+       scan_large_block(__start_data_ro_after_init, __end_data_ro_after_init);
 
 #ifdef CONFIG_SMP
        /* per-cpu sections scanning */
index de88f33519c0d6398de8fcc06bfa82f2a477dd95..19e796d36a629147dd36217ecab34934300dc660 100644 (file)
@@ -1112,10 +1112,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
        }
 
        if (!PageHuge(p) && PageTransHuge(hpage)) {
-               lock_page(hpage);
-               if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
-                       unlock_page(hpage);
-                       if (!PageAnon(hpage))
+               lock_page(p);
+               if (!PageAnon(p) || unlikely(split_huge_page(p))) {
+                       unlock_page(p);
+                       if (!PageAnon(p))
                                pr_err("Memory failure: %#lx: non anonymous thp\n",
                                        pfn);
                        else
@@ -1126,9 +1126,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
                        put_hwpoison_page(p);
                        return -EBUSY;
                }
-               unlock_page(hpage);
-               get_hwpoison_page(p);
-               put_hwpoison_page(hpage);
+               unlock_page(p);
                VM_BUG_ON_PAGE(!page_count(p), p);
                hpage = compound_head(p);
        }
index 072d791dce2d5e1304a8c2a9524a1a18dd89b623..6de9440e3ae2d995b28577dc4a000fc23f4182c0 100644 (file)
@@ -3658,7 +3658,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
        /* Make sure we know about allocations which stall for too long */
        if (time_after(jiffies, alloc_start + stall_timeout)) {
                warn_alloc(gfp_mask,
-                       "page alloction stalls for %ums, order:%u\n",
+                       "page allocation stalls for %ums, order:%u",
                        jiffies_to_msecs(jiffies-alloc_start), order);
                stall_timeout += 10 * HZ;
        }
index ad7813d73ea79879008eb570e790a101a4d7c3f7..166ebf5d2bceda1bdc9a824b6b3040f28588a171 100644 (file)
@@ -1483,6 +1483,8 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp,
        copy_highpage(newpage, oldpage);
        flush_dcache_page(newpage);
 
+       __SetPageLocked(newpage);
+       __SetPageSwapBacked(newpage);
        SetPageUptodate(newpage);
        set_page_private(newpage, swap_index);
        SetPageSwapCache(newpage);
index 71f0b28a1bec8bc58a479f7c53343b647bcf5f24..329b03843863940f2288ea046d6b950d126c0a49 100644 (file)
@@ -533,8 +533,8 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg,
 
        s = create_cache(cache_name, root_cache->object_size,
                         root_cache->size, root_cache->align,
-                        root_cache->flags, root_cache->ctor,
-                        memcg, root_cache);
+                        root_cache->flags & CACHE_CREATE_MASK,
+                        root_cache->ctor, memcg, root_cache);
        /*
         * If we could not create a memcg cache, do not complain, because
         * that's not critical at all as we can always proceed with the root
index 2210de290b54d160d31afc937471225077bf083a..f30438970cd176e5dde188bc6e05a28c3367e451 100644 (file)
@@ -2224,6 +2224,8 @@ static unsigned long read_swap_header(struct swap_info_struct *p,
                swab32s(&swap_header->info.version);
                swab32s(&swap_header->info.last_page);
                swab32s(&swap_header->info.nr_badpages);
+               if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES)
+                       return 0;
                for (i = 0; i < swap_header->info.nr_badpages; i++)
                        swab32s(&swap_header->info.badpages[i]);
        }
index 7d54e944de5e0723918d8196e2d10766fd0b84c5..dcbe67ff3e2b281abc87d791def2f131fdba9fb3 100644 (file)
@@ -34,7 +34,8 @@ void ceph_file_layout_from_legacy(struct ceph_file_layout *fl,
        fl->stripe_count = le32_to_cpu(legacy->fl_stripe_count);
        fl->object_size = le32_to_cpu(legacy->fl_object_size);
        fl->pool_id = le32_to_cpu(legacy->fl_pg_pool);
-       if (fl->pool_id == 0)
+       if (fl->pool_id == 0 && fl->stripe_unit == 0 &&
+           fl->stripe_count == 0 && fl->object_size == 0)
                fl->pool_id = -1;
 }
 EXPORT_SYMBOL(ceph_file_layout_from_legacy);
index d9bf7a1d0a583730a9f4c7376102d1ce5694f66f..e6ae15bc41b74dfc96e9d967139367b4ad3be952 100644 (file)
@@ -4094,6 +4094,7 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
        osd_init(&osdc->homeless_osd);
        osdc->homeless_osd.o_osdc = osdc;
        osdc->homeless_osd.o_osd = CEPH_HOMELESS_OSD;
+       osdc->last_linger_id = CEPH_LINGER_ID_START;
        osdc->linger_requests = RB_ROOT;
        osdc->map_checks = RB_ROOT;
        osdc->linger_map_checks = RB_ROOT;
index 34dd7b26ee5f16589a46f8c7faa158570ccec9ad..62a482790937b54a5d486bc932289b0fb14da248 100644 (file)
@@ -2753,14 +2753,18 @@ EXPORT_SYMBOL_GPL(rpc_cap_max_reconnect_timeout);
 
 void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt)
 {
+       rcu_read_lock();
        xprt_switch_put(rcu_dereference(clnt->cl_xpi.xpi_xpswitch));
+       rcu_read_unlock();
 }
 EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_put);
 
 void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt)
 {
+       rcu_read_lock();
        rpc_xprt_switch_add_xprt(rcu_dereference(clnt->cl_xpi.xpi_xpswitch),
                                 xprt);
+       rcu_read_unlock();
 }
 EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_add_xprt);
 
@@ -2770,9 +2774,8 @@ bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt,
        struct rpc_xprt_switch *xps;
        bool ret;
 
-       xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch);
-
        rcu_read_lock();
+       xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch);
        ret = rpc_xprt_switch_has_addr(xps, sap);
        rcu_read_unlock();
        return ret;
index 210949562786665ea1a2990e2e9e6f886e580af6..26b26beef2d4a6dd7ef9d31f09de7fe51504d841 100644 (file)
  * being done.
  *
  * When the underlying transport disconnects, MRs are left in one of
- * three states:
+ * four states:
  *
  * INVALID:    The MR was not in use before the QP entered ERROR state.
- *             (Or, the LOCAL_INV WR has not completed or flushed yet).
- *
- * STALE:      The MR was being registered or unregistered when the QP
- *             entered ERROR state, and the pending WR was flushed.
  *
  * VALID:      The MR was registered before the QP entered ERROR state.
  *
- * When frwr_op_map encounters STALE and VALID MRs, they are recovered
- * with ib_dereg_mr and then are re-initialized. Beause MR recovery
+ * FLUSHED_FR: The MR was being registered when the QP entered ERROR
+ *             state, and the pending WR was flushed.
+ *
+ * FLUSHED_LI: The MR was being invalidated when the QP entered ERROR
+ *             state, and the pending WR was flushed.
+ *
+ * When frwr_op_map encounters FLUSHED and VALID MRs, they are recovered
+ * with ib_dereg_mr and then are re-initialized. Because MR recovery
  * allocates fresh resources, it is deferred to a workqueue, and the
  * recovered MRs are placed back on the rb_mws list when recovery is
  * complete. frwr_op_map allocates another MR for the current RPC while
@@ -177,12 +179,15 @@ __frwr_reset_mr(struct rpcrdma_ia *ia, struct rpcrdma_mw *r)
 static void
 frwr_op_recover_mr(struct rpcrdma_mw *mw)
 {
+       enum rpcrdma_frmr_state state = mw->frmr.fr_state;
        struct rpcrdma_xprt *r_xprt = mw->mw_xprt;
        struct rpcrdma_ia *ia = &r_xprt->rx_ia;
        int rc;
 
        rc = __frwr_reset_mr(ia, mw);
-       ib_dma_unmap_sg(ia->ri_device, mw->mw_sg, mw->mw_nents, mw->mw_dir);
+       if (state != FRMR_FLUSHED_LI)
+               ib_dma_unmap_sg(ia->ri_device,
+                               mw->mw_sg, mw->mw_nents, mw->mw_dir);
        if (rc)
                goto out_release;
 
@@ -262,10 +267,8 @@ frwr_op_maxpages(struct rpcrdma_xprt *r_xprt)
 }
 
 static void
-__frwr_sendcompletion_flush(struct ib_wc *wc, struct rpcrdma_frmr *frmr,
-                           const char *wr)
+__frwr_sendcompletion_flush(struct ib_wc *wc, const char *wr)
 {
-       frmr->fr_state = FRMR_IS_STALE;
        if (wc->status != IB_WC_WR_FLUSH_ERR)
                pr_err("rpcrdma: %s: %s (%u/0x%x)\n",
                       wr, ib_wc_status_msg(wc->status),
@@ -288,7 +291,8 @@ frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc)
        if (wc->status != IB_WC_SUCCESS) {
                cqe = wc->wr_cqe;
                frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe);
-               __frwr_sendcompletion_flush(wc, frmr, "fastreg");
+               frmr->fr_state = FRMR_FLUSHED_FR;
+               __frwr_sendcompletion_flush(wc, "fastreg");
        }
 }
 
@@ -308,7 +312,8 @@ frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc)
        if (wc->status != IB_WC_SUCCESS) {
                cqe = wc->wr_cqe;
                frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe);
-               __frwr_sendcompletion_flush(wc, frmr, "localinv");
+               frmr->fr_state = FRMR_FLUSHED_LI;
+               __frwr_sendcompletion_flush(wc, "localinv");
        }
 }
 
@@ -328,8 +333,10 @@ frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc)
        /* WARNING: Only wr_cqe and status are reliable at this point */
        cqe = wc->wr_cqe;
        frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe);
-       if (wc->status != IB_WC_SUCCESS)
-               __frwr_sendcompletion_flush(wc, frmr, "localinv");
+       if (wc->status != IB_WC_SUCCESS) {
+               frmr->fr_state = FRMR_FLUSHED_LI;
+               __frwr_sendcompletion_flush(wc, "localinv");
+       }
        complete(&frmr->fr_linv_done);
 }
 
index 0d35b761c883d01a044ba5f9c635bb3a7edce741..6e1bba358203694e79cbc9074554b12053fa45c7 100644 (file)
@@ -216,7 +216,8 @@ struct rpcrdma_rep {
 enum rpcrdma_frmr_state {
        FRMR_IS_INVALID,        /* ready to be used */
        FRMR_IS_VALID,          /* in use */
-       FRMR_IS_STALE,          /* failed completion */
+       FRMR_FLUSHED_FR,        /* flushed FASTREG WR */
+       FRMR_FLUSHED_LI,        /* flushed LOCALINV WR */
 };
 
 struct rpcrdma_frmr {
index 53449a6ff6aa7de3c5c868f0645f6000b6f551e6..7c321a603b079d355bd127aebb04adc0294b4ba5 100644 (file)
@@ -36,6 +36,7 @@ warning-2 += -Wshadow
 warning-2 += $(call cc-option, -Wlogical-op)
 warning-2 += $(call cc-option, -Wmissing-field-initializers)
 warning-2 += $(call cc-option, -Wsign-compare)
+warning-2 += $(call cc-option, -Wmaybe-uninitialized)
 
 warning-3 := -Wbad-function-cast
 warning-3 += -Wcast-qual
index dd779c40c8e6af713c0ad7039bc929b0c6c2944a..3b1b13818d594f9ffa9dcb15206314ab349325a7 100644 (file)
@@ -17,4 +17,8 @@ endif
 ifdef CONFIG_UBSAN_NULL
       CFLAGS_UBSAN += $(call cc-option, -fsanitize=null)
 endif
+
+      # -fsanitize=* options makes GCC less smart than usual and
+      # increase number of 'maybe-uninitialized false-positives
+      CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
 endif
index 19f5adfd877dcf9b7e9c5b63c796ca72ee06dccf..d9ff038c1b28400799462dad5e29335b092b9a1a 100755 (executable)
@@ -8,6 +8,9 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 import sys, os, re
+from signal import signal, SIGPIPE, SIG_DFL
+
+signal(SIGPIPE, SIG_DFL)
 
 if len(sys.argv) != 3:
     sys.stderr.write("usage: %s file1 file2\n" % sys.argv[0])
index 895362a696c95b3737bf82123cba9b00146bb6a6..8ab72e0f593292ac91aea0b06b70d89fc084bd3c 100644 (file)
@@ -325,10 +325,15 @@ static ssize_t snd_info_text_entry_write(struct file *file,
        size_t next;
        int err = 0;
 
+       if (!entry->c.text.write)
+               return -EIO;
        pos = *offset;
        if (!valid_pos(pos, count))
                return -EIO;
        next = pos + count;
+       /* don't handle too large text inputs */
+       if (next > 16 * 1024)
+               return -EIO;
        mutex_lock(&entry->access);
        buf = data->wbuffer;
        if (!buf) {
@@ -366,7 +371,9 @@ static int snd_info_seq_show(struct seq_file *seq, void *p)
        struct snd_info_private_data *data = seq->private;
        struct snd_info_entry *entry = data->entry;
 
-       if (entry->c.text.read) {
+       if (!entry->c.text.read) {
+               return -EIO;
+       } else {
                data->rbuffer->buffer = (char *)seq; /* XXX hack! */
                entry->c.text.read(entry, data->rbuffer);
        }
index 18baea2f7d654528cf52617bfb0c58fc2e3b8efe..84f86745c30e93cd746935113f3c0aa08fd4021e 100644 (file)
@@ -148,11 +148,11 @@ SND_SOC_DAPM_OUTPUT("AOUTR"),
 };
 
 static const struct snd_soc_dapm_route cs4270_dapm_routes[] = {
-       { "Capture", NULL, "AINA" },
-       { "Capture", NULL, "AINB" },
+       { "Capture", NULL, "AINL" },
+       { "Capture", NULL, "AINR" },
 
-       { "AOUTA", NULL, "Playback" },
-       { "AOUTB", NULL, "Playback" },
+       { "AOUTL", NULL, "Playback" },
+       { "AOUTR", NULL, "Playback" },
 };
 
 /**
index 1152aa5e7c394208d6e42f04a2c4d44c8b0ea906..cf37936bfe3aaaf6b29cb1f78c9c54f80a2b40b7 100644 (file)
@@ -880,7 +880,8 @@ static const struct snd_soc_dapm_widget da7219_dapm_widgets[] = {
                            SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 
        /* DAI */
-       SND_SOC_DAPM_AIF_OUT("DAIOUT", "Capture", 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_AIF_OUT("DAIOUT", "Capture", 0, DA7219_DAI_TDM_CTRL,
+                            DA7219_DAI_OE_SHIFT, DA7219_NO_INVERT),
        SND_SOC_DAPM_AIF_IN("DAIIN", "Playback", 0, SND_SOC_NOPM, 0, 0),
 
        /* Output Muxes */
index b904492d774473a99d5e1aa451f18ff276f83732..90b5948e0ff363a91538a28513e35e32e35a0ee1 100644 (file)
@@ -364,7 +364,12 @@ static int hdmi_of_xlate_dai_name(struct snd_soc_component *component,
                                  struct of_phandle_args *args,
                                  const char **dai_name)
 {
-       int id = args->args[0];
+       int id;
+
+       if (args->args_count)
+               id = args->args[0];
+       else
+               id = 0;
 
        if (id < ARRAY_SIZE(hdmi_dai_name)) {
                *dai_name = hdmi_dai_name[id];
index 55558643166fda708ccb781daffcc9ed40806bc2..2db8179047ae89b4d2b297e5588bd8e77b3ab235 100644 (file)
@@ -249,6 +249,11 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic)
                        snd_soc_dapm_force_enable_pin(dapm, "LDO1");
                        snd_soc_dapm_sync(dapm);
 
+                       regmap_update_bits(rt298->regmap,
+                               RT298_POWER_CTRL1, 0x1001, 0);
+                       regmap_update_bits(rt298->regmap,
+                               RT298_POWER_CTRL2, 0x4, 0x4);
+
                        regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24);
                        msleep(50);
 
index 01a18d88f1eb19f4311319ce0a47771da34df131..00ff2788879e2a8982b3d0e79fa18ddb86fc188a 100644 (file)
@@ -1547,11 +1547,11 @@ static int rt5663_jack_detect(struct snd_soc_codec *codec, int jack_insert)
                        msleep(sleep_time[i]);
                        val = snd_soc_read(codec, RT5663_EM_JACK_TYPE_2) &
                                0x0003;
+                       dev_dbg(codec->dev, "%s: MX-00e7 val=%x sleep %d\n",
+                               __func__, val, sleep_time[i]);
                        i++;
                        if (val == 0x1 || val == 0x2 || val == 0x3)
                                break;
-                       dev_dbg(codec->dev, "%s: MX-00e7 val=%x sleep %d\n",
-                               __func__, val, sleep_time[i]);
                }
                dev_dbg(codec->dev, "%s val = %d\n", __func__, val);
                switch (val) {
index 7b31ee9b82bc87beb493427049fc82d75e1127e8..d6e00c77edcd7360b8df3d9942e5c4213ba530b6 100644 (file)
@@ -424,7 +424,7 @@ static const struct snd_soc_dai_ops stih407_dac_ops = {
 static const struct regmap_config stih407_sas_regmap = {
        .reg_bits = 32,
        .val_bits = 32,
-
+       .fast_io = true,
        .max_register = STIH407_AUDIO_DAC_CTRL,
        .reg_defaults = stih407_sas_reg_defaults,
        .num_reg_defaults = ARRAY_SIZE(stih407_sas_reg_defaults),
index df5e5cb33baaba035b1d9db577cbf772855ac3e9..810369f687d7166755a6b639fbfb97ed3b9672e7 100644 (file)
@@ -341,20 +341,9 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec,
                                        return ret;
                                }
                        }
-
-                       gpiod_set_value(priv->pdn_gpio, 0);
-                       usleep_range(5000, 6000);
-
-                       regcache_cache_only(priv->regmap, false);
-                       ret = regcache_sync(priv->regmap);
-                       if (ret)
-                               return ret;
                }
                break;
        case SND_SOC_BIAS_OFF:
-               regcache_cache_only(priv->regmap, true);
-               gpiod_set_value(priv->pdn_gpio, 1);
-
                if (!IS_ERR(priv->mclk))
                        clk_disable_unprepare(priv->mclk);
                break;
@@ -401,16 +390,6 @@ static const struct snd_kcontrol_new tas5711_controls[] = {
                   TAS571X_SOFT_MUTE_REG,
                   TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,
                   1, 1),
-
-       SOC_DOUBLE_R_RANGE("CH1 Mixer Volume",
-                          TAS5717_CH1_LEFT_CH_MIX_REG,
-                          TAS5717_CH1_RIGHT_CH_MIX_REG,
-                          16, 0, 0x80, 0),
-
-       SOC_DOUBLE_R_RANGE("CH2 Mixer Volume",
-                          TAS5717_CH2_LEFT_CH_MIX_REG,
-                          TAS5717_CH2_RIGHT_CH_MIX_REG,
-                          16, 0, 0x80, 0),
 };
 
 static const struct regmap_range tas571x_readonly_regs_range[] = {
@@ -488,6 +467,16 @@ static const struct snd_kcontrol_new tas5717_controls[] = {
                   TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,
                   1, 1),
 
+       SOC_DOUBLE_R_RANGE("CH1 Mixer Volume",
+                          TAS5717_CH1_LEFT_CH_MIX_REG,
+                          TAS5717_CH1_RIGHT_CH_MIX_REG,
+                          16, 0, 0x80, 0),
+
+       SOC_DOUBLE_R_RANGE("CH2 Mixer Volume",
+                          TAS5717_CH2_LEFT_CH_MIX_REG,
+                          TAS5717_CH2_RIGHT_CH_MIX_REG,
+                          16, 0, 0x80, 0),
+
        /*
         * The biquads are named according to the register names.
         * Please note that TI's TAS57xx Graphical Development Environment
@@ -747,13 +736,14 @@ static int tas571x_i2c_probe(struct i2c_client *client,
                /* pulse the active low reset line for ~100us */
                usleep_range(100, 200);
                gpiod_set_value(priv->reset_gpio, 0);
-               usleep_range(12000, 20000);
+               usleep_range(13500, 20000);
        }
 
        ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0);
        if (ret)
                return ret;
 
+       usleep_range(50000, 60000);
 
        memcpy(&priv->codec_driver, &tas571x_codec, sizeof(priv->codec_driver));
        priv->codec_driver.component_driver.controls = priv->chip->controls;
@@ -770,9 +760,6 @@ static int tas571x_i2c_probe(struct i2c_client *client,
                        return ret;
        }
 
-       regcache_cache_only(priv->regmap, true);
-       gpiod_set_value(priv->pdn_gpio, 1);
-
        return snd_soc_register_codec(&client->dev, &priv->codec_driver,
                                      &tas571x_dai, 1);
 }
index 26eb5a0a55754c43f94afe8a3403982b408d3e2b..fd5d1e0910382e94233702094658b6b868c71b83 100644 (file)
@@ -47,6 +47,7 @@ config SND_SOC_INTEL_SST_MATCH
 
 config SND_SOC_INTEL_HASWELL
        tristate
+       select SND_SOC_INTEL_SST_FIRMWARE
 
 config SND_SOC_INTEL_BAYTRAIL
        tristate
@@ -56,7 +57,6 @@ config SND_SOC_INTEL_HASWELL_MACH
        depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM
        depends on DW_DMAC_CORE
        select SND_SOC_INTEL_SST
-       select SND_SOC_INTEL_SST_FIRMWARE
        select SND_SOC_INTEL_HASWELL
        select SND_SOC_RT5640
        help
@@ -138,7 +138,6 @@ config SND_SOC_INTEL_BROADWELL_MACH
                   I2C_DESIGNWARE_PLATFORM
        depends on DW_DMAC_CORE
        select SND_SOC_INTEL_SST
-       select SND_SOC_INTEL_SST_FIRMWARE
        select SND_SOC_INTEL_HASWELL
        select SND_SOC_RT286
        help
index ba5c0d71720ab8548fddbb42cd79dd90c869abab..0a88537ca58a19c9c47df036c6cd95e7d2701837 100644 (file)
@@ -416,6 +416,7 @@ static const struct dmi_system_id cht_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
                },
        },
+       { }
 };
 
 
index 6532b8f0ab2fc475f09116d24dcf316170ce5618..865a21e557cce330508ceee677c16f82359087ee 100644 (file)
@@ -130,8 +130,8 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
         */
        ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
                        SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-                       SND_JACK_BTN_2 | SND_JACK_BTN_3, &broxton_headset,
-                       NULL, 0);
+                       SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT,
+                       &broxton_headset, NULL, 0);
        if (ret) {
                dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
                return ret;
index 2989c164dafe3a719ed219d2f47ddf73a20ea64d..06fa5e85dd0e0177f6e886065e23060a87a958fa 100644 (file)
@@ -674,7 +674,7 @@ static int skl_probe(struct pci_dev *pci,
 
        if (skl->nhlt == NULL) {
                err = -ENODEV;
-               goto out_free;
+               goto out_display_power_off;
        }
 
        skl_nhlt_update_topology_bin(skl);
@@ -746,6 +746,9 @@ static int skl_probe(struct pci_dev *pci,
        skl_machine_device_unregister(skl);
 out_nhlt_free:
        skl_nhlt_free(skl->nhlt);
+out_display_power_off:
+       if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
+               snd_hdac_display_power(bus, false);
 out_free:
        skl->init_failed = 1;
        skl_free(ebus);
@@ -785,8 +788,7 @@ static void skl_remove(struct pci_dev *pci)
 
        release_firmware(skl->tplg);
 
-       if (pci_dev_run_wake(pci))
-               pm_runtime_get_noresume(&pci->dev);
+       pm_runtime_get_noresume(&pci->dev);
 
        /* codec removal, invoke bus_device_remove */
        snd_hdac_ext_bus_device_remove(ebus);
index f2bf8661dd21f782b1d472a724d69902a56b7b57..823b5a236d8dce0943d160a6cd436df2865a76e6 100644 (file)
@@ -208,7 +208,7 @@ config SND_PXA2XX_SOC_IMOTE2
 
 config SND_MMP_SOC_BROWNSTONE
        tristate "SoC Audio support for Marvell Brownstone"
-       depends on SND_MMP_SOC && MACH_BROWNSTONE
+       depends on SND_MMP_SOC && MACH_BROWNSTONE && I2C
        select SND_MMP_SOC_SSPA
        select MFD_WM8994
        select SND_SOC_WM8994
index 3cde9fb977fa72779a2ff26530fbaafae29a6386..eff3f9a8b685fc2ff0a149c4f3f7cf3101a984af 100644 (file)
@@ -586,3 +586,6 @@ int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev)
        return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove);
+
+MODULE_DESCRIPTION("QTi LPASS CPU Driver");
+MODULE_LICENSE("GPL v2");
index e2ff538a8aa5b63c4117f35365c39057b1f5360a..07000f53db44950d7f88ec3aab24fb12b9d302a6 100644 (file)
@@ -61,7 +61,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
-       int ret;
+       struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
+       struct lpass_data *drvdata =
+               snd_soc_platform_get_drvdata(soc_runtime->platform);
+       struct lpass_variant *v = drvdata->variant;
+       int ret, dma_ch, dir = substream->stream;
+       struct lpass_pcm_data *data;
+
+       data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       data->i2s_port = cpu_dai->driver->id;
+       runtime->private_data = data;
+
+       if (v->alloc_dma_channel)
+               dma_ch = v->alloc_dma_channel(drvdata, dir);
+       if (dma_ch < 0)
+               return dma_ch;
+
+       drvdata->substream[dma_ch] = substream;
+
+       ret = regmap_write(drvdata->lpaif_map,
+                       LPAIF_DMACTL_REG(v, dma_ch, dir), 0);
+       if (ret) {
+               dev_err(soc_runtime->dev,
+                       "%s() error writing to rdmactl reg: %d\n",
+                       __func__, ret);
+                       return ret;
+       }
+
+       if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+               data->rdma_ch = dma_ch;
+       else
+               data->wrdma_ch = dma_ch;
 
        snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware);
 
@@ -80,13 +113,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
        return 0;
 }
 
+static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream)
+{
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
+       struct lpass_data *drvdata =
+               snd_soc_platform_get_drvdata(soc_runtime->platform);
+       struct lpass_variant *v = drvdata->variant;
+       struct lpass_pcm_data *data;
+       int dma_ch, dir = substream->stream;
+
+       data = runtime->private_data;
+       v = drvdata->variant;
+
+       if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+               dma_ch = data->rdma_ch;
+       else
+               dma_ch = data->wrdma_ch;
+
+       drvdata->substream[dma_ch] = NULL;
+
+       if (v->free_dma_channel)
+               v->free_dma_channel(drvdata, dma_ch);
+
+       return 0;
+}
+
 static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
                struct snd_pcm_hw_params *params)
 {
        struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
        struct lpass_data *drvdata =
                snd_soc_platform_get_drvdata(soc_runtime->platform);
-       struct lpass_pcm_data *pcm_data = drvdata->private_data;
+       struct snd_pcm_runtime *rt = substream->runtime;
+       struct lpass_pcm_data *pcm_data = rt->private_data;
        struct lpass_variant *v = drvdata->variant;
        snd_pcm_format_t format = params_format(params);
        unsigned int channels = params_channels(params);
@@ -179,7 +239,8 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
        struct lpass_data *drvdata =
                snd_soc_platform_get_drvdata(soc_runtime->platform);
-       struct lpass_pcm_data *pcm_data = drvdata->private_data;
+       struct snd_pcm_runtime *rt = substream->runtime;
+       struct lpass_pcm_data *pcm_data = rt->private_data;
        struct lpass_variant *v = drvdata->variant;
        unsigned int reg;
        int ret;
@@ -203,7 +264,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
        struct lpass_data *drvdata =
                snd_soc_platform_get_drvdata(soc_runtime->platform);
-       struct lpass_pcm_data *pcm_data = drvdata->private_data;
+       struct snd_pcm_runtime *rt = substream->runtime;
+       struct lpass_pcm_data *pcm_data = rt->private_data;
        struct lpass_variant *v = drvdata->variant;
        int ret, ch, dir = substream->stream;
 
@@ -257,7 +319,8 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
        struct lpass_data *drvdata =
                snd_soc_platform_get_drvdata(soc_runtime->platform);
-       struct lpass_pcm_data *pcm_data = drvdata->private_data;
+       struct snd_pcm_runtime *rt = substream->runtime;
+       struct lpass_pcm_data *pcm_data = rt->private_data;
        struct lpass_variant *v = drvdata->variant;
        int ret, ch, dir = substream->stream;
 
@@ -333,7 +396,8 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
        struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
        struct lpass_data *drvdata =
                        snd_soc_platform_get_drvdata(soc_runtime->platform);
-       struct lpass_pcm_data *pcm_data = drvdata->private_data;
+       struct snd_pcm_runtime *rt = substream->runtime;
+       struct lpass_pcm_data *pcm_data = rt->private_data;
        struct lpass_variant *v = drvdata->variant;
        unsigned int base_addr, curr_addr;
        int ret, ch, dir = substream->stream;
@@ -374,6 +438,7 @@ static int lpass_platform_pcmops_mmap(struct snd_pcm_substream *substream,
 
 static const struct snd_pcm_ops lpass_platform_pcm_ops = {
        .open           = lpass_platform_pcmops_open,
+       .close          = lpass_platform_pcmops_close,
        .ioctl          = snd_pcm_lib_ioctl,
        .hw_params      = lpass_platform_pcmops_hw_params,
        .hw_free        = lpass_platform_pcmops_hw_free,
@@ -470,117 +535,45 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 {
        struct snd_pcm *pcm = soc_runtime->pcm;
        struct snd_pcm_substream *psubstream, *csubstream;
-       struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
-       struct lpass_data *drvdata =
-               snd_soc_platform_get_drvdata(soc_runtime->platform);
-       struct lpass_variant *v = drvdata->variant;
        int ret = -EINVAL;
-       struct lpass_pcm_data *data;
        size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
 
-       data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL);
-       if (!data)
-               return -ENOMEM;
-
-       data->i2s_port = cpu_dai->driver->id;
-       drvdata->private_data = data;
-
        psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
        if (psubstream) {
-               if (v->alloc_dma_channel)
-                       data->rdma_ch = v->alloc_dma_channel(drvdata,
-                                               SNDRV_PCM_STREAM_PLAYBACK);
-
-               if (data->rdma_ch < 0)
-                       return data->rdma_ch;
-
-               drvdata->substream[data->rdma_ch] = psubstream;
-
                ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
                                        soc_runtime->platform->dev,
                                        size, &psubstream->dma_buffer);
-               if (ret)
-                       goto playback_alloc_err;
-
-               ret = regmap_write(drvdata->lpaif_map,
-                       LPAIF_RDMACTL_REG(v, data->rdma_ch), 0);
                if (ret) {
-                       dev_err(soc_runtime->dev,
-                               "%s() error writing to rdmactl reg: %d\n",
-                               __func__, ret);
-                       goto capture_alloc_err;
+                       dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
+                       return ret;
                }
        }
 
        csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
        if (csubstream) {
-               if (v->alloc_dma_channel)
-                       data->wrdma_ch = v->alloc_dma_channel(drvdata,
-                                               SNDRV_PCM_STREAM_CAPTURE);
-
-               if (data->wrdma_ch < 0) {
-                       ret = data->wrdma_ch;
-                       goto capture_alloc_err;
-               }
-
-               drvdata->substream[data->wrdma_ch] = csubstream;
-
                ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
                                        soc_runtime->platform->dev,
                                        size, &csubstream->dma_buffer);
-               if (ret)
-                       goto capture_alloc_err;
-
-               ret = regmap_write(drvdata->lpaif_map,
-                       LPAIF_WRDMACTL_REG(v, data->wrdma_ch), 0);
                if (ret) {
-                       dev_err(soc_runtime->dev,
-                               "%s() error writing to wrdmactl reg: %d\n",
-                               __func__, ret);
-                       goto capture_reg_err;
+                       dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
+                       if (psubstream)
+                               snd_dma_free_pages(&psubstream->dma_buffer);
+                       return ret;
                }
+
        }
 
        return 0;
-
-capture_reg_err:
-       if (csubstream)
-               snd_dma_free_pages(&csubstream->dma_buffer);
-
-capture_alloc_err:
-       if (psubstream)
-               snd_dma_free_pages(&psubstream->dma_buffer);
-
- playback_alloc_err:
-       dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
-
-       return ret;
 }
 
 static void lpass_platform_pcm_free(struct snd_pcm *pcm)
 {
-       struct snd_soc_pcm_runtime *rt;
-       struct lpass_data *drvdata;
-       struct lpass_pcm_data *data;
-       struct lpass_variant *v;
        struct snd_pcm_substream *substream;
-       int ch, i;
+       int i;
 
        for (i = 0; i < ARRAY_SIZE(pcm->streams); i++) {
                substream = pcm->streams[i].substream;
                if (substream) {
-                       rt = substream->private_data;
-                       drvdata = snd_soc_platform_get_drvdata(rt->platform);
-                       data = drvdata->private_data;
-
-                       ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-                               ? data->rdma_ch
-                               : data->wrdma_ch;
-                       v = drvdata->variant;
-                       drvdata->substream[ch] = NULL;
-                       if (v->free_dma_channel)
-                               v->free_dma_channel(drvdata, ch);
-
                        snd_dma_free_pages(&substream->dma_buffer);
                        substream->dma_buffer.area = NULL;
                        substream->dma_buffer.addr = 0;
index 35b3cea8207d8e61773a938d7fead9b3adb8d087..924971b6ded54f52ef56de0c84910258531bf1b9 100644 (file)
@@ -59,7 +59,6 @@ struct lpass_data {
        struct clk *pcnoc_mport_clk;
        struct clk *pcnoc_sway_clk;
 
-       void *private_data;
 };
 
 /* Vairant data per each SOC */
index 97d6700b100935466d01f5afad0a3c1fed54a931..cbc0023c2bc8276da9cda23ffa4d570d7c03e09f 100644 (file)
@@ -383,11 +383,6 @@ static int s3c_ac97_probe(struct platform_device *pdev)
                goto err4;
        }
 
-       ret = devm_snd_soc_register_component(&pdev->dev, &s3c_ac97_component,
-                                        s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai));
-       if (ret)
-               goto err5;
-
        ret = samsung_asoc_dma_platform_register(&pdev->dev,
                                                 ac97_pdata->dma_filter,
                                                 NULL, NULL);
@@ -396,6 +391,11 @@ static int s3c_ac97_probe(struct platform_device *pdev)
                goto err5;
        }
 
+       ret = devm_snd_soc_register_component(&pdev->dev, &s3c_ac97_component,
+                                        s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai));
+       if (ret)
+               goto err5;
+
        return 0;
 err5:
        free_irq(irq_res->start, NULL);
index 7e32cf4581f8a853a2e53bf49cbb84e1bd11f0b8..7825bff45ae3a523450e6732b94056a288b032d3 100644 (file)
@@ -1237,14 +1237,14 @@ static int samsung_i2s_probe(struct platform_device *pdev)
                        dev_err(&pdev->dev, "Unable to get drvdata\n");
                        return -EFAULT;
                }
-               ret = devm_snd_soc_register_component(&sec_dai->pdev->dev,
-                                               &samsung_i2s_component,
-                                               &sec_dai->i2s_dai_drv, 1);
+               ret = samsung_asoc_dma_platform_register(&pdev->dev,
+                                       sec_dai->filter, "tx-sec", NULL);
                if (ret != 0)
                        return ret;
 
-               return samsung_asoc_dma_platform_register(&pdev->dev,
-                                       sec_dai->filter, "tx-sec", NULL);
+               return devm_snd_soc_register_component(&sec_dai->pdev->dev,
+                                               &samsung_i2s_component,
+                                               &sec_dai->i2s_dai_drv, 1);
        }
 
        pri_dai = i2s_alloc_dai(pdev, false);
@@ -1314,6 +1314,11 @@ static int samsung_i2s_probe(struct platform_device *pdev)
        if (quirks & QUIRK_PRI_6CHAN)
                pri_dai->i2s_dai_drv.playback.channels_max = 6;
 
+       ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter,
+                                                NULL, NULL);
+       if (ret < 0)
+               goto err_disable_clk;
+
        if (quirks & QUIRK_SEC_DAI) {
                sec_dai = i2s_alloc_dai(pdev, true);
                if (!sec_dai) {
@@ -1353,10 +1358,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_free_dai;
 
-       ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter,
-                                                NULL, NULL);
-       if (ret < 0)
-               goto err_free_dai;
 
        pm_runtime_enable(&pdev->dev);
 
index 43e367a9acc368d148c0a5afbe777c2874f2ea30..c484985812ed681fa5a4326f3c54f76e4a80da4b 100644 (file)
@@ -565,24 +565,25 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
        pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id];
        pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id];
 
+       ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
+                                                NULL, NULL);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
+               goto err5;
+       }
+
        pm_runtime_enable(&pdev->dev);
 
        ret = devm_snd_soc_register_component(&pdev->dev, &s3c_pcm_component,
                                         &s3c_pcm_dai[pdev->id], 1);
        if (ret != 0) {
                dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret);
-               goto err5;
-       }
-
-       ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
-                                                NULL, NULL);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
-               goto err5;
+               goto err6;
        }
 
        return 0;
-
+err6:
+       pm_runtime_disable(&pdev->dev);
 err5:
        clk_disable_unprepare(pcm->pclk);
 err4:
index 3e89fbc0c51d046049f6b6413d554c7e62186055..0a4718207e6ec41ae9f1535c5757066c73710f6a 100644 (file)
@@ -168,19 +168,19 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
        s3c2412_i2s_pcm_stereo_in.addr = res->start + S3C2412_IISRXD;
        s3c2412_i2s_pcm_stereo_in.filter_data = pdata->dma_capture;
 
-       ret = s3c_i2sv2_register_component(&pdev->dev, -1,
-                                          &s3c2412_i2s_component,
-                                          &s3c2412_i2s_dai);
+       ret = samsung_asoc_dma_platform_register(&pdev->dev,
+                                                pdata->dma_filter,
+                                                NULL, NULL);
        if (ret) {
-               pr_err("failed to register the dai\n");
+               pr_err("failed to register the DMA: %d\n", ret);
                return ret;
        }
 
-       ret = samsung_asoc_dma_platform_register(&pdev->dev,
-                                                pdata->dma_filter,
-                                                NULL, NULL);
+       ret = s3c_i2sv2_register_component(&pdev->dev, -1,
+                                          &s3c2412_i2s_component,
+                                          &s3c2412_i2s_dai);
        if (ret)
-               pr_err("failed to register the DMA: %d\n", ret);
+               pr_err("failed to register the dai\n");
 
        return ret;
 }
index c78a936a30995639fdb6cf6c97008d7504b1ea5e..9052f6a7073ec8b0ca5066461ba74dcc01a5f0b8 100644 (file)
@@ -474,18 +474,18 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
        s3c24xx_i2s_pcm_stereo_in.addr = res->start + S3C2410_IISFIFO;
        s3c24xx_i2s_pcm_stereo_in.filter_data = pdata->dma_capture;
 
-       ret = devm_snd_soc_register_component(&pdev->dev,
-                       &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
+       ret = samsung_asoc_dma_platform_register(&pdev->dev,
+                                                pdata->dma_filter,
+                                                NULL, NULL);
        if (ret) {
-               pr_err("failed to register the dai\n");
+               pr_err("failed to register the dma: %d\n", ret);
                return ret;
        }
 
-       ret = samsung_asoc_dma_platform_register(&pdev->dev,
-                                                pdata->dma_filter,
-                                                NULL, NULL);
+       ret = devm_snd_soc_register_component(&pdev->dev,
+                       &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
        if (ret)
-               pr_err("failed to register the dma: %d\n", ret);
+               pr_err("failed to register the dai\n");
 
        return ret;
 }
index 26c1fbed4d3543da990ea3277a24f8fb87887818..779504f54bc074fcaec0ce179483b3a4a1bc17ee 100644 (file)
@@ -416,15 +416,6 @@ static int spdif_probe(struct platform_device *pdev)
                goto err3;
        }
 
-       dev_set_drvdata(&pdev->dev, spdif);
-
-       ret = devm_snd_soc_register_component(&pdev->dev,
-                       &samsung_spdif_component, &samsung_spdif_dai, 1);
-       if (ret != 0) {
-               dev_err(&pdev->dev, "fail to register dai\n");
-               goto err4;
-       }
-
        spdif_stereo_out.addr_width = 2;
        spdif_stereo_out.addr = mem_res->start + DATA_OUTBUF;
        filter = NULL;
@@ -432,7 +423,6 @@ static int spdif_probe(struct platform_device *pdev)
                spdif_stereo_out.filter_data = spdif_pdata->dma_playback;
                filter = spdif_pdata->dma_filter;
        }
-
        spdif->dma_playback = &spdif_stereo_out;
 
        ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
@@ -442,6 +432,15 @@ static int spdif_probe(struct platform_device *pdev)
                goto err4;
        }
 
+       dev_set_drvdata(&pdev->dev, spdif);
+
+       ret = devm_snd_soc_register_component(&pdev->dev,
+                       &samsung_spdif_component, &samsung_spdif_dai, 1);
+       if (ret != 0) {
+               dev_err(&pdev->dev, "fail to register dai\n");
+               goto err4;
+       }
+
        return 0;
 err4:
        iounmap(spdif->regs);
index 1bc8ebc2528eb1bdf0c1df6832e943d8eebaa29f..ad54d4cf58ada992f6f279cc0e6a00386e8e273e 100644 (file)
@@ -614,7 +614,11 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
        iec958->status[3] = ucontrol->value.iec958.status[3];
        mutex_unlock(&player->ctrl_lock);
 
-       uni_player_set_channel_status(player, NULL);
+       if (player->substream && player->substream->runtime)
+               uni_player_set_channel_status(player,
+                                             player->substream->runtime);
+       else
+               uni_player_set_channel_status(player, NULL);
 
        return 0;
 }
index e047ec06d5382cd61e5ff4e56269b508e714ef59..56ed9472e89fe98c98f82b3b90ed61fdd2e774e4 100644 (file)
@@ -765,11 +765,11 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
 
        card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
        if (!card)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        card->dai_link = sun4i_codec_create_link(dev, &card->num_links);
        if (!card->dai_link)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        card->dev               = dev;
        card->name              = "sun4i-codec";
@@ -829,12 +829,6 @@ static int sun4i_codec_probe(struct platform_device *pdev)
                return PTR_ERR(scodec->clk_module);
        }
 
-       /* Enable the bus clock */
-       if (clk_prepare_enable(scodec->clk_apb)) {
-               dev_err(&pdev->dev, "Failed to enable the APB clock\n");
-               return -EINVAL;
-       }
-
        scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa",
                                                  GPIOD_OUT_LOW);
        if (IS_ERR(scodec->gpio_pa)) {
@@ -844,6 +838,12 @@ static int sun4i_codec_probe(struct platform_device *pdev)
                return ret;
        }
 
+       /* Enable the bus clock */
+       if (clk_prepare_enable(scodec->clk_apb)) {
+               dev_err(&pdev->dev, "Failed to enable the APB clock\n");
+               return -EINVAL;
+       }
+
        /* DMA configuration for TX FIFO */
        scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA;
        scodec->playback_dma_data.maxburst = 4;
@@ -876,7 +876,8 @@ static int sun4i_codec_probe(struct platform_device *pdev)
        }
 
        card = sun4i_codec_create_card(&pdev->dev);
-       if (!card) {
+       if (IS_ERR(card)) {
+               ret = PTR_ERR(card);
                dev_err(&pdev->dev, "Failed to create our card\n");
                goto err_unregister_codec;
        }
index 4ffff7be92993e02f37fd4be8d79c23b11be9d85..a53fef0c673bbbfcf8669ffb66f5de079dbc7e18 100644 (file)
@@ -1337,8 +1337,8 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
                }
 
                if (first) {
-                       ui_browser__printf(&browser->b, "%c", folded_sign);
-                       width--;
+                       ui_browser__printf(&browser->b, "%c ", folded_sign);
+                       width -= 2;
                        first = false;
                } else {
                        ui_browser__printf(&browser->b, "  ");
@@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
                width -= hpp.buf - s;
        }
 
-       ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
-       width -= hierarchy_indent;
+       if (!first) {
+               ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
+               width -= hierarchy_indent;
+       }
 
        if (column >= browser->b.horiz_scroll) {
                char s[2048];
@@ -1381,7 +1383,13 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
                }
 
                perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
-                       ui_browser__write_nstring(&browser->b, "", 2);
+                       if (first) {
+                               ui_browser__printf(&browser->b, "%c ", folded_sign);
+                               first = false;
+                       } else {
+                               ui_browser__write_nstring(&browser->b, "", 2);
+                       }
+
                        width -= 2;
 
                        /*
@@ -1555,10 +1563,11 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
        int indent = hists->nr_hpp_node - 2;
        bool first_node, first_col;
 
-       ret = scnprintf(buf, size, " ");
+       ret = scnprintf(buf, size, "  ");
        if (advance_hpp_check(&dummy_hpp, ret))
                return ret;
 
+       first_node = true;
        /* the first hpp_list_node is for overhead columns */
        fmt_node = list_first_entry(&hists->hpp_formats,
                                    struct perf_hpp_list_node, list);
@@ -1573,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
                ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
                if (advance_hpp_check(&dummy_hpp, ret))
                        break;
+
+               first_node = false;
        }
 
-       ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
-                       indent * HIERARCHY_INDENT, "");
-       if (advance_hpp_check(&dummy_hpp, ret))
-               return ret;
+       if (!first_node) {
+               ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
+                               indent * HIERARCHY_INDENT, "");
+               if (advance_hpp_check(&dummy_hpp, ret))
+                       return ret;
+       }
 
        first_node = true;
        list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
@@ -2076,8 +2089,21 @@ void hist_browser__init(struct hist_browser *browser,
        browser->b.use_navkeypressed    = true;
        browser->show_headers           = symbol_conf.show_hist_headers;
 
-       hists__for_each_format(hists, fmt)
+       if (symbol_conf.report_hierarchy) {
+               struct perf_hpp_list_node *fmt_node;
+
+               /* count overhead columns (in the first node) */
+               fmt_node = list_first_entry(&hists->hpp_formats,
+                                           struct perf_hpp_list_node, list);
+               perf_hpp_list__for_each_format(&fmt_node->hpp, fmt)
+                       ++browser->b.columns;
+
+               /* add a single column for whole hierarchy sort keys*/
                ++browser->b.columns;
+       } else {
+               hists__for_each_format(hists, fmt)
+                       ++browser->b.columns;
+       }
 
        hists__reset_column_width(hists);
 }
index b02992efb51383c06ce507adcba261100e101dd8..a69f027368ef49caf0c259e035cf886fb7062d32 100644 (file)
@@ -1600,18 +1600,18 @@ static void hists__hierarchy_output_resort(struct hists *hists,
                if (prog)
                        ui_progress__update(prog, 1);
 
+               hists->nr_entries++;
+               if (!he->filtered) {
+                       hists->nr_non_filtered_entries++;
+                       hists__calc_col_len(hists, he);
+               }
+
                if (!he->leaf) {
                        hists__hierarchy_output_resort(hists, prog,
                                                       &he->hroot_in,
                                                       &he->hroot_out,
                                                       min_callchain_hits,
                                                       use_callchain);
-                       hists->nr_entries++;
-                       if (!he->filtered) {
-                               hists->nr_non_filtered_entries++;
-                               hists__calc_col_len(hists, he);
-                       }
-
                        continue;
                }
 
index b4bf76971dc975c5232b96f27f56310f65d2bcdd..1eef0aed64239509795229d522cada4e80edf5a2 100644 (file)
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
                        struct cpufreq_affected_cpus *cpus;
 
                        if (!bitmask_isbitset(cpus_chosen, cpu) ||
-                           cpupower_is_cpu_online(cpu))
+                           cpupower_is_cpu_online(cpu) != 1)
                                continue;
 
                        cpus = cpufreq_get_related_cpus(cpu);
@@ -316,10 +316,7 @@ int cmd_freq_set(int argc, char **argv)
             cpu <= bitmask_last(cpus_chosen); cpu++) {
 
                if (!bitmask_isbitset(cpus_chosen, cpu) ||
-                   cpupower_is_cpu_online(cpu))
-                       continue;
-
-               if (cpupower_is_cpu_online(cpu) != 1)
+                   cpupower_is_cpu_online(cpu) != 1)
                        continue;
 
                printf(_("Setting cpu: %d\n"), cpu);
index e18b30ddcdce94ae9577119f7bb7e1362adb25f5..ebe1b9fa3c4d39bdc04076d117a5d88970995c91 100644 (file)
@@ -453,17 +453,33 @@ struct vgic_io_device *kvm_to_vgic_iodev(const struct kvm_io_device *dev)
        return container_of(dev, struct vgic_io_device, dev);
 }
 
-static bool check_region(const struct vgic_register_region *region,
+static bool check_region(const struct kvm *kvm,
+                        const struct vgic_register_region *region,
                         gpa_t addr, int len)
 {
-       if ((region->access_flags & VGIC_ACCESS_8bit) && len == 1)
-               return true;
-       if ((region->access_flags & VGIC_ACCESS_32bit) &&
-           len == sizeof(u32) && !(addr & 3))
-               return true;
-       if ((region->access_flags & VGIC_ACCESS_64bit) &&
-           len == sizeof(u64) && !(addr & 7))
-               return true;
+       int flags, nr_irqs = kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS;
+
+       switch (len) {
+       case sizeof(u8):
+               flags = VGIC_ACCESS_8bit;
+               break;
+       case sizeof(u32):
+               flags = VGIC_ACCESS_32bit;
+               break;
+       case sizeof(u64):
+               flags = VGIC_ACCESS_64bit;
+               break;
+       default:
+               return false;
+       }
+
+       if ((region->access_flags & flags) && IS_ALIGNED(addr, len)) {
+               if (!region->bits_per_irq)
+                       return true;
+
+               /* Do we access a non-allocated IRQ? */
+               return VGIC_ADDR_TO_INTID(addr, region->bits_per_irq) < nr_irqs;
+       }
 
        return false;
 }
@@ -477,7 +493,7 @@ static int dispatch_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
 
        region = vgic_find_mmio_region(iodev->regions, iodev->nr_regions,
                                       addr - iodev->base_addr);
-       if (!region || !check_region(region, addr, len)) {
+       if (!region || !check_region(vcpu->kvm, region, addr, len)) {
                memset(val, 0, len);
                return 0;
        }
@@ -510,10 +526,7 @@ static int dispatch_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
 
        region = vgic_find_mmio_region(iodev->regions, iodev->nr_regions,
                                       addr - iodev->base_addr);
-       if (!region)
-               return 0;
-
-       if (!check_region(region, addr, len))
+       if (!region || !check_region(vcpu->kvm, region, addr, len))
                return 0;
 
        switch (iodev->iodev_type) {
index 4c34d39d44a0eabe1a8b70d16380d0cf8ae1787a..84961b4e4422fcf50800e156063a1595969851cd 100644 (file)
@@ -50,15 +50,15 @@ extern struct kvm_io_device_ops kvm_io_gic_ops;
 #define VGIC_ADDR_IRQ_MASK(bits) (((bits) * 1024 / 8) - 1)
 
 /*
- * (addr & mask) gives us the byte offset for the INT ID, so we want to
- * divide this with 'bytes per irq' to get the INT ID, which is given
- * by '(bits) / 8'.  But we do this with fixed-point-arithmetic and
- * take advantage of the fact that division by a fraction equals
- * multiplication with the inverted fraction, and scale up both the
- * numerator and denominator with 8 to support at most 64 bits per IRQ:
+ * (addr & mask) gives us the _byte_ offset for the INT ID.
+ * We multiply this by 8 the get the _bit_ offset, then divide this by
+ * the number of bits to learn the actual INT ID.
+ * But instead of a division (which requires a "long long div" implementation),
+ * we shift by the binary logarithm of <bits>.
+ * This assumes that <bits> is a power of two.
  */
 #define VGIC_ADDR_TO_INTID(addr, bits)  (((addr) & VGIC_ADDR_IRQ_MASK(bits)) * \
-                                       64 / (bits) / 8)
+                                       8 >> ilog2(bits))
 
 /*
  * Some VGIC registers store per-IRQ information, with a different number
index 2893d5ba523ad26f139fbac8d2dd1c2aa43649ad..6440b56ec90e2198a234fa9b09d87b0c518efea7 100644 (file)
@@ -273,6 +273,18 @@ bool vgic_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq)
                 * no more work for us to do.
                 */
                spin_unlock(&irq->irq_lock);
+
+               /*
+                * We have to kick the VCPU here, because we could be
+                * queueing an edge-triggered interrupt for which we
+                * get no EOI maintenance interrupt. In that case,
+                * while the IRQ is already on the VCPU's AP list, the
+                * VCPU could have EOI'ed the original interrupt and
+                * won't see this one until it exits for some other
+                * reason.
+                */
+               if (vcpu)
+                       kvm_vcpu_kick(vcpu);
                return false;
        }