diff options
author | Dave Airlie <airlied@redhat.com> | 2016-11-29 23:18:51 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-11-29 23:18:51 -0500 |
commit | 63207455963053ca212e61c75f43b3502ea69f0e (patch) | |
tree | 96b2bbcee059a41eb580c17a6c473a259189072a | |
parent | 7625e05286cf3f37c8a5e633379a4d014ddbe555 (diff) | |
parent | 348a4b6dd77d183ef4ea67673ecf30a09ae3f9d7 (diff) |
Merge tag 'drm-qemu-20161121' of git://git.kraxel.org/linux into drm-next
drm/virtio: fix busid in a different way, allocate more vbufs.
drm/qxl: various bugfixes and cleanups,
* tag 'drm-qemu-20161121' of git://git.kraxel.org/linux: (224 commits)
drm/virtio: allocate some extra bufs
qxl: Allow resolution which are not multiple of 8
qxl: Don't notify userspace when monitors config is unchanged
qxl: Remove qxl_bo_init() return value
qxl: Call qxl_gem_{init, fini}
qxl: Add missing '\n' to qxl_io_log() call
qxl: Remove unused prototype
qxl: Mark some internal functions as static
Revert "drm: virtio: reinstate drm_virtio_set_busid()"
drm/virtio: fix busid regression
drm: re-export drm_dev_set_unique
Linux 4.9-rc5
gp8psk: Fix DVB frontend attach
gp8psk: fix gp8psk_usb_in_op() logic
dvb-usb: move data_mutex to struct dvb_usb_device
iio: maxim_thermocouple: detect invalid storage size in read()
aoe: fix crash in page count manipulation
lightnvm: invalid offset calculation for lba_shift
Kbuild: enable -Wmaybe-uninitialized warnings by default
pcmcia: fix return value of soc_pcmcia_regulator_set
...
258 files changed, 1998 insertions, 1303 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl b/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl index b82deeaec314..470def06ab0a 100644 --- a/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl +++ b/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl | |||
@@ -1,4 +1,4 @@ | |||
1 | What: state | 1 | What: /sys/devices/system/ibm_rtl/state |
2 | Date: Sep 2010 | 2 | Date: Sep 2010 |
3 | KernelVersion: 2.6.37 | 3 | KernelVersion: 2.6.37 |
4 | Contact: Vernon Mauery <vernux@us.ibm.com> | 4 | Contact: Vernon Mauery <vernux@us.ibm.com> |
@@ -10,7 +10,7 @@ Description: The state file allows a means by which to change in and | |||
10 | Users: The ibm-prtm userspace daemon uses this interface. | 10 | Users: The ibm-prtm userspace daemon uses this interface. |
11 | 11 | ||
12 | 12 | ||
13 | What: version | 13 | What: /sys/devices/system/ibm_rtl/version |
14 | Date: Sep 2010 | 14 | Date: Sep 2010 |
15 | KernelVersion: 2.6.37 | 15 | KernelVersion: 2.6.37 |
16 | Contact: Vernon Mauery <vernux@us.ibm.com> | 16 | Contact: Vernon Mauery <vernux@us.ibm.com> |
diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt index 4e00e859e885..bfa461aaac99 100644 --- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt +++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt | |||
@@ -43,6 +43,9 @@ Optional properties: | |||
43 | reset signal present internally in some host controller IC designs. | 43 | reset signal present internally in some host controller IC designs. |
44 | See Documentation/devicetree/bindings/reset/reset.txt for details. | 44 | See Documentation/devicetree/bindings/reset/reset.txt for details. |
45 | 45 | ||
46 | * reset-names: request name for using "resets" property. Must be "reset". | ||
47 | (It will be used together with "resets" property.) | ||
48 | |||
46 | * clocks: from common clock binding: handle to biu and ciu clocks for the | 49 | * clocks: from common clock binding: handle to biu and ciu clocks for the |
47 | bus interface unit clock and the card interface unit clock. | 50 | bus interface unit clock and the card interface unit clock. |
48 | 51 | ||
@@ -103,6 +106,8 @@ board specific portions as listed below. | |||
103 | interrupts = <0 75 0>; | 106 | interrupts = <0 75 0>; |
104 | #address-cells = <1>; | 107 | #address-cells = <1>; |
105 | #size-cells = <0>; | 108 | #size-cells = <0>; |
109 | resets = <&rst 20>; | ||
110 | reset-names = "reset"; | ||
106 | }; | 111 | }; |
107 | 112 | ||
108 | [board specific internal DMA resources] | 113 | [board specific internal DMA resources] |
diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt index ba67b39939c1..71aeda1ca055 100644 --- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt +++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt | |||
@@ -26,13 +26,16 @@ Required properties: | |||
26 | - "sys" | 26 | - "sys" |
27 | - "legacy" | 27 | - "legacy" |
28 | - "client" | 28 | - "client" |
29 | - resets: Must contain five entries for each entry in reset-names. | 29 | - resets: Must contain seven entries for each entry in reset-names. |
30 | See ../reset/reset.txt for details. | 30 | See ../reset/reset.txt for details. |
31 | - reset-names: Must include the following names | 31 | - reset-names: Must include the following names |
32 | - "core" | 32 | - "core" |
33 | - "mgmt" | 33 | - "mgmt" |
34 | - "mgmt-sticky" | 34 | - "mgmt-sticky" |
35 | - "pipe" | 35 | - "pipe" |
36 | - "pm" | ||
37 | - "aclk" | ||
38 | - "pclk" | ||
36 | - pinctrl-names : The pin control state names | 39 | - pinctrl-names : The pin control state names |
37 | - pinctrl-0: The "default" pinctrl state | 40 | - pinctrl-0: The "default" pinctrl state |
38 | - #interrupt-cells: specifies the number of cells needed to encode an | 41 | - #interrupt-cells: specifies the number of cells needed to encode an |
@@ -86,8 +89,10 @@ pcie0: pcie@f8000000 { | |||
86 | reg = <0x0 0xf8000000 0x0 0x2000000>, <0x0 0xfd000000 0x0 0x1000000>; | 89 | reg = <0x0 0xf8000000 0x0 0x2000000>, <0x0 0xfd000000 0x0 0x1000000>; |
87 | reg-names = "axi-base", "apb-base"; | 90 | reg-names = "axi-base", "apb-base"; |
88 | resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, | 91 | resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, |
89 | <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>; | 92 | <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE> , |
90 | reset-names = "core", "mgmt", "mgmt-sticky", "pipe"; | 93 | <&cru SRST_PCIE_PM>, <&cru SRST_P_PCIE>, <&cru SRST_A_PCIE>; |
94 | reset-names = "core", "mgmt", "mgmt-sticky", "pipe", | ||
95 | "pm", "pclk", "aclk"; | ||
91 | phys = <&pcie_phy>; | 96 | phys = <&pcie_phy>; |
92 | phy-names = "pcie-phy"; | 97 | phy-names = "pcie-phy"; |
93 | pinctrl-names = "default"; | 98 | pinctrl-names = "default"; |
diff --git a/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt index f9753c416974..b24583aa34c3 100644 --- a/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt | |||
@@ -14,11 +14,6 @@ Required properies: | |||
14 | - #size-cells : The value of this property must be 1 | 14 | - #size-cells : The value of this property must be 1 |
15 | - ranges : defines mapping between pin controller node (parent) to | 15 | - ranges : defines mapping between pin controller node (parent) to |
16 | gpio-bank node (children). | 16 | gpio-bank node (children). |
17 | - interrupt-parent: phandle of the interrupt parent to which the external | ||
18 | GPIO interrupts are forwarded to. | ||
19 | - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node | ||
20 | which includes IRQ mux selection register, and the offset of the IRQ mux | ||
21 | selection register. | ||
22 | - pins-are-numbered: Specify the subnodes are using numbered pinmux to | 17 | - pins-are-numbered: Specify the subnodes are using numbered pinmux to |
23 | specify pins. | 18 | specify pins. |
24 | 19 | ||
@@ -37,6 +32,11 @@ Required properties: | |||
37 | 32 | ||
38 | Optional properties: | 33 | Optional properties: |
39 | - reset: : Reference to the reset controller | 34 | - reset: : Reference to the reset controller |
35 | - interrupt-parent: phandle of the interrupt parent to which the external | ||
36 | GPIO interrupts are forwarded to. | ||
37 | - st,syscfg: Should be phandle/offset pair. The phandle to the syscon node | ||
38 | which includes IRQ mux selection register, and the offset of the IRQ mux | ||
39 | selection register. | ||
40 | 40 | ||
41 | Example: | 41 | Example: |
42 | #include <dt-bindings/pinctrl/stm32f429-pinfunc.h> | 42 | #include <dt-bindings/pinctrl/stm32f429-pinfunc.h> |
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 14cdc101d165..1b5f15653b1b 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -447,7 +447,6 @@ prototypes: | |||
447 | int (*flush) (struct file *); | 447 | int (*flush) (struct file *); |
448 | int (*release) (struct inode *, struct file *); | 448 | int (*release) (struct inode *, struct file *); |
449 | int (*fsync) (struct file *, loff_t start, loff_t end, int datasync); | 449 | int (*fsync) (struct file *, loff_t start, loff_t end, int datasync); |
450 | int (*aio_fsync) (struct kiocb *, int datasync); | ||
451 | int (*fasync) (int, struct file *, int); | 450 | int (*fasync) (int, struct file *, int); |
452 | int (*lock) (struct file *, int, struct file_lock *); | 451 | int (*lock) (struct file *, int, struct file_lock *); |
453 | ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, | 452 | ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index d619c8d71966..b5039a00caaf 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -828,7 +828,6 @@ struct file_operations { | |||
828 | int (*flush) (struct file *, fl_owner_t id); | 828 | int (*flush) (struct file *, fl_owner_t id); |
829 | int (*release) (struct inode *, struct file *); | 829 | int (*release) (struct inode *, struct file *); |
830 | int (*fsync) (struct file *, loff_t, loff_t, int datasync); | 830 | int (*fsync) (struct file *, loff_t, loff_t, int datasync); |
831 | int (*aio_fsync) (struct kiocb *, int datasync); | ||
832 | int (*fasync) (int, struct file *, int); | 831 | int (*fasync) (int, struct file *, int); |
833 | int (*lock) (struct file *, int, struct file_lock *); | 832 | int (*lock) (struct file *, int, struct file_lock *); |
834 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); | 833 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); |
diff --git a/MAINTAINERS b/MAINTAINERS index 66df67f1a1a4..04bc7c93a7c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -9354,7 +9354,7 @@ PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) | |||
9354 | M: Keith Busch <keith.busch@intel.com> | 9354 | M: Keith Busch <keith.busch@intel.com> |
9355 | L: linux-pci@vger.kernel.org | 9355 | L: linux-pci@vger.kernel.org |
9356 | S: Supported | 9356 | S: Supported |
9357 | F: arch/x86/pci/vmd.c | 9357 | F: drivers/pci/host/vmd.c |
9358 | 9358 | ||
9359 | PCIE DRIVER FOR ST SPEAR13XX | 9359 | PCIE DRIVER FOR ST SPEAR13XX |
9360 | M: Pratyush Anand <pratyush.anand@gmail.com> | 9360 | M: Pratyush Anand <pratyush.anand@gmail.com> |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 9 | 2 | PATCHLEVEL = 9 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Psychotic Stoned Sheep | 5 | NAME = Psychotic Stoned Sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -370,7 +370,7 @@ LDFLAGS_MODULE = | |||
370 | CFLAGS_KERNEL = | 370 | CFLAGS_KERNEL = |
371 | AFLAGS_KERNEL = | 371 | AFLAGS_KERNEL = |
372 | LDFLAGS_vmlinux = | 372 | LDFLAGS_vmlinux = |
373 | CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im | 373 | CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized |
374 | CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) | 374 | CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) |
375 | 375 | ||
376 | 376 | ||
@@ -620,7 +620,6 @@ ARCH_CFLAGS := | |||
620 | include arch/$(SRCARCH)/Makefile | 620 | include arch/$(SRCARCH)/Makefile |
621 | 621 | ||
622 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) | 622 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) |
623 | KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) | ||
624 | KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) | 623 | KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) |
625 | 624 | ||
626 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION | 625 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION |
@@ -629,15 +628,18 @@ KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) | |||
629 | endif | 628 | endif |
630 | 629 | ||
631 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 630 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
632 | KBUILD_CFLAGS += -Os | 631 | KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) |
633 | else | 632 | else |
634 | ifdef CONFIG_PROFILE_ALL_BRANCHES | 633 | ifdef CONFIG_PROFILE_ALL_BRANCHES |
635 | KBUILD_CFLAGS += -O2 | 634 | KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) |
636 | else | 635 | else |
637 | KBUILD_CFLAGS += -O2 | 636 | KBUILD_CFLAGS += -O2 |
638 | endif | 637 | endif |
639 | endif | 638 | endif |
640 | 639 | ||
640 | KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ | ||
641 | $(call cc-disable-warning,maybe-uninitialized,)) | ||
642 | |||
641 | # Tell gcc to never replace conditional load with a non-conditional one | 643 | # Tell gcc to never replace conditional load with a non-conditional one |
642 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) | 644 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) |
643 | 645 | ||
diff --git a/arch/arc/Makefile b/arch/arc/Makefile index 864adad52280..19cce226d1a8 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile | |||
@@ -50,6 +50,9 @@ atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y) | |||
50 | 50 | ||
51 | cflags-$(atleast_gcc44) += -fsection-anchors | 51 | cflags-$(atleast_gcc44) += -fsection-anchors |
52 | 52 | ||
53 | cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock | ||
54 | cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape | ||
55 | |||
53 | ifdef CONFIG_ISA_ARCV2 | 56 | ifdef CONFIG_ISA_ARCV2 |
54 | 57 | ||
55 | ifndef CONFIG_ARC_HAS_LL64 | 58 | ifndef CONFIG_ARC_HAS_LL64 |
@@ -68,7 +71,9 @@ cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi) | |||
68 | ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE | 71 | ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE |
69 | # Generic build system uses -O2, we want -O3 | 72 | # Generic build system uses -O2, we want -O3 |
70 | # Note: No need to add to cflags-y as that happens anyways | 73 | # Note: No need to add to cflags-y as that happens anyways |
71 | ARCH_CFLAGS += -O3 | 74 | # |
75 | # Disable the false maybe-uninitialized warings gcc spits out at -O3 | ||
76 | ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,) | ||
72 | endif | 77 | endif |
73 | 78 | ||
74 | # small data is default for elf32 tool-chain. If not usable, disable it | 79 | # small data is default for elf32 tool-chain. If not usable, disable it |
diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi index 6ae2c476ad82..53ce226f77a5 100644 --- a/arch/arc/boot/dts/axc001.dtsi +++ b/arch/arc/boot/dts/axc001.dtsi | |||
@@ -71,7 +71,7 @@ | |||
71 | reg-io-width = <4>; | 71 | reg-io-width = <4>; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | arcpmu0: pmu { | 74 | arcpct0: pct { |
75 | compatible = "snps,arc700-pct"; | 75 | compatible = "snps,arc700-pct"; |
76 | }; | 76 | }; |
77 | }; | 77 | }; |
diff --git a/arch/arc/boot/dts/nsim_700.dts b/arch/arc/boot/dts/nsim_700.dts index ce0ccd20b5bf..5ee96b067c08 100644 --- a/arch/arc/boot/dts/nsim_700.dts +++ b/arch/arc/boot/dts/nsim_700.dts | |||
@@ -69,7 +69,7 @@ | |||
69 | }; | 69 | }; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | arcpmu0: pmu { | 72 | arcpct0: pct { |
73 | compatible = "snps,arc700-pct"; | 73 | compatible = "snps,arc700-pct"; |
74 | }; | 74 | }; |
75 | }; | 75 | }; |
diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts index bcf603142a33..3c391ba565ed 100644 --- a/arch/arc/boot/dts/nsimosci.dts +++ b/arch/arc/boot/dts/nsimosci.dts | |||
@@ -83,5 +83,9 @@ | |||
83 | reg = <0xf0003000 0x44>; | 83 | reg = <0xf0003000 0x44>; |
84 | interrupts = <7>; | 84 | interrupts = <7>; |
85 | }; | 85 | }; |
86 | |||
87 | arcpct0: pct { | ||
88 | compatible = "snps,arc700-pct"; | ||
89 | }; | ||
86 | }; | 90 | }; |
87 | }; | 91 | }; |
diff --git a/arch/arc/configs/nsim_700_defconfig b/arch/arc/configs/nsim_700_defconfig index 7314f538847b..b0066a749d4c 100644 --- a/arch/arc/configs/nsim_700_defconfig +++ b/arch/arc/configs/nsim_700_defconfig | |||
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
14 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs/" | 14 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs/" |
15 | CONFIG_KALLSYMS_ALL=y | 15 | CONFIG_KALLSYMS_ALL=y |
16 | CONFIG_EMBEDDED=y | 16 | CONFIG_EMBEDDED=y |
17 | CONFIG_PERF_EVENTS=y | ||
17 | # CONFIG_SLUB_DEBUG is not set | 18 | # CONFIG_SLUB_DEBUG is not set |
18 | # CONFIG_COMPAT_BRK is not set | 19 | # CONFIG_COMPAT_BRK is not set |
19 | CONFIG_KPROBES=y | 20 | CONFIG_KPROBES=y |
diff --git a/arch/arc/configs/nsim_hs_defconfig b/arch/arc/configs/nsim_hs_defconfig index 65ab9fbf83f2..ebe9ebb92933 100644 --- a/arch/arc/configs/nsim_hs_defconfig +++ b/arch/arc/configs/nsim_hs_defconfig | |||
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
14 | CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/" | 14 | CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/" |
15 | CONFIG_KALLSYMS_ALL=y | 15 | CONFIG_KALLSYMS_ALL=y |
16 | CONFIG_EMBEDDED=y | 16 | CONFIG_EMBEDDED=y |
17 | CONFIG_PERF_EVENTS=y | ||
17 | # CONFIG_SLUB_DEBUG is not set | 18 | # CONFIG_SLUB_DEBUG is not set |
18 | # CONFIG_COMPAT_BRK is not set | 19 | # CONFIG_COMPAT_BRK is not set |
19 | CONFIG_KPROBES=y | 20 | CONFIG_KPROBES=y |
diff --git a/arch/arc/configs/nsim_hs_smp_defconfig b/arch/arc/configs/nsim_hs_smp_defconfig index 3b3990cddbe1..4bde43278be6 100644 --- a/arch/arc/configs/nsim_hs_smp_defconfig +++ b/arch/arc/configs/nsim_hs_smp_defconfig | |||
@@ -12,6 +12,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
12 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" | 12 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" |
13 | CONFIG_KALLSYMS_ALL=y | 13 | CONFIG_KALLSYMS_ALL=y |
14 | CONFIG_EMBEDDED=y | 14 | CONFIG_EMBEDDED=y |
15 | CONFIG_PERF_EVENTS=y | ||
15 | # CONFIG_SLUB_DEBUG is not set | 16 | # CONFIG_SLUB_DEBUG is not set |
16 | # CONFIG_COMPAT_BRK is not set | 17 | # CONFIG_COMPAT_BRK is not set |
17 | CONFIG_KPROBES=y | 18 | CONFIG_KPROBES=y |
diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig index 98cf20933bbb..f6fb3d26557e 100644 --- a/arch/arc/configs/nsimosci_defconfig +++ b/arch/arc/configs/nsimosci_defconfig | |||
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
14 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs/" | 14 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs/" |
15 | CONFIG_KALLSYMS_ALL=y | 15 | CONFIG_KALLSYMS_ALL=y |
16 | CONFIG_EMBEDDED=y | 16 | CONFIG_EMBEDDED=y |
17 | CONFIG_PERF_EVENTS=y | ||
17 | # CONFIG_SLUB_DEBUG is not set | 18 | # CONFIG_SLUB_DEBUG is not set |
18 | # CONFIG_COMPAT_BRK is not set | 19 | # CONFIG_COMPAT_BRK is not set |
19 | CONFIG_KPROBES=y | 20 | CONFIG_KPROBES=y |
diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig index ddf8b96d494e..b9f0fe00044b 100644 --- a/arch/arc/configs/nsimosci_hs_defconfig +++ b/arch/arc/configs/nsimosci_hs_defconfig | |||
@@ -14,6 +14,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
14 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" | 14 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" |
15 | CONFIG_KALLSYMS_ALL=y | 15 | CONFIG_KALLSYMS_ALL=y |
16 | CONFIG_EMBEDDED=y | 16 | CONFIG_EMBEDDED=y |
17 | CONFIG_PERF_EVENTS=y | ||
17 | # CONFIG_SLUB_DEBUG is not set | 18 | # CONFIG_SLUB_DEBUG is not set |
18 | # CONFIG_COMPAT_BRK is not set | 19 | # CONFIG_COMPAT_BRK is not set |
19 | CONFIG_KPROBES=y | 20 | CONFIG_KPROBES=y |
diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig index ceb90745326e..6da71ba253a9 100644 --- a/arch/arc/configs/nsimosci_hs_smp_defconfig +++ b/arch/arc/configs/nsimosci_hs_smp_defconfig | |||
@@ -10,6 +10,7 @@ CONFIG_IKCONFIG_PROC=y | |||
10 | # CONFIG_PID_NS is not set | 10 | # CONFIG_PID_NS is not set |
11 | CONFIG_BLK_DEV_INITRD=y | 11 | CONFIG_BLK_DEV_INITRD=y |
12 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" | 12 | CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" |
13 | CONFIG_PERF_EVENTS=y | ||
13 | # CONFIG_COMPAT_BRK is not set | 14 | # CONFIG_COMPAT_BRK is not set |
14 | CONFIG_KPROBES=y | 15 | CONFIG_KPROBES=y |
15 | CONFIG_MODULES=y | 16 | CONFIG_MODULES=y |
@@ -34,7 +35,6 @@ CONFIG_INET=y | |||
34 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | 35 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set |
35 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | 36 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set |
36 | # CONFIG_INET_XFRM_MODE_BEET is not set | 37 | # CONFIG_INET_XFRM_MODE_BEET is not set |
37 | # CONFIG_INET_LRO is not set | ||
38 | # CONFIG_IPV6 is not set | 38 | # CONFIG_IPV6 is not set |
39 | # CONFIG_WIRELESS is not set | 39 | # CONFIG_WIRELESS is not set |
40 | CONFIG_DEVTMPFS=y | 40 | CONFIG_DEVTMPFS=y |
@@ -72,7 +72,6 @@ CONFIG_SERIAL_OF_PLATFORM=y | |||
72 | # CONFIG_HWMON is not set | 72 | # CONFIG_HWMON is not set |
73 | CONFIG_DRM=y | 73 | CONFIG_DRM=y |
74 | CONFIG_DRM_ARCPGU=y | 74 | CONFIG_DRM_ARCPGU=y |
75 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
76 | CONFIG_LOGO=y | 75 | CONFIG_LOGO=y |
77 | # CONFIG_HID is not set | 76 | # CONFIG_HID is not set |
78 | # CONFIG_USB_SUPPORT is not set | 77 | # CONFIG_USB_SUPPORT is not set |
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 7f3f9f63708c..1bd24ec3e350 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
@@ -43,12 +43,14 @@ | |||
43 | #define STATUS_AE_BIT 5 /* Exception active */ | 43 | #define STATUS_AE_BIT 5 /* Exception active */ |
44 | #define STATUS_DE_BIT 6 /* PC is in delay slot */ | 44 | #define STATUS_DE_BIT 6 /* PC is in delay slot */ |
45 | #define STATUS_U_BIT 7 /* User/Kernel mode */ | 45 | #define STATUS_U_BIT 7 /* User/Kernel mode */ |
46 | #define STATUS_Z_BIT 11 | ||
46 | #define STATUS_L_BIT 12 /* Loop inhibit */ | 47 | #define STATUS_L_BIT 12 /* Loop inhibit */ |
47 | 48 | ||
48 | /* These masks correspond to the status word(STATUS_32) bits */ | 49 | /* These masks correspond to the status word(STATUS_32) bits */ |
49 | #define STATUS_AE_MASK (1<<STATUS_AE_BIT) | 50 | #define STATUS_AE_MASK (1<<STATUS_AE_BIT) |
50 | #define STATUS_DE_MASK (1<<STATUS_DE_BIT) | 51 | #define STATUS_DE_MASK (1<<STATUS_DE_BIT) |
51 | #define STATUS_U_MASK (1<<STATUS_U_BIT) | 52 | #define STATUS_U_MASK (1<<STATUS_U_BIT) |
53 | #define STATUS_Z_MASK (1<<STATUS_Z_BIT) | ||
52 | #define STATUS_L_MASK (1<<STATUS_L_BIT) | 54 | #define STATUS_L_MASK (1<<STATUS_L_BIT) |
53 | 55 | ||
54 | /* | 56 | /* |
diff --git a/arch/arc/include/asm/smp.h b/arch/arc/include/asm/smp.h index 89fdd1b0a76e..0861007d9ef3 100644 --- a/arch/arc/include/asm/smp.h +++ b/arch/arc/include/asm/smp.h | |||
@@ -37,9 +37,9 @@ extern const char *arc_platform_smp_cpuinfo(void); | |||
37 | * API expected BY platform smp code (FROM arch smp code) | 37 | * API expected BY platform smp code (FROM arch smp code) |
38 | * | 38 | * |
39 | * smp_ipi_irq_setup: | 39 | * smp_ipi_irq_setup: |
40 | * Takes @cpu and @irq to which the arch-common ISR is hooked up | 40 | * Takes @cpu and @hwirq to which the arch-common ISR is hooked up |
41 | */ | 41 | */ |
42 | extern int smp_ipi_irq_setup(int cpu, int irq); | 42 | extern int smp_ipi_irq_setup(int cpu, irq_hw_number_t hwirq); |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * struct plat_smp_ops - SMP callbacks provided by platform to ARC SMP | 45 | * struct plat_smp_ops - SMP callbacks provided by platform to ARC SMP |
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c index f1e07c2344f8..3b67f538f142 100644 --- a/arch/arc/kernel/devtree.c +++ b/arch/arc/kernel/devtree.c | |||
@@ -31,6 +31,8 @@ static void __init arc_set_early_base_baud(unsigned long dt_root) | |||
31 | arc_base_baud = 166666666; /* Fixed 166.6MHz clk (TB10x) */ | 31 | arc_base_baud = 166666666; /* Fixed 166.6MHz clk (TB10x) */ |
32 | else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp")) | 32 | else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp")) |
33 | arc_base_baud = 33333333; /* Fixed 33MHz clk (AXS10x) */ | 33 | arc_base_baud = 33333333; /* Fixed 33MHz clk (AXS10x) */ |
34 | else if (of_flat_dt_is_compatible(dt_root, "ezchip,arc-nps")) | ||
35 | arc_base_baud = 800000000; /* Fixed 800MHz clk (NPS) */ | ||
34 | else | 36 | else |
35 | arc_base_baud = 50000000; /* Fixed default 50MHz */ | 37 | arc_base_baud = 50000000; /* Fixed default 50MHz */ |
36 | } | 38 | } |
diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index c424d5abc318..f39142acc89e 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c | |||
@@ -181,6 +181,8 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask, | |||
181 | { | 181 | { |
182 | unsigned long flags; | 182 | unsigned long flags; |
183 | cpumask_t online; | 183 | cpumask_t online; |
184 | unsigned int destination_bits; | ||
185 | unsigned int distribution_mode; | ||
184 | 186 | ||
185 | /* errout if no online cpu per @cpumask */ | 187 | /* errout if no online cpu per @cpumask */ |
186 | if (!cpumask_and(&online, cpumask, cpu_online_mask)) | 188 | if (!cpumask_and(&online, cpumask, cpu_online_mask)) |
@@ -188,8 +190,15 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask, | |||
188 | 190 | ||
189 | raw_spin_lock_irqsave(&mcip_lock, flags); | 191 | raw_spin_lock_irqsave(&mcip_lock, flags); |
190 | 192 | ||
191 | idu_set_dest(data->hwirq, cpumask_bits(&online)[0]); | 193 | destination_bits = cpumask_bits(&online)[0]; |
192 | idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR); | 194 | idu_set_dest(data->hwirq, destination_bits); |
195 | |||
196 | if (ffs(destination_bits) == fls(destination_bits)) | ||
197 | distribution_mode = IDU_M_DISTRI_DEST; | ||
198 | else | ||
199 | distribution_mode = IDU_M_DISTRI_RR; | ||
200 | |||
201 | idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, distribution_mode); | ||
193 | 202 | ||
194 | raw_spin_unlock_irqrestore(&mcip_lock, flags); | 203 | raw_spin_unlock_irqrestore(&mcip_lock, flags); |
195 | 204 | ||
@@ -207,16 +216,15 @@ static struct irq_chip idu_irq_chip = { | |||
207 | 216 | ||
208 | }; | 217 | }; |
209 | 218 | ||
210 | static int idu_first_irq; | 219 | static irq_hw_number_t idu_first_hwirq; |
211 | 220 | ||
212 | static void idu_cascade_isr(struct irq_desc *desc) | 221 | static void idu_cascade_isr(struct irq_desc *desc) |
213 | { | 222 | { |
214 | struct irq_domain *domain = irq_desc_get_handler_data(desc); | 223 | struct irq_domain *idu_domain = irq_desc_get_handler_data(desc); |
215 | unsigned int core_irq = irq_desc_get_irq(desc); | 224 | irq_hw_number_t core_hwirq = irqd_to_hwirq(irq_desc_get_irq_data(desc)); |
216 | unsigned int idu_irq; | 225 | irq_hw_number_t idu_hwirq = core_hwirq - idu_first_hwirq; |
217 | 226 | ||
218 | idu_irq = core_irq - idu_first_irq; | 227 | generic_handle_irq(irq_find_mapping(idu_domain, idu_hwirq)); |
219 | generic_handle_irq(irq_find_mapping(domain, idu_irq)); | ||
220 | } | 228 | } |
221 | 229 | ||
222 | static int idu_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hwirq) | 230 | 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) | |||
282 | struct irq_domain *domain; | 290 | struct irq_domain *domain; |
283 | /* Read IDU BCR to confirm nr_irqs */ | 291 | /* Read IDU BCR to confirm nr_irqs */ |
284 | int nr_irqs = of_irq_count(intc); | 292 | int nr_irqs = of_irq_count(intc); |
285 | int i, irq; | 293 | int i, virq; |
286 | struct mcip_bcr mp; | 294 | struct mcip_bcr mp; |
287 | 295 | ||
288 | READ_BCR(ARC_REG_MCIP_BCR, mp); | 296 | READ_BCR(ARC_REG_MCIP_BCR, mp); |
@@ -303,11 +311,11 @@ idu_of_init(struct device_node *intc, struct device_node *parent) | |||
303 | * however we need it to get the parent virq and set IDU handler | 311 | * however we need it to get the parent virq and set IDU handler |
304 | * as first level isr | 312 | * as first level isr |
305 | */ | 313 | */ |
306 | irq = irq_of_parse_and_map(intc, i); | 314 | virq = irq_of_parse_and_map(intc, i); |
307 | if (!i) | 315 | if (!i) |
308 | idu_first_irq = irq; | 316 | idu_first_hwirq = irqd_to_hwirq(irq_get_irq_data(virq)); |
309 | 317 | ||
310 | irq_set_chained_handler_and_data(irq, idu_cascade_isr, domain); | 318 | irq_set_chained_handler_and_data(virq, idu_cascade_isr, domain); |
311 | } | 319 | } |
312 | 320 | ||
313 | __mcip_cmd(CMD_IDU_ENABLE, 0); | 321 | __mcip_cmd(CMD_IDU_ENABLE, 0); |
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c index 59aa43cb146e..a41a79a4f4fe 100644 --- a/arch/arc/kernel/process.c +++ b/arch/arc/kernel/process.c | |||
@@ -43,8 +43,8 @@ SYSCALL_DEFINE0(arc_gettls) | |||
43 | 43 | ||
44 | SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) | 44 | SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) |
45 | { | 45 | { |
46 | int uval; | 46 | struct pt_regs *regs = current_pt_regs(); |
47 | int ret; | 47 | int uval = -EFAULT; |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * This is only for old cores lacking LLOCK/SCOND, which by defintion | 50 | * 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) | |||
54 | */ | 54 | */ |
55 | WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP)); | 55 | WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP)); |
56 | 56 | ||
57 | /* Z indicates to userspace if operation succeded */ | ||
58 | regs->status32 &= ~STATUS_Z_MASK; | ||
59 | |||
57 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | 60 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) |
58 | return -EFAULT; | 61 | return -EFAULT; |
59 | 62 | ||
60 | preempt_disable(); | 63 | preempt_disable(); |
61 | 64 | ||
62 | ret = __get_user(uval, uaddr); | 65 | if (__get_user(uval, uaddr)) |
63 | if (ret) | ||
64 | goto done; | 66 | goto done; |
65 | 67 | ||
66 | if (uval != expected) | 68 | if (uval == expected) { |
67 | ret = -EAGAIN; | 69 | if (!__put_user(new, uaddr)) |
68 | else | 70 | regs->status32 |= STATUS_Z_MASK; |
69 | ret = __put_user(new, uaddr); | 71 | } |
70 | 72 | ||
71 | done: | 73 | done: |
72 | preempt_enable(); | 74 | preempt_enable(); |
73 | 75 | ||
74 | return ret; | 76 | return uval; |
75 | } | 77 | } |
76 | 78 | ||
77 | void arch_cpu_idle(void) | 79 | void arch_cpu_idle(void) |
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c index f183cc648851..88674d972c9d 100644 --- a/arch/arc/kernel/smp.c +++ b/arch/arc/kernel/smp.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/atomic.h> | 22 | #include <linux/atomic.h> |
23 | #include <linux/cpumask.h> | 23 | #include <linux/cpumask.h> |
24 | #include <linux/reboot.h> | 24 | #include <linux/reboot.h> |
25 | #include <linux/irqdomain.h> | ||
25 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
26 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
27 | #include <asm/mach_desc.h> | 28 | #include <asm/mach_desc.h> |
@@ -67,11 +68,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
67 | int i; | 68 | int i; |
68 | 69 | ||
69 | /* | 70 | /* |
70 | * Initialise the present map, which describes the set of CPUs | 71 | * if platform didn't set the present map already, do it now |
71 | * actually populated at the present time. | 72 | * boot cpu is set to present already by init/main.c |
72 | */ | 73 | */ |
73 | for (i = 0; i < max_cpus; i++) | 74 | if (num_present_cpus() <= 1) { |
74 | set_cpu_present(i, true); | 75 | for (i = 0; i < max_cpus; i++) |
76 | set_cpu_present(i, true); | ||
77 | } | ||
75 | } | 78 | } |
76 | 79 | ||
77 | void __init smp_cpus_done(unsigned int max_cpus) | 80 | void __init smp_cpus_done(unsigned int max_cpus) |
@@ -351,20 +354,24 @@ irqreturn_t do_IPI(int irq, void *dev_id) | |||
351 | */ | 354 | */ |
352 | static DEFINE_PER_CPU(int, ipi_dev); | 355 | static DEFINE_PER_CPU(int, ipi_dev); |
353 | 356 | ||
354 | int smp_ipi_irq_setup(int cpu, int irq) | 357 | int smp_ipi_irq_setup(int cpu, irq_hw_number_t hwirq) |
355 | { | 358 | { |
356 | int *dev = per_cpu_ptr(&ipi_dev, cpu); | 359 | int *dev = per_cpu_ptr(&ipi_dev, cpu); |
360 | unsigned int virq = irq_find_mapping(NULL, hwirq); | ||
361 | |||
362 | if (!virq) | ||
363 | panic("Cannot find virq for root domain and hwirq=%lu", hwirq); | ||
357 | 364 | ||
358 | /* Boot cpu calls request, all call enable */ | 365 | /* Boot cpu calls request, all call enable */ |
359 | if (!cpu) { | 366 | if (!cpu) { |
360 | int rc; | 367 | int rc; |
361 | 368 | ||
362 | rc = request_percpu_irq(irq, do_IPI, "IPI Interrupt", dev); | 369 | rc = request_percpu_irq(virq, do_IPI, "IPI Interrupt", dev); |
363 | if (rc) | 370 | if (rc) |
364 | panic("Percpu IRQ request failed for %d\n", irq); | 371 | panic("Percpu IRQ request failed for %u\n", virq); |
365 | } | 372 | } |
366 | 373 | ||
367 | enable_percpu_irq(irq, 0); | 374 | enable_percpu_irq(virq, 0); |
368 | 375 | ||
369 | return 0; | 376 | return 0; |
370 | } | 377 | } |
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index f927b8dc6edd..c10390d1ddb6 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c | |||
@@ -152,14 +152,17 @@ static cycle_t arc_read_rtc(struct clocksource *cs) | |||
152 | cycle_t full; | 152 | cycle_t full; |
153 | } stamp; | 153 | } stamp; |
154 | 154 | ||
155 | 155 | /* | |
156 | __asm__ __volatile( | 156 | * hardware has an internal state machine which tracks readout of |
157 | "1: \n" | 157 | * low/high and updates the CTRL.status if |
158 | " lr %0, [AUX_RTC_LOW] \n" | 158 | * - interrupt/exception taken between the two reads |
159 | " lr %1, [AUX_RTC_HIGH] \n" | 159 | * - high increments after low has been read |
160 | " lr %2, [AUX_RTC_CTRL] \n" | 160 | */ |
161 | " bbit0.nt %2, 31, 1b \n" | 161 | do { |
162 | : "=r" (stamp.low), "=r" (stamp.high), "=r" (status)); | 162 | stamp.low = read_aux_reg(AUX_RTC_LOW); |
163 | stamp.high = read_aux_reg(AUX_RTC_HIGH); | ||
164 | status = read_aux_reg(AUX_RTC_CTRL); | ||
165 | } while (!(status & _BITUL(31))); | ||
163 | 166 | ||
164 | return stamp.full; | 167 | return stamp.full; |
165 | } | 168 | } |
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 60aab5a7522b..cd8aad8226dd 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c | |||
@@ -105,6 +105,31 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr, | |||
105 | __free_pages(page, get_order(size)); | 105 | __free_pages(page, get_order(size)); |
106 | } | 106 | } |
107 | 107 | ||
108 | static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma, | ||
109 | void *cpu_addr, dma_addr_t dma_addr, size_t size, | ||
110 | unsigned long attrs) | ||
111 | { | ||
112 | unsigned long user_count = vma_pages(vma); | ||
113 | unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; | ||
114 | unsigned long pfn = __phys_to_pfn(plat_dma_to_phys(dev, dma_addr)); | ||
115 | unsigned long off = vma->vm_pgoff; | ||
116 | int ret = -ENXIO; | ||
117 | |||
118 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
119 | |||
120 | if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) | ||
121 | return ret; | ||
122 | |||
123 | if (off < count && user_count <= (count - off)) { | ||
124 | ret = remap_pfn_range(vma, vma->vm_start, | ||
125 | pfn + off, | ||
126 | user_count << PAGE_SHIFT, | ||
127 | vma->vm_page_prot); | ||
128 | } | ||
129 | |||
130 | return ret; | ||
131 | } | ||
132 | |||
108 | /* | 133 | /* |
109 | * streaming DMA Mapping API... | 134 | * streaming DMA Mapping API... |
110 | * CPU accesses page via normal paddr, thus needs to explicitly made | 135 | * 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) | |||
193 | struct dma_map_ops arc_dma_ops = { | 218 | struct dma_map_ops arc_dma_ops = { |
194 | .alloc = arc_dma_alloc, | 219 | .alloc = arc_dma_alloc, |
195 | .free = arc_dma_free, | 220 | .free = arc_dma_free, |
221 | .mmap = arc_dma_mmap, | ||
196 | .map_page = arc_dma_map_page, | 222 | .map_page = arc_dma_map_page, |
197 | .map_sg = arc_dma_map_sg, | 223 | .map_sg = arc_dma_map_sg, |
198 | .sync_single_for_device = arc_dma_sync_single_for_device, | 224 | .sync_single_for_device = arc_dma_sync_single_for_device, |
diff --git a/arch/arc/plat-eznps/smp.c b/arch/arc/plat-eznps/smp.c index 5e901f86e4bd..56a4c8522f11 100644 --- a/arch/arc/plat-eznps/smp.c +++ b/arch/arc/plat-eznps/smp.c | |||
@@ -140,16 +140,10 @@ static void eznps_init_per_cpu(int cpu) | |||
140 | mtm_enable_core(cpu); | 140 | mtm_enable_core(cpu); |
141 | } | 141 | } |
142 | 142 | ||
143 | static void eznps_ipi_clear(int irq) | ||
144 | { | ||
145 | write_aux_reg(CTOP_AUX_IACK, 1 << irq); | ||
146 | } | ||
147 | |||
148 | struct plat_smp_ops plat_smp_ops = { | 143 | struct plat_smp_ops plat_smp_ops = { |
149 | .info = smp_cpuinfo_buf, | 144 | .info = smp_cpuinfo_buf, |
150 | .init_early_smp = eznps_init_cpumasks, | 145 | .init_early_smp = eznps_init_cpumasks, |
151 | .cpu_kick = eznps_smp_wakeup_cpu, | 146 | .cpu_kick = eznps_smp_wakeup_cpu, |
152 | .ipi_send = eznps_ipi_send, | 147 | .ipi_send = eznps_ipi_send, |
153 | .init_per_cpu = eznps_init_per_cpu, | 148 | .init_per_cpu = eznps_init_per_cpu, |
154 | .ipi_clear = eznps_ipi_clear, | ||
155 | }; | 149 | }; |
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h index d7ea6bcb29bf..8ef05381984b 100644 --- a/arch/arm/include/asm/kvm_asm.h +++ b/arch/arm/include/asm/kvm_asm.h | |||
@@ -66,6 +66,7 @@ extern char __kvm_hyp_vector[]; | |||
66 | extern void __kvm_flush_vm_context(void); | 66 | extern void __kvm_flush_vm_context(void); |
67 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); | 67 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); |
68 | extern void __kvm_tlb_flush_vmid(struct kvm *kvm); | 68 | extern void __kvm_tlb_flush_vmid(struct kvm *kvm); |
69 | extern void __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu); | ||
69 | 70 | ||
70 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); | 71 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); |
71 | 72 | ||
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 2d19e02d03fd..d5423ab15ed5 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h | |||
@@ -57,6 +57,9 @@ struct kvm_arch { | |||
57 | /* VTTBR value associated with below pgd and vmid */ | 57 | /* VTTBR value associated with below pgd and vmid */ |
58 | u64 vttbr; | 58 | u64 vttbr; |
59 | 59 | ||
60 | /* The last vcpu id that ran on each physical CPU */ | ||
61 | int __percpu *last_vcpu_ran; | ||
62 | |||
60 | /* Timer */ | 63 | /* Timer */ |
61 | struct arch_timer_kvm timer; | 64 | struct arch_timer_kvm timer; |
62 | 65 | ||
diff --git a/arch/arm/include/asm/kvm_hyp.h b/arch/arm/include/asm/kvm_hyp.h index 343135ede5fa..58508900c4bb 100644 --- a/arch/arm/include/asm/kvm_hyp.h +++ b/arch/arm/include/asm/kvm_hyp.h | |||
@@ -71,6 +71,7 @@ | |||
71 | #define ICIALLUIS __ACCESS_CP15(c7, 0, c1, 0) | 71 | #define ICIALLUIS __ACCESS_CP15(c7, 0, c1, 0) |
72 | #define ATS1CPR __ACCESS_CP15(c7, 0, c8, 0) | 72 | #define ATS1CPR __ACCESS_CP15(c7, 0, c8, 0) |
73 | #define TLBIALLIS __ACCESS_CP15(c8, 0, c3, 0) | 73 | #define TLBIALLIS __ACCESS_CP15(c8, 0, c3, 0) |
74 | #define TLBIALL __ACCESS_CP15(c8, 0, c7, 0) | ||
74 | #define TLBIALLNSNHIS __ACCESS_CP15(c8, 4, c3, 4) | 75 | #define TLBIALLNSNHIS __ACCESS_CP15(c8, 4, c3, 4) |
75 | #define PRRR __ACCESS_CP15(c10, 0, c2, 0) | 76 | #define PRRR __ACCESS_CP15(c10, 0, c2, 0) |
76 | #define NMRR __ACCESS_CP15(c10, 0, c2, 1) | 77 | #define NMRR __ACCESS_CP15(c10, 0, c2, 1) |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 08bb84f2ad58..19b5f5c1c0ff 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -114,11 +114,18 @@ void kvm_arch_check_processor_compat(void *rtn) | |||
114 | */ | 114 | */ |
115 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | 115 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) |
116 | { | 116 | { |
117 | int ret = 0; | 117 | int ret, cpu; |
118 | 118 | ||
119 | if (type) | 119 | if (type) |
120 | return -EINVAL; | 120 | return -EINVAL; |
121 | 121 | ||
122 | kvm->arch.last_vcpu_ran = alloc_percpu(typeof(*kvm->arch.last_vcpu_ran)); | ||
123 | if (!kvm->arch.last_vcpu_ran) | ||
124 | return -ENOMEM; | ||
125 | |||
126 | for_each_possible_cpu(cpu) | ||
127 | *per_cpu_ptr(kvm->arch.last_vcpu_ran, cpu) = -1; | ||
128 | |||
122 | ret = kvm_alloc_stage2_pgd(kvm); | 129 | ret = kvm_alloc_stage2_pgd(kvm); |
123 | if (ret) | 130 | if (ret) |
124 | goto out_fail_alloc; | 131 | goto out_fail_alloc; |
@@ -141,6 +148,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | |||
141 | out_free_stage2_pgd: | 148 | out_free_stage2_pgd: |
142 | kvm_free_stage2_pgd(kvm); | 149 | kvm_free_stage2_pgd(kvm); |
143 | out_fail_alloc: | 150 | out_fail_alloc: |
151 | free_percpu(kvm->arch.last_vcpu_ran); | ||
152 | kvm->arch.last_vcpu_ran = NULL; | ||
144 | return ret; | 153 | return ret; |
145 | } | 154 | } |
146 | 155 | ||
@@ -168,6 +177,9 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
168 | { | 177 | { |
169 | int i; | 178 | int i; |
170 | 179 | ||
180 | free_percpu(kvm->arch.last_vcpu_ran); | ||
181 | kvm->arch.last_vcpu_ran = NULL; | ||
182 | |||
171 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 183 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
172 | if (kvm->vcpus[i]) { | 184 | if (kvm->vcpus[i]) { |
173 | kvm_arch_vcpu_free(kvm->vcpus[i]); | 185 | kvm_arch_vcpu_free(kvm->vcpus[i]); |
@@ -312,6 +324,19 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
312 | 324 | ||
313 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | 325 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
314 | { | 326 | { |
327 | int *last_ran; | ||
328 | |||
329 | last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran); | ||
330 | |||
331 | /* | ||
332 | * We might get preempted before the vCPU actually runs, but | ||
333 | * over-invalidation doesn't affect correctness. | ||
334 | */ | ||
335 | if (*last_ran != vcpu->vcpu_id) { | ||
336 | kvm_call_hyp(__kvm_tlb_flush_local_vmid, vcpu); | ||
337 | *last_ran = vcpu->vcpu_id; | ||
338 | } | ||
339 | |||
315 | vcpu->cpu = cpu; | 340 | vcpu->cpu = cpu; |
316 | vcpu->arch.host_cpu_context = this_cpu_ptr(kvm_host_cpu_state); | 341 | vcpu->arch.host_cpu_context = this_cpu_ptr(kvm_host_cpu_state); |
317 | 342 | ||
diff --git a/arch/arm/kvm/hyp/tlb.c b/arch/arm/kvm/hyp/tlb.c index 729652854f90..6d810af2d9fd 100644 --- a/arch/arm/kvm/hyp/tlb.c +++ b/arch/arm/kvm/hyp/tlb.c | |||
@@ -55,6 +55,21 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) | |||
55 | __kvm_tlb_flush_vmid(kvm); | 55 | __kvm_tlb_flush_vmid(kvm); |
56 | } | 56 | } |
57 | 57 | ||
58 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) | ||
59 | { | ||
60 | struct kvm *kvm = kern_hyp_va(kern_hyp_va(vcpu)->kvm); | ||
61 | |||
62 | /* Switch to requested VMID */ | ||
63 | write_sysreg(kvm->arch.vttbr, VTTBR); | ||
64 | isb(); | ||
65 | |||
66 | write_sysreg(0, TLBIALL); | ||
67 | dsb(nsh); | ||
68 | isb(); | ||
69 | |||
70 | write_sysreg(0, VTTBR); | ||
71 | } | ||
72 | |||
58 | void __hyp_text __kvm_flush_vm_context(void) | 73 | void __hyp_text __kvm_flush_vm_context(void) |
59 | { | 74 | { |
60 | write_sysreg(0, TLBIALLNSNHIS); | 75 | write_sysreg(0, TLBIALLNSNHIS); |
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index b65c193dc64e..7afbfb0f96a3 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi | |||
@@ -300,8 +300,11 @@ | |||
300 | ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x600000 | 300 | ranges = <0x83000000 0x0 0xfa000000 0x0 0xfa000000 0x0 0x600000 |
301 | 0x81000000 0x0 0xfa600000 0x0 0xfa600000 0x0 0x100000>; | 301 | 0x81000000 0x0 0xfa600000 0x0 0xfa600000 0x0 0x100000>; |
302 | resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, | 302 | resets = <&cru SRST_PCIE_CORE>, <&cru SRST_PCIE_MGMT>, |
303 | <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>; | 303 | <&cru SRST_PCIE_MGMT_STICKY>, <&cru SRST_PCIE_PIPE>, |
304 | reset-names = "core", "mgmt", "mgmt-sticky", "pipe"; | 304 | <&cru SRST_PCIE_PM>, <&cru SRST_P_PCIE>, |
305 | <&cru SRST_A_PCIE>; | ||
306 | reset-names = "core", "mgmt", "mgmt-sticky", "pipe", | ||
307 | "pm", "pclk", "aclk"; | ||
305 | status = "disabled"; | 308 | status = "disabled"; |
306 | 309 | ||
307 | pcie0_intc: interrupt-controller { | 310 | pcie0_intc: interrupt-controller { |
diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h index 39feb85a6931..6e1cb8c5af4d 100644 --- a/arch/arm64/include/asm/alternative.h +++ b/arch/arm64/include/asm/alternative.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __ASM_ALTERNATIVE_H | 1 | #ifndef __ASM_ALTERNATIVE_H |
2 | #define __ASM_ALTERNATIVE_H | 2 | #define __ASM_ALTERNATIVE_H |
3 | 3 | ||
4 | #include <asm/cpufeature.h> | 4 | #include <asm/cpucaps.h> |
5 | #include <asm/insn.h> | 5 | #include <asm/insn.h> |
6 | 6 | ||
7 | #ifndef __ASSEMBLY__ | 7 | #ifndef __ASSEMBLY__ |
diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h new file mode 100644 index 000000000000..87b446535185 --- /dev/null +++ b/arch/arm64/include/asm/cpucaps.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * arch/arm64/include/asm/cpucaps.h | ||
3 | * | ||
4 | * Copyright (C) 2016 ARM Ltd. | ||
5 | * | ||
6 | * This program is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | #ifndef __ASM_CPUCAPS_H | ||
19 | #define __ASM_CPUCAPS_H | ||
20 | |||
21 | #define ARM64_WORKAROUND_CLEAN_CACHE 0 | ||
22 | #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1 | ||
23 | #define ARM64_WORKAROUND_845719 2 | ||
24 | #define ARM64_HAS_SYSREG_GIC_CPUIF 3 | ||
25 | #define ARM64_HAS_PAN 4 | ||
26 | #define ARM64_HAS_LSE_ATOMICS 5 | ||
27 | #define ARM64_WORKAROUND_CAVIUM_23154 6 | ||
28 | #define ARM64_WORKAROUND_834220 7 | ||
29 | #define ARM64_HAS_NO_HW_PREFETCH 8 | ||
30 | #define ARM64_HAS_UAO 9 | ||
31 | #define ARM64_ALT_PAN_NOT_UAO 10 | ||
32 | #define ARM64_HAS_VIRT_HOST_EXTN 11 | ||
33 | #define ARM64_WORKAROUND_CAVIUM_27456 12 | ||
34 | #define ARM64_HAS_32BIT_EL0 13 | ||
35 | #define ARM64_HYP_OFFSET_LOW 14 | ||
36 | #define ARM64_MISMATCHED_CACHE_LINE_SIZE 15 | ||
37 | |||
38 | #define ARM64_NCAPS 16 | ||
39 | |||
40 | #endif /* __ASM_CPUCAPS_H */ | ||
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index a27c3245ba21..0bc0b1de90c4 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/jump_label.h> | 12 | #include <linux/jump_label.h> |
13 | 13 | ||
14 | #include <asm/cpucaps.h> | ||
14 | #include <asm/hwcap.h> | 15 | #include <asm/hwcap.h> |
15 | #include <asm/sysreg.h> | 16 | #include <asm/sysreg.h> |
16 | 17 | ||
@@ -24,25 +25,6 @@ | |||
24 | #define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap)) | 25 | #define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap)) |
25 | #define cpu_feature(x) ilog2(HWCAP_ ## x) | 26 | #define cpu_feature(x) ilog2(HWCAP_ ## x) |
26 | 27 | ||
27 | #define ARM64_WORKAROUND_CLEAN_CACHE 0 | ||
28 | #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1 | ||
29 | #define ARM64_WORKAROUND_845719 2 | ||
30 | #define ARM64_HAS_SYSREG_GIC_CPUIF 3 | ||
31 | #define ARM64_HAS_PAN 4 | ||
32 | #define ARM64_HAS_LSE_ATOMICS 5 | ||
33 | #define ARM64_WORKAROUND_CAVIUM_23154 6 | ||
34 | #define ARM64_WORKAROUND_834220 7 | ||
35 | #define ARM64_HAS_NO_HW_PREFETCH 8 | ||
36 | #define ARM64_HAS_UAO 9 | ||
37 | #define ARM64_ALT_PAN_NOT_UAO 10 | ||
38 | #define ARM64_HAS_VIRT_HOST_EXTN 11 | ||
39 | #define ARM64_WORKAROUND_CAVIUM_27456 12 | ||
40 | #define ARM64_HAS_32BIT_EL0 13 | ||
41 | #define ARM64_HYP_OFFSET_LOW 14 | ||
42 | #define ARM64_MISMATCHED_CACHE_LINE_SIZE 15 | ||
43 | |||
44 | #define ARM64_NCAPS 16 | ||
45 | |||
46 | #ifndef __ASSEMBLY__ | 28 | #ifndef __ASSEMBLY__ |
47 | 29 | ||
48 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h index 18f746551bf6..ec3553eb9349 100644 --- a/arch/arm64/include/asm/kvm_asm.h +++ b/arch/arm64/include/asm/kvm_asm.h | |||
@@ -54,6 +54,7 @@ extern char __kvm_hyp_vector[]; | |||
54 | extern void __kvm_flush_vm_context(void); | 54 | extern void __kvm_flush_vm_context(void); |
55 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); | 55 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); |
56 | extern void __kvm_tlb_flush_vmid(struct kvm *kvm); | 56 | extern void __kvm_tlb_flush_vmid(struct kvm *kvm); |
57 | extern void __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu); | ||
57 | 58 | ||
58 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); | 59 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); |
59 | 60 | ||
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index bd94e6766759..e5050388e062 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
@@ -62,6 +62,9 @@ struct kvm_arch { | |||
62 | /* VTTBR value associated with above pgd and vmid */ | 62 | /* VTTBR value associated with above pgd and vmid */ |
63 | u64 vttbr; | 63 | u64 vttbr; |
64 | 64 | ||
65 | /* The last vcpu id that ran on each physical CPU */ | ||
66 | int __percpu *last_vcpu_ran; | ||
67 | |||
65 | /* The maximum number of vCPUs depends on the used GIC model */ | 68 | /* The maximum number of vCPUs depends on the used GIC model */ |
66 | int max_vcpus; | 69 | int max_vcpus; |
67 | 70 | ||
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index a79b969c26fc..6f72fe8b0e3e 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h | |||
@@ -128,7 +128,7 @@ static inline unsigned long __kern_hyp_va(unsigned long v) | |||
128 | return v; | 128 | return v; |
129 | } | 129 | } |
130 | 130 | ||
131 | #define kern_hyp_va(v) (typeof(v))(__kern_hyp_va((unsigned long)(v))) | 131 | #define kern_hyp_va(v) ((typeof(v))(__kern_hyp_va((unsigned long)(v)))) |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * We currently only support a 40bit IPA. | 134 | * We currently only support a 40bit IPA. |
diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h index 23acc00be32d..fc756e22c84c 100644 --- a/arch/arm64/include/asm/lse.h +++ b/arch/arm64/include/asm/lse.h | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | #include <linux/stringify.h> | 6 | #include <linux/stringify.h> |
7 | #include <asm/alternative.h> | 7 | #include <asm/alternative.h> |
8 | #include <asm/cpufeature.h> | ||
9 | 8 | ||
10 | #ifdef __ASSEMBLER__ | 9 | #ifdef __ASSEMBLER__ |
11 | 10 | ||
diff --git a/arch/arm64/kvm/hyp/tlb.c b/arch/arm64/kvm/hyp/tlb.c index 9cc0ea784ae6..88e2f2b938f0 100644 --- a/arch/arm64/kvm/hyp/tlb.c +++ b/arch/arm64/kvm/hyp/tlb.c | |||
@@ -64,6 +64,21 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) | |||
64 | write_sysreg(0, vttbr_el2); | 64 | write_sysreg(0, vttbr_el2); |
65 | } | 65 | } |
66 | 66 | ||
67 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) | ||
68 | { | ||
69 | struct kvm *kvm = kern_hyp_va(kern_hyp_va(vcpu)->kvm); | ||
70 | |||
71 | /* Switch to requested VMID */ | ||
72 | write_sysreg(kvm->arch.vttbr, vttbr_el2); | ||
73 | isb(); | ||
74 | |||
75 | asm volatile("tlbi vmalle1" : : ); | ||
76 | dsb(nsh); | ||
77 | isb(); | ||
78 | |||
79 | write_sysreg(0, vttbr_el2); | ||
80 | } | ||
81 | |||
67 | void __hyp_text __kvm_flush_vm_context(void) | 82 | void __hyp_text __kvm_flush_vm_context(void) |
68 | { | 83 | { |
69 | dsb(ishst); | 84 | dsb(ishst); |
diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c index d9563ddb337e..746bf5caaffc 100644 --- a/arch/nios2/kernel/time.c +++ b/arch/nios2/kernel/time.c | |||
@@ -324,6 +324,7 @@ static int __init nios2_time_init(struct device_node *timer) | |||
324 | ret = nios2_clocksource_init(timer); | 324 | ret = nios2_clocksource_init(timer); |
325 | break; | 325 | break; |
326 | default: | 326 | default: |
327 | ret = 0; | ||
327 | break; | 328 | break; |
328 | } | 329 | } |
329 | 330 | ||
diff --git a/arch/openrisc/include/asm/cache.h b/arch/openrisc/include/asm/cache.h index 4ce7a01a252d..5f55da9cbfd5 100644 --- a/arch/openrisc/include/asm/cache.h +++ b/arch/openrisc/include/asm/cache.h | |||
@@ -23,6 +23,8 @@ | |||
23 | * they shouldn't be hard-coded! | 23 | * they shouldn't be hard-coded! |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #define __ro_after_init __read_mostly | ||
27 | |||
26 | #define L1_CACHE_BYTES 16 | 28 | #define L1_CACHE_BYTES 16 |
27 | #define L1_CACHE_SHIFT 4 | 29 | #define L1_CACHE_SHIFT 4 |
28 | 30 | ||
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c index 28f03ca60100..794bebb43d23 100644 --- a/arch/s390/hypfs/hypfs_diag.c +++ b/arch/s390/hypfs/hypfs_diag.c | |||
@@ -363,11 +363,11 @@ out: | |||
363 | static int diag224_get_name_table(void) | 363 | static int diag224_get_name_table(void) |
364 | { | 364 | { |
365 | /* memory must be below 2GB */ | 365 | /* memory must be below 2GB */ |
366 | diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); | 366 | diag224_cpu_names = (char *) __get_free_page(GFP_KERNEL | GFP_DMA); |
367 | if (!diag224_cpu_names) | 367 | if (!diag224_cpu_names) |
368 | return -ENOMEM; | 368 | return -ENOMEM; |
369 | if (diag224(diag224_cpu_names)) { | 369 | if (diag224(diag224_cpu_names)) { |
370 | kfree(diag224_cpu_names); | 370 | free_page((unsigned long) diag224_cpu_names); |
371 | return -EOPNOTSUPP; | 371 | return -EOPNOTSUPP; |
372 | } | 372 | } |
373 | EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); | 373 | EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); |
@@ -376,7 +376,7 @@ static int diag224_get_name_table(void) | |||
376 | 376 | ||
377 | static void diag224_delete_name_table(void) | 377 | static void diag224_delete_name_table(void) |
378 | { | 378 | { |
379 | kfree(diag224_cpu_names); | 379 | free_page((unsigned long) diag224_cpu_names); |
380 | } | 380 | } |
381 | 381 | ||
382 | static int diag224_idx2name(int index, char *name) | 382 | static int diag224_idx2name(int index, char *name) |
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 000e6e91f6a0..3667d20e997f 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -62,9 +62,11 @@ SECTIONS | |||
62 | 62 | ||
63 | . = ALIGN(PAGE_SIZE); | 63 | . = ALIGN(PAGE_SIZE); |
64 | __start_ro_after_init = .; | 64 | __start_ro_after_init = .; |
65 | __start_data_ro_after_init = .; | ||
65 | .data..ro_after_init : { | 66 | .data..ro_after_init : { |
66 | *(.data..ro_after_init) | 67 | *(.data..ro_after_init) |
67 | } | 68 | } |
69 | __end_data_ro_after_init = .; | ||
68 | EXCEPTION_TABLE(16) | 70 | EXCEPTION_TABLE(16) |
69 | . = ALIGN(PAGE_SIZE); | 71 | . = ALIGN(PAGE_SIZE); |
70 | __end_ro_after_init = .; | 72 | __end_ro_after_init = .; |
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index 7350c8bc13a2..6b2f72f523b9 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
@@ -423,7 +423,7 @@ static int __s390_dma_map_sg(struct device *dev, struct scatterlist *sg, | |||
423 | dma_addr_t dma_addr_base, dma_addr; | 423 | dma_addr_t dma_addr_base, dma_addr; |
424 | int flags = ZPCI_PTE_VALID; | 424 | int flags = ZPCI_PTE_VALID; |
425 | struct scatterlist *s; | 425 | struct scatterlist *s; |
426 | unsigned long pa; | 426 | unsigned long pa = 0; |
427 | int ret; | 427 | int ret; |
428 | 428 | ||
429 | size = PAGE_ALIGN(size); | 429 | size = PAGE_ALIGN(size); |
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index 0ab5ee1c26af..aa8b0672f87a 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
@@ -888,7 +888,7 @@ static int helper_rfc4106_encrypt(struct aead_request *req) | |||
888 | unsigned long auth_tag_len = crypto_aead_authsize(tfm); | 888 | unsigned long auth_tag_len = crypto_aead_authsize(tfm); |
889 | u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); | 889 | u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); |
890 | struct scatter_walk src_sg_walk; | 890 | struct scatter_walk src_sg_walk; |
891 | struct scatter_walk dst_sg_walk; | 891 | struct scatter_walk dst_sg_walk = {}; |
892 | unsigned int i; | 892 | unsigned int i; |
893 | 893 | ||
894 | /* Assuming we are supporting rfc4106 64-bit extended */ | 894 | /* Assuming we are supporting rfc4106 64-bit extended */ |
@@ -968,7 +968,7 @@ static int helper_rfc4106_decrypt(struct aead_request *req) | |||
968 | u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); | 968 | u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); |
969 | u8 authTag[16]; | 969 | u8 authTag[16]; |
970 | struct scatter_walk src_sg_walk; | 970 | struct scatter_walk src_sg_walk; |
971 | struct scatter_walk dst_sg_walk; | 971 | struct scatter_walk dst_sg_walk = {}; |
972 | unsigned int i; | 972 | unsigned int i; |
973 | 973 | ||
974 | if (unlikely(req->assoclen != 16 && req->assoclen != 20)) | 974 | if (unlikely(req->assoclen != 16 && req->assoclen != 20)) |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index c7364bd633e1..51287cd90bf6 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -1042,8 +1042,11 @@ static int apm_get_power_status(u_short *status, u_short *bat, u_short *life) | |||
1042 | 1042 | ||
1043 | if (apm_info.get_power_status_broken) | 1043 | if (apm_info.get_power_status_broken) |
1044 | return APM_32_UNSUPPORTED; | 1044 | return APM_32_UNSUPPORTED; |
1045 | if (apm_bios_call(&call)) | 1045 | if (apm_bios_call(&call)) { |
1046 | if (!call.err) | ||
1047 | return APM_NO_ERROR; | ||
1046 | return call.err; | 1048 | return call.err; |
1049 | } | ||
1047 | *status = call.ebx; | 1050 | *status = call.ebx; |
1048 | *bat = call.ecx; | 1051 | *bat = call.ecx; |
1049 | if (apm_info.get_power_status_swabinminutes) { | 1052 | if (apm_info.get_power_status_swabinminutes) { |
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index d58fbf7f04e6..7dd70927991e 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c | |||
@@ -122,7 +122,7 @@ static int acpi_apd_create_device(struct acpi_device *adev, | |||
122 | int ret; | 122 | int ret; |
123 | 123 | ||
124 | if (!dev_desc) { | 124 | if (!dev_desc) { |
125 | pdev = acpi_create_platform_device(adev); | 125 | pdev = acpi_create_platform_device(adev, NULL); |
126 | return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1; | 126 | return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1; |
127 | } | 127 | } |
128 | 128 | ||
@@ -139,14 +139,8 @@ static int acpi_apd_create_device(struct acpi_device *adev, | |||
139 | goto err_out; | 139 | goto err_out; |
140 | } | 140 | } |
141 | 141 | ||
142 | if (dev_desc->properties) { | ||
143 | ret = device_add_properties(&adev->dev, dev_desc->properties); | ||
144 | if (ret) | ||
145 | goto err_out; | ||
146 | } | ||
147 | |||
148 | adev->driver_data = pdata; | 142 | adev->driver_data = pdata; |
149 | pdev = acpi_create_platform_device(adev); | 143 | pdev = acpi_create_platform_device(adev, dev_desc->properties); |
150 | if (!IS_ERR_OR_NULL(pdev)) | 144 | if (!IS_ERR_OR_NULL(pdev)) |
151 | return 1; | 145 | return 1; |
152 | 146 | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 552010288135..373657f7e35a 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -395,7 +395,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
395 | 395 | ||
396 | dev_desc = (const struct lpss_device_desc *)id->driver_data; | 396 | dev_desc = (const struct lpss_device_desc *)id->driver_data; |
397 | if (!dev_desc) { | 397 | if (!dev_desc) { |
398 | pdev = acpi_create_platform_device(adev); | 398 | pdev = acpi_create_platform_device(adev, NULL); |
399 | return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1; | 399 | return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1; |
400 | } | 400 | } |
401 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | 401 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); |
@@ -451,14 +451,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
451 | goto err_out; | 451 | goto err_out; |
452 | } | 452 | } |
453 | 453 | ||
454 | if (dev_desc->properties) { | ||
455 | ret = device_add_properties(&adev->dev, dev_desc->properties); | ||
456 | if (ret) | ||
457 | goto err_out; | ||
458 | } | ||
459 | |||
460 | adev->driver_data = pdata; | 454 | adev->driver_data = pdata; |
461 | pdev = acpi_create_platform_device(adev); | 455 | pdev = acpi_create_platform_device(adev, dev_desc->properties); |
462 | if (!IS_ERR_OR_NULL(pdev)) { | 456 | if (!IS_ERR_OR_NULL(pdev)) { |
463 | return 1; | 457 | return 1; |
464 | } | 458 | } |
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index b200ae1f3c6f..b4c1a6a51da4 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c | |||
@@ -50,6 +50,7 @@ static void acpi_platform_fill_resource(struct acpi_device *adev, | |||
50 | /** | 50 | /** |
51 | * acpi_create_platform_device - Create platform device for ACPI device node | 51 | * acpi_create_platform_device - Create platform device for ACPI device node |
52 | * @adev: ACPI device node to create a platform device for. | 52 | * @adev: ACPI device node to create a platform device for. |
53 | * @properties: Optional collection of build-in properties. | ||
53 | * | 54 | * |
54 | * Check if the given @adev can be represented as a platform device and, if | 55 | * Check if the given @adev can be represented as a platform device and, if |
55 | * that's the case, create and register a platform device, populate its common | 56 | * 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, | |||
57 | * | 58 | * |
58 | * Name of the platform device will be the same as @adev's. | 59 | * Name of the platform device will be the same as @adev's. |
59 | */ | 60 | */ |
60 | struct platform_device *acpi_create_platform_device(struct acpi_device *adev) | 61 | struct platform_device *acpi_create_platform_device(struct acpi_device *adev, |
62 | struct property_entry *properties) | ||
61 | { | 63 | { |
62 | struct platform_device *pdev = NULL; | 64 | struct platform_device *pdev = NULL; |
63 | struct platform_device_info pdevinfo; | 65 | struct platform_device_info pdevinfo; |
@@ -106,6 +108,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev) | |||
106 | pdevinfo.res = resources; | 108 | pdevinfo.res = resources; |
107 | pdevinfo.num_res = count; | 109 | pdevinfo.num_res = count; |
108 | pdevinfo.fwnode = acpi_fwnode_handle(adev); | 110 | pdevinfo.fwnode = acpi_fwnode_handle(adev); |
111 | pdevinfo.properties = properties; | ||
109 | 112 | ||
110 | if (acpi_dma_supported(adev)) | 113 | if (acpi_dma_supported(adev)) |
111 | pdevinfo.dma_mask = DMA_BIT_MASK(32); | 114 | pdevinfo.dma_mask = DMA_BIT_MASK(32); |
diff --git a/drivers/acpi/dptf/int340x_thermal.c b/drivers/acpi/dptf/int340x_thermal.c index 33505c651f62..86364097e236 100644 --- a/drivers/acpi/dptf/int340x_thermal.c +++ b/drivers/acpi/dptf/int340x_thermal.c | |||
@@ -34,11 +34,11 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev, | |||
34 | const struct acpi_device_id *id) | 34 | const struct acpi_device_id *id) |
35 | { | 35 | { |
36 | if (IS_ENABLED(CONFIG_INT340X_THERMAL)) | 36 | if (IS_ENABLED(CONFIG_INT340X_THERMAL)) |
37 | acpi_create_platform_device(adev); | 37 | acpi_create_platform_device(adev, NULL); |
38 | /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ | 38 | /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ |
39 | else if (IS_ENABLED(CONFIG_INTEL_SOC_DTS_THERMAL) && | 39 | else if (IS_ENABLED(CONFIG_INTEL_SOC_DTS_THERMAL) && |
40 | id->driver_data == INT3401_DEVICE) | 40 | id->driver_data == INT3401_DEVICE) |
41 | acpi_create_platform_device(adev); | 41 | acpi_create_platform_device(adev, NULL); |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 035ac646d8db..3d1856f1f4d0 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1734,7 +1734,7 @@ static void acpi_default_enumeration(struct acpi_device *device) | |||
1734 | &is_spi_i2c_slave); | 1734 | &is_spi_i2c_slave); |
1735 | acpi_dev_free_resource_list(&resource_list); | 1735 | acpi_dev_free_resource_list(&resource_list); |
1736 | if (!is_spi_i2c_slave) { | 1736 | if (!is_spi_i2c_slave) { |
1737 | acpi_create_platform_device(device); | 1737 | acpi_create_platform_device(device, NULL); |
1738 | acpi_device_set_enumerated(device); | 1738 | acpi_device_set_enumerated(device); |
1739 | } else { | 1739 | } else { |
1740 | blocking_notifier_call_chain(&acpi_reconfig_chain, | 1740 | blocking_notifier_call_chain(&acpi_reconfig_chain, |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index d22a7260f42b..d76cd97a98b6 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -324,7 +324,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) | |||
324 | { | 324 | { |
325 | int ret = -EPROBE_DEFER; | 325 | int ret = -EPROBE_DEFER; |
326 | int local_trigger_count = atomic_read(&deferred_trigger_count); | 326 | int local_trigger_count = atomic_read(&deferred_trigger_count); |
327 | bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE); | 327 | bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) && |
328 | !drv->suppress_bind_attrs; | ||
328 | 329 | ||
329 | if (defer_all_probes) { | 330 | if (defer_all_probes) { |
330 | /* | 331 | /* |
@@ -383,7 +384,7 @@ re_probe: | |||
383 | if (test_remove) { | 384 | if (test_remove) { |
384 | test_remove = false; | 385 | test_remove = false; |
385 | 386 | ||
386 | if (dev->bus && dev->bus->remove) | 387 | if (dev->bus->remove) |
387 | dev->bus->remove(dev); | 388 | dev->bus->remove(dev); |
388 | else if (drv->remove) | 389 | else if (drv->remove) |
389 | drv->remove(dev); | 390 | drv->remove(dev); |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index e44944f4be77..2932a5bd892f 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -1027,6 +1027,8 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a | |||
1027 | TRACE_DEVICE(dev); | 1027 | TRACE_DEVICE(dev); |
1028 | TRACE_SUSPEND(0); | 1028 | TRACE_SUSPEND(0); |
1029 | 1029 | ||
1030 | dpm_wait_for_children(dev, async); | ||
1031 | |||
1030 | if (async_error) | 1032 | if (async_error) |
1031 | goto Complete; | 1033 | goto Complete; |
1032 | 1034 | ||
@@ -1038,8 +1040,6 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a | |||
1038 | if (dev->power.syscore || dev->power.direct_complete) | 1040 | if (dev->power.syscore || dev->power.direct_complete) |
1039 | goto Complete; | 1041 | goto Complete; |
1040 | 1042 | ||
1041 | dpm_wait_for_children(dev, async); | ||
1042 | |||
1043 | if (dev->pm_domain) { | 1043 | if (dev->pm_domain) { |
1044 | info = "noirq power domain "; | 1044 | info = "noirq power domain "; |
1045 | callback = pm_noirq_op(&dev->pm_domain->ops, state); | 1045 | 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 | |||
1174 | 1174 | ||
1175 | __pm_runtime_disable(dev, false); | 1175 | __pm_runtime_disable(dev, false); |
1176 | 1176 | ||
1177 | dpm_wait_for_children(dev, async); | ||
1178 | |||
1177 | if (async_error) | 1179 | if (async_error) |
1178 | goto Complete; | 1180 | goto Complete; |
1179 | 1181 | ||
@@ -1185,8 +1187,6 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as | |||
1185 | if (dev->power.syscore || dev->power.direct_complete) | 1187 | if (dev->power.syscore || dev->power.direct_complete) |
1186 | goto Complete; | 1188 | goto Complete; |
1187 | 1189 | ||
1188 | dpm_wait_for_children(dev, async); | ||
1189 | |||
1190 | if (dev->pm_domain) { | 1190 | if (dev->pm_domain) { |
1191 | info = "late power domain "; | 1191 | info = "late power domain "; |
1192 | callback = pm_late_early_op(&dev->pm_domain->ops, state); | 1192 | callback = pm_late_early_op(&dev->pm_domain->ops, state); |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index ab19adb07a12..3c606c09fd5a 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -853,45 +853,6 @@ rqbiocnt(struct request *r) | |||
853 | return n; | 853 | return n; |
854 | } | 854 | } |
855 | 855 | ||
856 | /* This can be removed if we are certain that no users of the block | ||
857 | * layer will ever use zero-count pages in bios. Otherwise we have to | ||
858 | * protect against the put_page sometimes done by the network layer. | ||
859 | * | ||
860 | * See http://oss.sgi.com/archives/xfs/2007-01/msg00594.html for | ||
861 | * discussion. | ||
862 | * | ||
863 | * We cannot use get_page in the workaround, because it insists on a | ||
864 | * positive page count as a precondition. So we use _refcount directly. | ||
865 | */ | ||
866 | static void | ||
867 | bio_pageinc(struct bio *bio) | ||
868 | { | ||
869 | struct bio_vec bv; | ||
870 | struct page *page; | ||
871 | struct bvec_iter iter; | ||
872 | |||
873 | bio_for_each_segment(bv, bio, iter) { | ||
874 | /* Non-zero page count for non-head members of | ||
875 | * compound pages is no longer allowed by the kernel. | ||
876 | */ | ||
877 | page = compound_head(bv.bv_page); | ||
878 | page_ref_inc(page); | ||
879 | } | ||
880 | } | ||
881 | |||
882 | static void | ||
883 | bio_pagedec(struct bio *bio) | ||
884 | { | ||
885 | struct page *page; | ||
886 | struct bio_vec bv; | ||
887 | struct bvec_iter iter; | ||
888 | |||
889 | bio_for_each_segment(bv, bio, iter) { | ||
890 | page = compound_head(bv.bv_page); | ||
891 | page_ref_dec(page); | ||
892 | } | ||
893 | } | ||
894 | |||
895 | static void | 856 | static void |
896 | bufinit(struct buf *buf, struct request *rq, struct bio *bio) | 857 | bufinit(struct buf *buf, struct request *rq, struct bio *bio) |
897 | { | 858 | { |
@@ -899,7 +860,6 @@ bufinit(struct buf *buf, struct request *rq, struct bio *bio) | |||
899 | buf->rq = rq; | 860 | buf->rq = rq; |
900 | buf->bio = bio; | 861 | buf->bio = bio; |
901 | buf->iter = bio->bi_iter; | 862 | buf->iter = bio->bi_iter; |
902 | bio_pageinc(bio); | ||
903 | } | 863 | } |
904 | 864 | ||
905 | static struct buf * | 865 | static struct buf * |
@@ -1127,7 +1087,6 @@ aoe_end_buf(struct aoedev *d, struct buf *buf) | |||
1127 | if (buf == d->ip.buf) | 1087 | if (buf == d->ip.buf) |
1128 | d->ip.buf = NULL; | 1088 | d->ip.buf = NULL; |
1129 | rq = buf->rq; | 1089 | rq = buf->rq; |
1130 | bio_pagedec(buf->bio); | ||
1131 | mempool_free(buf, d->bufpool); | 1090 | mempool_free(buf, d->bufpool); |
1132 | n = (unsigned long) rq->special; | 1091 | n = (unsigned long) rq->special; |
1133 | rq->special = (void *) --n; | 1092 | rq->special = (void *) --n; |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 100be556e613..83482721bc01 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1871,7 +1871,7 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock, | |||
1871 | drbd_update_congested(connection); | 1871 | drbd_update_congested(connection); |
1872 | } | 1872 | } |
1873 | do { | 1873 | do { |
1874 | rv = kernel_sendmsg(sock, &msg, &iov, 1, size); | 1874 | rv = kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len); |
1875 | if (rv == -EAGAIN) { | 1875 | if (rv == -EAGAIN) { |
1876 | if (we_should_drop_the_connection(connection, sock)) | 1876 | if (we_should_drop_the_connection(connection, sock)) |
1877 | break; | 1877 | break; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 19a16b2dbb91..7a1048755914 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, | |||
599 | return -EINVAL; | 599 | return -EINVAL; |
600 | 600 | ||
601 | sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0); | 601 | sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0); |
602 | if (!sreq) | 602 | if (IS_ERR(sreq)) |
603 | return -ENOMEM; | 603 | return -ENOMEM; |
604 | 604 | ||
605 | mutex_unlock(&nbd->tx_lock); | 605 | mutex_unlock(&nbd->tx_lock); |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index d23368874710..6af1ce04b3da 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -748,10 +748,7 @@ static int pp_release(struct inode *inode, struct file *file) | |||
748 | } | 748 | } |
749 | 749 | ||
750 | if (pp->pdev) { | 750 | if (pp->pdev) { |
751 | const char *name = pp->pdev->name; | ||
752 | |||
753 | parport_unregister_device(pp->pdev); | 751 | parport_unregister_device(pp->pdev); |
754 | kfree(name); | ||
755 | pp->pdev = NULL; | 752 | pp->pdev = NULL; |
756 | pr_debug(CHRDEV "%x: unregistered pardevice\n", minor); | 753 | pr_debug(CHRDEV "%x: unregistered pardevice\n", minor); |
757 | } | 754 | } |
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 20b105584f82..80ae2a51452d 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c | |||
@@ -700,6 +700,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg, | |||
700 | struct mux_hwclock *hwc, | 700 | struct mux_hwclock *hwc, |
701 | const struct clk_ops *ops, | 701 | const struct clk_ops *ops, |
702 | unsigned long min_rate, | 702 | unsigned long min_rate, |
703 | unsigned long max_rate, | ||
703 | unsigned long pct80_rate, | 704 | unsigned long pct80_rate, |
704 | const char *fmt, int idx) | 705 | const char *fmt, int idx) |
705 | { | 706 | { |
@@ -728,6 +729,8 @@ static struct clk * __init create_mux_common(struct clockgen *cg, | |||
728 | continue; | 729 | continue; |
729 | if (rate < min_rate) | 730 | if (rate < min_rate) |
730 | continue; | 731 | continue; |
732 | if (rate > max_rate) | ||
733 | continue; | ||
731 | 734 | ||
732 | parent_names[j] = div->name; | 735 | parent_names[j] = div->name; |
733 | hwc->parent_to_clksel[j] = i; | 736 | hwc->parent_to_clksel[j] = i; |
@@ -759,7 +762,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) | |||
759 | struct mux_hwclock *hwc; | 762 | struct mux_hwclock *hwc; |
760 | const struct clockgen_pll_div *div; | 763 | const struct clockgen_pll_div *div; |
761 | unsigned long plat_rate, min_rate; | 764 | unsigned long plat_rate, min_rate; |
762 | u64 pct80_rate; | 765 | u64 max_rate, pct80_rate; |
763 | u32 clksel; | 766 | u32 clksel; |
764 | 767 | ||
765 | hwc = kzalloc(sizeof(*hwc), GFP_KERNEL); | 768 | hwc = kzalloc(sizeof(*hwc), GFP_KERNEL); |
@@ -787,8 +790,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) | |||
787 | return NULL; | 790 | return NULL; |
788 | } | 791 | } |
789 | 792 | ||
790 | pct80_rate = clk_get_rate(div->clk); | 793 | max_rate = clk_get_rate(div->clk); |
791 | pct80_rate *= 8; | 794 | pct80_rate = max_rate * 8; |
792 | do_div(pct80_rate, 10); | 795 | do_div(pct80_rate, 10); |
793 | 796 | ||
794 | plat_rate = clk_get_rate(cg->pll[PLATFORM_PLL].div[PLL_DIV1].clk); | 797 | 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) | |||
798 | else | 801 | else |
799 | min_rate = plat_rate / 2; | 802 | min_rate = plat_rate / 2; |
800 | 803 | ||
801 | return create_mux_common(cg, hwc, &cmux_ops, min_rate, | 804 | return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate, |
802 | pct80_rate, "cg-cmux%d", idx); | 805 | pct80_rate, "cg-cmux%d", idx); |
803 | } | 806 | } |
804 | 807 | ||
@@ -813,7 +816,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx) | |||
813 | hwc->reg = cg->regs + 0x20 * idx + 0x10; | 816 | hwc->reg = cg->regs + 0x20 * idx + 0x10; |
814 | hwc->info = cg->info.hwaccel[idx]; | 817 | hwc->info = cg->info.hwaccel[idx]; |
815 | 818 | ||
816 | return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0, | 819 | return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0, |
817 | "cg-hwaccel%d", idx); | 820 | "cg-hwaccel%d", idx); |
818 | } | 821 | } |
819 | 822 | ||
diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c index 5daddf5ecc4b..bc37030e38ba 100644 --- a/drivers/clk/clk-xgene.c +++ b/drivers/clk/clk-xgene.c | |||
@@ -463,22 +463,20 @@ static int xgene_clk_enable(struct clk_hw *hw) | |||
463 | struct xgene_clk *pclk = to_xgene_clk(hw); | 463 | struct xgene_clk *pclk = to_xgene_clk(hw); |
464 | unsigned long flags = 0; | 464 | unsigned long flags = 0; |
465 | u32 data; | 465 | u32 data; |
466 | phys_addr_t reg; | ||
467 | 466 | ||
468 | if (pclk->lock) | 467 | if (pclk->lock) |
469 | spin_lock_irqsave(pclk->lock, flags); | 468 | spin_lock_irqsave(pclk->lock, flags); |
470 | 469 | ||
471 | if (pclk->param.csr_reg != NULL) { | 470 | if (pclk->param.csr_reg != NULL) { |
472 | pr_debug("%s clock enabled\n", clk_hw_get_name(hw)); | 471 | pr_debug("%s clock enabled\n", clk_hw_get_name(hw)); |
473 | reg = __pa(pclk->param.csr_reg); | ||
474 | /* First enable the clock */ | 472 | /* First enable the clock */ |
475 | data = xgene_clk_read(pclk->param.csr_reg + | 473 | data = xgene_clk_read(pclk->param.csr_reg + |
476 | pclk->param.reg_clk_offset); | 474 | pclk->param.reg_clk_offset); |
477 | data |= pclk->param.reg_clk_mask; | 475 | data |= pclk->param.reg_clk_mask; |
478 | xgene_clk_write(data, pclk->param.csr_reg + | 476 | xgene_clk_write(data, pclk->param.csr_reg + |
479 | pclk->param.reg_clk_offset); | 477 | pclk->param.reg_clk_offset); |
480 | pr_debug("%s clock PADDR base %pa clk offset 0x%08X mask 0x%08X value 0x%08X\n", | 478 | pr_debug("%s clk offset 0x%08X mask 0x%08X value 0x%08X\n", |
481 | clk_hw_get_name(hw), ®, | 479 | clk_hw_get_name(hw), |
482 | pclk->param.reg_clk_offset, pclk->param.reg_clk_mask, | 480 | pclk->param.reg_clk_offset, pclk->param.reg_clk_mask, |
483 | data); | 481 | data); |
484 | 482 | ||
@@ -488,8 +486,8 @@ static int xgene_clk_enable(struct clk_hw *hw) | |||
488 | data &= ~pclk->param.reg_csr_mask; | 486 | data &= ~pclk->param.reg_csr_mask; |
489 | xgene_clk_write(data, pclk->param.csr_reg + | 487 | xgene_clk_write(data, pclk->param.csr_reg + |
490 | pclk->param.reg_csr_offset); | 488 | pclk->param.reg_csr_offset); |
491 | pr_debug("%s CSR RESET PADDR base %pa csr offset 0x%08X mask 0x%08X value 0x%08X\n", | 489 | pr_debug("%s csr offset 0x%08X mask 0x%08X value 0x%08X\n", |
492 | clk_hw_get_name(hw), ®, | 490 | clk_hw_get_name(hw), |
493 | pclk->param.reg_csr_offset, pclk->param.reg_csr_mask, | 491 | pclk->param.reg_csr_offset, pclk->param.reg_csr_mask, |
494 | data); | 492 | data); |
495 | } | 493 | } |
diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c index 19f9b622981a..7a6acc3e4a92 100644 --- a/drivers/clk/imx/clk-pllv3.c +++ b/drivers/clk/imx/clk-pllv3.c | |||
@@ -223,7 +223,7 @@ static unsigned long clk_pllv3_av_recalc_rate(struct clk_hw *hw, | |||
223 | temp64 *= mfn; | 223 | temp64 *= mfn; |
224 | do_div(temp64, mfd); | 224 | do_div(temp64, mfd); |
225 | 225 | ||
226 | return (parent_rate * div) + (u32)temp64; | 226 | return parent_rate * div + (unsigned long)temp64; |
227 | } | 227 | } |
228 | 228 | ||
229 | static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate, | 229 | 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, | |||
247 | do_div(temp64, parent_rate); | 247 | do_div(temp64, parent_rate); |
248 | mfn = temp64; | 248 | mfn = temp64; |
249 | 249 | ||
250 | return parent_rate * div + parent_rate * mfn / mfd; | 250 | temp64 = (u64)parent_rate; |
251 | temp64 *= mfn; | ||
252 | do_div(temp64, mfd); | ||
253 | |||
254 | return parent_rate * div + (unsigned long)temp64; | ||
251 | } | 255 | } |
252 | 256 | ||
253 | static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate, | 257 | static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate, |
diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c index 3a51fff1b0e7..9adaf48aea23 100644 --- a/drivers/clk/mmp/clk-of-mmp2.c +++ b/drivers/clk/mmp/clk-of-mmp2.c | |||
@@ -313,7 +313,7 @@ static void __init mmp2_clk_init(struct device_node *np) | |||
313 | } | 313 | } |
314 | 314 | ||
315 | pxa_unit->apmu_base = of_iomap(np, 1); | 315 | pxa_unit->apmu_base = of_iomap(np, 1); |
316 | if (!pxa_unit->mpmu_base) { | 316 | if (!pxa_unit->apmu_base) { |
317 | pr_err("failed to map apmu registers\n"); | 317 | pr_err("failed to map apmu registers\n"); |
318 | return; | 318 | return; |
319 | } | 319 | } |
diff --git a/drivers/clk/mmp/clk-of-pxa168.c b/drivers/clk/mmp/clk-of-pxa168.c index 87f2317b2a00..f110c02e83cb 100644 --- a/drivers/clk/mmp/clk-of-pxa168.c +++ b/drivers/clk/mmp/clk-of-pxa168.c | |||
@@ -262,7 +262,7 @@ static void __init pxa168_clk_init(struct device_node *np) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | pxa_unit->apmu_base = of_iomap(np, 1); | 264 | pxa_unit->apmu_base = of_iomap(np, 1); |
265 | if (!pxa_unit->mpmu_base) { | 265 | if (!pxa_unit->apmu_base) { |
266 | pr_err("failed to map apmu registers\n"); | 266 | pr_err("failed to map apmu registers\n"); |
267 | return; | 267 | return; |
268 | } | 268 | } |
diff --git a/drivers/clk/mmp/clk-of-pxa910.c b/drivers/clk/mmp/clk-of-pxa910.c index e22a67f76d93..64d1ef49caeb 100644 --- a/drivers/clk/mmp/clk-of-pxa910.c +++ b/drivers/clk/mmp/clk-of-pxa910.c | |||
@@ -282,7 +282,7 @@ static void __init pxa910_clk_init(struct device_node *np) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | pxa_unit->apmu_base = of_iomap(np, 1); | 284 | pxa_unit->apmu_base = of_iomap(np, 1); |
285 | if (!pxa_unit->mpmu_base) { | 285 | if (!pxa_unit->apmu_base) { |
286 | pr_err("failed to map apmu registers\n"); | 286 | pr_err("failed to map apmu registers\n"); |
287 | return; | 287 | return; |
288 | } | 288 | } |
@@ -294,7 +294,7 @@ static void __init pxa910_clk_init(struct device_node *np) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | pxa_unit->apbcp_base = of_iomap(np, 3); | 296 | pxa_unit->apbcp_base = of_iomap(np, 3); |
297 | if (!pxa_unit->mpmu_base) { | 297 | if (!pxa_unit->apbcp_base) { |
298 | pr_err("failed to map apbcp registers\n"); | 298 | pr_err("failed to map apbcp registers\n"); |
299 | return; | 299 | return; |
300 | } | 300 | } |
diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c index 8feba93672c5..e8075359366b 100644 --- a/drivers/clk/rockchip/clk-ddr.c +++ b/drivers/clk/rockchip/clk-ddr.c | |||
@@ -144,11 +144,8 @@ struct clk *rockchip_clk_register_ddrclk(const char *name, int flags, | |||
144 | ddrclk->ddr_flag = ddr_flag; | 144 | ddrclk->ddr_flag = ddr_flag; |
145 | 145 | ||
146 | clk = clk_register(NULL, &ddrclk->hw); | 146 | clk = clk_register(NULL, &ddrclk->hw); |
147 | if (IS_ERR(clk)) { | 147 | if (IS_ERR(clk)) |
148 | pr_err("%s: could not register ddrclk %s\n", __func__, name); | ||
149 | kfree(ddrclk); | 148 | kfree(ddrclk); |
150 | return NULL; | ||
151 | } | ||
152 | 149 | ||
153 | return clk; | 150 | return clk; |
154 | } | 151 | } |
diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 96fab6cfb202..6c6afb87b4ce 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c | |||
@@ -132,28 +132,34 @@ free_clkout: | |||
132 | pr_err("%s: failed to register clkout clock\n", __func__); | 132 | pr_err("%s: failed to register clkout clock\n", __func__); |
133 | } | 133 | } |
134 | 134 | ||
135 | /* | ||
136 | * We use CLK_OF_DECLARE_DRIVER initialization method to avoid setting | ||
137 | * the OF_POPULATED flag on the pmu device tree node, so later the | ||
138 | * Exynos PMU platform device can be properly probed with PMU driver. | ||
139 | */ | ||
140 | |||
135 | static void __init exynos4_clkout_init(struct device_node *node) | 141 | static void __init exynos4_clkout_init(struct device_node *node) |
136 | { | 142 | { |
137 | exynos_clkout_init(node, EXYNOS4_CLKOUT_MUX_MASK); | 143 | exynos_clkout_init(node, EXYNOS4_CLKOUT_MUX_MASK); |
138 | } | 144 | } |
139 | CLK_OF_DECLARE(exynos4210_clkout, "samsung,exynos4210-pmu", | 145 | CLK_OF_DECLARE_DRIVER(exynos4210_clkout, "samsung,exynos4210-pmu", |
140 | exynos4_clkout_init); | 146 | exynos4_clkout_init); |
141 | CLK_OF_DECLARE(exynos4212_clkout, "samsung,exynos4212-pmu", | 147 | CLK_OF_DECLARE_DRIVER(exynos4212_clkout, "samsung,exynos4212-pmu", |
142 | exynos4_clkout_init); | 148 | exynos4_clkout_init); |
143 | CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu", | 149 | CLK_OF_DECLARE_DRIVER(exynos4412_clkout, "samsung,exynos4412-pmu", |
144 | exynos4_clkout_init); | 150 | exynos4_clkout_init); |
145 | CLK_OF_DECLARE(exynos3250_clkout, "samsung,exynos3250-pmu", | 151 | CLK_OF_DECLARE_DRIVER(exynos3250_clkout, "samsung,exynos3250-pmu", |
146 | exynos4_clkout_init); | 152 | exynos4_clkout_init); |
147 | 153 | ||
148 | static void __init exynos5_clkout_init(struct device_node *node) | 154 | static void __init exynos5_clkout_init(struct device_node *node) |
149 | { | 155 | { |
150 | exynos_clkout_init(node, EXYNOS5_CLKOUT_MUX_MASK); | 156 | exynos_clkout_init(node, EXYNOS5_CLKOUT_MUX_MASK); |
151 | } | 157 | } |
152 | CLK_OF_DECLARE(exynos5250_clkout, "samsung,exynos5250-pmu", | 158 | CLK_OF_DECLARE_DRIVER(exynos5250_clkout, "samsung,exynos5250-pmu", |
153 | exynos5_clkout_init); | 159 | exynos5_clkout_init); |
154 | CLK_OF_DECLARE(exynos5410_clkout, "samsung,exynos5410-pmu", | 160 | CLK_OF_DECLARE_DRIVER(exynos5410_clkout, "samsung,exynos5410-pmu", |
155 | exynos5_clkout_init); | 161 | exynos5_clkout_init); |
156 | CLK_OF_DECLARE(exynos5420_clkout, "samsung,exynos5420-pmu", | 162 | CLK_OF_DECLARE_DRIVER(exynos5420_clkout, "samsung,exynos5420-pmu", |
157 | exynos5_clkout_init); | 163 | exynos5_clkout_init); |
158 | CLK_OF_DECLARE(exynos5433_clkout, "samsung,exynos5433-pmu", | 164 | CLK_OF_DECLARE_DRIVER(exynos5433_clkout, "samsung,exynos5433-pmu", |
159 | exynos5_clkout_init); | 165 | exynos5_clkout_init); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index 2f9f96cc9f65..06879d1dcabd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | |||
@@ -395,9 +395,12 @@ static int acp_hw_fini(void *handle) | |||
395 | { | 395 | { |
396 | int i, ret; | 396 | int i, ret; |
397 | struct device *dev; | 397 | struct device *dev; |
398 | |||
399 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 398 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
400 | 399 | ||
400 | /* return early if no ACP */ | ||
401 | if (!adev->acp.acp_genpd) | ||
402 | return 0; | ||
403 | |||
401 | for (i = 0; i < ACP_DEVS ; i++) { | 404 | for (i = 0; i < ACP_DEVS ; i++) { |
402 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); | 405 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
403 | ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev); | 406 | ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 017556ca22e6..7ded61e6dd81 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -809,10 +809,19 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, | |||
809 | if (!adev->pm.fw) { | 809 | if (!adev->pm.fw) { |
810 | switch (adev->asic_type) { | 810 | switch (adev->asic_type) { |
811 | case CHIP_TOPAZ: | 811 | case CHIP_TOPAZ: |
812 | strcpy(fw_name, "amdgpu/topaz_smc.bin"); | 812 | if (((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x81)) || |
813 | ((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x83)) || | ||
814 | ((adev->pdev->device == 0x6907) && (adev->pdev->revision == 0x87))) | ||
815 | strcpy(fw_name, "amdgpu/topaz_k_smc.bin"); | ||
816 | else | ||
817 | strcpy(fw_name, "amdgpu/topaz_smc.bin"); | ||
813 | break; | 818 | break; |
814 | case CHIP_TONGA: | 819 | case CHIP_TONGA: |
815 | strcpy(fw_name, "amdgpu/tonga_smc.bin"); | 820 | if (((adev->pdev->device == 0x6939) && (adev->pdev->revision == 0xf1)) || |
821 | ((adev->pdev->device == 0x6938) && (adev->pdev->revision == 0xf1))) | ||
822 | strcpy(fw_name, "amdgpu/tonga_k_smc.bin"); | ||
823 | else | ||
824 | strcpy(fw_name, "amdgpu/tonga_smc.bin"); | ||
816 | break; | 825 | break; |
817 | case CHIP_FIJI: | 826 | case CHIP_FIJI: |
818 | strcpy(fw_name, "amdgpu/fiji_smc.bin"); | 827 | strcpy(fw_name, "amdgpu/fiji_smc.bin"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 3af8ffb45b64..8d1cf2d3e663 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | |||
@@ -769,7 +769,7 @@ static void amdgpu_connector_unregister(struct drm_connector *connector) | |||
769 | { | 769 | { |
770 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); | 770 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); |
771 | 771 | ||
772 | if (amdgpu_connector->ddc_bus->has_aux) { | 772 | if (amdgpu_connector->ddc_bus && amdgpu_connector->ddc_bus->has_aux) { |
773 | drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux); | 773 | drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux); |
774 | amdgpu_connector->ddc_bus->has_aux = false; | 774 | amdgpu_connector->ddc_bus->has_aux = false; |
775 | } | 775 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 6bb4d9e9afe4..42da6163b893 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -742,8 +742,20 @@ static struct pci_driver amdgpu_kms_pci_driver = { | |||
742 | 742 | ||
743 | static int __init amdgpu_init(void) | 743 | static int __init amdgpu_init(void) |
744 | { | 744 | { |
745 | amdgpu_sync_init(); | 745 | int r; |
746 | amdgpu_fence_slab_init(); | 746 | |
747 | r = amdgpu_sync_init(); | ||
748 | if (r) | ||
749 | goto error_sync; | ||
750 | |||
751 | r = amdgpu_fence_slab_init(); | ||
752 | if (r) | ||
753 | goto error_fence; | ||
754 | |||
755 | r = amd_sched_fence_slab_init(); | ||
756 | if (r) | ||
757 | goto error_sched; | ||
758 | |||
747 | if (vgacon_text_force()) { | 759 | if (vgacon_text_force()) { |
748 | DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); | 760 | DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); |
749 | return -EINVAL; | 761 | return -EINVAL; |
@@ -755,6 +767,15 @@ static int __init amdgpu_init(void) | |||
755 | amdgpu_register_atpx_handler(); | 767 | amdgpu_register_atpx_handler(); |
756 | /* let modprobe override vga console setting */ | 768 | /* let modprobe override vga console setting */ |
757 | return drm_pci_init(driver, pdriver); | 769 | return drm_pci_init(driver, pdriver); |
770 | |||
771 | error_sched: | ||
772 | amdgpu_fence_slab_fini(); | ||
773 | |||
774 | error_fence: | ||
775 | amdgpu_sync_fini(); | ||
776 | |||
777 | error_sync: | ||
778 | return r; | ||
758 | } | 779 | } |
759 | 780 | ||
760 | static void __exit amdgpu_exit(void) | 781 | static void __exit amdgpu_exit(void) |
@@ -763,6 +784,7 @@ static void __exit amdgpu_exit(void) | |||
763 | drm_pci_exit(driver, pdriver); | 784 | drm_pci_exit(driver, pdriver); |
764 | amdgpu_unregister_atpx_handler(); | 785 | amdgpu_unregister_atpx_handler(); |
765 | amdgpu_sync_fini(); | 786 | amdgpu_sync_fini(); |
787 | amd_sched_fence_slab_fini(); | ||
766 | amdgpu_fence_slab_fini(); | 788 | amdgpu_fence_slab_fini(); |
767 | } | 789 | } |
768 | 790 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index ad908612aff9..d1cf9ac0dff1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -99,6 +99,8 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) | |||
99 | 99 | ||
100 | if ((amdgpu_runtime_pm != 0) && | 100 | if ((amdgpu_runtime_pm != 0) && |
101 | amdgpu_has_atpx() && | 101 | amdgpu_has_atpx() && |
102 | (amdgpu_is_atpx_hybrid() || | ||
103 | amdgpu_has_atpx_dgpu_power_cntl()) && | ||
102 | ((flags & AMD_IS_APU) == 0)) | 104 | ((flags & AMD_IS_APU) == 0)) |
103 | flags |= AMD_IS_PX; | 105 | flags |= AMD_IS_PX; |
104 | 106 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index 52d0a83e6ad1..0b21e7beda91 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -80,7 +80,9 @@ | |||
80 | #include "dce_virtual.h" | 80 | #include "dce_virtual.h" |
81 | 81 | ||
82 | MODULE_FIRMWARE("amdgpu/topaz_smc.bin"); | 82 | MODULE_FIRMWARE("amdgpu/topaz_smc.bin"); |
83 | MODULE_FIRMWARE("amdgpu/topaz_k_smc.bin"); | ||
83 | MODULE_FIRMWARE("amdgpu/tonga_smc.bin"); | 84 | MODULE_FIRMWARE("amdgpu/tonga_smc.bin"); |
85 | MODULE_FIRMWARE("amdgpu/tonga_k_smc.bin"); | ||
84 | MODULE_FIRMWARE("amdgpu/fiji_smc.bin"); | 86 | MODULE_FIRMWARE("amdgpu/fiji_smc.bin"); |
85 | MODULE_FIRMWARE("amdgpu/polaris10_smc.bin"); | 87 | MODULE_FIRMWARE("amdgpu/polaris10_smc.bin"); |
86 | MODULE_FIRMWARE("amdgpu/polaris10_smc_sk.bin"); | 88 | MODULE_FIRMWARE("amdgpu/polaris10_smc_sk.bin"); |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c index 14f8c1f4da3d..0723758ed065 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | |||
@@ -272,7 +272,7 @@ bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hw | |||
272 | PHM_FUNC_CHECK(hwmgr); | 272 | PHM_FUNC_CHECK(hwmgr); |
273 | 273 | ||
274 | if (hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration == NULL) | 274 | if (hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration == NULL) |
275 | return -EINVAL; | 275 | return false; |
276 | 276 | ||
277 | return hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration(hwmgr); | 277 | return hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration(hwmgr); |
278 | } | 278 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index 2ba7937d2545..e03dcb6ea9c1 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | |||
@@ -710,8 +710,10 @@ int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type, | |||
710 | uint32_t vol; | 710 | uint32_t vol; |
711 | int ret = 0; | 711 | int ret = 0; |
712 | 712 | ||
713 | if (hwmgr->chip_id < CHIP_POLARIS10) { | 713 | if (hwmgr->chip_id < CHIP_TONGA) { |
714 | atomctrl_get_voltage_evv_on_sclk(hwmgr, voltage_type, sclk, id, voltage); | 714 | ret = atomctrl_get_voltage_evv(hwmgr, id, voltage); |
715 | } else if (hwmgr->chip_id < CHIP_POLARIS10) { | ||
716 | ret = atomctrl_get_voltage_evv_on_sclk(hwmgr, voltage_type, sclk, id, voltage); | ||
715 | if (*voltage >= 2000 || *voltage == 0) | 717 | if (*voltage >= 2000 || *voltage == 0) |
716 | *voltage = 1150; | 718 | *voltage = 1150; |
717 | } else { | 719 | } else { |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index 9e49f2777143..28e748d688e2 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -1474,19 +1474,19 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr) | |||
1474 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = NULL; | 1474 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = NULL; |
1475 | 1475 | ||
1476 | 1476 | ||
1477 | if (table_info == NULL) | ||
1478 | return -EINVAL; | ||
1479 | |||
1480 | sclk_table = table_info->vdd_dep_on_sclk; | ||
1481 | |||
1482 | for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) { | 1477 | for (i = 0; i < SMU7_MAX_LEAKAGE_COUNT; i++) { |
1483 | vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; | 1478 | vv_id = ATOM_VIRTUAL_VOLTAGE_ID0 + i; |
1484 | 1479 | ||
1485 | if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) { | 1480 | if (data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2) { |
1486 | if (0 == phm_get_sclk_for_voltage_evv(hwmgr, | 1481 | if ((hwmgr->pp_table_version == PP_TABLE_V1) |
1482 | && !phm_get_sclk_for_voltage_evv(hwmgr, | ||
1487 | table_info->vddgfx_lookup_table, vv_id, &sclk)) { | 1483 | table_info->vddgfx_lookup_table, vv_id, &sclk)) { |
1488 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 1484 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
1489 | PHM_PlatformCaps_ClockStretcher)) { | 1485 | PHM_PlatformCaps_ClockStretcher)) { |
1486 | if (table_info == NULL) | ||
1487 | return -EINVAL; | ||
1488 | sclk_table = table_info->vdd_dep_on_sclk; | ||
1489 | |||
1490 | for (j = 1; j < sclk_table->count; j++) { | 1490 | for (j = 1; j < sclk_table->count; j++) { |
1491 | if (sclk_table->entries[j].clk == sclk && | 1491 | if (sclk_table->entries[j].clk == sclk && |
1492 | sclk_table->entries[j].cks_enable == 0) { | 1492 | sclk_table->entries[j].cks_enable == 0) { |
@@ -1512,12 +1512,15 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr) | |||
1512 | } | 1512 | } |
1513 | } | 1513 | } |
1514 | } else { | 1514 | } else { |
1515 | |||
1516 | if ((hwmgr->pp_table_version == PP_TABLE_V0) | 1515 | if ((hwmgr->pp_table_version == PP_TABLE_V0) |
1517 | || !phm_get_sclk_for_voltage_evv(hwmgr, | 1516 | || !phm_get_sclk_for_voltage_evv(hwmgr, |
1518 | table_info->vddc_lookup_table, vv_id, &sclk)) { | 1517 | table_info->vddc_lookup_table, vv_id, &sclk)) { |
1519 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 1518 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
1520 | PHM_PlatformCaps_ClockStretcher)) { | 1519 | PHM_PlatformCaps_ClockStretcher)) { |
1520 | if (table_info == NULL) | ||
1521 | return -EINVAL; | ||
1522 | sclk_table = table_info->vdd_dep_on_sclk; | ||
1523 | |||
1521 | for (j = 1; j < sclk_table->count; j++) { | 1524 | for (j = 1; j < sclk_table->count; j++) { |
1522 | if (sclk_table->entries[j].clk == sclk && | 1525 | if (sclk_table->entries[j].clk == sclk && |
1523 | sclk_table->entries[j].cks_enable == 0) { | 1526 | sclk_table->entries[j].cks_enable == 0) { |
@@ -2147,9 +2150,11 @@ static int smu7_patch_limits_vddc(struct pp_hwmgr *hwmgr, | |||
2147 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | 2150 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
2148 | 2151 | ||
2149 | if (tab) { | 2152 | if (tab) { |
2153 | vddc = tab->vddc; | ||
2150 | smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddc, | 2154 | smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddc, |
2151 | &data->vddc_leakage); | 2155 | &data->vddc_leakage); |
2152 | tab->vddc = vddc; | 2156 | tab->vddc = vddc; |
2157 | vddci = tab->vddci; | ||
2153 | smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddci, | 2158 | smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddci, |
2154 | &data->vddci_leakage); | 2159 | &data->vddci_leakage); |
2155 | tab->vddci = vddci; | 2160 | tab->vddci = vddci; |
@@ -4247,18 +4252,26 @@ static int smu7_get_sclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks) | |||
4247 | { | 4252 | { |
4248 | struct phm_ppt_v1_information *table_info = | 4253 | struct phm_ppt_v1_information *table_info = |
4249 | (struct phm_ppt_v1_information *)hwmgr->pptable; | 4254 | (struct phm_ppt_v1_information *)hwmgr->pptable; |
4250 | struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table; | 4255 | struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table = NULL; |
4256 | struct phm_clock_voltage_dependency_table *sclk_table; | ||
4251 | int i; | 4257 | int i; |
4252 | 4258 | ||
4253 | if (table_info == NULL) | 4259 | if (hwmgr->pp_table_version == PP_TABLE_V1) { |
4254 | return -EINVAL; | 4260 | if (table_info == NULL || table_info->vdd_dep_on_sclk == NULL) |
4255 | 4261 | return -EINVAL; | |
4256 | dep_sclk_table = table_info->vdd_dep_on_sclk; | 4262 | dep_sclk_table = table_info->vdd_dep_on_sclk; |
4257 | 4263 | for (i = 0; i < dep_sclk_table->count; i++) { | |
4258 | for (i = 0; i < dep_sclk_table->count; i++) { | 4264 | clocks->clock[i] = dep_sclk_table->entries[i].clk; |
4259 | clocks->clock[i] = dep_sclk_table->entries[i].clk; | 4265 | clocks->count++; |
4260 | clocks->count++; | 4266 | } |
4267 | } else if (hwmgr->pp_table_version == PP_TABLE_V0) { | ||
4268 | sclk_table = hwmgr->dyn_state.vddc_dependency_on_sclk; | ||
4269 | for (i = 0; i < sclk_table->count; i++) { | ||
4270 | clocks->clock[i] = sclk_table->entries[i].clk; | ||
4271 | clocks->count++; | ||
4272 | } | ||
4261 | } | 4273 | } |
4274 | |||
4262 | return 0; | 4275 | return 0; |
4263 | } | 4276 | } |
4264 | 4277 | ||
@@ -4280,17 +4293,24 @@ static int smu7_get_mclks(struct pp_hwmgr *hwmgr, struct amd_pp_clocks *clocks) | |||
4280 | (struct phm_ppt_v1_information *)hwmgr->pptable; | 4293 | (struct phm_ppt_v1_information *)hwmgr->pptable; |
4281 | struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table; | 4294 | struct phm_ppt_v1_clock_voltage_dependency_table *dep_mclk_table; |
4282 | int i; | 4295 | int i; |
4296 | struct phm_clock_voltage_dependency_table *mclk_table; | ||
4283 | 4297 | ||
4284 | if (table_info == NULL) | 4298 | if (hwmgr->pp_table_version == PP_TABLE_V1) { |
4285 | return -EINVAL; | 4299 | if (table_info == NULL) |
4286 | 4300 | return -EINVAL; | |
4287 | dep_mclk_table = table_info->vdd_dep_on_mclk; | 4301 | dep_mclk_table = table_info->vdd_dep_on_mclk; |
4288 | 4302 | for (i = 0; i < dep_mclk_table->count; i++) { | |
4289 | for (i = 0; i < dep_mclk_table->count; i++) { | 4303 | clocks->clock[i] = dep_mclk_table->entries[i].clk; |
4290 | clocks->clock[i] = dep_mclk_table->entries[i].clk; | 4304 | clocks->latency[i] = smu7_get_mem_latency(hwmgr, |
4291 | clocks->latency[i] = smu7_get_mem_latency(hwmgr, | ||
4292 | dep_mclk_table->entries[i].clk); | 4305 | dep_mclk_table->entries[i].clk); |
4293 | clocks->count++; | 4306 | clocks->count++; |
4307 | } | ||
4308 | } else if (hwmgr->pp_table_version == PP_TABLE_V0) { | ||
4309 | mclk_table = hwmgr->dyn_state.vddc_dependency_on_mclk; | ||
4310 | for (i = 0; i < mclk_table->count; i++) { | ||
4311 | clocks->clock[i] = mclk_table->entries[i].clk; | ||
4312 | clocks->count++; | ||
4313 | } | ||
4294 | } | 4314 | } |
4295 | return 0; | 4315 | return 0; |
4296 | } | 4316 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c index fb6c6f6106d5..29d0319b22e6 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c | |||
@@ -30,7 +30,7 @@ int smu7_fan_ctrl_get_fan_speed_info(struct pp_hwmgr *hwmgr, | |||
30 | struct phm_fan_speed_info *fan_speed_info) | 30 | struct phm_fan_speed_info *fan_speed_info) |
31 | { | 31 | { |
32 | if (hwmgr->thermal_controller.fanInfo.bNoFan) | 32 | if (hwmgr->thermal_controller.fanInfo.bNoFan) |
33 | return 0; | 33 | return -ENODEV; |
34 | 34 | ||
35 | fan_speed_info->supports_percent_read = true; | 35 | fan_speed_info->supports_percent_read = true; |
36 | fan_speed_info->supports_percent_write = true; | 36 | fan_speed_info->supports_percent_write = true; |
@@ -60,7 +60,7 @@ int smu7_fan_ctrl_get_fan_speed_percent(struct pp_hwmgr *hwmgr, | |||
60 | uint64_t tmp64; | 60 | uint64_t tmp64; |
61 | 61 | ||
62 | if (hwmgr->thermal_controller.fanInfo.bNoFan) | 62 | if (hwmgr->thermal_controller.fanInfo.bNoFan) |
63 | return 0; | 63 | return -ENODEV; |
64 | 64 | ||
65 | duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, | 65 | duty100 = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, |
66 | CG_FDO_CTRL1, FMAX_DUTY100); | 66 | CG_FDO_CTRL1, FMAX_DUTY100); |
@@ -89,7 +89,7 @@ int smu7_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t *speed) | |||
89 | if (hwmgr->thermal_controller.fanInfo.bNoFan || | 89 | if (hwmgr->thermal_controller.fanInfo.bNoFan || |
90 | (hwmgr->thermal_controller.fanInfo. | 90 | (hwmgr->thermal_controller.fanInfo. |
91 | ucTachometerPulsesPerRevolution == 0)) | 91 | ucTachometerPulsesPerRevolution == 0)) |
92 | return 0; | 92 | return -ENODEV; |
93 | 93 | ||
94 | tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, | 94 | tach_period = PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, |
95 | CG_TACH_STATUS, TACH_PERIOD); | 95 | CG_TACH_STATUS, TACH_PERIOD); |
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 09b2cf6ccfa4..1bf83ed113b3 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | |||
@@ -34,9 +34,6 @@ static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity); | |||
34 | static void amd_sched_wakeup(struct amd_gpu_scheduler *sched); | 34 | static void amd_sched_wakeup(struct amd_gpu_scheduler *sched); |
35 | static void amd_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb); | 35 | static void amd_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb); |
36 | 36 | ||
37 | struct kmem_cache *sched_fence_slab; | ||
38 | atomic_t sched_fence_slab_ref = ATOMIC_INIT(0); | ||
39 | |||
40 | /* Initialize a given run queue struct */ | 37 | /* Initialize a given run queue struct */ |
41 | static void amd_sched_rq_init(struct amd_sched_rq *rq) | 38 | static void amd_sched_rq_init(struct amd_sched_rq *rq) |
42 | { | 39 | { |
@@ -619,13 +616,6 @@ int amd_sched_init(struct amd_gpu_scheduler *sched, | |||
619 | INIT_LIST_HEAD(&sched->ring_mirror_list); | 616 | INIT_LIST_HEAD(&sched->ring_mirror_list); |
620 | spin_lock_init(&sched->job_list_lock); | 617 | spin_lock_init(&sched->job_list_lock); |
621 | atomic_set(&sched->hw_rq_count, 0); | 618 | atomic_set(&sched->hw_rq_count, 0); |
622 | if (atomic_inc_return(&sched_fence_slab_ref) == 1) { | ||
623 | sched_fence_slab = kmem_cache_create( | ||
624 | "amd_sched_fence", sizeof(struct amd_sched_fence), 0, | ||
625 | SLAB_HWCACHE_ALIGN, NULL); | ||
626 | if (!sched_fence_slab) | ||
627 | return -ENOMEM; | ||
628 | } | ||
629 | 619 | ||
630 | /* Each scheduler will run on a seperate kernel thread */ | 620 | /* Each scheduler will run on a seperate kernel thread */ |
631 | sched->thread = kthread_run(amd_sched_main, sched, sched->name); | 621 | sched->thread = kthread_run(amd_sched_main, sched, sched->name); |
@@ -646,7 +636,4 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched) | |||
646 | { | 636 | { |
647 | if (sched->thread) | 637 | if (sched->thread) |
648 | kthread_stop(sched->thread); | 638 | kthread_stop(sched->thread); |
649 | rcu_barrier(); | ||
650 | if (atomic_dec_and_test(&sched_fence_slab_ref)) | ||
651 | kmem_cache_destroy(sched_fence_slab); | ||
652 | } | 639 | } |
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 876aa43b57df..d8dc681bcda6 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | |||
@@ -30,9 +30,6 @@ | |||
30 | struct amd_gpu_scheduler; | 30 | struct amd_gpu_scheduler; |
31 | struct amd_sched_rq; | 31 | struct amd_sched_rq; |
32 | 32 | ||
33 | extern struct kmem_cache *sched_fence_slab; | ||
34 | extern atomic_t sched_fence_slab_ref; | ||
35 | |||
36 | /** | 33 | /** |
37 | * A scheduler entity is a wrapper around a job queue or a group | 34 | * A scheduler entity is a wrapper around a job queue or a group |
38 | * of other entities. Entities take turns emitting jobs from their | 35 | * of other entities. Entities take turns emitting jobs from their |
@@ -145,6 +142,9 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched, | |||
145 | struct amd_sched_entity *entity); | 142 | struct amd_sched_entity *entity); |
146 | void amd_sched_entity_push_job(struct amd_sched_job *sched_job); | 143 | void amd_sched_entity_push_job(struct amd_sched_job *sched_job); |
147 | 144 | ||
145 | int amd_sched_fence_slab_init(void); | ||
146 | void amd_sched_fence_slab_fini(void); | ||
147 | |||
148 | struct amd_sched_fence *amd_sched_fence_create( | 148 | struct amd_sched_fence *amd_sched_fence_create( |
149 | struct amd_sched_entity *s_entity, void *owner); | 149 | struct amd_sched_entity *s_entity, void *owner); |
150 | void amd_sched_fence_scheduled(struct amd_sched_fence *fence); | 150 | void amd_sched_fence_scheduled(struct amd_sched_fence *fence); |
diff --git a/drivers/gpu/drm/amd/scheduler/sched_fence.c b/drivers/gpu/drm/amd/scheduler/sched_fence.c index 91530e25aaff..33f54d0a5c4f 100644 --- a/drivers/gpu/drm/amd/scheduler/sched_fence.c +++ b/drivers/gpu/drm/amd/scheduler/sched_fence.c | |||
@@ -27,6 +27,25 @@ | |||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include "gpu_scheduler.h" | 28 | #include "gpu_scheduler.h" |
29 | 29 | ||
30 | static struct kmem_cache *sched_fence_slab; | ||
31 | |||
32 | int amd_sched_fence_slab_init(void) | ||
33 | { | ||
34 | sched_fence_slab = kmem_cache_create( | ||
35 | "amd_sched_fence", sizeof(struct amd_sched_fence), 0, | ||
36 | SLAB_HWCACHE_ALIGN, NULL); | ||
37 | if (!sched_fence_slab) | ||
38 | return -ENOMEM; | ||
39 | |||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | void amd_sched_fence_slab_fini(void) | ||
44 | { | ||
45 | rcu_barrier(); | ||
46 | kmem_cache_destroy(sched_fence_slab); | ||
47 | } | ||
48 | |||
30 | struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *entity, | 49 | struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *entity, |
31 | void *owner) | 50 | void *owner) |
32 | { | 51 | { |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 6dbb98649795..de4da25a681e 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -303,9 +303,10 @@ void drm_minor_release(struct drm_minor *minor) | |||
303 | * callbacks implemented by the driver. The driver then needs to initialize all | 303 | * callbacks implemented by the driver. The driver then needs to initialize all |
304 | * the various subsystems for the drm device like memory management, vblank | 304 | * the various subsystems for the drm device like memory management, vblank |
305 | * handling, modesetting support and intial output configuration plus obviously | 305 | * handling, modesetting support and intial output configuration plus obviously |
306 | * initialize all the corresponding hardware bits. Finally when everything is up | 306 | * initialize all the corresponding hardware bits. An important part of this is |
307 | * and running and ready for userspace the device instance can be published | 307 | * also calling drm_dev_set_unique() to set the userspace-visible unique name of |
308 | * using drm_dev_register(). | 308 | * this device instance. Finally when everything is up and running and ready for |
309 | * userspace the device instance can be published using drm_dev_register(). | ||
309 | * | 310 | * |
310 | * There is also deprecated support for initalizing device instances using | 311 | * There is also deprecated support for initalizing device instances using |
311 | * bus-specific helpers and the ->load() callback. But due to | 312 | * bus-specific helpers and the ->load() callback. But due to |
@@ -327,17 +328,6 @@ void drm_minor_release(struct drm_minor *minor) | |||
327 | * dev_priv field of &drm_device. | 328 | * dev_priv field of &drm_device. |
328 | */ | 329 | */ |
329 | 330 | ||
330 | static int drm_dev_set_unique(struct drm_device *dev, const char *name) | ||
331 | { | ||
332 | if (!name) | ||
333 | return -EINVAL; | ||
334 | |||
335 | kfree(dev->unique); | ||
336 | dev->unique = kstrdup(name, GFP_KERNEL); | ||
337 | |||
338 | return dev->unique ? 0 : -ENOMEM; | ||
339 | } | ||
340 | |||
341 | /** | 331 | /** |
342 | * drm_put_dev - Unregister and release a DRM device | 332 | * drm_put_dev - Unregister and release a DRM device |
343 | * @dev: DRM device | 333 | * @dev: DRM device |
@@ -760,6 +750,26 @@ void drm_dev_unregister(struct drm_device *dev) | |||
760 | } | 750 | } |
761 | EXPORT_SYMBOL(drm_dev_unregister); | 751 | EXPORT_SYMBOL(drm_dev_unregister); |
762 | 752 | ||
753 | /** | ||
754 | * drm_dev_set_unique - Set the unique name of a DRM device | ||
755 | * @dev: device of which to set the unique name | ||
756 | * @name: unique name | ||
757 | * | ||
758 | * Sets the unique name of a DRM device using the specified string. Drivers | ||
759 | * can use this at driver probe time if the unique name of the devices they | ||
760 | * drive is static. | ||
761 | * | ||
762 | * Return: 0 on success or a negative error code on failure. | ||
763 | */ | ||
764 | int drm_dev_set_unique(struct drm_device *dev, const char *name) | ||
765 | { | ||
766 | kfree(dev->unique); | ||
767 | dev->unique = kstrdup(name, GFP_KERNEL); | ||
768 | |||
769 | return dev->unique ? 0 : -ENOMEM; | ||
770 | } | ||
771 | EXPORT_SYMBOL(drm_dev_set_unique); | ||
772 | |||
763 | /* | 773 | /* |
764 | * DRM Core | 774 | * DRM Core |
765 | * The DRM core module initializes all global DRM objects and makes them | 775 | * The DRM core module initializes all global DRM objects and makes them |
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 4e1ae3fc462d..6be515a9fb69 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c | |||
@@ -68,6 +68,12 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, | |||
68 | 68 | ||
69 | ipu_dc_disable_channel(ipu_crtc->dc); | 69 | ipu_dc_disable_channel(ipu_crtc->dc); |
70 | ipu_di_disable(ipu_crtc->di); | 70 | ipu_di_disable(ipu_crtc->di); |
71 | /* | ||
72 | * Planes must be disabled before DC clock is removed, as otherwise the | ||
73 | * attached IDMACs will be left in undefined state, possibly hanging | ||
74 | * the IPU or even system. | ||
75 | */ | ||
76 | drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, false); | ||
71 | ipu_dc_disable(ipu); | 77 | ipu_dc_disable(ipu); |
72 | 78 | ||
73 | spin_lock_irq(&crtc->dev->event_lock); | 79 | spin_lock_irq(&crtc->dev->event_lock); |
@@ -77,9 +83,6 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, | |||
77 | } | 83 | } |
78 | spin_unlock_irq(&crtc->dev->event_lock); | 84 | spin_unlock_irq(&crtc->dev->event_lock); |
79 | 85 | ||
80 | /* always disable planes on the CRTC */ | ||
81 | drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, true); | ||
82 | |||
83 | drm_crtc_vblank_off(crtc); | 86 | drm_crtc_vblank_off(crtc); |
84 | } | 87 | } |
85 | 88 | ||
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index f05ed0e1f3d6..6f240021705b 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c | |||
@@ -139,6 +139,7 @@ struct msm_dsi_host { | |||
139 | 139 | ||
140 | u32 err_work_state; | 140 | u32 err_work_state; |
141 | struct work_struct err_work; | 141 | struct work_struct err_work; |
142 | struct work_struct hpd_work; | ||
142 | struct workqueue_struct *workqueue; | 143 | struct workqueue_struct *workqueue; |
143 | 144 | ||
144 | /* DSI 6G TX buffer*/ | 145 | /* DSI 6G TX buffer*/ |
@@ -1294,6 +1295,14 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host) | |||
1294 | wmb(); /* make sure dsi controller enabled again */ | 1295 | wmb(); /* make sure dsi controller enabled again */ |
1295 | } | 1296 | } |
1296 | 1297 | ||
1298 | static void dsi_hpd_worker(struct work_struct *work) | ||
1299 | { | ||
1300 | struct msm_dsi_host *msm_host = | ||
1301 | container_of(work, struct msm_dsi_host, hpd_work); | ||
1302 | |||
1303 | drm_helper_hpd_irq_event(msm_host->dev); | ||
1304 | } | ||
1305 | |||
1297 | static void dsi_err_worker(struct work_struct *work) | 1306 | static void dsi_err_worker(struct work_struct *work) |
1298 | { | 1307 | { |
1299 | struct msm_dsi_host *msm_host = | 1308 | struct msm_dsi_host *msm_host = |
@@ -1480,7 +1489,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host, | |||
1480 | 1489 | ||
1481 | DBG("id=%d", msm_host->id); | 1490 | DBG("id=%d", msm_host->id); |
1482 | if (msm_host->dev) | 1491 | if (msm_host->dev) |
1483 | drm_helper_hpd_irq_event(msm_host->dev); | 1492 | queue_work(msm_host->workqueue, &msm_host->hpd_work); |
1484 | 1493 | ||
1485 | return 0; | 1494 | return 0; |
1486 | } | 1495 | } |
@@ -1494,7 +1503,7 @@ static int dsi_host_detach(struct mipi_dsi_host *host, | |||
1494 | 1503 | ||
1495 | DBG("id=%d", msm_host->id); | 1504 | DBG("id=%d", msm_host->id); |
1496 | if (msm_host->dev) | 1505 | if (msm_host->dev) |
1497 | drm_helper_hpd_irq_event(msm_host->dev); | 1506 | queue_work(msm_host->workqueue, &msm_host->hpd_work); |
1498 | 1507 | ||
1499 | return 0; | 1508 | return 0; |
1500 | } | 1509 | } |
@@ -1748,6 +1757,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) | |||
1748 | /* setup workqueue */ | 1757 | /* setup workqueue */ |
1749 | msm_host->workqueue = alloc_ordered_workqueue("dsi_drm_work", 0); | 1758 | msm_host->workqueue = alloc_ordered_workqueue("dsi_drm_work", 0); |
1750 | INIT_WORK(&msm_host->err_work, dsi_err_worker); | 1759 | INIT_WORK(&msm_host->err_work, dsi_err_worker); |
1760 | INIT_WORK(&msm_host->hpd_work, dsi_hpd_worker); | ||
1751 | 1761 | ||
1752 | msm_dsi->host = &msm_host->base; | 1762 | msm_dsi->host = &msm_host->base; |
1753 | msm_dsi->id = msm_host->id; | 1763 | msm_dsi->id = msm_host->id; |
diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c index 598fdaff0a41..26e3a01a99c2 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c | |||
@@ -521,6 +521,7 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm) | |||
521 | .parent_names = (const char *[]){ "xo" }, | 521 | .parent_names = (const char *[]){ "xo" }, |
522 | .num_parents = 1, | 522 | .num_parents = 1, |
523 | .name = vco_name, | 523 | .name = vco_name, |
524 | .flags = CLK_IGNORE_UNUSED, | ||
524 | .ops = &clk_ops_dsi_pll_28nm_vco, | 525 | .ops = &clk_ops_dsi_pll_28nm_vco, |
525 | }; | 526 | }; |
526 | struct device *dev = &pll_28nm->pdev->dev; | 527 | struct device *dev = &pll_28nm->pdev->dev; |
diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c index 38c90e1eb002..49008451085b 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c | |||
@@ -412,6 +412,7 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm) | |||
412 | struct clk_init_data vco_init = { | 412 | struct clk_init_data vco_init = { |
413 | .parent_names = (const char *[]){ "pxo" }, | 413 | .parent_names = (const char *[]){ "pxo" }, |
414 | .num_parents = 1, | 414 | .num_parents = 1, |
415 | .flags = CLK_IGNORE_UNUSED, | ||
415 | .ops = &clk_ops_dsi_pll_28nm_vco, | 416 | .ops = &clk_ops_dsi_pll_28nm_vco, |
416 | }; | 417 | }; |
417 | struct device *dev = &pll_28nm->pdev->dev; | 418 | struct device *dev = &pll_28nm->pdev->dev; |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c index aa94a553794f..143eab46ba68 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | |||
@@ -702,6 +702,7 @@ static struct clk_init_data pll_init = { | |||
702 | .ops = &hdmi_8996_pll_ops, | 702 | .ops = &hdmi_8996_pll_ops, |
703 | .parent_names = hdmi_pll_parents, | 703 | .parent_names = hdmi_pll_parents, |
704 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), | 704 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), |
705 | .flags = CLK_IGNORE_UNUSED, | ||
705 | }; | 706 | }; |
706 | 707 | ||
707 | int msm_hdmi_pll_8996_init(struct platform_device *pdev) | 708 | int msm_hdmi_pll_8996_init(struct platform_device *pdev) |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c b/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c index 92da69aa6187..99590758c68b 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c | |||
@@ -424,6 +424,7 @@ static struct clk_init_data pll_init = { | |||
424 | .ops = &hdmi_pll_ops, | 424 | .ops = &hdmi_pll_ops, |
425 | .parent_names = hdmi_pll_parents, | 425 | .parent_names = hdmi_pll_parents, |
426 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), | 426 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), |
427 | .flags = CLK_IGNORE_UNUSED, | ||
427 | }; | 428 | }; |
428 | 429 | ||
429 | int msm_hdmi_pll_8960_init(struct platform_device *pdev) | 430 | int msm_hdmi_pll_8960_init(struct platform_device *pdev) |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c index ac9e4cde1380..8b4e3004f451 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c | |||
@@ -272,7 +272,7 @@ const struct mdp5_cfg_hw msm8x16_config = { | |||
272 | .count = 2, | 272 | .count = 2, |
273 | .base = { 0x14000, 0x16000 }, | 273 | .base = { 0x14000, 0x16000 }, |
274 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | | 274 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
275 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION, | 275 | MDP_PIPE_CAP_DECIMATION, |
276 | }, | 276 | }, |
277 | .pipe_dma = { | 277 | .pipe_dma = { |
278 | .count = 1, | 278 | .count = 1, |
@@ -282,7 +282,7 @@ const struct mdp5_cfg_hw msm8x16_config = { | |||
282 | .lm = { | 282 | .lm = { |
283 | .count = 2, /* LM0 and LM3 */ | 283 | .count = 2, /* LM0 and LM3 */ |
284 | .base = { 0x44000, 0x47000 }, | 284 | .base = { 0x44000, 0x47000 }, |
285 | .nb_stages = 5, | 285 | .nb_stages = 8, |
286 | .max_width = 2048, | 286 | .max_width = 2048, |
287 | .max_height = 0xFFFF, | 287 | .max_height = 0xFFFF, |
288 | }, | 288 | }, |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c index fa2be7ce9468..c205c360e16d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | |||
@@ -223,12 +223,7 @@ static void blend_setup(struct drm_crtc *crtc) | |||
223 | plane_cnt++; | 223 | plane_cnt++; |
224 | } | 224 | } |
225 | 225 | ||
226 | /* | 226 | if (!pstates[STAGE_BASE]) { |
227 | * If there is no base layer, enable border color. | ||
228 | * Although it's not possbile in current blend logic, | ||
229 | * put it here as a reminder. | ||
230 | */ | ||
231 | if (!pstates[STAGE_BASE] && plane_cnt) { | ||
232 | ctl_blend_flags |= MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT; | 227 | ctl_blend_flags |= MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT; |
233 | DBG("Border Color is enabled"); | 228 | DBG("Border Color is enabled"); |
234 | } | 229 | } |
@@ -365,6 +360,15 @@ static int pstate_cmp(const void *a, const void *b) | |||
365 | return pa->state->zpos - pb->state->zpos; | 360 | return pa->state->zpos - pb->state->zpos; |
366 | } | 361 | } |
367 | 362 | ||
363 | /* is there a helper for this? */ | ||
364 | static bool is_fullscreen(struct drm_crtc_state *cstate, | ||
365 | struct drm_plane_state *pstate) | ||
366 | { | ||
367 | return (pstate->crtc_x <= 0) && (pstate->crtc_y <= 0) && | ||
368 | ((pstate->crtc_x + pstate->crtc_w) >= cstate->mode.hdisplay) && | ||
369 | ((pstate->crtc_y + pstate->crtc_h) >= cstate->mode.vdisplay); | ||
370 | } | ||
371 | |||
368 | static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, | 372 | static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, |
369 | struct drm_crtc_state *state) | 373 | struct drm_crtc_state *state) |
370 | { | 374 | { |
@@ -375,21 +379,11 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, | |||
375 | struct plane_state pstates[STAGE_MAX + 1]; | 379 | struct plane_state pstates[STAGE_MAX + 1]; |
376 | const struct mdp5_cfg_hw *hw_cfg; | 380 | const struct mdp5_cfg_hw *hw_cfg; |
377 | const struct drm_plane_state *pstate; | 381 | const struct drm_plane_state *pstate; |
378 | int cnt = 0, i; | 382 | int cnt = 0, base = 0, i; |
379 | 383 | ||
380 | DBG("%s: check", mdp5_crtc->name); | 384 | DBG("%s: check", mdp5_crtc->name); |
381 | 385 | ||
382 | /* verify that there are not too many planes attached to crtc | ||
383 | * and that we don't have conflicting mixer stages: | ||
384 | */ | ||
385 | hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg); | ||
386 | drm_atomic_crtc_state_for_each_plane_state(plane, pstate, state) { | 386 | drm_atomic_crtc_state_for_each_plane_state(plane, pstate, state) { |
387 | if (cnt >= (hw_cfg->lm.nb_stages)) { | ||
388 | dev_err(dev->dev, "too many planes!\n"); | ||
389 | return -EINVAL; | ||
390 | } | ||
391 | |||
392 | |||
393 | pstates[cnt].plane = plane; | 387 | pstates[cnt].plane = plane; |
394 | pstates[cnt].state = to_mdp5_plane_state(pstate); | 388 | pstates[cnt].state = to_mdp5_plane_state(pstate); |
395 | 389 | ||
@@ -399,8 +393,24 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, | |||
399 | /* assign a stage based on sorted zpos property */ | 393 | /* assign a stage based on sorted zpos property */ |
400 | sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); | 394 | sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); |
401 | 395 | ||
396 | /* if the bottom-most layer is not fullscreen, we need to use | ||
397 | * it for solid-color: | ||
398 | */ | ||
399 | if ((cnt > 0) && !is_fullscreen(state, &pstates[0].state->base)) | ||
400 | base++; | ||
401 | |||
402 | /* verify that there are not too many planes attached to crtc | ||
403 | * and that we don't have conflicting mixer stages: | ||
404 | */ | ||
405 | hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg); | ||
406 | |||
407 | if ((cnt + base) >= hw_cfg->lm.nb_stages) { | ||
408 | dev_err(dev->dev, "too many planes!\n"); | ||
409 | return -EINVAL; | ||
410 | } | ||
411 | |||
402 | for (i = 0; i < cnt; i++) { | 412 | for (i = 0; i < cnt; i++) { |
403 | pstates[i].state->stage = STAGE_BASE + i; | 413 | pstates[i].state->stage = STAGE_BASE + i + base; |
404 | DBG("%s: assign pipe %s on stage=%d", mdp5_crtc->name, | 414 | DBG("%s: assign pipe %s on stage=%d", mdp5_crtc->name, |
405 | pipe2name(mdp5_plane_pipe(pstates[i].plane)), | 415 | pipe2name(mdp5_plane_pipe(pstates[i].plane)), |
406 | pstates[i].state->stage); | 416 | pstates[i].state->stage); |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 8bf55e3450c5..81c0562ab489 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | |||
@@ -307,8 +307,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, | |||
307 | format = to_mdp_format(msm_framebuffer_format(state->fb)); | 307 | format = to_mdp_format(msm_framebuffer_format(state->fb)); |
308 | if (MDP_FORMAT_IS_YUV(format) && | 308 | if (MDP_FORMAT_IS_YUV(format) && |
309 | !pipe_supports_yuv(mdp5_plane->caps)) { | 309 | !pipe_supports_yuv(mdp5_plane->caps)) { |
310 | dev_err(plane->dev->dev, | 310 | DBG("Pipe doesn't support YUV\n"); |
311 | "Pipe doesn't support YUV\n"); | ||
312 | 311 | ||
313 | return -EINVAL; | 312 | return -EINVAL; |
314 | } | 313 | } |
@@ -316,8 +315,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, | |||
316 | if (!(mdp5_plane->caps & MDP_PIPE_CAP_SCALE) && | 315 | if (!(mdp5_plane->caps & MDP_PIPE_CAP_SCALE) && |
317 | (((state->src_w >> 16) != state->crtc_w) || | 316 | (((state->src_w >> 16) != state->crtc_w) || |
318 | ((state->src_h >> 16) != state->crtc_h))) { | 317 | ((state->src_h >> 16) != state->crtc_h))) { |
319 | dev_err(plane->dev->dev, | 318 | DBG("Pipe doesn't support scaling (%dx%d -> %dx%d)\n", |
320 | "Pipe doesn't support scaling (%dx%d -> %dx%d)\n", | ||
321 | state->src_w >> 16, state->src_h >> 16, | 319 | state->src_w >> 16, state->src_h >> 16, |
322 | state->crtc_w, state->crtc_h); | 320 | state->crtc_w, state->crtc_h); |
323 | 321 | ||
@@ -333,8 +331,7 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, | |||
333 | 331 | ||
334 | if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) || | 332 | if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) || |
335 | (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) { | 333 | (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) { |
336 | dev_err(plane->dev->dev, | 334 | DBG("Pipe doesn't support flip\n"); |
337 | "Pipe doesn't support flip\n"); | ||
338 | 335 | ||
339 | return -EINVAL; | 336 | return -EINVAL; |
340 | } | 337 | } |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 8d21fb27a401..440c00ff8409 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -234,7 +234,7 @@ static int msm_drm_uninit(struct device *dev) | |||
234 | flush_workqueue(priv->atomic_wq); | 234 | flush_workqueue(priv->atomic_wq); |
235 | destroy_workqueue(priv->atomic_wq); | 235 | destroy_workqueue(priv->atomic_wq); |
236 | 236 | ||
237 | if (kms) | 237 | if (kms && kms->funcs) |
238 | kms->funcs->destroy(kms); | 238 | kms->funcs->destroy(kms); |
239 | 239 | ||
240 | if (gpu) { | 240 | if (gpu) { |
diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c b/drivers/gpu/drm/msm/msm_gem_shrinker.c index 283d2841ba58..192b2d3a79cb 100644 --- a/drivers/gpu/drm/msm/msm_gem_shrinker.c +++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c | |||
@@ -163,6 +163,9 @@ void msm_gem_shrinker_init(struct drm_device *dev) | |||
163 | void msm_gem_shrinker_cleanup(struct drm_device *dev) | 163 | void msm_gem_shrinker_cleanup(struct drm_device *dev) |
164 | { | 164 | { |
165 | struct msm_drm_private *priv = dev->dev_private; | 165 | struct msm_drm_private *priv = dev->dev_private; |
166 | WARN_ON(unregister_vmap_purge_notifier(&priv->vmap_notifier)); | 166 | |
167 | unregister_shrinker(&priv->shrinker); | 167 | if (priv->shrinker.nr_deferred) { |
168 | WARN_ON(unregister_vmap_purge_notifier(&priv->vmap_notifier)); | ||
169 | unregister_shrinker(&priv->shrinker); | ||
170 | } | ||
168 | } | 171 | } |
diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index 04270f5d110c..74fc9362ecf9 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c | |||
@@ -578,7 +578,7 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev, | |||
578 | return 0; | 578 | return 0; |
579 | } | 579 | } |
580 | 580 | ||
581 | int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf) | 581 | static int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf) |
582 | { | 582 | { |
583 | struct qxl_rect rect; | 583 | struct qxl_rect rect; |
584 | int ret; | 584 | int ret; |
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index a61c0d460ec2..4b5eab8a47b3 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c | |||
@@ -36,7 +36,7 @@ static bool qxl_head_enabled(struct qxl_head *head) | |||
36 | return head->width && head->height; | 36 | return head->width && head->height; |
37 | } | 37 | } |
38 | 38 | ||
39 | void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count) | 39 | static void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count) |
40 | { | 40 | { |
41 | if (qdev->client_monitors_config && | 41 | if (qdev->client_monitors_config && |
42 | count > qdev->client_monitors_config->count) { | 42 | count > qdev->client_monitors_config->count) { |
@@ -57,11 +57,18 @@ void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count) | |||
57 | qdev->client_monitors_config->count = count; | 57 | qdev->client_monitors_config->count = count; |
58 | } | 58 | } |
59 | 59 | ||
60 | enum { | ||
61 | MONITORS_CONFIG_MODIFIED, | ||
62 | MONITORS_CONFIG_UNCHANGED, | ||
63 | MONITORS_CONFIG_BAD_CRC, | ||
64 | }; | ||
65 | |||
60 | static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) | 66 | static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) |
61 | { | 67 | { |
62 | int i; | 68 | int i; |
63 | int num_monitors; | 69 | int num_monitors; |
64 | uint32_t crc; | 70 | uint32_t crc; |
71 | int status = MONITORS_CONFIG_UNCHANGED; | ||
65 | 72 | ||
66 | num_monitors = qdev->rom->client_monitors_config.count; | 73 | num_monitors = qdev->rom->client_monitors_config.count; |
67 | crc = crc32(0, (const uint8_t *)&qdev->rom->client_monitors_config, | 74 | crc = crc32(0, (const uint8_t *)&qdev->rom->client_monitors_config, |
@@ -70,7 +77,7 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) | |||
70 | qxl_io_log(qdev, "crc mismatch: have %X (%zd) != %X\n", crc, | 77 | qxl_io_log(qdev, "crc mismatch: have %X (%zd) != %X\n", crc, |
71 | sizeof(qdev->rom->client_monitors_config), | 78 | sizeof(qdev->rom->client_monitors_config), |
72 | qdev->rom->client_monitors_config_crc); | 79 | qdev->rom->client_monitors_config_crc); |
73 | return 1; | 80 | return MONITORS_CONFIG_BAD_CRC; |
74 | } | 81 | } |
75 | if (num_monitors > qdev->monitors_config->max_allowed) { | 82 | if (num_monitors > qdev->monitors_config->max_allowed) { |
76 | DRM_DEBUG_KMS("client monitors list will be truncated: %d < %d\n", | 83 | DRM_DEBUG_KMS("client monitors list will be truncated: %d < %d\n", |
@@ -79,6 +86,10 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) | |||
79 | } else { | 86 | } else { |
80 | num_monitors = qdev->rom->client_monitors_config.count; | 87 | num_monitors = qdev->rom->client_monitors_config.count; |
81 | } | 88 | } |
89 | if (qdev->client_monitors_config | ||
90 | && (num_monitors != qdev->client_monitors_config->count)) { | ||
91 | status = MONITORS_CONFIG_MODIFIED; | ||
92 | } | ||
82 | qxl_alloc_client_monitors_config(qdev, num_monitors); | 93 | qxl_alloc_client_monitors_config(qdev, num_monitors); |
83 | /* we copy max from the client but it isn't used */ | 94 | /* we copy max from the client but it isn't used */ |
84 | qdev->client_monitors_config->max_allowed = | 95 | qdev->client_monitors_config->max_allowed = |
@@ -88,17 +99,39 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) | |||
88 | &qdev->rom->client_monitors_config.heads[i]; | 99 | &qdev->rom->client_monitors_config.heads[i]; |
89 | struct qxl_head *client_head = | 100 | struct qxl_head *client_head = |
90 | &qdev->client_monitors_config->heads[i]; | 101 | &qdev->client_monitors_config->heads[i]; |
91 | client_head->x = c_rect->left; | 102 | if (client_head->x != c_rect->left) { |
92 | client_head->y = c_rect->top; | 103 | client_head->x = c_rect->left; |
93 | client_head->width = c_rect->right - c_rect->left; | 104 | status = MONITORS_CONFIG_MODIFIED; |
94 | client_head->height = c_rect->bottom - c_rect->top; | 105 | } |
95 | client_head->surface_id = 0; | 106 | if (client_head->y != c_rect->top) { |
96 | client_head->id = i; | 107 | client_head->y = c_rect->top; |
97 | client_head->flags = 0; | 108 | status = MONITORS_CONFIG_MODIFIED; |
109 | } | ||
110 | if (client_head->width != c_rect->right - c_rect->left) { | ||
111 | client_head->width = c_rect->right - c_rect->left; | ||
112 | status = MONITORS_CONFIG_MODIFIED; | ||
113 | } | ||
114 | if (client_head->height != c_rect->bottom - c_rect->top) { | ||
115 | client_head->height = c_rect->bottom - c_rect->top; | ||
116 | status = MONITORS_CONFIG_MODIFIED; | ||
117 | } | ||
118 | if (client_head->surface_id != 0) { | ||
119 | client_head->surface_id = 0; | ||
120 | status = MONITORS_CONFIG_MODIFIED; | ||
121 | } | ||
122 | if (client_head->id != i) { | ||
123 | client_head->id = i; | ||
124 | status = MONITORS_CONFIG_MODIFIED; | ||
125 | } | ||
126 | if (client_head->flags != 0) { | ||
127 | client_head->flags = 0; | ||
128 | status = MONITORS_CONFIG_MODIFIED; | ||
129 | } | ||
98 | DRM_DEBUG_KMS("read %dx%d+%d+%d\n", client_head->width, client_head->height, | 130 | DRM_DEBUG_KMS("read %dx%d+%d+%d\n", client_head->width, client_head->height, |
99 | client_head->x, client_head->y); | 131 | client_head->x, client_head->y); |
100 | } | 132 | } |
101 | return 0; | 133 | |
134 | return status; | ||
102 | } | 135 | } |
103 | 136 | ||
104 | static void qxl_update_offset_props(struct qxl_device *qdev) | 137 | static void qxl_update_offset_props(struct qxl_device *qdev) |
@@ -124,9 +157,18 @@ void qxl_display_read_client_monitors_config(struct qxl_device *qdev) | |||
124 | { | 157 | { |
125 | 158 | ||
126 | struct drm_device *dev = qdev->ddev; | 159 | struct drm_device *dev = qdev->ddev; |
127 | while (qxl_display_copy_rom_client_monitors_config(qdev)) { | 160 | int status; |
161 | |||
162 | status = qxl_display_copy_rom_client_monitors_config(qdev); | ||
163 | while (status == MONITORS_CONFIG_BAD_CRC) { | ||
128 | qxl_io_log(qdev, "failed crc check for client_monitors_config," | 164 | qxl_io_log(qdev, "failed crc check for client_monitors_config," |
129 | " retrying\n"); | 165 | " retrying\n"); |
166 | status = qxl_display_copy_rom_client_monitors_config(qdev); | ||
167 | } | ||
168 | if (status == MONITORS_CONFIG_UNCHANGED) { | ||
169 | qxl_io_log(qdev, "config unchanged\n"); | ||
170 | DRM_DEBUG("ignoring unchanged client monitors config"); | ||
171 | return; | ||
130 | } | 172 | } |
131 | 173 | ||
132 | drm_modeset_lock_all(dev); | 174 | drm_modeset_lock_all(dev); |
@@ -157,6 +199,9 @@ static int qxl_add_monitors_config_modes(struct drm_connector *connector, | |||
157 | mode = drm_cvt_mode(dev, head->width, head->height, 60, false, false, | 199 | mode = drm_cvt_mode(dev, head->width, head->height, 60, false, false, |
158 | false); | 200 | false); |
159 | mode->type |= DRM_MODE_TYPE_PREFERRED; | 201 | mode->type |= DRM_MODE_TYPE_PREFERRED; |
202 | mode->hdisplay = head->width; | ||
203 | mode->vdisplay = head->height; | ||
204 | drm_mode_set_name(mode); | ||
160 | *pwidth = head->width; | 205 | *pwidth = head->width; |
161 | *pheight = head->height; | 206 | *pheight = head->height; |
162 | drm_mode_probed_add(connector, mode); | 207 | drm_mode_probed_add(connector, mode); |
@@ -607,7 +652,7 @@ static bool qxl_crtc_mode_fixup(struct drm_crtc *crtc, | |||
607 | return true; | 652 | return true; |
608 | } | 653 | } |
609 | 654 | ||
610 | void | 655 | static void |
611 | qxl_send_monitors_config(struct qxl_device *qdev) | 656 | qxl_send_monitors_config(struct qxl_device *qdev) |
612 | { | 657 | { |
613 | int i; | 658 | int i; |
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 84995ebc6ffc..785aad42e9bb 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h | |||
@@ -395,16 +395,11 @@ qxl_framebuffer_init(struct drm_device *dev, | |||
395 | struct drm_gem_object *obj, | 395 | struct drm_gem_object *obj, |
396 | const struct drm_framebuffer_funcs *funcs); | 396 | const struct drm_framebuffer_funcs *funcs); |
397 | void qxl_display_read_client_monitors_config(struct qxl_device *qdev); | 397 | void qxl_display_read_client_monitors_config(struct qxl_device *qdev); |
398 | void qxl_send_monitors_config(struct qxl_device *qdev); | ||
399 | int qxl_create_monitors_object(struct qxl_device *qdev); | 398 | int qxl_create_monitors_object(struct qxl_device *qdev); |
400 | int qxl_destroy_monitors_object(struct qxl_device *qdev); | 399 | int qxl_destroy_monitors_object(struct qxl_device *qdev); |
401 | 400 | ||
402 | /* used by qxl_debugfs only */ | ||
403 | void qxl_crtc_set_from_monitors_config(struct qxl_device *qdev); | ||
404 | void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count); | ||
405 | |||
406 | /* qxl_gem.c */ | 401 | /* qxl_gem.c */ |
407 | int qxl_gem_init(struct qxl_device *qdev); | 402 | void qxl_gem_init(struct qxl_device *qdev); |
408 | void qxl_gem_fini(struct qxl_device *qdev); | 403 | void qxl_gem_fini(struct qxl_device *qdev); |
409 | int qxl_gem_object_create(struct qxl_device *qdev, int size, | 404 | int qxl_gem_object_create(struct qxl_device *qdev, int size, |
410 | int alignment, int initial_domain, | 405 | int alignment, int initial_domain, |
@@ -574,6 +569,5 @@ int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo); | |||
574 | struct qxl_drv_surface * | 569 | struct qxl_drv_surface * |
575 | qxl_surface_lookup(struct drm_device *dev, int surface_id); | 570 | qxl_surface_lookup(struct drm_device *dev, int surface_id); |
576 | void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool freeing); | 571 | void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool freeing); |
577 | int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf); | ||
578 | 572 | ||
579 | #endif | 573 | #endif |
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c index 7e305d8a4146..fd7e5e94be5b 100644 --- a/drivers/gpu/drm/qxl/qxl_fb.c +++ b/drivers/gpu/drm/qxl/qxl_fb.c | |||
@@ -191,7 +191,7 @@ static int qxlfb_framebuffer_dirty(struct drm_framebuffer *fb, | |||
191 | /* | 191 | /* |
192 | * we are using a shadow draw buffer, at qdev->surface0_shadow | 192 | * we are using a shadow draw buffer, at qdev->surface0_shadow |
193 | */ | 193 | */ |
194 | qxl_io_log(qdev, "dirty x[%d, %d], y[%d, %d]", clips->x1, clips->x2, | 194 | qxl_io_log(qdev, "dirty x[%d, %d], y[%d, %d]\n", clips->x1, clips->x2, |
195 | clips->y1, clips->y2); | 195 | clips->y1, clips->y2); |
196 | image->dx = clips->x1; | 196 | image->dx = clips->x1; |
197 | image->dy = clips->y1; | 197 | image->dy = clips->y1; |
diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c index d9746e904ef1..3f185c4da5b7 100644 --- a/drivers/gpu/drm/qxl/qxl_gem.c +++ b/drivers/gpu/drm/qxl/qxl_gem.c | |||
@@ -111,10 +111,9 @@ void qxl_gem_object_close(struct drm_gem_object *obj, | |||
111 | { | 111 | { |
112 | } | 112 | } |
113 | 113 | ||
114 | int qxl_gem_init(struct qxl_device *qdev) | 114 | void qxl_gem_init(struct qxl_device *qdev) |
115 | { | 115 | { |
116 | INIT_LIST_HEAD(&qdev->gem.objects); | 116 | INIT_LIST_HEAD(&qdev->gem.objects); |
117 | return 0; | ||
118 | } | 117 | } |
119 | 118 | ||
120 | void qxl_gem_fini(struct qxl_device *qdev) | 119 | void qxl_gem_fini(struct qxl_device *qdev) |
diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index e642242728c0..af685f1d91f8 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c | |||
@@ -131,7 +131,7 @@ static int qxl_device_init(struct qxl_device *qdev, | |||
131 | mutex_init(&qdev->update_area_mutex); | 131 | mutex_init(&qdev->update_area_mutex); |
132 | mutex_init(&qdev->release_mutex); | 132 | mutex_init(&qdev->release_mutex); |
133 | mutex_init(&qdev->surf_evict_mutex); | 133 | mutex_init(&qdev->surf_evict_mutex); |
134 | INIT_LIST_HEAD(&qdev->gem.objects); | 134 | qxl_gem_init(qdev); |
135 | 135 | ||
136 | qdev->rom_base = pci_resource_start(pdev, 2); | 136 | qdev->rom_base = pci_resource_start(pdev, 2); |
137 | qdev->rom_size = pci_resource_len(pdev, 2); | 137 | qdev->rom_size = pci_resource_len(pdev, 2); |
@@ -273,6 +273,7 @@ static void qxl_device_fini(struct qxl_device *qdev) | |||
273 | qxl_ring_free(qdev->command_ring); | 273 | qxl_ring_free(qdev->command_ring); |
274 | qxl_ring_free(qdev->cursor_ring); | 274 | qxl_ring_free(qdev->cursor_ring); |
275 | qxl_ring_free(qdev->release_ring); | 275 | qxl_ring_free(qdev->release_ring); |
276 | qxl_gem_fini(qdev); | ||
276 | qxl_bo_fini(qdev); | 277 | qxl_bo_fini(qdev); |
277 | io_mapping_free(qdev->surface_mapping); | 278 | io_mapping_free(qdev->surface_mapping); |
278 | io_mapping_free(qdev->vram_mapping); | 279 | io_mapping_free(qdev->vram_mapping); |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index e18839d52e3e..27affbde058c 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -931,7 +931,7 @@ static void radeon_connector_unregister(struct drm_connector *connector) | |||
931 | { | 931 | { |
932 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 932 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
933 | 933 | ||
934 | if (radeon_connector->ddc_bus->has_aux) { | 934 | if (radeon_connector->ddc_bus && radeon_connector->ddc_bus->has_aux) { |
935 | drm_dp_aux_unregister(&radeon_connector->ddc_bus->aux); | 935 | drm_dp_aux_unregister(&radeon_connector->ddc_bus->aux); |
936 | radeon_connector->ddc_bus->has_aux = false; | 936 | radeon_connector->ddc_bus->has_aux = false; |
937 | } | 937 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 0be8d5cd7826..60a8920fa0b9 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -104,6 +104,14 @@ static const char radeon_family_name[][16] = { | |||
104 | "LAST", | 104 | "LAST", |
105 | }; | 105 | }; |
106 | 106 | ||
107 | #if defined(CONFIG_VGA_SWITCHEROO) | ||
108 | bool radeon_has_atpx_dgpu_power_cntl(void); | ||
109 | bool radeon_is_atpx_hybrid(void); | ||
110 | #else | ||
111 | static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; } | ||
112 | static inline bool radeon_is_atpx_hybrid(void) { return false; } | ||
113 | #endif | ||
114 | |||
107 | #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) | 115 | #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) |
108 | #define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1) | 116 | #define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1) |
109 | 117 | ||
@@ -160,6 +168,11 @@ static void radeon_device_handle_px_quirks(struct radeon_device *rdev) | |||
160 | 168 | ||
161 | if (rdev->px_quirk_flags & RADEON_PX_QUIRK_DISABLE_PX) | 169 | if (rdev->px_quirk_flags & RADEON_PX_QUIRK_DISABLE_PX) |
162 | rdev->flags &= ~RADEON_IS_PX; | 170 | rdev->flags &= ~RADEON_IS_PX; |
171 | |||
172 | /* disable PX is the system doesn't support dGPU power control or hybrid gfx */ | ||
173 | if (!radeon_is_atpx_hybrid() && | ||
174 | !radeon_has_atpx_dgpu_power_cntl()) | ||
175 | rdev->flags &= ~RADEON_IS_PX; | ||
163 | } | 176 | } |
164 | 177 | ||
165 | /** | 178 | /** |
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 29f0207fa677..873f010d9616 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c | |||
@@ -98,17 +98,23 @@ success: | |||
98 | static int udl_select_std_channel(struct udl_device *udl) | 98 | static int udl_select_std_channel(struct udl_device *udl) |
99 | { | 99 | { |
100 | int ret; | 100 | int ret; |
101 | u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7, | 101 | static const u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7, |
102 | 0x1C, 0x88, 0x5E, 0x15, | 102 | 0x1C, 0x88, 0x5E, 0x15, |
103 | 0x60, 0xFE, 0xC6, 0x97, | 103 | 0x60, 0xFE, 0xC6, 0x97, |
104 | 0x16, 0x3D, 0x47, 0xF2}; | 104 | 0x16, 0x3D, 0x47, 0xF2}; |
105 | void *sendbuf; | ||
106 | |||
107 | sendbuf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL); | ||
108 | if (!sendbuf) | ||
109 | return -ENOMEM; | ||
105 | 110 | ||
106 | ret = usb_control_msg(udl->udev, | 111 | ret = usb_control_msg(udl->udev, |
107 | usb_sndctrlpipe(udl->udev, 0), | 112 | usb_sndctrlpipe(udl->udev, 0), |
108 | NR_USB_REQUEST_CHANNEL, | 113 | NR_USB_REQUEST_CHANNEL, |
109 | (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0, | 114 | (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0, |
110 | set_def_chn, sizeof(set_def_chn), | 115 | sendbuf, sizeof(set_def_chn), |
111 | USB_CTRL_SET_TIMEOUT); | 116 | USB_CTRL_SET_TIMEOUT); |
117 | kfree(sendbuf); | ||
112 | return ret < 0 ? ret : 0; | 118 | return ret < 0 ? ret : 0; |
113 | } | 119 | } |
114 | 120 | ||
diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c index 49e5996cb9f2..3b97d50fd392 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c +++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c | |||
@@ -28,16 +28,6 @@ | |||
28 | 28 | ||
29 | #include "virtgpu_drv.h" | 29 | #include "virtgpu_drv.h" |
30 | 30 | ||
31 | int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) | ||
32 | { | ||
33 | struct pci_dev *pdev = dev->pdev; | ||
34 | |||
35 | if (pdev) { | ||
36 | return drm_pci_set_busid(dev, master); | ||
37 | } | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) | 31 | static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) |
42 | { | 32 | { |
43 | struct apertures_struct *ap; | 33 | struct apertures_struct *ap; |
@@ -71,13 +61,22 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) | |||
71 | 61 | ||
72 | if (strcmp(vdev->dev.parent->bus->name, "pci") == 0) { | 62 | if (strcmp(vdev->dev.parent->bus->name, "pci") == 0) { |
73 | struct pci_dev *pdev = to_pci_dev(vdev->dev.parent); | 63 | struct pci_dev *pdev = to_pci_dev(vdev->dev.parent); |
64 | const char *pname = dev_name(&pdev->dev); | ||
74 | bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA; | 65 | bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA; |
66 | char unique[20]; | ||
75 | 67 | ||
76 | DRM_INFO("pci: %s detected\n", | 68 | DRM_INFO("pci: %s detected at %s\n", |
77 | vga ? "virtio-vga" : "virtio-gpu-pci"); | 69 | vga ? "virtio-vga" : "virtio-gpu-pci", |
70 | pname); | ||
78 | dev->pdev = pdev; | 71 | dev->pdev = pdev; |
79 | if (vga) | 72 | if (vga) |
80 | virtio_pci_kick_out_firmware_fb(pdev); | 73 | virtio_pci_kick_out_firmware_fb(pdev); |
74 | |||
75 | snprintf(unique, sizeof(unique), "pci:%s", pname); | ||
76 | ret = drm_dev_set_unique(dev, unique); | ||
77 | if (ret) | ||
78 | goto err_free; | ||
79 | |||
81 | } | 80 | } |
82 | 81 | ||
83 | ret = drm_dev_register(dev, 0); | 82 | ret = drm_dev_register(dev, 0); |
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index 04d98db75c64..d82489815096 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c | |||
@@ -115,7 +115,6 @@ static const struct file_operations virtio_gpu_driver_fops = { | |||
115 | 115 | ||
116 | static struct drm_driver driver = { | 116 | static struct drm_driver driver = { |
117 | .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER | DRIVER_ATOMIC, | 117 | .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER | DRIVER_ATOMIC, |
118 | .set_busid = drm_virtio_set_busid, | ||
119 | .load = virtio_gpu_driver_load, | 118 | .load = virtio_gpu_driver_load, |
120 | .unload = virtio_gpu_driver_unload, | 119 | .unload = virtio_gpu_driver_unload, |
121 | .open = virtio_gpu_driver_open, | 120 | .open = virtio_gpu_driver_open, |
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index ec1ebdcfe80b..08906c8ce3fa 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h | |||
@@ -49,7 +49,6 @@ | |||
49 | #define DRIVER_PATCHLEVEL 1 | 49 | #define DRIVER_PATCHLEVEL 1 |
50 | 50 | ||
51 | /* virtgpu_drm_bus.c */ | 51 | /* virtgpu_drm_bus.c */ |
52 | int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master); | ||
53 | int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev); | 52 | int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev); |
54 | 53 | ||
55 | struct virtio_gpu_object { | 54 | struct virtio_gpu_object { |
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index 5a0f8a745b9d..974f9410474b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c | |||
@@ -75,7 +75,7 @@ void virtio_gpu_cursor_ack(struct virtqueue *vq) | |||
75 | int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev) | 75 | int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev) |
76 | { | 76 | { |
77 | struct virtio_gpu_vbuffer *vbuf; | 77 | struct virtio_gpu_vbuffer *vbuf; |
78 | int i, size, count = 0; | 78 | int i, size, count = 16; |
79 | void *ptr; | 79 | void *ptr; |
80 | 80 | ||
81 | INIT_LIST_HEAD(&vgdev->free_vbufs); | 81 | INIT_LIST_HEAD(&vgdev->free_vbufs); |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 6cfb5cacc253..575aa65436d1 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -179,6 +179,7 @@ | |||
179 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | 179 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 |
180 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | 180 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 |
181 | #define USB_DEVICE_ID_ATEN_CS682 0x2213 | 181 | #define USB_DEVICE_ID_ATEN_CS682 0x2213 |
182 | #define USB_DEVICE_ID_ATEN_CS692 0x8021 | ||
182 | 183 | ||
183 | #define USB_VENDOR_ID_ATMEL 0x03eb | 184 | #define USB_VENDOR_ID_ATMEL 0x03eb |
184 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 185 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index 5614fee82347..3a84aaf1418b 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c | |||
@@ -292,11 +292,11 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr, | |||
292 | bool input = false; | 292 | bool input = false; |
293 | int value = 0; | 293 | int value = 0; |
294 | 294 | ||
295 | if (sscanf(attr->attr.name, "feature-%d-%x-%s", &index, &usage, | 295 | if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage, |
296 | name) == 3) { | 296 | name) == 3) { |
297 | feature = true; | 297 | feature = true; |
298 | field_index = index + sensor_inst->input_field_count; | 298 | field_index = index + sensor_inst->input_field_count; |
299 | } else if (sscanf(attr->attr.name, "input-%d-%x-%s", &index, &usage, | 299 | } else if (sscanf(attr->attr.name, "input-%x-%x-%s", &index, &usage, |
300 | name) == 3) { | 300 | name) == 3) { |
301 | input = true; | 301 | input = true; |
302 | field_index = index; | 302 | field_index = index; |
@@ -398,7 +398,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, | |||
398 | char name[HID_CUSTOM_NAME_LENGTH]; | 398 | char name[HID_CUSTOM_NAME_LENGTH]; |
399 | int value; | 399 | int value; |
400 | 400 | ||
401 | if (sscanf(attr->attr.name, "feature-%d-%x-%s", &index, &usage, | 401 | if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage, |
402 | name) == 3) { | 402 | name) == 3) { |
403 | field_index = index + sensor_inst->input_field_count; | 403 | field_index = index + sensor_inst->input_field_count; |
404 | } else | 404 | } else |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 658a607dc6d9..c5c3d6111729 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -251,6 +251,9 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, | |||
251 | struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); | 251 | struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); |
252 | int report_size; | 252 | int report_size; |
253 | int ret = 0; | 253 | int ret = 0; |
254 | u8 *val_ptr; | ||
255 | int buffer_index = 0; | ||
256 | int i; | ||
254 | 257 | ||
255 | mutex_lock(&data->mutex); | 258 | mutex_lock(&data->mutex); |
256 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); | 259 | 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, | |||
271 | goto done_proc; | 274 | goto done_proc; |
272 | } | 275 | } |
273 | ret = min(report_size, buffer_size); | 276 | ret = min(report_size, buffer_size); |
274 | memcpy(buffer, report->field[field_index]->value, ret); | 277 | |
278 | val_ptr = (u8 *)report->field[field_index]->value; | ||
279 | for (i = 0; i < report->field[field_index]->report_count; ++i) { | ||
280 | if (buffer_index >= ret) | ||
281 | break; | ||
282 | |||
283 | memcpy(&((u8 *)buffer)[buffer_index], val_ptr, | ||
284 | report->field[field_index]->report_size / 8); | ||
285 | val_ptr += sizeof(__s32); | ||
286 | buffer_index += (report->field[field_index]->report_size / 8); | ||
287 | } | ||
275 | 288 | ||
276 | done_proc: | 289 | done_proc: |
277 | mutex_unlock(&data->mutex); | 290 | mutex_unlock(&data->mutex); |
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c index e2517c11e0ee..0c9ac4d5d850 100644 --- a/drivers/hid/intel-ish-hid/ipc/ipc.c +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c | |||
@@ -638,6 +638,58 @@ eoi: | |||
638 | } | 638 | } |
639 | 639 | ||
640 | /** | 640 | /** |
641 | * ish_disable_dma() - disable dma communication between host and ISHFW | ||
642 | * @dev: ishtp device pointer | ||
643 | * | ||
644 | * Clear the dma enable bit and wait for dma inactive. | ||
645 | * | ||
646 | * Return: 0 for success else error code. | ||
647 | */ | ||
648 | static int ish_disable_dma(struct ishtp_device *dev) | ||
649 | { | ||
650 | unsigned int dma_delay; | ||
651 | |||
652 | /* Clear the dma enable bit */ | ||
653 | ish_reg_write(dev, IPC_REG_ISH_RMP2, 0); | ||
654 | |||
655 | /* wait for dma inactive */ | ||
656 | for (dma_delay = 0; dma_delay < MAX_DMA_DELAY && | ||
657 | _ish_read_fw_sts_reg(dev) & (IPC_ISH_IN_DMA); | ||
658 | dma_delay += 5) | ||
659 | mdelay(5); | ||
660 | |||
661 | if (dma_delay >= MAX_DMA_DELAY) { | ||
662 | dev_err(dev->devc, | ||
663 | "Wait for DMA inactive timeout\n"); | ||
664 | return -EBUSY; | ||
665 | } | ||
666 | |||
667 | return 0; | ||
668 | } | ||
669 | |||
670 | /** | ||
671 | * ish_wakeup() - wakeup ishfw from waiting-for-host state | ||
672 | * @dev: ishtp device pointer | ||
673 | * | ||
674 | * Set the dma enable bit and send a void message to FW, | ||
675 | * it wil wakeup FW from waiting-for-host state. | ||
676 | */ | ||
677 | static void ish_wakeup(struct ishtp_device *dev) | ||
678 | { | ||
679 | /* Set dma enable bit */ | ||
680 | ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED); | ||
681 | |||
682 | /* | ||
683 | * Send 0 IPC message so that ISH FW wakes up if it was already | ||
684 | * asleep. | ||
685 | */ | ||
686 | ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT); | ||
687 | |||
688 | /* Flush writes to doorbell and REMAP2 */ | ||
689 | ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS); | ||
690 | } | ||
691 | |||
692 | /** | ||
641 | * _ish_hw_reset() - HW reset | 693 | * _ish_hw_reset() - HW reset |
642 | * @dev: ishtp device pointer | 694 | * @dev: ishtp device pointer |
643 | * | 695 | * |
@@ -649,7 +701,6 @@ static int _ish_hw_reset(struct ishtp_device *dev) | |||
649 | { | 701 | { |
650 | struct pci_dev *pdev = dev->pdev; | 702 | struct pci_dev *pdev = dev->pdev; |
651 | int rv; | 703 | int rv; |
652 | unsigned int dma_delay; | ||
653 | uint16_t csr; | 704 | uint16_t csr; |
654 | 705 | ||
655 | if (!pdev) | 706 | if (!pdev) |
@@ -664,15 +715,8 @@ static int _ish_hw_reset(struct ishtp_device *dev) | |||
664 | return -EINVAL; | 715 | return -EINVAL; |
665 | } | 716 | } |
666 | 717 | ||
667 | /* Now trigger reset to FW */ | 718 | /* Disable dma communication between FW and host */ |
668 | ish_reg_write(dev, IPC_REG_ISH_RMP2, 0); | 719 | if (ish_disable_dma(dev)) { |
669 | |||
670 | for (dma_delay = 0; dma_delay < MAX_DMA_DELAY && | ||
671 | _ish_read_fw_sts_reg(dev) & (IPC_ISH_IN_DMA); | ||
672 | dma_delay += 5) | ||
673 | mdelay(5); | ||
674 | |||
675 | if (dma_delay >= MAX_DMA_DELAY) { | ||
676 | dev_err(&pdev->dev, | 720 | dev_err(&pdev->dev, |
677 | "Can't reset - stuck with DMA in-progress\n"); | 721 | "Can't reset - stuck with DMA in-progress\n"); |
678 | return -EBUSY; | 722 | return -EBUSY; |
@@ -690,16 +734,8 @@ static int _ish_hw_reset(struct ishtp_device *dev) | |||
690 | csr |= PCI_D0; | 734 | csr |= PCI_D0; |
691 | pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr); | 735 | pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr); |
692 | 736 | ||
693 | ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED); | 737 | /* Now we can enable ISH DMA operation and wakeup ISHFW */ |
694 | 738 | ish_wakeup(dev); | |
695 | /* | ||
696 | * Send 0 IPC message so that ISH FW wakes up if it was already | ||
697 | * asleep | ||
698 | */ | ||
699 | ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT); | ||
700 | |||
701 | /* Flush writes to doorbell and REMAP2 */ | ||
702 | ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS); | ||
703 | 739 | ||
704 | return 0; | 740 | return 0; |
705 | } | 741 | } |
@@ -758,16 +794,9 @@ static int _ish_ipc_reset(struct ishtp_device *dev) | |||
758 | int ish_hw_start(struct ishtp_device *dev) | 794 | int ish_hw_start(struct ishtp_device *dev) |
759 | { | 795 | { |
760 | ish_set_host_rdy(dev); | 796 | ish_set_host_rdy(dev); |
761 | /* After that we can enable ISH DMA operation */ | ||
762 | ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED); | ||
763 | 797 | ||
764 | /* | 798 | /* After that we can enable ISH DMA operation and wakeup ISHFW */ |
765 | * Send 0 IPC message so that ISH FW wakes up if it was already | 799 | ish_wakeup(dev); |
766 | * asleep | ||
767 | */ | ||
768 | ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT); | ||
769 | /* Flush write to doorbell */ | ||
770 | ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS); | ||
771 | 800 | ||
772 | set_host_ready(dev); | 801 | set_host_ready(dev); |
773 | 802 | ||
@@ -876,6 +905,21 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev) | |||
876 | */ | 905 | */ |
877 | void ish_device_disable(struct ishtp_device *dev) | 906 | void ish_device_disable(struct ishtp_device *dev) |
878 | { | 907 | { |
908 | struct pci_dev *pdev = dev->pdev; | ||
909 | |||
910 | if (!pdev) | ||
911 | return; | ||
912 | |||
913 | /* Disable dma communication between FW and host */ | ||
914 | if (ish_disable_dma(dev)) { | ||
915 | dev_err(&pdev->dev, | ||
916 | "Can't reset - stuck with DMA in-progress\n"); | ||
917 | return; | ||
918 | } | ||
919 | |||
920 | /* Put ISH to D3hot state for power saving */ | ||
921 | pci_set_power_state(pdev, PCI_D3hot); | ||
922 | |||
879 | dev->dev_state = ISHTP_DEV_DISABLED; | 923 | dev->dev_state = ISHTP_DEV_DISABLED; |
880 | ish_clr_host_rdy(dev); | 924 | ish_clr_host_rdy(dev); |
881 | } | 925 | } |
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index 42f0beeb09fd..20d647d2dd2c 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c | |||
@@ -146,7 +146,7 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
146 | pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3; | 146 | pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3; |
147 | 147 | ||
148 | /* request and enable interrupt */ | 148 | /* request and enable interrupt */ |
149 | ret = request_irq(pdev->irq, ish_irq_handler, IRQF_NO_SUSPEND, | 149 | ret = request_irq(pdev->irq, ish_irq_handler, IRQF_SHARED, |
150 | KBUILD_MODNAME, dev); | 150 | KBUILD_MODNAME, dev); |
151 | if (ret) { | 151 | if (ret) { |
152 | dev_err(&pdev->dev, "ISH: request IRQ failure (%d)\n", | 152 | dev_err(&pdev->dev, "ISH: request IRQ failure (%d)\n", |
@@ -202,6 +202,7 @@ static void ish_remove(struct pci_dev *pdev) | |||
202 | kfree(ishtp_dev); | 202 | kfree(ishtp_dev); |
203 | } | 203 | } |
204 | 204 | ||
205 | #ifdef CONFIG_PM | ||
205 | static struct device *ish_resume_device; | 206 | static struct device *ish_resume_device; |
206 | 207 | ||
207 | /** | 208 | /** |
@@ -293,7 +294,6 @@ static int ish_resume(struct device *device) | |||
293 | return 0; | 294 | return 0; |
294 | } | 295 | } |
295 | 296 | ||
296 | #ifdef CONFIG_PM | ||
297 | static const struct dev_pm_ops ish_pm_ops = { | 297 | static const struct dev_pm_ops ish_pm_ops = { |
298 | .suspend = ish_suspend, | 298 | .suspend = ish_suspend, |
299 | .resume = ish_resume, | 299 | .resume = ish_resume, |
@@ -301,7 +301,7 @@ static const struct dev_pm_ops ish_pm_ops = { | |||
301 | #define ISHTP_ISH_PM_OPS (&ish_pm_ops) | 301 | #define ISHTP_ISH_PM_OPS (&ish_pm_ops) |
302 | #else | 302 | #else |
303 | #define ISHTP_ISH_PM_OPS NULL | 303 | #define ISHTP_ISH_PM_OPS NULL |
304 | #endif | 304 | #endif /* CONFIG_PM */ |
305 | 305 | ||
306 | static struct pci_driver ish_driver = { | 306 | static struct pci_driver ish_driver = { |
307 | .name = KBUILD_MODNAME, | 307 | .name = KBUILD_MODNAME, |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 354d49ea36dd..e6cfd323babc 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -63,6 +63,7 @@ static const struct hid_blacklist { | |||
63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | 63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, |
64 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 64 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
65 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET }, | 65 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET }, |
66 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS692, HID_QUIRK_NOGET }, | ||
66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, | 67 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, |
67 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, | 68 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, |
68 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, | 69 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, |
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index a259e18d22d5..0276d2ef06ee 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
@@ -961,7 +961,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) | |||
961 | { | 961 | { |
962 | int ret = 0; | 962 | int ret = 0; |
963 | 963 | ||
964 | dev_set_name(&child_device_obj->device, "vmbus-%pUl", | 964 | dev_set_name(&child_device_obj->device, "%pUl", |
965 | child_device_obj->channel->offermsg.offer.if_instance.b); | 965 | child_device_obj->channel->offermsg.offer.if_instance.b); |
966 | 966 | ||
967 | child_device_obj->device.bus = &hv_bus; | 967 | child_device_obj->device.bus = &hv_bus; |
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index adae6848ffb2..a74c075a30ec 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
@@ -536,8 +536,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, | |||
536 | 536 | ||
537 | hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), | 537 | hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), |
538 | GFP_KERNEL); | 538 | GFP_KERNEL); |
539 | if (!hwdev->groups) | 539 | if (!hwdev->groups) { |
540 | return ERR_PTR(-ENOMEM); | 540 | err = -ENOMEM; |
541 | goto free_hwmon; | ||
542 | } | ||
541 | 543 | ||
542 | attrs = __hwmon_create_attrs(dev, drvdata, chip); | 544 | attrs = __hwmon_create_attrs(dev, drvdata, chip); |
543 | if (IS_ERR(attrs)) { | 545 | if (IS_ERR(attrs)) { |
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index da3fb069ec5c..ce69048c88e9 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c | |||
@@ -743,8 +743,8 @@ static int st_accel_read_raw(struct iio_dev *indio_dev, | |||
743 | 743 | ||
744 | return IIO_VAL_INT; | 744 | return IIO_VAL_INT; |
745 | case IIO_CHAN_INFO_SCALE: | 745 | case IIO_CHAN_INFO_SCALE: |
746 | *val = 0; | 746 | *val = adata->current_fullscale->gain / 1000000; |
747 | *val2 = adata->current_fullscale->gain; | 747 | *val2 = adata->current_fullscale->gain % 1000000; |
748 | return IIO_VAL_INT_PLUS_MICRO; | 748 | return IIO_VAL_INT_PLUS_MICRO; |
749 | case IIO_CHAN_INFO_SAMP_FREQ: | 749 | case IIO_CHAN_INFO_SAMP_FREQ: |
750 | *val = adata->odr; | 750 | *val = adata->odr; |
@@ -763,9 +763,13 @@ static int st_accel_write_raw(struct iio_dev *indio_dev, | |||
763 | int err; | 763 | int err; |
764 | 764 | ||
765 | switch (mask) { | 765 | switch (mask) { |
766 | case IIO_CHAN_INFO_SCALE: | 766 | case IIO_CHAN_INFO_SCALE: { |
767 | err = st_sensors_set_fullscale_by_gain(indio_dev, val2); | 767 | int gain; |
768 | |||
769 | gain = val * 1000000 + val2; | ||
770 | err = st_sensors_set_fullscale_by_gain(indio_dev, gain); | ||
768 | break; | 771 | break; |
772 | } | ||
769 | case IIO_CHAN_INFO_SAMP_FREQ: | 773 | case IIO_CHAN_INFO_SAMP_FREQ: |
770 | if (val2) | 774 | if (val2) |
771 | return -EINVAL; | 775 | return -EINVAL; |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c index dc33c1dd5191..b5beea53d6f6 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c | |||
@@ -30,26 +30,26 @@ static struct { | |||
30 | u32 usage_id; | 30 | u32 usage_id; |
31 | int unit; /* 0 for default others from HID sensor spec */ | 31 | int unit; /* 0 for default others from HID sensor spec */ |
32 | int scale_val0; /* scale, whole number */ | 32 | int scale_val0; /* scale, whole number */ |
33 | int scale_val1; /* scale, fraction in micros */ | 33 | int scale_val1; /* scale, fraction in nanos */ |
34 | } unit_conversion[] = { | 34 | } unit_conversion[] = { |
35 | {HID_USAGE_SENSOR_ACCEL_3D, 0, 9, 806650}, | 35 | {HID_USAGE_SENSOR_ACCEL_3D, 0, 9, 806650000}, |
36 | {HID_USAGE_SENSOR_ACCEL_3D, | 36 | {HID_USAGE_SENSOR_ACCEL_3D, |
37 | HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD, 1, 0}, | 37 | HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD, 1, 0}, |
38 | {HID_USAGE_SENSOR_ACCEL_3D, | 38 | {HID_USAGE_SENSOR_ACCEL_3D, |
39 | HID_USAGE_SENSOR_UNITS_G, 9, 806650}, | 39 | HID_USAGE_SENSOR_UNITS_G, 9, 806650000}, |
40 | 40 | ||
41 | {HID_USAGE_SENSOR_GYRO_3D, 0, 0, 17453}, | 41 | {HID_USAGE_SENSOR_GYRO_3D, 0, 0, 17453293}, |
42 | {HID_USAGE_SENSOR_GYRO_3D, | 42 | {HID_USAGE_SENSOR_GYRO_3D, |
43 | HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND, 1, 0}, | 43 | HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND, 1, 0}, |
44 | {HID_USAGE_SENSOR_GYRO_3D, | 44 | {HID_USAGE_SENSOR_GYRO_3D, |
45 | HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND, 0, 17453}, | 45 | HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND, 0, 17453293}, |
46 | 46 | ||
47 | {HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000}, | 47 | {HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000000}, |
48 | {HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0}, | 48 | {HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0}, |
49 | 49 | ||
50 | {HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453}, | 50 | {HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453293}, |
51 | {HID_USAGE_SENSOR_INCLINOMETER_3D, | 51 | {HID_USAGE_SENSOR_INCLINOMETER_3D, |
52 | HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453}, | 52 | HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453293}, |
53 | {HID_USAGE_SENSOR_INCLINOMETER_3D, | 53 | {HID_USAGE_SENSOR_INCLINOMETER_3D, |
54 | HID_USAGE_SENSOR_UNITS_RADIANS, 1, 0}, | 54 | HID_USAGE_SENSOR_UNITS_RADIANS, 1, 0}, |
55 | 55 | ||
@@ -57,7 +57,7 @@ static struct { | |||
57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, | 57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, |
58 | 58 | ||
59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0}, | 59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0}, |
60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000}, | 60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000000}, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int pow_10(unsigned power) | 63 | static int pow_10(unsigned power) |
@@ -266,15 +266,15 @@ EXPORT_SYMBOL(hid_sensor_write_raw_hyst_value); | |||
266 | /* | 266 | /* |
267 | * This fuction applies the unit exponent to the scale. | 267 | * This fuction applies the unit exponent to the scale. |
268 | * For example: | 268 | * For example: |
269 | * 9.806650 ->exp:2-> val0[980]val1[665000] | 269 | * 9.806650000 ->exp:2-> val0[980]val1[665000000] |
270 | * 9.000806 ->exp:2-> val0[900]val1[80600] | 270 | * 9.000806000 ->exp:2-> val0[900]val1[80600000] |
271 | * 0.174535 ->exp:2-> val0[17]val1[453500] | 271 | * 0.174535293 ->exp:2-> val0[17]val1[453529300] |
272 | * 1.001745 ->exp:0-> val0[1]val1[1745] | 272 | * 1.001745329 ->exp:0-> val0[1]val1[1745329] |
273 | * 1.001745 ->exp:2-> val0[100]val1[174500] | 273 | * 1.001745329 ->exp:2-> val0[100]val1[174532900] |
274 | * 1.001745 ->exp:4-> val0[10017]val1[450000] | 274 | * 1.001745329 ->exp:4-> val0[10017]val1[453290000] |
275 | * 9.806650 ->exp:-2-> val0[0]val1[98066] | 275 | * 9.806650000 ->exp:-2-> val0[0]val1[98066500] |
276 | */ | 276 | */ |
277 | static void adjust_exponent_micro(int *val0, int *val1, int scale0, | 277 | static void adjust_exponent_nano(int *val0, int *val1, int scale0, |
278 | int scale1, int exp) | 278 | int scale1, int exp) |
279 | { | 279 | { |
280 | int i; | 280 | int i; |
@@ -285,32 +285,32 @@ static void adjust_exponent_micro(int *val0, int *val1, int scale0, | |||
285 | if (exp > 0) { | 285 | if (exp > 0) { |
286 | *val0 = scale0 * pow_10(exp); | 286 | *val0 = scale0 * pow_10(exp); |
287 | res = 0; | 287 | res = 0; |
288 | if (exp > 6) { | 288 | if (exp > 9) { |
289 | *val1 = 0; | 289 | *val1 = 0; |
290 | return; | 290 | return; |
291 | } | 291 | } |
292 | for (i = 0; i < exp; ++i) { | 292 | for (i = 0; i < exp; ++i) { |
293 | x = scale1 / pow_10(5 - i); | 293 | x = scale1 / pow_10(8 - i); |
294 | res += (pow_10(exp - 1 - i) * x); | 294 | res += (pow_10(exp - 1 - i) * x); |
295 | scale1 = scale1 % pow_10(5 - i); | 295 | scale1 = scale1 % pow_10(8 - i); |
296 | } | 296 | } |
297 | *val0 += res; | 297 | *val0 += res; |
298 | *val1 = scale1 * pow_10(exp); | 298 | *val1 = scale1 * pow_10(exp); |
299 | } else if (exp < 0) { | 299 | } else if (exp < 0) { |
300 | exp = abs(exp); | 300 | exp = abs(exp); |
301 | if (exp > 6) { | 301 | if (exp > 9) { |
302 | *val0 = *val1 = 0; | 302 | *val0 = *val1 = 0; |
303 | return; | 303 | return; |
304 | } | 304 | } |
305 | *val0 = scale0 / pow_10(exp); | 305 | *val0 = scale0 / pow_10(exp); |
306 | rem = scale0 % pow_10(exp); | 306 | rem = scale0 % pow_10(exp); |
307 | res = 0; | 307 | res = 0; |
308 | for (i = 0; i < (6 - exp); ++i) { | 308 | for (i = 0; i < (9 - exp); ++i) { |
309 | x = scale1 / pow_10(5 - i); | 309 | x = scale1 / pow_10(8 - i); |
310 | res += (pow_10(5 - exp - i) * x); | 310 | res += (pow_10(8 - exp - i) * x); |
311 | scale1 = scale1 % pow_10(5 - i); | 311 | scale1 = scale1 % pow_10(8 - i); |
312 | } | 312 | } |
313 | *val1 = rem * pow_10(6 - exp) + res; | 313 | *val1 = rem * pow_10(9 - exp) + res; |
314 | } else { | 314 | } else { |
315 | *val0 = scale0; | 315 | *val0 = scale0; |
316 | *val1 = scale1; | 316 | *val1 = scale1; |
@@ -332,14 +332,14 @@ int hid_sensor_format_scale(u32 usage_id, | |||
332 | unit_conversion[i].unit == attr_info->units) { | 332 | unit_conversion[i].unit == attr_info->units) { |
333 | exp = hid_sensor_convert_exponent( | 333 | exp = hid_sensor_convert_exponent( |
334 | attr_info->unit_expo); | 334 | attr_info->unit_expo); |
335 | adjust_exponent_micro(val0, val1, | 335 | adjust_exponent_nano(val0, val1, |
336 | unit_conversion[i].scale_val0, | 336 | unit_conversion[i].scale_val0, |
337 | unit_conversion[i].scale_val1, exp); | 337 | unit_conversion[i].scale_val1, exp); |
338 | break; | 338 | break; |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | return IIO_VAL_INT_PLUS_MICRO; | 342 | return IIO_VAL_INT_PLUS_NANO; |
343 | } | 343 | } |
344 | EXPORT_SYMBOL(hid_sensor_format_scale); | 344 | EXPORT_SYMBOL(hid_sensor_format_scale); |
345 | 345 | ||
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 285a64a589d7..975a1f19f747 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -612,7 +612,7 @@ EXPORT_SYMBOL(st_sensors_sysfs_sampling_frequency_avail); | |||
612 | ssize_t st_sensors_sysfs_scale_avail(struct device *dev, | 612 | ssize_t st_sensors_sysfs_scale_avail(struct device *dev, |
613 | struct device_attribute *attr, char *buf) | 613 | struct device_attribute *attr, char *buf) |
614 | { | 614 | { |
615 | int i, len = 0; | 615 | int i, len = 0, q, r; |
616 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 616 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
617 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 617 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
618 | 618 | ||
@@ -621,8 +621,10 @@ ssize_t st_sensors_sysfs_scale_avail(struct device *dev, | |||
621 | if (sdata->sensor_settings->fs.fs_avl[i].num == 0) | 621 | if (sdata->sensor_settings->fs.fs_avl[i].num == 0) |
622 | break; | 622 | break; |
623 | 623 | ||
624 | len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", | 624 | q = sdata->sensor_settings->fs.fs_avl[i].gain / 1000000; |
625 | sdata->sensor_settings->fs.fs_avl[i].gain); | 625 | r = sdata->sensor_settings->fs.fs_avl[i].gain % 1000000; |
626 | |||
627 | len += scnprintf(buf + len, PAGE_SIZE - len, "%u.%06u ", q, r); | ||
626 | } | 628 | } |
627 | mutex_unlock(&indio_dev->mlock); | 629 | mutex_unlock(&indio_dev->mlock); |
628 | buf[len - 1] = '\n'; | 630 | buf[len - 1] = '\n'; |
diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c index b98b9d94d184..a97e802ca523 100644 --- a/drivers/iio/orientation/hid-sensor-rotation.c +++ b/drivers/iio/orientation/hid-sensor-rotation.c | |||
@@ -335,6 +335,7 @@ static struct platform_driver hid_dev_rot_platform_driver = { | |||
335 | .id_table = hid_dev_rot_ids, | 335 | .id_table = hid_dev_rot_ids, |
336 | .driver = { | 336 | .driver = { |
337 | .name = KBUILD_MODNAME, | 337 | .name = KBUILD_MODNAME, |
338 | .pm = &hid_sensor_pm_ops, | ||
338 | }, | 339 | }, |
339 | .probe = hid_dev_rot_probe, | 340 | .probe = hid_dev_rot_probe, |
340 | .remove = hid_dev_rot_remove, | 341 | .remove = hid_dev_rot_remove, |
diff --git a/drivers/iio/temperature/maxim_thermocouple.c b/drivers/iio/temperature/maxim_thermocouple.c index 066161a4bccd..f962f31a5eb2 100644 --- a/drivers/iio/temperature/maxim_thermocouple.c +++ b/drivers/iio/temperature/maxim_thermocouple.c | |||
@@ -136,6 +136,8 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data, | |||
136 | ret = spi_read(data->spi, (void *)&buf32, storage_bytes); | 136 | ret = spi_read(data->spi, (void *)&buf32, storage_bytes); |
137 | *val = be32_to_cpu(buf32); | 137 | *val = be32_to_cpu(buf32); |
138 | break; | 138 | break; |
139 | default: | ||
140 | ret = -EINVAL; | ||
139 | } | 141 | } |
140 | 142 | ||
141 | if (ret) | 143 | if (ret) |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 36bf50ebb187..89a6b0546804 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -1094,47 +1094,47 @@ static void cma_save_ib_info(struct sockaddr *src_addr, | |||
1094 | } | 1094 | } |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | static void cma_save_ip4_info(struct sockaddr *src_addr, | 1097 | static void cma_save_ip4_info(struct sockaddr_in *src_addr, |
1098 | struct sockaddr *dst_addr, | 1098 | struct sockaddr_in *dst_addr, |
1099 | struct cma_hdr *hdr, | 1099 | struct cma_hdr *hdr, |
1100 | __be16 local_port) | 1100 | __be16 local_port) |
1101 | { | 1101 | { |
1102 | struct sockaddr_in *ip4; | ||
1103 | |||
1104 | if (src_addr) { | 1102 | if (src_addr) { |
1105 | ip4 = (struct sockaddr_in *)src_addr; | 1103 | *src_addr = (struct sockaddr_in) { |
1106 | ip4->sin_family = AF_INET; | 1104 | .sin_family = AF_INET, |
1107 | ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr; | 1105 | .sin_addr.s_addr = hdr->dst_addr.ip4.addr, |
1108 | ip4->sin_port = local_port; | 1106 | .sin_port = local_port, |
1107 | }; | ||
1109 | } | 1108 | } |
1110 | 1109 | ||
1111 | if (dst_addr) { | 1110 | if (dst_addr) { |
1112 | ip4 = (struct sockaddr_in *)dst_addr; | 1111 | *dst_addr = (struct sockaddr_in) { |
1113 | ip4->sin_family = AF_INET; | 1112 | .sin_family = AF_INET, |
1114 | ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr; | 1113 | .sin_addr.s_addr = hdr->src_addr.ip4.addr, |
1115 | ip4->sin_port = hdr->port; | 1114 | .sin_port = hdr->port, |
1115 | }; | ||
1116 | } | 1116 | } |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | static void cma_save_ip6_info(struct sockaddr *src_addr, | 1119 | static void cma_save_ip6_info(struct sockaddr_in6 *src_addr, |
1120 | struct sockaddr *dst_addr, | 1120 | struct sockaddr_in6 *dst_addr, |
1121 | struct cma_hdr *hdr, | 1121 | struct cma_hdr *hdr, |
1122 | __be16 local_port) | 1122 | __be16 local_port) |
1123 | { | 1123 | { |
1124 | struct sockaddr_in6 *ip6; | ||
1125 | |||
1126 | if (src_addr) { | 1124 | if (src_addr) { |
1127 | ip6 = (struct sockaddr_in6 *)src_addr; | 1125 | *src_addr = (struct sockaddr_in6) { |
1128 | ip6->sin6_family = AF_INET6; | 1126 | .sin6_family = AF_INET6, |
1129 | ip6->sin6_addr = hdr->dst_addr.ip6; | 1127 | .sin6_addr = hdr->dst_addr.ip6, |
1130 | ip6->sin6_port = local_port; | 1128 | .sin6_port = local_port, |
1129 | }; | ||
1131 | } | 1130 | } |
1132 | 1131 | ||
1133 | if (dst_addr) { | 1132 | if (dst_addr) { |
1134 | ip6 = (struct sockaddr_in6 *)dst_addr; | 1133 | *dst_addr = (struct sockaddr_in6) { |
1135 | ip6->sin6_family = AF_INET6; | 1134 | .sin6_family = AF_INET6, |
1136 | ip6->sin6_addr = hdr->src_addr.ip6; | 1135 | .sin6_addr = hdr->src_addr.ip6, |
1137 | ip6->sin6_port = hdr->port; | 1136 | .sin6_port = hdr->port, |
1137 | }; | ||
1138 | } | 1138 | } |
1139 | } | 1139 | } |
1140 | 1140 | ||
@@ -1159,10 +1159,12 @@ static int cma_save_ip_info(struct sockaddr *src_addr, | |||
1159 | 1159 | ||
1160 | switch (cma_get_ip_ver(hdr)) { | 1160 | switch (cma_get_ip_ver(hdr)) { |
1161 | case 4: | 1161 | case 4: |
1162 | cma_save_ip4_info(src_addr, dst_addr, hdr, port); | 1162 | cma_save_ip4_info((struct sockaddr_in *)src_addr, |
1163 | (struct sockaddr_in *)dst_addr, hdr, port); | ||
1163 | break; | 1164 | break; |
1164 | case 6: | 1165 | case 6: |
1165 | cma_save_ip6_info(src_addr, dst_addr, hdr, port); | 1166 | cma_save_ip6_info((struct sockaddr_in6 *)src_addr, |
1167 | (struct sockaddr_in6 *)dst_addr, hdr, port); | ||
1166 | break; | 1168 | break; |
1167 | default: | 1169 | default: |
1168 | return -EAFNOSUPPORT; | 1170 | return -EAFNOSUPPORT; |
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 15c01c3cd540..e6f9b2d745ca 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
@@ -2636,17 +2636,26 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
2636 | /* And we're up. Go go go! */ | 2636 | /* And we're up. Go go go! */ |
2637 | of_iommu_set_ops(dev->of_node, &arm_smmu_ops); | 2637 | of_iommu_set_ops(dev->of_node, &arm_smmu_ops); |
2638 | #ifdef CONFIG_PCI | 2638 | #ifdef CONFIG_PCI |
2639 | pci_request_acs(); | 2639 | if (pci_bus_type.iommu_ops != &arm_smmu_ops) { |
2640 | ret = bus_set_iommu(&pci_bus_type, &arm_smmu_ops); | 2640 | pci_request_acs(); |
2641 | if (ret) | 2641 | ret = bus_set_iommu(&pci_bus_type, &arm_smmu_ops); |
2642 | return ret; | 2642 | if (ret) |
2643 | return ret; | ||
2644 | } | ||
2643 | #endif | 2645 | #endif |
2644 | #ifdef CONFIG_ARM_AMBA | 2646 | #ifdef CONFIG_ARM_AMBA |
2645 | ret = bus_set_iommu(&amba_bustype, &arm_smmu_ops); | 2647 | if (amba_bustype.iommu_ops != &arm_smmu_ops) { |
2646 | if (ret) | 2648 | ret = bus_set_iommu(&amba_bustype, &arm_smmu_ops); |
2647 | return ret; | 2649 | if (ret) |
2650 | return ret; | ||
2651 | } | ||
2648 | #endif | 2652 | #endif |
2649 | return bus_set_iommu(&platform_bus_type, &arm_smmu_ops); | 2653 | if (platform_bus_type.iommu_ops != &arm_smmu_ops) { |
2654 | ret = bus_set_iommu(&platform_bus_type, &arm_smmu_ops); | ||
2655 | if (ret) | ||
2656 | return ret; | ||
2657 | } | ||
2658 | return 0; | ||
2650 | } | 2659 | } |
2651 | 2660 | ||
2652 | static int arm_smmu_device_remove(struct platform_device *pdev) | 2661 | static int arm_smmu_device_remove(struct platform_device *pdev) |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index c841eb7a1a74..8f7281444551 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -324,8 +324,10 @@ struct arm_smmu_master_cfg { | |||
324 | #define INVALID_SMENDX -1 | 324 | #define INVALID_SMENDX -1 |
325 | #define __fwspec_cfg(fw) ((struct arm_smmu_master_cfg *)fw->iommu_priv) | 325 | #define __fwspec_cfg(fw) ((struct arm_smmu_master_cfg *)fw->iommu_priv) |
326 | #define fwspec_smmu(fw) (__fwspec_cfg(fw)->smmu) | 326 | #define fwspec_smmu(fw) (__fwspec_cfg(fw)->smmu) |
327 | #define fwspec_smendx(fw, i) \ | ||
328 | (i >= fw->num_ids ? INVALID_SMENDX : __fwspec_cfg(fw)->smendx[i]) | ||
327 | #define for_each_cfg_sme(fw, i, idx) \ | 329 | #define for_each_cfg_sme(fw, i, idx) \ |
328 | for (i = 0; idx = __fwspec_cfg(fw)->smendx[i], i < fw->num_ids; ++i) | 330 | for (i = 0; idx = fwspec_smendx(fw, i), i < fw->num_ids; ++i) |
329 | 331 | ||
330 | struct arm_smmu_device { | 332 | struct arm_smmu_device { |
331 | struct device *dev; | 333 | struct device *dev; |
@@ -1228,6 +1230,16 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1228 | return -ENXIO; | 1230 | return -ENXIO; |
1229 | } | 1231 | } |
1230 | 1232 | ||
1233 | /* | ||
1234 | * FIXME: The arch/arm DMA API code tries to attach devices to its own | ||
1235 | * domains between of_xlate() and add_device() - we have no way to cope | ||
1236 | * with that, so until ARM gets converted to rely on groups and default | ||
1237 | * domains, just say no (but more politely than by dereferencing NULL). | ||
1238 | * This should be at least a WARN_ON once that's sorted. | ||
1239 | */ | ||
1240 | if (!fwspec->iommu_priv) | ||
1241 | return -ENODEV; | ||
1242 | |||
1231 | smmu = fwspec_smmu(fwspec); | 1243 | smmu = fwspec_smmu(fwspec); |
1232 | /* Ensure that the domain is finalised */ | 1244 | /* Ensure that the domain is finalised */ |
1233 | ret = arm_smmu_init_domain_context(domain, smmu); | 1245 | ret = arm_smmu_init_domain_context(domain, smmu); |
@@ -1390,7 +1402,7 @@ static int arm_smmu_add_device(struct device *dev) | |||
1390 | fwspec = dev->iommu_fwspec; | 1402 | fwspec = dev->iommu_fwspec; |
1391 | if (ret) | 1403 | if (ret) |
1392 | goto out_free; | 1404 | goto out_free; |
1393 | } else if (fwspec) { | 1405 | } else if (fwspec && fwspec->ops == &arm_smmu_ops) { |
1394 | smmu = arm_smmu_get_by_node(to_of_node(fwspec->iommu_fwnode)); | 1406 | smmu = arm_smmu_get_by_node(to_of_node(fwspec->iommu_fwnode)); |
1395 | } else { | 1407 | } else { |
1396 | return -ENODEV; | 1408 | return -ENODEV; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a4407eabf0e6..3965e73db51c 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1711,6 +1711,7 @@ static void disable_dmar_iommu(struct intel_iommu *iommu) | |||
1711 | if (!iommu->domains || !iommu->domain_ids) | 1711 | if (!iommu->domains || !iommu->domain_ids) |
1712 | return; | 1712 | return; |
1713 | 1713 | ||
1714 | again: | ||
1714 | spin_lock_irqsave(&device_domain_lock, flags); | 1715 | spin_lock_irqsave(&device_domain_lock, flags); |
1715 | list_for_each_entry_safe(info, tmp, &device_domain_list, global) { | 1716 | list_for_each_entry_safe(info, tmp, &device_domain_list, global) { |
1716 | struct dmar_domain *domain; | 1717 | struct dmar_domain *domain; |
@@ -1723,10 +1724,19 @@ static void disable_dmar_iommu(struct intel_iommu *iommu) | |||
1723 | 1724 | ||
1724 | domain = info->domain; | 1725 | domain = info->domain; |
1725 | 1726 | ||
1726 | dmar_remove_one_dev_info(domain, info->dev); | 1727 | __dmar_remove_one_dev_info(info); |
1727 | 1728 | ||
1728 | if (!domain_type_is_vm_or_si(domain)) | 1729 | if (!domain_type_is_vm_or_si(domain)) { |
1730 | /* | ||
1731 | * The domain_exit() function can't be called under | ||
1732 | * device_domain_lock, as it takes this lock itself. | ||
1733 | * So release the lock here and re-run the loop | ||
1734 | * afterwards. | ||
1735 | */ | ||
1736 | spin_unlock_irqrestore(&device_domain_lock, flags); | ||
1729 | domain_exit(domain); | 1737 | domain_exit(domain); |
1738 | goto again; | ||
1739 | } | ||
1730 | } | 1740 | } |
1731 | spin_unlock_irqrestore(&device_domain_lock, flags); | 1741 | spin_unlock_irqrestore(&device_domain_lock, flags); |
1732 | 1742 | ||
diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index 012225587c25..b71b747ee0ba 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig | |||
@@ -513,6 +513,11 @@ config DVB_AS102_FE | |||
513 | depends on DVB_CORE | 513 | depends on DVB_CORE |
514 | default DVB_AS102 | 514 | default DVB_AS102 |
515 | 515 | ||
516 | config DVB_GP8PSK_FE | ||
517 | tristate | ||
518 | depends on DVB_CORE | ||
519 | default DVB_USB_GP8PSK | ||
520 | |||
516 | comment "DVB-C (cable) frontends" | 521 | comment "DVB-C (cable) frontends" |
517 | depends on DVB_CORE | 522 | depends on DVB_CORE |
518 | 523 | ||
diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile index e90165ad361b..93921a4eaa27 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile | |||
@@ -121,6 +121,7 @@ obj-$(CONFIG_DVB_RTL2832_SDR) += rtl2832_sdr.o | |||
121 | obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o | 121 | obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o |
122 | obj-$(CONFIG_DVB_AF9033) += af9033.o | 122 | obj-$(CONFIG_DVB_AF9033) += af9033.o |
123 | obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o | 123 | obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o |
124 | obj-$(CONFIG_DVB_GP8PSK_FE) += gp8psk-fe.o | ||
124 | obj-$(CONFIG_DVB_TC90522) += tc90522.o | 125 | obj-$(CONFIG_DVB_TC90522) += tc90522.o |
125 | obj-$(CONFIG_DVB_HORUS3A) += horus3a.o | 126 | obj-$(CONFIG_DVB_HORUS3A) += horus3a.o |
126 | obj-$(CONFIG_DVB_ASCOT2E) += ascot2e.o | 127 | obj-$(CONFIG_DVB_ASCOT2E) += ascot2e.o |
diff --git a/drivers/media/usb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb-frontends/gp8psk-fe.c index db6eb79cde07..be19afeed7a9 100644 --- a/drivers/media/usb/dvb-usb/gp8psk-fe.c +++ b/drivers/media/dvb-frontends/gp8psk-fe.c | |||
@@ -14,11 +14,27 @@ | |||
14 | * | 14 | * |
15 | * see Documentation/dvb/README.dvb-usb for more information | 15 | * see Documentation/dvb/README.dvb-usb for more information |
16 | */ | 16 | */ |
17 | #include "gp8psk.h" | 17 | |
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
20 | #include "gp8psk-fe.h" | ||
21 | #include "dvb_frontend.h" | ||
22 | |||
23 | static int debug; | ||
24 | module_param(debug, int, 0644); | ||
25 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | ||
26 | |||
27 | #define dprintk(fmt, arg...) do { \ | ||
28 | if (debug) \ | ||
29 | printk(KERN_DEBUG pr_fmt("%s: " fmt), \ | ||
30 | __func__, ##arg); \ | ||
31 | } while (0) | ||
18 | 32 | ||
19 | struct gp8psk_fe_state { | 33 | struct gp8psk_fe_state { |
20 | struct dvb_frontend fe; | 34 | struct dvb_frontend fe; |
21 | struct dvb_usb_device *d; | 35 | void *priv; |
36 | const struct gp8psk_fe_ops *ops; | ||
37 | bool is_rev1; | ||
22 | u8 lock; | 38 | u8 lock; |
23 | u16 snr; | 39 | u16 snr; |
24 | unsigned long next_status_check; | 40 | unsigned long next_status_check; |
@@ -29,22 +45,24 @@ static int gp8psk_tuned_to_DCII(struct dvb_frontend *fe) | |||
29 | { | 45 | { |
30 | struct gp8psk_fe_state *st = fe->demodulator_priv; | 46 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
31 | u8 status; | 47 | u8 status; |
32 | gp8psk_usb_in_op(st->d, GET_8PSK_CONFIG, 0, 0, &status, 1); | 48 | |
49 | st->ops->in(st->priv, GET_8PSK_CONFIG, 0, 0, &status, 1); | ||
33 | return status & bmDCtuned; | 50 | return status & bmDCtuned; |
34 | } | 51 | } |
35 | 52 | ||
36 | static int gp8psk_set_tuner_mode(struct dvb_frontend *fe, int mode) | 53 | static int gp8psk_set_tuner_mode(struct dvb_frontend *fe, int mode) |
37 | { | 54 | { |
38 | struct gp8psk_fe_state *state = fe->demodulator_priv; | 55 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
39 | return gp8psk_usb_out_op(state->d, SET_8PSK_CONFIG, mode, 0, NULL, 0); | 56 | |
57 | return st->ops->out(st->priv, SET_8PSK_CONFIG, mode, 0, NULL, 0); | ||
40 | } | 58 | } |
41 | 59 | ||
42 | static int gp8psk_fe_update_status(struct gp8psk_fe_state *st) | 60 | static int gp8psk_fe_update_status(struct gp8psk_fe_state *st) |
43 | { | 61 | { |
44 | u8 buf[6]; | 62 | u8 buf[6]; |
45 | if (time_after(jiffies,st->next_status_check)) { | 63 | if (time_after(jiffies,st->next_status_check)) { |
46 | gp8psk_usb_in_op(st->d, GET_SIGNAL_LOCK, 0,0,&st->lock,1); | 64 | st->ops->in(st->priv, GET_SIGNAL_LOCK, 0, 0, &st->lock, 1); |
47 | gp8psk_usb_in_op(st->d, GET_SIGNAL_STRENGTH, 0,0,buf,6); | 65 | st->ops->in(st->priv, GET_SIGNAL_STRENGTH, 0, 0, buf, 6); |
48 | st->snr = (buf[1]) << 8 | buf[0]; | 66 | st->snr = (buf[1]) << 8 | buf[0]; |
49 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; | 67 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; |
50 | } | 68 | } |
@@ -116,13 +134,12 @@ static int gp8psk_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_front | |||
116 | 134 | ||
117 | static int gp8psk_fe_set_frontend(struct dvb_frontend *fe) | 135 | static int gp8psk_fe_set_frontend(struct dvb_frontend *fe) |
118 | { | 136 | { |
119 | struct gp8psk_fe_state *state = fe->demodulator_priv; | 137 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
120 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 138 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
121 | u8 cmd[10]; | 139 | u8 cmd[10]; |
122 | u32 freq = c->frequency * 1000; | 140 | u32 freq = c->frequency * 1000; |
123 | int gp_product_id = le16_to_cpu(state->d->udev->descriptor.idProduct); | ||
124 | 141 | ||
125 | deb_fe("%s()\n", __func__); | 142 | dprintk("%s()\n", __func__); |
126 | 143 | ||
127 | cmd[4] = freq & 0xff; | 144 | cmd[4] = freq & 0xff; |
128 | cmd[5] = (freq >> 8) & 0xff; | 145 | cmd[5] = (freq >> 8) & 0xff; |
@@ -136,21 +153,21 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend *fe) | |||
136 | switch (c->delivery_system) { | 153 | switch (c->delivery_system) { |
137 | case SYS_DVBS: | 154 | case SYS_DVBS: |
138 | if (c->modulation != QPSK) { | 155 | if (c->modulation != QPSK) { |
139 | deb_fe("%s: unsupported modulation selected (%d)\n", | 156 | dprintk("%s: unsupported modulation selected (%d)\n", |
140 | __func__, c->modulation); | 157 | __func__, c->modulation); |
141 | return -EOPNOTSUPP; | 158 | return -EOPNOTSUPP; |
142 | } | 159 | } |
143 | c->fec_inner = FEC_AUTO; | 160 | c->fec_inner = FEC_AUTO; |
144 | break; | 161 | break; |
145 | case SYS_DVBS2: /* kept for backwards compatibility */ | 162 | case SYS_DVBS2: /* kept for backwards compatibility */ |
146 | deb_fe("%s: DVB-S2 delivery system selected\n", __func__); | 163 | dprintk("%s: DVB-S2 delivery system selected\n", __func__); |
147 | break; | 164 | break; |
148 | case SYS_TURBO: | 165 | case SYS_TURBO: |
149 | deb_fe("%s: Turbo-FEC delivery system selected\n", __func__); | 166 | dprintk("%s: Turbo-FEC delivery system selected\n", __func__); |
150 | break; | 167 | break; |
151 | 168 | ||
152 | default: | 169 | default: |
153 | deb_fe("%s: unsupported delivery system selected (%d)\n", | 170 | dprintk("%s: unsupported delivery system selected (%d)\n", |
154 | __func__, c->delivery_system); | 171 | __func__, c->delivery_system); |
155 | return -EOPNOTSUPP; | 172 | return -EOPNOTSUPP; |
156 | } | 173 | } |
@@ -161,9 +178,9 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend *fe) | |||
161 | cmd[3] = (c->symbol_rate >> 24) & 0xff; | 178 | cmd[3] = (c->symbol_rate >> 24) & 0xff; |
162 | switch (c->modulation) { | 179 | switch (c->modulation) { |
163 | case QPSK: | 180 | case QPSK: |
164 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) | 181 | if (st->is_rev1) |
165 | if (gp8psk_tuned_to_DCII(fe)) | 182 | if (gp8psk_tuned_to_DCII(fe)) |
166 | gp8psk_bcm4500_reload(state->d); | 183 | st->ops->reload(st->priv); |
167 | switch (c->fec_inner) { | 184 | switch (c->fec_inner) { |
168 | case FEC_1_2: | 185 | case FEC_1_2: |
169 | cmd[9] = 0; break; | 186 | cmd[9] = 0; break; |
@@ -207,18 +224,18 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend *fe) | |||
207 | cmd[9] = 0; | 224 | cmd[9] = 0; |
208 | break; | 225 | break; |
209 | default: /* Unknown modulation */ | 226 | default: /* Unknown modulation */ |
210 | deb_fe("%s: unsupported modulation selected (%d)\n", | 227 | dprintk("%s: unsupported modulation selected (%d)\n", |
211 | __func__, c->modulation); | 228 | __func__, c->modulation); |
212 | return -EOPNOTSUPP; | 229 | return -EOPNOTSUPP; |
213 | } | 230 | } |
214 | 231 | ||
215 | if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) | 232 | if (st->is_rev1) |
216 | gp8psk_set_tuner_mode(fe, 0); | 233 | gp8psk_set_tuner_mode(fe, 0); |
217 | gp8psk_usb_out_op(state->d, TUNE_8PSK, 0, 0, cmd, 10); | 234 | st->ops->out(st->priv, TUNE_8PSK, 0, 0, cmd, 10); |
218 | 235 | ||
219 | state->lock = 0; | 236 | st->lock = 0; |
220 | state->next_status_check = jiffies; | 237 | st->next_status_check = jiffies; |
221 | state->status_check_interval = 200; | 238 | st->status_check_interval = 200; |
222 | 239 | ||
223 | return 0; | 240 | return 0; |
224 | } | 241 | } |
@@ -228,9 +245,9 @@ static int gp8psk_fe_send_diseqc_msg (struct dvb_frontend* fe, | |||
228 | { | 245 | { |
229 | struct gp8psk_fe_state *st = fe->demodulator_priv; | 246 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
230 | 247 | ||
231 | deb_fe("%s\n",__func__); | 248 | dprintk("%s\n", __func__); |
232 | 249 | ||
233 | if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, m->msg[0], 0, | 250 | if (st->ops->out(st->priv, SEND_DISEQC_COMMAND, m->msg[0], 0, |
234 | m->msg, m->msg_len)) { | 251 | m->msg, m->msg_len)) { |
235 | return -EINVAL; | 252 | return -EINVAL; |
236 | } | 253 | } |
@@ -243,12 +260,12 @@ static int gp8psk_fe_send_diseqc_burst(struct dvb_frontend *fe, | |||
243 | struct gp8psk_fe_state *st = fe->demodulator_priv; | 260 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
244 | u8 cmd; | 261 | u8 cmd; |
245 | 262 | ||
246 | deb_fe("%s\n",__func__); | 263 | dprintk("%s\n", __func__); |
247 | 264 | ||
248 | /* These commands are certainly wrong */ | 265 | /* These commands are certainly wrong */ |
249 | cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01; | 266 | cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01; |
250 | 267 | ||
251 | if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, cmd, 0, | 268 | if (st->ops->out(st->priv, SEND_DISEQC_COMMAND, cmd, 0, |
252 | &cmd, 0)) { | 269 | &cmd, 0)) { |
253 | return -EINVAL; | 270 | return -EINVAL; |
254 | } | 271 | } |
@@ -258,10 +275,10 @@ static int gp8psk_fe_send_diseqc_burst(struct dvb_frontend *fe, | |||
258 | static int gp8psk_fe_set_tone(struct dvb_frontend *fe, | 275 | static int gp8psk_fe_set_tone(struct dvb_frontend *fe, |
259 | enum fe_sec_tone_mode tone) | 276 | enum fe_sec_tone_mode tone) |
260 | { | 277 | { |
261 | struct gp8psk_fe_state* state = fe->demodulator_priv; | 278 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
262 | 279 | ||
263 | if (gp8psk_usb_out_op(state->d,SET_22KHZ_TONE, | 280 | if (st->ops->out(st->priv, SET_22KHZ_TONE, |
264 | (tone == SEC_TONE_ON), 0, NULL, 0)) { | 281 | (tone == SEC_TONE_ON), 0, NULL, 0)) { |
265 | return -EINVAL; | 282 | return -EINVAL; |
266 | } | 283 | } |
267 | return 0; | 284 | return 0; |
@@ -270,9 +287,9 @@ static int gp8psk_fe_set_tone(struct dvb_frontend *fe, | |||
270 | static int gp8psk_fe_set_voltage(struct dvb_frontend *fe, | 287 | static int gp8psk_fe_set_voltage(struct dvb_frontend *fe, |
271 | enum fe_sec_voltage voltage) | 288 | enum fe_sec_voltage voltage) |
272 | { | 289 | { |
273 | struct gp8psk_fe_state* state = fe->demodulator_priv; | 290 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
274 | 291 | ||
275 | if (gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE, | 292 | if (st->ops->out(st->priv, SET_LNB_VOLTAGE, |
276 | voltage == SEC_VOLTAGE_18, 0, NULL, 0)) { | 293 | voltage == SEC_VOLTAGE_18, 0, NULL, 0)) { |
277 | return -EINVAL; | 294 | return -EINVAL; |
278 | } | 295 | } |
@@ -281,52 +298,60 @@ static int gp8psk_fe_set_voltage(struct dvb_frontend *fe, | |||
281 | 298 | ||
282 | static int gp8psk_fe_enable_high_lnb_voltage(struct dvb_frontend* fe, long onoff) | 299 | static int gp8psk_fe_enable_high_lnb_voltage(struct dvb_frontend* fe, long onoff) |
283 | { | 300 | { |
284 | struct gp8psk_fe_state* state = fe->demodulator_priv; | 301 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
285 | return gp8psk_usb_out_op(state->d, USE_EXTRA_VOLT, onoff, 0,NULL,0); | 302 | |
303 | return st->ops->out(st->priv, USE_EXTRA_VOLT, onoff, 0, NULL, 0); | ||
286 | } | 304 | } |
287 | 305 | ||
288 | static int gp8psk_fe_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long sw_cmd) | 306 | static int gp8psk_fe_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long sw_cmd) |
289 | { | 307 | { |
290 | struct gp8psk_fe_state* state = fe->demodulator_priv; | 308 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
291 | u8 cmd = sw_cmd & 0x7f; | 309 | u8 cmd = sw_cmd & 0x7f; |
292 | 310 | ||
293 | if (gp8psk_usb_out_op(state->d,SET_DN_SWITCH, cmd, 0, | 311 | if (st->ops->out(st->priv, SET_DN_SWITCH, cmd, 0, NULL, 0)) |
294 | NULL, 0)) { | ||
295 | return -EINVAL; | 312 | return -EINVAL; |
296 | } | 313 | |
297 | if (gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE, !!(sw_cmd & 0x80), | 314 | if (st->ops->out(st->priv, SET_LNB_VOLTAGE, !!(sw_cmd & 0x80), |
298 | 0, NULL, 0)) { | 315 | 0, NULL, 0)) |
299 | return -EINVAL; | 316 | return -EINVAL; |
300 | } | ||
301 | 317 | ||
302 | return 0; | 318 | return 0; |
303 | } | 319 | } |
304 | 320 | ||
305 | static void gp8psk_fe_release(struct dvb_frontend* fe) | 321 | static void gp8psk_fe_release(struct dvb_frontend* fe) |
306 | { | 322 | { |
307 | struct gp8psk_fe_state *state = fe->demodulator_priv; | 323 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
308 | kfree(state); | 324 | |
325 | kfree(st); | ||
309 | } | 326 | } |
310 | 327 | ||
311 | static struct dvb_frontend_ops gp8psk_fe_ops; | 328 | static struct dvb_frontend_ops gp8psk_fe_ops; |
312 | 329 | ||
313 | struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d) | 330 | struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops, |
331 | void *priv, bool is_rev1) | ||
314 | { | 332 | { |
315 | struct gp8psk_fe_state *s = kzalloc(sizeof(struct gp8psk_fe_state), GFP_KERNEL); | 333 | struct gp8psk_fe_state *st; |
316 | if (s == NULL) | ||
317 | goto error; | ||
318 | |||
319 | s->d = d; | ||
320 | memcpy(&s->fe.ops, &gp8psk_fe_ops, sizeof(struct dvb_frontend_ops)); | ||
321 | s->fe.demodulator_priv = s; | ||
322 | |||
323 | goto success; | ||
324 | error: | ||
325 | return NULL; | ||
326 | success: | ||
327 | return &s->fe; | ||
328 | } | ||
329 | 334 | ||
335 | if (!ops || !ops->in || !ops->out || !ops->reload) { | ||
336 | pr_err("Error! gp8psk-fe ops not defined.\n"); | ||
337 | return NULL; | ||
338 | } | ||
339 | |||
340 | st = kzalloc(sizeof(struct gp8psk_fe_state), GFP_KERNEL); | ||
341 | if (!st) | ||
342 | return NULL; | ||
343 | |||
344 | memcpy(&st->fe.ops, &gp8psk_fe_ops, sizeof(struct dvb_frontend_ops)); | ||
345 | st->fe.demodulator_priv = st; | ||
346 | st->ops = ops; | ||
347 | st->priv = priv; | ||
348 | st->is_rev1 = is_rev1; | ||
349 | |||
350 | pr_info("Frontend %sattached\n", is_rev1 ? "revision 1 " : ""); | ||
351 | |||
352 | return &st->fe; | ||
353 | } | ||
354 | EXPORT_SYMBOL_GPL(gp8psk_fe_attach); | ||
330 | 355 | ||
331 | static struct dvb_frontend_ops gp8psk_fe_ops = { | 356 | static struct dvb_frontend_ops gp8psk_fe_ops = { |
332 | .delsys = { SYS_DVBS }, | 357 | .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 index 000000000000..6c7944b1ecd6 --- /dev/null +++ b/drivers/media/dvb-frontends/gp8psk-fe.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * gp8psk_fe driver | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2, or (at your option) | ||
7 | * any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef GP8PSK_FE_H | ||
16 | #define GP8PSK_FE_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | /* gp8psk commands */ | ||
21 | |||
22 | #define GET_8PSK_CONFIG 0x80 /* in */ | ||
23 | #define SET_8PSK_CONFIG 0x81 | ||
24 | #define I2C_WRITE 0x83 | ||
25 | #define I2C_READ 0x84 | ||
26 | #define ARM_TRANSFER 0x85 | ||
27 | #define TUNE_8PSK 0x86 | ||
28 | #define GET_SIGNAL_STRENGTH 0x87 /* in */ | ||
29 | #define LOAD_BCM4500 0x88 | ||
30 | #define BOOT_8PSK 0x89 /* in */ | ||
31 | #define START_INTERSIL 0x8A /* in */ | ||
32 | #define SET_LNB_VOLTAGE 0x8B | ||
33 | #define SET_22KHZ_TONE 0x8C | ||
34 | #define SEND_DISEQC_COMMAND 0x8D | ||
35 | #define SET_DVB_MODE 0x8E | ||
36 | #define SET_DN_SWITCH 0x8F | ||
37 | #define GET_SIGNAL_LOCK 0x90 /* in */ | ||
38 | #define GET_FW_VERS 0x92 | ||
39 | #define GET_SERIAL_NUMBER 0x93 /* in */ | ||
40 | #define USE_EXTRA_VOLT 0x94 | ||
41 | #define GET_FPGA_VERS 0x95 | ||
42 | #define CW3K_INIT 0x9d | ||
43 | |||
44 | /* PSK_configuration bits */ | ||
45 | #define bm8pskStarted 0x01 | ||
46 | #define bm8pskFW_Loaded 0x02 | ||
47 | #define bmIntersilOn 0x04 | ||
48 | #define bmDVBmode 0x08 | ||
49 | #define bm22kHz 0x10 | ||
50 | #define bmSEL18V 0x20 | ||
51 | #define bmDCtuned 0x40 | ||
52 | #define bmArmed 0x80 | ||
53 | |||
54 | /* Satellite modulation modes */ | ||
55 | #define ADV_MOD_DVB_QPSK 0 /* DVB-S QPSK */ | ||
56 | #define ADV_MOD_TURBO_QPSK 1 /* Turbo QPSK */ | ||
57 | #define ADV_MOD_TURBO_8PSK 2 /* Turbo 8PSK (also used for Trellis 8PSK) */ | ||
58 | #define ADV_MOD_TURBO_16QAM 3 /* Turbo 16QAM (also used for Trellis 8PSK) */ | ||
59 | |||
60 | #define ADV_MOD_DCII_C_QPSK 4 /* Digicipher II Combo */ | ||
61 | #define ADV_MOD_DCII_I_QPSK 5 /* Digicipher II I-stream */ | ||
62 | #define ADV_MOD_DCII_Q_QPSK 6 /* Digicipher II Q-stream */ | ||
63 | #define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */ | ||
64 | #define ADV_MOD_DSS_QPSK 8 /* DSS (DIRECTV) QPSK */ | ||
65 | #define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */ | ||
66 | |||
67 | /* firmware revision id's */ | ||
68 | #define GP8PSK_FW_REV1 0x020604 | ||
69 | #define GP8PSK_FW_REV2 0x020704 | ||
70 | #define GP8PSK_FW_VERS(_fw_vers) \ | ||
71 | ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0]) | ||
72 | |||
73 | struct gp8psk_fe_ops { | ||
74 | int (*in)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen); | ||
75 | int (*out)(void *priv, u8 req, u16 value, u16 index, u8 *b, int blen); | ||
76 | int (*reload)(void *priv); | ||
77 | }; | ||
78 | |||
79 | struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops, | ||
80 | void *priv, bool is_rev1); | ||
81 | |||
82 | #endif | ||
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index f95a6bc839d5..cede3975d04b 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c | |||
@@ -118,7 +118,7 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol, | |||
118 | *protocol = RC_TYPE_RC6_MCE; | 118 | *protocol = RC_TYPE_RC6_MCE; |
119 | dev &= 0x7f; | 119 | dev &= 0x7f; |
120 | dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n", | 120 | dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n", |
121 | toggle, vendor, dev, code); | 121 | *ptoggle, vendor, dev, code); |
122 | } else { | 122 | } else { |
123 | *ptoggle = 0; | 123 | *ptoggle = 0; |
124 | *protocol = RC_TYPE_RC6_6A_32; | 124 | *protocol = RC_TYPE_RC6_6A_32; |
diff --git a/drivers/media/usb/dvb-usb/Makefile b/drivers/media/usb/dvb-usb/Makefile index 2a7b5a963acf..3b3f32b426d1 100644 --- a/drivers/media/usb/dvb-usb/Makefile +++ b/drivers/media/usb/dvb-usb/Makefile | |||
@@ -8,7 +8,7 @@ obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o | |||
8 | dvb-usb-vp702x-objs := vp702x.o vp702x-fe.o | 8 | dvb-usb-vp702x-objs := vp702x.o vp702x-fe.o |
9 | obj-$(CONFIG_DVB_USB_VP702X) += dvb-usb-vp702x.o | 9 | obj-$(CONFIG_DVB_USB_VP702X) += dvb-usb-vp702x.o |
10 | 10 | ||
11 | dvb-usb-gp8psk-objs := gp8psk.o gp8psk-fe.o | 11 | dvb-usb-gp8psk-objs := gp8psk.o |
12 | obj-$(CONFIG_DVB_USB_GP8PSK) += dvb-usb-gp8psk.o | 12 | obj-$(CONFIG_DVB_USB_GP8PSK) += dvb-usb-gp8psk.o |
13 | 13 | ||
14 | dvb-usb-dtt200u-objs := dtt200u.o dtt200u-fe.o | 14 | dvb-usb-dtt200u-objs := dtt200u.o dtt200u-fe.o |
diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c index b257780fb380..7853261906b1 100644 --- a/drivers/media/usb/dvb-usb/af9005.c +++ b/drivers/media/usb/dvb-usb/af9005.c | |||
@@ -53,7 +53,6 @@ struct af9005_device_state { | |||
53 | u8 sequence; | 53 | u8 sequence; |
54 | int led_state; | 54 | int led_state; |
55 | unsigned char data[256]; | 55 | unsigned char data[256]; |
56 | struct mutex data_mutex; | ||
57 | }; | 56 | }; |
58 | 57 | ||
59 | static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, | 58 | 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, | |||
72 | return -EINVAL; | 71 | return -EINVAL; |
73 | } | 72 | } |
74 | 73 | ||
75 | mutex_lock(&st->data_mutex); | 74 | mutex_lock(&d->data_mutex); |
76 | st->data[0] = 14; /* rest of buffer length low */ | 75 | st->data[0] = 14; /* rest of buffer length low */ |
77 | st->data[1] = 0; /* rest of buffer length high */ | 76 | st->data[1] = 0; /* rest of buffer length high */ |
78 | 77 | ||
@@ -140,7 +139,7 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, | |||
140 | values[i] = st->data[8 + i]; | 139 | values[i] = st->data[8 + i]; |
141 | 140 | ||
142 | ret: | 141 | ret: |
143 | mutex_unlock(&st->data_mutex); | 142 | mutex_unlock(&d->data_mutex); |
144 | return ret; | 143 | return ret; |
145 | 144 | ||
146 | } | 145 | } |
@@ -481,7 +480,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf, | |||
481 | } | 480 | } |
482 | packet_len = wlen + 5; | 481 | packet_len = wlen + 5; |
483 | 482 | ||
484 | mutex_lock(&st->data_mutex); | 483 | mutex_lock(&d->data_mutex); |
485 | 484 | ||
486 | st->data[0] = (u8) (packet_len & 0xff); | 485 | st->data[0] = (u8) (packet_len & 0xff); |
487 | st->data[1] = (u8) ((packet_len & 0xff00) >> 8); | 486 | 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, | |||
512 | rbuf[i] = st->data[i + 7]; | 511 | rbuf[i] = st->data[i + 7]; |
513 | } | 512 | } |
514 | 513 | ||
515 | mutex_unlock(&st->data_mutex); | 514 | mutex_unlock(&d->data_mutex); |
516 | return ret; | 515 | return ret; |
517 | } | 516 | } |
518 | 517 | ||
@@ -523,7 +522,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values, | |||
523 | u8 seq; | 522 | u8 seq; |
524 | int ret, i; | 523 | int ret, i; |
525 | 524 | ||
526 | mutex_lock(&st->data_mutex); | 525 | mutex_lock(&d->data_mutex); |
527 | 526 | ||
528 | memset(st->data, 0, sizeof(st->data)); | 527 | memset(st->data, 0, sizeof(st->data)); |
529 | 528 | ||
@@ -559,7 +558,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values, | |||
559 | for (i = 0; i < len; i++) | 558 | for (i = 0; i < len; i++) |
560 | values[i] = st->data[6 + i]; | 559 | values[i] = st->data[6 + i]; |
561 | } | 560 | } |
562 | mutex_unlock(&st->data_mutex); | 561 | mutex_unlock(&d->data_mutex); |
563 | 562 | ||
564 | return ret; | 563 | return ret; |
565 | } | 564 | } |
@@ -847,7 +846,7 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state) | |||
847 | return 0; | 846 | return 0; |
848 | } | 847 | } |
849 | 848 | ||
850 | mutex_lock(&st->data_mutex); | 849 | mutex_lock(&d->data_mutex); |
851 | 850 | ||
852 | /* deb_info("rc_query\n"); */ | 851 | /* deb_info("rc_query\n"); */ |
853 | st->data[0] = 3; /* rest of packet length low */ | 852 | 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) | |||
890 | } | 889 | } |
891 | 890 | ||
892 | ret: | 891 | ret: |
893 | mutex_unlock(&st->data_mutex); | 892 | mutex_unlock(&d->data_mutex); |
894 | return ret; | 893 | return ret; |
895 | } | 894 | } |
896 | 895 | ||
@@ -1004,20 +1003,8 @@ static struct dvb_usb_device_properties af9005_properties; | |||
1004 | static int af9005_usb_probe(struct usb_interface *intf, | 1003 | static int af9005_usb_probe(struct usb_interface *intf, |
1005 | const struct usb_device_id *id) | 1004 | const struct usb_device_id *id) |
1006 | { | 1005 | { |
1007 | struct dvb_usb_device *d; | 1006 | return dvb_usb_device_init(intf, &af9005_properties, |
1008 | struct af9005_device_state *st; | 1007 | THIS_MODULE, NULL, adapter_nr); |
1009 | int ret; | ||
1010 | |||
1011 | ret = dvb_usb_device_init(intf, &af9005_properties, | ||
1012 | THIS_MODULE, &d, adapter_nr); | ||
1013 | |||
1014 | if (ret < 0) | ||
1015 | return ret; | ||
1016 | |||
1017 | st = d->priv; | ||
1018 | mutex_init(&st->data_mutex); | ||
1019 | |||
1020 | return 0; | ||
1021 | } | 1008 | } |
1022 | 1009 | ||
1023 | enum af9005_usb_table_entry { | 1010 | enum af9005_usb_table_entry { |
diff --git a/drivers/media/usb/dvb-usb/cinergyT2-core.c b/drivers/media/usb/dvb-usb/cinergyT2-core.c index 8ac825413d5a..290275bc7fde 100644 --- a/drivers/media/usb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/usb/dvb-usb/cinergyT2-core.c | |||
@@ -42,7 +42,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
42 | struct cinergyt2_state { | 42 | struct cinergyt2_state { |
43 | u8 rc_counter; | 43 | u8 rc_counter; |
44 | unsigned char data[64]; | 44 | unsigned char data[64]; |
45 | struct mutex data_mutex; | ||
46 | }; | 45 | }; |
47 | 46 | ||
48 | /* We are missing a release hook with usb_device data */ | 47 | /* 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) | |||
56 | struct cinergyt2_state *st = d->priv; | 55 | struct cinergyt2_state *st = d->priv; |
57 | int ret; | 56 | int ret; |
58 | 57 | ||
59 | mutex_lock(&st->data_mutex); | 58 | mutex_lock(&d->data_mutex); |
60 | st->data[0] = CINERGYT2_EP1_CONTROL_STREAM_TRANSFER; | 59 | st->data[0] = CINERGYT2_EP1_CONTROL_STREAM_TRANSFER; |
61 | st->data[1] = enable ? 1 : 0; | 60 | st->data[1] = enable ? 1 : 0; |
62 | 61 | ||
63 | ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 64, 0); | 62 | ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 64, 0); |
64 | mutex_unlock(&st->data_mutex); | 63 | mutex_unlock(&d->data_mutex); |
65 | 64 | ||
66 | return ret; | 65 | return ret; |
67 | } | 66 | } |
@@ -71,12 +70,12 @@ static int cinergyt2_power_ctrl(struct dvb_usb_device *d, int enable) | |||
71 | struct cinergyt2_state *st = d->priv; | 70 | struct cinergyt2_state *st = d->priv; |
72 | int ret; | 71 | int ret; |
73 | 72 | ||
74 | mutex_lock(&st->data_mutex); | 73 | mutex_lock(&d->data_mutex); |
75 | st->data[0] = CINERGYT2_EP1_SLEEP_MODE; | 74 | st->data[0] = CINERGYT2_EP1_SLEEP_MODE; |
76 | st->data[1] = enable ? 0 : 1; | 75 | st->data[1] = enable ? 0 : 1; |
77 | 76 | ||
78 | ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 3, 0); | 77 | ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 3, 0); |
79 | mutex_unlock(&st->data_mutex); | 78 | mutex_unlock(&d->data_mutex); |
80 | 79 | ||
81 | return ret; | 80 | return ret; |
82 | } | 81 | } |
@@ -89,7 +88,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) | |||
89 | 88 | ||
90 | adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev); | 89 | adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev); |
91 | 90 | ||
92 | mutex_lock(&st->data_mutex); | 91 | mutex_lock(&d->data_mutex); |
93 | st->data[0] = CINERGYT2_EP1_GET_FIRMWARE_VERSION; | 92 | st->data[0] = CINERGYT2_EP1_GET_FIRMWARE_VERSION; |
94 | 93 | ||
95 | ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 3, 0); | 94 | 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) | |||
97 | deb_rc("cinergyt2_power_ctrl() Failed to retrieve sleep " | 96 | deb_rc("cinergyt2_power_ctrl() Failed to retrieve sleep " |
98 | "state info\n"); | 97 | "state info\n"); |
99 | } | 98 | } |
100 | mutex_unlock(&st->data_mutex); | 99 | mutex_unlock(&d->data_mutex); |
101 | 100 | ||
102 | /* Copy this pointer as we are gonna need it in the release phase */ | 101 | /* Copy this pointer as we are gonna need it in the release phase */ |
103 | cinergyt2_usb_device = adap->dev; | 102 | cinergyt2_usb_device = adap->dev; |
@@ -166,7 +165,7 @@ static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
166 | 165 | ||
167 | *state = REMOTE_NO_KEY_PRESSED; | 166 | *state = REMOTE_NO_KEY_PRESSED; |
168 | 167 | ||
169 | mutex_lock(&st->data_mutex); | 168 | mutex_lock(&d->data_mutex); |
170 | st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS; | 169 | st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS; |
171 | 170 | ||
172 | ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); | 171 | 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) | |||
202 | } | 201 | } |
203 | 202 | ||
204 | ret: | 203 | ret: |
205 | mutex_unlock(&st->data_mutex); | 204 | mutex_unlock(&d->data_mutex); |
206 | return ret; | 205 | return ret; |
207 | } | 206 | } |
208 | 207 | ||
209 | static int cinergyt2_usb_probe(struct usb_interface *intf, | 208 | static int cinergyt2_usb_probe(struct usb_interface *intf, |
210 | const struct usb_device_id *id) | 209 | const struct usb_device_id *id) |
211 | { | 210 | { |
212 | struct dvb_usb_device *d; | 211 | return dvb_usb_device_init(intf, &cinergyt2_properties, |
213 | struct cinergyt2_state *st; | 212 | THIS_MODULE, NULL, adapter_nr); |
214 | int ret; | ||
215 | |||
216 | ret = dvb_usb_device_init(intf, &cinergyt2_properties, | ||
217 | THIS_MODULE, &d, adapter_nr); | ||
218 | if (ret < 0) | ||
219 | return ret; | ||
220 | |||
221 | st = d->priv; | ||
222 | mutex_init(&st->data_mutex); | ||
223 | |||
224 | return 0; | ||
225 | } | 213 | } |
226 | 214 | ||
227 | |||
228 | static struct usb_device_id cinergyt2_usb_table[] = { | 215 | static struct usb_device_id cinergyt2_usb_table[] = { |
229 | { USB_DEVICE(USB_VID_TERRATEC, 0x0038) }, | 216 | { USB_DEVICE(USB_VID_TERRATEC, 0x0038) }, |
230 | { 0 } | 217 | { 0 } |
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 39772812269d..243403081fa5 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c | |||
@@ -68,7 +68,7 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, | |||
68 | 68 | ||
69 | wo = (rbuf == NULL || rlen == 0); /* write-only */ | 69 | wo = (rbuf == NULL || rlen == 0); /* write-only */ |
70 | 70 | ||
71 | mutex_lock(&st->data_mutex); | 71 | mutex_lock(&d->data_mutex); |
72 | st->data[0] = cmd; | 72 | st->data[0] = cmd; |
73 | memcpy(&st->data[1], wbuf, wlen); | 73 | memcpy(&st->data[1], wbuf, wlen); |
74 | if (wo) | 74 | if (wo) |
@@ -77,7 +77,7 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, | |||
77 | ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, | 77 | ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, |
78 | rbuf, rlen, 0); | 78 | rbuf, rlen, 0); |
79 | 79 | ||
80 | mutex_unlock(&st->data_mutex); | 80 | mutex_unlock(&d->data_mutex); |
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
@@ -1461,43 +1461,36 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties; | |||
1461 | static int cxusb_probe(struct usb_interface *intf, | 1461 | static int cxusb_probe(struct usb_interface *intf, |
1462 | const struct usb_device_id *id) | 1462 | const struct usb_device_id *id) |
1463 | { | 1463 | { |
1464 | struct dvb_usb_device *d; | ||
1465 | struct cxusb_state *st; | ||
1466 | |||
1467 | if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties, | 1464 | if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties, |
1468 | THIS_MODULE, &d, adapter_nr) || | 1465 | THIS_MODULE, NULL, adapter_nr) || |
1469 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties, | 1466 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties, |
1470 | THIS_MODULE, &d, adapter_nr) || | 1467 | THIS_MODULE, NULL, adapter_nr) || |
1471 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties, | 1468 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties, |
1472 | THIS_MODULE, &d, adapter_nr) || | 1469 | THIS_MODULE, NULL, adapter_nr) || |
1473 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties, | 1470 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties, |
1474 | THIS_MODULE, &d, adapter_nr) || | 1471 | THIS_MODULE, NULL, adapter_nr) || |
1475 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties, | 1472 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties, |
1476 | THIS_MODULE, &d, adapter_nr) || | 1473 | THIS_MODULE, NULL, adapter_nr) || |
1477 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties, | 1474 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties, |
1478 | THIS_MODULE, &d, adapter_nr) || | 1475 | THIS_MODULE, NULL, adapter_nr) || |
1479 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties, | 1476 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties, |
1480 | THIS_MODULE, &d, adapter_nr) || | 1477 | THIS_MODULE, NULL, adapter_nr) || |
1481 | 0 == dvb_usb_device_init(intf, | 1478 | 0 == dvb_usb_device_init(intf, |
1482 | &cxusb_bluebird_nano2_needsfirmware_properties, | 1479 | &cxusb_bluebird_nano2_needsfirmware_properties, |
1483 | THIS_MODULE, &d, adapter_nr) || | 1480 | THIS_MODULE, NULL, adapter_nr) || |
1484 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, | 1481 | 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, |
1485 | THIS_MODULE, &d, adapter_nr) || | 1482 | THIS_MODULE, NULL, adapter_nr) || |
1486 | 0 == dvb_usb_device_init(intf, | 1483 | 0 == dvb_usb_device_init(intf, |
1487 | &cxusb_bluebird_dualdig4_rev2_properties, | 1484 | &cxusb_bluebird_dualdig4_rev2_properties, |
1488 | THIS_MODULE, &d, adapter_nr) || | 1485 | THIS_MODULE, NULL, adapter_nr) || |
1489 | 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, | 1486 | 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, |
1490 | THIS_MODULE, &d, adapter_nr) || | 1487 | THIS_MODULE, NULL, adapter_nr) || |
1491 | 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, | 1488 | 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, |
1492 | THIS_MODULE, &d, adapter_nr) || | 1489 | THIS_MODULE, NULL, adapter_nr) || |
1493 | 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties, | 1490 | 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties, |
1494 | THIS_MODULE, &d, adapter_nr) || | 1491 | THIS_MODULE, NULL, adapter_nr) || |
1495 | 0) { | 1492 | 0) |
1496 | st = d->priv; | ||
1497 | mutex_init(&st->data_mutex); | ||
1498 | |||
1499 | return 0; | 1493 | return 0; |
1500 | } | ||
1501 | 1494 | ||
1502 | return -EINVAL; | 1495 | return -EINVAL; |
1503 | } | 1496 | } |
diff --git a/drivers/media/usb/dvb-usb/cxusb.h b/drivers/media/usb/dvb-usb/cxusb.h index 9f3ee0e47d5c..18acda19527a 100644 --- a/drivers/media/usb/dvb-usb/cxusb.h +++ b/drivers/media/usb/dvb-usb/cxusb.h | |||
@@ -37,7 +37,6 @@ struct cxusb_state { | |||
37 | struct i2c_client *i2c_client_tuner; | 37 | struct i2c_client *i2c_client_tuner; |
38 | 38 | ||
39 | unsigned char data[MAX_XFER_SIZE]; | 39 | unsigned char data[MAX_XFER_SIZE]; |
40 | struct mutex data_mutex; | ||
41 | }; | 40 | }; |
42 | 41 | ||
43 | #endif | 42 | #endif |
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index 92d5408684ac..47ce9d5de4c6 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c | |||
@@ -704,7 +704,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
704 | struct dvb_usb_device *d = purb->context; | 704 | struct dvb_usb_device *d = purb->context; |
705 | struct dib0700_rc_response *poll_reply; | 705 | struct dib0700_rc_response *poll_reply; |
706 | enum rc_type protocol; | 706 | enum rc_type protocol; |
707 | u32 uninitialized_var(keycode); | 707 | u32 keycode; |
708 | u8 toggle; | 708 | u8 toggle; |
709 | 709 | ||
710 | deb_info("%s()\n", __func__); | 710 | deb_info("%s()\n", __func__); |
@@ -745,7 +745,8 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
745 | poll_reply->nec.data == 0x00 && | 745 | poll_reply->nec.data == 0x00 && |
746 | poll_reply->nec.not_data == 0xff) { | 746 | poll_reply->nec.not_data == 0xff) { |
747 | poll_reply->data_state = 2; | 747 | poll_reply->data_state = 2; |
748 | break; | 748 | rc_repeat(d->rc_dev); |
749 | goto resubmit; | ||
749 | } | 750 | } |
750 | 751 | ||
751 | if ((poll_reply->nec.data ^ poll_reply->nec.not_data) != 0xff) { | 752 | if ((poll_reply->nec.data ^ poll_reply->nec.not_data) != 0xff) { |
diff --git a/drivers/media/usb/dvb-usb/dtt200u.c b/drivers/media/usb/dvb-usb/dtt200u.c index f88572c7ae7c..fcbff7fb0c4e 100644 --- a/drivers/media/usb/dvb-usb/dtt200u.c +++ b/drivers/media/usb/dvb-usb/dtt200u.c | |||
@@ -22,7 +22,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
22 | 22 | ||
23 | struct dtt200u_state { | 23 | struct dtt200u_state { |
24 | unsigned char data[80]; | 24 | unsigned char data[80]; |
25 | struct mutex data_mutex; | ||
26 | }; | 25 | }; |
27 | 26 | ||
28 | static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) | 27 | 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) | |||
30 | struct dtt200u_state *st = d->priv; | 29 | struct dtt200u_state *st = d->priv; |
31 | int ret = 0; | 30 | int ret = 0; |
32 | 31 | ||
33 | mutex_lock(&st->data_mutex); | 32 | mutex_lock(&d->data_mutex); |
34 | 33 | ||
35 | st->data[0] = SET_INIT; | 34 | st->data[0] = SET_INIT; |
36 | 35 | ||
37 | if (onoff) | 36 | if (onoff) |
38 | ret = dvb_usb_generic_write(d, st->data, 2); | 37 | ret = dvb_usb_generic_write(d, st->data, 2); |
39 | 38 | ||
40 | mutex_unlock(&st->data_mutex); | 39 | mutex_unlock(&d->data_mutex); |
41 | return ret; | 40 | return ret; |
42 | } | 41 | } |
43 | 42 | ||
44 | static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | 43 | static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
45 | { | 44 | { |
46 | struct dtt200u_state *st = adap->dev->priv; | 45 | struct dvb_usb_device *d = adap->dev; |
46 | struct dtt200u_state *st = d->priv; | ||
47 | int ret; | 47 | int ret; |
48 | 48 | ||
49 | mutex_lock(&st->data_mutex); | 49 | mutex_lock(&d->data_mutex); |
50 | st->data[0] = SET_STREAMING; | 50 | st->data[0] = SET_STREAMING; |
51 | st->data[1] = onoff; | 51 | st->data[1] = onoff; |
52 | 52 | ||
@@ -61,26 +61,27 @@ static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
61 | ret = dvb_usb_generic_write(adap->dev, st->data, 1); | 61 | ret = dvb_usb_generic_write(adap->dev, st->data, 1); |
62 | 62 | ||
63 | ret: | 63 | ret: |
64 | mutex_unlock(&st->data_mutex); | 64 | mutex_unlock(&d->data_mutex); |
65 | 65 | ||
66 | return ret; | 66 | return ret; |
67 | } | 67 | } |
68 | 68 | ||
69 | static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) | 69 | static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) |
70 | { | 70 | { |
71 | struct dtt200u_state *st = adap->dev->priv; | 71 | struct dvb_usb_device *d = adap->dev; |
72 | struct dtt200u_state *st = d->priv; | ||
72 | int ret; | 73 | int ret; |
73 | 74 | ||
74 | pid = onoff ? pid : 0; | 75 | pid = onoff ? pid : 0; |
75 | 76 | ||
76 | mutex_lock(&st->data_mutex); | 77 | mutex_lock(&d->data_mutex); |
77 | st->data[0] = SET_PID_FILTER; | 78 | st->data[0] = SET_PID_FILTER; |
78 | st->data[1] = index; | 79 | st->data[1] = index; |
79 | st->data[2] = pid & 0xff; | 80 | st->data[2] = pid & 0xff; |
80 | st->data[3] = (pid >> 8) & 0x1f; | 81 | st->data[3] = (pid >> 8) & 0x1f; |
81 | 82 | ||
82 | ret = dvb_usb_generic_write(adap->dev, st->data, 4); | 83 | ret = dvb_usb_generic_write(adap->dev, st->data, 4); |
83 | mutex_unlock(&st->data_mutex); | 84 | mutex_unlock(&d->data_mutex); |
84 | 85 | ||
85 | return ret; | 86 | return ret; |
86 | } | 87 | } |
@@ -91,7 +92,7 @@ static int dtt200u_rc_query(struct dvb_usb_device *d) | |||
91 | u32 scancode; | 92 | u32 scancode; |
92 | int ret; | 93 | int ret; |
93 | 94 | ||
94 | mutex_lock(&st->data_mutex); | 95 | mutex_lock(&d->data_mutex); |
95 | st->data[0] = GET_RC_CODE; | 96 | st->data[0] = GET_RC_CODE; |
96 | 97 | ||
97 | ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); | 98 | 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) | |||
126 | deb_info("st->data: %*ph\n", 5, st->data); | 127 | deb_info("st->data: %*ph\n", 5, st->data); |
127 | 128 | ||
128 | ret: | 129 | ret: |
129 | mutex_unlock(&st->data_mutex); | 130 | mutex_unlock(&d->data_mutex); |
130 | return ret; | 131 | return ret; |
131 | } | 132 | } |
132 | 133 | ||
@@ -145,24 +146,17 @@ static struct dvb_usb_device_properties wt220u_miglia_properties; | |||
145 | static int dtt200u_usb_probe(struct usb_interface *intf, | 146 | static int dtt200u_usb_probe(struct usb_interface *intf, |
146 | const struct usb_device_id *id) | 147 | const struct usb_device_id *id) |
147 | { | 148 | { |
148 | struct dvb_usb_device *d; | ||
149 | struct dtt200u_state *st; | ||
150 | |||
151 | if (0 == dvb_usb_device_init(intf, &dtt200u_properties, | 149 | if (0 == dvb_usb_device_init(intf, &dtt200u_properties, |
152 | THIS_MODULE, &d, adapter_nr) || | 150 | THIS_MODULE, NULL, adapter_nr) || |
153 | 0 == dvb_usb_device_init(intf, &wt220u_properties, | 151 | 0 == dvb_usb_device_init(intf, &wt220u_properties, |
154 | THIS_MODULE, &d, adapter_nr) || | 152 | THIS_MODULE, NULL, adapter_nr) || |
155 | 0 == dvb_usb_device_init(intf, &wt220u_fc_properties, | 153 | 0 == dvb_usb_device_init(intf, &wt220u_fc_properties, |
156 | THIS_MODULE, &d, adapter_nr) || | 154 | THIS_MODULE, NULL, adapter_nr) || |
157 | 0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties, | 155 | 0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties, |
158 | THIS_MODULE, &d, adapter_nr) || | 156 | THIS_MODULE, NULL, adapter_nr) || |
159 | 0 == dvb_usb_device_init(intf, &wt220u_miglia_properties, | 157 | 0 == dvb_usb_device_init(intf, &wt220u_miglia_properties, |
160 | THIS_MODULE, &d, adapter_nr)) { | 158 | THIS_MODULE, NULL, adapter_nr)) |
161 | st = d->priv; | ||
162 | mutex_init(&st->data_mutex); | ||
163 | |||
164 | return 0; | 159 | return 0; |
165 | } | ||
166 | 160 | ||
167 | return -ENODEV; | 161 | return -ENODEV; |
168 | } | 162 | } |
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c index 3896ba9a4179..84308569e7dc 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c | |||
@@ -142,6 +142,7 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) | |||
142 | { | 142 | { |
143 | int ret = 0; | 143 | int ret = 0; |
144 | 144 | ||
145 | mutex_init(&d->data_mutex); | ||
145 | mutex_init(&d->usb_mutex); | 146 | mutex_init(&d->usb_mutex); |
146 | mutex_init(&d->i2c_mutex); | 147 | mutex_init(&d->i2c_mutex); |
147 | 148 | ||
diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h index 639c4678c65b..107255b08b2b 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb.h +++ b/drivers/media/usb/dvb-usb/dvb-usb.h | |||
@@ -404,8 +404,12 @@ struct dvb_usb_adapter { | |||
404 | * Powered is in/decremented for each call to modify the state. | 404 | * Powered is in/decremented for each call to modify the state. |
405 | * @udev: pointer to the device's struct usb_device. | 405 | * @udev: pointer to the device's struct usb_device. |
406 | * | 406 | * |
407 | * @usb_mutex: semaphore of USB control messages (reading needs two messages) | 407 | * @data_mutex: mutex to protect the data structure used to store URB data |
408 | * @i2c_mutex: semaphore for i2c-transfers | 408 | * @usb_mutex: mutex of USB control messages (reading needs two messages). |
409 | * Please notice that this mutex is used internally at the generic | ||
410 | * URB control functions. So, drivers using dvb_usb_generic_rw() and | ||
411 | * derivated functions should not lock it internally. | ||
412 | * @i2c_mutex: mutex for i2c-transfers | ||
409 | * | 413 | * |
410 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB | 414 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB |
411 | * | 415 | * |
@@ -433,6 +437,7 @@ struct dvb_usb_device { | |||
433 | int powered; | 437 | int powered; |
434 | 438 | ||
435 | /* locking */ | 439 | /* locking */ |
440 | struct mutex data_mutex; | ||
436 | struct mutex usb_mutex; | 441 | struct mutex usb_mutex; |
437 | 442 | ||
438 | /* i2c */ | 443 | /* i2c */ |
diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c index adfd76491451..993bb7a72985 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.c +++ b/drivers/media/usb/dvb-usb/gp8psk.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * see Documentation/dvb/README.dvb-usb for more information | 15 | * see Documentation/dvb/README.dvb-usb for more information |
16 | */ | 16 | */ |
17 | #include "gp8psk.h" | 17 | #include "gp8psk.h" |
18 | #include "gp8psk-fe.h" | ||
18 | 19 | ||
19 | /* debug */ | 20 | /* debug */ |
20 | static char bcm4500_firmware[] = "dvb-usb-gp8psk-02.fw"; | 21 | static char bcm4500_firmware[] = "dvb-usb-gp8psk-02.fw"; |
@@ -28,34 +29,8 @@ struct gp8psk_state { | |||
28 | unsigned char data[80]; | 29 | unsigned char data[80]; |
29 | }; | 30 | }; |
30 | 31 | ||
31 | static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers) | 32 | static int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, |
32 | { | 33 | u16 index, u8 *b, int blen) |
33 | return (gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6)); | ||
34 | } | ||
35 | |||
36 | static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers) | ||
37 | { | ||
38 | return (gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1)); | ||
39 | } | ||
40 | |||
41 | static void gp8psk_info(struct dvb_usb_device *d) | ||
42 | { | ||
43 | u8 fpga_vers, fw_vers[6]; | ||
44 | |||
45 | if (!gp8psk_get_fw_version(d, fw_vers)) | ||
46 | info("FW Version = %i.%02i.%i (0x%x) Build %4i/%02i/%02i", | ||
47 | fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers), | ||
48 | 2000 + fw_vers[5], fw_vers[4], fw_vers[3]); | ||
49 | else | ||
50 | info("failed to get FW version"); | ||
51 | |||
52 | if (!gp8psk_get_fpga_version(d, &fpga_vers)) | ||
53 | info("FPGA Version = %i", fpga_vers); | ||
54 | else | ||
55 | info("failed to get FPGA version"); | ||
56 | } | ||
57 | |||
58 | int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | ||
59 | { | 34 | { |
60 | struct gp8psk_state *st = d->priv; | 35 | struct gp8psk_state *st = d->priv; |
61 | int ret = 0,try = 0; | 36 | 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 | |||
67 | return ret; | 42 | return ret; |
68 | 43 | ||
69 | while (ret >= 0 && ret != blen && try < 3) { | 44 | while (ret >= 0 && ret != blen && try < 3) { |
70 | memcpy(st->data, b, blen); | ||
71 | ret = usb_control_msg(d->udev, | 45 | ret = usb_control_msg(d->udev, |
72 | usb_rcvctrlpipe(d->udev,0), | 46 | usb_rcvctrlpipe(d->udev,0), |
73 | req, | 47 | req, |
@@ -81,8 +55,10 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 | |||
81 | if (ret < 0 || ret != blen) { | 55 | if (ret < 0 || ret != blen) { |
82 | warn("usb in %d operation failed.", req); | 56 | warn("usb in %d operation failed.", req); |
83 | ret = -EIO; | 57 | ret = -EIO; |
84 | } else | 58 | } else { |
85 | ret = 0; | 59 | ret = 0; |
60 | memcpy(b, st->data, blen); | ||
61 | } | ||
86 | 62 | ||
87 | deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index); | 63 | deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index); |
88 | debug_dump(b,blen,deb_xfer); | 64 | 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 | |||
92 | return ret; | 68 | return ret; |
93 | } | 69 | } |
94 | 70 | ||
95 | int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | 71 | static int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, |
96 | u16 index, u8 *b, int blen) | 72 | u16 index, u8 *b, int blen) |
97 | { | 73 | { |
98 | struct gp8psk_state *st = d->priv; | 74 | struct gp8psk_state *st = d->priv; |
@@ -123,6 +99,34 @@ int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | |||
123 | return ret; | 99 | return ret; |
124 | } | 100 | } |
125 | 101 | ||
102 | |||
103 | static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers) | ||
104 | { | ||
105 | return gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6); | ||
106 | } | ||
107 | |||
108 | static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers) | ||
109 | { | ||
110 | return gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1); | ||
111 | } | ||
112 | |||
113 | static void gp8psk_info(struct dvb_usb_device *d) | ||
114 | { | ||
115 | u8 fpga_vers, fw_vers[6]; | ||
116 | |||
117 | if (!gp8psk_get_fw_version(d, fw_vers)) | ||
118 | info("FW Version = %i.%02i.%i (0x%x) Build %4i/%02i/%02i", | ||
119 | fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers), | ||
120 | 2000 + fw_vers[5], fw_vers[4], fw_vers[3]); | ||
121 | else | ||
122 | info("failed to get FW version"); | ||
123 | |||
124 | if (!gp8psk_get_fpga_version(d, &fpga_vers)) | ||
125 | info("FPGA Version = %i", fpga_vers); | ||
126 | else | ||
127 | info("failed to get FPGA version"); | ||
128 | } | ||
129 | |||
126 | static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) | 130 | static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) |
127 | { | 131 | { |
128 | int ret; | 132 | int ret; |
@@ -225,10 +229,13 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
225 | return 0; | 229 | return 0; |
226 | } | 230 | } |
227 | 231 | ||
228 | int gp8psk_bcm4500_reload(struct dvb_usb_device *d) | 232 | static int gp8psk_bcm4500_reload(struct dvb_usb_device *d) |
229 | { | 233 | { |
230 | u8 buf; | 234 | u8 buf; |
231 | int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); | 235 | int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); |
236 | |||
237 | deb_xfer("reloading firmware\n"); | ||
238 | |||
232 | /* Turn off 8psk power */ | 239 | /* Turn off 8psk power */ |
233 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) | 240 | if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) |
234 | return -EINVAL; | 241 | return -EINVAL; |
@@ -247,9 +254,47 @@ static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
247 | return gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0); | 254 | return gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0); |
248 | } | 255 | } |
249 | 256 | ||
257 | /* Callbacks for gp8psk-fe.c */ | ||
258 | |||
259 | static int gp8psk_fe_in(void *priv, u8 req, u16 value, | ||
260 | u16 index, u8 *b, int blen) | ||
261 | { | ||
262 | struct dvb_usb_device *d = priv; | ||
263 | |||
264 | return gp8psk_usb_in_op(d, req, value, index, b, blen); | ||
265 | } | ||
266 | |||
267 | static int gp8psk_fe_out(void *priv, u8 req, u16 value, | ||
268 | u16 index, u8 *b, int blen) | ||
269 | { | ||
270 | struct dvb_usb_device *d = priv; | ||
271 | |||
272 | return gp8psk_usb_out_op(d, req, value, index, b, blen); | ||
273 | } | ||
274 | |||
275 | static int gp8psk_fe_reload(void *priv) | ||
276 | { | ||
277 | struct dvb_usb_device *d = priv; | ||
278 | |||
279 | return gp8psk_bcm4500_reload(d); | ||
280 | } | ||
281 | |||
282 | const struct gp8psk_fe_ops gp8psk_fe_ops = { | ||
283 | .in = gp8psk_fe_in, | ||
284 | .out = gp8psk_fe_out, | ||
285 | .reload = gp8psk_fe_reload, | ||
286 | }; | ||
287 | |||
250 | static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap) | 288 | static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap) |
251 | { | 289 | { |
252 | adap->fe_adap[0].fe = gp8psk_fe_attach(adap->dev); | 290 | struct dvb_usb_device *d = adap->dev; |
291 | int id = le16_to_cpu(d->udev->descriptor.idProduct); | ||
292 | int is_rev1; | ||
293 | |||
294 | is_rev1 = (id == USB_PID_GENPIX_8PSK_REV_1_WARM) ? true : false; | ||
295 | |||
296 | adap->fe_adap[0].fe = dvb_attach(gp8psk_fe_attach, | ||
297 | &gp8psk_fe_ops, d, is_rev1); | ||
253 | return 0; | 298 | return 0; |
254 | } | 299 | } |
255 | 300 | ||
diff --git a/drivers/media/usb/dvb-usb/gp8psk.h b/drivers/media/usb/dvb-usb/gp8psk.h index ed32b9da4843..d8975b866dee 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.h +++ b/drivers/media/usb/dvb-usb/gp8psk.h | |||
@@ -24,58 +24,6 @@ extern int dvb_usb_gp8psk_debug; | |||
24 | #define deb_info(args...) dprintk(dvb_usb_gp8psk_debug,0x01,args) | 24 | #define deb_info(args...) dprintk(dvb_usb_gp8psk_debug,0x01,args) |
25 | #define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args) | 25 | #define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args) |
26 | #define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args) | 26 | #define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args) |
27 | #define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args) | ||
28 | |||
29 | /* Twinhan Vendor requests */ | ||
30 | #define TH_COMMAND_IN 0xC0 | ||
31 | #define TH_COMMAND_OUT 0xC1 | ||
32 | |||
33 | /* gp8psk commands */ | ||
34 | |||
35 | #define GET_8PSK_CONFIG 0x80 /* in */ | ||
36 | #define SET_8PSK_CONFIG 0x81 | ||
37 | #define I2C_WRITE 0x83 | ||
38 | #define I2C_READ 0x84 | ||
39 | #define ARM_TRANSFER 0x85 | ||
40 | #define TUNE_8PSK 0x86 | ||
41 | #define GET_SIGNAL_STRENGTH 0x87 /* in */ | ||
42 | #define LOAD_BCM4500 0x88 | ||
43 | #define BOOT_8PSK 0x89 /* in */ | ||
44 | #define START_INTERSIL 0x8A /* in */ | ||
45 | #define SET_LNB_VOLTAGE 0x8B | ||
46 | #define SET_22KHZ_TONE 0x8C | ||
47 | #define SEND_DISEQC_COMMAND 0x8D | ||
48 | #define SET_DVB_MODE 0x8E | ||
49 | #define SET_DN_SWITCH 0x8F | ||
50 | #define GET_SIGNAL_LOCK 0x90 /* in */ | ||
51 | #define GET_FW_VERS 0x92 | ||
52 | #define GET_SERIAL_NUMBER 0x93 /* in */ | ||
53 | #define USE_EXTRA_VOLT 0x94 | ||
54 | #define GET_FPGA_VERS 0x95 | ||
55 | #define CW3K_INIT 0x9d | ||
56 | |||
57 | /* PSK_configuration bits */ | ||
58 | #define bm8pskStarted 0x01 | ||
59 | #define bm8pskFW_Loaded 0x02 | ||
60 | #define bmIntersilOn 0x04 | ||
61 | #define bmDVBmode 0x08 | ||
62 | #define bm22kHz 0x10 | ||
63 | #define bmSEL18V 0x20 | ||
64 | #define bmDCtuned 0x40 | ||
65 | #define bmArmed 0x80 | ||
66 | |||
67 | /* Satellite modulation modes */ | ||
68 | #define ADV_MOD_DVB_QPSK 0 /* DVB-S QPSK */ | ||
69 | #define ADV_MOD_TURBO_QPSK 1 /* Turbo QPSK */ | ||
70 | #define ADV_MOD_TURBO_8PSK 2 /* Turbo 8PSK (also used for Trellis 8PSK) */ | ||
71 | #define ADV_MOD_TURBO_16QAM 3 /* Turbo 16QAM (also used for Trellis 8PSK) */ | ||
72 | |||
73 | #define ADV_MOD_DCII_C_QPSK 4 /* Digicipher II Combo */ | ||
74 | #define ADV_MOD_DCII_I_QPSK 5 /* Digicipher II I-stream */ | ||
75 | #define ADV_MOD_DCII_Q_QPSK 6 /* Digicipher II Q-stream */ | ||
76 | #define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */ | ||
77 | #define ADV_MOD_DSS_QPSK 8 /* DSS (DIRECTV) QPSK */ | ||
78 | #define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */ | ||
79 | 27 | ||
80 | #define GET_USB_SPEED 0x07 | 28 | #define GET_USB_SPEED 0x07 |
81 | 29 | ||
@@ -86,15 +34,4 @@ extern int dvb_usb_gp8psk_debug; | |||
86 | #define PRODUCT_STRING_READ 0x0D | 34 | #define PRODUCT_STRING_READ 0x0D |
87 | #define FW_BCD_VERSION_READ 0x14 | 35 | #define FW_BCD_VERSION_READ 0x14 |
88 | 36 | ||
89 | /* firmware revision id's */ | ||
90 | #define GP8PSK_FW_REV1 0x020604 | ||
91 | #define GP8PSK_FW_REV2 0x020704 | ||
92 | #define GP8PSK_FW_VERS(_fw_vers) ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0]) | ||
93 | |||
94 | extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d); | ||
95 | extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); | ||
96 | extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | ||
97 | u16 index, u8 *b, int blen); | ||
98 | extern int gp8psk_bcm4500_reload(struct dvb_usb_device *d); | ||
99 | |||
100 | #endif | 37 | #endif |
diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c index e9e6ea3ab73c..75b9d4ac8b1e 100644 --- a/drivers/misc/mei/bus-fixup.c +++ b/drivers/misc/mei/bus-fixup.c | |||
@@ -178,7 +178,7 @@ static int mei_nfc_if_version(struct mei_cl *cl, | |||
178 | 178 | ||
179 | ret = 0; | 179 | ret = 0; |
180 | bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length); | 180 | bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length); |
181 | if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) { | 181 | if (bytes_recv < if_version_length) { |
182 | dev_err(bus->dev, "Could not read IF version\n"); | 182 | dev_err(bus->dev, "Could not read IF version\n"); |
183 | ret = -EIO; | 183 | ret = -EIO; |
184 | goto err; | 184 | goto err; |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 5a8dc5a76e0d..3678220964fe 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -2347,7 +2347,7 @@ static int mmc_test_ongoing_transfer(struct mmc_test_card *test, | |||
2347 | struct mmc_test_req *rq = mmc_test_req_alloc(); | 2347 | struct mmc_test_req *rq = mmc_test_req_alloc(); |
2348 | struct mmc_host *host = test->card->host; | 2348 | struct mmc_host *host = test->card->host; |
2349 | struct mmc_test_area *t = &test->area; | 2349 | struct mmc_test_area *t = &test->area; |
2350 | struct mmc_async_req areq; | 2350 | struct mmc_test_async_req test_areq = { .test = test }; |
2351 | struct mmc_request *mrq; | 2351 | struct mmc_request *mrq; |
2352 | unsigned long timeout; | 2352 | unsigned long timeout; |
2353 | bool expired = false; | 2353 | bool expired = false; |
@@ -2363,8 +2363,8 @@ static int mmc_test_ongoing_transfer(struct mmc_test_card *test, | |||
2363 | mrq->sbc = &rq->sbc; | 2363 | mrq->sbc = &rq->sbc; |
2364 | mrq->cap_cmd_during_tfr = true; | 2364 | mrq->cap_cmd_during_tfr = true; |
2365 | 2365 | ||
2366 | areq.mrq = mrq; | 2366 | test_areq.areq.mrq = mrq; |
2367 | areq.err_check = mmc_test_check_result_async; | 2367 | test_areq.areq.err_check = mmc_test_check_result_async; |
2368 | 2368 | ||
2369 | mmc_test_prepare_mrq(test, mrq, t->sg, t->sg_len, dev_addr, t->blocks, | 2369 | mmc_test_prepare_mrq(test, mrq, t->sg, t->sg_len, dev_addr, t->blocks, |
2370 | 512, write); | 2370 | 512, write); |
@@ -2378,7 +2378,7 @@ static int mmc_test_ongoing_transfer(struct mmc_test_card *test, | |||
2378 | 2378 | ||
2379 | /* Start ongoing data request */ | 2379 | /* Start ongoing data request */ |
2380 | if (use_areq) { | 2380 | if (use_areq) { |
2381 | mmc_start_req(host, &areq, &ret); | 2381 | mmc_start_req(host, &test_areq.areq, &ret); |
2382 | if (ret) | 2382 | if (ret) |
2383 | goto out_free; | 2383 | goto out_free; |
2384 | } else { | 2384 | } else { |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 39fc5b2b96c5..df19777068a6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include "mmc_ops.h" | 26 | #include "mmc_ops.h" |
27 | #include "sd_ops.h" | 27 | #include "sd_ops.h" |
28 | 28 | ||
29 | #define DEFAULT_CMD6_TIMEOUT_MS 500 | ||
30 | |||
29 | static const unsigned int tran_exp[] = { | 31 | static const unsigned int tran_exp[] = { |
30 | 10000, 100000, 1000000, 10000000, | 32 | 10000, 100000, 1000000, 10000000, |
31 | 0, 0, 0, 0 | 33 | 0, 0, 0, 0 |
@@ -571,6 +573,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) | |||
571 | card->erased_byte = 0x0; | 573 | card->erased_byte = 0x0; |
572 | 574 | ||
573 | /* eMMC v4.5 or later */ | 575 | /* eMMC v4.5 or later */ |
576 | card->ext_csd.generic_cmd6_time = DEFAULT_CMD6_TIMEOUT_MS; | ||
574 | if (card->ext_csd.rev >= 6) { | 577 | if (card->ext_csd.rev >= 6) { |
575 | card->ext_csd.feature_support |= MMC_DISCARD_FEATURE; | 578 | card->ext_csd.feature_support |= MMC_DISCARD_FEATURE; |
576 | 579 | ||
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 4fcbc4012ed0..50a674be6655 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -2940,7 +2940,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) | |||
2940 | return ERR_PTR(-ENOMEM); | 2940 | return ERR_PTR(-ENOMEM); |
2941 | 2941 | ||
2942 | /* find reset controller when exist */ | 2942 | /* find reset controller when exist */ |
2943 | pdata->rstc = devm_reset_control_get_optional(dev, NULL); | 2943 | pdata->rstc = devm_reset_control_get_optional(dev, "reset"); |
2944 | if (IS_ERR(pdata->rstc)) { | 2944 | if (IS_ERR(pdata->rstc)) { |
2945 | if (PTR_ERR(pdata->rstc) == -EPROBE_DEFER) | 2945 | if (PTR_ERR(pdata->rstc) == -EPROBE_DEFER) |
2946 | return ERR_PTR(-EPROBE_DEFER); | 2946 | return ERR_PTR(-EPROBE_DEFER); |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index d839147e591d..44ecebd1ea8c 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -661,13 +661,13 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
661 | 661 | ||
662 | platform_set_drvdata(pdev, mmc); | 662 | platform_set_drvdata(pdev, mmc); |
663 | 663 | ||
664 | spin_lock_init(&host->lock); | ||
665 | |||
664 | ret = devm_request_irq(&pdev->dev, irq_err, mxs_mmc_irq_handler, 0, | 666 | ret = devm_request_irq(&pdev->dev, irq_err, mxs_mmc_irq_handler, 0, |
665 | dev_name(&pdev->dev), host); | 667 | dev_name(&pdev->dev), host); |
666 | if (ret) | 668 | if (ret) |
667 | goto out_free_dma; | 669 | goto out_free_dma; |
668 | 670 | ||
669 | spin_lock_init(&host->lock); | ||
670 | |||
671 | ret = mmc_add_host(mmc); | 671 | ret = mmc_add_host(mmc); |
672 | if (ret) | 672 | if (ret) |
673 | goto out_free_dma; | 673 | goto out_free_dma; |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 71654b90227f..42ef3ebb1d8c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -2086,6 +2086,10 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | |||
2086 | 2086 | ||
2087 | if (!host->tuning_done) { | 2087 | if (!host->tuning_done) { |
2088 | pr_info(DRIVER_NAME ": Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock\n"); | 2088 | pr_info(DRIVER_NAME ": Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock\n"); |
2089 | |||
2090 | sdhci_do_reset(host, SDHCI_RESET_CMD); | ||
2091 | sdhci_do_reset(host, SDHCI_RESET_DATA); | ||
2092 | |||
2089 | ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); | 2093 | ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); |
2090 | ctrl &= ~SDHCI_CTRL_TUNED_CLK; | 2094 | ctrl &= ~SDHCI_CTRL_TUNED_CLK; |
2091 | ctrl &= ~SDHCI_CTRL_EXEC_TUNING; | 2095 | ctrl &= ~SDHCI_CTRL_EXEC_TUNING; |
@@ -2286,10 +2290,8 @@ static bool sdhci_request_done(struct sdhci_host *host) | |||
2286 | 2290 | ||
2287 | for (i = 0; i < SDHCI_MAX_MRQS; i++) { | 2291 | for (i = 0; i < SDHCI_MAX_MRQS; i++) { |
2288 | mrq = host->mrqs_done[i]; | 2292 | mrq = host->mrqs_done[i]; |
2289 | if (mrq) { | 2293 | if (mrq) |
2290 | host->mrqs_done[i] = NULL; | ||
2291 | break; | 2294 | break; |
2292 | } | ||
2293 | } | 2295 | } |
2294 | 2296 | ||
2295 | if (!mrq) { | 2297 | if (!mrq) { |
@@ -2320,6 +2322,17 @@ static bool sdhci_request_done(struct sdhci_host *host) | |||
2320 | * upon error conditions. | 2322 | * upon error conditions. |
2321 | */ | 2323 | */ |
2322 | if (sdhci_needs_reset(host, mrq)) { | 2324 | if (sdhci_needs_reset(host, mrq)) { |
2325 | /* | ||
2326 | * Do not finish until command and data lines are available for | ||
2327 | * reset. Note there can only be one other mrq, so it cannot | ||
2328 | * also be in mrqs_done, otherwise host->cmd and host->data_cmd | ||
2329 | * would both be null. | ||
2330 | */ | ||
2331 | if (host->cmd || host->data_cmd) { | ||
2332 | spin_unlock_irqrestore(&host->lock, flags); | ||
2333 | return true; | ||
2334 | } | ||
2335 | |||
2323 | /* Some controllers need this kick or reset won't work here */ | 2336 | /* Some controllers need this kick or reset won't work here */ |
2324 | if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) | 2337 | if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) |
2325 | /* This is to force an update */ | 2338 | /* This is to force an update */ |
@@ -2327,10 +2340,8 @@ static bool sdhci_request_done(struct sdhci_host *host) | |||
2327 | 2340 | ||
2328 | /* Spec says we should do both at the same time, but Ricoh | 2341 | /* Spec says we should do both at the same time, but Ricoh |
2329 | controllers do not like that. */ | 2342 | controllers do not like that. */ |
2330 | if (!host->cmd) | 2343 | sdhci_do_reset(host, SDHCI_RESET_CMD); |
2331 | sdhci_do_reset(host, SDHCI_RESET_CMD); | 2344 | sdhci_do_reset(host, SDHCI_RESET_DATA); |
2332 | if (!host->data_cmd) | ||
2333 | sdhci_do_reset(host, SDHCI_RESET_DATA); | ||
2334 | 2345 | ||
2335 | host->pending_reset = false; | 2346 | host->pending_reset = false; |
2336 | } | 2347 | } |
@@ -2338,6 +2349,8 @@ static bool sdhci_request_done(struct sdhci_host *host) | |||
2338 | if (!sdhci_has_requests(host)) | 2349 | if (!sdhci_has_requests(host)) |
2339 | sdhci_led_deactivate(host); | 2350 | sdhci_led_deactivate(host); |
2340 | 2351 | ||
2352 | host->mrqs_done[i] = NULL; | ||
2353 | |||
2341 | mmiowb(); | 2354 | mmiowb(); |
2342 | spin_unlock_irqrestore(&host->lock, flags); | 2355 | spin_unlock_irqrestore(&host->lock, flags); |
2343 | 2356 | ||
@@ -2512,9 +2525,6 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) | |||
2512 | if (!host->data) { | 2525 | if (!host->data) { |
2513 | struct mmc_command *data_cmd = host->data_cmd; | 2526 | struct mmc_command *data_cmd = host->data_cmd; |
2514 | 2527 | ||
2515 | if (data_cmd) | ||
2516 | host->data_cmd = NULL; | ||
2517 | |||
2518 | /* | 2528 | /* |
2519 | * The "data complete" interrupt is also used to | 2529 | * The "data complete" interrupt is also used to |
2520 | * indicate that a busy state has ended. See comment | 2530 | * indicate that a busy state has ended. See comment |
@@ -2522,11 +2532,13 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) | |||
2522 | */ | 2532 | */ |
2523 | if (data_cmd && (data_cmd->flags & MMC_RSP_BUSY)) { | 2533 | if (data_cmd && (data_cmd->flags & MMC_RSP_BUSY)) { |
2524 | if (intmask & SDHCI_INT_DATA_TIMEOUT) { | 2534 | if (intmask & SDHCI_INT_DATA_TIMEOUT) { |
2535 | host->data_cmd = NULL; | ||
2525 | data_cmd->error = -ETIMEDOUT; | 2536 | data_cmd->error = -ETIMEDOUT; |
2526 | sdhci_finish_mrq(host, data_cmd->mrq); | 2537 | sdhci_finish_mrq(host, data_cmd->mrq); |
2527 | return; | 2538 | return; |
2528 | } | 2539 | } |
2529 | if (intmask & SDHCI_INT_DATA_END) { | 2540 | if (intmask & SDHCI_INT_DATA_END) { |
2541 | host->data_cmd = NULL; | ||
2530 | /* | 2542 | /* |
2531 | * Some cards handle busy-end interrupt | 2543 | * Some cards handle busy-end interrupt |
2532 | * before the command completed, so make | 2544 | * before the command completed, so make |
@@ -2912,6 +2924,10 @@ int sdhci_runtime_resume_host(struct sdhci_host *host) | |||
2912 | spin_unlock_irqrestore(&host->lock, flags); | 2924 | spin_unlock_irqrestore(&host->lock, flags); |
2913 | } | 2925 | } |
2914 | 2926 | ||
2927 | if ((mmc->caps2 & MMC_CAP2_HS400_ES) && | ||
2928 | mmc->ops->hs400_enhanced_strobe) | ||
2929 | mmc->ops->hs400_enhanced_strobe(mmc, &mmc->ios); | ||
2930 | |||
2915 | spin_lock_irqsave(&host->lock, flags); | 2931 | spin_lock_irqsave(&host->lock, flags); |
2916 | 2932 | ||
2917 | host->runtime_suspended = false; | 2933 | host->runtime_suspended = false; |
diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c index 83deda4bb4d6..6f9563a96488 100644 --- a/drivers/nfc/mei_phy.c +++ b/drivers/nfc/mei_phy.c | |||
@@ -133,7 +133,7 @@ static int mei_nfc_if_version(struct nfc_mei_phy *phy) | |||
133 | return -ENOMEM; | 133 | return -ENOMEM; |
134 | 134 | ||
135 | bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply, if_version_length); | 135 | bytes_recv = mei_cldev_recv(phy->cldev, (u8 *)reply, if_version_length); |
136 | if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) { | 136 | if (bytes_recv < 0 || bytes_recv < if_version_length) { |
137 | pr_err("Could not read IF version\n"); | 137 | pr_err("Could not read IF version\n"); |
138 | r = -EIO; | 138 | r = -EIO; |
139 | goto err; | 139 | goto err; |
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index f5e3011e31fc..5daf2f4be0cd 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c | |||
@@ -612,7 +612,7 @@ int nvme_nvm_register(struct nvme_ns *ns, char *disk_name, int node, | |||
612 | 612 | ||
613 | ret = nvm_register(dev); | 613 | ret = nvm_register(dev); |
614 | 614 | ||
615 | ns->lba_shift = ilog2(dev->sec_size) - 9; | 615 | ns->lba_shift = ilog2(dev->sec_size); |
616 | 616 | ||
617 | if (sysfs_create_group(&dev->dev.kobj, attrs)) | 617 | if (sysfs_create_group(&dev->dev.kobj, attrs)) |
618 | pr_warn("%s: failed to create sysfs group for identification\n", | 618 | pr_warn("%s: failed to create sysfs group for identification\n", |
diff --git a/drivers/of/base.c b/drivers/of/base.c index d687e6de24a0..a0bccb54a9bd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -2077,8 +2077,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
2077 | name = of_get_property(of_aliases, "stdout", NULL); | 2077 | name = of_get_property(of_aliases, "stdout", NULL); |
2078 | if (name) | 2078 | if (name) |
2079 | of_stdout = of_find_node_opts_by_path(name, &of_stdout_options); | 2079 | of_stdout = of_find_node_opts_by_path(name, &of_stdout_options); |
2080 | if (of_stdout) | ||
2081 | console_set_by_of(); | ||
2082 | } | 2080 | } |
2083 | 2081 | ||
2084 | if (!of_aliases) | 2082 | if (!of_aliases) |
diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c index e0b22dab9b7a..e04f69beb42d 100644 --- a/drivers/pci/host/pcie-rockchip.c +++ b/drivers/pci/host/pcie-rockchip.c | |||
@@ -190,6 +190,9 @@ struct rockchip_pcie { | |||
190 | struct reset_control *mgmt_rst; | 190 | struct reset_control *mgmt_rst; |
191 | struct reset_control *mgmt_sticky_rst; | 191 | struct reset_control *mgmt_sticky_rst; |
192 | struct reset_control *pipe_rst; | 192 | struct reset_control *pipe_rst; |
193 | struct reset_control *pm_rst; | ||
194 | struct reset_control *aclk_rst; | ||
195 | struct reset_control *pclk_rst; | ||
193 | struct clk *aclk_pcie; | 196 | struct clk *aclk_pcie; |
194 | struct clk *aclk_perf_pcie; | 197 | struct clk *aclk_perf_pcie; |
195 | struct clk *hclk_pcie; | 198 | struct clk *hclk_pcie; |
@@ -408,6 +411,44 @@ static int rockchip_pcie_init_port(struct rockchip_pcie *rockchip) | |||
408 | 411 | ||
409 | gpiod_set_value(rockchip->ep_gpio, 0); | 412 | gpiod_set_value(rockchip->ep_gpio, 0); |
410 | 413 | ||
414 | err = reset_control_assert(rockchip->aclk_rst); | ||
415 | if (err) { | ||
416 | dev_err(dev, "assert aclk_rst err %d\n", err); | ||
417 | return err; | ||
418 | } | ||
419 | |||
420 | err = reset_control_assert(rockchip->pclk_rst); | ||
421 | if (err) { | ||
422 | dev_err(dev, "assert pclk_rst err %d\n", err); | ||
423 | return err; | ||
424 | } | ||
425 | |||
426 | err = reset_control_assert(rockchip->pm_rst); | ||
427 | if (err) { | ||
428 | dev_err(dev, "assert pm_rst err %d\n", err); | ||
429 | return err; | ||
430 | } | ||
431 | |||
432 | udelay(10); | ||
433 | |||
434 | err = reset_control_deassert(rockchip->pm_rst); | ||
435 | if (err) { | ||
436 | dev_err(dev, "deassert pm_rst err %d\n", err); | ||
437 | return err; | ||
438 | } | ||
439 | |||
440 | err = reset_control_deassert(rockchip->aclk_rst); | ||
441 | if (err) { | ||
442 | dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err); | ||
443 | return err; | ||
444 | } | ||
445 | |||
446 | err = reset_control_deassert(rockchip->pclk_rst); | ||
447 | if (err) { | ||
448 | dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err); | ||
449 | return err; | ||
450 | } | ||
451 | |||
411 | err = phy_init(rockchip->phy); | 452 | err = phy_init(rockchip->phy); |
412 | if (err < 0) { | 453 | if (err < 0) { |
413 | dev_err(dev, "fail to init phy, err %d\n", err); | 454 | 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) | |||
781 | return PTR_ERR(rockchip->pipe_rst); | 822 | return PTR_ERR(rockchip->pipe_rst); |
782 | } | 823 | } |
783 | 824 | ||
825 | rockchip->pm_rst = devm_reset_control_get(dev, "pm"); | ||
826 | if (IS_ERR(rockchip->pm_rst)) { | ||
827 | if (PTR_ERR(rockchip->pm_rst) != -EPROBE_DEFER) | ||
828 | dev_err(dev, "missing pm reset property in node\n"); | ||
829 | return PTR_ERR(rockchip->pm_rst); | ||
830 | } | ||
831 | |||
832 | rockchip->pclk_rst = devm_reset_control_get(dev, "pclk"); | ||
833 | if (IS_ERR(rockchip->pclk_rst)) { | ||
834 | if (PTR_ERR(rockchip->pclk_rst) != -EPROBE_DEFER) | ||
835 | dev_err(dev, "missing pclk reset property in node\n"); | ||
836 | return PTR_ERR(rockchip->pclk_rst); | ||
837 | } | ||
838 | |||
839 | rockchip->aclk_rst = devm_reset_control_get(dev, "aclk"); | ||
840 | if (IS_ERR(rockchip->aclk_rst)) { | ||
841 | if (PTR_ERR(rockchip->aclk_rst) != -EPROBE_DEFER) | ||
842 | dev_err(dev, "missing aclk reset property in node\n"); | ||
843 | return PTR_ERR(rockchip->aclk_rst); | ||
844 | } | ||
845 | |||
784 | rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); | 846 | rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); |
785 | if (IS_ERR(rockchip->ep_gpio)) { | 847 | if (IS_ERR(rockchip->ep_gpio)) { |
786 | dev_err(dev, "missing ep-gpios property in node\n"); | 848 | dev_err(dev, "missing ep-gpios property in node\n"); |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 66c4d8f42233..9526e341988b 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -121,6 +121,14 @@ int pci_claim_resource(struct pci_dev *dev, int resource) | |||
121 | return -EINVAL; | 121 | return -EINVAL; |
122 | } | 122 | } |
123 | 123 | ||
124 | /* | ||
125 | * If we have a shadow copy in RAM, the PCI device doesn't respond | ||
126 | * to the shadow range, so we don't need to claim it, and upstream | ||
127 | * bridges don't need to route the range to the device. | ||
128 | */ | ||
129 | if (res->flags & IORESOURCE_ROM_SHADOW) | ||
130 | return 0; | ||
131 | |||
124 | root = pci_find_parent_resource(dev, res); | 132 | root = pci_find_parent_resource(dev, res); |
125 | if (!root) { | 133 | if (!root) { |
126 | dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n", | 134 | dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n", |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 153f3122283d..b6b316de055c 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -107,7 +107,7 @@ int soc_pcmcia_regulator_set(struct soc_pcmcia_socket *skt, | |||
107 | 107 | ||
108 | ret = regulator_enable(r->reg); | 108 | ret = regulator_enable(r->reg); |
109 | } else { | 109 | } else { |
110 | regulator_disable(r->reg); | 110 | ret = regulator_disable(r->reg); |
111 | } | 111 | } |
112 | if (ret == 0) | 112 | if (ret == 0) |
113 | r->on = on; | 113 | r->on = on; |
diff --git a/drivers/phy/phy-da8xx-usb.c b/drivers/phy/phy-da8xx-usb.c index 32ae78c8ca17..c85fb0b59729 100644 --- a/drivers/phy/phy-da8xx-usb.c +++ b/drivers/phy/phy-da8xx-usb.c | |||
@@ -198,7 +198,8 @@ static int da8xx_usb_phy_probe(struct platform_device *pdev) | |||
198 | } else { | 198 | } else { |
199 | int ret; | 199 | int ret; |
200 | 200 | ||
201 | ret = phy_create_lookup(d_phy->usb11_phy, "usb-phy", "ohci.0"); | 201 | ret = phy_create_lookup(d_phy->usb11_phy, "usb-phy", |
202 | "ohci-da8xx"); | ||
202 | if (ret) | 203 | if (ret) |
203 | dev_warn(dev, "Failed to create usb11 phy lookup\n"); | 204 | dev_warn(dev, "Failed to create usb11 phy lookup\n"); |
204 | ret = phy_create_lookup(d_phy->usb20_phy, "usb-phy", | 205 | ret = phy_create_lookup(d_phy->usb20_phy, "usb-phy", |
@@ -216,7 +217,7 @@ static int da8xx_usb_phy_remove(struct platform_device *pdev) | |||
216 | 217 | ||
217 | if (!pdev->dev.of_node) { | 218 | if (!pdev->dev.of_node) { |
218 | phy_remove_lookup(d_phy->usb20_phy, "usb-phy", "musb-da8xx"); | 219 | phy_remove_lookup(d_phy->usb20_phy, "usb-phy", "musb-da8xx"); |
219 | phy_remove_lookup(d_phy->usb11_phy, "usb-phy", "ohci.0"); | 220 | phy_remove_lookup(d_phy->usb11_phy, "usb-phy", "ohci-da8xx"); |
220 | } | 221 | } |
221 | 222 | ||
222 | return 0; | 223 | return 0; |
diff --git a/drivers/phy/phy-rockchip-pcie.c b/drivers/phy/phy-rockchip-pcie.c index a2b4c6b58aea..6904633cad68 100644 --- a/drivers/phy/phy-rockchip-pcie.c +++ b/drivers/phy/phy-rockchip-pcie.c | |||
@@ -249,21 +249,10 @@ err_refclk: | |||
249 | static int rockchip_pcie_phy_exit(struct phy *phy) | 249 | static int rockchip_pcie_phy_exit(struct phy *phy) |
250 | { | 250 | { |
251 | struct rockchip_pcie_phy *rk_phy = phy_get_drvdata(phy); | 251 | struct rockchip_pcie_phy *rk_phy = phy_get_drvdata(phy); |
252 | int err = 0; | ||
253 | 252 | ||
254 | clk_disable_unprepare(rk_phy->clk_pciephy_ref); | 253 | clk_disable_unprepare(rk_phy->clk_pciephy_ref); |
255 | 254 | ||
256 | err = reset_control_deassert(rk_phy->phy_rst); | 255 | return 0; |
257 | if (err) { | ||
258 | dev_err(&phy->dev, "deassert phy_rst err %d\n", err); | ||
259 | goto err_reset; | ||
260 | } | ||
261 | |||
262 | return err; | ||
263 | |||
264 | err_reset: | ||
265 | clk_prepare_enable(rk_phy->clk_pciephy_ref); | ||
266 | return err; | ||
267 | } | 256 | } |
268 | 257 | ||
269 | static const struct phy_ops ops = { | 258 | static const struct phy_ops ops = { |
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index b9342a2af7b3..fec34f5213c4 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
@@ -264,7 +264,7 @@ static int sun4i_usb_phy_init(struct phy *_phy) | |||
264 | return ret; | 264 | return ret; |
265 | } | 265 | } |
266 | 266 | ||
267 | if (data->cfg->enable_pmu_unk1) { | 267 | if (phy->pmu && data->cfg->enable_pmu_unk1) { |
268 | val = readl(phy->pmu + REG_PMU_UNK1); | 268 | val = readl(phy->pmu + REG_PMU_UNK1); |
269 | writel(val & ~2, phy->pmu + REG_PMU_UNK1); | 269 | writel(val & ~2, phy->pmu + REG_PMU_UNK1); |
270 | } | 270 | } |
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c index c8c72e8259d3..87b46390b695 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #define ASPEED_G5_NR_PINS 228 | 27 | #define ASPEED_G5_NR_PINS 228 |
28 | 28 | ||
29 | #define COND1 SIG_DESC_BIT(SCU90, 6, 0) | 29 | #define COND1 { SCU90, BIT(6), 0, 0 } |
30 | #define COND2 { SCU94, GENMASK(1, 0), 0, 0 } | 30 | #define COND2 { SCU94, GENMASK(1, 0), 0, 0 } |
31 | 31 | ||
32 | #define B14 0 | 32 | #define B14 0 |
diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c index 7f7700716398..5d1e505c3c63 100644 --- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | |||
@@ -844,6 +844,6 @@ static struct platform_driver iproc_gpio_driver = { | |||
844 | 844 | ||
845 | static int __init iproc_gpio_init(void) | 845 | static int __init iproc_gpio_init(void) |
846 | { | 846 | { |
847 | return platform_driver_probe(&iproc_gpio_driver, iproc_gpio_probe); | 847 | return platform_driver_register(&iproc_gpio_driver); |
848 | } | 848 | } |
849 | arch_initcall_sync(iproc_gpio_init); | 849 | arch_initcall_sync(iproc_gpio_init); |
diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c b/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c index 35783db1c10b..c8deb8be1da7 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c | |||
@@ -741,6 +741,6 @@ static struct platform_driver nsp_gpio_driver = { | |||
741 | 741 | ||
742 | static int __init nsp_gpio_init(void) | 742 | static int __init nsp_gpio_init(void) |
743 | { | 743 | { |
744 | return platform_driver_probe(&nsp_gpio_driver, nsp_gpio_probe); | 744 | return platform_driver_register(&nsp_gpio_driver); |
745 | } | 745 | } |
746 | arch_initcall_sync(nsp_gpio_init); | 746 | arch_initcall_sync(nsp_gpio_init); |
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 47613201269a..79c4e14a5a75 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c | |||
@@ -687,6 +687,7 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, | |||
687 | if (!info->functions) | 687 | if (!info->functions) |
688 | return -ENOMEM; | 688 | return -ENOMEM; |
689 | 689 | ||
690 | info->group_index = 0; | ||
690 | if (flat_funcs) { | 691 | if (flat_funcs) { |
691 | info->ngroups = of_get_child_count(np); | 692 | info->ngroups = of_get_child_count(np); |
692 | } else { | 693 | } else { |
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 30389f4ccab4..c43b1e9a06af 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c | |||
@@ -1652,12 +1652,15 @@ static int chv_pinctrl_probe(struct platform_device *pdev) | |||
1652 | } | 1652 | } |
1653 | 1653 | ||
1654 | #ifdef CONFIG_PM_SLEEP | 1654 | #ifdef CONFIG_PM_SLEEP |
1655 | static int chv_pinctrl_suspend(struct device *dev) | 1655 | static int chv_pinctrl_suspend_noirq(struct device *dev) |
1656 | { | 1656 | { |
1657 | struct platform_device *pdev = to_platform_device(dev); | 1657 | struct platform_device *pdev = to_platform_device(dev); |
1658 | struct chv_pinctrl *pctrl = platform_get_drvdata(pdev); | 1658 | struct chv_pinctrl *pctrl = platform_get_drvdata(pdev); |
1659 | unsigned long flags; | ||
1659 | int i; | 1660 | int i; |
1660 | 1661 | ||
1662 | raw_spin_lock_irqsave(&chv_lock, flags); | ||
1663 | |||
1661 | pctrl->saved_intmask = readl(pctrl->regs + CHV_INTMASK); | 1664 | pctrl->saved_intmask = readl(pctrl->regs + CHV_INTMASK); |
1662 | 1665 | ||
1663 | for (i = 0; i < pctrl->community->npins; i++) { | 1666 | for (i = 0; i < pctrl->community->npins; i++) { |
@@ -1678,15 +1681,20 @@ static int chv_pinctrl_suspend(struct device *dev) | |||
1678 | ctx->padctrl1 = readl(reg); | 1681 | ctx->padctrl1 = readl(reg); |
1679 | } | 1682 | } |
1680 | 1683 | ||
1684 | raw_spin_unlock_irqrestore(&chv_lock, flags); | ||
1685 | |||
1681 | return 0; | 1686 | return 0; |
1682 | } | 1687 | } |
1683 | 1688 | ||
1684 | static int chv_pinctrl_resume(struct device *dev) | 1689 | static int chv_pinctrl_resume_noirq(struct device *dev) |
1685 | { | 1690 | { |
1686 | struct platform_device *pdev = to_platform_device(dev); | 1691 | struct platform_device *pdev = to_platform_device(dev); |
1687 | struct chv_pinctrl *pctrl = platform_get_drvdata(pdev); | 1692 | struct chv_pinctrl *pctrl = platform_get_drvdata(pdev); |
1693 | unsigned long flags; | ||
1688 | int i; | 1694 | int i; |
1689 | 1695 | ||
1696 | raw_spin_lock_irqsave(&chv_lock, flags); | ||
1697 | |||
1690 | /* | 1698 | /* |
1691 | * Mask all interrupts before restoring per-pin configuration | 1699 | * Mask all interrupts before restoring per-pin configuration |
1692 | * registers because we don't know in which state BIOS left them | 1700 | * registers because we don't know in which state BIOS left them |
@@ -1731,12 +1739,15 @@ static int chv_pinctrl_resume(struct device *dev) | |||
1731 | chv_writel(0xffff, pctrl->regs + CHV_INTSTAT); | 1739 | chv_writel(0xffff, pctrl->regs + CHV_INTSTAT); |
1732 | chv_writel(pctrl->saved_intmask, pctrl->regs + CHV_INTMASK); | 1740 | chv_writel(pctrl->saved_intmask, pctrl->regs + CHV_INTMASK); |
1733 | 1741 | ||
1742 | raw_spin_unlock_irqrestore(&chv_lock, flags); | ||
1743 | |||
1734 | return 0; | 1744 | return 0; |
1735 | } | 1745 | } |
1736 | #endif | 1746 | #endif |
1737 | 1747 | ||
1738 | static const struct dev_pm_ops chv_pinctrl_pm_ops = { | 1748 | static const struct dev_pm_ops chv_pinctrl_pm_ops = { |
1739 | SET_LATE_SYSTEM_SLEEP_PM_OPS(chv_pinctrl_suspend, chv_pinctrl_resume) | 1749 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(chv_pinctrl_suspend_noirq, |
1750 | chv_pinctrl_resume_noirq) | ||
1740 | }; | 1751 | }; |
1741 | 1752 | ||
1742 | static const struct acpi_device_id chv_pinctrl_acpi_match[] = { | 1753 | static const struct acpi_device_id chv_pinctrl_acpi_match[] = { |
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 99da4cf91031..b7bb37167969 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c | |||
@@ -1512,7 +1512,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info, | |||
1512 | if (info->irqmux_base || gpio_irq > 0) { | 1512 | if (info->irqmux_base || gpio_irq > 0) { |
1513 | err = gpiochip_irqchip_add(&bank->gpio_chip, &st_gpio_irqchip, | 1513 | err = gpiochip_irqchip_add(&bank->gpio_chip, &st_gpio_irqchip, |
1514 | 0, handle_simple_irq, | 1514 | 0, handle_simple_irq, |
1515 | IRQ_TYPE_LEVEL_LOW); | 1515 | IRQ_TYPE_NONE); |
1516 | if (err) { | 1516 | if (err) { |
1517 | gpiochip_remove(&bank->gpio_chip); | 1517 | gpiochip_remove(&bank->gpio_chip); |
1518 | dev_info(dev, "could not add irqchip\n"); | 1518 | dev_info(dev, "could not add irqchip\n"); |
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 200667f08c37..efc43711ff5c 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c | |||
@@ -1092,9 +1092,11 @@ int stm32_pctl_probe(struct platform_device *pdev) | |||
1092 | return -EINVAL; | 1092 | return -EINVAL; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | ret = stm32_pctrl_dt_setup_irq(pdev, pctl); | 1095 | if (of_find_property(np, "interrupt-parent", NULL)) { |
1096 | if (ret) | 1096 | ret = stm32_pctrl_dt_setup_irq(pdev, pctl); |
1097 | return ret; | 1097 | if (ret) |
1098 | return ret; | ||
1099 | } | ||
1098 | 1100 | ||
1099 | for_each_child_of_node(np, child) | 1101 | for_each_child_of_node(np, child) |
1100 | if (of_property_read_bool(child, "gpio-controller")) | 1102 | if (of_property_read_bool(child, "gpio-controller")) |
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index a2323941e677..a7614fc542b5 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
@@ -934,6 +934,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { | |||
934 | }, | 934 | }, |
935 | }, | 935 | }, |
936 | { | 936 | { |
937 | .ident = "Lenovo Yoga 900", | ||
938 | .matches = { | ||
939 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
940 | DMI_MATCH(DMI_BOARD_NAME, "VIUU4"), | ||
941 | }, | ||
942 | }, | ||
943 | { | ||
937 | .ident = "Lenovo YOGA 910-13IKB", | 944 | .ident = "Lenovo YOGA 910-13IKB", |
938 | .matches = { | 945 | .matches = { |
939 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | 946 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index ed5874217ee7..12dbb5063376 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c | |||
@@ -264,7 +264,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
264 | return AE_OK; | 264 | return AE_OK; |
265 | 265 | ||
266 | if (acpi_match_device_ids(dev, ids) == 0) | 266 | if (acpi_match_device_ids(dev, ids) == 0) |
267 | if (acpi_create_platform_device(dev)) | 267 | if (acpi_create_platform_device(dev, NULL)) |
268 | dev_info(&dev->dev, | 268 | dev_info(&dev->dev, |
269 | "intel-hid: created platform device\n"); | 269 | "intel-hid: created platform device\n"); |
270 | 270 | ||
diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c index 146d02f8c9bc..78080763df51 100644 --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c | |||
@@ -164,7 +164,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
164 | return AE_OK; | 164 | return AE_OK; |
165 | 165 | ||
166 | if (acpi_match_device_ids(dev, ids) == 0) | 166 | if (acpi_match_device_ids(dev, ids) == 0) |
167 | if (acpi_create_platform_device(dev)) | 167 | if (acpi_create_platform_device(dev, NULL)) |
168 | dev_info(&dev->dev, | 168 | dev_info(&dev->dev, |
169 | "intel-vbtn: created platform device\n"); | 169 | "intel-vbtn: created platform device\n"); |
170 | 170 | ||
diff --git a/drivers/platform/x86/toshiba-wmi.c b/drivers/platform/x86/toshiba-wmi.c index feac4576b837..2df07ee8f3c3 100644 --- a/drivers/platform/x86/toshiba-wmi.c +++ b/drivers/platform/x86/toshiba-wmi.c | |||
@@ -24,14 +24,15 @@ | |||
24 | #include <linux/acpi.h> | 24 | #include <linux/acpi.h> |
25 | #include <linux/input.h> | 25 | #include <linux/input.h> |
26 | #include <linux/input/sparse-keymap.h> | 26 | #include <linux/input/sparse-keymap.h> |
27 | #include <linux/dmi.h> | ||
27 | 28 | ||
28 | MODULE_AUTHOR("Azael Avalos"); | 29 | MODULE_AUTHOR("Azael Avalos"); |
29 | MODULE_DESCRIPTION("Toshiba WMI Hotkey Driver"); | 30 | MODULE_DESCRIPTION("Toshiba WMI Hotkey Driver"); |
30 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
31 | 32 | ||
32 | #define TOSHIBA_WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100" | 33 | #define WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100" |
33 | 34 | ||
34 | MODULE_ALIAS("wmi:"TOSHIBA_WMI_EVENT_GUID); | 35 | MODULE_ALIAS("wmi:"WMI_EVENT_GUID); |
35 | 36 | ||
36 | static struct input_dev *toshiba_wmi_input_dev; | 37 | static struct input_dev *toshiba_wmi_input_dev; |
37 | 38 | ||
@@ -63,6 +64,16 @@ static void toshiba_wmi_notify(u32 value, void *context) | |||
63 | kfree(response.pointer); | 64 | kfree(response.pointer); |
64 | } | 65 | } |
65 | 66 | ||
67 | static struct dmi_system_id toshiba_wmi_dmi_table[] __initdata = { | ||
68 | { | ||
69 | .ident = "Toshiba laptop", | ||
70 | .matches = { | ||
71 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
72 | }, | ||
73 | }, | ||
74 | {} | ||
75 | }; | ||
76 | |||
66 | static int __init toshiba_wmi_input_setup(void) | 77 | static int __init toshiba_wmi_input_setup(void) |
67 | { | 78 | { |
68 | acpi_status status; | 79 | acpi_status status; |
@@ -81,7 +92,7 @@ static int __init toshiba_wmi_input_setup(void) | |||
81 | if (err) | 92 | if (err) |
82 | goto err_free_dev; | 93 | goto err_free_dev; |
83 | 94 | ||
84 | status = wmi_install_notify_handler(TOSHIBA_WMI_EVENT_GUID, | 95 | status = wmi_install_notify_handler(WMI_EVENT_GUID, |
85 | toshiba_wmi_notify, NULL); | 96 | toshiba_wmi_notify, NULL); |
86 | if (ACPI_FAILURE(status)) { | 97 | if (ACPI_FAILURE(status)) { |
87 | err = -EIO; | 98 | err = -EIO; |
@@ -95,7 +106,7 @@ static int __init toshiba_wmi_input_setup(void) | |||
95 | return 0; | 106 | return 0; |
96 | 107 | ||
97 | err_remove_notifier: | 108 | err_remove_notifier: |
98 | wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID); | 109 | wmi_remove_notify_handler(WMI_EVENT_GUID); |
99 | err_free_keymap: | 110 | err_free_keymap: |
100 | sparse_keymap_free(toshiba_wmi_input_dev); | 111 | sparse_keymap_free(toshiba_wmi_input_dev); |
101 | err_free_dev: | 112 | err_free_dev: |
@@ -105,7 +116,7 @@ static int __init toshiba_wmi_input_setup(void) | |||
105 | 116 | ||
106 | static void toshiba_wmi_input_destroy(void) | 117 | static void toshiba_wmi_input_destroy(void) |
107 | { | 118 | { |
108 | wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID); | 119 | wmi_remove_notify_handler(WMI_EVENT_GUID); |
109 | sparse_keymap_free(toshiba_wmi_input_dev); | 120 | sparse_keymap_free(toshiba_wmi_input_dev); |
110 | input_unregister_device(toshiba_wmi_input_dev); | 121 | input_unregister_device(toshiba_wmi_input_dev); |
111 | } | 122 | } |
@@ -114,7 +125,8 @@ static int __init toshiba_wmi_init(void) | |||
114 | { | 125 | { |
115 | int ret; | 126 | int ret; |
116 | 127 | ||
117 | if (!wmi_has_guid(TOSHIBA_WMI_EVENT_GUID)) | 128 | if (!wmi_has_guid(WMI_EVENT_GUID) || |
129 | !dmi_check_system(toshiba_wmi_dmi_table)) | ||
118 | return -ENODEV; | 130 | return -ENODEV; |
119 | 131 | ||
120 | ret = toshiba_wmi_input_setup(); | 132 | ret = toshiba_wmi_input_setup(); |
@@ -130,7 +142,7 @@ static int __init toshiba_wmi_init(void) | |||
130 | 142 | ||
131 | static void __exit toshiba_wmi_exit(void) | 143 | static void __exit toshiba_wmi_exit(void) |
132 | { | 144 | { |
133 | if (wmi_has_guid(TOSHIBA_WMI_EVENT_GUID)) | 145 | if (wmi_has_guid(WMI_EVENT_GUID)) |
134 | toshiba_wmi_input_destroy(); | 146 | toshiba_wmi_input_destroy(); |
135 | } | 147 | } |
136 | 148 | ||
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index d1421139e6ea..2ffe029ff2b6 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -2081,9 +2081,10 @@ void cxgbi_cleanup_task(struct iscsi_task *task) | |||
2081 | /* never reached the xmit task callout */ | 2081 | /* never reached the xmit task callout */ |
2082 | if (tdata->skb) | 2082 | if (tdata->skb) |
2083 | __kfree_skb(tdata->skb); | 2083 | __kfree_skb(tdata->skb); |
2084 | memset(tdata, 0, sizeof(*tdata)); | ||
2085 | 2084 | ||
2086 | task_release_itt(task, task->hdr_itt); | 2085 | task_release_itt(task, task->hdr_itt); |
2086 | memset(tdata, 0, sizeof(*tdata)); | ||
2087 | |||
2087 | iscsi_tcp_cleanup_task(task); | 2088 | iscsi_tcp_cleanup_task(task); |
2088 | } | 2089 | } |
2089 | EXPORT_SYMBOL_GPL(cxgbi_cleanup_task); | 2090 | EXPORT_SYMBOL_GPL(cxgbi_cleanup_task); |
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 241829e59668..7bb20684e9fa 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c | |||
@@ -793,6 +793,7 @@ static void alua_rtpg_work(struct work_struct *work) | |||
793 | WARN_ON(pg->flags & ALUA_PG_RUN_RTPG); | 793 | WARN_ON(pg->flags & ALUA_PG_RUN_RTPG); |
794 | WARN_ON(pg->flags & ALUA_PG_RUN_STPG); | 794 | WARN_ON(pg->flags & ALUA_PG_RUN_STPG); |
795 | spin_unlock_irqrestore(&pg->lock, flags); | 795 | spin_unlock_irqrestore(&pg->lock, flags); |
796 | kref_put(&pg->kref, release_port_group); | ||
796 | return; | 797 | return; |
797 | } | 798 | } |
798 | if (pg->flags & ALUA_SYNC_STPG) | 799 | if (pg->flags & ALUA_SYNC_STPG) |
@@ -890,6 +891,7 @@ static void alua_rtpg_queue(struct alua_port_group *pg, | |||
890 | /* Do not queue if the worker is already running */ | 891 | /* Do not queue if the worker is already running */ |
891 | if (!(pg->flags & ALUA_PG_RUNNING)) { | 892 | if (!(pg->flags & ALUA_PG_RUNNING)) { |
892 | kref_get(&pg->kref); | 893 | kref_get(&pg->kref); |
894 | sdev = NULL; | ||
893 | start_queue = 1; | 895 | start_queue = 1; |
894 | } | 896 | } |
895 | } | 897 | } |
@@ -901,7 +903,8 @@ static void alua_rtpg_queue(struct alua_port_group *pg, | |||
901 | if (start_queue && | 903 | if (start_queue && |
902 | !queue_delayed_work(alua_wq, &pg->rtpg_work, | 904 | !queue_delayed_work(alua_wq, &pg->rtpg_work, |
903 | msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS))) { | 905 | msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS))) { |
904 | scsi_device_put(sdev); | 906 | if (sdev) |
907 | scsi_device_put(sdev); | ||
905 | kref_put(&pg->kref, release_port_group); | 908 | kref_put(&pg->kref, release_port_group); |
906 | } | 909 | } |
907 | } | 910 | } |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index ca86c885dfaa..3aaea713bf37 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -2233,7 +2233,7 @@ struct megasas_instance_template { | |||
2233 | }; | 2233 | }; |
2234 | 2234 | ||
2235 | #define MEGASAS_IS_LOGICAL(scp) \ | 2235 | #define MEGASAS_IS_LOGICAL(scp) \ |
2236 | (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 | 2236 | ((scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) |
2237 | 2237 | ||
2238 | #define MEGASAS_DEV_INDEX(scp) \ | 2238 | #define MEGASAS_DEV_INDEX(scp) \ |
2239 | (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ | 2239 | (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 209a969a979d..8aa769a2d919 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c | |||
@@ -1273,9 +1273,9 @@ scsih_target_alloc(struct scsi_target *starget) | |||
1273 | sas_target_priv_data->handle = raid_device->handle; | 1273 | sas_target_priv_data->handle = raid_device->handle; |
1274 | sas_target_priv_data->sas_address = raid_device->wwid; | 1274 | sas_target_priv_data->sas_address = raid_device->wwid; |
1275 | sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME; | 1275 | sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME; |
1276 | sas_target_priv_data->raid_device = raid_device; | ||
1277 | if (ioc->is_warpdrive) | 1276 | if (ioc->is_warpdrive) |
1278 | raid_device->starget = starget; | 1277 | sas_target_priv_data->raid_device = raid_device; |
1278 | raid_device->starget = starget; | ||
1279 | } | 1279 | } |
1280 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); | 1280 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
1281 | return 0; | 1281 | return 0; |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index ace65db1d2a2..567fa080e261 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -707,6 +707,11 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) | |||
707 | srb_t *sp; | 707 | srb_t *sp; |
708 | int rval; | 708 | int rval; |
709 | 709 | ||
710 | if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) { | ||
711 | cmd->result = DID_NO_CONNECT << 16; | ||
712 | goto qc24_fail_command; | ||
713 | } | ||
714 | |||
710 | if (ha->flags.eeh_busy) { | 715 | if (ha->flags.eeh_busy) { |
711 | if (ha->flags.pci_channel_io_perm_failure) { | 716 | if (ha->flags.pci_channel_io_perm_failure) { |
712 | ql_dbg(ql_dbg_aer, vha, 0x9010, | 717 | ql_dbg(ql_dbg_aer, vha, 0x9010, |
@@ -1451,6 +1456,15 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) | |||
1451 | for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { | 1456 | for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { |
1452 | sp = req->outstanding_cmds[cnt]; | 1457 | sp = req->outstanding_cmds[cnt]; |
1453 | if (sp) { | 1458 | if (sp) { |
1459 | /* Get a reference to the sp and drop the lock. | ||
1460 | * The reference ensures this sp->done() call | ||
1461 | * - and not the call in qla2xxx_eh_abort() - | ||
1462 | * ends the SCSI command (with result 'res'). | ||
1463 | */ | ||
1464 | sp_get(sp); | ||
1465 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1466 | qla2xxx_eh_abort(GET_CMD_SP(sp)); | ||
1467 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1454 | req->outstanding_cmds[cnt] = NULL; | 1468 | req->outstanding_cmds[cnt] = NULL; |
1455 | sp->done(vha, sp, res); | 1469 | sp->done(vha, sp, res); |
1456 | } | 1470 | } |
@@ -2341,6 +2355,8 @@ qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time) | |||
2341 | { | 2355 | { |
2342 | scsi_qla_host_t *vha = shost_priv(shost); | 2356 | scsi_qla_host_t *vha = shost_priv(shost); |
2343 | 2357 | ||
2358 | if (test_bit(UNLOADING, &vha->dpc_flags)) | ||
2359 | return 1; | ||
2344 | if (!vha->host) | 2360 | if (!vha->host) |
2345 | return 1; | 2361 | return 1; |
2346 | if (time > vha->hw->loop_reset_delay * HZ) | 2362 | if (time > vha->hw->loop_reset_delay * HZ) |
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 4a0d3cdc607c..15ca09cd16f3 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c | |||
@@ -793,6 +793,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd) | |||
793 | unsigned long flags; | 793 | unsigned long flags; |
794 | int result = SUCCESS; | 794 | int result = SUCCESS; |
795 | DECLARE_COMPLETION_ONSTACK(abort_cmp); | 795 | DECLARE_COMPLETION_ONSTACK(abort_cmp); |
796 | int done; | ||
796 | 797 | ||
797 | scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n", | 798 | scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n", |
798 | adapter->host->host_no, cmd); | 799 | adapter->host->host_no, cmd); |
@@ -824,10 +825,10 @@ static int pvscsi_abort(struct scsi_cmnd *cmd) | |||
824 | pvscsi_abort_cmd(adapter, ctx); | 825 | pvscsi_abort_cmd(adapter, ctx); |
825 | spin_unlock_irqrestore(&adapter->hw_lock, flags); | 826 | spin_unlock_irqrestore(&adapter->hw_lock, flags); |
826 | /* Wait for 2 secs for the completion. */ | 827 | /* Wait for 2 secs for the completion. */ |
827 | wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000)); | 828 | done = wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000)); |
828 | spin_lock_irqsave(&adapter->hw_lock, flags); | 829 | spin_lock_irqsave(&adapter->hw_lock, flags); |
829 | 830 | ||
830 | if (!completion_done(&abort_cmp)) { | 831 | if (!done) { |
831 | /* | 832 | /* |
832 | * Failed to abort the command, unmark the fact that it | 833 | * Failed to abort the command, unmark the fact that it |
833 | * was requested to be aborted. | 834 | * was requested to be aborted. |
diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index c097d2ccbde3..d41292ef85f2 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | 28 | ||
29 | #define PVSCSI_DRIVER_VERSION_STRING "1.0.6.0-k" | 29 | #define PVSCSI_DRIVER_VERSION_STRING "1.0.7.0-k" |
30 | 30 | ||
31 | #define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128 | 31 | #define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128 |
32 | 32 | ||
diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c index 7043eb0543f6..5ab49a798164 100644 --- a/drivers/staging/comedi/drivers/ni_tio.c +++ b/drivers/staging/comedi/drivers/ni_tio.c | |||
@@ -207,7 +207,8 @@ static int ni_tio_clock_period_ps(const struct ni_gpct *counter, | |||
207 | * clock period is specified by user with prescaling | 207 | * clock period is specified by user with prescaling |
208 | * already taken into account. | 208 | * already taken into account. |
209 | */ | 209 | */ |
210 | return counter->clock_period_ps; | 210 | *period_ps = counter->clock_period_ps; |
211 | return 0; | ||
211 | } | 212 | } |
212 | 213 | ||
213 | switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) { | 214 | switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) { |
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index 34307ac3f255..d33d6fe078ad 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c | |||
@@ -186,6 +186,7 @@ int arche_platform_change_state(enum arche_platform_state state, | |||
186 | exit: | 186 | exit: |
187 | spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); | 187 | spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); |
188 | mutex_unlock(&arche_pdata->platform_state_mutex); | 188 | mutex_unlock(&arche_pdata->platform_state_mutex); |
189 | put_device(&pdev->dev); | ||
189 | of_node_put(np); | 190 | of_node_put(np); |
190 | return ret; | 191 | return ret; |
191 | } | 192 | } |
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 5eecf1cb1028..3892a7470410 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c | |||
@@ -655,6 +655,7 @@ static void ad5933_work(struct work_struct *work) | |||
655 | __be16 buf[2]; | 655 | __be16 buf[2]; |
656 | int val[2]; | 656 | int val[2]; |
657 | unsigned char status; | 657 | unsigned char status; |
658 | int ret; | ||
658 | 659 | ||
659 | mutex_lock(&indio_dev->mlock); | 660 | mutex_lock(&indio_dev->mlock); |
660 | if (st->state == AD5933_CTRL_INIT_START_FREQ) { | 661 | if (st->state == AD5933_CTRL_INIT_START_FREQ) { |
@@ -662,19 +663,22 @@ static void ad5933_work(struct work_struct *work) | |||
662 | ad5933_cmd(st, AD5933_CTRL_START_SWEEP); | 663 | ad5933_cmd(st, AD5933_CTRL_START_SWEEP); |
663 | st->state = AD5933_CTRL_START_SWEEP; | 664 | st->state = AD5933_CTRL_START_SWEEP; |
664 | schedule_delayed_work(&st->work, st->poll_time_jiffies); | 665 | schedule_delayed_work(&st->work, st->poll_time_jiffies); |
665 | mutex_unlock(&indio_dev->mlock); | 666 | goto out; |
666 | return; | ||
667 | } | 667 | } |
668 | 668 | ||
669 | ad5933_i2c_read(st->client, AD5933_REG_STATUS, 1, &status); | 669 | ret = ad5933_i2c_read(st->client, AD5933_REG_STATUS, 1, &status); |
670 | if (ret) | ||
671 | goto out; | ||
670 | 672 | ||
671 | if (status & AD5933_STAT_DATA_VALID) { | 673 | if (status & AD5933_STAT_DATA_VALID) { |
672 | int scan_count = bitmap_weight(indio_dev->active_scan_mask, | 674 | int scan_count = bitmap_weight(indio_dev->active_scan_mask, |
673 | indio_dev->masklength); | 675 | indio_dev->masklength); |
674 | ad5933_i2c_read(st->client, | 676 | ret = ad5933_i2c_read(st->client, |
675 | test_bit(1, indio_dev->active_scan_mask) ? | 677 | test_bit(1, indio_dev->active_scan_mask) ? |
676 | AD5933_REG_REAL_DATA : AD5933_REG_IMAG_DATA, | 678 | AD5933_REG_REAL_DATA : AD5933_REG_IMAG_DATA, |
677 | scan_count * 2, (u8 *)buf); | 679 | scan_count * 2, (u8 *)buf); |
680 | if (ret) | ||
681 | goto out; | ||
678 | 682 | ||
679 | if (scan_count == 2) { | 683 | if (scan_count == 2) { |
680 | val[0] = be16_to_cpu(buf[0]); | 684 | val[0] = be16_to_cpu(buf[0]); |
@@ -686,8 +690,7 @@ static void ad5933_work(struct work_struct *work) | |||
686 | } else { | 690 | } else { |
687 | /* no data available - try again later */ | 691 | /* no data available - try again later */ |
688 | schedule_delayed_work(&st->work, st->poll_time_jiffies); | 692 | schedule_delayed_work(&st->work, st->poll_time_jiffies); |
689 | mutex_unlock(&indio_dev->mlock); | 693 | goto out; |
690 | return; | ||
691 | } | 694 | } |
692 | 695 | ||
693 | if (status & AD5933_STAT_SWEEP_DONE) { | 696 | if (status & AD5933_STAT_SWEEP_DONE) { |
@@ -700,7 +703,7 @@ static void ad5933_work(struct work_struct *work) | |||
700 | ad5933_cmd(st, AD5933_CTRL_INC_FREQ); | 703 | ad5933_cmd(st, AD5933_CTRL_INC_FREQ); |
701 | schedule_delayed_work(&st->work, st->poll_time_jiffies); | 704 | schedule_delayed_work(&st->work, st->poll_time_jiffies); |
702 | } | 705 | } |
703 | 706 | out: | |
704 | mutex_unlock(&indio_dev->mlock); | 707 | mutex_unlock(&indio_dev->mlock); |
705 | } | 708 | } |
706 | 709 | ||
diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index a324322ee0ad..499952c8ef39 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c | |||
@@ -106,13 +106,12 @@ static int nvec_mouse_probe(struct platform_device *pdev) | |||
106 | { | 106 | { |
107 | struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); | 107 | struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); |
108 | struct serio *ser_dev; | 108 | struct serio *ser_dev; |
109 | char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 }; | ||
110 | 109 | ||
111 | ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL); | 110 | ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL); |
112 | if (!ser_dev) | 111 | if (!ser_dev) |
113 | return -ENOMEM; | 112 | return -ENOMEM; |
114 | 113 | ||
115 | ser_dev->id.type = SERIO_PS_PSTHRU; | 114 | ser_dev->id.type = SERIO_8042; |
116 | ser_dev->write = ps2_sendcommand; | 115 | ser_dev->write = ps2_sendcommand; |
117 | ser_dev->start = ps2_startstreaming; | 116 | ser_dev->start = ps2_startstreaming; |
118 | ser_dev->stop = ps2_stopstreaming; | 117 | ser_dev->stop = ps2_stopstreaming; |
@@ -127,9 +126,6 @@ static int nvec_mouse_probe(struct platform_device *pdev) | |||
127 | 126 | ||
128 | serio_register_port(ser_dev); | 127 | serio_register_port(ser_dev); |
129 | 128 | ||
130 | /* mouse reset */ | ||
131 | nvec_write_async(nvec, mouse_reset, sizeof(mouse_reset)); | ||
132 | |||
133 | return 0; | 129 | return 0; |
134 | } | 130 | } |
135 | 131 | ||
diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h index 955247979aaa..4ed6d8d7712a 100644 --- a/drivers/staging/sm750fb/ddk750_reg.h +++ b/drivers/staging/sm750fb/ddk750_reg.h | |||
@@ -601,13 +601,13 @@ | |||
601 | 601 | ||
602 | #define PANEL_PLANE_TL 0x08001C | 602 | #define PANEL_PLANE_TL 0x08001C |
603 | #define PANEL_PLANE_TL_TOP_SHIFT 16 | 603 | #define PANEL_PLANE_TL_TOP_SHIFT 16 |
604 | #define PANEL_PLANE_TL_TOP_MASK (0xeff << 16) | 604 | #define PANEL_PLANE_TL_TOP_MASK (0x7ff << 16) |
605 | #define PANEL_PLANE_TL_LEFT_MASK 0xeff | 605 | #define PANEL_PLANE_TL_LEFT_MASK 0x7ff |
606 | 606 | ||
607 | #define PANEL_PLANE_BR 0x080020 | 607 | #define PANEL_PLANE_BR 0x080020 |
608 | #define PANEL_PLANE_BR_BOTTOM_SHIFT 16 | 608 | #define PANEL_PLANE_BR_BOTTOM_SHIFT 16 |
609 | #define PANEL_PLANE_BR_BOTTOM_MASK (0xeff << 16) | 609 | #define PANEL_PLANE_BR_BOTTOM_MASK (0x7ff << 16) |
610 | #define PANEL_PLANE_BR_RIGHT_MASK 0xeff | 610 | #define PANEL_PLANE_BR_RIGHT_MASK 0x7ff |
611 | 611 | ||
612 | #define PANEL_HORIZONTAL_TOTAL 0x080024 | 612 | #define PANEL_HORIZONTAL_TOTAL 0x080024 |
613 | #define PANEL_HORIZONTAL_TOTAL_TOTAL_SHIFT 16 | 613 | #define PANEL_HORIZONTAL_TOTAL_TOTAL_SHIFT 16 |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 78f0f85bebdc..fada988512a1 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -932,8 +932,6 @@ static int wait_serial_change(struct acm *acm, unsigned long arg) | |||
932 | DECLARE_WAITQUEUE(wait, current); | 932 | DECLARE_WAITQUEUE(wait, current); |
933 | struct async_icount old, new; | 933 | struct async_icount old, new; |
934 | 934 | ||
935 | if (arg & (TIOCM_DSR | TIOCM_RI | TIOCM_CD)) | ||
936 | return -EINVAL; | ||
937 | do { | 935 | do { |
938 | spin_lock_irq(&acm->read_lock); | 936 | spin_lock_irq(&acm->read_lock); |
939 | old = acm->oldcount; | 937 | old = acm->oldcount; |
@@ -1161,6 +1159,8 @@ static int acm_probe(struct usb_interface *intf, | |||
1161 | if (quirks == IGNORE_DEVICE) | 1159 | if (quirks == IGNORE_DEVICE) |
1162 | return -ENODEV; | 1160 | return -ENODEV; |
1163 | 1161 | ||
1162 | memset(&h, 0x00, sizeof(struct usb_cdc_parsed_header)); | ||
1163 | |||
1164 | num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR; | 1164 | num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR; |
1165 | 1165 | ||
1166 | /* handle quirks deadly to normal probing*/ | 1166 | /* handle quirks deadly to normal probing*/ |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7287a763cd0c..fea446900cad 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -769,15 +769,14 @@ static int dwc3_core_init(struct dwc3 *dwc) | |||
769 | return 0; | 769 | return 0; |
770 | 770 | ||
771 | err4: | 771 | err4: |
772 | phy_power_off(dwc->usb2_generic_phy); | 772 | phy_power_off(dwc->usb3_generic_phy); |
773 | 773 | ||
774 | err3: | 774 | err3: |
775 | phy_power_off(dwc->usb3_generic_phy); | 775 | phy_power_off(dwc->usb2_generic_phy); |
776 | 776 | ||
777 | err2: | 777 | err2: |
778 | usb_phy_set_suspend(dwc->usb2_phy, 1); | 778 | usb_phy_set_suspend(dwc->usb2_phy, 1); |
779 | usb_phy_set_suspend(dwc->usb3_phy, 1); | 779 | usb_phy_set_suspend(dwc->usb3_phy, 1); |
780 | dwc3_core_exit(dwc); | ||
781 | 780 | ||
782 | err1: | 781 | err1: |
783 | usb_phy_shutdown(dwc->usb2_phy); | 782 | usb_phy_shutdown(dwc->usb2_phy); |
diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 89a2f712fdfe..aaaf256f71dd 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/regmap.h> | 32 | #include <linux/regmap.h> |
33 | #include <linux/reset.h> | 33 | #include <linux/reset.h> |
34 | #include <linux/pinctrl/consumer.h> | ||
34 | #include <linux/usb/of.h> | 35 | #include <linux/usb/of.h> |
35 | 36 | ||
36 | #include "core.h" | 37 | #include "core.h" |
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index fe1811650dbc..5d1bd13a56c1 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c | |||
@@ -588,14 +588,6 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, | |||
588 | 588 | ||
589 | req->length = length; | 589 | req->length = length; |
590 | 590 | ||
591 | /* throttle high/super speed IRQ rate back slightly */ | ||
592 | if (gadget_is_dualspeed(dev->gadget)) | ||
593 | req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH || | ||
594 | dev->gadget->speed == USB_SPEED_SUPER)) && | ||
595 | !list_empty(&dev->tx_reqs)) | ||
596 | ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0) | ||
597 | : 0; | ||
598 | |||
599 | retval = usb_ep_queue(in, req, GFP_ATOMIC); | 591 | retval = usb_ep_queue(in, req, GFP_ATOMIC); |
600 | switch (retval) { | 592 | switch (retval) { |
601 | default: | 593 | default: |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index d793f548dfe2..a9a1e4c40480 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -995,6 +995,14 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) | |||
995 | } | 995 | } |
996 | val = readl(base + ext_cap_offset); | 996 | val = readl(base + ext_cap_offset); |
997 | 997 | ||
998 | /* Auto handoff never worked for these devices. Force it and continue */ | ||
999 | if ((pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) || | ||
1000 | (pdev->vendor == PCI_VENDOR_ID_RENESAS | ||
1001 | && pdev->device == 0x0014)) { | ||
1002 | val = (val | XHCI_HC_OS_OWNED) & ~XHCI_HC_BIOS_OWNED; | ||
1003 | writel(val, base + ext_cap_offset); | ||
1004 | } | ||
1005 | |||
998 | /* If the BIOS owns the HC, signal that the OS wants it, and wait */ | 1006 | /* If the BIOS owns the HC, signal that the OS wants it, and wait */ |
999 | if (val & XHCI_HC_BIOS_OWNED) { | 1007 | if (val & XHCI_HC_BIOS_OWNED) { |
1000 | writel(val | XHCI_HC_OS_OWNED, base + ext_cap_offset); | 1008 | writel(val | XHCI_HC_OS_OWNED, base + ext_cap_offset); |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 210b7e43a6fd..2440f88e07a3 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -479,7 +479,8 @@ static int da8xx_probe(struct platform_device *pdev) | |||
479 | 479 | ||
480 | glue->phy = devm_phy_get(&pdev->dev, "usb-phy"); | 480 | glue->phy = devm_phy_get(&pdev->dev, "usb-phy"); |
481 | if (IS_ERR(glue->phy)) { | 481 | if (IS_ERR(glue->phy)) { |
482 | dev_err(&pdev->dev, "failed to get phy\n"); | 482 | if (PTR_ERR(glue->phy) != -EPROBE_DEFER) |
483 | dev_err(&pdev->dev, "failed to get phy\n"); | ||
483 | return PTR_ERR(glue->phy); | 484 | return PTR_ERR(glue->phy); |
484 | } | 485 | } |
485 | 486 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 27dadc0d9114..e01116e4c067 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2114,11 +2114,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2114 | musb->io.ep_offset = musb_flat_ep_offset; | 2114 | musb->io.ep_offset = musb_flat_ep_offset; |
2115 | musb->io.ep_select = musb_flat_ep_select; | 2115 | musb->io.ep_select = musb_flat_ep_select; |
2116 | } | 2116 | } |
2117 | /* And override them with platform specific ops if specified. */ | ||
2118 | if (musb->ops->ep_offset) | ||
2119 | musb->io.ep_offset = musb->ops->ep_offset; | ||
2120 | if (musb->ops->ep_select) | ||
2121 | musb->io.ep_select = musb->ops->ep_select; | ||
2122 | 2117 | ||
2123 | /* At least tusb6010 has its own offsets */ | 2118 | /* At least tusb6010 has its own offsets */ |
2124 | if (musb->ops->ep_offset) | 2119 | if (musb->ops->ep_offset) |
diff --git a/drivers/uwb/lc-rc.c b/drivers/uwb/lc-rc.c index d059ad4d0dbd..97ee1b46db69 100644 --- a/drivers/uwb/lc-rc.c +++ b/drivers/uwb/lc-rc.c | |||
@@ -56,8 +56,11 @@ static struct uwb_rc *uwb_rc_find_by_index(int index) | |||
56 | struct uwb_rc *rc = NULL; | 56 | struct uwb_rc *rc = NULL; |
57 | 57 | ||
58 | dev = class_find_device(&uwb_rc_class, NULL, &index, uwb_rc_index_match); | 58 | dev = class_find_device(&uwb_rc_class, NULL, &index, uwb_rc_index_match); |
59 | if (dev) | 59 | if (dev) { |
60 | rc = dev_get_drvdata(dev); | 60 | rc = dev_get_drvdata(dev); |
61 | put_device(dev); | ||
62 | } | ||
63 | |||
61 | return rc; | 64 | return rc; |
62 | } | 65 | } |
63 | 66 | ||
@@ -467,7 +470,9 @@ struct uwb_rc *__uwb_rc_try_get(struct uwb_rc *target_rc) | |||
467 | if (dev) { | 470 | if (dev) { |
468 | rc = dev_get_drvdata(dev); | 471 | rc = dev_get_drvdata(dev); |
469 | __uwb_rc_get(rc); | 472 | __uwb_rc_get(rc); |
473 | put_device(dev); | ||
470 | } | 474 | } |
475 | |||
471 | return rc; | 476 | return rc; |
472 | } | 477 | } |
473 | EXPORT_SYMBOL_GPL(__uwb_rc_try_get); | 478 | EXPORT_SYMBOL_GPL(__uwb_rc_try_get); |
@@ -520,8 +525,11 @@ struct uwb_rc *uwb_rc_get_by_grandpa(const struct device *grandpa_dev) | |||
520 | 525 | ||
521 | dev = class_find_device(&uwb_rc_class, NULL, grandpa_dev, | 526 | dev = class_find_device(&uwb_rc_class, NULL, grandpa_dev, |
522 | find_rc_grandpa); | 527 | find_rc_grandpa); |
523 | if (dev) | 528 | if (dev) { |
524 | rc = dev_get_drvdata(dev); | 529 | rc = dev_get_drvdata(dev); |
530 | put_device(dev); | ||
531 | } | ||
532 | |||
525 | return rc; | 533 | return rc; |
526 | } | 534 | } |
527 | EXPORT_SYMBOL_GPL(uwb_rc_get_by_grandpa); | 535 | 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) | |||
553 | struct uwb_rc *rc = NULL; | 561 | struct uwb_rc *rc = NULL; |
554 | 562 | ||
555 | dev = class_find_device(&uwb_rc_class, NULL, addr, find_rc_dev); | 563 | dev = class_find_device(&uwb_rc_class, NULL, addr, find_rc_dev); |
556 | if (dev) | 564 | if (dev) { |
557 | rc = dev_get_drvdata(dev); | 565 | rc = dev_get_drvdata(dev); |
566 | put_device(dev); | ||
567 | } | ||
558 | 568 | ||
559 | return rc; | 569 | return rc; |
560 | } | 570 | } |
diff --git a/drivers/uwb/pal.c b/drivers/uwb/pal.c index c1304b8d4985..678e93741ae1 100644 --- a/drivers/uwb/pal.c +++ b/drivers/uwb/pal.c | |||
@@ -97,6 +97,8 @@ static bool uwb_rc_class_device_exists(struct uwb_rc *target_rc) | |||
97 | 97 | ||
98 | dev = class_find_device(&uwb_rc_class, NULL, target_rc, find_rc); | 98 | dev = class_find_device(&uwb_rc_class, NULL, target_rc, find_rc); |
99 | 99 | ||
100 | put_device(dev); | ||
101 | |||
100 | return (dev != NULL); | 102 | return (dev != NULL); |
101 | } | 103 | } |
102 | 104 | ||
@@ -1078,6 +1078,17 @@ static void aio_complete(struct kiocb *kiocb, long res, long res2) | |||
1078 | unsigned tail, pos, head; | 1078 | unsigned tail, pos, head; |
1079 | unsigned long flags; | 1079 | unsigned long flags; |
1080 | 1080 | ||
1081 | if (kiocb->ki_flags & IOCB_WRITE) { | ||
1082 | struct file *file = kiocb->ki_filp; | ||
1083 | |||
1084 | /* | ||
1085 | * Tell lockdep we inherited freeze protection from submission | ||
1086 | * thread. | ||
1087 | */ | ||
1088 | __sb_writers_acquired(file_inode(file)->i_sb, SB_FREEZE_WRITE); | ||
1089 | file_end_write(file); | ||
1090 | } | ||
1091 | |||
1081 | /* | 1092 | /* |
1082 | * Special case handling for sync iocbs: | 1093 | * Special case handling for sync iocbs: |
1083 | * - events go directly into the iocb for fast handling | 1094 | * - events go directly into the iocb for fast handling |
@@ -1392,122 +1403,106 @@ SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx) | |||
1392 | return -EINVAL; | 1403 | return -EINVAL; |
1393 | } | 1404 | } |
1394 | 1405 | ||
1395 | typedef ssize_t (rw_iter_op)(struct kiocb *, struct iov_iter *); | 1406 | static int aio_setup_rw(int rw, struct iocb *iocb, struct iovec **iovec, |
1396 | 1407 | bool vectored, bool compat, struct iov_iter *iter) | |
1397 | static int aio_setup_vectored_rw(int rw, char __user *buf, size_t len, | ||
1398 | struct iovec **iovec, | ||
1399 | bool compat, | ||
1400 | struct iov_iter *iter) | ||
1401 | { | 1408 | { |
1409 | void __user *buf = (void __user *)(uintptr_t)iocb->aio_buf; | ||
1410 | size_t len = iocb->aio_nbytes; | ||
1411 | |||
1412 | if (!vectored) { | ||
1413 | ssize_t ret = import_single_range(rw, buf, len, *iovec, iter); | ||
1414 | *iovec = NULL; | ||
1415 | return ret; | ||
1416 | } | ||
1402 | #ifdef CONFIG_COMPAT | 1417 | #ifdef CONFIG_COMPAT |
1403 | if (compat) | 1418 | if (compat) |
1404 | return compat_import_iovec(rw, | 1419 | return compat_import_iovec(rw, buf, len, UIO_FASTIOV, iovec, |
1405 | (struct compat_iovec __user *)buf, | 1420 | iter); |
1406 | len, UIO_FASTIOV, iovec, iter); | ||
1407 | #endif | 1421 | #endif |
1408 | return import_iovec(rw, (struct iovec __user *)buf, | 1422 | return import_iovec(rw, buf, len, UIO_FASTIOV, iovec, iter); |
1409 | len, UIO_FASTIOV, iovec, iter); | ||
1410 | } | 1423 | } |
1411 | 1424 | ||
1412 | /* | 1425 | static inline ssize_t aio_ret(struct kiocb *req, ssize_t ret) |
1413 | * aio_run_iocb: | 1426 | { |
1414 | * Performs the initial checks and io submission. | 1427 | switch (ret) { |
1415 | */ | 1428 | case -EIOCBQUEUED: |
1416 | static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, | 1429 | return ret; |
1417 | char __user *buf, size_t len, bool compat) | 1430 | case -ERESTARTSYS: |
1431 | case -ERESTARTNOINTR: | ||
1432 | case -ERESTARTNOHAND: | ||
1433 | case -ERESTART_RESTARTBLOCK: | ||
1434 | /* | ||
1435 | * There's no easy way to restart the syscall since other AIO's | ||
1436 | * may be already running. Just fail this IO with EINTR. | ||
1437 | */ | ||
1438 | ret = -EINTR; | ||
1439 | /*FALLTHRU*/ | ||
1440 | default: | ||
1441 | aio_complete(req, ret, 0); | ||
1442 | return 0; | ||
1443 | } | ||
1444 | } | ||
1445 | |||
1446 | static ssize_t aio_read(struct kiocb *req, struct iocb *iocb, bool vectored, | ||
1447 | bool compat) | ||
1418 | { | 1448 | { |
1419 | struct file *file = req->ki_filp; | 1449 | struct file *file = req->ki_filp; |
1420 | ssize_t ret; | ||
1421 | int rw; | ||
1422 | fmode_t mode; | ||
1423 | rw_iter_op *iter_op; | ||
1424 | struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; | 1450 | struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; |
1425 | struct iov_iter iter; | 1451 | struct iov_iter iter; |
1452 | ssize_t ret; | ||
1426 | 1453 | ||
1427 | switch (opcode) { | 1454 | if (unlikely(!(file->f_mode & FMODE_READ))) |
1428 | case IOCB_CMD_PREAD: | 1455 | return -EBADF; |
1429 | case IOCB_CMD_PREADV: | 1456 | if (unlikely(!file->f_op->read_iter)) |
1430 | mode = FMODE_READ; | 1457 | return -EINVAL; |
1431 | rw = READ; | ||
1432 | iter_op = file->f_op->read_iter; | ||
1433 | goto rw_common; | ||
1434 | |||
1435 | case IOCB_CMD_PWRITE: | ||
1436 | case IOCB_CMD_PWRITEV: | ||
1437 | mode = FMODE_WRITE; | ||
1438 | rw = WRITE; | ||
1439 | iter_op = file->f_op->write_iter; | ||
1440 | goto rw_common; | ||
1441 | rw_common: | ||
1442 | if (unlikely(!(file->f_mode & mode))) | ||
1443 | return -EBADF; | ||
1444 | |||
1445 | if (!iter_op) | ||
1446 | return -EINVAL; | ||
1447 | |||
1448 | if (opcode == IOCB_CMD_PREADV || opcode == IOCB_CMD_PWRITEV) | ||
1449 | ret = aio_setup_vectored_rw(rw, buf, len, | ||
1450 | &iovec, compat, &iter); | ||
1451 | else { | ||
1452 | ret = import_single_range(rw, buf, len, iovec, &iter); | ||
1453 | iovec = NULL; | ||
1454 | } | ||
1455 | if (!ret) | ||
1456 | ret = rw_verify_area(rw, file, &req->ki_pos, | ||
1457 | iov_iter_count(&iter)); | ||
1458 | if (ret < 0) { | ||
1459 | kfree(iovec); | ||
1460 | return ret; | ||
1461 | } | ||
1462 | |||
1463 | if (rw == WRITE) | ||
1464 | file_start_write(file); | ||
1465 | |||
1466 | ret = iter_op(req, &iter); | ||
1467 | |||
1468 | if (rw == WRITE) | ||
1469 | file_end_write(file); | ||
1470 | kfree(iovec); | ||
1471 | break; | ||
1472 | |||
1473 | case IOCB_CMD_FDSYNC: | ||
1474 | if (!file->f_op->aio_fsync) | ||
1475 | return -EINVAL; | ||
1476 | |||
1477 | ret = file->f_op->aio_fsync(req, 1); | ||
1478 | break; | ||
1479 | 1458 | ||
1480 | case IOCB_CMD_FSYNC: | 1459 | ret = aio_setup_rw(READ, iocb, &iovec, vectored, compat, &iter); |
1481 | if (!file->f_op->aio_fsync) | 1460 | if (ret) |
1482 | return -EINVAL; | 1461 | return ret; |
1462 | ret = rw_verify_area(READ, file, &req->ki_pos, iov_iter_count(&iter)); | ||
1463 | if (!ret) | ||
1464 | ret = aio_ret(req, file->f_op->read_iter(req, &iter)); | ||
1465 | kfree(iovec); | ||
1466 | return ret; | ||
1467 | } | ||
1483 | 1468 | ||
1484 | ret = file->f_op->aio_fsync(req, 0); | 1469 | static ssize_t aio_write(struct kiocb *req, struct iocb *iocb, bool vectored, |
1485 | break; | 1470 | bool compat) |
1471 | { | ||
1472 | struct file *file = req->ki_filp; | ||
1473 | struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; | ||
1474 | struct iov_iter iter; | ||
1475 | ssize_t ret; | ||
1486 | 1476 | ||
1487 | default: | 1477 | if (unlikely(!(file->f_mode & FMODE_WRITE))) |
1488 | pr_debug("EINVAL: no operation provided\n"); | 1478 | return -EBADF; |
1479 | if (unlikely(!file->f_op->write_iter)) | ||
1489 | return -EINVAL; | 1480 | return -EINVAL; |
1490 | } | ||
1491 | 1481 | ||
1492 | if (ret != -EIOCBQUEUED) { | 1482 | ret = aio_setup_rw(WRITE, iocb, &iovec, vectored, compat, &iter); |
1483 | if (ret) | ||
1484 | return ret; | ||
1485 | ret = rw_verify_area(WRITE, file, &req->ki_pos, iov_iter_count(&iter)); | ||
1486 | if (!ret) { | ||
1487 | req->ki_flags |= IOCB_WRITE; | ||
1488 | file_start_write(file); | ||
1489 | ret = aio_ret(req, file->f_op->write_iter(req, &iter)); | ||
1493 | /* | 1490 | /* |
1494 | * There's no easy way to restart the syscall since other AIO's | 1491 | * We release freeze protection in aio_complete(). Fool lockdep |
1495 | * may be already running. Just fail this IO with EINTR. | 1492 | * by telling it the lock got released so that it doesn't |
1493 | * complain about held lock when we return to userspace. | ||
1496 | */ | 1494 | */ |
1497 | if (unlikely(ret == -ERESTARTSYS || ret == -ERESTARTNOINTR || | 1495 | __sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE); |
1498 | ret == -ERESTARTNOHAND || | ||
1499 | ret == -ERESTART_RESTARTBLOCK)) | ||
1500 | ret = -EINTR; | ||
1501 | aio_complete(req, ret, 0); | ||
1502 | } | 1496 | } |
1503 | 1497 | kfree(iovec); | |
1504 | return 0; | 1498 | return ret; |
1505 | } | 1499 | } |
1506 | 1500 | ||
1507 | static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | 1501 | static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, |
1508 | struct iocb *iocb, bool compat) | 1502 | struct iocb *iocb, bool compat) |
1509 | { | 1503 | { |
1510 | struct aio_kiocb *req; | 1504 | struct aio_kiocb *req; |
1505 | struct file *file; | ||
1511 | ssize_t ret; | 1506 | ssize_t ret; |
1512 | 1507 | ||
1513 | /* enforce forwards compatibility on users */ | 1508 | /* enforce forwards compatibility on users */ |
@@ -1530,7 +1525,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1530 | if (unlikely(!req)) | 1525 | if (unlikely(!req)) |
1531 | return -EAGAIN; | 1526 | return -EAGAIN; |
1532 | 1527 | ||
1533 | req->common.ki_filp = fget(iocb->aio_fildes); | 1528 | req->common.ki_filp = file = fget(iocb->aio_fildes); |
1534 | if (unlikely(!req->common.ki_filp)) { | 1529 | if (unlikely(!req->common.ki_filp)) { |
1535 | ret = -EBADF; | 1530 | ret = -EBADF; |
1536 | goto out_put_req; | 1531 | goto out_put_req; |
@@ -1565,13 +1560,29 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1565 | req->ki_user_iocb = user_iocb; | 1560 | req->ki_user_iocb = user_iocb; |
1566 | req->ki_user_data = iocb->aio_data; | 1561 | req->ki_user_data = iocb->aio_data; |
1567 | 1562 | ||
1568 | ret = aio_run_iocb(&req->common, iocb->aio_lio_opcode, | 1563 | get_file(file); |
1569 | (char __user *)(unsigned long)iocb->aio_buf, | 1564 | switch (iocb->aio_lio_opcode) { |
1570 | iocb->aio_nbytes, | 1565 | case IOCB_CMD_PREAD: |
1571 | compat); | 1566 | ret = aio_read(&req->common, iocb, false, compat); |
1572 | if (ret) | 1567 | break; |
1573 | goto out_put_req; | 1568 | case IOCB_CMD_PWRITE: |
1569 | ret = aio_write(&req->common, iocb, false, compat); | ||
1570 | break; | ||
1571 | case IOCB_CMD_PREADV: | ||
1572 | ret = aio_read(&req->common, iocb, true, compat); | ||
1573 | break; | ||
1574 | case IOCB_CMD_PWRITEV: | ||
1575 | ret = aio_write(&req->common, iocb, true, compat); | ||
1576 | break; | ||
1577 | default: | ||
1578 | pr_debug("invalid aio operation %d\n", iocb->aio_lio_opcode); | ||
1579 | ret = -EINVAL; | ||
1580 | break; | ||
1581 | } | ||
1582 | fput(file); | ||
1574 | 1583 | ||
1584 | if (ret && ret != -EIOCBQUEUED) | ||
1585 | goto out_put_req; | ||
1575 | return 0; | 1586 | return 0; |
1576 | out_put_req: | 1587 | out_put_req: |
1577 | put_reqs_available(ctx, 1); | 1588 | put_reqs_available(ctx, 1); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 18630e800208..f995e3528a33 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -1770,7 +1770,6 @@ const struct file_operations ceph_file_fops = { | |||
1770 | .fsync = ceph_fsync, | 1770 | .fsync = ceph_fsync, |
1771 | .lock = ceph_lock, | 1771 | .lock = ceph_lock, |
1772 | .flock = ceph_flock, | 1772 | .flock = ceph_flock, |
1773 | .splice_read = generic_file_splice_read, | ||
1774 | .splice_write = iter_file_splice_write, | 1773 | .splice_write = iter_file_splice_write, |
1775 | .unlocked_ioctl = ceph_ioctl, | 1774 | .unlocked_ioctl = ceph_ioctl, |
1776 | .compat_ioctl = ceph_ioctl, | 1775 | .compat_ioctl = ceph_ioctl, |
diff --git a/fs/coredump.c b/fs/coredump.c index 281b768000e6..eb9c92c9b20f 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/slab.h> | 1 | #include <linux/slab.h> |
2 | #include <linux/file.h> | 2 | #include <linux/file.h> |
3 | #include <linux/fdtable.h> | 3 | #include <linux/fdtable.h> |
4 | #include <linux/freezer.h> | ||
4 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
5 | #include <linux/stat.h> | 6 | #include <linux/stat.h> |
6 | #include <linux/fcntl.h> | 7 | #include <linux/fcntl.h> |
@@ -423,7 +424,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state) | |||
423 | if (core_waiters > 0) { | 424 | if (core_waiters > 0) { |
424 | struct core_thread *ptr; | 425 | struct core_thread *ptr; |
425 | 426 | ||
427 | freezer_do_not_count(); | ||
426 | wait_for_completion(&core_state->startup); | 428 | wait_for_completion(&core_state->startup); |
429 | freezer_count(); | ||
427 | /* | 430 | /* |
428 | * Wait for all the threads to become inactive, so that | 431 | * Wait for all the threads to become inactive, so that |
429 | * all the thread context (extended register state, like | 432 | * all the thread context (extended register state, like |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 7555ba889d1f..ebecfb8fba06 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -314,7 +314,8 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat | |||
314 | /* Match the full socket address */ | 314 | /* Match the full socket address */ |
315 | if (!rpc_cmp_addr_port(sap, clap)) | 315 | if (!rpc_cmp_addr_port(sap, clap)) |
316 | /* Match all xprt_switch full socket addresses */ | 316 | /* Match all xprt_switch full socket addresses */ |
317 | if (!rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, | 317 | if (IS_ERR(clp->cl_rpcclient) || |
318 | !rpc_clnt_xprt_switch_has_addr(clp->cl_rpcclient, | ||
318 | sap)) | 319 | sap)) |
319 | continue; | 320 | continue; |
320 | 321 | ||
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index c8162c660c44..5551e8ef67fd 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -98,7 +98,7 @@ rename_retry: | |||
98 | return end; | 98 | return end; |
99 | } | 99 | } |
100 | namelen = strlen(base); | 100 | namelen = strlen(base); |
101 | if (flags & NFS_PATH_CANONICAL) { | 101 | if (*end == '/') { |
102 | /* Strip off excess slashes in base string */ | 102 | /* Strip off excess slashes in base string */ |
103 | while (namelen > 0 && base[namelen - 1] == '/') | 103 | while (namelen > 0 && base[namelen - 1] == '/') |
104 | namelen--; | 104 | namelen--; |
diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c index b62973045a3e..a61350f75c74 100644 --- a/fs/nfs/nfs4session.c +++ b/fs/nfs/nfs4session.c | |||
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table *tbl, u32 slotid, | |||
178 | __must_hold(&tbl->slot_tbl_lock) | 178 | __must_hold(&tbl->slot_tbl_lock) |
179 | { | 179 | { |
180 | struct nfs4_slot *slot; | 180 | struct nfs4_slot *slot; |
181 | int ret; | ||
181 | 182 | ||
182 | slot = nfs4_lookup_slot(tbl, slotid); | 183 | slot = nfs4_lookup_slot(tbl, slotid); |
183 | if (IS_ERR(slot)) | 184 | ret = PTR_ERR_OR_ZERO(slot); |
184 | return PTR_ERR(slot); | 185 | if (!ret) |
185 | *seq_nr = slot->seq_nr; | 186 | *seq_nr = slot->seq_nr; |
186 | return 0; | 187 | |
188 | return ret; | ||
187 | } | 189 | } |
188 | 190 | ||
189 | /* | 191 | /* |
@@ -196,7 +198,7 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table *tbl, u32 slotid, | |||
196 | static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl, | 198 | static bool nfs4_slot_seqid_in_use(struct nfs4_slot_table *tbl, |
197 | u32 slotid, u32 seq_nr) | 199 | u32 slotid, u32 seq_nr) |
198 | { | 200 | { |
199 | u32 cur_seq; | 201 | u32 cur_seq = 0; |
200 | bool ret = false; | 202 | bool ret = false; |
201 | 203 | ||
202 | spin_lock(&tbl->slot_tbl_lock); | 204 | spin_lock(&tbl->slot_tbl_lock); |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 56b2d96f9103..259ef85f435a 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -146,6 +146,8 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh, | |||
146 | u32 id; | 146 | u32 id; |
147 | int i; | 147 | int i; |
148 | 148 | ||
149 | if (fsinfo->nlayouttypes == 0) | ||
150 | goto out_no_driver; | ||
149 | if (!(server->nfs_client->cl_exchange_flags & | 151 | if (!(server->nfs_client->cl_exchange_flags & |
150 | (EXCHGID4_FLAG_USE_NON_PNFS | EXCHGID4_FLAG_USE_PNFS_MDS))) { | 152 | (EXCHGID4_FLAG_USE_NON_PNFS | EXCHGID4_FLAG_USE_PNFS_MDS))) { |
151 | printk(KERN_ERR "NFS: %s: cl_exchange_flags 0x%x\n", | 153 | printk(KERN_ERR "NFS: %s: cl_exchange_flags 0x%x\n", |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index a18613579001..0ee19ecc982d 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -1544,8 +1544,6 @@ const struct file_operations ntfs_dir_ops = { | |||
1544 | .iterate = ntfs_readdir, /* Read directory contents. */ | 1544 | .iterate = ntfs_readdir, /* Read directory contents. */ |
1545 | #ifdef NTFS_RW | 1545 | #ifdef NTFS_RW |
1546 | .fsync = ntfs_dir_fsync, /* Sync a directory to disk. */ | 1546 | .fsync = ntfs_dir_fsync, /* Sync a directory to disk. */ |
1547 | /*.aio_fsync = ,*/ /* Sync all outstanding async | ||
1548 | i/o operations on a kiocb. */ | ||
1549 | #endif /* NTFS_RW */ | 1547 | #endif /* NTFS_RW */ |
1550 | /*.ioctl = ,*/ /* Perform function on the | 1548 | /*.ioctl = ,*/ /* Perform function on the |
1551 | mounted filesystem. */ | 1549 | mounted filesystem. */ |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index e7054e2ac922..3ecb9f337b7d 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -3699,7 +3699,7 @@ static void ocfs2_dx_dir_transfer_leaf(struct inode *dir, u32 split_hash, | |||
3699 | static int ocfs2_dx_dir_rebalance_credits(struct ocfs2_super *osb, | 3699 | static int ocfs2_dx_dir_rebalance_credits(struct ocfs2_super *osb, |
3700 | struct ocfs2_dx_root_block *dx_root) | 3700 | struct ocfs2_dx_root_block *dx_root) |
3701 | { | 3701 | { |
3702 | int credits = ocfs2_clusters_to_blocks(osb->sb, 2); | 3702 | int credits = ocfs2_clusters_to_blocks(osb->sb, 3); |
3703 | 3703 | ||
3704 | credits += ocfs2_calc_extend_credits(osb->sb, &dx_root->dr_list); | 3704 | credits += ocfs2_calc_extend_credits(osb->sb, &dx_root->dr_list); |
3705 | credits += ocfs2_quota_trans_credits(osb->sb); | 3705 | credits += ocfs2_quota_trans_credits(osb->sb); |
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index eb09aa026723..d484068ca716 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c | |||
@@ -141,6 +141,9 @@ static struct client_debug_mask client_debug_mask; | |||
141 | */ | 141 | */ |
142 | static DEFINE_MUTEX(orangefs_debug_lock); | 142 | static DEFINE_MUTEX(orangefs_debug_lock); |
143 | 143 | ||
144 | /* Used to protect data in ORANGEFS_KMOD_DEBUG_HELP_FILE */ | ||
145 | static DEFINE_MUTEX(orangefs_help_file_lock); | ||
146 | |||
144 | /* | 147 | /* |
145 | * initialize kmod debug operations, create orangefs debugfs dir and | 148 | * initialize kmod debug operations, create orangefs debugfs dir and |
146 | * ORANGEFS_KMOD_DEBUG_HELP_FILE. | 149 | * ORANGEFS_KMOD_DEBUG_HELP_FILE. |
@@ -289,6 +292,8 @@ static void *help_start(struct seq_file *m, loff_t *pos) | |||
289 | 292 | ||
290 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_start: start\n"); | 293 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_start: start\n"); |
291 | 294 | ||
295 | mutex_lock(&orangefs_help_file_lock); | ||
296 | |||
292 | if (*pos == 0) | 297 | if (*pos == 0) |
293 | payload = m->private; | 298 | payload = m->private; |
294 | 299 | ||
@@ -305,6 +310,7 @@ static void *help_next(struct seq_file *m, void *v, loff_t *pos) | |||
305 | static void help_stop(struct seq_file *m, void *p) | 310 | static void help_stop(struct seq_file *m, void *p) |
306 | { | 311 | { |
307 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_stop: start\n"); | 312 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_stop: start\n"); |
313 | mutex_unlock(&orangefs_help_file_lock); | ||
308 | } | 314 | } |
309 | 315 | ||
310 | static int help_show(struct seq_file *m, void *v) | 316 | static int help_show(struct seq_file *m, void *v) |
@@ -610,32 +616,54 @@ out: | |||
610 | * /sys/kernel/debug/orangefs/debug-help can be catted to | 616 | * /sys/kernel/debug/orangefs/debug-help can be catted to |
611 | * see all the available kernel and client debug keywords. | 617 | * see all the available kernel and client debug keywords. |
612 | * | 618 | * |
613 | * When the kernel boots, we have no idea what keywords the | 619 | * When orangefs.ko initializes, we have no idea what keywords the |
614 | * client supports, nor their associated masks. | 620 | * client supports, nor their associated masks. |
615 | * | 621 | * |
616 | * We pass through this function once at boot and stamp a | 622 | * We pass through this function once at module-load and stamp a |
617 | * boilerplate "we don't know" message for the client in the | 623 | * boilerplate "we don't know" message for the client in the |
618 | * debug-help file. We pass through here again when the client | 624 | * debug-help file. We pass through here again when the client |
619 | * starts and then we can fill out the debug-help file fully. | 625 | * starts and then we can fill out the debug-help file fully. |
620 | * | 626 | * |
621 | * The client might be restarted any number of times between | 627 | * The client might be restarted any number of times between |
622 | * reboots, we only build the debug-help file the first time. | 628 | * module reloads, we only build the debug-help file the first time. |
623 | */ | 629 | */ |
624 | int orangefs_prepare_debugfs_help_string(int at_boot) | 630 | int orangefs_prepare_debugfs_help_string(int at_boot) |
625 | { | 631 | { |
626 | int rc = -EINVAL; | ||
627 | int i; | ||
628 | int byte_count = 0; | ||
629 | char *client_title = "Client Debug Keywords:\n"; | 632 | char *client_title = "Client Debug Keywords:\n"; |
630 | char *kernel_title = "Kernel Debug Keywords:\n"; | 633 | char *kernel_title = "Kernel Debug Keywords:\n"; |
634 | size_t string_size = DEBUG_HELP_STRING_SIZE; | ||
635 | size_t result_size; | ||
636 | size_t i; | ||
637 | char *new; | ||
638 | int rc = -EINVAL; | ||
631 | 639 | ||
632 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); | 640 | gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__); |
633 | 641 | ||
634 | if (at_boot) { | 642 | if (at_boot) |
635 | byte_count += strlen(HELP_STRING_UNINITIALIZED); | ||
636 | client_title = HELP_STRING_UNINITIALIZED; | 643 | client_title = HELP_STRING_UNINITIALIZED; |
637 | } else { | 644 | |
638 | /* | 645 | /* build a new debug_help_string. */ |
646 | new = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL); | ||
647 | if (!new) { | ||
648 | rc = -ENOMEM; | ||
649 | goto out; | ||
650 | } | ||
651 | |||
652 | /* | ||
653 | * strlcat(dst, src, size) will append at most | ||
654 | * "size - strlen(dst) - 1" bytes of src onto dst, | ||
655 | * null terminating the result, and return the total | ||
656 | * length of the string it tried to create. | ||
657 | * | ||
658 | * We'll just plow through here building our new debug | ||
659 | * help string and let strlcat take care of assuring that | ||
660 | * dst doesn't overflow. | ||
661 | */ | ||
662 | strlcat(new, client_title, string_size); | ||
663 | |||
664 | if (!at_boot) { | ||
665 | |||
666 | /* | ||
639 | * fill the client keyword/mask array and remember | 667 | * fill the client keyword/mask array and remember |
640 | * how many elements there were. | 668 | * how many elements there were. |
641 | */ | 669 | */ |
@@ -644,64 +672,40 @@ int orangefs_prepare_debugfs_help_string(int at_boot) | |||
644 | if (cdm_element_count <= 0) | 672 | if (cdm_element_count <= 0) |
645 | goto out; | 673 | goto out; |
646 | 674 | ||
647 | /* Count the bytes destined for debug_help_string. */ | ||
648 | byte_count += strlen(client_title); | ||
649 | |||
650 | for (i = 0; i < cdm_element_count; i++) { | 675 | for (i = 0; i < cdm_element_count; i++) { |
651 | byte_count += strlen(cdm_array[i].keyword + 2); | 676 | strlcat(new, "\t", string_size); |
652 | if (byte_count >= DEBUG_HELP_STRING_SIZE) { | 677 | strlcat(new, cdm_array[i].keyword, string_size); |
653 | pr_info("%s: overflow 1!\n", __func__); | 678 | strlcat(new, "\n", string_size); |
654 | goto out; | ||
655 | } | ||
656 | } | 679 | } |
657 | |||
658 | gossip_debug(GOSSIP_UTILS_DEBUG, | ||
659 | "%s: cdm_element_count:%d:\n", | ||
660 | __func__, | ||
661 | cdm_element_count); | ||
662 | } | 680 | } |
663 | 681 | ||
664 | byte_count += strlen(kernel_title); | 682 | strlcat(new, "\n", string_size); |
683 | strlcat(new, kernel_title, string_size); | ||
684 | |||
665 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { | 685 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { |
666 | byte_count += | 686 | strlcat(new, "\t", string_size); |
667 | strlen(s_kmod_keyword_mask_map[i].keyword + 2); | 687 | strlcat(new, s_kmod_keyword_mask_map[i].keyword, string_size); |
668 | if (byte_count >= DEBUG_HELP_STRING_SIZE) { | 688 | result_size = strlcat(new, "\n", string_size); |
669 | pr_info("%s: overflow 2!\n", __func__); | ||
670 | goto out; | ||
671 | } | ||
672 | } | 689 | } |
673 | 690 | ||
674 | /* build debug_help_string. */ | 691 | /* See if we tried to put too many bytes into "new"... */ |
675 | debug_help_string = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL); | 692 | if (result_size >= string_size) { |
676 | if (!debug_help_string) { | 693 | kfree(new); |
677 | rc = -ENOMEM; | ||
678 | goto out; | 694 | goto out; |
679 | } | 695 | } |
680 | 696 | ||
681 | strcat(debug_help_string, client_title); | 697 | if (at_boot) { |
682 | 698 | debug_help_string = new; | |
683 | if (!at_boot) { | 699 | } else { |
684 | for (i = 0; i < cdm_element_count; i++) { | 700 | mutex_lock(&orangefs_help_file_lock); |
685 | strcat(debug_help_string, "\t"); | 701 | memset(debug_help_string, 0, DEBUG_HELP_STRING_SIZE); |
686 | strcat(debug_help_string, cdm_array[i].keyword); | 702 | strlcat(debug_help_string, new, string_size); |
687 | strcat(debug_help_string, "\n"); | 703 | mutex_unlock(&orangefs_help_file_lock); |
688 | } | ||
689 | } | ||
690 | |||
691 | strcat(debug_help_string, "\n"); | ||
692 | strcat(debug_help_string, kernel_title); | ||
693 | |||
694 | for (i = 0; i < num_kmod_keyword_mask_map; i++) { | ||
695 | strcat(debug_help_string, "\t"); | ||
696 | strcat(debug_help_string, s_kmod_keyword_mask_map[i].keyword); | ||
697 | strcat(debug_help_string, "\n"); | ||
698 | } | 704 | } |
699 | 705 | ||
700 | rc = 0; | 706 | rc = 0; |
701 | 707 | ||
702 | out: | 708 | out: return rc; |
703 | |||
704 | return rc; | ||
705 | 709 | ||
706 | } | 710 | } |
707 | 711 | ||
@@ -959,8 +963,12 @@ int orangefs_debugfs_new_client_string(void __user *arg) | |||
959 | ret = copy_from_user(&client_debug_array_string, | 963 | ret = copy_from_user(&client_debug_array_string, |
960 | (void __user *)arg, | 964 | (void __user *)arg, |
961 | ORANGEFS_MAX_DEBUG_STRING_LEN); | 965 | ORANGEFS_MAX_DEBUG_STRING_LEN); |
962 | if (ret != 0) | 966 | |
967 | if (ret != 0) { | ||
968 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", | ||
969 | __func__); | ||
963 | return -EIO; | 970 | return -EIO; |
971 | } | ||
964 | 972 | ||
965 | /* | 973 | /* |
966 | * The real client-core makes an effort to ensure | 974 | * The real client-core makes an effort to ensure |
@@ -975,45 +983,18 @@ int orangefs_debugfs_new_client_string(void __user *arg) | |||
975 | client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] = | 983 | client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] = |
976 | '\0'; | 984 | '\0'; |
977 | 985 | ||
978 | if (ret != 0) { | ||
979 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", | ||
980 | __func__); | ||
981 | return -EIO; | ||
982 | } | ||
983 | |||
984 | pr_info("%s: client debug array string has been received.\n", | 986 | pr_info("%s: client debug array string has been received.\n", |
985 | __func__); | 987 | __func__); |
986 | 988 | ||
987 | if (!help_string_initialized) { | 989 | if (!help_string_initialized) { |
988 | 990 | ||
989 | /* Free the "we don't know yet" default string... */ | 991 | /* Build a proper debug help string. */ |
990 | kfree(debug_help_string); | ||
991 | |||
992 | /* build a proper debug help string */ | ||
993 | if (orangefs_prepare_debugfs_help_string(0)) { | 992 | if (orangefs_prepare_debugfs_help_string(0)) { |
994 | gossip_err("%s: no debug help string \n", | 993 | gossip_err("%s: no debug help string \n", |
995 | __func__); | 994 | __func__); |
996 | return -EIO; | 995 | return -EIO; |
997 | } | 996 | } |
998 | 997 | ||
999 | /* Replace the boilerplate boot-time debug-help file. */ | ||
1000 | debugfs_remove(help_file_dentry); | ||
1001 | |||
1002 | help_file_dentry = | ||
1003 | debugfs_create_file( | ||
1004 | ORANGEFS_KMOD_DEBUG_HELP_FILE, | ||
1005 | 0444, | ||
1006 | debug_dir, | ||
1007 | debug_help_string, | ||
1008 | &debug_help_fops); | ||
1009 | |||
1010 | if (!help_file_dentry) { | ||
1011 | gossip_err("%s: debugfs_create_file failed for" | ||
1012 | " :%s:!\n", | ||
1013 | __func__, | ||
1014 | ORANGEFS_KMOD_DEBUG_HELP_FILE); | ||
1015 | return -EIO; | ||
1016 | } | ||
1017 | } | 998 | } |
1018 | 999 | ||
1019 | debug_mask_to_string(&client_debug_mask, 1); | 1000 | debug_mask_to_string(&client_debug_mask, 1); |
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c index 2e5b03065f34..4113eb0495bf 100644 --- a/fs/orangefs/orangefs-mod.c +++ b/fs/orangefs/orangefs-mod.c | |||
@@ -124,7 +124,7 @@ static int __init orangefs_init(void) | |||
124 | * unknown at boot time. | 124 | * unknown at boot time. |
125 | * | 125 | * |
126 | * orangefs_prepare_debugfs_help_string will be used again | 126 | * orangefs_prepare_debugfs_help_string will be used again |
127 | * later to rebuild the debug-help file after the client starts | 127 | * later to rebuild the debug-help-string after the client starts |
128 | * and passes along the needed info. The argument signifies | 128 | * and passes along the needed info. The argument signifies |
129 | * which time orangefs_prepare_debugfs_help_string is being | 129 | * which time orangefs_prepare_debugfs_help_string is being |
130 | * called. | 130 | * called. |
@@ -152,7 +152,9 @@ static int __init orangefs_init(void) | |||
152 | 152 | ||
153 | ret = register_filesystem(&orangefs_fs_type); | 153 | ret = register_filesystem(&orangefs_fs_type); |
154 | if (ret == 0) { | 154 | if (ret == 0) { |
155 | pr_info("orangefs: module version %s loaded\n", ORANGEFS_VERSION); | 155 | pr_info("%s: module version %s loaded\n", |
156 | __func__, | ||
157 | ORANGEFS_VERSION); | ||
156 | ret = 0; | 158 | ret = 0; |
157 | goto out; | 159 | goto out; |
158 | } | 160 | } |
diff --git a/fs/splice.c b/fs/splice.c index 153d4f3bd441..dcaf185a5731 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -299,13 +299,8 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, | |||
299 | { | 299 | { |
300 | struct iov_iter to; | 300 | struct iov_iter to; |
301 | struct kiocb kiocb; | 301 | struct kiocb kiocb; |
302 | loff_t isize; | ||
303 | int idx, ret; | 302 | int idx, ret; |
304 | 303 | ||
305 | isize = i_size_read(in->f_mapping->host); | ||
306 | if (unlikely(*ppos >= isize)) | ||
307 | return 0; | ||
308 | |||
309 | iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len); | 304 | iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len); |
310 | idx = to.idx; | 305 | idx = to.idx; |
311 | init_sync_kiocb(&kiocb, in); | 306 | init_sync_kiocb(&kiocb, in); |
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 613c5cf19436..5c2929f94bd3 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c | |||
@@ -199,9 +199,9 @@ xfs_defer_intake_work( | |||
199 | struct xfs_defer_pending *dfp; | 199 | struct xfs_defer_pending *dfp; |
200 | 200 | ||
201 | list_for_each_entry(dfp, &dop->dop_intake, dfp_list) { | 201 | list_for_each_entry(dfp, &dop->dop_intake, dfp_list) { |
202 | trace_xfs_defer_intake_work(tp->t_mountp, dfp); | ||
203 | dfp->dfp_intent = dfp->dfp_type->create_intent(tp, | 202 | dfp->dfp_intent = dfp->dfp_type->create_intent(tp, |
204 | dfp->dfp_count); | 203 | dfp->dfp_count); |
204 | trace_xfs_defer_intake_work(tp->t_mountp, dfp); | ||
205 | list_sort(tp->t_mountp, &dfp->dfp_work, | 205 | list_sort(tp->t_mountp, &dfp->dfp_work, |
206 | dfp->dfp_type->diff_items); | 206 | dfp->dfp_type->diff_items); |
207 | list_for_each(li, &dfp->dfp_work) | 207 | list_for_each(li, &dfp->dfp_work) |
@@ -221,21 +221,14 @@ xfs_defer_trans_abort( | |||
221 | struct xfs_defer_pending *dfp; | 221 | struct xfs_defer_pending *dfp; |
222 | 222 | ||
223 | trace_xfs_defer_trans_abort(tp->t_mountp, dop); | 223 | trace_xfs_defer_trans_abort(tp->t_mountp, dop); |
224 | /* | ||
225 | * If the transaction was committed, drop the intent reference | ||
226 | * since we're bailing out of here. The other reference is | ||
227 | * dropped when the intent hits the AIL. If the transaction | ||
228 | * was not committed, the intent is freed by the intent item | ||
229 | * unlock handler on abort. | ||
230 | */ | ||
231 | if (!dop->dop_committed) | ||
232 | return; | ||
233 | 224 | ||
234 | /* Abort intent items. */ | 225 | /* Abort intent items that don't have a done item. */ |
235 | list_for_each_entry(dfp, &dop->dop_pending, dfp_list) { | 226 | list_for_each_entry(dfp, &dop->dop_pending, dfp_list) { |
236 | trace_xfs_defer_pending_abort(tp->t_mountp, dfp); | 227 | trace_xfs_defer_pending_abort(tp->t_mountp, dfp); |
237 | if (!dfp->dfp_done) | 228 | if (dfp->dfp_intent && !dfp->dfp_done) { |
238 | dfp->dfp_type->abort_intent(dfp->dfp_intent); | 229 | dfp->dfp_type->abort_intent(dfp->dfp_intent); |
230 | dfp->dfp_intent = NULL; | ||
231 | } | ||
239 | } | 232 | } |
240 | 233 | ||
241 | /* Shut down FS. */ | 234 | /* Shut down FS. */ |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 40e887068da2..0504ef8f3aa3 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -118,9 +118,9 @@ do { \ | |||
118 | #define this_cpu_generic_read(pcp) \ | 118 | #define this_cpu_generic_read(pcp) \ |
119 | ({ \ | 119 | ({ \ |
120 | typeof(pcp) __ret; \ | 120 | typeof(pcp) __ret; \ |
121 | preempt_disable(); \ | 121 | preempt_disable_notrace(); \ |
122 | __ret = raw_cpu_generic_read(pcp); \ | 122 | __ret = raw_cpu_generic_read(pcp); \ |
123 | preempt_enable(); \ | 123 | preempt_enable_notrace(); \ |
124 | __ret; \ | 124 | __ret; \ |
125 | }) | 125 | }) |
126 | 126 | ||
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index af0254c09424..4df64a1fc09e 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
@@ -14,6 +14,8 @@ | |||
14 | * [_sdata, _edata]: contains .data.* sections, may also contain .rodata.* | 14 | * [_sdata, _edata]: contains .data.* sections, may also contain .rodata.* |
15 | * and/or .init.* sections. | 15 | * and/or .init.* sections. |
16 | * [__start_rodata, __end_rodata]: contains .rodata.* sections | 16 | * [__start_rodata, __end_rodata]: contains .rodata.* sections |
17 | * [__start_data_ro_after_init, __end_data_ro_after_init]: | ||
18 | * contains data.ro_after_init section | ||
17 | * [__init_begin, __init_end]: contains .init.* sections, but .init.text.* | 19 | * [__init_begin, __init_end]: contains .init.* sections, but .init.text.* |
18 | * may be out of this range on some architectures. | 20 | * may be out of this range on some architectures. |
19 | * [_sinittext, _einittext]: contains .init.text.* sections | 21 | * [_sinittext, _einittext]: contains .init.text.* sections |
@@ -31,6 +33,7 @@ extern char _data[], _sdata[], _edata[]; | |||
31 | extern char __bss_start[], __bss_stop[]; | 33 | extern char __bss_start[], __bss_stop[]; |
32 | extern char __init_begin[], __init_end[]; | 34 | extern char __init_begin[], __init_end[]; |
33 | extern char _sinittext[], _einittext[]; | 35 | extern char _sinittext[], _einittext[]; |
36 | extern char __start_data_ro_after_init[], __end_data_ro_after_init[]; | ||
34 | extern char _end[]; | 37 | extern char _end[]; |
35 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; | 38 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; |
36 | extern char __kprobes_text_start[], __kprobes_text_end[]; | 39 | extern char __kprobes_text_start[], __kprobes_text_end[]; |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 30747960bc54..31e1d639abed 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -259,7 +259,10 @@ | |||
259 | * own by defining an empty RO_AFTER_INIT_DATA. | 259 | * own by defining an empty RO_AFTER_INIT_DATA. |
260 | */ | 260 | */ |
261 | #ifndef RO_AFTER_INIT_DATA | 261 | #ifndef RO_AFTER_INIT_DATA |
262 | #define RO_AFTER_INIT_DATA *(.data..ro_after_init) | 262 | #define RO_AFTER_INIT_DATA \ |
263 | __start_data_ro_after_init = .; \ | ||
264 | *(.data..ro_after_init) \ | ||
265 | __end_data_ro_after_init = .; | ||
263 | #endif | 266 | #endif |
264 | 267 | ||
265 | /* | 268 | /* |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index b352a7b812e6..a9cfd33c7b1a 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -779,7 +779,6 @@ extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah); | |||
779 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); | 779 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); |
780 | 780 | ||
781 | 781 | ||
782 | |||
783 | /*@}*/ | 782 | /*@}*/ |
784 | 783 | ||
785 | /* PCI section */ | 784 | /* PCI section */ |
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index aad8bbacd1f0..6e232e7e0262 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h | |||
@@ -427,4 +427,7 @@ void drm_dev_unref(struct drm_device *dev); | |||
427 | void drm_put_dev(struct drm_device *dev); | 427 | void drm_put_dev(struct drm_device *dev); |
428 | void drm_unplug_dev(struct drm_device *dev); | 428 | void drm_unplug_dev(struct drm_device *dev); |
429 | 429 | ||
430 | int drm_dev_set_unique(struct drm_device *dev, const char *name); | ||
431 | |||
432 | |||
430 | #endif | 433 | #endif |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 689a8b9b9c8f..61a3d90f32b3 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -555,7 +555,8 @@ int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); | |||
555 | int acpi_device_modalias(struct device *, char *, int); | 555 | int acpi_device_modalias(struct device *, char *, int); |
556 | void acpi_walk_dep_device_list(acpi_handle handle); | 556 | void acpi_walk_dep_device_list(acpi_handle handle); |
557 | 557 | ||
558 | struct platform_device *acpi_create_platform_device(struct acpi_device *); | 558 | struct platform_device *acpi_create_platform_device(struct acpi_device *, |
559 | struct property_entry *); | ||
559 | #define ACPI_PTR(_ptr) (_ptr) | 560 | #define ACPI_PTR(_ptr) (_ptr) |
560 | 561 | ||
561 | static inline void acpi_device_set_enumerated(struct acpi_device *adev) | 562 | static inline void acpi_device_set_enumerated(struct acpi_device *adev) |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 96337b15a60d..a8e66344bacc 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -258,6 +258,8 @@ struct ceph_watch_item { | |||
258 | struct ceph_entity_addr addr; | 258 | struct ceph_entity_addr addr; |
259 | }; | 259 | }; |
260 | 260 | ||
261 | #define CEPH_LINGER_ID_START 0xffff000000000000ULL | ||
262 | |||
261 | struct ceph_osd_client { | 263 | struct ceph_osd_client { |
262 | struct ceph_client *client; | 264 | struct ceph_client *client; |
263 | 265 | ||
diff --git a/include/linux/console.h b/include/linux/console.h index 3672809234a7..d530c4627e54 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -173,12 +173,6 @@ static inline void console_sysfs_notify(void) | |||
173 | #endif | 173 | #endif |
174 | extern bool console_suspend_enabled; | 174 | extern bool console_suspend_enabled; |
175 | 175 | ||
176 | #ifdef CONFIG_OF | ||
177 | extern void console_set_by_of(void); | ||
178 | #else | ||
179 | static inline void console_set_by_of(void) {} | ||
180 | #endif | ||
181 | |||
182 | /* Suspend and resume console messages over PM events */ | 176 | /* Suspend and resume console messages over PM events */ |
183 | extern void suspend_console(void); | 177 | extern void suspend_console(void); |
184 | extern void resume_console(void); | 178 | extern void resume_console(void); |
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index c46d2aa16d81..1d18af034554 100644 --- a/include/linux/frontswap.h +++ b/include/linux/frontswap.h | |||
@@ -106,8 +106,9 @@ static inline void frontswap_invalidate_area(unsigned type) | |||
106 | 106 | ||
107 | static inline void frontswap_init(unsigned type, unsigned long *map) | 107 | static inline void frontswap_init(unsigned type, unsigned long *map) |
108 | { | 108 | { |
109 | if (frontswap_enabled()) | 109 | #ifdef CONFIG_FRONTSWAP |
110 | __frontswap_init(type, map); | 110 | __frontswap_init(type, map); |
111 | #endif | ||
111 | } | 112 | } |
112 | 113 | ||
113 | #endif /* _LINUX_FRONTSWAP_H */ | 114 | #endif /* _LINUX_FRONTSWAP_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 16d2b6e874d6..dc0478c07b2a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -321,6 +321,7 @@ struct writeback_control; | |||
321 | #define IOCB_HIPRI (1 << 3) | 321 | #define IOCB_HIPRI (1 << 3) |
322 | #define IOCB_DSYNC (1 << 4) | 322 | #define IOCB_DSYNC (1 << 4) |
323 | #define IOCB_SYNC (1 << 5) | 323 | #define IOCB_SYNC (1 << 5) |
324 | #define IOCB_WRITE (1 << 6) | ||
324 | 325 | ||
325 | struct kiocb { | 326 | struct kiocb { |
326 | struct file *ki_filp; | 327 | struct file *ki_filp; |
@@ -1709,7 +1710,6 @@ struct file_operations { | |||
1709 | int (*flush) (struct file *, fl_owner_t id); | 1710 | int (*flush) (struct file *, fl_owner_t id); |
1710 | int (*release) (struct inode *, struct file *); | 1711 | int (*release) (struct inode *, struct file *); |
1711 | int (*fsync) (struct file *, loff_t, loff_t, int datasync); | 1712 | int (*fsync) (struct file *, loff_t, loff_t, int datasync); |
1712 | int (*aio_fsync) (struct kiocb *, int datasync); | ||
1713 | int (*fasync) (int, struct file *, int); | 1713 | int (*fasync) (int, struct file *, int); |
1714 | int (*lock) (struct file *, int, struct file_lock *); | 1714 | int (*lock) (struct file *, int, struct file_lock *); |
1715 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); | 1715 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); |
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index ee1bed7dbfc6..78bb0d7f6b11 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h | |||
@@ -253,6 +253,13 @@ static inline int phy_set_mode(struct phy *phy, enum phy_mode mode) | |||
253 | return -ENOSYS; | 253 | return -ENOSYS; |
254 | } | 254 | } |
255 | 255 | ||
256 | static inline int phy_reset(struct phy *phy) | ||
257 | { | ||
258 | if (!phy) | ||
259 | return 0; | ||
260 | return -ENOSYS; | ||
261 | } | ||
262 | |||
256 | static inline int phy_get_bus_width(struct phy *phy) | 263 | static inline int phy_get_bus_width(struct phy *phy) |
257 | { | 264 | { |
258 | return -ENOSYS; | 265 | return -ENOSYS; |
diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h index 33d00a4ce656..819d895edfdc 100644 --- a/include/uapi/sound/asoc.h +++ b/include/uapi/sound/asoc.h | |||
@@ -18,12 +18,6 @@ | |||
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <sound/asound.h> | 19 | #include <sound/asound.h> |
20 | 20 | ||
21 | #ifndef __KERNEL__ | ||
22 | #error This API is an early revision and not enabled in the current | ||
23 | #error kernel release, it will be enabled in a future kernel version | ||
24 | #error with incompatible changes to what is here. | ||
25 | #endif | ||
26 | |||
27 | /* | 21 | /* |
28 | * Maximum number of channels topology kcontrol can represent. | 22 | * Maximum number of channels topology kcontrol can represent. |
29 | */ | 23 | */ |
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 084452e34a12..bdff5ed57f10 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c | |||
@@ -203,8 +203,10 @@ static int __init test_suspend(void) | |||
203 | 203 | ||
204 | /* RTCs have initialized by now too ... can we use one? */ | 204 | /* RTCs have initialized by now too ... can we use one? */ |
205 | dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm); | 205 | dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm); |
206 | if (dev) | 206 | if (dev) { |
207 | rtc = rtc_class_open(dev_name(dev)); | 207 | rtc = rtc_class_open(dev_name(dev)); |
208 | put_device(dev); | ||
209 | } | ||
208 | if (!rtc) { | 210 | if (!rtc) { |
209 | printk(warn_no_rtc); | 211 | printk(warn_no_rtc); |
210 | return 0; | 212 | return 0; |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index de08fc90baaf..5028f4fd504a 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -253,17 +253,6 @@ static int preferred_console = -1; | |||
253 | int console_set_on_cmdline; | 253 | int console_set_on_cmdline; |
254 | EXPORT_SYMBOL(console_set_on_cmdline); | 254 | EXPORT_SYMBOL(console_set_on_cmdline); |
255 | 255 | ||
256 | #ifdef CONFIG_OF | ||
257 | static bool of_specified_console; | ||
258 | |||
259 | void console_set_by_of(void) | ||
260 | { | ||
261 | of_specified_console = true; | ||
262 | } | ||
263 | #else | ||
264 | # define of_specified_console false | ||
265 | #endif | ||
266 | |||
267 | /* Flag: console code may call schedule() */ | 256 | /* Flag: console code may call schedule() */ |
268 | static int console_may_schedule; | 257 | static int console_may_schedule; |
269 | 258 | ||
@@ -2657,7 +2646,7 @@ void register_console(struct console *newcon) | |||
2657 | * didn't select a console we take the first one | 2646 | * didn't select a console we take the first one |
2658 | * that registers here. | 2647 | * that registers here. |
2659 | */ | 2648 | */ |
2660 | if (preferred_console < 0 && !of_specified_console) { | 2649 | if (preferred_console < 0) { |
2661 | if (newcon->index < 0) | 2650 | if (newcon->index < 0) |
2662 | newcon->index = 0; | 2651 | newcon->index = 0; |
2663 | if (newcon->setup == NULL || | 2652 | if (newcon->setup == NULL || |
diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 4d830e299989..f87d138e9672 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c | |||
@@ -192,6 +192,7 @@ void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace *trace) | |||
192 | trace->entries = stack->entries; | 192 | trace->entries = stack->entries; |
193 | trace->skip = 0; | 193 | trace->skip = 0; |
194 | } | 194 | } |
195 | EXPORT_SYMBOL_GPL(depot_fetch_stack); | ||
195 | 196 | ||
196 | /** | 197 | /** |
197 | * depot_save_stack - save stack in a stack depot. | 198 | * depot_save_stack - save stack in a stack depot. |
@@ -283,3 +284,4 @@ exit: | |||
283 | fast_exit: | 284 | fast_exit: |
284 | return retval; | 285 | return retval; |
285 | } | 286 | } |
287 | EXPORT_SYMBOL_GPL(depot_save_stack); | ||
@@ -385,6 +385,9 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align) | |||
385 | bitmap_maxno = cma_bitmap_maxno(cma); | 385 | bitmap_maxno = cma_bitmap_maxno(cma); |
386 | bitmap_count = cma_bitmap_pages_to_bits(cma, count); | 386 | bitmap_count = cma_bitmap_pages_to_bits(cma, count); |
387 | 387 | ||
388 | if (bitmap_count > bitmap_maxno) | ||
389 | return NULL; | ||
390 | |||
388 | for (;;) { | 391 | for (;;) { |
389 | mutex_lock(&cma->lock); | 392 | mutex_lock(&cma->lock); |
390 | bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap, | 393 | bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap, |
diff --git a/mm/filemap.c b/mm/filemap.c index c7fe2f16503f..50b52fe51937 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1732,6 +1732,9 @@ find_page: | |||
1732 | if (inode->i_blkbits == PAGE_SHIFT || | 1732 | if (inode->i_blkbits == PAGE_SHIFT || |
1733 | !mapping->a_ops->is_partially_uptodate) | 1733 | !mapping->a_ops->is_partially_uptodate) |
1734 | goto page_not_up_to_date; | 1734 | goto page_not_up_to_date; |
1735 | /* pipes can't handle partially uptodate pages */ | ||
1736 | if (unlikely(iter->type & ITER_PIPE)) | ||
1737 | goto page_not_up_to_date; | ||
1735 | if (!trylock_page(page)) | 1738 | if (!trylock_page(page)) |
1736 | goto page_not_up_to_date; | 1739 | goto page_not_up_to_date; |
1737 | /* Did it get truncated before we got the lock? */ | 1740 | /* Did it get truncated before we got the lock? */ |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ec49d9ef1eef..418bf01a50ed 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -1826,11 +1826,17 @@ static void return_unused_surplus_pages(struct hstate *h, | |||
1826 | * is not the case is if a reserve map was changed between calls. It | 1826 | * is not the case is if a reserve map was changed between calls. It |
1827 | * is the responsibility of the caller to notice the difference and | 1827 | * is the responsibility of the caller to notice the difference and |
1828 | * take appropriate action. | 1828 | * take appropriate action. |
1829 | * | ||
1830 | * vma_add_reservation is used in error paths where a reservation must | ||
1831 | * be restored when a newly allocated huge page must be freed. It is | ||
1832 | * to be called after calling vma_needs_reservation to determine if a | ||
1833 | * reservation exists. | ||
1829 | */ | 1834 | */ |
1830 | enum vma_resv_mode { | 1835 | enum vma_resv_mode { |
1831 | VMA_NEEDS_RESV, | 1836 | VMA_NEEDS_RESV, |
1832 | VMA_COMMIT_RESV, | 1837 | VMA_COMMIT_RESV, |
1833 | VMA_END_RESV, | 1838 | VMA_END_RESV, |
1839 | VMA_ADD_RESV, | ||
1834 | }; | 1840 | }; |
1835 | static long __vma_reservation_common(struct hstate *h, | 1841 | static long __vma_reservation_common(struct hstate *h, |
1836 | struct vm_area_struct *vma, unsigned long addr, | 1842 | struct vm_area_struct *vma, unsigned long addr, |
@@ -1856,6 +1862,14 @@ static long __vma_reservation_common(struct hstate *h, | |||
1856 | region_abort(resv, idx, idx + 1); | 1862 | region_abort(resv, idx, idx + 1); |
1857 | ret = 0; | 1863 | ret = 0; |
1858 | break; | 1864 | break; |
1865 | case VMA_ADD_RESV: | ||
1866 | if (vma->vm_flags & VM_MAYSHARE) | ||
1867 | ret = region_add(resv, idx, idx + 1); | ||
1868 | else { | ||
1869 | region_abort(resv, idx, idx + 1); | ||
1870 | ret = region_del(resv, idx, idx + 1); | ||
1871 | } | ||
1872 | break; | ||
1859 | default: | 1873 | default: |
1860 | BUG(); | 1874 | BUG(); |
1861 | } | 1875 | } |
@@ -1903,6 +1917,56 @@ static void vma_end_reservation(struct hstate *h, | |||
1903 | (void)__vma_reservation_common(h, vma, addr, VMA_END_RESV); | 1917 | (void)__vma_reservation_common(h, vma, addr, VMA_END_RESV); |
1904 | } | 1918 | } |
1905 | 1919 | ||
1920 | static long vma_add_reservation(struct hstate *h, | ||
1921 | struct vm_area_struct *vma, unsigned long addr) | ||
1922 | { | ||
1923 | return __vma_reservation_common(h, vma, addr, VMA_ADD_RESV); | ||
1924 | } | ||
1925 | |||
1926 | /* | ||
1927 | * This routine is called to restore a reservation on error paths. In the | ||
1928 | * specific error paths, a huge page was allocated (via alloc_huge_page) | ||
1929 | * and is about to be freed. If a reservation for the page existed, | ||
1930 | * alloc_huge_page would have consumed the reservation and set PagePrivate | ||
1931 | * in the newly allocated page. When the page is freed via free_huge_page, | ||
1932 | * the global reservation count will be incremented if PagePrivate is set. | ||
1933 | * However, free_huge_page can not adjust the reserve map. Adjust the | ||
1934 | * reserve map here to be consistent with global reserve count adjustments | ||
1935 | * to be made by free_huge_page. | ||
1936 | */ | ||
1937 | static void restore_reserve_on_error(struct hstate *h, | ||
1938 | struct vm_area_struct *vma, unsigned long address, | ||
1939 | struct page *page) | ||
1940 | { | ||
1941 | if (unlikely(PagePrivate(page))) { | ||
1942 | long rc = vma_needs_reservation(h, vma, address); | ||
1943 | |||
1944 | if (unlikely(rc < 0)) { | ||
1945 | /* | ||
1946 | * Rare out of memory condition in reserve map | ||
1947 | * manipulation. Clear PagePrivate so that | ||
1948 | * global reserve count will not be incremented | ||
1949 | * by free_huge_page. This will make it appear | ||
1950 | * as though the reservation for this page was | ||
1951 | * consumed. This may prevent the task from | ||
1952 | * faulting in the page at a later time. This | ||
1953 | * is better than inconsistent global huge page | ||
1954 | * accounting of reserve counts. | ||
1955 | */ | ||
1956 | ClearPagePrivate(page); | ||
1957 | } else if (rc) { | ||
1958 | rc = vma_add_reservation(h, vma, address); | ||
1959 | if (unlikely(rc < 0)) | ||
1960 | /* | ||
1961 | * See above comment about rare out of | ||
1962 | * memory condition. | ||
1963 | */ | ||
1964 | ClearPagePrivate(page); | ||
1965 | } else | ||
1966 | vma_end_reservation(h, vma, address); | ||
1967 | } | ||
1968 | } | ||
1969 | |||
1906 | struct page *alloc_huge_page(struct vm_area_struct *vma, | 1970 | struct page *alloc_huge_page(struct vm_area_struct *vma, |
1907 | unsigned long addr, int avoid_reserve) | 1971 | unsigned long addr, int avoid_reserve) |
1908 | { | 1972 | { |
@@ -3498,6 +3562,7 @@ retry_avoidcopy: | |||
3498 | spin_unlock(ptl); | 3562 | spin_unlock(ptl); |
3499 | mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end); | 3563 | mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end); |
3500 | out_release_all: | 3564 | out_release_all: |
3565 | restore_reserve_on_error(h, vma, address, new_page); | ||
3501 | put_page(new_page); | 3566 | put_page(new_page); |
3502 | out_release_old: | 3567 | out_release_old: |
3503 | put_page(old_page); | 3568 | put_page(old_page); |
@@ -3680,6 +3745,7 @@ backout: | |||
3680 | spin_unlock(ptl); | 3745 | spin_unlock(ptl); |
3681 | backout_unlocked: | 3746 | backout_unlocked: |
3682 | unlock_page(page); | 3747 | unlock_page(page); |
3748 | restore_reserve_on_error(h, vma, address, page); | ||
3683 | put_page(page); | 3749 | put_page(page); |
3684 | goto out; | 3750 | goto out; |
3685 | } | 3751 | } |
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index e5355a5b423f..d1380ed93fdf 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -1414,6 +1414,7 @@ static void kmemleak_scan(void) | |||
1414 | /* data/bss scanning */ | 1414 | /* data/bss scanning */ |
1415 | scan_large_block(_sdata, _edata); | 1415 | scan_large_block(_sdata, _edata); |
1416 | scan_large_block(__bss_start, __bss_stop); | 1416 | scan_large_block(__bss_start, __bss_stop); |
1417 | scan_large_block(__start_data_ro_after_init, __end_data_ro_after_init); | ||
1417 | 1418 | ||
1418 | #ifdef CONFIG_SMP | 1419 | #ifdef CONFIG_SMP |
1419 | /* per-cpu sections scanning */ | 1420 | /* per-cpu sections scanning */ |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index de88f33519c0..19e796d36a62 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -1112,10 +1112,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | if (!PageHuge(p) && PageTransHuge(hpage)) { | 1114 | if (!PageHuge(p) && PageTransHuge(hpage)) { |
1115 | lock_page(hpage); | 1115 | lock_page(p); |
1116 | if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) { | 1116 | if (!PageAnon(p) || unlikely(split_huge_page(p))) { |
1117 | unlock_page(hpage); | 1117 | unlock_page(p); |
1118 | if (!PageAnon(hpage)) | 1118 | if (!PageAnon(p)) |
1119 | pr_err("Memory failure: %#lx: non anonymous thp\n", | 1119 | pr_err("Memory failure: %#lx: non anonymous thp\n", |
1120 | pfn); | 1120 | pfn); |
1121 | else | 1121 | else |
@@ -1126,9 +1126,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1126 | put_hwpoison_page(p); | 1126 | put_hwpoison_page(p); |
1127 | return -EBUSY; | 1127 | return -EBUSY; |
1128 | } | 1128 | } |
1129 | unlock_page(hpage); | 1129 | unlock_page(p); |
1130 | get_hwpoison_page(p); | ||
1131 | put_hwpoison_page(hpage); | ||
1132 | VM_BUG_ON_PAGE(!page_count(p), p); | 1130 | VM_BUG_ON_PAGE(!page_count(p), p); |
1133 | hpage = compound_head(p); | 1131 | hpage = compound_head(p); |
1134 | } | 1132 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 072d791dce2d..6de9440e3ae2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3658,7 +3658,7 @@ retry: | |||
3658 | /* Make sure we know about allocations which stall for too long */ | 3658 | /* Make sure we know about allocations which stall for too long */ |
3659 | if (time_after(jiffies, alloc_start + stall_timeout)) { | 3659 | if (time_after(jiffies, alloc_start + stall_timeout)) { |
3660 | warn_alloc(gfp_mask, | 3660 | warn_alloc(gfp_mask, |
3661 | "page alloction stalls for %ums, order:%u\n", | 3661 | "page allocation stalls for %ums, order:%u", |
3662 | jiffies_to_msecs(jiffies-alloc_start), order); | 3662 | jiffies_to_msecs(jiffies-alloc_start), order); |
3663 | stall_timeout += 10 * HZ; | 3663 | stall_timeout += 10 * HZ; |
3664 | } | 3664 | } |
diff --git a/mm/shmem.c b/mm/shmem.c index ad7813d73ea7..166ebf5d2bce 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1483,6 +1483,8 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp, | |||
1483 | copy_highpage(newpage, oldpage); | 1483 | copy_highpage(newpage, oldpage); |
1484 | flush_dcache_page(newpage); | 1484 | flush_dcache_page(newpage); |
1485 | 1485 | ||
1486 | __SetPageLocked(newpage); | ||
1487 | __SetPageSwapBacked(newpage); | ||
1486 | SetPageUptodate(newpage); | 1488 | SetPageUptodate(newpage); |
1487 | set_page_private(newpage, swap_index); | 1489 | set_page_private(newpage, swap_index); |
1488 | SetPageSwapCache(newpage); | 1490 | SetPageSwapCache(newpage); |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 71f0b28a1bec..329b03843863 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -533,8 +533,8 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg, | |||
533 | 533 | ||
534 | s = create_cache(cache_name, root_cache->object_size, | 534 | s = create_cache(cache_name, root_cache->object_size, |
535 | root_cache->size, root_cache->align, | 535 | root_cache->size, root_cache->align, |
536 | root_cache->flags, root_cache->ctor, | 536 | root_cache->flags & CACHE_CREATE_MASK, |
537 | memcg, root_cache); | 537 | root_cache->ctor, memcg, root_cache); |
538 | /* | 538 | /* |
539 | * If we could not create a memcg cache, do not complain, because | 539 | * If we could not create a memcg cache, do not complain, because |
540 | * that's not critical at all as we can always proceed with the root | 540 | * that's not critical at all as we can always proceed with the root |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 2210de290b54..f30438970cd1 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -2224,6 +2224,8 @@ static unsigned long read_swap_header(struct swap_info_struct *p, | |||
2224 | swab32s(&swap_header->info.version); | 2224 | swab32s(&swap_header->info.version); |
2225 | swab32s(&swap_header->info.last_page); | 2225 | swab32s(&swap_header->info.last_page); |
2226 | swab32s(&swap_header->info.nr_badpages); | 2226 | swab32s(&swap_header->info.nr_badpages); |
2227 | if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES) | ||
2228 | return 0; | ||
2227 | for (i = 0; i < swap_header->info.nr_badpages; i++) | 2229 | for (i = 0; i < swap_header->info.nr_badpages; i++) |
2228 | swab32s(&swap_header->info.badpages[i]); | 2230 | swab32s(&swap_header->info.badpages[i]); |
2229 | } | 2231 | } |
diff --git a/net/ceph/ceph_fs.c b/net/ceph/ceph_fs.c index 7d54e944de5e..dcbe67ff3e2b 100644 --- a/net/ceph/ceph_fs.c +++ b/net/ceph/ceph_fs.c | |||
@@ -34,7 +34,8 @@ void ceph_file_layout_from_legacy(struct ceph_file_layout *fl, | |||
34 | fl->stripe_count = le32_to_cpu(legacy->fl_stripe_count); | 34 | fl->stripe_count = le32_to_cpu(legacy->fl_stripe_count); |
35 | fl->object_size = le32_to_cpu(legacy->fl_object_size); | 35 | fl->object_size = le32_to_cpu(legacy->fl_object_size); |
36 | fl->pool_id = le32_to_cpu(legacy->fl_pg_pool); | 36 | fl->pool_id = le32_to_cpu(legacy->fl_pg_pool); |
37 | if (fl->pool_id == 0) | 37 | if (fl->pool_id == 0 && fl->stripe_unit == 0 && |
38 | fl->stripe_count == 0 && fl->object_size == 0) | ||
38 | fl->pool_id = -1; | 39 | fl->pool_id = -1; |
39 | } | 40 | } |
40 | EXPORT_SYMBOL(ceph_file_layout_from_legacy); | 41 | EXPORT_SYMBOL(ceph_file_layout_from_legacy); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d9bf7a1d0a58..e6ae15bc41b7 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -4094,6 +4094,7 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client) | |||
4094 | osd_init(&osdc->homeless_osd); | 4094 | osd_init(&osdc->homeless_osd); |
4095 | osdc->homeless_osd.o_osdc = osdc; | 4095 | osdc->homeless_osd.o_osdc = osdc; |
4096 | osdc->homeless_osd.o_osd = CEPH_HOMELESS_OSD; | 4096 | osdc->homeless_osd.o_osd = CEPH_HOMELESS_OSD; |
4097 | osdc->last_linger_id = CEPH_LINGER_ID_START; | ||
4097 | osdc->linger_requests = RB_ROOT; | 4098 | osdc->linger_requests = RB_ROOT; |
4098 | osdc->map_checks = RB_ROOT; | 4099 | osdc->map_checks = RB_ROOT; |
4099 | osdc->linger_map_checks = RB_ROOT; | 4100 | osdc->linger_map_checks = RB_ROOT; |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 34dd7b26ee5f..62a482790937 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -2753,14 +2753,18 @@ EXPORT_SYMBOL_GPL(rpc_cap_max_reconnect_timeout); | |||
2753 | 2753 | ||
2754 | void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt) | 2754 | void rpc_clnt_xprt_switch_put(struct rpc_clnt *clnt) |
2755 | { | 2755 | { |
2756 | rcu_read_lock(); | ||
2756 | xprt_switch_put(rcu_dereference(clnt->cl_xpi.xpi_xpswitch)); | 2757 | xprt_switch_put(rcu_dereference(clnt->cl_xpi.xpi_xpswitch)); |
2758 | rcu_read_unlock(); | ||
2757 | } | 2759 | } |
2758 | EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_put); | 2760 | EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_put); |
2759 | 2761 | ||
2760 | void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt) | 2762 | void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt) |
2761 | { | 2763 | { |
2764 | rcu_read_lock(); | ||
2762 | rpc_xprt_switch_add_xprt(rcu_dereference(clnt->cl_xpi.xpi_xpswitch), | 2765 | rpc_xprt_switch_add_xprt(rcu_dereference(clnt->cl_xpi.xpi_xpswitch), |
2763 | xprt); | 2766 | xprt); |
2767 | rcu_read_unlock(); | ||
2764 | } | 2768 | } |
2765 | EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_add_xprt); | 2769 | EXPORT_SYMBOL_GPL(rpc_clnt_xprt_switch_add_xprt); |
2766 | 2770 | ||
@@ -2770,9 +2774,8 @@ bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, | |||
2770 | struct rpc_xprt_switch *xps; | 2774 | struct rpc_xprt_switch *xps; |
2771 | bool ret; | 2775 | bool ret; |
2772 | 2776 | ||
2773 | xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch); | ||
2774 | |||
2775 | rcu_read_lock(); | 2777 | rcu_read_lock(); |
2778 | xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch); | ||
2776 | ret = rpc_xprt_switch_has_addr(xps, sap); | 2779 | ret = rpc_xprt_switch_has_addr(xps, sap); |
2777 | rcu_read_unlock(); | 2780 | rcu_read_unlock(); |
2778 | return ret; | 2781 | return ret; |
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index 210949562786..26b26beef2d4 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c | |||
@@ -44,18 +44,20 @@ | |||
44 | * being done. | 44 | * being done. |
45 | * | 45 | * |
46 | * When the underlying transport disconnects, MRs are left in one of | 46 | * When the underlying transport disconnects, MRs are left in one of |
47 | * three states: | 47 | * four states: |
48 | * | 48 | * |
49 | * INVALID: The MR was not in use before the QP entered ERROR state. | 49 | * INVALID: The MR was not in use before the QP entered ERROR state. |
50 | * (Or, the LOCAL_INV WR has not completed or flushed yet). | ||
51 | * | ||
52 | * STALE: The MR was being registered or unregistered when the QP | ||
53 | * entered ERROR state, and the pending WR was flushed. | ||
54 | * | 50 | * |
55 | * VALID: The MR was registered before the QP entered ERROR state. | 51 | * VALID: The MR was registered before the QP entered ERROR state. |
56 | * | 52 | * |
57 | * When frwr_op_map encounters STALE and VALID MRs, they are recovered | 53 | * FLUSHED_FR: The MR was being registered when the QP entered ERROR |
58 | * with ib_dereg_mr and then are re-initialized. Beause MR recovery | 54 | * state, and the pending WR was flushed. |
55 | * | ||
56 | * FLUSHED_LI: The MR was being invalidated when the QP entered ERROR | ||
57 | * state, and the pending WR was flushed. | ||
58 | * | ||
59 | * When frwr_op_map encounters FLUSHED and VALID MRs, they are recovered | ||
60 | * with ib_dereg_mr and then are re-initialized. Because MR recovery | ||
59 | * allocates fresh resources, it is deferred to a workqueue, and the | 61 | * allocates fresh resources, it is deferred to a workqueue, and the |
60 | * recovered MRs are placed back on the rb_mws list when recovery is | 62 | * recovered MRs are placed back on the rb_mws list when recovery is |
61 | * complete. frwr_op_map allocates another MR for the current RPC while | 63 | * 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) | |||
177 | static void | 179 | static void |
178 | frwr_op_recover_mr(struct rpcrdma_mw *mw) | 180 | frwr_op_recover_mr(struct rpcrdma_mw *mw) |
179 | { | 181 | { |
182 | enum rpcrdma_frmr_state state = mw->frmr.fr_state; | ||
180 | struct rpcrdma_xprt *r_xprt = mw->mw_xprt; | 183 | struct rpcrdma_xprt *r_xprt = mw->mw_xprt; |
181 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | 184 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; |
182 | int rc; | 185 | int rc; |
183 | 186 | ||
184 | rc = __frwr_reset_mr(ia, mw); | 187 | rc = __frwr_reset_mr(ia, mw); |
185 | ib_dma_unmap_sg(ia->ri_device, mw->mw_sg, mw->mw_nents, mw->mw_dir); | 188 | if (state != FRMR_FLUSHED_LI) |
189 | ib_dma_unmap_sg(ia->ri_device, | ||
190 | mw->mw_sg, mw->mw_nents, mw->mw_dir); | ||
186 | if (rc) | 191 | if (rc) |
187 | goto out_release; | 192 | goto out_release; |
188 | 193 | ||
@@ -262,10 +267,8 @@ frwr_op_maxpages(struct rpcrdma_xprt *r_xprt) | |||
262 | } | 267 | } |
263 | 268 | ||
264 | static void | 269 | static void |
265 | __frwr_sendcompletion_flush(struct ib_wc *wc, struct rpcrdma_frmr *frmr, | 270 | __frwr_sendcompletion_flush(struct ib_wc *wc, const char *wr) |
266 | const char *wr) | ||
267 | { | 271 | { |
268 | frmr->fr_state = FRMR_IS_STALE; | ||
269 | if (wc->status != IB_WC_WR_FLUSH_ERR) | 272 | if (wc->status != IB_WC_WR_FLUSH_ERR) |
270 | pr_err("rpcrdma: %s: %s (%u/0x%x)\n", | 273 | pr_err("rpcrdma: %s: %s (%u/0x%x)\n", |
271 | wr, ib_wc_status_msg(wc->status), | 274 | wr, ib_wc_status_msg(wc->status), |
@@ -288,7 +291,8 @@ frwr_wc_fastreg(struct ib_cq *cq, struct ib_wc *wc) | |||
288 | if (wc->status != IB_WC_SUCCESS) { | 291 | if (wc->status != IB_WC_SUCCESS) { |
289 | cqe = wc->wr_cqe; | 292 | cqe = wc->wr_cqe; |
290 | frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe); | 293 | frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe); |
291 | __frwr_sendcompletion_flush(wc, frmr, "fastreg"); | 294 | frmr->fr_state = FRMR_FLUSHED_FR; |
295 | __frwr_sendcompletion_flush(wc, "fastreg"); | ||
292 | } | 296 | } |
293 | } | 297 | } |
294 | 298 | ||
@@ -308,7 +312,8 @@ frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc) | |||
308 | if (wc->status != IB_WC_SUCCESS) { | 312 | if (wc->status != IB_WC_SUCCESS) { |
309 | cqe = wc->wr_cqe; | 313 | cqe = wc->wr_cqe; |
310 | frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe); | 314 | frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe); |
311 | __frwr_sendcompletion_flush(wc, frmr, "localinv"); | 315 | frmr->fr_state = FRMR_FLUSHED_LI; |
316 | __frwr_sendcompletion_flush(wc, "localinv"); | ||
312 | } | 317 | } |
313 | } | 318 | } |
314 | 319 | ||
@@ -328,8 +333,10 @@ frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc) | |||
328 | /* WARNING: Only wr_cqe and status are reliable at this point */ | 333 | /* WARNING: Only wr_cqe and status are reliable at this point */ |
329 | cqe = wc->wr_cqe; | 334 | cqe = wc->wr_cqe; |
330 | frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe); | 335 | frmr = container_of(cqe, struct rpcrdma_frmr, fr_cqe); |
331 | if (wc->status != IB_WC_SUCCESS) | 336 | if (wc->status != IB_WC_SUCCESS) { |
332 | __frwr_sendcompletion_flush(wc, frmr, "localinv"); | 337 | frmr->fr_state = FRMR_FLUSHED_LI; |
338 | __frwr_sendcompletion_flush(wc, "localinv"); | ||
339 | } | ||
333 | complete(&frmr->fr_linv_done); | 340 | complete(&frmr->fr_linv_done); |
334 | } | 341 | } |
335 | 342 | ||
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 0d35b761c883..6e1bba358203 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
@@ -216,7 +216,8 @@ struct rpcrdma_rep { | |||
216 | enum rpcrdma_frmr_state { | 216 | enum rpcrdma_frmr_state { |
217 | FRMR_IS_INVALID, /* ready to be used */ | 217 | FRMR_IS_INVALID, /* ready to be used */ |
218 | FRMR_IS_VALID, /* in use */ | 218 | FRMR_IS_VALID, /* in use */ |
219 | FRMR_IS_STALE, /* failed completion */ | 219 | FRMR_FLUSHED_FR, /* flushed FASTREG WR */ |
220 | FRMR_FLUSHED_LI, /* flushed LOCALINV WR */ | ||
220 | }; | 221 | }; |
221 | 222 | ||
222 | struct rpcrdma_frmr { | 223 | struct rpcrdma_frmr { |
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 53449a6ff6aa..7c321a603b07 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn | |||
@@ -36,6 +36,7 @@ warning-2 += -Wshadow | |||
36 | warning-2 += $(call cc-option, -Wlogical-op) | 36 | warning-2 += $(call cc-option, -Wlogical-op) |
37 | warning-2 += $(call cc-option, -Wmissing-field-initializers) | 37 | warning-2 += $(call cc-option, -Wmissing-field-initializers) |
38 | warning-2 += $(call cc-option, -Wsign-compare) | 38 | warning-2 += $(call cc-option, -Wsign-compare) |
39 | warning-2 += $(call cc-option, -Wmaybe-uninitialized) | ||
39 | 40 | ||
40 | warning-3 := -Wbad-function-cast | 41 | warning-3 := -Wbad-function-cast |
41 | warning-3 += -Wcast-qual | 42 | warning-3 += -Wcast-qual |
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index dd779c40c8e6..3b1b13818d59 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan | |||
@@ -17,4 +17,8 @@ endif | |||
17 | ifdef CONFIG_UBSAN_NULL | 17 | ifdef CONFIG_UBSAN_NULL |
18 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=null) | 18 | CFLAGS_UBSAN += $(call cc-option, -fsanitize=null) |
19 | endif | 19 | endif |
20 | |||
21 | # -fsanitize=* options makes GCC less smart than usual and | ||
22 | # increase number of 'maybe-uninitialized false-positives | ||
23 | CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized) | ||
20 | endif | 24 | endif |
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter index 19f5adfd877d..d9ff038c1b28 100755 --- a/scripts/bloat-o-meter +++ b/scripts/bloat-o-meter | |||
@@ -8,6 +8,9 @@ | |||
8 | # of the GNU General Public License, incorporated herein by reference. | 8 | # of the GNU General Public License, incorporated herein by reference. |
9 | 9 | ||
10 | import sys, os, re | 10 | import sys, os, re |
11 | from signal import signal, SIGPIPE, SIG_DFL | ||
12 | |||
13 | signal(SIGPIPE, SIG_DFL) | ||
11 | 14 | ||
12 | if len(sys.argv) != 3: | 15 | if len(sys.argv) != 3: |
13 | sys.stderr.write("usage: %s file1 file2\n" % sys.argv[0]) | 16 | sys.stderr.write("usage: %s file1 file2\n" % sys.argv[0]) |
diff --git a/sound/core/info.c b/sound/core/info.c index 895362a696c9..8ab72e0f5932 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -325,10 +325,15 @@ static ssize_t snd_info_text_entry_write(struct file *file, | |||
325 | size_t next; | 325 | size_t next; |
326 | int err = 0; | 326 | int err = 0; |
327 | 327 | ||
328 | if (!entry->c.text.write) | ||
329 | return -EIO; | ||
328 | pos = *offset; | 330 | pos = *offset; |
329 | if (!valid_pos(pos, count)) | 331 | if (!valid_pos(pos, count)) |
330 | return -EIO; | 332 | return -EIO; |
331 | next = pos + count; | 333 | next = pos + count; |
334 | /* don't handle too large text inputs */ | ||
335 | if (next > 16 * 1024) | ||
336 | return -EIO; | ||
332 | mutex_lock(&entry->access); | 337 | mutex_lock(&entry->access); |
333 | buf = data->wbuffer; | 338 | buf = data->wbuffer; |
334 | if (!buf) { | 339 | if (!buf) { |
@@ -366,7 +371,9 @@ static int snd_info_seq_show(struct seq_file *seq, void *p) | |||
366 | struct snd_info_private_data *data = seq->private; | 371 | struct snd_info_private_data *data = seq->private; |
367 | struct snd_info_entry *entry = data->entry; | 372 | struct snd_info_entry *entry = data->entry; |
368 | 373 | ||
369 | if (entry->c.text.read) { | 374 | if (!entry->c.text.read) { |
375 | return -EIO; | ||
376 | } else { | ||
370 | data->rbuffer->buffer = (char *)seq; /* XXX hack! */ | 377 | data->rbuffer->buffer = (char *)seq; /* XXX hack! */ |
371 | entry->c.text.read(entry, data->rbuffer); | 378 | entry->c.text.read(entry, data->rbuffer); |
372 | } | 379 | } |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 18baea2f7d65..84f86745c30e 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -148,11 +148,11 @@ SND_SOC_DAPM_OUTPUT("AOUTR"), | |||
148 | }; | 148 | }; |
149 | 149 | ||
150 | static const struct snd_soc_dapm_route cs4270_dapm_routes[] = { | 150 | static const struct snd_soc_dapm_route cs4270_dapm_routes[] = { |
151 | { "Capture", NULL, "AINA" }, | 151 | { "Capture", NULL, "AINL" }, |
152 | { "Capture", NULL, "AINB" }, | 152 | { "Capture", NULL, "AINR" }, |
153 | 153 | ||
154 | { "AOUTA", NULL, "Playback" }, | 154 | { "AOUTL", NULL, "Playback" }, |
155 | { "AOUTB", NULL, "Playback" }, | 155 | { "AOUTR", NULL, "Playback" }, |
156 | }; | 156 | }; |
157 | 157 | ||
158 | /** | 158 | /** |
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 1152aa5e7c39..cf37936bfe3a 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c | |||
@@ -880,7 +880,8 @@ static const struct snd_soc_dapm_widget da7219_dapm_widgets[] = { | |||
880 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | 880 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
881 | 881 | ||
882 | /* DAI */ | 882 | /* DAI */ |
883 | SND_SOC_DAPM_AIF_OUT("DAIOUT", "Capture", 0, SND_SOC_NOPM, 0, 0), | 883 | SND_SOC_DAPM_AIF_OUT("DAIOUT", "Capture", 0, DA7219_DAI_TDM_CTRL, |
884 | DA7219_DAI_OE_SHIFT, DA7219_NO_INVERT), | ||
884 | SND_SOC_DAPM_AIF_IN("DAIIN", "Playback", 0, SND_SOC_NOPM, 0, 0), | 885 | SND_SOC_DAPM_AIF_IN("DAIIN", "Playback", 0, SND_SOC_NOPM, 0, 0), |
885 | 886 | ||
886 | /* Output Muxes */ | 887 | /* Output Muxes */ |
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index b904492d7744..90b5948e0ff3 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c | |||
@@ -364,7 +364,12 @@ static int hdmi_of_xlate_dai_name(struct snd_soc_component *component, | |||
364 | struct of_phandle_args *args, | 364 | struct of_phandle_args *args, |
365 | const char **dai_name) | 365 | const char **dai_name) |
366 | { | 366 | { |
367 | int id = args->args[0]; | 367 | int id; |
368 | |||
369 | if (args->args_count) | ||
370 | id = args->args[0]; | ||
371 | else | ||
372 | id = 0; | ||
368 | 373 | ||
369 | if (id < ARRAY_SIZE(hdmi_dai_name)) { | 374 | if (id < ARRAY_SIZE(hdmi_dai_name)) { |
370 | *dai_name = hdmi_dai_name[id]; | 375 | *dai_name = hdmi_dai_name[id]; |
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 55558643166f..2db8179047ae 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c | |||
@@ -249,6 +249,11 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) | |||
249 | snd_soc_dapm_force_enable_pin(dapm, "LDO1"); | 249 | snd_soc_dapm_force_enable_pin(dapm, "LDO1"); |
250 | snd_soc_dapm_sync(dapm); | 250 | snd_soc_dapm_sync(dapm); |
251 | 251 | ||
252 | regmap_update_bits(rt298->regmap, | ||
253 | RT298_POWER_CTRL1, 0x1001, 0); | ||
254 | regmap_update_bits(rt298->regmap, | ||
255 | RT298_POWER_CTRL2, 0x4, 0x4); | ||
256 | |||
252 | regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24); | 257 | regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24); |
253 | msleep(50); | 258 | msleep(50); |
254 | 259 | ||
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 01a18d88f1eb..00ff2788879e 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c | |||
@@ -1547,11 +1547,11 @@ static int rt5663_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
1547 | msleep(sleep_time[i]); | 1547 | msleep(sleep_time[i]); |
1548 | val = snd_soc_read(codec, RT5663_EM_JACK_TYPE_2) & | 1548 | val = snd_soc_read(codec, RT5663_EM_JACK_TYPE_2) & |
1549 | 0x0003; | 1549 | 0x0003; |
1550 | dev_dbg(codec->dev, "%s: MX-00e7 val=%x sleep %d\n", | ||
1551 | __func__, val, sleep_time[i]); | ||
1550 | i++; | 1552 | i++; |
1551 | if (val == 0x1 || val == 0x2 || val == 0x3) | 1553 | if (val == 0x1 || val == 0x2 || val == 0x3) |
1552 | break; | 1554 | break; |
1553 | dev_dbg(codec->dev, "%s: MX-00e7 val=%x sleep %d\n", | ||
1554 | __func__, val, sleep_time[i]); | ||
1555 | } | 1555 | } |
1556 | dev_dbg(codec->dev, "%s val = %d\n", __func__, val); | 1556 | dev_dbg(codec->dev, "%s val = %d\n", __func__, val); |
1557 | switch (val) { | 1557 | switch (val) { |
diff --git a/sound/soc/codecs/sti-sas.c b/sound/soc/codecs/sti-sas.c index 7b31ee9b82bc..d6e00c77edcd 100644 --- a/sound/soc/codecs/sti-sas.c +++ b/sound/soc/codecs/sti-sas.c | |||
@@ -424,7 +424,7 @@ static const struct snd_soc_dai_ops stih407_dac_ops = { | |||
424 | static const struct regmap_config stih407_sas_regmap = { | 424 | static const struct regmap_config stih407_sas_regmap = { |
425 | .reg_bits = 32, | 425 | .reg_bits = 32, |
426 | .val_bits = 32, | 426 | .val_bits = 32, |
427 | 427 | .fast_io = true, | |
428 | .max_register = STIH407_AUDIO_DAC_CTRL, | 428 | .max_register = STIH407_AUDIO_DAC_CTRL, |
429 | .reg_defaults = stih407_sas_reg_defaults, | 429 | .reg_defaults = stih407_sas_reg_defaults, |
430 | .num_reg_defaults = ARRAY_SIZE(stih407_sas_reg_defaults), | 430 | .num_reg_defaults = ARRAY_SIZE(stih407_sas_reg_defaults), |
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index df5e5cb33baa..810369f687d7 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c | |||
@@ -341,20 +341,9 @@ static int tas571x_set_bias_level(struct snd_soc_codec *codec, | |||
341 | return ret; | 341 | return ret; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | |||
345 | gpiod_set_value(priv->pdn_gpio, 0); | ||
346 | usleep_range(5000, 6000); | ||
347 | |||
348 | regcache_cache_only(priv->regmap, false); | ||
349 | ret = regcache_sync(priv->regmap); | ||
350 | if (ret) | ||
351 | return ret; | ||
352 | } | 344 | } |
353 | break; | 345 | break; |
354 | case SND_SOC_BIAS_OFF: | 346 | case SND_SOC_BIAS_OFF: |
355 | regcache_cache_only(priv->regmap, true); | ||
356 | gpiod_set_value(priv->pdn_gpio, 1); | ||
357 | |||
358 | if (!IS_ERR(priv->mclk)) | 347 | if (!IS_ERR(priv->mclk)) |
359 | clk_disable_unprepare(priv->mclk); | 348 | clk_disable_unprepare(priv->mclk); |
360 | break; | 349 | break; |
@@ -401,16 +390,6 @@ static const struct snd_kcontrol_new tas5711_controls[] = { | |||
401 | TAS571X_SOFT_MUTE_REG, | 390 | TAS571X_SOFT_MUTE_REG, |
402 | TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, | 391 | TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, |
403 | 1, 1), | 392 | 1, 1), |
404 | |||
405 | SOC_DOUBLE_R_RANGE("CH1 Mixer Volume", | ||
406 | TAS5717_CH1_LEFT_CH_MIX_REG, | ||
407 | TAS5717_CH1_RIGHT_CH_MIX_REG, | ||
408 | 16, 0, 0x80, 0), | ||
409 | |||
410 | SOC_DOUBLE_R_RANGE("CH2 Mixer Volume", | ||
411 | TAS5717_CH2_LEFT_CH_MIX_REG, | ||
412 | TAS5717_CH2_RIGHT_CH_MIX_REG, | ||
413 | 16, 0, 0x80, 0), | ||
414 | }; | 393 | }; |
415 | 394 | ||
416 | static const struct regmap_range tas571x_readonly_regs_range[] = { | 395 | static const struct regmap_range tas571x_readonly_regs_range[] = { |
@@ -488,6 +467,16 @@ static const struct snd_kcontrol_new tas5717_controls[] = { | |||
488 | TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, | 467 | TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, |
489 | 1, 1), | 468 | 1, 1), |
490 | 469 | ||
470 | SOC_DOUBLE_R_RANGE("CH1 Mixer Volume", | ||
471 | TAS5717_CH1_LEFT_CH_MIX_REG, | ||
472 | TAS5717_CH1_RIGHT_CH_MIX_REG, | ||
473 | 16, 0, 0x80, 0), | ||
474 | |||
475 | SOC_DOUBLE_R_RANGE("CH2 Mixer Volume", | ||
476 | TAS5717_CH2_LEFT_CH_MIX_REG, | ||
477 | TAS5717_CH2_RIGHT_CH_MIX_REG, | ||
478 | 16, 0, 0x80, 0), | ||
479 | |||
491 | /* | 480 | /* |
492 | * The biquads are named according to the register names. | 481 | * The biquads are named according to the register names. |
493 | * Please note that TI's TAS57xx Graphical Development Environment | 482 | * Please note that TI's TAS57xx Graphical Development Environment |
@@ -747,13 +736,14 @@ static int tas571x_i2c_probe(struct i2c_client *client, | |||
747 | /* pulse the active low reset line for ~100us */ | 736 | /* pulse the active low reset line for ~100us */ |
748 | usleep_range(100, 200); | 737 | usleep_range(100, 200); |
749 | gpiod_set_value(priv->reset_gpio, 0); | 738 | gpiod_set_value(priv->reset_gpio, 0); |
750 | usleep_range(12000, 20000); | 739 | usleep_range(13500, 20000); |
751 | } | 740 | } |
752 | 741 | ||
753 | ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0); | 742 | ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0); |
754 | if (ret) | 743 | if (ret) |
755 | return ret; | 744 | return ret; |
756 | 745 | ||
746 | usleep_range(50000, 60000); | ||
757 | 747 | ||
758 | memcpy(&priv->codec_driver, &tas571x_codec, sizeof(priv->codec_driver)); | 748 | memcpy(&priv->codec_driver, &tas571x_codec, sizeof(priv->codec_driver)); |
759 | priv->codec_driver.component_driver.controls = priv->chip->controls; | 749 | priv->codec_driver.component_driver.controls = priv->chip->controls; |
@@ -770,9 +760,6 @@ static int tas571x_i2c_probe(struct i2c_client *client, | |||
770 | return ret; | 760 | return ret; |
771 | } | 761 | } |
772 | 762 | ||
773 | regcache_cache_only(priv->regmap, true); | ||
774 | gpiod_set_value(priv->pdn_gpio, 1); | ||
775 | |||
776 | return snd_soc_register_codec(&client->dev, &priv->codec_driver, | 763 | return snd_soc_register_codec(&client->dev, &priv->codec_driver, |
777 | &tas571x_dai, 1); | 764 | &tas571x_dai, 1); |
778 | } | 765 | } |
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 26eb5a0a5575..fd5d1e091038 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig | |||
@@ -47,6 +47,7 @@ config SND_SOC_INTEL_SST_MATCH | |||
47 | 47 | ||
48 | config SND_SOC_INTEL_HASWELL | 48 | config SND_SOC_INTEL_HASWELL |
49 | tristate | 49 | tristate |
50 | select SND_SOC_INTEL_SST_FIRMWARE | ||
50 | 51 | ||
51 | config SND_SOC_INTEL_BAYTRAIL | 52 | config SND_SOC_INTEL_BAYTRAIL |
52 | tristate | 53 | tristate |
@@ -56,7 +57,6 @@ config SND_SOC_INTEL_HASWELL_MACH | |||
56 | depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM | 57 | depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM |
57 | depends on DW_DMAC_CORE | 58 | depends on DW_DMAC_CORE |
58 | select SND_SOC_INTEL_SST | 59 | select SND_SOC_INTEL_SST |
59 | select SND_SOC_INTEL_SST_FIRMWARE | ||
60 | select SND_SOC_INTEL_HASWELL | 60 | select SND_SOC_INTEL_HASWELL |
61 | select SND_SOC_RT5640 | 61 | select SND_SOC_RT5640 |
62 | help | 62 | help |
@@ -138,7 +138,6 @@ config SND_SOC_INTEL_BROADWELL_MACH | |||
138 | I2C_DESIGNWARE_PLATFORM | 138 | I2C_DESIGNWARE_PLATFORM |
139 | depends on DW_DMAC_CORE | 139 | depends on DW_DMAC_CORE |
140 | select SND_SOC_INTEL_SST | 140 | select SND_SOC_INTEL_SST |
141 | select SND_SOC_INTEL_SST_FIRMWARE | ||
142 | select SND_SOC_INTEL_HASWELL | 141 | select SND_SOC_INTEL_HASWELL |
143 | select SND_SOC_RT286 | 142 | select SND_SOC_RT286 |
144 | help | 143 | help |
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c index ba5c0d71720a..0a88537ca58a 100644 --- a/sound/soc/intel/atom/sst/sst_acpi.c +++ b/sound/soc/intel/atom/sst/sst_acpi.c | |||
@@ -416,6 +416,7 @@ static const struct dmi_system_id cht_table[] = { | |||
416 | DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), | 416 | DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), |
417 | }, | 417 | }, |
418 | }, | 418 | }, |
419 | { } | ||
419 | }; | 420 | }; |
420 | 421 | ||
421 | 422 | ||
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 6532b8f0ab2f..865a21e557cc 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c | |||
@@ -130,8 +130,8 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) | |||
130 | */ | 130 | */ |
131 | ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", | 131 | ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", |
132 | SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | | 132 | SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | |
133 | SND_JACK_BTN_2 | SND_JACK_BTN_3, &broxton_headset, | 133 | SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT, |
134 | NULL, 0); | 134 | &broxton_headset, NULL, 0); |
135 | if (ret) { | 135 | if (ret) { |
136 | dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); | 136 | dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); |
137 | return ret; | 137 | return ret; |
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 2989c164dafe..06fa5e85dd0e 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c | |||
@@ -674,7 +674,7 @@ static int skl_probe(struct pci_dev *pci, | |||
674 | 674 | ||
675 | if (skl->nhlt == NULL) { | 675 | if (skl->nhlt == NULL) { |
676 | err = -ENODEV; | 676 | err = -ENODEV; |
677 | goto out_free; | 677 | goto out_display_power_off; |
678 | } | 678 | } |
679 | 679 | ||
680 | skl_nhlt_update_topology_bin(skl); | 680 | skl_nhlt_update_topology_bin(skl); |
@@ -746,6 +746,9 @@ out_mach_free: | |||
746 | skl_machine_device_unregister(skl); | 746 | skl_machine_device_unregister(skl); |
747 | out_nhlt_free: | 747 | out_nhlt_free: |
748 | skl_nhlt_free(skl->nhlt); | 748 | skl_nhlt_free(skl->nhlt); |
749 | out_display_power_off: | ||
750 | if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) | ||
751 | snd_hdac_display_power(bus, false); | ||
749 | out_free: | 752 | out_free: |
750 | skl->init_failed = 1; | 753 | skl->init_failed = 1; |
751 | skl_free(ebus); | 754 | skl_free(ebus); |
@@ -785,8 +788,7 @@ static void skl_remove(struct pci_dev *pci) | |||
785 | 788 | ||
786 | release_firmware(skl->tplg); | 789 | release_firmware(skl->tplg); |
787 | 790 | ||
788 | if (pci_dev_run_wake(pci)) | 791 | pm_runtime_get_noresume(&pci->dev); |
789 | pm_runtime_get_noresume(&pci->dev); | ||
790 | 792 | ||
791 | /* codec removal, invoke bus_device_remove */ | 793 | /* codec removal, invoke bus_device_remove */ |
792 | snd_hdac_ext_bus_device_remove(ebus); | 794 | snd_hdac_ext_bus_device_remove(ebus); |
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index f2bf8661dd21..823b5a236d8d 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -208,7 +208,7 @@ config SND_PXA2XX_SOC_IMOTE2 | |||
208 | 208 | ||
209 | config SND_MMP_SOC_BROWNSTONE | 209 | config SND_MMP_SOC_BROWNSTONE |
210 | tristate "SoC Audio support for Marvell Brownstone" | 210 | tristate "SoC Audio support for Marvell Brownstone" |
211 | depends on SND_MMP_SOC && MACH_BROWNSTONE | 211 | depends on SND_MMP_SOC && MACH_BROWNSTONE && I2C |
212 | select SND_MMP_SOC_SSPA | 212 | select SND_MMP_SOC_SSPA |
213 | select MFD_WM8994 | 213 | select MFD_WM8994 |
214 | select SND_SOC_WM8994 | 214 | select SND_SOC_WM8994 |
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 3cde9fb977fa..eff3f9a8b685 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c | |||
@@ -586,3 +586,6 @@ int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev) | |||
586 | return 0; | 586 | return 0; |
587 | } | 587 | } |
588 | EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove); | 588 | EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove); |
589 | |||
590 | MODULE_DESCRIPTION("QTi LPASS CPU Driver"); | ||
591 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index e2ff538a8aa5..07000f53db44 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c | |||
@@ -61,7 +61,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) | |||
61 | { | 61 | { |
62 | struct snd_pcm_runtime *runtime = substream->runtime; | 62 | struct snd_pcm_runtime *runtime = substream->runtime; |
63 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 63 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
64 | int ret; | 64 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; |
65 | struct lpass_data *drvdata = | ||
66 | snd_soc_platform_get_drvdata(soc_runtime->platform); | ||
67 | struct lpass_variant *v = drvdata->variant; | ||
68 | int ret, dma_ch, dir = substream->stream; | ||
69 | struct lpass_pcm_data *data; | ||
70 | |||
71 | data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL); | ||
72 | if (!data) | ||
73 | return -ENOMEM; | ||
74 | |||
75 | data->i2s_port = cpu_dai->driver->id; | ||
76 | runtime->private_data = data; | ||
77 | |||
78 | if (v->alloc_dma_channel) | ||
79 | dma_ch = v->alloc_dma_channel(drvdata, dir); | ||
80 | if (dma_ch < 0) | ||
81 | return dma_ch; | ||
82 | |||
83 | drvdata->substream[dma_ch] = substream; | ||
84 | |||
85 | ret = regmap_write(drvdata->lpaif_map, | ||
86 | LPAIF_DMACTL_REG(v, dma_ch, dir), 0); | ||
87 | if (ret) { | ||
88 | dev_err(soc_runtime->dev, | ||
89 | "%s() error writing to rdmactl reg: %d\n", | ||
90 | __func__, ret); | ||
91 | return ret; | ||
92 | } | ||
93 | |||
94 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | ||
95 | data->rdma_ch = dma_ch; | ||
96 | else | ||
97 | data->wrdma_ch = dma_ch; | ||
65 | 98 | ||
66 | snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); | 99 | snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); |
67 | 100 | ||
@@ -80,13 +113,40 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) | |||
80 | return 0; | 113 | return 0; |
81 | } | 114 | } |
82 | 115 | ||
116 | static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream) | ||
117 | { | ||
118 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
119 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
120 | struct lpass_data *drvdata = | ||
121 | snd_soc_platform_get_drvdata(soc_runtime->platform); | ||
122 | struct lpass_variant *v = drvdata->variant; | ||
123 | struct lpass_pcm_data *data; | ||
124 | int dma_ch, dir = substream->stream; | ||
125 | |||
126 | data = runtime->private_data; | ||
127 | v = drvdata->variant; | ||
128 | |||
129 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | ||
130 | dma_ch = data->rdma_ch; | ||
131 | else | ||
132 | dma_ch = data->wrdma_ch; | ||
133 | |||
134 | drvdata->substream[dma_ch] = NULL; | ||
135 | |||
136 | if (v->free_dma_channel) | ||
137 | v->free_dma_channel(drvdata, dma_ch); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
83 | static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, | 142 | static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, |
84 | struct snd_pcm_hw_params *params) | 143 | struct snd_pcm_hw_params *params) |
85 | { | 144 | { |
86 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 145 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
87 | struct lpass_data *drvdata = | 146 | struct lpass_data *drvdata = |
88 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 147 | snd_soc_platform_get_drvdata(soc_runtime->platform); |
89 | struct lpass_pcm_data *pcm_data = drvdata->private_data; | 148 | struct snd_pcm_runtime *rt = substream->runtime; |
149 | struct lpass_pcm_data *pcm_data = rt->private_data; | ||
90 | struct lpass_variant *v = drvdata->variant; | 150 | struct lpass_variant *v = drvdata->variant; |
91 | snd_pcm_format_t format = params_format(params); | 151 | snd_pcm_format_t format = params_format(params); |
92 | unsigned int channels = params_channels(params); | 152 | unsigned int channels = params_channels(params); |
@@ -179,7 +239,8 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) | |||
179 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 239 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
180 | struct lpass_data *drvdata = | 240 | struct lpass_data *drvdata = |
181 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 241 | snd_soc_platform_get_drvdata(soc_runtime->platform); |
182 | struct lpass_pcm_data *pcm_data = drvdata->private_data; | 242 | struct snd_pcm_runtime *rt = substream->runtime; |
243 | struct lpass_pcm_data *pcm_data = rt->private_data; | ||
183 | struct lpass_variant *v = drvdata->variant; | 244 | struct lpass_variant *v = drvdata->variant; |
184 | unsigned int reg; | 245 | unsigned int reg; |
185 | int ret; | 246 | int ret; |
@@ -203,7 +264,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream) | |||
203 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 264 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
204 | struct lpass_data *drvdata = | 265 | struct lpass_data *drvdata = |
205 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 266 | snd_soc_platform_get_drvdata(soc_runtime->platform); |
206 | struct lpass_pcm_data *pcm_data = drvdata->private_data; | 267 | struct snd_pcm_runtime *rt = substream->runtime; |
268 | struct lpass_pcm_data *pcm_data = rt->private_data; | ||
207 | struct lpass_variant *v = drvdata->variant; | 269 | struct lpass_variant *v = drvdata->variant; |
208 | int ret, ch, dir = substream->stream; | 270 | int ret, ch, dir = substream->stream; |
209 | 271 | ||
@@ -257,7 +319,8 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream, | |||
257 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 319 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
258 | struct lpass_data *drvdata = | 320 | struct lpass_data *drvdata = |
259 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 321 | snd_soc_platform_get_drvdata(soc_runtime->platform); |
260 | struct lpass_pcm_data *pcm_data = drvdata->private_data; | 322 | struct snd_pcm_runtime *rt = substream->runtime; |
323 | struct lpass_pcm_data *pcm_data = rt->private_data; | ||
261 | struct lpass_variant *v = drvdata->variant; | 324 | struct lpass_variant *v = drvdata->variant; |
262 | int ret, ch, dir = substream->stream; | 325 | int ret, ch, dir = substream->stream; |
263 | 326 | ||
@@ -333,7 +396,8 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer( | |||
333 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 396 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
334 | struct lpass_data *drvdata = | 397 | struct lpass_data *drvdata = |
335 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 398 | snd_soc_platform_get_drvdata(soc_runtime->platform); |
336 | struct lpass_pcm_data *pcm_data = drvdata->private_data; | 399 | struct snd_pcm_runtime *rt = substream->runtime; |
400 | struct lpass_pcm_data *pcm_data = rt->private_data; | ||
337 | struct lpass_variant *v = drvdata->variant; | 401 | struct lpass_variant *v = drvdata->variant; |
338 | unsigned int base_addr, curr_addr; | 402 | unsigned int base_addr, curr_addr; |
339 | int ret, ch, dir = substream->stream; | 403 | int ret, ch, dir = substream->stream; |
@@ -374,6 +438,7 @@ static int lpass_platform_pcmops_mmap(struct snd_pcm_substream *substream, | |||
374 | 438 | ||
375 | static const struct snd_pcm_ops lpass_platform_pcm_ops = { | 439 | static const struct snd_pcm_ops lpass_platform_pcm_ops = { |
376 | .open = lpass_platform_pcmops_open, | 440 | .open = lpass_platform_pcmops_open, |
441 | .close = lpass_platform_pcmops_close, | ||
377 | .ioctl = snd_pcm_lib_ioctl, | 442 | .ioctl = snd_pcm_lib_ioctl, |
378 | .hw_params = lpass_platform_pcmops_hw_params, | 443 | .hw_params = lpass_platform_pcmops_hw_params, |
379 | .hw_free = lpass_platform_pcmops_hw_free, | 444 | .hw_free = lpass_platform_pcmops_hw_free, |
@@ -470,117 +535,45 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) | |||
470 | { | 535 | { |
471 | struct snd_pcm *pcm = soc_runtime->pcm; | 536 | struct snd_pcm *pcm = soc_runtime->pcm; |
472 | struct snd_pcm_substream *psubstream, *csubstream; | 537 | struct snd_pcm_substream *psubstream, *csubstream; |
473 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; | ||
474 | struct lpass_data *drvdata = | ||
475 | snd_soc_platform_get_drvdata(soc_runtime->platform); | ||
476 | struct lpass_variant *v = drvdata->variant; | ||
477 | int ret = -EINVAL; | 538 | int ret = -EINVAL; |
478 | struct lpass_pcm_data *data; | ||
479 | size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; | 539 | size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; |
480 | 540 | ||
481 | data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL); | ||
482 | if (!data) | ||
483 | return -ENOMEM; | ||
484 | |||
485 | data->i2s_port = cpu_dai->driver->id; | ||
486 | drvdata->private_data = data; | ||
487 | |||
488 | psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 541 | psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
489 | if (psubstream) { | 542 | if (psubstream) { |
490 | if (v->alloc_dma_channel) | ||
491 | data->rdma_ch = v->alloc_dma_channel(drvdata, | ||
492 | SNDRV_PCM_STREAM_PLAYBACK); | ||
493 | |||
494 | if (data->rdma_ch < 0) | ||
495 | return data->rdma_ch; | ||
496 | |||
497 | drvdata->substream[data->rdma_ch] = psubstream; | ||
498 | |||
499 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 543 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
500 | soc_runtime->platform->dev, | 544 | soc_runtime->platform->dev, |
501 | size, &psubstream->dma_buffer); | 545 | size, &psubstream->dma_buffer); |
502 | if (ret) | ||
503 | goto playback_alloc_err; | ||
504 | |||
505 | ret = regmap_write(drvdata->lpaif_map, | ||
506 | LPAIF_RDMACTL_REG(v, data->rdma_ch), 0); | ||
507 | if (ret) { | 546 | if (ret) { |
508 | dev_err(soc_runtime->dev, | 547 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); |
509 | "%s() error writing to rdmactl reg: %d\n", | 548 | return ret; |
510 | __func__, ret); | ||
511 | goto capture_alloc_err; | ||
512 | } | 549 | } |
513 | } | 550 | } |
514 | 551 | ||
515 | csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 552 | csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
516 | if (csubstream) { | 553 | if (csubstream) { |
517 | if (v->alloc_dma_channel) | ||
518 | data->wrdma_ch = v->alloc_dma_channel(drvdata, | ||
519 | SNDRV_PCM_STREAM_CAPTURE); | ||
520 | |||
521 | if (data->wrdma_ch < 0) { | ||
522 | ret = data->wrdma_ch; | ||
523 | goto capture_alloc_err; | ||
524 | } | ||
525 | |||
526 | drvdata->substream[data->wrdma_ch] = csubstream; | ||
527 | |||
528 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 554 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
529 | soc_runtime->platform->dev, | 555 | soc_runtime->platform->dev, |
530 | size, &csubstream->dma_buffer); | 556 | size, &csubstream->dma_buffer); |
531 | if (ret) | ||
532 | goto capture_alloc_err; | ||
533 | |||
534 | ret = regmap_write(drvdata->lpaif_map, | ||
535 | LPAIF_WRDMACTL_REG(v, data->wrdma_ch), 0); | ||
536 | if (ret) { | 557 | if (ret) { |
537 | dev_err(soc_runtime->dev, | 558 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); |
538 | "%s() error writing to wrdmactl reg: %d\n", | 559 | if (psubstream) |
539 | __func__, ret); | 560 | snd_dma_free_pages(&psubstream->dma_buffer); |
540 | goto capture_reg_err; | 561 | return ret; |
541 | } | 562 | } |
563 | |||
542 | } | 564 | } |
543 | 565 | ||
544 | return 0; | 566 | return 0; |
545 | |||
546 | capture_reg_err: | ||
547 | if (csubstream) | ||
548 | snd_dma_free_pages(&csubstream->dma_buffer); | ||
549 | |||
550 | capture_alloc_err: | ||
551 | if (psubstream) | ||
552 | snd_dma_free_pages(&psubstream->dma_buffer); | ||
553 | |||
554 | playback_alloc_err: | ||
555 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); | ||
556 | |||
557 | return ret; | ||
558 | } | 567 | } |
559 | 568 | ||
560 | static void lpass_platform_pcm_free(struct snd_pcm *pcm) | 569 | static void lpass_platform_pcm_free(struct snd_pcm *pcm) |
561 | { | 570 | { |
562 | struct snd_soc_pcm_runtime *rt; | ||
563 | struct lpass_data *drvdata; | ||
564 | struct lpass_pcm_data *data; | ||
565 | struct lpass_variant *v; | ||
566 | struct snd_pcm_substream *substream; | 571 | struct snd_pcm_substream *substream; |
567 | int ch, i; | 572 | int i; |
568 | 573 | ||
569 | for (i = 0; i < ARRAY_SIZE(pcm->streams); i++) { | 574 | for (i = 0; i < ARRAY_SIZE(pcm->streams); i++) { |
570 | substream = pcm->streams[i].substream; | 575 | substream = pcm->streams[i].substream; |
571 | if (substream) { | 576 | if (substream) { |
572 | rt = substream->private_data; | ||
573 | drvdata = snd_soc_platform_get_drvdata(rt->platform); | ||
574 | data = drvdata->private_data; | ||
575 | |||
576 | ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
577 | ? data->rdma_ch | ||
578 | : data->wrdma_ch; | ||
579 | v = drvdata->variant; | ||
580 | drvdata->substream[ch] = NULL; | ||
581 | if (v->free_dma_channel) | ||
582 | v->free_dma_channel(drvdata, ch); | ||
583 | |||
584 | snd_dma_free_pages(&substream->dma_buffer); | 577 | snd_dma_free_pages(&substream->dma_buffer); |
585 | substream->dma_buffer.area = NULL; | 578 | substream->dma_buffer.area = NULL; |
586 | substream->dma_buffer.addr = 0; | 579 | substream->dma_buffer.addr = 0; |
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h index 35b3cea8207d..924971b6ded5 100644 --- a/sound/soc/qcom/lpass.h +++ b/sound/soc/qcom/lpass.h | |||
@@ -59,7 +59,6 @@ struct lpass_data { | |||
59 | struct clk *pcnoc_mport_clk; | 59 | struct clk *pcnoc_mport_clk; |
60 | struct clk *pcnoc_sway_clk; | 60 | struct clk *pcnoc_sway_clk; |
61 | 61 | ||
62 | void *private_data; | ||
63 | }; | 62 | }; |
64 | 63 | ||
65 | /* Vairant data per each SOC */ | 64 | /* Vairant data per each SOC */ |
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index 97d6700b1009..cbc0023c2bc8 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c | |||
@@ -383,11 +383,6 @@ static int s3c_ac97_probe(struct platform_device *pdev) | |||
383 | goto err4; | 383 | goto err4; |
384 | } | 384 | } |
385 | 385 | ||
386 | ret = devm_snd_soc_register_component(&pdev->dev, &s3c_ac97_component, | ||
387 | s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | ||
388 | if (ret) | ||
389 | goto err5; | ||
390 | |||
391 | ret = samsung_asoc_dma_platform_register(&pdev->dev, | 386 | ret = samsung_asoc_dma_platform_register(&pdev->dev, |
392 | ac97_pdata->dma_filter, | 387 | ac97_pdata->dma_filter, |
393 | NULL, NULL); | 388 | NULL, NULL); |
@@ -396,6 +391,11 @@ static int s3c_ac97_probe(struct platform_device *pdev) | |||
396 | goto err5; | 391 | goto err5; |
397 | } | 392 | } |
398 | 393 | ||
394 | ret = devm_snd_soc_register_component(&pdev->dev, &s3c_ac97_component, | ||
395 | s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | ||
396 | if (ret) | ||
397 | goto err5; | ||
398 | |||
399 | return 0; | 399 | return 0; |
400 | err5: | 400 | err5: |
401 | free_irq(irq_res->start, NULL); | 401 | free_irq(irq_res->start, NULL); |
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 7e32cf4581f8..7825bff45ae3 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -1237,14 +1237,14 @@ static int samsung_i2s_probe(struct platform_device *pdev) | |||
1237 | dev_err(&pdev->dev, "Unable to get drvdata\n"); | 1237 | dev_err(&pdev->dev, "Unable to get drvdata\n"); |
1238 | return -EFAULT; | 1238 | return -EFAULT; |
1239 | } | 1239 | } |
1240 | ret = devm_snd_soc_register_component(&sec_dai->pdev->dev, | 1240 | ret = samsung_asoc_dma_platform_register(&pdev->dev, |
1241 | &samsung_i2s_component, | 1241 | sec_dai->filter, "tx-sec", NULL); |
1242 | &sec_dai->i2s_dai_drv, 1); | ||
1243 | if (ret != 0) | 1242 | if (ret != 0) |
1244 | return ret; | 1243 | return ret; |
1245 | 1244 | ||
1246 | return samsung_asoc_dma_platform_register(&pdev->dev, | 1245 | return devm_snd_soc_register_component(&sec_dai->pdev->dev, |
1247 | sec_dai->filter, "tx-sec", NULL); | 1246 | &samsung_i2s_component, |
1247 | &sec_dai->i2s_dai_drv, 1); | ||
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | pri_dai = i2s_alloc_dai(pdev, false); | 1250 | pri_dai = i2s_alloc_dai(pdev, false); |
@@ -1314,6 +1314,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) | |||
1314 | if (quirks & QUIRK_PRI_6CHAN) | 1314 | if (quirks & QUIRK_PRI_6CHAN) |
1315 | pri_dai->i2s_dai_drv.playback.channels_max = 6; | 1315 | pri_dai->i2s_dai_drv.playback.channels_max = 6; |
1316 | 1316 | ||
1317 | ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter, | ||
1318 | NULL, NULL); | ||
1319 | if (ret < 0) | ||
1320 | goto err_disable_clk; | ||
1321 | |||
1317 | if (quirks & QUIRK_SEC_DAI) { | 1322 | if (quirks & QUIRK_SEC_DAI) { |
1318 | sec_dai = i2s_alloc_dai(pdev, true); | 1323 | sec_dai = i2s_alloc_dai(pdev, true); |
1319 | if (!sec_dai) { | 1324 | if (!sec_dai) { |
@@ -1353,10 +1358,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) | |||
1353 | if (ret < 0) | 1358 | if (ret < 0) |
1354 | goto err_free_dai; | 1359 | goto err_free_dai; |
1355 | 1360 | ||
1356 | ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter, | ||
1357 | NULL, NULL); | ||
1358 | if (ret < 0) | ||
1359 | goto err_free_dai; | ||
1360 | 1361 | ||
1361 | pm_runtime_enable(&pdev->dev); | 1362 | pm_runtime_enable(&pdev->dev); |
1362 | 1363 | ||
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 43e367a9acc3..c484985812ed 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c | |||
@@ -565,24 +565,25 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev) | |||
565 | pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; | 565 | pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; |
566 | pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; | 566 | pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; |
567 | 567 | ||
568 | ret = samsung_asoc_dma_platform_register(&pdev->dev, filter, | ||
569 | NULL, NULL); | ||
570 | if (ret) { | ||
571 | dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); | ||
572 | goto err5; | ||
573 | } | ||
574 | |||
568 | pm_runtime_enable(&pdev->dev); | 575 | pm_runtime_enable(&pdev->dev); |
569 | 576 | ||
570 | ret = devm_snd_soc_register_component(&pdev->dev, &s3c_pcm_component, | 577 | ret = devm_snd_soc_register_component(&pdev->dev, &s3c_pcm_component, |
571 | &s3c_pcm_dai[pdev->id], 1); | 578 | &s3c_pcm_dai[pdev->id], 1); |
572 | if (ret != 0) { | 579 | if (ret != 0) { |
573 | dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); | 580 | dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); |
574 | goto err5; | 581 | goto err6; |
575 | } | ||
576 | |||
577 | ret = samsung_asoc_dma_platform_register(&pdev->dev, filter, | ||
578 | NULL, NULL); | ||
579 | if (ret) { | ||
580 | dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); | ||
581 | goto err5; | ||
582 | } | 582 | } |
583 | 583 | ||
584 | return 0; | 584 | return 0; |
585 | 585 | err6: | |
586 | pm_runtime_disable(&pdev->dev); | ||
586 | err5: | 587 | err5: |
587 | clk_disable_unprepare(pcm->pclk); | 588 | clk_disable_unprepare(pcm->pclk); |
588 | err4: | 589 | err4: |
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 3e89fbc0c51d..0a4718207e6e 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c | |||
@@ -168,19 +168,19 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev) | |||
168 | s3c2412_i2s_pcm_stereo_in.addr = res->start + S3C2412_IISRXD; | 168 | s3c2412_i2s_pcm_stereo_in.addr = res->start + S3C2412_IISRXD; |
169 | s3c2412_i2s_pcm_stereo_in.filter_data = pdata->dma_capture; | 169 | s3c2412_i2s_pcm_stereo_in.filter_data = pdata->dma_capture; |
170 | 170 | ||
171 | ret = s3c_i2sv2_register_component(&pdev->dev, -1, | 171 | ret = samsung_asoc_dma_platform_register(&pdev->dev, |
172 | &s3c2412_i2s_component, | 172 | pdata->dma_filter, |
173 | &s3c2412_i2s_dai); | 173 | NULL, NULL); |
174 | if (ret) { | 174 | if (ret) { |
175 | pr_err("failed to register the dai\n"); | 175 | pr_err("failed to register the DMA: %d\n", ret); |
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
178 | 178 | ||
179 | ret = samsung_asoc_dma_platform_register(&pdev->dev, | 179 | ret = s3c_i2sv2_register_component(&pdev->dev, -1, |
180 | pdata->dma_filter, | 180 | &s3c2412_i2s_component, |
181 | NULL, NULL); | 181 | &s3c2412_i2s_dai); |
182 | if (ret) | 182 | if (ret) |
183 | pr_err("failed to register the DMA: %d\n", ret); | 183 | pr_err("failed to register the dai\n"); |
184 | 184 | ||
185 | return ret; | 185 | return ret; |
186 | } | 186 | } |
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index c78a936a3099..9052f6a7073e 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c | |||
@@ -474,18 +474,18 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev) | |||
474 | s3c24xx_i2s_pcm_stereo_in.addr = res->start + S3C2410_IISFIFO; | 474 | s3c24xx_i2s_pcm_stereo_in.addr = res->start + S3C2410_IISFIFO; |
475 | s3c24xx_i2s_pcm_stereo_in.filter_data = pdata->dma_capture; | 475 | s3c24xx_i2s_pcm_stereo_in.filter_data = pdata->dma_capture; |
476 | 476 | ||
477 | ret = devm_snd_soc_register_component(&pdev->dev, | 477 | ret = samsung_asoc_dma_platform_register(&pdev->dev, |
478 | &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1); | 478 | pdata->dma_filter, |
479 | NULL, NULL); | ||
479 | if (ret) { | 480 | if (ret) { |
480 | pr_err("failed to register the dai\n"); | 481 | pr_err("failed to register the dma: %d\n", ret); |
481 | return ret; | 482 | return ret; |
482 | } | 483 | } |
483 | 484 | ||
484 | ret = samsung_asoc_dma_platform_register(&pdev->dev, | 485 | ret = devm_snd_soc_register_component(&pdev->dev, |
485 | pdata->dma_filter, | 486 | &s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1); |
486 | NULL, NULL); | ||
487 | if (ret) | 487 | if (ret) |
488 | pr_err("failed to register the dma: %d\n", ret); | 488 | pr_err("failed to register the dai\n"); |
489 | 489 | ||
490 | return ret; | 490 | return ret; |
491 | } | 491 | } |
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c index 26c1fbed4d35..779504f54bc0 100644 --- a/sound/soc/samsung/spdif.c +++ b/sound/soc/samsung/spdif.c | |||
@@ -416,15 +416,6 @@ static int spdif_probe(struct platform_device *pdev) | |||
416 | goto err3; | 416 | goto err3; |
417 | } | 417 | } |
418 | 418 | ||
419 | dev_set_drvdata(&pdev->dev, spdif); | ||
420 | |||
421 | ret = devm_snd_soc_register_component(&pdev->dev, | ||
422 | &samsung_spdif_component, &samsung_spdif_dai, 1); | ||
423 | if (ret != 0) { | ||
424 | dev_err(&pdev->dev, "fail to register dai\n"); | ||
425 | goto err4; | ||
426 | } | ||
427 | |||
428 | spdif_stereo_out.addr_width = 2; | 419 | spdif_stereo_out.addr_width = 2; |
429 | spdif_stereo_out.addr = mem_res->start + DATA_OUTBUF; | 420 | spdif_stereo_out.addr = mem_res->start + DATA_OUTBUF; |
430 | filter = NULL; | 421 | filter = NULL; |
@@ -432,7 +423,6 @@ static int spdif_probe(struct platform_device *pdev) | |||
432 | spdif_stereo_out.filter_data = spdif_pdata->dma_playback; | 423 | spdif_stereo_out.filter_data = spdif_pdata->dma_playback; |
433 | filter = spdif_pdata->dma_filter; | 424 | filter = spdif_pdata->dma_filter; |
434 | } | 425 | } |
435 | |||
436 | spdif->dma_playback = &spdif_stereo_out; | 426 | spdif->dma_playback = &spdif_stereo_out; |
437 | 427 | ||
438 | ret = samsung_asoc_dma_platform_register(&pdev->dev, filter, | 428 | ret = samsung_asoc_dma_platform_register(&pdev->dev, filter, |
@@ -442,6 +432,15 @@ static int spdif_probe(struct platform_device *pdev) | |||
442 | goto err4; | 432 | goto err4; |
443 | } | 433 | } |
444 | 434 | ||
435 | dev_set_drvdata(&pdev->dev, spdif); | ||
436 | |||
437 | ret = devm_snd_soc_register_component(&pdev->dev, | ||
438 | &samsung_spdif_component, &samsung_spdif_dai, 1); | ||
439 | if (ret != 0) { | ||
440 | dev_err(&pdev->dev, "fail to register dai\n"); | ||
441 | goto err4; | ||
442 | } | ||
443 | |||
445 | return 0; | 444 | return 0; |
446 | err4: | 445 | err4: |
447 | iounmap(spdif->regs); | 446 | iounmap(spdif->regs); |
diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c index 1bc8ebc2528e..ad54d4cf58ad 100644 --- a/sound/soc/sti/uniperif_player.c +++ b/sound/soc/sti/uniperif_player.c | |||
@@ -614,7 +614,11 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, | |||
614 | iec958->status[3] = ucontrol->value.iec958.status[3]; | 614 | iec958->status[3] = ucontrol->value.iec958.status[3]; |
615 | mutex_unlock(&player->ctrl_lock); | 615 | mutex_unlock(&player->ctrl_lock); |
616 | 616 | ||
617 | uni_player_set_channel_status(player, NULL); | 617 | if (player->substream && player->substream->runtime) |
618 | uni_player_set_channel_status(player, | ||
619 | player->substream->runtime); | ||
620 | else | ||
621 | uni_player_set_channel_status(player, NULL); | ||
618 | 622 | ||
619 | return 0; | 623 | return 0; |
620 | } | 624 | } |
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index e047ec06d538..56ed9472e89f 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c | |||
@@ -765,11 +765,11 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev) | |||
765 | 765 | ||
766 | card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); | 766 | card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); |
767 | if (!card) | 767 | if (!card) |
768 | return NULL; | 768 | return ERR_PTR(-ENOMEM); |
769 | 769 | ||
770 | card->dai_link = sun4i_codec_create_link(dev, &card->num_links); | 770 | card->dai_link = sun4i_codec_create_link(dev, &card->num_links); |
771 | if (!card->dai_link) | 771 | if (!card->dai_link) |
772 | return NULL; | 772 | return ERR_PTR(-ENOMEM); |
773 | 773 | ||
774 | card->dev = dev; | 774 | card->dev = dev; |
775 | card->name = "sun4i-codec"; | 775 | card->name = "sun4i-codec"; |
@@ -829,12 +829,6 @@ static int sun4i_codec_probe(struct platform_device *pdev) | |||
829 | return PTR_ERR(scodec->clk_module); | 829 | return PTR_ERR(scodec->clk_module); |
830 | } | 830 | } |
831 | 831 | ||
832 | /* Enable the bus clock */ | ||
833 | if (clk_prepare_enable(scodec->clk_apb)) { | ||
834 | dev_err(&pdev->dev, "Failed to enable the APB clock\n"); | ||
835 | return -EINVAL; | ||
836 | } | ||
837 | |||
838 | scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa", | 832 | scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa", |
839 | GPIOD_OUT_LOW); | 833 | GPIOD_OUT_LOW); |
840 | if (IS_ERR(scodec->gpio_pa)) { | 834 | if (IS_ERR(scodec->gpio_pa)) { |
@@ -844,6 +838,12 @@ static int sun4i_codec_probe(struct platform_device *pdev) | |||
844 | return ret; | 838 | return ret; |
845 | } | 839 | } |
846 | 840 | ||
841 | /* Enable the bus clock */ | ||
842 | if (clk_prepare_enable(scodec->clk_apb)) { | ||
843 | dev_err(&pdev->dev, "Failed to enable the APB clock\n"); | ||
844 | return -EINVAL; | ||
845 | } | ||
846 | |||
847 | /* DMA configuration for TX FIFO */ | 847 | /* DMA configuration for TX FIFO */ |
848 | scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA; | 848 | scodec->playback_dma_data.addr = res->start + SUN4I_CODEC_DAC_TXDATA; |
849 | scodec->playback_dma_data.maxburst = 4; | 849 | scodec->playback_dma_data.maxburst = 4; |
@@ -876,7 +876,8 @@ static int sun4i_codec_probe(struct platform_device *pdev) | |||
876 | } | 876 | } |
877 | 877 | ||
878 | card = sun4i_codec_create_card(&pdev->dev); | 878 | card = sun4i_codec_create_card(&pdev->dev); |
879 | if (!card) { | 879 | if (IS_ERR(card)) { |
880 | ret = PTR_ERR(card); | ||
880 | dev_err(&pdev->dev, "Failed to create our card\n"); | 881 | dev_err(&pdev->dev, "Failed to create our card\n"); |
881 | goto err_unregister_codec; | 882 | goto err_unregister_codec; |
882 | } | 883 | } |
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index b4bf76971dc9..1eef0aed6423 100644 --- a/tools/power/cpupower/utils/cpufreq-set.c +++ b/tools/power/cpupower/utils/cpufreq-set.c | |||
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv) | |||
296 | struct cpufreq_affected_cpus *cpus; | 296 | struct cpufreq_affected_cpus *cpus; |
297 | 297 | ||
298 | if (!bitmask_isbitset(cpus_chosen, cpu) || | 298 | if (!bitmask_isbitset(cpus_chosen, cpu) || |
299 | cpupower_is_cpu_online(cpu)) | 299 | cpupower_is_cpu_online(cpu) != 1) |
300 | continue; | 300 | continue; |
301 | 301 | ||
302 | cpus = cpufreq_get_related_cpus(cpu); | 302 | cpus = cpufreq_get_related_cpus(cpu); |
@@ -316,10 +316,7 @@ int cmd_freq_set(int argc, char **argv) | |||
316 | cpu <= bitmask_last(cpus_chosen); cpu++) { | 316 | cpu <= bitmask_last(cpus_chosen); cpu++) { |
317 | 317 | ||
318 | if (!bitmask_isbitset(cpus_chosen, cpu) || | 318 | if (!bitmask_isbitset(cpus_chosen, cpu) || |
319 | cpupower_is_cpu_online(cpu)) | 319 | cpupower_is_cpu_online(cpu) != 1) |
320 | continue; | ||
321 | |||
322 | if (cpupower_is_cpu_online(cpu) != 1) | ||
323 | continue; | 320 | continue; |
324 | 321 | ||
325 | printf(_("Setting cpu: %d\n"), cpu); | 322 | printf(_("Setting cpu: %d\n"), cpu); |
diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c index e18b30ddcdce..ebe1b9fa3c4d 100644 --- a/virt/kvm/arm/vgic/vgic-mmio.c +++ b/virt/kvm/arm/vgic/vgic-mmio.c | |||
@@ -453,17 +453,33 @@ struct vgic_io_device *kvm_to_vgic_iodev(const struct kvm_io_device *dev) | |||
453 | return container_of(dev, struct vgic_io_device, dev); | 453 | return container_of(dev, struct vgic_io_device, dev); |
454 | } | 454 | } |
455 | 455 | ||
456 | static bool check_region(const struct vgic_register_region *region, | 456 | static bool check_region(const struct kvm *kvm, |
457 | const struct vgic_register_region *region, | ||
457 | gpa_t addr, int len) | 458 | gpa_t addr, int len) |
458 | { | 459 | { |
459 | if ((region->access_flags & VGIC_ACCESS_8bit) && len == 1) | 460 | int flags, nr_irqs = kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS; |
460 | return true; | 461 | |
461 | if ((region->access_flags & VGIC_ACCESS_32bit) && | 462 | switch (len) { |
462 | len == sizeof(u32) && !(addr & 3)) | 463 | case sizeof(u8): |
463 | return true; | 464 | flags = VGIC_ACCESS_8bit; |
464 | if ((region->access_flags & VGIC_ACCESS_64bit) && | 465 | break; |
465 | len == sizeof(u64) && !(addr & 7)) | 466 | case sizeof(u32): |
466 | return true; | 467 | flags = VGIC_ACCESS_32bit; |
468 | break; | ||
469 | case sizeof(u64): | ||
470 | flags = VGIC_ACCESS_64bit; | ||
471 | break; | ||
472 | default: | ||
473 | return false; | ||
474 | } | ||
475 | |||
476 | if ((region->access_flags & flags) && IS_ALIGNED(addr, len)) { | ||
477 | if (!region->bits_per_irq) | ||
478 | return true; | ||
479 | |||
480 | /* Do we access a non-allocated IRQ? */ | ||
481 | return VGIC_ADDR_TO_INTID(addr, region->bits_per_irq) < nr_irqs; | ||
482 | } | ||
467 | 483 | ||
468 | return false; | 484 | return false; |
469 | } | 485 | } |
@@ -477,7 +493,7 @@ static int dispatch_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev, | |||
477 | 493 | ||
478 | region = vgic_find_mmio_region(iodev->regions, iodev->nr_regions, | 494 | region = vgic_find_mmio_region(iodev->regions, iodev->nr_regions, |
479 | addr - iodev->base_addr); | 495 | addr - iodev->base_addr); |
480 | if (!region || !check_region(region, addr, len)) { | 496 | if (!region || !check_region(vcpu->kvm, region, addr, len)) { |
481 | memset(val, 0, len); | 497 | memset(val, 0, len); |
482 | return 0; | 498 | return 0; |
483 | } | 499 | } |
@@ -510,10 +526,7 @@ static int dispatch_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev, | |||
510 | 526 | ||
511 | region = vgic_find_mmio_region(iodev->regions, iodev->nr_regions, | 527 | region = vgic_find_mmio_region(iodev->regions, iodev->nr_regions, |
512 | addr - iodev->base_addr); | 528 | addr - iodev->base_addr); |
513 | if (!region) | 529 | if (!region || !check_region(vcpu->kvm, region, addr, len)) |
514 | return 0; | ||
515 | |||
516 | if (!check_region(region, addr, len)) | ||
517 | return 0; | 530 | return 0; |
518 | 531 | ||
519 | switch (iodev->iodev_type) { | 532 | switch (iodev->iodev_type) { |
diff --git a/virt/kvm/arm/vgic/vgic-mmio.h b/virt/kvm/arm/vgic/vgic-mmio.h index 4c34d39d44a0..84961b4e4422 100644 --- a/virt/kvm/arm/vgic/vgic-mmio.h +++ b/virt/kvm/arm/vgic/vgic-mmio.h | |||
@@ -50,15 +50,15 @@ extern struct kvm_io_device_ops kvm_io_gic_ops; | |||
50 | #define VGIC_ADDR_IRQ_MASK(bits) (((bits) * 1024 / 8) - 1) | 50 | #define VGIC_ADDR_IRQ_MASK(bits) (((bits) * 1024 / 8) - 1) |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * (addr & mask) gives us the byte offset for the INT ID, so we want to | 53 | * (addr & mask) gives us the _byte_ offset for the INT ID. |
54 | * divide this with 'bytes per irq' to get the INT ID, which is given | 54 | * We multiply this by 8 the get the _bit_ offset, then divide this by |
55 | * by '(bits) / 8'. But we do this with fixed-point-arithmetic and | 55 | * the number of bits to learn the actual INT ID. |
56 | * take advantage of the fact that division by a fraction equals | 56 | * But instead of a division (which requires a "long long div" implementation), |
57 | * multiplication with the inverted fraction, and scale up both the | 57 | * we shift by the binary logarithm of <bits>. |
58 | * numerator and denominator with 8 to support at most 64 bits per IRQ: | 58 | * This assumes that <bits> is a power of two. |
59 | */ | 59 | */ |
60 | #define VGIC_ADDR_TO_INTID(addr, bits) (((addr) & VGIC_ADDR_IRQ_MASK(bits)) * \ | 60 | #define VGIC_ADDR_TO_INTID(addr, bits) (((addr) & VGIC_ADDR_IRQ_MASK(bits)) * \ |
61 | 64 / (bits) / 8) | 61 | 8 >> ilog2(bits)) |
62 | 62 | ||
63 | /* | 63 | /* |
64 | * Some VGIC registers store per-IRQ information, with a different number | 64 | * Some VGIC registers store per-IRQ information, with a different number |
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 2893d5ba523a..6440b56ec90e 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c | |||
@@ -273,6 +273,18 @@ retry: | |||
273 | * no more work for us to do. | 273 | * no more work for us to do. |
274 | */ | 274 | */ |
275 | spin_unlock(&irq->irq_lock); | 275 | spin_unlock(&irq->irq_lock); |
276 | |||
277 | /* | ||
278 | * We have to kick the VCPU here, because we could be | ||
279 | * queueing an edge-triggered interrupt for which we | ||
280 | * get no EOI maintenance interrupt. In that case, | ||
281 | * while the IRQ is already on the VCPU's AP list, the | ||
282 | * VCPU could have EOI'ed the original interrupt and | ||
283 | * won't see this one until it exits for some other | ||
284 | * reason. | ||
285 | */ | ||
286 | if (vcpu) | ||
287 | kvm_vcpu_kick(vcpu); | ||
276 | return false; | 288 | return false; |
277 | } | 289 | } |
278 | 290 | ||