diff options
85 files changed, 1442 insertions, 325 deletions
diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt index 1486497a24c1..ce6a1a072028 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt | |||
@@ -4,11 +4,13 @@ Specifying interrupt information for devices | |||
4 | 1) Interrupt client nodes | 4 | 1) Interrupt client nodes |
5 | ------------------------- | 5 | ------------------------- |
6 | 6 | ||
7 | Nodes that describe devices which generate interrupts must contain an either an | 7 | Nodes that describe devices which generate interrupts must contain an |
8 | "interrupts" property or an "interrupts-extended" property. These properties | 8 | "interrupts" property, an "interrupts-extended" property, or both. If both are |
9 | contain a list of interrupt specifiers, one per output interrupt. The format of | 9 | present, the latter should take precedence; the former may be provided simply |
10 | the interrupt specifier is determined by the interrupt controller to which the | 10 | for compatibility with software that does not recognize the latter. These |
11 | interrupts are routed; see section 2 below for details. | 11 | properties contain a list of interrupt specifiers, one per output interrupt. The |
12 | format of the interrupt specifier is determined by the interrupt controller to | ||
13 | which the interrupts are routed; see section 2 below for details. | ||
12 | 14 | ||
13 | Example: | 15 | Example: |
14 | interrupt-parent = <&intc1>; | 16 | interrupt-parent = <&intc1>; |
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt index d0d15ee42834..ed0d9b9fff2b 100644 --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt | |||
@@ -2,6 +2,10 @@ | |||
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: should contain "snps,dw-pcie" to identify the core. | 4 | - compatible: should contain "snps,dw-pcie" to identify the core. |
5 | - reg: Should contain the configuration address space. | ||
6 | - reg-names: Must be "config" for the PCIe configuration space. | ||
7 | (The old way of getting the configuration address space from "ranges" | ||
8 | is deprecated and should be avoided.) | ||
5 | - #address-cells: set to <3> | 9 | - #address-cells: set to <3> |
6 | - #size-cells: set to <2> | 10 | - #size-cells: set to <2> |
7 | - device_type: set to "pci" | 11 | - device_type: set to "pci" |
diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt new file mode 100644 index 000000000000..3d217911b313 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/ti-pci.txt | |||
@@ -0,0 +1,59 @@ | |||
1 | TI PCI Controllers | ||
2 | |||
3 | PCIe Designware Controller | ||
4 | - compatible: Should be "ti,dra7-pcie"" | ||
5 | - reg : Two register ranges as listed in the reg-names property | ||
6 | - reg-names : The first entry must be "ti-conf" for the TI specific registers | ||
7 | The second entry must be "rc-dbics" for the designware pcie | ||
8 | registers | ||
9 | The third entry must be "config" for the PCIe configuration space | ||
10 | - phys : list of PHY specifiers (used by generic PHY framework) | ||
11 | - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the | ||
12 | number of PHYs as specified in *phys* property. | ||
13 | - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", | ||
14 | where <X> is the instance number of the pcie from the HW spec. | ||
15 | - interrupts : Two interrupt entries must be specified. The first one is for | ||
16 | main interrupt line and the second for MSI interrupt line. | ||
17 | - #address-cells, | ||
18 | #size-cells, | ||
19 | #interrupt-cells, | ||
20 | device_type, | ||
21 | ranges, | ||
22 | num-lanes, | ||
23 | interrupt-map-mask, | ||
24 | interrupt-map : as specified in ../designware-pcie.txt | ||
25 | |||
26 | Example: | ||
27 | axi { | ||
28 | compatible = "simple-bus"; | ||
29 | #size-cells = <1>; | ||
30 | #address-cells = <1>; | ||
31 | ranges = <0x51000000 0x51000000 0x3000 | ||
32 | 0x0 0x20000000 0x10000000>; | ||
33 | pcie@51000000 { | ||
34 | compatible = "ti,dra7-pcie"; | ||
35 | reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; | ||
36 | reg-names = "rc_dbics", "ti_conf", "config"; | ||
37 | interrupts = <0 232 0x4>, <0 233 0x4>; | ||
38 | #address-cells = <3>; | ||
39 | #size-cells = <2>; | ||
40 | device_type = "pci"; | ||
41 | ranges = <0x81000000 0 0 0x03000 0 0x00010000 | ||
42 | 0x82000000 0 0x20013000 0x13000 0 0xffed000>; | ||
43 | #interrupt-cells = <1>; | ||
44 | num-lanes = <1>; | ||
45 | ti,hwmods = "pcie1"; | ||
46 | phys = <&pcie1_phy>; | ||
47 | phy-names = "pcie-phy0"; | ||
48 | interrupt-map-mask = <0 0 0 7>; | ||
49 | interrupt-map = <0 0 0 1 &pcie_intc 1>, | ||
50 | <0 0 0 2 &pcie_intc 2>, | ||
51 | <0 0 0 3 &pcie_intc 3>, | ||
52 | <0 0 0 4 &pcie_intc 4>; | ||
53 | pcie_intc: interrupt-controller { | ||
54 | interrupt-controller; | ||
55 | #address-cells = <0>; | ||
56 | #interrupt-cells = <1>; | ||
57 | }; | ||
58 | }; | ||
59 | }; | ||
diff --git a/MAINTAINERS b/MAINTAINERS index aefa94841ff3..a3e0d10e386e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3843,10 +3843,13 @@ F: drivers/tty/serial/ucc_uart.c | |||
3843 | 3843 | ||
3844 | FREESCALE SOC SOUND DRIVERS | 3844 | FREESCALE SOC SOUND DRIVERS |
3845 | M: Timur Tabi <timur@tabi.org> | 3845 | M: Timur Tabi <timur@tabi.org> |
3846 | M: Nicolin Chen <nicoleotsuka@gmail.com> | ||
3847 | M: Xiubo Li <Li.Xiubo@freescale.com> | ||
3846 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 3848 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
3847 | L: linuxppc-dev@lists.ozlabs.org | 3849 | L: linuxppc-dev@lists.ozlabs.org |
3848 | S: Maintained | 3850 | S: Maintained |
3849 | F: sound/soc/fsl/fsl* | 3851 | F: sound/soc/fsl/fsl* |
3852 | F: sound/soc/fsl/imx* | ||
3850 | F: sound/soc/fsl/mpc8610_hpcd.c | 3853 | F: sound/soc/fsl/mpc8610_hpcd.c |
3851 | 3854 | ||
3852 | FREEVXFS FILESYSTEM | 3855 | FREEVXFS FILESYSTEM |
@@ -4446,6 +4449,13 @@ F: include/linux/i2c-*.h | |||
4446 | F: include/uapi/linux/i2c.h | 4449 | F: include/uapi/linux/i2c.h |
4447 | F: include/uapi/linux/i2c-*.h | 4450 | F: include/uapi/linux/i2c-*.h |
4448 | 4451 | ||
4452 | I2C ACPI SUPPORT | ||
4453 | M: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
4454 | L: linux-i2c@vger.kernel.org | ||
4455 | L: linux-acpi@vger.kernel.org | ||
4456 | S: Maintained | ||
4457 | F: drivers/i2c/i2c-acpi.c | ||
4458 | |||
4449 | I2C-TAOS-EVM DRIVER | 4459 | I2C-TAOS-EVM DRIVER |
4450 | M: Jean Delvare <jdelvare@suse.de> | 4460 | M: Jean Delvare <jdelvare@suse.de> |
4451 | L: linux-i2c@vger.kernel.org | 4461 | L: linux-i2c@vger.kernel.org |
@@ -6858,6 +6868,14 @@ S: Supported | |||
6858 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | 6868 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt |
6859 | F: drivers/pci/host/pci-tegra.c | 6869 | F: drivers/pci/host/pci-tegra.c |
6860 | 6870 | ||
6871 | PCI DRIVER FOR TI DRA7XX | ||
6872 | M: Kishon Vijay Abraham I <kishon@ti.com> | ||
6873 | L: linux-omap@vger.kernel.org | ||
6874 | L: linux-pci@vger.kernel.org | ||
6875 | S: Supported | ||
6876 | F: Documentation/devicetree/bindings/pci/ti-pci.txt | ||
6877 | F: drivers/pci/host/pci-dra7xx.c | ||
6878 | |||
6861 | PCI DRIVER FOR RENESAS R-CAR | 6879 | PCI DRIVER FOR RENESAS R-CAR |
6862 | M: Simon Horman <horms@verge.net.au> | 6880 | M: Simon Horman <horms@verge.net.au> |
6863 | L: linux-pci@vger.kernel.org | 6881 | L: linux-pci@vger.kernel.org |
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h index a34f309e5801..6554e78893f2 100644 --- a/arch/frv/include/asm/processor.h +++ b/arch/frv/include/asm/processor.h | |||
@@ -129,7 +129,8 @@ unsigned long get_wchan(struct task_struct *p); | |||
129 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) | 129 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) |
130 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) | 130 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) |
131 | 131 | ||
132 | #define cpu_relax() barrier() | 132 | #define cpu_relax() barrier() |
133 | #define cpu_relax_lowlatency() cpu_relax() | ||
133 | 134 | ||
134 | /* data cache prefetch */ | 135 | /* data cache prefetch */ |
135 | #define ARCH_HAS_PREFETCH | 136 | #define ARCH_HAS_PREFETCH |
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index 4254f5d3218c..10a14ead70b9 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | 13 | ||
14 | #define NR_syscalls 316 /* length of syscall table */ | 14 | #define NR_syscalls 317 /* length of syscall table */ |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * The following defines stop scripts/checksyscalls.sh from complaining about | 17 | * The following defines stop scripts/checksyscalls.sh from complaining about |
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h index 99801c3be914..6a65bb7d0657 100644 --- a/arch/ia64/include/uapi/asm/unistd.h +++ b/arch/ia64/include/uapi/asm/unistd.h | |||
@@ -329,5 +329,6 @@ | |||
329 | #define __NR_sched_getattr 1337 | 329 | #define __NR_sched_getattr 1337 |
330 | #define __NR_renameat2 1338 | 330 | #define __NR_renameat2 1338 |
331 | #define __NR_getrandom 1339 | 331 | #define __NR_getrandom 1339 |
332 | #define __NR_memfd_create 1339 | ||
332 | 333 | ||
333 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ | 334 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 4c13837a9269..01edf242eb29 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1777,6 +1777,7 @@ sys_call_table: | |||
1777 | data8 sys_sched_getattr | 1777 | data8 sys_sched_getattr |
1778 | data8 sys_renameat2 | 1778 | data8 sys_renameat2 |
1779 | data8 sys_getrandom | 1779 | data8 sys_getrandom |
1780 | data8 sys_memfd_create // 1340 | ||
1780 | 1781 | ||
1781 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1782 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
1782 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ | 1783 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ |
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h index 4e1ddc930a68..1c2380bf8fe6 100644 --- a/arch/microblaze/include/uapi/asm/unistd.h +++ b/arch/microblaze/include/uapi/asm/unistd.h | |||
@@ -399,5 +399,8 @@ | |||
399 | #define __NR_sched_setattr 381 | 399 | #define __NR_sched_setattr 381 |
400 | #define __NR_sched_getattr 382 | 400 | #define __NR_sched_getattr 382 |
401 | #define __NR_renameat2 383 | 401 | #define __NR_renameat2 383 |
402 | #define __NR_seccomp 384 | ||
403 | #define __NR_getrandom 385 | ||
404 | #define __NR_memfd_create 386 | ||
402 | 405 | ||
403 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ | 406 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 1a23d5d5480c..de59ee1d7010 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -384,3 +384,6 @@ ENTRY(sys_call_table) | |||
384 | .long sys_sched_setattr | 384 | .long sys_sched_setattr |
385 | .long sys_sched_getattr | 385 | .long sys_sched_getattr |
386 | .long sys_renameat2 | 386 | .long sys_renameat2 |
387 | .long sys_seccomp | ||
388 | .long sys_getrandom /* 385 */ | ||
389 | .long sys_memfd_create | ||
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index 329d7fdd0a6a..b9615ba5b083 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c | |||
@@ -101,7 +101,7 @@ struct kvm_rma_info *kvm_alloc_rma() | |||
101 | ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); | 101 | ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); |
102 | if (!ri) | 102 | if (!ri) |
103 | return NULL; | 103 | return NULL; |
104 | page = cma_alloc(kvm_cma, kvm_rma_pages, get_order(kvm_rma_pages)); | 104 | page = cma_alloc(kvm_cma, kvm_rma_pages, order_base_2(kvm_rma_pages)); |
105 | if (!page) | 105 | if (!page) |
106 | goto err_out; | 106 | goto err_out; |
107 | atomic_set(&ri->use_count, 1); | 107 | atomic_set(&ri->use_count, 1); |
@@ -135,12 +135,12 @@ struct page *kvm_alloc_hpt(unsigned long nr_pages) | |||
135 | { | 135 | { |
136 | unsigned long align_pages = HPT_ALIGN_PAGES; | 136 | unsigned long align_pages = HPT_ALIGN_PAGES; |
137 | 137 | ||
138 | VM_BUG_ON(get_order(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT); | 138 | VM_BUG_ON(order_base_2(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT); |
139 | 139 | ||
140 | /* Old CPUs require HPT aligned on a multiple of its size */ | 140 | /* Old CPUs require HPT aligned on a multiple of its size */ |
141 | if (!cpu_has_feature(CPU_FTR_ARCH_206)) | 141 | if (!cpu_has_feature(CPU_FTR_ARCH_206)) |
142 | align_pages = nr_pages; | 142 | align_pages = nr_pages; |
143 | return cma_alloc(kvm_cma, nr_pages, get_order(align_pages)); | 143 | return cma_alloc(kvm_cma, nr_pages, order_base_2(align_pages)); |
144 | } | 144 | } |
145 | EXPORT_SYMBOL_GPL(kvm_alloc_hpt); | 145 | EXPORT_SYMBOL_GPL(kvm_alloc_hpt); |
146 | 146 | ||
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 572460175ba5..7c492ed9087b 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) | |||
95 | #define KVM_REFILL_PAGES 25 | 95 | #define KVM_REFILL_PAGES 25 |
96 | #define KVM_MAX_CPUID_ENTRIES 80 | 96 | #define KVM_MAX_CPUID_ENTRIES 80 |
97 | #define KVM_NR_FIXED_MTRR_REGION 88 | 97 | #define KVM_NR_FIXED_MTRR_REGION 88 |
98 | #define KVM_NR_VAR_MTRR 10 | 98 | #define KVM_NR_VAR_MTRR 8 |
99 | 99 | ||
100 | #define ASYNC_PF_PER_VCPU 64 | 100 | #define ASYNC_PF_PER_VCPU 64 |
101 | 101 | ||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 56657b0bb3bb..03954f7900f5 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1491,9 +1491,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, | |||
1491 | goto exception; | 1491 | goto exception; |
1492 | break; | 1492 | break; |
1493 | case VCPU_SREG_CS: | 1493 | case VCPU_SREG_CS: |
1494 | if (in_task_switch && rpl != dpl) | ||
1495 | goto exception; | ||
1496 | |||
1497 | if (!(seg_desc.type & 8)) | 1494 | if (!(seg_desc.type & 8)) |
1498 | goto exception; | 1495 | goto exception; |
1499 | 1496 | ||
@@ -4394,8 +4391,11 @@ done_prefixes: | |||
4394 | 4391 | ||
4395 | ctxt->execute = opcode.u.execute; | 4392 | ctxt->execute = opcode.u.execute; |
4396 | 4393 | ||
4394 | if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD))) | ||
4395 | return EMULATION_FAILED; | ||
4396 | |||
4397 | if (unlikely(ctxt->d & | 4397 | if (unlikely(ctxt->d & |
4398 | (NotImpl|EmulateOnUD|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) { | 4398 | (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) { |
4399 | /* | 4399 | /* |
4400 | * These are copied unconditionally here, and checked unconditionally | 4400 | * These are copied unconditionally here, and checked unconditionally |
4401 | * in x86_emulate_insn. | 4401 | * in x86_emulate_insn. |
@@ -4406,9 +4406,6 @@ done_prefixes: | |||
4406 | if (ctxt->d & NotImpl) | 4406 | if (ctxt->d & NotImpl) |
4407 | return EMULATION_FAILED; | 4407 | return EMULATION_FAILED; |
4408 | 4408 | ||
4409 | if (!(ctxt->d & EmulateOnUD) && ctxt->ud) | ||
4410 | return EMULATION_FAILED; | ||
4411 | |||
4412 | if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) | 4409 | if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) |
4413 | ctxt->op_bytes = 8; | 4410 | ctxt->op_bytes = 8; |
4414 | 4411 | ||
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index fc3df47fca35..f1fef74e503c 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c | |||
@@ -24,8 +24,8 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/of_device.h> | 25 | #include <linux/of_device.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/tegra-powergate.h> | ||
28 | #include <linux/regulator/consumer.h> | 27 | #include <linux/regulator/consumer.h> |
28 | #include <soc/tegra/pmc.h> | ||
29 | #include "ahci.h" | 29 | #include "ahci.h" |
30 | 30 | ||
31 | #define SATA_CONFIGURATION_0 0x180 | 31 | #define SATA_CONFIGURATION_0 0x180 |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index bc281115490b..c6962300b93c 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -344,7 +344,7 @@ static struct ata_port_operations xgene_ahci_ops = { | |||
344 | }; | 344 | }; |
345 | 345 | ||
346 | static const struct ata_port_info xgene_ahci_port_info = { | 346 | static const struct ata_port_info xgene_ahci_port_info = { |
347 | .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ, | 347 | .flags = AHCI_FLAG_COMMON, |
348 | .pio_mask = ATA_PIO4, | 348 | .pio_mask = ATA_PIO4, |
349 | .udma_mask = ATA_UDMA6, | 349 | .udma_mask = ATA_UDMA6, |
350 | .port_ops = &xgene_ahci_ops, | 350 | .port_ops = &xgene_ahci_ops, |
@@ -480,7 +480,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
480 | /* Configure the host controller */ | 480 | /* Configure the host controller */ |
481 | xgene_ahci_hw_init(hpriv); | 481 | xgene_ahci_hw_init(hpriv); |
482 | 482 | ||
483 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ; | 483 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; |
484 | 484 | ||
485 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); | 485 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); |
486 | if (rc) | 486 | if (rc) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index dbdc5d32343f..f3e7b9f894cd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4228,7 +4228,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4228 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4229 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4229 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4230 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4230 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4231 | { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4231 | { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4232 | 4232 | ||
4233 | /* | 4233 | /* |
4234 | * Some WD SATA-I drives spin up and down erratically when the link | 4234 | * Some WD SATA-I drives spin up and down erratically when the link |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 2578fc16960a..1a24a5dc3940 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -360,7 +360,7 @@ static int pata_s3c_wait_after_reset(struct ata_link *link, | |||
360 | /* | 360 | /* |
361 | * pata_s3c_bus_softreset - PATA device software reset | 361 | * pata_s3c_bus_softreset - PATA device software reset |
362 | */ | 362 | */ |
363 | static unsigned int pata_s3c_bus_softreset(struct ata_port *ap, | 363 | static int pata_s3c_bus_softreset(struct ata_port *ap, |
364 | unsigned long deadline) | 364 | unsigned long deadline) |
365 | { | 365 | { |
366 | struct ata_ioports *ioaddr = &ap->ioaddr; | 366 | struct ata_ioports *ioaddr = &ap->ioaddr; |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 4e006d74bef8..7f4cb76ed9fa 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -585,7 +585,7 @@ static int scc_wait_after_reset(struct ata_link *link, unsigned int devmask, | |||
585 | * Note: Original code is ata_bus_softreset(). | 585 | * Note: Original code is ata_bus_softreset(). |
586 | */ | 586 | */ |
587 | 587 | ||
588 | static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, | 588 | static int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, |
589 | unsigned long deadline) | 589 | unsigned long deadline) |
590 | { | 590 | { |
591 | struct ata_ioports *ioaddr = &ap->ioaddr; | 591 | struct ata_ioports *ioaddr = &ap->ioaddr; |
@@ -599,9 +599,7 @@ static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask, | |||
599 | udelay(20); | 599 | udelay(20); |
600 | out_be32(ioaddr->ctl_addr, ap->ctl); | 600 | out_be32(ioaddr->ctl_addr, ap->ctl); |
601 | 601 | ||
602 | scc_wait_after_reset(&ap->link, devmask, deadline); | 602 | return scc_wait_after_reset(&ap->link, devmask, deadline); |
603 | |||
604 | return 0; | ||
605 | } | 603 | } |
606 | 604 | ||
607 | /** | 605 | /** |
@@ -618,7 +616,8 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes, | |||
618 | { | 616 | { |
619 | struct ata_port *ap = link->ap; | 617 | struct ata_port *ap = link->ap; |
620 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; | 618 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; |
621 | unsigned int devmask = 0, err_mask; | 619 | unsigned int devmask = 0; |
620 | int rc; | ||
622 | u8 err; | 621 | u8 err; |
623 | 622 | ||
624 | DPRINTK("ENTER\n"); | 623 | DPRINTK("ENTER\n"); |
@@ -634,9 +633,9 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes, | |||
634 | 633 | ||
635 | /* issue bus reset */ | 634 | /* issue bus reset */ |
636 | DPRINTK("about to softreset, devmask=%x\n", devmask); | 635 | DPRINTK("about to softreset, devmask=%x\n", devmask); |
637 | err_mask = scc_bus_softreset(ap, devmask, deadline); | 636 | rc = scc_bus_softreset(ap, devmask, deadline); |
638 | if (err_mask) { | 637 | if (rc) { |
639 | ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", err_mask); | 638 | ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", rc); |
640 | return -EIO; | 639 | return -EIO; |
641 | } | 640 | } |
642 | 641 | ||
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c index 1bdcccc54a1d..f745d2c1325e 100644 --- a/drivers/hid/hid-cherry.c +++ b/drivers/hid/hid-cherry.c | |||
@@ -28,7 +28,7 @@ | |||
28 | static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 28 | static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
29 | unsigned int *rsize) | 29 | unsigned int *rsize) |
30 | { | 30 | { |
31 | if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { | 31 | if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { |
32 | hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n"); | 32 | hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n"); |
33 | rdesc[11] = rdesc[16] = 0xff; | 33 | rdesc[11] = rdesc[16] = 0xff; |
34 | rdesc[12] = rdesc[17] = 0x03; | 34 | rdesc[12] = rdesc[17] = 0x03; |
diff --git a/drivers/hid/hid-huion.c b/drivers/hid/hid-huion.c index 60f44cd1b0ed..61b68ca27790 100644 --- a/drivers/hid/hid-huion.c +++ b/drivers/hid/hid-huion.c | |||
@@ -84,6 +84,15 @@ static const __u8 huion_tablet_rdesc_template[] = { | |||
84 | 0xC0 /* End Collection */ | 84 | 0xC0 /* End Collection */ |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* Parameter indices */ | ||
88 | enum huion_prm { | ||
89 | HUION_PRM_X_LM = 1, | ||
90 | HUION_PRM_Y_LM = 2, | ||
91 | HUION_PRM_PRESSURE_LM = 4, | ||
92 | HUION_PRM_RESOLUTION = 5, | ||
93 | HUION_PRM_NUM | ||
94 | }; | ||
95 | |||
87 | /* Driver data */ | 96 | /* Driver data */ |
88 | struct huion_drvdata { | 97 | struct huion_drvdata { |
89 | __u8 *rdesc; | 98 | __u8 *rdesc; |
@@ -115,7 +124,12 @@ static int huion_tablet_enable(struct hid_device *hdev) | |||
115 | int rc; | 124 | int rc; |
116 | struct usb_device *usb_dev = hid_to_usb_dev(hdev); | 125 | struct usb_device *usb_dev = hid_to_usb_dev(hdev); |
117 | struct huion_drvdata *drvdata = hid_get_drvdata(hdev); | 126 | struct huion_drvdata *drvdata = hid_get_drvdata(hdev); |
118 | __le16 buf[6]; | 127 | __le16 *buf = NULL; |
128 | size_t len; | ||
129 | s32 params[HUION_PH_ID_NUM]; | ||
130 | s32 resolution; | ||
131 | __u8 *p; | ||
132 | s32 v; | ||
119 | 133 | ||
120 | /* | 134 | /* |
121 | * Read string descriptor containing tablet parameters. The specific | 135 | * Read string descriptor containing tablet parameters. The specific |
@@ -123,65 +137,79 @@ static int huion_tablet_enable(struct hid_device *hdev) | |||
123 | * driver traffic. | 137 | * driver traffic. |
124 | * NOTE: This enables fully-functional tablet mode. | 138 | * NOTE: This enables fully-functional tablet mode. |
125 | */ | 139 | */ |
140 | len = HUION_PRM_NUM * sizeof(*buf); | ||
141 | buf = kmalloc(len, GFP_KERNEL); | ||
142 | if (buf == NULL) { | ||
143 | hid_err(hdev, "failed to allocate parameter buffer\n"); | ||
144 | rc = -ENOMEM; | ||
145 | goto cleanup; | ||
146 | } | ||
126 | rc = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), | 147 | rc = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), |
127 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, | 148 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, |
128 | (USB_DT_STRING << 8) + 0x64, | 149 | (USB_DT_STRING << 8) + 0x64, |
129 | 0x0409, buf, sizeof(buf), | 150 | 0x0409, buf, len, |
130 | USB_CTRL_GET_TIMEOUT); | 151 | USB_CTRL_GET_TIMEOUT); |
131 | if (rc == -EPIPE) | 152 | if (rc == -EPIPE) { |
132 | hid_warn(hdev, "device parameters not found\n"); | 153 | hid_err(hdev, "device parameters not found\n"); |
133 | else if (rc < 0) | 154 | rc = -ENODEV; |
134 | hid_warn(hdev, "failed to get device parameters: %d\n", rc); | 155 | goto cleanup; |
135 | else if (rc != sizeof(buf)) | 156 | } else if (rc < 0) { |
136 | hid_warn(hdev, "invalid device parameters\n"); | 157 | hid_err(hdev, "failed to get device parameters: %d\n", rc); |
137 | else { | 158 | rc = -ENODEV; |
138 | s32 params[HUION_PH_ID_NUM]; | 159 | goto cleanup; |
139 | s32 resolution; | 160 | } else if (rc != len) { |
140 | __u8 *p; | 161 | hid_err(hdev, "invalid device parameters\n"); |
141 | s32 v; | 162 | rc = -ENODEV; |
163 | goto cleanup; | ||
164 | } | ||
142 | 165 | ||
143 | /* Extract device parameters */ | 166 | /* Extract device parameters */ |
144 | params[HUION_PH_ID_X_LM] = le16_to_cpu(buf[1]); | 167 | params[HUION_PH_ID_X_LM] = le16_to_cpu(buf[HUION_PRM_X_LM]); |
145 | params[HUION_PH_ID_Y_LM] = le16_to_cpu(buf[2]); | 168 | params[HUION_PH_ID_Y_LM] = le16_to_cpu(buf[HUION_PRM_Y_LM]); |
146 | params[HUION_PH_ID_PRESSURE_LM] = le16_to_cpu(buf[4]); | 169 | params[HUION_PH_ID_PRESSURE_LM] = |
147 | resolution = le16_to_cpu(buf[5]); | 170 | le16_to_cpu(buf[HUION_PRM_PRESSURE_LM]); |
148 | if (resolution == 0) { | 171 | resolution = le16_to_cpu(buf[HUION_PRM_RESOLUTION]); |
149 | params[HUION_PH_ID_X_PM] = 0; | 172 | if (resolution == 0) { |
150 | params[HUION_PH_ID_Y_PM] = 0; | 173 | params[HUION_PH_ID_X_PM] = 0; |
151 | } else { | 174 | params[HUION_PH_ID_Y_PM] = 0; |
152 | params[HUION_PH_ID_X_PM] = params[HUION_PH_ID_X_LM] * | 175 | } else { |
153 | 1000 / resolution; | 176 | params[HUION_PH_ID_X_PM] = params[HUION_PH_ID_X_LM] * |
154 | params[HUION_PH_ID_Y_PM] = params[HUION_PH_ID_Y_LM] * | 177 | 1000 / resolution; |
155 | 1000 / resolution; | 178 | params[HUION_PH_ID_Y_PM] = params[HUION_PH_ID_Y_LM] * |
156 | } | 179 | 1000 / resolution; |
180 | } | ||
157 | 181 | ||
158 | /* Allocate fixed report descriptor */ | 182 | /* Allocate fixed report descriptor */ |
159 | drvdata->rdesc = devm_kmalloc(&hdev->dev, | 183 | drvdata->rdesc = devm_kmalloc(&hdev->dev, |
160 | sizeof(huion_tablet_rdesc_template), | 184 | sizeof(huion_tablet_rdesc_template), |
161 | GFP_KERNEL); | 185 | GFP_KERNEL); |
162 | if (drvdata->rdesc == NULL) { | 186 | if (drvdata->rdesc == NULL) { |
163 | hid_err(hdev, "failed to allocate fixed rdesc\n"); | 187 | hid_err(hdev, "failed to allocate fixed rdesc\n"); |
164 | return -ENOMEM; | 188 | rc = -ENOMEM; |
165 | } | 189 | goto cleanup; |
166 | drvdata->rsize = sizeof(huion_tablet_rdesc_template); | 190 | } |
191 | drvdata->rsize = sizeof(huion_tablet_rdesc_template); | ||
167 | 192 | ||
168 | /* Format fixed report descriptor */ | 193 | /* Format fixed report descriptor */ |
169 | memcpy(drvdata->rdesc, huion_tablet_rdesc_template, | 194 | memcpy(drvdata->rdesc, huion_tablet_rdesc_template, |
170 | drvdata->rsize); | 195 | drvdata->rsize); |
171 | for (p = drvdata->rdesc; | 196 | for (p = drvdata->rdesc; |
172 | p <= drvdata->rdesc + drvdata->rsize - 4;) { | 197 | p <= drvdata->rdesc + drvdata->rsize - 4;) { |
173 | if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && | 198 | if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && |
174 | p[3] < sizeof(params)) { | 199 | p[3] < sizeof(params)) { |
175 | v = params[p[3]]; | 200 | v = params[p[3]]; |
176 | put_unaligned(cpu_to_le32(v), (s32 *)p); | 201 | put_unaligned(cpu_to_le32(v), (s32 *)p); |
177 | p += 4; | 202 | p += 4; |
178 | } else { | 203 | } else { |
179 | p++; | 204 | p++; |
180 | } | ||
181 | } | 205 | } |
182 | } | 206 | } |
183 | 207 | ||
184 | return 0; | 208 | rc = 0; |
209 | |||
210 | cleanup: | ||
211 | kfree(buf); | ||
212 | return rc; | ||
185 | } | 213 | } |
186 | 214 | ||
187 | static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id) | 215 | static int huion_probe(struct hid_device *hdev, const struct hid_device_id *id) |
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index e77696367591..b92bf01a1ae8 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c | |||
@@ -300,7 +300,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
300 | * - change the button usage range to 4-7 for the extra | 300 | * - change the button usage range to 4-7 for the extra |
301 | * buttons | 301 | * buttons |
302 | */ | 302 | */ |
303 | if (*rsize >= 74 && | 303 | if (*rsize >= 75 && |
304 | rdesc[61] == 0x05 && rdesc[62] == 0x08 && | 304 | rdesc[61] == 0x05 && rdesc[62] == 0x08 && |
305 | rdesc[63] == 0x19 && rdesc[64] == 0x08 && | 305 | rdesc[63] == 0x19 && rdesc[64] == 0x08 && |
306 | rdesc[65] == 0x29 && rdesc[66] == 0x0f && | 306 | rdesc[65] == 0x29 && rdesc[66] == 0x0f && |
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index a976f48263f6..f91ff145db9a 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
@@ -345,14 +345,14 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
345 | struct usb_device_descriptor *udesc; | 345 | struct usb_device_descriptor *udesc; |
346 | __u16 bcdDevice, rev_maj, rev_min; | 346 | __u16 bcdDevice, rev_maj, rev_min; |
347 | 347 | ||
348 | if ((drv_data->quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && | 348 | if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 && |
349 | rdesc[84] == 0x8c && rdesc[85] == 0x02) { | 349 | rdesc[84] == 0x8c && rdesc[85] == 0x02) { |
350 | hid_info(hdev, | 350 | hid_info(hdev, |
351 | "fixing up Logitech keyboard report descriptor\n"); | 351 | "fixing up Logitech keyboard report descriptor\n"); |
352 | rdesc[84] = rdesc[89] = 0x4d; | 352 | rdesc[84] = rdesc[89] = 0x4d; |
353 | rdesc[85] = rdesc[90] = 0x10; | 353 | rdesc[85] = rdesc[90] = 0x10; |
354 | } | 354 | } |
355 | if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 50 && | 355 | if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 && |
356 | rdesc[32] == 0x81 && rdesc[33] == 0x06 && | 356 | rdesc[32] == 0x81 && rdesc[33] == 0x06 && |
357 | rdesc[49] == 0x81 && rdesc[50] == 0x06) { | 357 | rdesc[49] == 0x81 && rdesc[50] == 0x06) { |
358 | hid_info(hdev, | 358 | hid_info(hdev, |
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index cc2bd2022198..7835717bc020 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c | |||
@@ -451,13 +451,13 @@ static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *at | |||
451 | drv_data = hid_get_drvdata(hid); | 451 | drv_data = hid_get_drvdata(hid); |
452 | if (!drv_data) { | 452 | if (!drv_data) { |
453 | hid_err(hid, "Private driver data not found!\n"); | 453 | hid_err(hid, "Private driver data not found!\n"); |
454 | return 0; | 454 | return -EINVAL; |
455 | } | 455 | } |
456 | 456 | ||
457 | entry = drv_data->device_props; | 457 | entry = drv_data->device_props; |
458 | if (!entry) { | 458 | if (!entry) { |
459 | hid_err(hid, "Device properties not found!\n"); | 459 | hid_err(hid, "Device properties not found!\n"); |
460 | return 0; | 460 | return -EINVAL; |
461 | } | 461 | } |
462 | 462 | ||
463 | if (range == 0) | 463 | if (range == 0) |
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 486dbde2ba2d..b7ba82960c79 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -238,13 +238,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
238 | return; | 238 | return; |
239 | } | 239 | } |
240 | 240 | ||
241 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | ||
242 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | ||
243 | dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n", | ||
244 | __func__, dj_report->device_index); | ||
245 | return; | ||
246 | } | ||
247 | |||
248 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | 241 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { |
249 | /* The device is already known. No need to reallocate it. */ | 242 | /* The device is already known. No need to reallocate it. */ |
250 | dbg_hid("%s: device is already known\n", __func__); | 243 | dbg_hid("%s: device is already known\n", __func__); |
@@ -557,7 +550,7 @@ static int logi_dj_ll_raw_request(struct hid_device *hid, | |||
557 | if (!out_buf) | 550 | if (!out_buf) |
558 | return -ENOMEM; | 551 | return -ENOMEM; |
559 | 552 | ||
560 | if (count < DJREPORT_SHORT_LENGTH - 2) | 553 | if (count > DJREPORT_SHORT_LENGTH - 2) |
561 | count = DJREPORT_SHORT_LENGTH - 2; | 554 | count = DJREPORT_SHORT_LENGTH - 2; |
562 | 555 | ||
563 | out_buf[0] = REPORT_ID_DJ_SHORT; | 556 | out_buf[0] = REPORT_ID_DJ_SHORT; |
@@ -690,6 +683,12 @@ static int logi_dj_raw_event(struct hid_device *hdev, | |||
690 | * device (via hid_input_report() ) and return 1 so hid-core does not do | 683 | * device (via hid_input_report() ) and return 1 so hid-core does not do |
691 | * anything else with it. | 684 | * anything else with it. |
692 | */ | 685 | */ |
686 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | ||
687 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | ||
688 | dev_err(&hdev->dev, "%s: invalid device index:%d\n", | ||
689 | __func__, dj_report->device_index); | ||
690 | return false; | ||
691 | } | ||
693 | 692 | ||
694 | spin_lock_irqsave(&djrcv_dev->lock, flags); | 693 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
695 | if (dj_report->report_id == REPORT_ID_DJ_SHORT) { | 694 | if (dj_report->report_id == REPORT_ID_DJ_SHORT) { |
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c index 9e14c00eb1b6..25daf28b26bd 100644 --- a/drivers/hid/hid-monterey.c +++ b/drivers/hid/hid-monterey.c | |||
@@ -24,7 +24,7 @@ | |||
24 | static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 24 | static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
25 | unsigned int *rsize) | 25 | unsigned int *rsize) |
26 | { | 26 | { |
27 | if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { | 27 | if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { |
28 | hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); | 28 | hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); |
29 | rdesc[30] = 0x0c; | 29 | rdesc[30] = 0x0c; |
30 | } | 30 | } |
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c index 736b2502df4f..6aca4f2554bf 100644 --- a/drivers/hid/hid-petalynx.c +++ b/drivers/hid/hid-petalynx.c | |||
@@ -25,7 +25,7 @@ | |||
25 | static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 25 | static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
26 | unsigned int *rsize) | 26 | unsigned int *rsize) |
27 | { | 27 | { |
28 | if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && | 28 | if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && |
29 | rdesc[41] == 0x00 && rdesc[59] == 0x26 && | 29 | rdesc[41] == 0x00 && rdesc[59] == 0x26 && |
30 | rdesc[60] == 0xf9 && rdesc[61] == 0x00) { | 30 | rdesc[60] == 0xf9 && rdesc[61] == 0x00) { |
31 | hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n"); | 31 | hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n"); |
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 0dc25142f451..8389e8109218 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -909,10 +909,15 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
909 | return ret; | 909 | return ret; |
910 | } | 910 | } |
911 | 911 | ||
912 | if (!test_bit(RMI_STARTED, &data->flags)) { | 912 | if (!test_bit(RMI_STARTED, &data->flags)) |
913 | hid_hw_stop(hdev); | 913 | /* |
914 | return -EIO; | 914 | * The device maybe in the bootloader if rmi_input_configured |
915 | } | 915 | * failed to find F11 in the PDT. Print an error, but don't |
916 | * return an error from rmi_probe so that hidraw will be | ||
917 | * accessible from userspace. That way a userspace tool | ||
918 | * can be used to reload working firmware on the touchpad. | ||
919 | */ | ||
920 | hid_err(hdev, "Device failed to be properly configured\n"); | ||
916 | 921 | ||
917 | return 0; | 922 | return 0; |
918 | } | 923 | } |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index e244e449cbba..2ac25760a9a9 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -604,9 +604,9 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
604 | ret = -EINVAL; | 604 | ret = -EINVAL; |
605 | goto err_stop_hw; | 605 | goto err_stop_hw; |
606 | } | 606 | } |
607 | sd->hid_sensor_hub_client_devs = kzalloc(dev_cnt * | 607 | sd->hid_sensor_hub_client_devs = devm_kzalloc(&hdev->dev, dev_cnt * |
608 | sizeof(struct mfd_cell), | 608 | sizeof(struct mfd_cell), |
609 | GFP_KERNEL); | 609 | GFP_KERNEL); |
610 | if (sd->hid_sensor_hub_client_devs == NULL) { | 610 | if (sd->hid_sensor_hub_client_devs == NULL) { |
611 | hid_err(hdev, "Failed to allocate memory for mfd cells\n"); | 611 | hid_err(hdev, "Failed to allocate memory for mfd cells\n"); |
612 | ret = -ENOMEM; | 612 | ret = -ENOMEM; |
@@ -618,11 +618,12 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
618 | 618 | ||
619 | if (collection->type == HID_COLLECTION_PHYSICAL) { | 619 | if (collection->type == HID_COLLECTION_PHYSICAL) { |
620 | 620 | ||
621 | hsdev = kzalloc(sizeof(*hsdev), GFP_KERNEL); | 621 | hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev), |
622 | GFP_KERNEL); | ||
622 | if (!hsdev) { | 623 | if (!hsdev) { |
623 | hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); | 624 | hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); |
624 | ret = -ENOMEM; | 625 | ret = -ENOMEM; |
625 | goto err_no_mem; | 626 | goto err_stop_hw; |
626 | } | 627 | } |
627 | hsdev->hdev = hdev; | 628 | hsdev->hdev = hdev; |
628 | hsdev->vendor_id = hdev->vendor; | 629 | hsdev->vendor_id = hdev->vendor; |
@@ -631,13 +632,13 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
631 | if (last_hsdev) | 632 | if (last_hsdev) |
632 | last_hsdev->end_collection_index = i; | 633 | last_hsdev->end_collection_index = i; |
633 | last_hsdev = hsdev; | 634 | last_hsdev = hsdev; |
634 | name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x", | 635 | name = devm_kasprintf(&hdev->dev, GFP_KERNEL, |
635 | collection->usage); | 636 | "HID-SENSOR-%x", |
637 | collection->usage); | ||
636 | if (name == NULL) { | 638 | if (name == NULL) { |
637 | hid_err(hdev, "Failed MFD device name\n"); | 639 | hid_err(hdev, "Failed MFD device name\n"); |
638 | ret = -ENOMEM; | 640 | ret = -ENOMEM; |
639 | kfree(hsdev); | 641 | goto err_stop_hw; |
640 | goto err_no_mem; | ||
641 | } | 642 | } |
642 | sd->hid_sensor_hub_client_devs[ | 643 | sd->hid_sensor_hub_client_devs[ |
643 | sd->hid_sensor_client_cnt].id = | 644 | sd->hid_sensor_client_cnt].id = |
@@ -661,16 +662,10 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
661 | ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs, | 662 | ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs, |
662 | sd->hid_sensor_client_cnt, NULL, 0, NULL); | 663 | sd->hid_sensor_client_cnt, NULL, 0, NULL); |
663 | if (ret < 0) | 664 | if (ret < 0) |
664 | goto err_no_mem; | 665 | goto err_stop_hw; |
665 | 666 | ||
666 | return ret; | 667 | return ret; |
667 | 668 | ||
668 | err_no_mem: | ||
669 | for (i = 0; i < sd->hid_sensor_client_cnt; ++i) { | ||
670 | kfree(sd->hid_sensor_hub_client_devs[i].name); | ||
671 | kfree(sd->hid_sensor_hub_client_devs[i].platform_data); | ||
672 | } | ||
673 | kfree(sd->hid_sensor_hub_client_devs); | ||
674 | err_stop_hw: | 669 | err_stop_hw: |
675 | hid_hw_stop(hdev); | 670 | hid_hw_stop(hdev); |
676 | 671 | ||
@@ -681,7 +676,6 @@ static void sensor_hub_remove(struct hid_device *hdev) | |||
681 | { | 676 | { |
682 | struct sensor_hub_data *data = hid_get_drvdata(hdev); | 677 | struct sensor_hub_data *data = hid_get_drvdata(hdev); |
683 | unsigned long flags; | 678 | unsigned long flags; |
684 | int i; | ||
685 | 679 | ||
686 | hid_dbg(hdev, " hardware removed\n"); | 680 | hid_dbg(hdev, " hardware removed\n"); |
687 | hid_hw_close(hdev); | 681 | hid_hw_close(hdev); |
@@ -691,11 +685,6 @@ static void sensor_hub_remove(struct hid_device *hdev) | |||
691 | complete(&data->pending.ready); | 685 | complete(&data->pending.ready); |
692 | spin_unlock_irqrestore(&data->lock, flags); | 686 | spin_unlock_irqrestore(&data->lock, flags); |
693 | mfd_remove_devices(&hdev->dev); | 687 | mfd_remove_devices(&hdev->dev); |
694 | for (i = 0; i < data->hid_sensor_client_cnt; ++i) { | ||
695 | kfree(data->hid_sensor_hub_client_devs[i].name); | ||
696 | kfree(data->hid_sensor_hub_client_devs[i].platform_data); | ||
697 | } | ||
698 | kfree(data->hid_sensor_hub_client_devs); | ||
699 | hid_set_drvdata(hdev, NULL); | 688 | hid_set_drvdata(hdev, NULL); |
700 | mutex_destroy(&data->mutex); | 689 | mutex_destroy(&data->mutex); |
701 | } | 690 | } |
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c index 87fc91e1c8de..91072fa54663 100644 --- a/drivers/hid/hid-sunplus.c +++ b/drivers/hid/hid-sunplus.c | |||
@@ -24,7 +24,7 @@ | |||
24 | static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 24 | static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
25 | unsigned int *rsize) | 25 | unsigned int *rsize) |
26 | { | 26 | { |
27 | if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && | 27 | if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && |
28 | rdesc[106] == 0x03) { | 28 | rdesc[106] == 0x03) { |
29 | hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n"); | 29 | hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n"); |
30 | rdesc[105] = rdesc[110] = 0x03; | 30 | rdesc[105] = rdesc[110] = 0x03; |
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 3e3b680dc007..b51a402752c4 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig | |||
@@ -23,17 +23,14 @@ config I2C | |||
23 | This I2C support can also be built as a module. If so, the module | 23 | This I2C support can also be built as a module. If so, the module |
24 | will be called i2c-core. | 24 | will be called i2c-core. |
25 | 25 | ||
26 | config I2C_ACPI | 26 | config ACPI_I2C_OPREGION |
27 | bool "I2C ACPI support" | 27 | bool "ACPI I2C Operation region support" |
28 | select I2C | 28 | depends on I2C=y && ACPI |
29 | depends on ACPI | ||
30 | default y | 29 | default y |
31 | help | 30 | help |
32 | Say Y here if you want to enable ACPI I2C support. This includes support | 31 | Say Y here if you want to enable ACPI I2C operation region support. |
33 | for automatic enumeration of I2C slave devices and support for ACPI I2C | 32 | Operation Regions allow firmware (BIOS) code to access I2C slave devices, |
34 | Operation Regions. Operation Regions allow firmware (BIOS) code to | 33 | such as smart batteries through an I2C host controller driver. |
35 | access I2C slave devices, such as smart batteries through an I2C host | ||
36 | controller driver. | ||
37 | 34 | ||
38 | if I2C | 35 | if I2C |
39 | 36 | ||
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index a1f590cbb435..e0228b228256 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | i2ccore-y := i2c-core.o | 5 | i2ccore-y := i2c-core.o |
6 | i2ccore-$(CONFIG_I2C_ACPI) += i2c-acpi.o | 6 | i2ccore-$(CONFIG_ACPI) += i2c-acpi.o |
7 | 7 | ||
8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o | 8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o |
9 | obj-$(CONFIG_I2C) += i2ccore.o | 9 | obj-$(CONFIG_I2C) += i2ccore.o |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 2994690b26e9..10467a327749 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -164,6 +164,7 @@ | |||
164 | 164 | ||
165 | /* Older devices have their ID defined in <linux/pci_ids.h> */ | 165 | /* Older devices have their ID defined in <linux/pci_ids.h> */ |
166 | #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 | 166 | #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 |
167 | #define PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS 0x2292 | ||
167 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 | 168 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 |
168 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 | 169 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 |
169 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ | 170 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ |
@@ -828,6 +829,7 @@ static const struct pci_device_id i801_ids[] = { | |||
828 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_SMBUS) }, | 829 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_SMBUS) }, |
829 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS) }, | 830 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS) }, |
830 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS) }, | 831 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS) }, |
832 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) }, | ||
831 | { 0, } | 833 | { 0, } |
832 | }; | 834 | }; |
833 | 835 | ||
diff --git a/drivers/i2c/i2c-acpi.c b/drivers/i2c/i2c-acpi.c index e8b61967334b..0dbc18c15c43 100644 --- a/drivers/i2c/i2c-acpi.c +++ b/drivers/i2c/i2c-acpi.c | |||
@@ -126,6 +126,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adap) | |||
126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | 126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); |
127 | } | 127 | } |
128 | 128 | ||
129 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
129 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | 130 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, |
130 | u8 cmd, u8 *data, u8 data_len) | 131 | u8 cmd, u8 *data, u8 data_len) |
131 | { | 132 | { |
@@ -360,3 +361,4 @@ void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | |||
360 | 361 | ||
361 | acpi_bus_detach_private_data(handle); | 362 | acpi_bus_detach_private_data(handle); |
362 | } | 363 | } |
364 | #endif | ||
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 18405314168b..ecb0109a5360 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -3149,14 +3149,16 @@ free_domains: | |||
3149 | 3149 | ||
3150 | static void cleanup_domain(struct protection_domain *domain) | 3150 | static void cleanup_domain(struct protection_domain *domain) |
3151 | { | 3151 | { |
3152 | struct iommu_dev_data *dev_data, *next; | 3152 | struct iommu_dev_data *entry; |
3153 | unsigned long flags; | 3153 | unsigned long flags; |
3154 | 3154 | ||
3155 | write_lock_irqsave(&amd_iommu_devtable_lock, flags); | 3155 | write_lock_irqsave(&amd_iommu_devtable_lock, flags); |
3156 | 3156 | ||
3157 | list_for_each_entry_safe(dev_data, next, &domain->dev_list, list) { | 3157 | while (!list_empty(&domain->dev_list)) { |
3158 | __detach_device(dev_data); | 3158 | entry = list_first_entry(&domain->dev_list, |
3159 | atomic_set(&dev_data->bind, 0); | 3159 | struct iommu_dev_data, list); |
3160 | __detach_device(entry); | ||
3161 | atomic_set(&entry->bind, 0); | ||
3160 | } | 3162 | } |
3161 | 3163 | ||
3162 | write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); | 3164 | write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index d1f5caad04f9..5619f264862d 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -3869,6 +3869,14 @@ static int device_notifier(struct notifier_block *nb, | |||
3869 | action != BUS_NOTIFY_DEL_DEVICE) | 3869 | action != BUS_NOTIFY_DEL_DEVICE) |
3870 | return 0; | 3870 | return 0; |
3871 | 3871 | ||
3872 | /* | ||
3873 | * If the device is still attached to a device driver we can't | ||
3874 | * tear down the domain yet as DMA mappings may still be in use. | ||
3875 | * Wait for the BUS_NOTIFY_UNBOUND_DRIVER event to do that. | ||
3876 | */ | ||
3877 | if (action == BUS_NOTIFY_DEL_DEVICE && dev->driver != NULL) | ||
3878 | return 0; | ||
3879 | |||
3872 | domain = find_domain(dev); | 3880 | domain = find_domain(dev); |
3873 | if (!domain) | 3881 | if (!domain) |
3874 | return 0; | 3882 | return 0; |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 169836020208..ac4adb337038 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -995,7 +995,7 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
995 | size_t orig_size = size; | 995 | size_t orig_size = size; |
996 | int ret = 0; | 996 | int ret = 0; |
997 | 997 | ||
998 | if (unlikely(domain->ops->unmap == NULL || | 998 | if (unlikely(domain->ops->map == NULL || |
999 | domain->ops->pgsize_bitmap == 0UL)) | 999 | domain->ops->pgsize_bitmap == 0UL)) |
1000 | return -ENODEV; | 1000 | return -ENODEV; |
1001 | 1001 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index b08c18871323..6703751d87d7 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2953,6 +2953,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
2953 | */ | 2953 | */ |
2954 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) { | 2954 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) { |
2955 | end_reshape(conf); | 2955 | end_reshape(conf); |
2956 | close_sync(conf); | ||
2956 | return 0; | 2957 | return 0; |
2957 | } | 2958 | } |
2958 | 2959 | ||
@@ -3081,6 +3082,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3081 | } | 3082 | } |
3082 | 3083 | ||
3083 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 3084 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); |
3085 | r10_bio->state = 0; | ||
3084 | raise_barrier(conf, rb2 != NULL); | 3086 | raise_barrier(conf, rb2 != NULL); |
3085 | atomic_set(&r10_bio->remaining, 0); | 3087 | atomic_set(&r10_bio->remaining, 0); |
3086 | 3088 | ||
@@ -3269,6 +3271,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3269 | if (sync_blocks < max_sync) | 3271 | if (sync_blocks < max_sync) |
3270 | max_sync = sync_blocks; | 3272 | max_sync = sync_blocks; |
3271 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 3273 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); |
3274 | r10_bio->state = 0; | ||
3272 | 3275 | ||
3273 | r10_bio->mddev = mddev; | 3276 | r10_bio->mddev = mddev; |
3274 | atomic_set(&r10_bio->remaining, 0); | 3277 | atomic_set(&r10_bio->remaining, 0); |
@@ -4384,6 +4387,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, | |||
4384 | read_more: | 4387 | read_more: |
4385 | /* Now schedule reads for blocks from sector_nr to last */ | 4388 | /* Now schedule reads for blocks from sector_nr to last */ |
4386 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); | 4389 | r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO); |
4390 | r10_bio->state = 0; | ||
4387 | raise_barrier(conf, sectors_done != 0); | 4391 | raise_barrier(conf, sectors_done != 0); |
4388 | atomic_set(&r10_bio->remaining, 0); | 4392 | atomic_set(&r10_bio->remaining, 0); |
4389 | r10_bio->mddev = mddev; | 4393 | r10_bio->mddev = mddev; |
@@ -4398,6 +4402,7 @@ read_more: | |||
4398 | * on all the target devices. | 4402 | * on all the target devices. |
4399 | */ | 4403 | */ |
4400 | // FIXME | 4404 | // FIXME |
4405 | mempool_free(r10_bio, conf->r10buf_pool); | ||
4401 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 4406 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
4402 | return sectors_done; | 4407 | return sectors_done; |
4403 | } | 4408 | } |
@@ -4410,7 +4415,7 @@ read_more: | |||
4410 | read_bio->bi_private = r10_bio; | 4415 | read_bio->bi_private = r10_bio; |
4411 | read_bio->bi_end_io = end_sync_read; | 4416 | read_bio->bi_end_io = end_sync_read; |
4412 | read_bio->bi_rw = READ; | 4417 | read_bio->bi_rw = READ; |
4413 | read_bio->bi_flags &= ~(BIO_POOL_MASK - 1); | 4418 | read_bio->bi_flags &= (~0UL << BIO_RESET_BITS); |
4414 | read_bio->bi_flags |= 1 << BIO_UPTODATE; | 4419 | read_bio->bi_flags |= 1 << BIO_UPTODATE; |
4415 | read_bio->bi_vcnt = 0; | 4420 | read_bio->bi_vcnt = 0; |
4416 | read_bio->bi_iter.bi_size = 0; | 4421 | read_bio->bi_iter.bi_size = 0; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6234b2e84587..183588b11fc1 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2922,7 +2922,7 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s, | |||
2922 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) && | 2922 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) && |
2923 | !test_bit(R5_OVERWRITE, &fdev[0]->flags)) || | 2923 | !test_bit(R5_OVERWRITE, &fdev[0]->flags)) || |
2924 | (sh->raid_conf->level == 6 && s->failed && s->to_write && | 2924 | (sh->raid_conf->level == 6 && s->failed && s->to_write && |
2925 | s->to_write < sh->raid_conf->raid_disks - 2 && | 2925 | s->to_write - s->non_overwrite < sh->raid_conf->raid_disks - 2 && |
2926 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))))) { | 2926 | (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))))) { |
2927 | /* we would like to get this block, possibly by computing it, | 2927 | /* we would like to get this block, possibly by computing it, |
2928 | * otherwise read it if the backing disk is insync | 2928 | * otherwise read it if the backing disk is insync |
@@ -3817,6 +3817,8 @@ static void handle_stripe(struct stripe_head *sh) | |||
3817 | set_bit(R5_Wantwrite, &dev->flags); | 3817 | set_bit(R5_Wantwrite, &dev->flags); |
3818 | if (prexor) | 3818 | if (prexor) |
3819 | continue; | 3819 | continue; |
3820 | if (s.failed > 1) | ||
3821 | continue; | ||
3820 | if (!test_bit(R5_Insync, &dev->flags) || | 3822 | if (!test_bit(R5_Insync, &dev->flags) || |
3821 | ((i == sh->pd_idx || i == sh->qd_idx) && | 3823 | ((i == sh->pd_idx || i == sh->qd_idx) && |
3822 | s.failed == 0)) | 3824 | s.failed == 0)) |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index f46a24ffa3fe..79cb8313c7d8 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -453,7 +453,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, | |||
453 | base = dt_mem_next_cell(dt_root_addr_cells, &prop); | 453 | base = dt_mem_next_cell(dt_root_addr_cells, &prop); |
454 | size = dt_mem_next_cell(dt_root_size_cells, &prop); | 454 | size = dt_mem_next_cell(dt_root_size_cells, &prop); |
455 | 455 | ||
456 | if (base && size && | 456 | if (size && |
457 | early_init_dt_reserve_memory_arch(base, size, nomap) == 0) | 457 | early_init_dt_reserve_memory_arch(base, size, nomap) == 0) |
458 | pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n", | 458 | pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n", |
459 | uname, &base, (unsigned long)size / SZ_1M); | 459 | uname, &base, (unsigned long)size / SZ_1M); |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 3e06a699352d..1471e0a223a5 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -301,16 +301,17 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar | |||
301 | /* Get the reg property (if any) */ | 301 | /* Get the reg property (if any) */ |
302 | addr = of_get_property(device, "reg", NULL); | 302 | addr = of_get_property(device, "reg", NULL); |
303 | 303 | ||
304 | /* Try the new-style interrupts-extended first */ | ||
305 | res = of_parse_phandle_with_args(device, "interrupts-extended", | ||
306 | "#interrupt-cells", index, out_irq); | ||
307 | if (!res) | ||
308 | return of_irq_parse_raw(addr, out_irq); | ||
309 | |||
304 | /* Get the interrupts property */ | 310 | /* Get the interrupts property */ |
305 | intspec = of_get_property(device, "interrupts", &intlen); | 311 | intspec = of_get_property(device, "interrupts", &intlen); |
306 | if (intspec == NULL) { | 312 | if (intspec == NULL) |
307 | /* Try the new-style interrupts-extended */ | 313 | return -EINVAL; |
308 | res = of_parse_phandle_with_args(device, "interrupts-extended", | 314 | |
309 | "#interrupt-cells", index, out_irq); | ||
310 | if (res) | ||
311 | return -EINVAL; | ||
312 | return of_irq_parse_raw(addr, out_irq); | ||
313 | } | ||
314 | intlen /= sizeof(*intspec); | 315 | intlen /= sizeof(*intspec); |
315 | 316 | ||
316 | pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); | 317 | pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index d41002667833..a737cb5974de 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -27,6 +27,7 @@ static struct selftest_results { | |||
27 | #define NO_OF_NODES 2 | 27 | #define NO_OF_NODES 2 |
28 | static struct device_node *nodes[NO_OF_NODES]; | 28 | static struct device_node *nodes[NO_OF_NODES]; |
29 | static int last_node_index; | 29 | static int last_node_index; |
30 | static bool selftest_live_tree; | ||
30 | 31 | ||
31 | #define selftest(result, fmt, ...) { \ | 32 | #define selftest(result, fmt, ...) { \ |
32 | if (!(result)) { \ | 33 | if (!(result)) { \ |
@@ -630,13 +631,6 @@ static int attach_node_and_children(struct device_node *np) | |||
630 | { | 631 | { |
631 | struct device_node *next, *root = np, *dup; | 632 | struct device_node *next, *root = np, *dup; |
632 | 633 | ||
633 | if (!np) { | ||
634 | pr_warn("%s: No tree to attach; not running tests\n", | ||
635 | __func__); | ||
636 | return -ENODATA; | ||
637 | } | ||
638 | |||
639 | |||
640 | /* skip root node */ | 634 | /* skip root node */ |
641 | np = np->child; | 635 | np = np->child; |
642 | /* storing a copy in temporary node */ | 636 | /* storing a copy in temporary node */ |
@@ -672,12 +666,12 @@ static int attach_node_and_children(struct device_node *np) | |||
672 | static int __init selftest_data_add(void) | 666 | static int __init selftest_data_add(void) |
673 | { | 667 | { |
674 | void *selftest_data; | 668 | void *selftest_data; |
675 | struct device_node *selftest_data_node; | 669 | struct device_node *selftest_data_node, *np; |
676 | extern uint8_t __dtb_testcases_begin[]; | 670 | extern uint8_t __dtb_testcases_begin[]; |
677 | extern uint8_t __dtb_testcases_end[]; | 671 | extern uint8_t __dtb_testcases_end[]; |
678 | const int size = __dtb_testcases_end - __dtb_testcases_begin; | 672 | const int size = __dtb_testcases_end - __dtb_testcases_begin; |
679 | 673 | ||
680 | if (!size || !of_allnodes) { | 674 | if (!size) { |
681 | pr_warn("%s: No testcase data to attach; not running tests\n", | 675 | pr_warn("%s: No testcase data to attach; not running tests\n", |
682 | __func__); | 676 | __func__); |
683 | return -ENODATA; | 677 | return -ENODATA; |
@@ -692,6 +686,22 @@ static int __init selftest_data_add(void) | |||
692 | return -ENOMEM; | 686 | return -ENOMEM; |
693 | } | 687 | } |
694 | of_fdt_unflatten_tree(selftest_data, &selftest_data_node); | 688 | of_fdt_unflatten_tree(selftest_data, &selftest_data_node); |
689 | if (!selftest_data_node) { | ||
690 | pr_warn("%s: No tree to attach; not running tests\n", __func__); | ||
691 | return -ENODATA; | ||
692 | } | ||
693 | |||
694 | if (!of_allnodes) { | ||
695 | /* enabling flag for removing nodes */ | ||
696 | selftest_live_tree = true; | ||
697 | of_allnodes = selftest_data_node; | ||
698 | |||
699 | for_each_of_allnodes(np) | ||
700 | __of_attach_node_sysfs(np); | ||
701 | of_aliases = of_find_node_by_path("/aliases"); | ||
702 | of_chosen = of_find_node_by_path("/chosen"); | ||
703 | return 0; | ||
704 | } | ||
695 | 705 | ||
696 | /* attach the sub-tree to live tree */ | 706 | /* attach the sub-tree to live tree */ |
697 | return attach_node_and_children(selftest_data_node); | 707 | return attach_node_and_children(selftest_data_node); |
@@ -723,6 +733,18 @@ static void selftest_data_remove(void) | |||
723 | struct device_node *np; | 733 | struct device_node *np; |
724 | struct property *prop; | 734 | struct property *prop; |
725 | 735 | ||
736 | if (selftest_live_tree) { | ||
737 | of_node_put(of_aliases); | ||
738 | of_node_put(of_chosen); | ||
739 | of_aliases = NULL; | ||
740 | of_chosen = NULL; | ||
741 | for_each_child_of_node(of_allnodes, np) | ||
742 | detach_node_and_children(np); | ||
743 | __of_detach_node_sysfs(of_allnodes); | ||
744 | of_allnodes = NULL; | ||
745 | return; | ||
746 | } | ||
747 | |||
726 | while (last_node_index >= 0) { | 748 | while (last_node_index >= 0) { |
727 | if (nodes[last_node_index]) { | 749 | if (nodes[last_node_index]) { |
728 | np = of_find_node_by_path(nodes[last_node_index]->full_name); | 750 | np = of_find_node_by_path(nodes[last_node_index]->full_name); |
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index 2d8a4d05d78f..8922c376456a 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig | |||
@@ -1,9 +1,18 @@ | |||
1 | menu "PCI host controller drivers" | 1 | menu "PCI host controller drivers" |
2 | depends on PCI | 2 | depends on PCI |
3 | 3 | ||
4 | config PCI_DRA7XX | ||
5 | bool "TI DRA7xx PCIe controller" | ||
6 | select PCIE_DW | ||
7 | depends on OF && HAS_IOMEM && TI_PIPE3 | ||
8 | help | ||
9 | Enables support for the PCIe controller in the DRA7xx SoC. There | ||
10 | are two instances of PCIe controller in DRA7xx. This controller can | ||
11 | act both as EP and RC. This reuses the Designware core. | ||
12 | |||
4 | config PCI_MVEBU | 13 | config PCI_MVEBU |
5 | bool "Marvell EBU PCIe controller" | 14 | bool "Marvell EBU PCIe controller" |
6 | depends on ARCH_MVEBU || ARCH_DOVE || ARCH_KIRKWOOD | 15 | depends on ARCH_MVEBU || ARCH_DOVE |
7 | depends on OF | 16 | depends on OF |
8 | 17 | ||
9 | config PCIE_DW | 18 | config PCIE_DW |
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile index 0daec7941aba..d0e88f114ff9 100644 --- a/drivers/pci/host/Makefile +++ b/drivers/pci/host/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_PCIE_DW) += pcie-designware.o | 1 | obj-$(CONFIG_PCIE_DW) += pcie-designware.o |
2 | obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o | ||
2 | obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o | 3 | obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o |
3 | obj-$(CONFIG_PCI_IMX6) += pci-imx6.o | 4 | obj-$(CONFIG_PCI_IMX6) += pci-imx6.o |
4 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o | 5 | obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o |
diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c new file mode 100644 index 000000000000..52b34fee07fd --- /dev/null +++ b/drivers/pci/host/pci-dra7xx.c | |||
@@ -0,0 +1,458 @@ | |||
1 | /* | ||
2 | * pcie-dra7xx - PCIe controller driver for TI DRA7xx SoCs | ||
3 | * | ||
4 | * Copyright (C) 2013-2014 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * | ||
6 | * Authors: Kishon Vijay Abraham I <kishon@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/delay.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/irqdomain.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/pci.h> | ||
21 | #include <linux/phy/phy.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/pm_runtime.h> | ||
24 | #include <linux/resource.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | #include "pcie-designware.h" | ||
28 | |||
29 | /* PCIe controller wrapper DRA7XX configuration registers */ | ||
30 | |||
31 | #define PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN 0x0024 | ||
32 | #define PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN 0x0028 | ||
33 | #define ERR_SYS BIT(0) | ||
34 | #define ERR_FATAL BIT(1) | ||
35 | #define ERR_NONFATAL BIT(2) | ||
36 | #define ERR_COR BIT(3) | ||
37 | #define ERR_AXI BIT(4) | ||
38 | #define ERR_ECRC BIT(5) | ||
39 | #define PME_TURN_OFF BIT(8) | ||
40 | #define PME_TO_ACK BIT(9) | ||
41 | #define PM_PME BIT(10) | ||
42 | #define LINK_REQ_RST BIT(11) | ||
43 | #define LINK_UP_EVT BIT(12) | ||
44 | #define CFG_BME_EVT BIT(13) | ||
45 | #define CFG_MSE_EVT BIT(14) | ||
46 | #define INTERRUPTS (ERR_SYS | ERR_FATAL | ERR_NONFATAL | ERR_COR | ERR_AXI | \ | ||
47 | ERR_ECRC | PME_TURN_OFF | PME_TO_ACK | PM_PME | \ | ||
48 | LINK_REQ_RST | LINK_UP_EVT | CFG_BME_EVT | CFG_MSE_EVT) | ||
49 | |||
50 | #define PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI 0x0034 | ||
51 | #define PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI 0x0038 | ||
52 | #define INTA BIT(0) | ||
53 | #define INTB BIT(1) | ||
54 | #define INTC BIT(2) | ||
55 | #define INTD BIT(3) | ||
56 | #define MSI BIT(4) | ||
57 | #define LEG_EP_INTERRUPTS (INTA | INTB | INTC | INTD) | ||
58 | |||
59 | #define PCIECTRL_DRA7XX_CONF_DEVICE_CMD 0x0104 | ||
60 | #define LTSSM_EN 0x1 | ||
61 | |||
62 | #define PCIECTRL_DRA7XX_CONF_PHY_CS 0x010C | ||
63 | #define LINK_UP BIT(16) | ||
64 | |||
65 | struct dra7xx_pcie { | ||
66 | void __iomem *base; | ||
67 | struct phy **phy; | ||
68 | int phy_count; | ||
69 | struct device *dev; | ||
70 | struct pcie_port pp; | ||
71 | }; | ||
72 | |||
73 | #define to_dra7xx_pcie(x) container_of((x), struct dra7xx_pcie, pp) | ||
74 | |||
75 | static inline u32 dra7xx_pcie_readl(struct dra7xx_pcie *pcie, u32 offset) | ||
76 | { | ||
77 | return readl(pcie->base + offset); | ||
78 | } | ||
79 | |||
80 | static inline void dra7xx_pcie_writel(struct dra7xx_pcie *pcie, u32 offset, | ||
81 | u32 value) | ||
82 | { | ||
83 | writel(value, pcie->base + offset); | ||
84 | } | ||
85 | |||
86 | static int dra7xx_pcie_link_up(struct pcie_port *pp) | ||
87 | { | ||
88 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
89 | u32 reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS); | ||
90 | |||
91 | return !!(reg & LINK_UP); | ||
92 | } | ||
93 | |||
94 | static int dra7xx_pcie_establish_link(struct pcie_port *pp) | ||
95 | { | ||
96 | u32 reg; | ||
97 | unsigned int retries = 1000; | ||
98 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
99 | |||
100 | if (dw_pcie_link_up(pp)) { | ||
101 | dev_err(pp->dev, "link is already up\n"); | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD); | ||
106 | reg |= LTSSM_EN; | ||
107 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg); | ||
108 | |||
109 | while (retries--) { | ||
110 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS); | ||
111 | if (reg & LINK_UP) | ||
112 | break; | ||
113 | usleep_range(10, 20); | ||
114 | } | ||
115 | |||
116 | if (retries == 0) { | ||
117 | dev_err(pp->dev, "link is not up\n"); | ||
118 | return -ETIMEDOUT; | ||
119 | } | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static void dra7xx_pcie_enable_interrupts(struct pcie_port *pp) | ||
125 | { | ||
126 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
127 | |||
128 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN, | ||
129 | ~INTERRUPTS); | ||
130 | dra7xx_pcie_writel(dra7xx, | ||
131 | PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN, INTERRUPTS); | ||
132 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, | ||
133 | ~LEG_EP_INTERRUPTS & ~MSI); | ||
134 | |||
135 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
136 | dra7xx_pcie_writel(dra7xx, | ||
137 | PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI, MSI); | ||
138 | else | ||
139 | dra7xx_pcie_writel(dra7xx, | ||
140 | PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI, | ||
141 | LEG_EP_INTERRUPTS); | ||
142 | } | ||
143 | |||
144 | static void dra7xx_pcie_host_init(struct pcie_port *pp) | ||
145 | { | ||
146 | dw_pcie_setup_rc(pp); | ||
147 | dra7xx_pcie_establish_link(pp); | ||
148 | if (IS_ENABLED(CONFIG_PCI_MSI)) | ||
149 | dw_pcie_msi_init(pp); | ||
150 | dra7xx_pcie_enable_interrupts(pp); | ||
151 | } | ||
152 | |||
153 | static struct pcie_host_ops dra7xx_pcie_host_ops = { | ||
154 | .link_up = dra7xx_pcie_link_up, | ||
155 | .host_init = dra7xx_pcie_host_init, | ||
156 | }; | ||
157 | |||
158 | static int dra7xx_pcie_intx_map(struct irq_domain *domain, unsigned int irq, | ||
159 | irq_hw_number_t hwirq) | ||
160 | { | ||
161 | irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); | ||
162 | irq_set_chip_data(irq, domain->host_data); | ||
163 | set_irq_flags(irq, IRQF_VALID); | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static const struct irq_domain_ops intx_domain_ops = { | ||
169 | .map = dra7xx_pcie_intx_map, | ||
170 | }; | ||
171 | |||
172 | static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp) | ||
173 | { | ||
174 | struct device *dev = pp->dev; | ||
175 | struct device_node *node = dev->of_node; | ||
176 | struct device_node *pcie_intc_node = of_get_next_child(node, NULL); | ||
177 | |||
178 | if (!pcie_intc_node) { | ||
179 | dev_err(dev, "No PCIe Intc node found\n"); | ||
180 | return PTR_ERR(pcie_intc_node); | ||
181 | } | ||
182 | |||
183 | pp->irq_domain = irq_domain_add_linear(pcie_intc_node, 4, | ||
184 | &intx_domain_ops, pp); | ||
185 | if (!pp->irq_domain) { | ||
186 | dev_err(dev, "Failed to get a INTx IRQ domain\n"); | ||
187 | return PTR_ERR(pp->irq_domain); | ||
188 | } | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg) | ||
194 | { | ||
195 | struct pcie_port *pp = arg; | ||
196 | struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); | ||
197 | u32 reg; | ||
198 | |||
199 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI); | ||
200 | |||
201 | switch (reg) { | ||
202 | case MSI: | ||
203 | dw_handle_msi_irq(pp); | ||
204 | break; | ||
205 | case INTA: | ||
206 | case INTB: | ||
207 | case INTC: | ||
208 | case INTD: | ||
209 | generic_handle_irq(irq_find_mapping(pp->irq_domain, ffs(reg))); | ||
210 | break; | ||
211 | } | ||
212 | |||
213 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI, reg); | ||
214 | |||
215 | return IRQ_HANDLED; | ||
216 | } | ||
217 | |||
218 | |||
219 | static irqreturn_t dra7xx_pcie_irq_handler(int irq, void *arg) | ||
220 | { | ||
221 | struct dra7xx_pcie *dra7xx = arg; | ||
222 | u32 reg; | ||
223 | |||
224 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN); | ||
225 | |||
226 | if (reg & ERR_SYS) | ||
227 | dev_dbg(dra7xx->dev, "System Error\n"); | ||
228 | |||
229 | if (reg & ERR_FATAL) | ||
230 | dev_dbg(dra7xx->dev, "Fatal Error\n"); | ||
231 | |||
232 | if (reg & ERR_NONFATAL) | ||
233 | dev_dbg(dra7xx->dev, "Non Fatal Error\n"); | ||
234 | |||
235 | if (reg & ERR_COR) | ||
236 | dev_dbg(dra7xx->dev, "Correctable Error\n"); | ||
237 | |||
238 | if (reg & ERR_AXI) | ||
239 | dev_dbg(dra7xx->dev, "AXI tag lookup fatal Error\n"); | ||
240 | |||
241 | if (reg & ERR_ECRC) | ||
242 | dev_dbg(dra7xx->dev, "ECRC Error\n"); | ||
243 | |||
244 | if (reg & PME_TURN_OFF) | ||
245 | dev_dbg(dra7xx->dev, | ||
246 | "Power Management Event Turn-Off message received\n"); | ||
247 | |||
248 | if (reg & PME_TO_ACK) | ||
249 | dev_dbg(dra7xx->dev, | ||
250 | "Power Management Turn-Off Ack message received\n"); | ||
251 | |||
252 | if (reg & PM_PME) | ||
253 | dev_dbg(dra7xx->dev, | ||
254 | "PM Power Management Event message received\n"); | ||
255 | |||
256 | if (reg & LINK_REQ_RST) | ||
257 | dev_dbg(dra7xx->dev, "Link Request Reset\n"); | ||
258 | |||
259 | if (reg & LINK_UP_EVT) | ||
260 | dev_dbg(dra7xx->dev, "Link-up state change\n"); | ||
261 | |||
262 | if (reg & CFG_BME_EVT) | ||
263 | dev_dbg(dra7xx->dev, "CFG 'Bus Master Enable' change\n"); | ||
264 | |||
265 | if (reg & CFG_MSE_EVT) | ||
266 | dev_dbg(dra7xx->dev, "CFG 'Memory Space Enable' change\n"); | ||
267 | |||
268 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN, reg); | ||
269 | |||
270 | return IRQ_HANDLED; | ||
271 | } | ||
272 | |||
273 | static int add_pcie_port(struct dra7xx_pcie *dra7xx, | ||
274 | struct platform_device *pdev) | ||
275 | { | ||
276 | int ret; | ||
277 | struct pcie_port *pp; | ||
278 | struct resource *res; | ||
279 | struct device *dev = &pdev->dev; | ||
280 | |||
281 | pp = &dra7xx->pp; | ||
282 | pp->dev = dev; | ||
283 | pp->ops = &dra7xx_pcie_host_ops; | ||
284 | |||
285 | pp->irq = platform_get_irq(pdev, 1); | ||
286 | if (pp->irq < 0) { | ||
287 | dev_err(dev, "missing IRQ resource\n"); | ||
288 | return -EINVAL; | ||
289 | } | ||
290 | |||
291 | ret = devm_request_irq(&pdev->dev, pp->irq, | ||
292 | dra7xx_pcie_msi_irq_handler, IRQF_SHARED, | ||
293 | "dra7-pcie-msi", pp); | ||
294 | if (ret) { | ||
295 | dev_err(&pdev->dev, "failed to request irq\n"); | ||
296 | return ret; | ||
297 | } | ||
298 | |||
299 | if (!IS_ENABLED(CONFIG_PCI_MSI)) { | ||
300 | ret = dra7xx_pcie_init_irq_domain(pp); | ||
301 | if (ret < 0) | ||
302 | return ret; | ||
303 | } | ||
304 | |||
305 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rc_dbics"); | ||
306 | pp->dbi_base = devm_ioremap(dev, res->start, resource_size(res)); | ||
307 | if (!pp->dbi_base) | ||
308 | return -ENOMEM; | ||
309 | |||
310 | ret = dw_pcie_host_init(pp); | ||
311 | if (ret) { | ||
312 | dev_err(dra7xx->dev, "failed to initialize host\n"); | ||
313 | return ret; | ||
314 | } | ||
315 | |||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | static int __init dra7xx_pcie_probe(struct platform_device *pdev) | ||
320 | { | ||
321 | u32 reg; | ||
322 | int ret; | ||
323 | int irq; | ||
324 | int i; | ||
325 | int phy_count; | ||
326 | struct phy **phy; | ||
327 | void __iomem *base; | ||
328 | struct resource *res; | ||
329 | struct dra7xx_pcie *dra7xx; | ||
330 | struct device *dev = &pdev->dev; | ||
331 | struct device_node *np = dev->of_node; | ||
332 | char name[10]; | ||
333 | |||
334 | dra7xx = devm_kzalloc(dev, sizeof(*dra7xx), GFP_KERNEL); | ||
335 | if (!dra7xx) | ||
336 | return -ENOMEM; | ||
337 | |||
338 | irq = platform_get_irq(pdev, 0); | ||
339 | if (irq < 0) { | ||
340 | dev_err(dev, "missing IRQ resource\n"); | ||
341 | return -EINVAL; | ||
342 | } | ||
343 | |||
344 | ret = devm_request_irq(dev, irq, dra7xx_pcie_irq_handler, | ||
345 | IRQF_SHARED, "dra7xx-pcie-main", dra7xx); | ||
346 | if (ret) { | ||
347 | dev_err(dev, "failed to request irq\n"); | ||
348 | return ret; | ||
349 | } | ||
350 | |||
351 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ti_conf"); | ||
352 | base = devm_ioremap_nocache(dev, res->start, resource_size(res)); | ||
353 | if (!base) | ||
354 | return -ENOMEM; | ||
355 | |||
356 | phy_count = of_property_count_strings(np, "phy-names"); | ||
357 | if (phy_count < 0) { | ||
358 | dev_err(dev, "unable to find the strings\n"); | ||
359 | return phy_count; | ||
360 | } | ||
361 | |||
362 | phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL); | ||
363 | if (!phy) | ||
364 | return -ENOMEM; | ||
365 | |||
366 | for (i = 0; i < phy_count; i++) { | ||
367 | snprintf(name, sizeof(name), "pcie-phy%d", i); | ||
368 | phy[i] = devm_phy_get(dev, name); | ||
369 | if (IS_ERR(phy[i])) | ||
370 | return PTR_ERR(phy[i]); | ||
371 | |||
372 | ret = phy_init(phy[i]); | ||
373 | if (ret < 0) | ||
374 | goto err_phy; | ||
375 | |||
376 | ret = phy_power_on(phy[i]); | ||
377 | if (ret < 0) { | ||
378 | phy_exit(phy[i]); | ||
379 | goto err_phy; | ||
380 | } | ||
381 | } | ||
382 | |||
383 | dra7xx->base = base; | ||
384 | dra7xx->phy = phy; | ||
385 | dra7xx->dev = dev; | ||
386 | dra7xx->phy_count = phy_count; | ||
387 | |||
388 | pm_runtime_enable(dev); | ||
389 | ret = pm_runtime_get_sync(dev); | ||
390 | if (IS_ERR_VALUE(ret)) { | ||
391 | dev_err(dev, "pm_runtime_get_sync failed\n"); | ||
392 | goto err_phy; | ||
393 | } | ||
394 | |||
395 | reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD); | ||
396 | reg &= ~LTSSM_EN; | ||
397 | dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg); | ||
398 | |||
399 | platform_set_drvdata(pdev, dra7xx); | ||
400 | |||
401 | ret = add_pcie_port(dra7xx, pdev); | ||
402 | if (ret < 0) | ||
403 | goto err_add_port; | ||
404 | |||
405 | return 0; | ||
406 | |||
407 | err_add_port: | ||
408 | pm_runtime_put(dev); | ||
409 | pm_runtime_disable(dev); | ||
410 | |||
411 | err_phy: | ||
412 | while (--i >= 0) { | ||
413 | phy_power_off(phy[i]); | ||
414 | phy_exit(phy[i]); | ||
415 | } | ||
416 | |||
417 | return ret; | ||
418 | } | ||
419 | |||
420 | static int __exit dra7xx_pcie_remove(struct platform_device *pdev) | ||
421 | { | ||
422 | struct dra7xx_pcie *dra7xx = platform_get_drvdata(pdev); | ||
423 | struct pcie_port *pp = &dra7xx->pp; | ||
424 | struct device *dev = &pdev->dev; | ||
425 | int count = dra7xx->phy_count; | ||
426 | |||
427 | if (pp->irq_domain) | ||
428 | irq_domain_remove(pp->irq_domain); | ||
429 | pm_runtime_put(dev); | ||
430 | pm_runtime_disable(dev); | ||
431 | while (count--) { | ||
432 | phy_power_off(dra7xx->phy[count]); | ||
433 | phy_exit(dra7xx->phy[count]); | ||
434 | } | ||
435 | |||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | static const struct of_device_id of_dra7xx_pcie_match[] = { | ||
440 | { .compatible = "ti,dra7-pcie", }, | ||
441 | {}, | ||
442 | }; | ||
443 | MODULE_DEVICE_TABLE(of, of_dra7xx_pcie_match); | ||
444 | |||
445 | static struct platform_driver dra7xx_pcie_driver = { | ||
446 | .remove = __exit_p(dra7xx_pcie_remove), | ||
447 | .driver = { | ||
448 | .name = "dra7-pcie", | ||
449 | .owner = THIS_MODULE, | ||
450 | .of_match_table = of_dra7xx_pcie_match, | ||
451 | }, | ||
452 | }; | ||
453 | |||
454 | module_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe); | ||
455 | |||
456 | MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>"); | ||
457 | MODULE_DESCRIPTION("TI PCIe controller driver"); | ||
458 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index abd65784618d..0fb0fdb223d5 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/debugfs.h> | ||
28 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
29 | #include <linux/export.h> | 30 | #include <linux/export.h> |
30 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
@@ -276,6 +277,7 @@ struct tegra_pcie { | |||
276 | unsigned int num_supplies; | 277 | unsigned int num_supplies; |
277 | 278 | ||
278 | const struct tegra_pcie_soc_data *soc_data; | 279 | const struct tegra_pcie_soc_data *soc_data; |
280 | struct dentry *debugfs; | ||
279 | }; | 281 | }; |
280 | 282 | ||
281 | struct tegra_pcie_port { | 283 | struct tegra_pcie_port { |
@@ -1739,6 +1741,115 @@ static const struct of_device_id tegra_pcie_of_match[] = { | |||
1739 | }; | 1741 | }; |
1740 | MODULE_DEVICE_TABLE(of, tegra_pcie_of_match); | 1742 | MODULE_DEVICE_TABLE(of, tegra_pcie_of_match); |
1741 | 1743 | ||
1744 | static void *tegra_pcie_ports_seq_start(struct seq_file *s, loff_t *pos) | ||
1745 | { | ||
1746 | struct tegra_pcie *pcie = s->private; | ||
1747 | |||
1748 | if (list_empty(&pcie->ports)) | ||
1749 | return NULL; | ||
1750 | |||
1751 | seq_printf(s, "Index Status\n"); | ||
1752 | |||
1753 | return seq_list_start(&pcie->ports, *pos); | ||
1754 | } | ||
1755 | |||
1756 | static void *tegra_pcie_ports_seq_next(struct seq_file *s, void *v, loff_t *pos) | ||
1757 | { | ||
1758 | struct tegra_pcie *pcie = s->private; | ||
1759 | |||
1760 | return seq_list_next(v, &pcie->ports, pos); | ||
1761 | } | ||
1762 | |||
1763 | static void tegra_pcie_ports_seq_stop(struct seq_file *s, void *v) | ||
1764 | { | ||
1765 | } | ||
1766 | |||
1767 | static int tegra_pcie_ports_seq_show(struct seq_file *s, void *v) | ||
1768 | { | ||
1769 | bool up = false, active = false; | ||
1770 | struct tegra_pcie_port *port; | ||
1771 | unsigned int value; | ||
1772 | |||
1773 | port = list_entry(v, struct tegra_pcie_port, list); | ||
1774 | |||
1775 | value = readl(port->base + RP_VEND_XP); | ||
1776 | |||
1777 | if (value & RP_VEND_XP_DL_UP) | ||
1778 | up = true; | ||
1779 | |||
1780 | value = readl(port->base + RP_LINK_CONTROL_STATUS); | ||
1781 | |||
1782 | if (value & RP_LINK_CONTROL_STATUS_DL_LINK_ACTIVE) | ||
1783 | active = true; | ||
1784 | |||
1785 | seq_printf(s, "%2u ", port->index); | ||
1786 | |||
1787 | if (up) | ||
1788 | seq_printf(s, "up"); | ||
1789 | |||
1790 | if (active) { | ||
1791 | if (up) | ||
1792 | seq_printf(s, ", "); | ||
1793 | |||
1794 | seq_printf(s, "active"); | ||
1795 | } | ||
1796 | |||
1797 | seq_printf(s, "\n"); | ||
1798 | return 0; | ||
1799 | } | ||
1800 | |||
1801 | static const struct seq_operations tegra_pcie_ports_seq_ops = { | ||
1802 | .start = tegra_pcie_ports_seq_start, | ||
1803 | .next = tegra_pcie_ports_seq_next, | ||
1804 | .stop = tegra_pcie_ports_seq_stop, | ||
1805 | .show = tegra_pcie_ports_seq_show, | ||
1806 | }; | ||
1807 | |||
1808 | static int tegra_pcie_ports_open(struct inode *inode, struct file *file) | ||
1809 | { | ||
1810 | struct tegra_pcie *pcie = inode->i_private; | ||
1811 | struct seq_file *s; | ||
1812 | int err; | ||
1813 | |||
1814 | err = seq_open(file, &tegra_pcie_ports_seq_ops); | ||
1815 | if (err) | ||
1816 | return err; | ||
1817 | |||
1818 | s = file->private_data; | ||
1819 | s->private = pcie; | ||
1820 | |||
1821 | return 0; | ||
1822 | } | ||
1823 | |||
1824 | static const struct file_operations tegra_pcie_ports_ops = { | ||
1825 | .owner = THIS_MODULE, | ||
1826 | .open = tegra_pcie_ports_open, | ||
1827 | .read = seq_read, | ||
1828 | .llseek = seq_lseek, | ||
1829 | .release = seq_release, | ||
1830 | }; | ||
1831 | |||
1832 | static int tegra_pcie_debugfs_init(struct tegra_pcie *pcie) | ||
1833 | { | ||
1834 | struct dentry *file; | ||
1835 | |||
1836 | pcie->debugfs = debugfs_create_dir("pcie", NULL); | ||
1837 | if (!pcie->debugfs) | ||
1838 | return -ENOMEM; | ||
1839 | |||
1840 | file = debugfs_create_file("ports", S_IFREG | S_IRUGO, pcie->debugfs, | ||
1841 | pcie, &tegra_pcie_ports_ops); | ||
1842 | if (!file) | ||
1843 | goto remove; | ||
1844 | |||
1845 | return 0; | ||
1846 | |||
1847 | remove: | ||
1848 | debugfs_remove_recursive(pcie->debugfs); | ||
1849 | pcie->debugfs = NULL; | ||
1850 | return -ENOMEM; | ||
1851 | } | ||
1852 | |||
1742 | static int tegra_pcie_probe(struct platform_device *pdev) | 1853 | static int tegra_pcie_probe(struct platform_device *pdev) |
1743 | { | 1854 | { |
1744 | const struct of_device_id *match; | 1855 | const struct of_device_id *match; |
@@ -1793,6 +1904,13 @@ static int tegra_pcie_probe(struct platform_device *pdev) | |||
1793 | goto disable_msi; | 1904 | goto disable_msi; |
1794 | } | 1905 | } |
1795 | 1906 | ||
1907 | if (IS_ENABLED(CONFIG_DEBUG_FS)) { | ||
1908 | err = tegra_pcie_debugfs_init(pcie); | ||
1909 | if (err < 0) | ||
1910 | dev_err(&pdev->dev, "failed to setup debugfs: %d\n", | ||
1911 | err); | ||
1912 | } | ||
1913 | |||
1796 | platform_set_drvdata(pdev, pcie); | 1914 | platform_set_drvdata(pdev, pcie); |
1797 | return 0; | 1915 | return 0; |
1798 | 1916 | ||
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 1eaf4df3618a..52bd3a143563 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/of_pci.h> | 20 | #include <linux/of_pci.h> |
21 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
22 | #include <linux/pci_regs.h> | 22 | #include <linux/pci_regs.h> |
23 | #include <linux/platform_device.h> | ||
23 | #include <linux/types.h> | 24 | #include <linux/types.h> |
24 | 25 | ||
25 | #include "pcie-designware.h" | 26 | #include "pcie-designware.h" |
@@ -217,27 +218,47 @@ static int find_valid_pos0(struct pcie_port *pp, int msgvec, int pos, int *pos0) | |||
217 | return 0; | 218 | return 0; |
218 | } | 219 | } |
219 | 220 | ||
221 | static void dw_pcie_msi_clear_irq(struct pcie_port *pp, int irq) | ||
222 | { | ||
223 | unsigned int res, bit, val; | ||
224 | |||
225 | res = (irq / 32) * 12; | ||
226 | bit = irq % 32; | ||
227 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | ||
228 | val &= ~(1 << bit); | ||
229 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
230 | } | ||
231 | |||
220 | static void clear_irq_range(struct pcie_port *pp, unsigned int irq_base, | 232 | static void clear_irq_range(struct pcie_port *pp, unsigned int irq_base, |
221 | unsigned int nvec, unsigned int pos) | 233 | unsigned int nvec, unsigned int pos) |
222 | { | 234 | { |
223 | unsigned int i, res, bit, val; | 235 | unsigned int i; |
224 | 236 | ||
225 | for (i = 0; i < nvec; i++) { | 237 | for (i = 0; i < nvec; i++) { |
226 | irq_set_msi_desc_off(irq_base, i, NULL); | 238 | irq_set_msi_desc_off(irq_base, i, NULL); |
227 | clear_bit(pos + i, pp->msi_irq_in_use); | 239 | clear_bit(pos + i, pp->msi_irq_in_use); |
228 | /* Disable corresponding interrupt on MSI controller */ | 240 | /* Disable corresponding interrupt on MSI controller */ |
229 | res = ((pos + i) / 32) * 12; | 241 | if (pp->ops->msi_clear_irq) |
230 | bit = (pos + i) % 32; | 242 | pp->ops->msi_clear_irq(pp, pos + i); |
231 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | 243 | else |
232 | val &= ~(1 << bit); | 244 | dw_pcie_msi_clear_irq(pp, pos + i); |
233 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
234 | } | 245 | } |
235 | } | 246 | } |
236 | 247 | ||
248 | static void dw_pcie_msi_set_irq(struct pcie_port *pp, int irq) | ||
249 | { | ||
250 | unsigned int res, bit, val; | ||
251 | |||
252 | res = (irq / 32) * 12; | ||
253 | bit = irq % 32; | ||
254 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | ||
255 | val |= 1 << bit; | ||
256 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
257 | } | ||
258 | |||
237 | static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) | 259 | static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) |
238 | { | 260 | { |
239 | int res, bit, irq, pos0, pos1, i; | 261 | int irq, pos0, pos1, i; |
240 | u32 val; | ||
241 | struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata); | 262 | struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata); |
242 | 263 | ||
243 | if (!pp) { | 264 | if (!pp) { |
@@ -281,11 +302,10 @@ static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos) | |||
281 | } | 302 | } |
282 | set_bit(pos0 + i, pp->msi_irq_in_use); | 303 | set_bit(pos0 + i, pp->msi_irq_in_use); |
283 | /*Enable corresponding interrupt in MSI interrupt controller */ | 304 | /*Enable corresponding interrupt in MSI interrupt controller */ |
284 | res = ((pos0 + i) / 32) * 12; | 305 | if (pp->ops->msi_set_irq) |
285 | bit = (pos0 + i) % 32; | 306 | pp->ops->msi_set_irq(pp, pos0 + i); |
286 | dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, &val); | 307 | else |
287 | val |= 1 << bit; | 308 | dw_pcie_msi_set_irq(pp, pos0 + i); |
288 | dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE + res, 4, val); | ||
289 | } | 309 | } |
290 | 310 | ||
291 | *pos = pos0; | 311 | *pos = pos0; |
@@ -353,7 +373,10 @@ static int dw_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev, | |||
353 | */ | 373 | */ |
354 | desc->msi_attrib.multiple = msgvec; | 374 | desc->msi_attrib.multiple = msgvec; |
355 | 375 | ||
356 | msg.address_lo = virt_to_phys((void *)pp->msi_data); | 376 | if (pp->ops->get_msi_data) |
377 | msg.address_lo = pp->ops->get_msi_data(pp); | ||
378 | else | ||
379 | msg.address_lo = virt_to_phys((void *)pp->msi_data); | ||
357 | msg.address_hi = 0x0; | 380 | msg.address_hi = 0x0; |
358 | msg.data = pos; | 381 | msg.data = pos; |
359 | write_msi_msg(irq, &msg); | 382 | write_msi_msg(irq, &msg); |
@@ -396,10 +419,35 @@ static const struct irq_domain_ops msi_domain_ops = { | |||
396 | int __init dw_pcie_host_init(struct pcie_port *pp) | 419 | int __init dw_pcie_host_init(struct pcie_port *pp) |
397 | { | 420 | { |
398 | struct device_node *np = pp->dev->of_node; | 421 | struct device_node *np = pp->dev->of_node; |
422 | struct platform_device *pdev = to_platform_device(pp->dev); | ||
399 | struct of_pci_range range; | 423 | struct of_pci_range range; |
400 | struct of_pci_range_parser parser; | 424 | struct of_pci_range_parser parser; |
401 | u32 val; | 425 | struct resource *cfg_res; |
402 | int i; | 426 | u32 val, na, ns; |
427 | const __be32 *addrp; | ||
428 | int i, index; | ||
429 | |||
430 | /* Find the address cell size and the number of cells in order to get | ||
431 | * the untranslated address. | ||
432 | */ | ||
433 | of_property_read_u32(np, "#address-cells", &na); | ||
434 | ns = of_n_size_cells(np); | ||
435 | |||
436 | cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config"); | ||
437 | if (cfg_res) { | ||
438 | pp->config.cfg0_size = resource_size(cfg_res)/2; | ||
439 | pp->config.cfg1_size = resource_size(cfg_res)/2; | ||
440 | pp->cfg0_base = cfg_res->start; | ||
441 | pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; | ||
442 | |||
443 | /* Find the untranslated configuration space address */ | ||
444 | index = of_property_match_string(np, "reg-names", "config"); | ||
445 | addrp = of_get_address(np, index, false, false); | ||
446 | pp->cfg0_mod_base = of_read_number(addrp, ns); | ||
447 | pp->cfg1_mod_base = pp->cfg0_mod_base + pp->config.cfg0_size; | ||
448 | } else { | ||
449 | dev_err(pp->dev, "missing *config* reg space\n"); | ||
450 | } | ||
403 | 451 | ||
404 | if (of_pci_range_parser_init(&parser, np)) { | 452 | if (of_pci_range_parser_init(&parser, np)) { |
405 | dev_err(pp->dev, "missing ranges property\n"); | 453 | dev_err(pp->dev, "missing ranges property\n"); |
@@ -422,17 +470,33 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
422 | pp->config.io_size = resource_size(&pp->io); | 470 | pp->config.io_size = resource_size(&pp->io); |
423 | pp->config.io_bus_addr = range.pci_addr; | 471 | pp->config.io_bus_addr = range.pci_addr; |
424 | pp->io_base = range.cpu_addr; | 472 | pp->io_base = range.cpu_addr; |
473 | |||
474 | /* Find the untranslated IO space address */ | ||
475 | pp->io_mod_base = of_read_number(parser.range - | ||
476 | parser.np + na, ns); | ||
425 | } | 477 | } |
426 | if (restype == IORESOURCE_MEM) { | 478 | if (restype == IORESOURCE_MEM) { |
427 | of_pci_range_to_resource(&range, np, &pp->mem); | 479 | of_pci_range_to_resource(&range, np, &pp->mem); |
428 | pp->mem.name = "MEM"; | 480 | pp->mem.name = "MEM"; |
429 | pp->config.mem_size = resource_size(&pp->mem); | 481 | pp->config.mem_size = resource_size(&pp->mem); |
430 | pp->config.mem_bus_addr = range.pci_addr; | 482 | pp->config.mem_bus_addr = range.pci_addr; |
483 | |||
484 | /* Find the untranslated MEM space address */ | ||
485 | pp->mem_mod_base = of_read_number(parser.range - | ||
486 | parser.np + na, ns); | ||
431 | } | 487 | } |
432 | if (restype == 0) { | 488 | if (restype == 0) { |
433 | of_pci_range_to_resource(&range, np, &pp->cfg); | 489 | of_pci_range_to_resource(&range, np, &pp->cfg); |
434 | pp->config.cfg0_size = resource_size(&pp->cfg)/2; | 490 | pp->config.cfg0_size = resource_size(&pp->cfg)/2; |
435 | pp->config.cfg1_size = resource_size(&pp->cfg)/2; | 491 | pp->config.cfg1_size = resource_size(&pp->cfg)/2; |
492 | pp->cfg0_base = pp->cfg.start; | ||
493 | pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; | ||
494 | |||
495 | /* Find the untranslated configuration space address */ | ||
496 | pp->cfg0_mod_base = of_read_number(parser.range - | ||
497 | parser.np + na, ns); | ||
498 | pp->cfg1_mod_base = pp->cfg0_mod_base + | ||
499 | pp->config.cfg0_size; | ||
436 | } | 500 | } |
437 | } | 501 | } |
438 | 502 | ||
@@ -445,8 +509,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
445 | } | 509 | } |
446 | } | 510 | } |
447 | 511 | ||
448 | pp->cfg0_base = pp->cfg.start; | ||
449 | pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; | ||
450 | pp->mem_base = pp->mem.start; | 512 | pp->mem_base = pp->mem.start; |
451 | 513 | ||
452 | pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, | 514 | pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, |
@@ -509,9 +571,9 @@ static void dw_pcie_prog_viewport_cfg0(struct pcie_port *pp, u32 busdev) | |||
509 | /* Program viewport 0 : OUTBOUND : CFG0 */ | 571 | /* Program viewport 0 : OUTBOUND : CFG0 */ |
510 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, | 572 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, |
511 | PCIE_ATU_VIEWPORT); | 573 | PCIE_ATU_VIEWPORT); |
512 | dw_pcie_writel_rc(pp, pp->cfg0_base, PCIE_ATU_LOWER_BASE); | 574 | dw_pcie_writel_rc(pp, pp->cfg0_mod_base, PCIE_ATU_LOWER_BASE); |
513 | dw_pcie_writel_rc(pp, (pp->cfg0_base >> 32), PCIE_ATU_UPPER_BASE); | 575 | dw_pcie_writel_rc(pp, (pp->cfg0_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
514 | dw_pcie_writel_rc(pp, pp->cfg0_base + pp->config.cfg0_size - 1, | 576 | dw_pcie_writel_rc(pp, pp->cfg0_mod_base + pp->config.cfg0_size - 1, |
515 | PCIE_ATU_LIMIT); | 577 | PCIE_ATU_LIMIT); |
516 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); | 578 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); |
517 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); | 579 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); |
@@ -525,9 +587,9 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev) | |||
525 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, | 587 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
526 | PCIE_ATU_VIEWPORT); | 588 | PCIE_ATU_VIEWPORT); |
527 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); | 589 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); |
528 | dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE); | 590 | dw_pcie_writel_rc(pp, pp->cfg1_mod_base, PCIE_ATU_LOWER_BASE); |
529 | dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE); | 591 | dw_pcie_writel_rc(pp, (pp->cfg1_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
530 | dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1, | 592 | dw_pcie_writel_rc(pp, pp->cfg1_mod_base + pp->config.cfg1_size - 1, |
531 | PCIE_ATU_LIMIT); | 593 | PCIE_ATU_LIMIT); |
532 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); | 594 | dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); |
533 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); | 595 | dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); |
@@ -540,9 +602,9 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) | |||
540 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, | 602 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, |
541 | PCIE_ATU_VIEWPORT); | 603 | PCIE_ATU_VIEWPORT); |
542 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); | 604 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); |
543 | dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE); | 605 | dw_pcie_writel_rc(pp, pp->mem_mod_base, PCIE_ATU_LOWER_BASE); |
544 | dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE); | 606 | dw_pcie_writel_rc(pp, (pp->mem_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
545 | dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1, | 607 | dw_pcie_writel_rc(pp, pp->mem_mod_base + pp->config.mem_size - 1, |
546 | PCIE_ATU_LIMIT); | 608 | PCIE_ATU_LIMIT); |
547 | dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); | 609 | dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); |
548 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), | 610 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), |
@@ -556,9 +618,9 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) | |||
556 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, | 618 | dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
557 | PCIE_ATU_VIEWPORT); | 619 | PCIE_ATU_VIEWPORT); |
558 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); | 620 | dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); |
559 | dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE); | 621 | dw_pcie_writel_rc(pp, pp->io_mod_base, PCIE_ATU_LOWER_BASE); |
560 | dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE); | 622 | dw_pcie_writel_rc(pp, (pp->io_mod_base >> 32), PCIE_ATU_UPPER_BASE); |
561 | dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1, | 623 | dw_pcie_writel_rc(pp, pp->io_mod_base + pp->config.io_size - 1, |
562 | PCIE_ATU_LIMIT); | 624 | PCIE_ATU_LIMIT); |
563 | dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); | 625 | dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); |
564 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), | 626 | dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), |
@@ -656,7 +718,11 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, | |||
656 | } | 718 | } |
657 | 719 | ||
658 | if (bus->number != pp->root_bus_nr) | 720 | if (bus->number != pp->root_bus_nr) |
659 | ret = dw_pcie_rd_other_conf(pp, bus, devfn, | 721 | if (pp->ops->rd_other_conf) |
722 | ret = pp->ops->rd_other_conf(pp, bus, devfn, | ||
723 | where, size, val); | ||
724 | else | ||
725 | ret = dw_pcie_rd_other_conf(pp, bus, devfn, | ||
660 | where, size, val); | 726 | where, size, val); |
661 | else | 727 | else |
662 | ret = dw_pcie_rd_own_conf(pp, where, size, val); | 728 | ret = dw_pcie_rd_own_conf(pp, where, size, val); |
@@ -679,7 +745,11 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
679 | return PCIBIOS_DEVICE_NOT_FOUND; | 745 | return PCIBIOS_DEVICE_NOT_FOUND; |
680 | 746 | ||
681 | if (bus->number != pp->root_bus_nr) | 747 | if (bus->number != pp->root_bus_nr) |
682 | ret = dw_pcie_wr_other_conf(pp, bus, devfn, | 748 | if (pp->ops->wr_other_conf) |
749 | ret = pp->ops->wr_other_conf(pp, bus, devfn, | ||
750 | where, size, val); | ||
751 | else | ||
752 | ret = dw_pcie_wr_other_conf(pp, bus, devfn, | ||
683 | where, size, val); | 753 | where, size, val); |
684 | else | 754 | else |
685 | ret = dw_pcie_wr_own_conf(pp, where, size, val); | 755 | ret = dw_pcie_wr_own_conf(pp, where, size, val); |
diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index 77f592faa7bf..daf81f922cda 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h | |||
@@ -36,11 +36,15 @@ struct pcie_port { | |||
36 | u8 root_bus_nr; | 36 | u8 root_bus_nr; |
37 | void __iomem *dbi_base; | 37 | void __iomem *dbi_base; |
38 | u64 cfg0_base; | 38 | u64 cfg0_base; |
39 | u64 cfg0_mod_base; | ||
39 | void __iomem *va_cfg0_base; | 40 | void __iomem *va_cfg0_base; |
40 | u64 cfg1_base; | 41 | u64 cfg1_base; |
42 | u64 cfg1_mod_base; | ||
41 | void __iomem *va_cfg1_base; | 43 | void __iomem *va_cfg1_base; |
42 | u64 io_base; | 44 | u64 io_base; |
45 | u64 io_mod_base; | ||
43 | u64 mem_base; | 46 | u64 mem_base; |
47 | u64 mem_mod_base; | ||
44 | struct resource cfg; | 48 | struct resource cfg; |
45 | struct resource io; | 49 | struct resource io; |
46 | struct resource mem; | 50 | struct resource mem; |
@@ -61,8 +65,15 @@ struct pcie_host_ops { | |||
61 | u32 val, void __iomem *dbi_base); | 65 | u32 val, void __iomem *dbi_base); |
62 | int (*rd_own_conf)(struct pcie_port *pp, int where, int size, u32 *val); | 66 | int (*rd_own_conf)(struct pcie_port *pp, int where, int size, u32 *val); |
63 | int (*wr_own_conf)(struct pcie_port *pp, int where, int size, u32 val); | 67 | int (*wr_own_conf)(struct pcie_port *pp, int where, int size, u32 val); |
68 | int (*rd_other_conf)(struct pcie_port *pp, struct pci_bus *bus, | ||
69 | unsigned int devfn, int where, int size, u32 *val); | ||
70 | int (*wr_other_conf)(struct pcie_port *pp, struct pci_bus *bus, | ||
71 | unsigned int devfn, int where, int size, u32 val); | ||
64 | int (*link_up)(struct pcie_port *pp); | 72 | int (*link_up)(struct pcie_port *pp); |
65 | void (*host_init)(struct pcie_port *pp); | 73 | void (*host_init)(struct pcie_port *pp); |
74 | void (*msi_set_irq)(struct pcie_port *pp, int irq); | ||
75 | void (*msi_clear_irq)(struct pcie_port *pp, int irq); | ||
76 | u32 (*get_msi_data)(struct pcie_port *pp); | ||
66 | }; | 77 | }; |
67 | 78 | ||
68 | int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val); | 79 | int dw_pcie_cfg_read(void __iomem *addr, int where, int size, u32 *val); |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index e4da61bcbf8b..b062d3d7b373 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1258,7 +1258,7 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1258 | int mode = -1; | 1258 | int mode = -1; |
1259 | int time = -1; | 1259 | int time = -1; |
1260 | 1260 | ||
1261 | if (sscanf(buf, "%i", &mode) != 1 || (mode != 2 || mode != 1)) | 1261 | if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1)) |
1262 | return -EINVAL; | 1262 | return -EINVAL; |
1263 | 1263 | ||
1264 | /* Set the Keyboard Backlight Mode where: | 1264 | /* Set the Keyboard Backlight Mode where: |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index df3306019a7e..d81f3cc43ff1 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -377,6 +377,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) | |||
377 | pool->slab_flags |= SLAB_CACHE_DMA; | 377 | pool->slab_flags |= SLAB_CACHE_DMA; |
378 | pool->gfp_mask = __GFP_DMA; | 378 | pool->gfp_mask = __GFP_DMA; |
379 | } | 379 | } |
380 | |||
381 | if (hostt->cmd_size) | ||
382 | hostt->cmd_pool = pool; | ||
383 | |||
380 | return pool; | 384 | return pool; |
381 | } | 385 | } |
382 | 386 | ||
@@ -421,8 +425,10 @@ out: | |||
421 | out_free_slab: | 425 | out_free_slab: |
422 | kmem_cache_destroy(pool->cmd_slab); | 426 | kmem_cache_destroy(pool->cmd_slab); |
423 | out_free_pool: | 427 | out_free_pool: |
424 | if (hostt->cmd_size) | 428 | if (hostt->cmd_size) { |
425 | scsi_free_host_cmd_pool(pool); | 429 | scsi_free_host_cmd_pool(pool); |
430 | hostt->cmd_pool = NULL; | ||
431 | } | ||
426 | goto out; | 432 | goto out; |
427 | } | 433 | } |
428 | 434 | ||
@@ -444,8 +450,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost) | |||
444 | if (!--pool->users) { | 450 | if (!--pool->users) { |
445 | kmem_cache_destroy(pool->cmd_slab); | 451 | kmem_cache_destroy(pool->cmd_slab); |
446 | kmem_cache_destroy(pool->sense_slab); | 452 | kmem_cache_destroy(pool->sense_slab); |
447 | if (hostt->cmd_size) | 453 | if (hostt->cmd_size) { |
448 | scsi_free_host_cmd_pool(pool); | 454 | scsi_free_host_cmd_pool(pool); |
455 | hostt->cmd_pool = NULL; | ||
456 | } | ||
449 | } | 457 | } |
450 | mutex_unlock(&host_cmd_pool_mutex); | 458 | mutex_unlock(&host_cmd_pool_mutex); |
451 | } | 459 | } |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9c44392b748f..ce62e8798cc8 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1774,7 +1774,7 @@ static void scsi_request_fn(struct request_queue *q) | |||
1774 | blk_requeue_request(q, req); | 1774 | blk_requeue_request(q, req); |
1775 | atomic_dec(&sdev->device_busy); | 1775 | atomic_dec(&sdev->device_busy); |
1776 | out_delay: | 1776 | out_delay: |
1777 | if (atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev)) | 1777 | if (!atomic_read(&sdev->device_busy) && !scsi_device_blocked(sdev)) |
1778 | blk_delay_queue(q, SCSI_QUEUE_DELAY); | 1778 | blk_delay_queue(q, SCSI_QUEUE_DELAY); |
1779 | } | 1779 | } |
1780 | 1780 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ac4f260155c8..889b98455750 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -207,6 +207,19 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
210 | static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len) | ||
211 | { | ||
212 | struct super_block *sb = file->f_path.dentry->d_sb; | ||
213 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | ||
214 | struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); | ||
215 | struct TCP_Server_Info *server = tcon->ses->server; | ||
216 | |||
217 | if (server->ops->fallocate) | ||
218 | return server->ops->fallocate(file, tcon, mode, off, len); | ||
219 | |||
220 | return -EOPNOTSUPP; | ||
221 | } | ||
222 | |||
210 | static int cifs_permission(struct inode *inode, int mask) | 223 | static int cifs_permission(struct inode *inode, int mask) |
211 | { | 224 | { |
212 | struct cifs_sb_info *cifs_sb; | 225 | struct cifs_sb_info *cifs_sb; |
@@ -812,8 +825,9 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) | |||
812 | if (!(S_ISREG(inode->i_mode))) | 825 | if (!(S_ISREG(inode->i_mode))) |
813 | return -EINVAL; | 826 | return -EINVAL; |
814 | 827 | ||
815 | /* check if file is oplocked */ | 828 | /* Check if file is oplocked if this is request for new lease */ |
816 | if (((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) || | 829 | if (arg == F_UNLCK || |
830 | ((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) || | ||
817 | ((arg == F_WRLCK) && CIFS_CACHE_WRITE(CIFS_I(inode)))) | 831 | ((arg == F_WRLCK) && CIFS_CACHE_WRITE(CIFS_I(inode)))) |
818 | return generic_setlease(file, arg, lease); | 832 | return generic_setlease(file, arg, lease); |
819 | else if (tlink_tcon(cfile->tlink)->local_lease && | 833 | else if (tlink_tcon(cfile->tlink)->local_lease && |
@@ -908,6 +922,7 @@ const struct file_operations cifs_file_ops = { | |||
908 | .unlocked_ioctl = cifs_ioctl, | 922 | .unlocked_ioctl = cifs_ioctl, |
909 | #endif /* CONFIG_CIFS_POSIX */ | 923 | #endif /* CONFIG_CIFS_POSIX */ |
910 | .setlease = cifs_setlease, | 924 | .setlease = cifs_setlease, |
925 | .fallocate = cifs_fallocate, | ||
911 | }; | 926 | }; |
912 | 927 | ||
913 | const struct file_operations cifs_file_strict_ops = { | 928 | const struct file_operations cifs_file_strict_ops = { |
@@ -927,6 +942,7 @@ const struct file_operations cifs_file_strict_ops = { | |||
927 | .unlocked_ioctl = cifs_ioctl, | 942 | .unlocked_ioctl = cifs_ioctl, |
928 | #endif /* CONFIG_CIFS_POSIX */ | 943 | #endif /* CONFIG_CIFS_POSIX */ |
929 | .setlease = cifs_setlease, | 944 | .setlease = cifs_setlease, |
945 | .fallocate = cifs_fallocate, | ||
930 | }; | 946 | }; |
931 | 947 | ||
932 | const struct file_operations cifs_file_direct_ops = { | 948 | const struct file_operations cifs_file_direct_ops = { |
@@ -947,6 +963,7 @@ const struct file_operations cifs_file_direct_ops = { | |||
947 | #endif /* CONFIG_CIFS_POSIX */ | 963 | #endif /* CONFIG_CIFS_POSIX */ |
948 | .llseek = cifs_llseek, | 964 | .llseek = cifs_llseek, |
949 | .setlease = cifs_setlease, | 965 | .setlease = cifs_setlease, |
966 | .fallocate = cifs_fallocate, | ||
950 | }; | 967 | }; |
951 | 968 | ||
952 | const struct file_operations cifs_file_nobrl_ops = { | 969 | const struct file_operations cifs_file_nobrl_ops = { |
@@ -965,6 +982,7 @@ const struct file_operations cifs_file_nobrl_ops = { | |||
965 | .unlocked_ioctl = cifs_ioctl, | 982 | .unlocked_ioctl = cifs_ioctl, |
966 | #endif /* CONFIG_CIFS_POSIX */ | 983 | #endif /* CONFIG_CIFS_POSIX */ |
967 | .setlease = cifs_setlease, | 984 | .setlease = cifs_setlease, |
985 | .fallocate = cifs_fallocate, | ||
968 | }; | 986 | }; |
969 | 987 | ||
970 | const struct file_operations cifs_file_strict_nobrl_ops = { | 988 | const struct file_operations cifs_file_strict_nobrl_ops = { |
@@ -983,6 +1001,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = { | |||
983 | .unlocked_ioctl = cifs_ioctl, | 1001 | .unlocked_ioctl = cifs_ioctl, |
984 | #endif /* CONFIG_CIFS_POSIX */ | 1002 | #endif /* CONFIG_CIFS_POSIX */ |
985 | .setlease = cifs_setlease, | 1003 | .setlease = cifs_setlease, |
1004 | .fallocate = cifs_fallocate, | ||
986 | }; | 1005 | }; |
987 | 1006 | ||
988 | const struct file_operations cifs_file_direct_nobrl_ops = { | 1007 | const struct file_operations cifs_file_direct_nobrl_ops = { |
@@ -1002,6 +1021,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = { | |||
1002 | #endif /* CONFIG_CIFS_POSIX */ | 1021 | #endif /* CONFIG_CIFS_POSIX */ |
1003 | .llseek = cifs_llseek, | 1022 | .llseek = cifs_llseek, |
1004 | .setlease = cifs_setlease, | 1023 | .setlease = cifs_setlease, |
1024 | .fallocate = cifs_fallocate, | ||
1005 | }; | 1025 | }; |
1006 | 1026 | ||
1007 | const struct file_operations cifs_dir_ops = { | 1027 | const struct file_operations cifs_dir_ops = { |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 0012e1e291d4..dfc731b02aa9 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -409,6 +409,10 @@ struct smb_version_operations { | |||
409 | /* get mtu credits */ | 409 | /* get mtu credits */ |
410 | int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, | 410 | int (*wait_mtu_credits)(struct TCP_Server_Info *, unsigned int, |
411 | unsigned int *, unsigned int *); | 411 | unsigned int *, unsigned int *); |
412 | /* check if we need to issue closedir */ | ||
413 | bool (*dir_needs_close)(struct cifsFileInfo *); | ||
414 | long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, | ||
415 | loff_t); | ||
412 | }; | 416 | }; |
413 | 417 | ||
414 | struct smb_version_values { | 418 | struct smb_version_values { |
@@ -883,6 +887,7 @@ struct cifs_tcon { | |||
883 | for this mount even if server would support */ | 887 | for this mount even if server would support */ |
884 | bool local_lease:1; /* check leases (only) on local system not remote */ | 888 | bool local_lease:1; /* check leases (only) on local system not remote */ |
885 | bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ | 889 | bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ |
890 | bool broken_sparse_sup; /* if server or share does not support sparse */ | ||
886 | bool need_reconnect:1; /* connection reset, tid now invalid */ | 891 | bool need_reconnect:1; /* connection reset, tid now invalid */ |
887 | #ifdef CONFIG_CIFS_SMB2 | 892 | #ifdef CONFIG_CIFS_SMB2 |
888 | bool print:1; /* set if connection to printer share */ | 893 | bool print:1; /* set if connection to printer share */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 33df36ef9d52..5f9822ac0245 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -2253,6 +2253,29 @@ typedef struct { | |||
2253 | /* minimum includes first three fields, and empty FS Name */ | 2253 | /* minimum includes first three fields, and empty FS Name */ |
2254 | #define MIN_FS_ATTR_INFO_SIZE 12 | 2254 | #define MIN_FS_ATTR_INFO_SIZE 12 |
2255 | 2255 | ||
2256 | |||
2257 | /* List of FileSystemAttributes - see 2.5.1 of MS-FSCC */ | ||
2258 | #define FILE_SUPPORT_INTEGRITY_STREAMS 0x04000000 | ||
2259 | #define FILE_SUPPORTS_USN_JOURNAL 0x02000000 | ||
2260 | #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 | ||
2261 | #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 | ||
2262 | #define FILE_SUPPORTS_HARD_LINKS 0x00400000 | ||
2263 | #define FILE_SUPPORTS_TRANSACTIONS 0x00200000 | ||
2264 | #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 | ||
2265 | #define FILE_READ_ONLY_VOLUME 0x00080000 | ||
2266 | #define FILE_NAMED_STREAMS 0x00040000 | ||
2267 | #define FILE_SUPPORTS_ENCRYPTION 0x00020000 | ||
2268 | #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 | ||
2269 | #define FILE_VOLUME_IS_COMPRESSED 0x00008000 | ||
2270 | #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 | ||
2271 | #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 | ||
2272 | #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 | ||
2273 | #define FILE_VOLUME_QUOTAS 0x00000020 | ||
2274 | #define FILE_FILE_COMPRESSION 0x00000010 | ||
2275 | #define FILE_PERSISTENT_ACLS 0x00000008 | ||
2276 | #define FILE_UNICODE_ON_DISK 0x00000004 | ||
2277 | #define FILE_CASE_PRESERVED_NAMES 0x00000002 | ||
2278 | #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 | ||
2256 | typedef struct { | 2279 | typedef struct { |
2257 | __le32 Attributes; | 2280 | __le32 Attributes; |
2258 | __le32 MaxPathNameComponentLength; | 2281 | __le32 MaxPathNameComponentLength; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 4ab2f79ffa7a..d5fec92e0360 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -762,7 +762,7 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
762 | 762 | ||
763 | cifs_dbg(FYI, "Freeing private data in close dir\n"); | 763 | cifs_dbg(FYI, "Freeing private data in close dir\n"); |
764 | spin_lock(&cifs_file_list_lock); | 764 | spin_lock(&cifs_file_list_lock); |
765 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { | 765 | if (server->ops->dir_needs_close(cfile)) { |
766 | cfile->invalidHandle = true; | 766 | cfile->invalidHandle = true; |
767 | spin_unlock(&cifs_file_list_lock); | 767 | spin_unlock(&cifs_file_list_lock); |
768 | if (server->ops->close_dir) | 768 | if (server->ops->close_dir) |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 426d6c6ad8bf..949ec909ec9a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1727,6 +1727,12 @@ unlink_target: | |||
1727 | target_dentry, to_name); | 1727 | target_dentry, to_name); |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | /* force revalidate to go get info when needed */ | ||
1731 | CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; | ||
1732 | |||
1733 | source_dir->i_ctime = source_dir->i_mtime = target_dir->i_ctime = | ||
1734 | target_dir->i_mtime = current_fs_time(source_dir->i_sb); | ||
1735 | |||
1730 | cifs_rename_exit: | 1736 | cifs_rename_exit: |
1731 | kfree(info_buf_source); | 1737 | kfree(info_buf_source); |
1732 | kfree(from_name); | 1738 | kfree(from_name); |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 81340c6253eb..b7415d596dbd 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -574,13 +574,6 @@ void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | |||
574 | cinode->oplock = 0; | 574 | cinode->oplock = 0; |
575 | } | 575 | } |
576 | 576 | ||
577 | static int | ||
578 | cifs_oplock_break_wait(void *unused) | ||
579 | { | ||
580 | schedule(); | ||
581 | return signal_pending(current) ? -ERESTARTSYS : 0; | ||
582 | } | ||
583 | |||
584 | /* | 577 | /* |
585 | * We wait for oplock breaks to be processed before we attempt to perform | 578 | * We wait for oplock breaks to be processed before we attempt to perform |
586 | * writes. | 579 | * writes. |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index b15862e0f68c..798c80a41c88 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -593,7 +593,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos, | |||
593 | /* close and restart search */ | 593 | /* close and restart search */ |
594 | cifs_dbg(FYI, "search backing up - close and restart search\n"); | 594 | cifs_dbg(FYI, "search backing up - close and restart search\n"); |
595 | spin_lock(&cifs_file_list_lock); | 595 | spin_lock(&cifs_file_list_lock); |
596 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { | 596 | if (server->ops->dir_needs_close(cfile)) { |
597 | cfile->invalidHandle = true; | 597 | cfile->invalidHandle = true; |
598 | spin_unlock(&cifs_file_list_lock); | 598 | spin_unlock(&cifs_file_list_lock); |
599 | if (server->ops->close) | 599 | if (server->ops->close) |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 5e8c22d6c7b9..1a6df4b03f67 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -1015,6 +1015,12 @@ cifs_wp_retry_size(struct inode *inode) | |||
1015 | return CIFS_SB(inode->i_sb)->wsize; | 1015 | return CIFS_SB(inode->i_sb)->wsize; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | static bool | ||
1019 | cifs_dir_needs_close(struct cifsFileInfo *cfile) | ||
1020 | { | ||
1021 | return !cfile->srch_inf.endOfSearch && !cfile->invalidHandle; | ||
1022 | } | ||
1023 | |||
1018 | struct smb_version_operations smb1_operations = { | 1024 | struct smb_version_operations smb1_operations = { |
1019 | .send_cancel = send_nt_cancel, | 1025 | .send_cancel = send_nt_cancel, |
1020 | .compare_fids = cifs_compare_fids, | 1026 | .compare_fids = cifs_compare_fids, |
@@ -1086,6 +1092,7 @@ struct smb_version_operations smb1_operations = { | |||
1086 | .create_mf_symlink = cifs_create_mf_symlink, | 1092 | .create_mf_symlink = cifs_create_mf_symlink, |
1087 | .is_read_op = cifs_is_read_op, | 1093 | .is_read_op = cifs_is_read_op, |
1088 | .wp_retry_size = cifs_wp_retry_size, | 1094 | .wp_retry_size = cifs_wp_retry_size, |
1095 | .dir_needs_close = cifs_dir_needs_close, | ||
1089 | #ifdef CONFIG_CIFS_XATTR | 1096 | #ifdef CONFIG_CIFS_XATTR |
1090 | .query_all_EAs = CIFSSMBQAllEAs, | 1097 | .query_all_EAs = CIFSSMBQAllEAs, |
1091 | .set_EA = CIFSSMBSetEA, | 1098 | .set_EA = CIFSSMBSetEA, |
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c index e31a9dfdcd39..af59d03db492 100644 --- a/fs/cifs/smb2maperror.c +++ b/fs/cifs/smb2maperror.c | |||
@@ -214,7 +214,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { | |||
214 | {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, | 214 | {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, |
215 | {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, | 215 | {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, |
216 | {STATUS_BUFFER_OVERFLOW, -EIO, "STATUS_BUFFER_OVERFLOW"}, | 216 | {STATUS_BUFFER_OVERFLOW, -EIO, "STATUS_BUFFER_OVERFLOW"}, |
217 | {STATUS_NO_MORE_FILES, -EIO, "STATUS_NO_MORE_FILES"}, | 217 | {STATUS_NO_MORE_FILES, -ENODATA, "STATUS_NO_MORE_FILES"}, |
218 | {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, | 218 | {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, |
219 | {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, | 219 | {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, |
220 | {STATUS_NO_INHERITANCE, -EIO, "STATUS_NO_INHERITANCE"}, | 220 | {STATUS_NO_INHERITANCE, -EIO, "STATUS_NO_INHERITANCE"}, |
@@ -298,7 +298,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { | |||
298 | {STATUS_INVALID_PARAMETER, -EINVAL, "STATUS_INVALID_PARAMETER"}, | 298 | {STATUS_INVALID_PARAMETER, -EINVAL, "STATUS_INVALID_PARAMETER"}, |
299 | {STATUS_NO_SUCH_DEVICE, -ENODEV, "STATUS_NO_SUCH_DEVICE"}, | 299 | {STATUS_NO_SUCH_DEVICE, -ENODEV, "STATUS_NO_SUCH_DEVICE"}, |
300 | {STATUS_NO_SUCH_FILE, -ENOENT, "STATUS_NO_SUCH_FILE"}, | 300 | {STATUS_NO_SUCH_FILE, -ENOENT, "STATUS_NO_SUCH_FILE"}, |
301 | {STATUS_INVALID_DEVICE_REQUEST, -EIO, "STATUS_INVALID_DEVICE_REQUEST"}, | 301 | {STATUS_INVALID_DEVICE_REQUEST, -EOPNOTSUPP, "STATUS_INVALID_DEVICE_REQUEST"}, |
302 | {STATUS_END_OF_FILE, -ENODATA, "STATUS_END_OF_FILE"}, | 302 | {STATUS_END_OF_FILE, -ENODATA, "STATUS_END_OF_FILE"}, |
303 | {STATUS_WRONG_VOLUME, -EIO, "STATUS_WRONG_VOLUME"}, | 303 | {STATUS_WRONG_VOLUME, -EIO, "STATUS_WRONG_VOLUME"}, |
304 | {STATUS_NO_MEDIA_IN_DEVICE, -EIO, "STATUS_NO_MEDIA_IN_DEVICE"}, | 304 | {STATUS_NO_MEDIA_IN_DEVICE, -EIO, "STATUS_NO_MEDIA_IN_DEVICE"}, |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index f2e6ac29a8d6..4aa7a0f07d6e 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
@@ -178,9 +178,24 @@ smb2_check_message(char *buf, unsigned int length) | |||
178 | /* Windows 7 server returns 24 bytes more */ | 178 | /* Windows 7 server returns 24 bytes more */ |
179 | if (clc_len + 20 == len && command == SMB2_OPLOCK_BREAK_HE) | 179 | if (clc_len + 20 == len && command == SMB2_OPLOCK_BREAK_HE) |
180 | return 0; | 180 | return 0; |
181 | /* server can return one byte more */ | 181 | /* server can return one byte more due to implied bcc[0] */ |
182 | if (clc_len == 4 + len + 1) | 182 | if (clc_len == 4 + len + 1) |
183 | return 0; | 183 | return 0; |
184 | |||
185 | /* | ||
186 | * MacOS server pads after SMB2.1 write response with 3 bytes | ||
187 | * of junk. Other servers match RFC1001 len to actual | ||
188 | * SMB2/SMB3 frame length (header + smb2 response specific data) | ||
189 | * Log the server error (once), but allow it and continue | ||
190 | * since the frame is parseable. | ||
191 | */ | ||
192 | if (clc_len < 4 /* RFC1001 header size */ + len) { | ||
193 | printk_once(KERN_WARNING | ||
194 | "SMB2 server sent bad RFC1001 len %d not %d\n", | ||
195 | len, clc_len - 4); | ||
196 | return 0; | ||
197 | } | ||
198 | |||
184 | return 1; | 199 | return 1; |
185 | } | 200 | } |
186 | return 0; | 201 | return 0; |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 77f8aeb9c2fc..5a48aa290dfe 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -731,11 +731,72 @@ smb2_sync_write(const unsigned int xid, struct cifsFileInfo *cfile, | |||
731 | return SMB2_write(xid, parms, written, iov, nr_segs); | 731 | return SMB2_write(xid, parms, written, iov, nr_segs); |
732 | } | 732 | } |
733 | 733 | ||
734 | /* Set or clear the SPARSE_FILE attribute based on value passed in setsparse */ | ||
735 | static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon, | ||
736 | struct cifsFileInfo *cfile, struct inode *inode, __u8 setsparse) | ||
737 | { | ||
738 | struct cifsInodeInfo *cifsi; | ||
739 | int rc; | ||
740 | |||
741 | cifsi = CIFS_I(inode); | ||
742 | |||
743 | /* if file already sparse don't bother setting sparse again */ | ||
744 | if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) && setsparse) | ||
745 | return true; /* already sparse */ | ||
746 | |||
747 | if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) && !setsparse) | ||
748 | return true; /* already not sparse */ | ||
749 | |||
750 | /* | ||
751 | * Can't check for sparse support on share the usual way via the | ||
752 | * FS attribute info (FILE_SUPPORTS_SPARSE_FILES) on the share | ||
753 | * since Samba server doesn't set the flag on the share, yet | ||
754 | * supports the set sparse FSCTL and returns sparse correctly | ||
755 | * in the file attributes. If we fail setting sparse though we | ||
756 | * mark that server does not support sparse files for this share | ||
757 | * to avoid repeatedly sending the unsupported fsctl to server | ||
758 | * if the file is repeatedly extended. | ||
759 | */ | ||
760 | if (tcon->broken_sparse_sup) | ||
761 | return false; | ||
762 | |||
763 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | ||
764 | cfile->fid.volatile_fid, FSCTL_SET_SPARSE, | ||
765 | true /* is_fctl */, &setsparse, 1, NULL, NULL); | ||
766 | if (rc) { | ||
767 | tcon->broken_sparse_sup = true; | ||
768 | cifs_dbg(FYI, "set sparse rc = %d\n", rc); | ||
769 | return false; | ||
770 | } | ||
771 | |||
772 | if (setsparse) | ||
773 | cifsi->cifsAttrs |= FILE_ATTRIBUTE_SPARSE_FILE; | ||
774 | else | ||
775 | cifsi->cifsAttrs &= (~FILE_ATTRIBUTE_SPARSE_FILE); | ||
776 | |||
777 | return true; | ||
778 | } | ||
779 | |||
734 | static int | 780 | static int |
735 | smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, | 781 | smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, |
736 | struct cifsFileInfo *cfile, __u64 size, bool set_alloc) | 782 | struct cifsFileInfo *cfile, __u64 size, bool set_alloc) |
737 | { | 783 | { |
738 | __le64 eof = cpu_to_le64(size); | 784 | __le64 eof = cpu_to_le64(size); |
785 | struct inode *inode; | ||
786 | |||
787 | /* | ||
788 | * If extending file more than one page make sparse. Many Linux fs | ||
789 | * make files sparse by default when extending via ftruncate | ||
790 | */ | ||
791 | inode = cfile->dentry->d_inode; | ||
792 | |||
793 | if (!set_alloc && (size > inode->i_size + 8192)) { | ||
794 | __u8 set_sparse = 1; | ||
795 | |||
796 | /* whether set sparse succeeds or not, extend the file */ | ||
797 | smb2_set_sparse(xid, tcon, cfile, inode, set_sparse); | ||
798 | } | ||
799 | |||
739 | return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, | 800 | return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, |
740 | cfile->fid.volatile_fid, cfile->pid, &eof, false); | 801 | cfile->fid.volatile_fid, cfile->pid, &eof, false); |
741 | } | 802 | } |
@@ -954,6 +1015,105 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
954 | return rc; | 1015 | return rc; |
955 | } | 1016 | } |
956 | 1017 | ||
1018 | static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | ||
1019 | loff_t offset, loff_t len, bool keep_size) | ||
1020 | { | ||
1021 | struct inode *inode; | ||
1022 | struct cifsInodeInfo *cifsi; | ||
1023 | struct cifsFileInfo *cfile = file->private_data; | ||
1024 | struct file_zero_data_information fsctl_buf; | ||
1025 | long rc; | ||
1026 | unsigned int xid; | ||
1027 | |||
1028 | xid = get_xid(); | ||
1029 | |||
1030 | inode = cfile->dentry->d_inode; | ||
1031 | cifsi = CIFS_I(inode); | ||
1032 | |||
1033 | /* if file not oplocked can't be sure whether asking to extend size */ | ||
1034 | if (!CIFS_CACHE_READ(cifsi)) | ||
1035 | if (keep_size == false) | ||
1036 | return -EOPNOTSUPP; | ||
1037 | |||
1038 | /* | ||
1039 | * Must check if file sparse since fallocate -z (zero range) assumes | ||
1040 | * non-sparse allocation | ||
1041 | */ | ||
1042 | if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) | ||
1043 | return -EOPNOTSUPP; | ||
1044 | |||
1045 | /* | ||
1046 | * need to make sure we are not asked to extend the file since the SMB3 | ||
1047 | * fsctl does not change the file size. In the future we could change | ||
1048 | * this to zero the first part of the range then set the file size | ||
1049 | * which for a non sparse file would zero the newly extended range | ||
1050 | */ | ||
1051 | if (keep_size == false) | ||
1052 | if (i_size_read(inode) < offset + len) | ||
1053 | return -EOPNOTSUPP; | ||
1054 | |||
1055 | cifs_dbg(FYI, "offset %lld len %lld", offset, len); | ||
1056 | |||
1057 | fsctl_buf.FileOffset = cpu_to_le64(offset); | ||
1058 | fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); | ||
1059 | |||
1060 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | ||
1061 | cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, | ||
1062 | true /* is_fctl */, (char *)&fsctl_buf, | ||
1063 | sizeof(struct file_zero_data_information), NULL, NULL); | ||
1064 | free_xid(xid); | ||
1065 | return rc; | ||
1066 | } | ||
1067 | |||
1068 | static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, | ||
1069 | loff_t offset, loff_t len) | ||
1070 | { | ||
1071 | struct inode *inode; | ||
1072 | struct cifsInodeInfo *cifsi; | ||
1073 | struct cifsFileInfo *cfile = file->private_data; | ||
1074 | struct file_zero_data_information fsctl_buf; | ||
1075 | long rc; | ||
1076 | unsigned int xid; | ||
1077 | __u8 set_sparse = 1; | ||
1078 | |||
1079 | xid = get_xid(); | ||
1080 | |||
1081 | inode = cfile->dentry->d_inode; | ||
1082 | cifsi = CIFS_I(inode); | ||
1083 | |||
1084 | /* Need to make file sparse, if not already, before freeing range. */ | ||
1085 | /* Consider adding equivalent for compressed since it could also work */ | ||
1086 | if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse)) | ||
1087 | return -EOPNOTSUPP; | ||
1088 | |||
1089 | cifs_dbg(FYI, "offset %lld len %lld", offset, len); | ||
1090 | |||
1091 | fsctl_buf.FileOffset = cpu_to_le64(offset); | ||
1092 | fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); | ||
1093 | |||
1094 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | ||
1095 | cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, | ||
1096 | true /* is_fctl */, (char *)&fsctl_buf, | ||
1097 | sizeof(struct file_zero_data_information), NULL, NULL); | ||
1098 | free_xid(xid); | ||
1099 | return rc; | ||
1100 | } | ||
1101 | |||
1102 | static long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode, | ||
1103 | loff_t off, loff_t len) | ||
1104 | { | ||
1105 | /* KEEP_SIZE already checked for by do_fallocate */ | ||
1106 | if (mode & FALLOC_FL_PUNCH_HOLE) | ||
1107 | return smb3_punch_hole(file, tcon, off, len); | ||
1108 | else if (mode & FALLOC_FL_ZERO_RANGE) { | ||
1109 | if (mode & FALLOC_FL_KEEP_SIZE) | ||
1110 | return smb3_zero_range(file, tcon, off, len, true); | ||
1111 | return smb3_zero_range(file, tcon, off, len, false); | ||
1112 | } | ||
1113 | |||
1114 | return -EOPNOTSUPP; | ||
1115 | } | ||
1116 | |||
957 | static void | 1117 | static void |
958 | smb2_downgrade_oplock(struct TCP_Server_Info *server, | 1118 | smb2_downgrade_oplock(struct TCP_Server_Info *server, |
959 | struct cifsInodeInfo *cinode, bool set_level2) | 1119 | struct cifsInodeInfo *cinode, bool set_level2) |
@@ -1161,6 +1321,12 @@ smb2_wp_retry_size(struct inode *inode) | |||
1161 | SMB2_MAX_BUFFER_SIZE); | 1321 | SMB2_MAX_BUFFER_SIZE); |
1162 | } | 1322 | } |
1163 | 1323 | ||
1324 | static bool | ||
1325 | smb2_dir_needs_close(struct cifsFileInfo *cfile) | ||
1326 | { | ||
1327 | return !cfile->invalidHandle; | ||
1328 | } | ||
1329 | |||
1164 | struct smb_version_operations smb20_operations = { | 1330 | struct smb_version_operations smb20_operations = { |
1165 | .compare_fids = smb2_compare_fids, | 1331 | .compare_fids = smb2_compare_fids, |
1166 | .setup_request = smb2_setup_request, | 1332 | .setup_request = smb2_setup_request, |
@@ -1236,6 +1402,7 @@ struct smb_version_operations smb20_operations = { | |||
1236 | .parse_lease_buf = smb2_parse_lease_buf, | 1402 | .parse_lease_buf = smb2_parse_lease_buf, |
1237 | .clone_range = smb2_clone_range, | 1403 | .clone_range = smb2_clone_range, |
1238 | .wp_retry_size = smb2_wp_retry_size, | 1404 | .wp_retry_size = smb2_wp_retry_size, |
1405 | .dir_needs_close = smb2_dir_needs_close, | ||
1239 | }; | 1406 | }; |
1240 | 1407 | ||
1241 | struct smb_version_operations smb21_operations = { | 1408 | struct smb_version_operations smb21_operations = { |
@@ -1313,6 +1480,7 @@ struct smb_version_operations smb21_operations = { | |||
1313 | .parse_lease_buf = smb2_parse_lease_buf, | 1480 | .parse_lease_buf = smb2_parse_lease_buf, |
1314 | .clone_range = smb2_clone_range, | 1481 | .clone_range = smb2_clone_range, |
1315 | .wp_retry_size = smb2_wp_retry_size, | 1482 | .wp_retry_size = smb2_wp_retry_size, |
1483 | .dir_needs_close = smb2_dir_needs_close, | ||
1316 | }; | 1484 | }; |
1317 | 1485 | ||
1318 | struct smb_version_operations smb30_operations = { | 1486 | struct smb_version_operations smb30_operations = { |
@@ -1393,6 +1561,8 @@ struct smb_version_operations smb30_operations = { | |||
1393 | .clone_range = smb2_clone_range, | 1561 | .clone_range = smb2_clone_range, |
1394 | .validate_negotiate = smb3_validate_negotiate, | 1562 | .validate_negotiate = smb3_validate_negotiate, |
1395 | .wp_retry_size = smb2_wp_retry_size, | 1563 | .wp_retry_size = smb2_wp_retry_size, |
1564 | .dir_needs_close = smb2_dir_needs_close, | ||
1565 | .fallocate = smb3_fallocate, | ||
1396 | }; | 1566 | }; |
1397 | 1567 | ||
1398 | struct smb_version_values smb20_values = { | 1568 | struct smb_version_values smb20_values = { |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 42ebc1a8be6c..fa0dd044213b 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -907,7 +907,8 @@ tcon_exit: | |||
907 | tcon_error_exit: | 907 | tcon_error_exit: |
908 | if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) { | 908 | if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) { |
909 | cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); | 909 | cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); |
910 | tcon->bad_network_name = true; | 910 | if (tcon) |
911 | tcon->bad_network_name = true; | ||
911 | } | 912 | } |
912 | goto tcon_exit; | 913 | goto tcon_exit; |
913 | } | 914 | } |
@@ -1224,7 +1225,9 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, | |||
1224 | 1225 | ||
1225 | cifs_dbg(FYI, "SMB2 IOCTL\n"); | 1226 | cifs_dbg(FYI, "SMB2 IOCTL\n"); |
1226 | 1227 | ||
1227 | *out_data = NULL; | 1228 | if (out_data != NULL) |
1229 | *out_data = NULL; | ||
1230 | |||
1228 | /* zero out returned data len, in case of error */ | 1231 | /* zero out returned data len, in case of error */ |
1229 | if (plen) | 1232 | if (plen) |
1230 | *plen = 0; | 1233 | *plen = 0; |
@@ -2177,6 +2180,10 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, | |||
2177 | rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; | 2180 | rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; |
2178 | 2181 | ||
2179 | if (rc) { | 2182 | if (rc) { |
2183 | if (rc == -ENODATA && rsp->hdr.Status == STATUS_NO_MORE_FILES) { | ||
2184 | srch_inf->endOfSearch = true; | ||
2185 | rc = 0; | ||
2186 | } | ||
2180 | cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); | 2187 | cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); |
2181 | goto qdir_exit; | 2188 | goto qdir_exit; |
2182 | } | 2189 | } |
@@ -2214,11 +2221,6 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, | |||
2214 | else | 2221 | else |
2215 | cifs_dbg(VFS, "illegal search buffer type\n"); | 2222 | cifs_dbg(VFS, "illegal search buffer type\n"); |
2216 | 2223 | ||
2217 | if (rsp->hdr.Status == STATUS_NO_MORE_FILES) | ||
2218 | srch_inf->endOfSearch = 1; | ||
2219 | else | ||
2220 | srch_inf->endOfSearch = 0; | ||
2221 | |||
2222 | return rc; | 2224 | return rc; |
2223 | 2225 | ||
2224 | qdir_exit: | 2226 | qdir_exit: |
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 69f3595d3952..fbe486c285a9 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h | |||
@@ -573,6 +573,12 @@ struct copychunk_ioctl { | |||
573 | __u32 Reserved2; | 573 | __u32 Reserved2; |
574 | } __packed; | 574 | } __packed; |
575 | 575 | ||
576 | /* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */ | ||
577 | struct file_zero_data_information { | ||
578 | __le64 FileOffset; | ||
579 | __le64 BeyondFinalZero; | ||
580 | } __packed; | ||
581 | |||
576 | struct copychunk_ioctl_rsp { | 582 | struct copychunk_ioctl_rsp { |
577 | __le32 ChunksWritten; | 583 | __le32 ChunksWritten; |
578 | __le32 ChunkBytesWritten; | 584 | __le32 ChunkBytesWritten; |
diff --git a/fs/cifs/smbfsctl.h b/fs/cifs/smbfsctl.h index 0e538b5c9622..83efa59535be 100644 --- a/fs/cifs/smbfsctl.h +++ b/fs/cifs/smbfsctl.h | |||
@@ -63,7 +63,7 @@ | |||
63 | #define FSCTL_SET_OBJECT_ID_EXTENDED 0x000900BC /* BB add struct */ | 63 | #define FSCTL_SET_OBJECT_ID_EXTENDED 0x000900BC /* BB add struct */ |
64 | #define FSCTL_CREATE_OR_GET_OBJECT_ID 0x000900C0 /* BB add struct */ | 64 | #define FSCTL_CREATE_OR_GET_OBJECT_ID 0x000900C0 /* BB add struct */ |
65 | #define FSCTL_SET_SPARSE 0x000900C4 /* BB add struct */ | 65 | #define FSCTL_SET_SPARSE 0x000900C4 /* BB add struct */ |
66 | #define FSCTL_SET_ZERO_DATA 0x000900C8 /* BB add struct */ | 66 | #define FSCTL_SET_ZERO_DATA 0x000980C8 |
67 | #define FSCTL_SET_ENCRYPTION 0x000900D7 /* BB add struct */ | 67 | #define FSCTL_SET_ENCRYPTION 0x000900D7 /* BB add struct */ |
68 | #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB /* BB add struct */ | 68 | #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB /* BB add struct */ |
69 | #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF /* BB add struct */ | 69 | #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF /* BB add struct */ |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 08cdfe5461e3..622e88249024 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -2828,8 +2828,9 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
2828 | */ | 2828 | */ |
2829 | overhead += ngroups * (2 + sbi->s_itb_per_group); | 2829 | overhead += ngroups * (2 + sbi->s_itb_per_group); |
2830 | 2830 | ||
2831 | /* Add the journal blocks as well */ | 2831 | /* Add the internal journal blocks as well */ |
2832 | overhead += sbi->s_journal->j_maxlen; | 2832 | if (sbi->s_journal && !sbi->journal_bdev) |
2833 | overhead += sbi->s_journal->j_maxlen; | ||
2833 | 2834 | ||
2834 | sbi->s_overhead_last = overhead; | 2835 | sbi->s_overhead_last = overhead; |
2835 | smp_wmb(); | 2836 | smp_wmb(); |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 4556ce1af5b0..5ddaf8625d3b 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -61,7 +61,7 @@ static void isofs_put_super(struct super_block *sb) | |||
61 | return; | 61 | return; |
62 | } | 62 | } |
63 | 63 | ||
64 | static int isofs_read_inode(struct inode *); | 64 | static int isofs_read_inode(struct inode *, int relocated); |
65 | static int isofs_statfs (struct dentry *, struct kstatfs *); | 65 | static int isofs_statfs (struct dentry *, struct kstatfs *); |
66 | 66 | ||
67 | static struct kmem_cache *isofs_inode_cachep; | 67 | static struct kmem_cache *isofs_inode_cachep; |
@@ -1259,7 +1259,7 @@ out_toomany: | |||
1259 | goto out; | 1259 | goto out; |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | static int isofs_read_inode(struct inode *inode) | 1262 | static int isofs_read_inode(struct inode *inode, int relocated) |
1263 | { | 1263 | { |
1264 | struct super_block *sb = inode->i_sb; | 1264 | struct super_block *sb = inode->i_sb; |
1265 | struct isofs_sb_info *sbi = ISOFS_SB(sb); | 1265 | struct isofs_sb_info *sbi = ISOFS_SB(sb); |
@@ -1404,7 +1404,7 @@ static int isofs_read_inode(struct inode *inode) | |||
1404 | */ | 1404 | */ |
1405 | 1405 | ||
1406 | if (!high_sierra) { | 1406 | if (!high_sierra) { |
1407 | parse_rock_ridge_inode(de, inode); | 1407 | parse_rock_ridge_inode(de, inode, relocated); |
1408 | /* if we want uid/gid set, override the rock ridge setting */ | 1408 | /* if we want uid/gid set, override the rock ridge setting */ |
1409 | if (sbi->s_uid_set) | 1409 | if (sbi->s_uid_set) |
1410 | inode->i_uid = sbi->s_uid; | 1410 | inode->i_uid = sbi->s_uid; |
@@ -1483,9 +1483,10 @@ static int isofs_iget5_set(struct inode *ino, void *data) | |||
1483 | * offset that point to the underlying meta-data for the inode. The | 1483 | * offset that point to the underlying meta-data for the inode. The |
1484 | * code below is otherwise similar to the iget() code in | 1484 | * code below is otherwise similar to the iget() code in |
1485 | * include/linux/fs.h */ | 1485 | * include/linux/fs.h */ |
1486 | struct inode *isofs_iget(struct super_block *sb, | 1486 | struct inode *__isofs_iget(struct super_block *sb, |
1487 | unsigned long block, | 1487 | unsigned long block, |
1488 | unsigned long offset) | 1488 | unsigned long offset, |
1489 | int relocated) | ||
1489 | { | 1490 | { |
1490 | unsigned long hashval; | 1491 | unsigned long hashval; |
1491 | struct inode *inode; | 1492 | struct inode *inode; |
@@ -1507,7 +1508,7 @@ struct inode *isofs_iget(struct super_block *sb, | |||
1507 | return ERR_PTR(-ENOMEM); | 1508 | return ERR_PTR(-ENOMEM); |
1508 | 1509 | ||
1509 | if (inode->i_state & I_NEW) { | 1510 | if (inode->i_state & I_NEW) { |
1510 | ret = isofs_read_inode(inode); | 1511 | ret = isofs_read_inode(inode, relocated); |
1511 | if (ret < 0) { | 1512 | if (ret < 0) { |
1512 | iget_failed(inode); | 1513 | iget_failed(inode); |
1513 | inode = ERR_PTR(ret); | 1514 | inode = ERR_PTR(ret); |
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index 99167238518d..0ac4c1f73fbd 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h | |||
@@ -107,7 +107,7 @@ extern int iso_date(char *, int); | |||
107 | 107 | ||
108 | struct inode; /* To make gcc happy */ | 108 | struct inode; /* To make gcc happy */ |
109 | 109 | ||
110 | extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *); | 110 | extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *, int relocated); |
111 | extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *); | 111 | extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *); |
112 | extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *); | 112 | extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *); |
113 | 113 | ||
@@ -118,9 +118,24 @@ extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned int | |||
118 | extern struct buffer_head *isofs_bread(struct inode *, sector_t); | 118 | extern struct buffer_head *isofs_bread(struct inode *, sector_t); |
119 | extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long); | 119 | extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long); |
120 | 120 | ||
121 | extern struct inode *isofs_iget(struct super_block *sb, | 121 | struct inode *__isofs_iget(struct super_block *sb, |
122 | unsigned long block, | 122 | unsigned long block, |
123 | unsigned long offset); | 123 | unsigned long offset, |
124 | int relocated); | ||
125 | |||
126 | static inline struct inode *isofs_iget(struct super_block *sb, | ||
127 | unsigned long block, | ||
128 | unsigned long offset) | ||
129 | { | ||
130 | return __isofs_iget(sb, block, offset, 0); | ||
131 | } | ||
132 | |||
133 | static inline struct inode *isofs_iget_reloc(struct super_block *sb, | ||
134 | unsigned long block, | ||
135 | unsigned long offset) | ||
136 | { | ||
137 | return __isofs_iget(sb, block, offset, 1); | ||
138 | } | ||
124 | 139 | ||
125 | /* Because the inode number is no longer relevant to finding the | 140 | /* Because the inode number is no longer relevant to finding the |
126 | * underlying meta-data for an inode, we are free to choose a more | 141 | * underlying meta-data for an inode, we are free to choose a more |
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index c0bf42472e40..f488bbae541a 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c | |||
@@ -288,12 +288,16 @@ eio: | |||
288 | goto out; | 288 | goto out; |
289 | } | 289 | } |
290 | 290 | ||
291 | #define RR_REGARD_XA 1 | ||
292 | #define RR_RELOC_DE 2 | ||
293 | |||
291 | static int | 294 | static int |
292 | parse_rock_ridge_inode_internal(struct iso_directory_record *de, | 295 | parse_rock_ridge_inode_internal(struct iso_directory_record *de, |
293 | struct inode *inode, int regard_xa) | 296 | struct inode *inode, int flags) |
294 | { | 297 | { |
295 | int symlink_len = 0; | 298 | int symlink_len = 0; |
296 | int cnt, sig; | 299 | int cnt, sig; |
300 | unsigned int reloc_block; | ||
297 | struct inode *reloc; | 301 | struct inode *reloc; |
298 | struct rock_ridge *rr; | 302 | struct rock_ridge *rr; |
299 | int rootflag; | 303 | int rootflag; |
@@ -305,7 +309,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de, | |||
305 | 309 | ||
306 | init_rock_state(&rs, inode); | 310 | init_rock_state(&rs, inode); |
307 | setup_rock_ridge(de, inode, &rs); | 311 | setup_rock_ridge(de, inode, &rs); |
308 | if (regard_xa) { | 312 | if (flags & RR_REGARD_XA) { |
309 | rs.chr += 14; | 313 | rs.chr += 14; |
310 | rs.len -= 14; | 314 | rs.len -= 14; |
311 | if (rs.len < 0) | 315 | if (rs.len < 0) |
@@ -485,12 +489,22 @@ repeat: | |||
485 | "relocated directory\n"); | 489 | "relocated directory\n"); |
486 | goto out; | 490 | goto out; |
487 | case SIG('C', 'L'): | 491 | case SIG('C', 'L'): |
488 | ISOFS_I(inode)->i_first_extent = | 492 | if (flags & RR_RELOC_DE) { |
489 | isonum_733(rr->u.CL.location); | 493 | printk(KERN_ERR |
490 | reloc = | 494 | "ISOFS: Recursive directory relocation " |
491 | isofs_iget(inode->i_sb, | 495 | "is not supported\n"); |
492 | ISOFS_I(inode)->i_first_extent, | 496 | goto eio; |
493 | 0); | 497 | } |
498 | reloc_block = isonum_733(rr->u.CL.location); | ||
499 | if (reloc_block == ISOFS_I(inode)->i_iget5_block && | ||
500 | ISOFS_I(inode)->i_iget5_offset == 0) { | ||
501 | printk(KERN_ERR | ||
502 | "ISOFS: Directory relocation points to " | ||
503 | "itself\n"); | ||
504 | goto eio; | ||
505 | } | ||
506 | ISOFS_I(inode)->i_first_extent = reloc_block; | ||
507 | reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0); | ||
494 | if (IS_ERR(reloc)) { | 508 | if (IS_ERR(reloc)) { |
495 | ret = PTR_ERR(reloc); | 509 | ret = PTR_ERR(reloc); |
496 | goto out; | 510 | goto out; |
@@ -637,9 +651,11 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) | |||
637 | return rpnt; | 651 | return rpnt; |
638 | } | 652 | } |
639 | 653 | ||
640 | int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) | 654 | int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode, |
655 | int relocated) | ||
641 | { | 656 | { |
642 | int result = parse_rock_ridge_inode_internal(de, inode, 0); | 657 | int flags = relocated ? RR_RELOC_DE : 0; |
658 | int result = parse_rock_ridge_inode_internal(de, inode, flags); | ||
643 | 659 | ||
644 | /* | 660 | /* |
645 | * if rockridge flag was reset and we didn't look for attributes | 661 | * if rockridge flag was reset and we didn't look for attributes |
@@ -647,7 +663,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) | |||
647 | */ | 663 | */ |
648 | if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1) | 664 | if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1) |
649 | && (ISOFS_SB(inode->i_sb)->s_rock == 2)) { | 665 | && (ISOFS_SB(inode->i_sb)->s_rock == 2)) { |
650 | result = parse_rock_ridge_inode_internal(de, inode, 14); | 666 | result = parse_rock_ridge_inode_internal(de, inode, |
667 | flags | RR_REGARD_XA); | ||
651 | } | 668 | } |
652 | return result; | 669 | return result; |
653 | } | 670 | } |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 9737cba1357d..83a06001742b 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -1014,7 +1014,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1014 | 1014 | ||
1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1016 | if (!fi) | 1016 | if (!fi) |
1017 | goto out_no_entry; | 1017 | goto out_fail; |
1018 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); | 1018 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); |
1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | 1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
1020 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { | 1020 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { |
@@ -1036,6 +1036,7 @@ out: | |||
1036 | 1036 | ||
1037 | out_no_entry: | 1037 | out_no_entry: |
1038 | up_write(&iinfo->i_data_sem); | 1038 | up_write(&iinfo->i_data_sem); |
1039 | out_fail: | ||
1039 | inode_dec_link_count(inode); | 1040 | inode_dec_link_count(inode); |
1040 | iput(inode); | 1041 | iput(inode); |
1041 | goto out; | 1042 | goto out; |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index ea507665896c..a95efeb53a8b 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -577,16 +577,20 @@ static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node | |||
577 | } | 577 | } |
578 | #endif /* CONFIG_OF */ | 578 | #endif /* CONFIG_OF */ |
579 | 579 | ||
580 | #ifdef CONFIG_I2C_ACPI | 580 | #ifdef CONFIG_ACPI |
581 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter); | ||
582 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter); | ||
583 | void acpi_i2c_register_devices(struct i2c_adapter *adap); | 581 | void acpi_i2c_register_devices(struct i2c_adapter *adap); |
584 | #else | 582 | #else |
585 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | 583 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } |
584 | #endif /* CONFIG_ACPI */ | ||
585 | |||
586 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
587 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter); | ||
588 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter); | ||
589 | #else | ||
586 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | 590 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) |
587 | { } | 591 | { } |
588 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | 592 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) |
589 | { return 0; } | 593 | { return 0; } |
590 | #endif | 594 | #endif /* CONFIG_ACPI_I2C_OPREGION */ |
591 | 595 | ||
592 | #endif /* _LINUX_I2C_H */ | 596 | #endif /* _LINUX_I2C_H */ |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 36badba2dcec..99d7d7fecaad 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -50,6 +50,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); | |||
50 | #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) | 50 | #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) |
51 | 51 | ||
52 | #define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) | 52 | #define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) |
53 | #define is_cherryview(codec) ((codec)->vendor_id == 0x80862883) | ||
54 | #define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) | ||
53 | 55 | ||
54 | struct hdmi_spec_per_cvt { | 56 | struct hdmi_spec_per_cvt { |
55 | hda_nid_t cvt_nid; | 57 | hda_nid_t cvt_nid; |
@@ -1459,7 +1461,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, | |||
1459 | mux_idx); | 1461 | mux_idx); |
1460 | 1462 | ||
1461 | /* configure unused pins to choose other converters */ | 1463 | /* configure unused pins to choose other converters */ |
1462 | if (is_haswell_plus(codec) || is_valleyview(codec)) | 1464 | if (is_haswell_plus(codec) || is_valleyview_plus(codec)) |
1463 | intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx); | 1465 | intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx); |
1464 | 1466 | ||
1465 | snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); | 1467 | snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); |
@@ -1598,7 +1600,8 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
1598 | * and this can make HW reset converter selection on a pin. | 1600 | * and this can make HW reset converter selection on a pin. |
1599 | */ | 1601 | */ |
1600 | if (eld->eld_valid && !old_eld_valid && per_pin->setup) { | 1602 | if (eld->eld_valid && !old_eld_valid && per_pin->setup) { |
1601 | if (is_haswell_plus(codec) || is_valleyview(codec)) { | 1603 | if (is_haswell_plus(codec) || |
1604 | is_valleyview_plus(codec)) { | ||
1602 | intel_verify_pin_cvt_connect(codec, per_pin); | 1605 | intel_verify_pin_cvt_connect(codec, per_pin); |
1603 | intel_not_share_assigned_cvt(codec, pin_nid, | 1606 | intel_not_share_assigned_cvt(codec, pin_nid, |
1604 | per_pin->mux_idx); | 1607 | per_pin->mux_idx); |
@@ -1779,7 +1782,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1779 | bool non_pcm; | 1782 | bool non_pcm; |
1780 | int pinctl; | 1783 | int pinctl; |
1781 | 1784 | ||
1782 | if (is_haswell_plus(codec) || is_valleyview(codec)) { | 1785 | if (is_haswell_plus(codec) || is_valleyview_plus(codec)) { |
1783 | /* Verify pin:cvt selections to avoid silent audio after S3. | 1786 | /* Verify pin:cvt selections to avoid silent audio after S3. |
1784 | * After S3, the audio driver restores pin:cvt selections | 1787 | * After S3, the audio driver restores pin:cvt selections |
1785 | * but this can happen before gfx is ready and such selection | 1788 | * but this can happen before gfx is ready and such selection |
@@ -2330,9 +2333,8 @@ static int patch_generic_hdmi(struct hda_codec *codec) | |||
2330 | intel_haswell_fixup_enable_dp12(codec); | 2333 | intel_haswell_fixup_enable_dp12(codec); |
2331 | } | 2334 | } |
2332 | 2335 | ||
2333 | if (is_haswell(codec) || is_valleyview(codec)) { | 2336 | if (is_haswell_plus(codec) || is_valleyview_plus(codec)) |
2334 | codec->depop_delay = 0; | 2337 | codec->depop_delay = 0; |
2335 | } | ||
2336 | 2338 | ||
2337 | if (hdmi_parse_codec(codec) < 0) { | 2339 | if (hdmi_parse_codec(codec) < 0) { |
2338 | codec->spec = NULL; | 2340 | codec->spec = NULL; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6b38ec3c6e57..d71270a3f73f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -181,6 +181,8 @@ static void alc_fix_pll(struct hda_codec *codec) | |||
181 | spec->pll_coef_idx); | 181 | spec->pll_coef_idx); |
182 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | 182 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
183 | AC_VERB_GET_PROC_COEF, 0); | 183 | AC_VERB_GET_PROC_COEF, 0); |
184 | if (val == -1) | ||
185 | return; | ||
184 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | 186 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
185 | spec->pll_coef_idx); | 187 | spec->pll_coef_idx); |
186 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | 188 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
@@ -2806,6 +2808,8 @@ static void alc286_shutup(struct hda_codec *codec) | |||
2806 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) | 2808 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
2807 | { | 2809 | { |
2808 | int val = alc_read_coef_idx(codec, 0x04); | 2810 | int val = alc_read_coef_idx(codec, 0x04); |
2811 | if (val == -1) | ||
2812 | return; | ||
2809 | if (power_up) | 2813 | if (power_up) |
2810 | val |= 1 << 11; | 2814 | val |= 1 << 11; |
2811 | else | 2815 | else |
@@ -3264,6 +3268,15 @@ static int alc269_resume(struct hda_codec *codec) | |||
3264 | snd_hda_codec_resume_cache(codec); | 3268 | snd_hda_codec_resume_cache(codec); |
3265 | alc_inv_dmic_sync(codec, true); | 3269 | alc_inv_dmic_sync(codec, true); |
3266 | hda_call_check_power_status(codec, 0x01); | 3270 | hda_call_check_power_status(codec, 0x01); |
3271 | |||
3272 | /* on some machine, the BIOS will clear the codec gpio data when enter | ||
3273 | * suspend, and won't restore the data after resume, so we restore it | ||
3274 | * in the driver. | ||
3275 | */ | ||
3276 | if (spec->gpio_led) | ||
3277 | snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, | ||
3278 | spec->gpio_led); | ||
3279 | |||
3267 | if (spec->has_alc5505_dsp) | 3280 | if (spec->has_alc5505_dsp) |
3268 | alc5505_dsp_resume(codec); | 3281 | alc5505_dsp_resume(codec); |
3269 | 3282 | ||
@@ -5311,27 +5324,30 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
5311 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { | 5324 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
5312 | val = alc_read_coef_idx(codec, 0x04); | 5325 | val = alc_read_coef_idx(codec, 0x04); |
5313 | /* Power up output pin */ | 5326 | /* Power up output pin */ |
5314 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | 5327 | if (val != -1) |
5328 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | ||
5315 | } | 5329 | } |
5316 | 5330 | ||
5317 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { | 5331 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
5318 | val = alc_read_coef_idx(codec, 0xd); | 5332 | val = alc_read_coef_idx(codec, 0xd); |
5319 | if ((val & 0x0c00) >> 10 != 0x1) { | 5333 | if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { |
5320 | /* Capless ramp up clock control */ | 5334 | /* Capless ramp up clock control */ |
5321 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); | 5335 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
5322 | } | 5336 | } |
5323 | val = alc_read_coef_idx(codec, 0x17); | 5337 | val = alc_read_coef_idx(codec, 0x17); |
5324 | if ((val & 0x01c0) >> 6 != 0x4) { | 5338 | if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { |
5325 | /* Class D power on reset */ | 5339 | /* Class D power on reset */ |
5326 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); | 5340 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
5327 | } | 5341 | } |
5328 | } | 5342 | } |
5329 | 5343 | ||
5330 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ | 5344 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
5331 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | 5345 | if (val != -1) |
5346 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); | ||
5332 | 5347 | ||
5333 | val = alc_read_coef_idx(codec, 0x4); /* HP */ | 5348 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
5334 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | 5349 | if (val != -1) |
5350 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | ||
5335 | } | 5351 | } |
5336 | 5352 | ||
5337 | /* | 5353 | /* |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index bd41ee4da078..2c71f16bd661 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -1278,6 +1278,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
1278 | else | 1278 | else |
1279 | rates = &arizona_48k_bclk_rates[0]; | 1279 | rates = &arizona_48k_bclk_rates[0]; |
1280 | 1280 | ||
1281 | wl = snd_pcm_format_width(params_format(params)); | ||
1282 | |||
1281 | if (tdm_slots) { | 1283 | if (tdm_slots) { |
1282 | arizona_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n", | 1284 | arizona_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n", |
1283 | tdm_slots, tdm_width); | 1285 | tdm_slots, tdm_width); |
@@ -1285,6 +1287,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
1285 | channels = tdm_slots; | 1287 | channels = tdm_slots; |
1286 | } else { | 1288 | } else { |
1287 | bclk_target = snd_soc_params_to_bclk(params); | 1289 | bclk_target = snd_soc_params_to_bclk(params); |
1290 | tdm_width = wl; | ||
1288 | } | 1291 | } |
1289 | 1292 | ||
1290 | if (chan_limit && chan_limit < channels) { | 1293 | if (chan_limit && chan_limit < channels) { |
@@ -1319,8 +1322,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
1319 | arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", | 1322 | arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", |
1320 | rates[bclk], rates[bclk] / lrclk); | 1323 | rates[bclk], rates[bclk] / lrclk); |
1321 | 1324 | ||
1322 | wl = snd_pcm_format_width(params_format(params)); | 1325 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | tdm_width; |
1323 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl; | ||
1324 | 1326 | ||
1325 | reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); | 1327 | reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); |
1326 | 1328 | ||
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index 163ec3855fd4..0c8aefab404c 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c | |||
@@ -259,13 +259,13 @@ static const struct soc_enum pcm512x_veds = | |||
259 | pcm512x_ramp_step_text); | 259 | pcm512x_ramp_step_text); |
260 | 260 | ||
261 | static const struct snd_kcontrol_new pcm512x_controls[] = { | 261 | static const struct snd_kcontrol_new pcm512x_controls[] = { |
262 | SOC_DOUBLE_R_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2, | 262 | SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2, |
263 | PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv), | 263 | PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv), |
264 | SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL, | 264 | SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL, |
265 | PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv), | 265 | PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv), |
266 | SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST, | 266 | SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST, |
267 | PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv), | 267 | PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv), |
268 | SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT, | 268 | SOC_DOUBLE("Digital Playback Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT, |
269 | PCM512x_RQMR_SHIFT, 1, 1), | 269 | PCM512x_RQMR_SHIFT, 1, 1), |
270 | 270 | ||
271 | SOC_SINGLE("Deemphasis Switch", PCM512x_DSP, PCM512x_DEMP_SHIFT, 1, 1), | 271 | SOC_SINGLE("Deemphasis Switch", PCM512x_DSP, PCM512x_DEMP_SHIFT, 1, 1), |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c28508da34cf..6a6b2ff7d7d7 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -403,7 +403,8 @@ out: | |||
403 | return ret; | 403 | return ret; |
404 | } | 404 | } |
405 | 405 | ||
406 | static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) | 406 | static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, |
407 | int div, bool explicit) | ||
407 | { | 408 | { |
408 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); | 409 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); |
409 | 410 | ||
@@ -420,7 +421,8 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
420 | ACLKXDIV(div - 1), ACLKXDIV_MASK); | 421 | ACLKXDIV(div - 1), ACLKXDIV_MASK); |
421 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, | 422 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, |
422 | ACLKRDIV(div - 1), ACLKRDIV_MASK); | 423 | ACLKRDIV(div - 1), ACLKRDIV_MASK); |
423 | mcasp->bclk_div = div; | 424 | if (explicit) |
425 | mcasp->bclk_div = div; | ||
424 | break; | 426 | break; |
425 | 427 | ||
426 | case 2: /* BCLK/LRCLK ratio */ | 428 | case 2: /* BCLK/LRCLK ratio */ |
@@ -434,6 +436,12 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
434 | return 0; | 436 | return 0; |
435 | } | 437 | } |
436 | 438 | ||
439 | static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, | ||
440 | int div) | ||
441 | { | ||
442 | return __davinci_mcasp_set_clkdiv(dai, div_id, div, 1); | ||
443 | } | ||
444 | |||
437 | static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, | 445 | static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
438 | unsigned int freq, int dir) | 446 | unsigned int freq, int dir) |
439 | { | 447 | { |
@@ -738,7 +746,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
738 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", | 746 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", |
739 | mcasp->sysclk_freq, div, bclk_freq); | 747 | mcasp->sysclk_freq, div, bclk_freq); |
740 | } | 748 | } |
741 | davinci_mcasp_set_clkdiv(cpu_dai, 1, div); | 749 | __davinci_mcasp_set_clkdiv(cpu_dai, 1, div, 0); |
742 | } | 750 | } |
743 | 751 | ||
744 | ret = mcasp_common_hw_param(mcasp, substream->stream, | 752 | ret = mcasp_common_hw_param(mcasp, substream->stream, |
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index f54a8fc99291..f3012b645b51 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -49,7 +49,6 @@ config SND_SOC_FSL_ESAI | |||
49 | tristate "Enhanced Serial Audio Interface (ESAI) module support" | 49 | tristate "Enhanced Serial Audio Interface (ESAI) module support" |
50 | select REGMAP_MMIO | 50 | select REGMAP_MMIO |
51 | select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n | 51 | select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n |
52 | select SND_SOC_FSL_UTILS | ||
53 | help | 52 | help |
54 | Say Y if you want to add Enhanced Synchronous Audio Interface | 53 | Say Y if you want to add Enhanced Synchronous Audio Interface |
55 | (ESAI) support for the Freescale CPUs. | 54 | (ESAI) support for the Freescale CPUs. |
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 72d154e7dd03..a3b29ed84963 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #include "fsl_esai.h" | 19 | #include "fsl_esai.h" |
20 | #include "imx-pcm.h" | 20 | #include "imx-pcm.h" |
21 | #include "fsl_utils.h" | ||
22 | 21 | ||
23 | #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000 | 22 | #define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000 |
24 | #define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ | 23 | #define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ |
@@ -607,7 +606,6 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = { | |||
607 | .hw_params = fsl_esai_hw_params, | 606 | .hw_params = fsl_esai_hw_params, |
608 | .set_sysclk = fsl_esai_set_dai_sysclk, | 607 | .set_sysclk = fsl_esai_set_dai_sysclk, |
609 | .set_fmt = fsl_esai_set_dai_fmt, | 608 | .set_fmt = fsl_esai_set_dai_fmt, |
610 | .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask, | ||
611 | .set_tdm_slot = fsl_esai_set_dai_tdm_slot, | 609 | .set_tdm_slot = fsl_esai_set_dai_tdm_slot, |
612 | }; | 610 | }; |
613 | 611 | ||
diff --git a/sound/soc/intel/sst-acpi.c b/sound/soc/intel/sst-acpi.c index 42edc6f4fc4a..03d0a166b635 100644 --- a/sound/soc/intel/sst-acpi.c +++ b/sound/soc/intel/sst-acpi.c | |||
@@ -246,8 +246,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = { | |||
246 | }; | 246 | }; |
247 | 247 | ||
248 | static struct sst_acpi_mach baytrail_machines[] = { | 248 | static struct sst_acpi_mach baytrail_machines[] = { |
249 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-i2s_master" }, | 249 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, |
250 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-i2s_master" }, | 250 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, |
251 | {} | 251 | {} |
252 | }; | 252 | }; |
253 | 253 | ||
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c index 67673a2c0f41..b4ad98c43e5c 100644 --- a/sound/soc/intel/sst-baytrail-ipc.c +++ b/sound/soc/intel/sst-baytrail-ipc.c | |||
@@ -817,7 +817,7 @@ static struct sst_dsp_device byt_dev = { | |||
817 | .ops = &sst_byt_ops, | 817 | .ops = &sst_byt_ops, |
818 | }; | 818 | }; |
819 | 819 | ||
820 | int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata) | 820 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata) |
821 | { | 821 | { |
822 | struct sst_byt *byt = pdata->dsp; | 822 | struct sst_byt *byt = pdata->dsp; |
823 | 823 | ||
@@ -826,14 +826,6 @@ int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata) | |||
826 | sst_byt_drop_all(byt); | 826 | sst_byt_drop_all(byt); |
827 | dev_dbg(byt->dev, "dsp in reset\n"); | 827 | dev_dbg(byt->dev, "dsp in reset\n"); |
828 | 828 | ||
829 | return 0; | ||
830 | } | ||
831 | EXPORT_SYMBOL_GPL(sst_byt_dsp_suspend_noirq); | ||
832 | |||
833 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata) | ||
834 | { | ||
835 | struct sst_byt *byt = pdata->dsp; | ||
836 | |||
837 | dev_dbg(byt->dev, "free all blocks and unload fw\n"); | 829 | dev_dbg(byt->dev, "free all blocks and unload fw\n"); |
838 | sst_fw_unload(byt->fw); | 830 | sst_fw_unload(byt->fw); |
839 | 831 | ||
diff --git a/sound/soc/intel/sst-baytrail-ipc.h b/sound/soc/intel/sst-baytrail-ipc.h index 06a4d202689b..8faff6dcf25d 100644 --- a/sound/soc/intel/sst-baytrail-ipc.h +++ b/sound/soc/intel/sst-baytrail-ipc.h | |||
@@ -66,7 +66,6 @@ int sst_byt_get_dsp_position(struct sst_byt *byt, | |||
66 | int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata); | 66 | int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata); |
67 | void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata); | 67 | void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata); |
68 | struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt); | 68 | struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt); |
69 | int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata); | ||
70 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata); | 69 | int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata); |
71 | int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata); | 70 | int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata); |
72 | int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata); | 71 | int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata); |
diff --git a/sound/soc/intel/sst-baytrail-pcm.c b/sound/soc/intel/sst-baytrail-pcm.c index 599401c0c655..eab1c7d85187 100644 --- a/sound/soc/intel/sst-baytrail-pcm.c +++ b/sound/soc/intel/sst-baytrail-pcm.c | |||
@@ -59,6 +59,9 @@ struct sst_byt_priv_data { | |||
59 | 59 | ||
60 | /* DAI data */ | 60 | /* DAI data */ |
61 | struct sst_byt_pcm_data pcm[BYT_PCM_COUNT]; | 61 | struct sst_byt_pcm_data pcm[BYT_PCM_COUNT]; |
62 | |||
63 | /* flag indicating is stream context restore needed after suspend */ | ||
64 | bool restore_stream; | ||
62 | }; | 65 | }; |
63 | 66 | ||
64 | /* this may get called several times by oss emulation */ | 67 | /* this may get called several times by oss emulation */ |
@@ -184,7 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
184 | sst_byt_stream_start(byt, pcm_data->stream, 0); | 187 | sst_byt_stream_start(byt, pcm_data->stream, 0); |
185 | break; | 188 | break; |
186 | case SNDRV_PCM_TRIGGER_RESUME: | 189 | case SNDRV_PCM_TRIGGER_RESUME: |
187 | schedule_work(&pcm_data->work); | 190 | if (pdata->restore_stream == true) |
191 | schedule_work(&pcm_data->work); | ||
192 | else | ||
193 | sst_byt_stream_resume(byt, pcm_data->stream); | ||
188 | break; | 194 | break; |
189 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 195 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
190 | sst_byt_stream_resume(byt, pcm_data->stream); | 196 | sst_byt_stream_resume(byt, pcm_data->stream); |
@@ -193,6 +199,7 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
193 | sst_byt_stream_stop(byt, pcm_data->stream); | 199 | sst_byt_stream_stop(byt, pcm_data->stream); |
194 | break; | 200 | break; |
195 | case SNDRV_PCM_TRIGGER_SUSPEND: | 201 | case SNDRV_PCM_TRIGGER_SUSPEND: |
202 | pdata->restore_stream = false; | ||
196 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 203 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
197 | sst_byt_stream_pause(byt, pcm_data->stream); | 204 | sst_byt_stream_pause(byt, pcm_data->stream); |
198 | break; | 205 | break; |
@@ -404,26 +411,10 @@ static const struct snd_soc_component_driver byt_dai_component = { | |||
404 | }; | 411 | }; |
405 | 412 | ||
406 | #ifdef CONFIG_PM | 413 | #ifdef CONFIG_PM |
407 | static int sst_byt_pcm_dev_suspend_noirq(struct device *dev) | ||
408 | { | ||
409 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | ||
410 | int ret; | ||
411 | |||
412 | dev_dbg(dev, "suspending noirq\n"); | ||
413 | |||
414 | /* at this point all streams will be stopped and context saved */ | ||
415 | ret = sst_byt_dsp_suspend_noirq(dev, sst_pdata); | ||
416 | if (ret < 0) { | ||
417 | dev_err(dev, "failed to suspend %d\n", ret); | ||
418 | return ret; | ||
419 | } | ||
420 | |||
421 | return ret; | ||
422 | } | ||
423 | |||
424 | static int sst_byt_pcm_dev_suspend_late(struct device *dev) | 414 | static int sst_byt_pcm_dev_suspend_late(struct device *dev) |
425 | { | 415 | { |
426 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | 416 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); |
417 | struct sst_byt_priv_data *priv_data = dev_get_drvdata(dev); | ||
427 | int ret; | 418 | int ret; |
428 | 419 | ||
429 | dev_dbg(dev, "suspending late\n"); | 420 | dev_dbg(dev, "suspending late\n"); |
@@ -434,34 +425,30 @@ static int sst_byt_pcm_dev_suspend_late(struct device *dev) | |||
434 | return ret; | 425 | return ret; |
435 | } | 426 | } |
436 | 427 | ||
428 | priv_data->restore_stream = true; | ||
429 | |||
437 | return ret; | 430 | return ret; |
438 | } | 431 | } |
439 | 432 | ||
440 | static int sst_byt_pcm_dev_resume_early(struct device *dev) | 433 | static int sst_byt_pcm_dev_resume_early(struct device *dev) |
441 | { | 434 | { |
442 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | 435 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); |
436 | int ret; | ||
443 | 437 | ||
444 | dev_dbg(dev, "resume early\n"); | 438 | dev_dbg(dev, "resume early\n"); |
445 | 439 | ||
446 | /* load fw and boot DSP */ | 440 | /* load fw and boot DSP */ |
447 | return sst_byt_dsp_boot(dev, sst_pdata); | 441 | ret = sst_byt_dsp_boot(dev, sst_pdata); |
448 | } | 442 | if (ret) |
449 | 443 | return ret; | |
450 | static int sst_byt_pcm_dev_resume(struct device *dev) | ||
451 | { | ||
452 | struct sst_pdata *sst_pdata = dev_get_platdata(dev); | ||
453 | |||
454 | dev_dbg(dev, "resume\n"); | ||
455 | 444 | ||
456 | /* wait for FW to finish booting */ | 445 | /* wait for FW to finish booting */ |
457 | return sst_byt_dsp_wait_for_ready(dev, sst_pdata); | 446 | return sst_byt_dsp_wait_for_ready(dev, sst_pdata); |
458 | } | 447 | } |
459 | 448 | ||
460 | static const struct dev_pm_ops sst_byt_pm_ops = { | 449 | static const struct dev_pm_ops sst_byt_pm_ops = { |
461 | .suspend_noirq = sst_byt_pcm_dev_suspend_noirq, | ||
462 | .suspend_late = sst_byt_pcm_dev_suspend_late, | 450 | .suspend_late = sst_byt_pcm_dev_suspend_late, |
463 | .resume_early = sst_byt_pcm_dev_resume_early, | 451 | .resume_early = sst_byt_pcm_dev_resume_early, |
464 | .resume = sst_byt_pcm_dev_resume, | ||
465 | }; | 452 | }; |
466 | 453 | ||
467 | #define SST_BYT_PM_OPS (&sst_byt_pm_ops) | 454 | #define SST_BYT_PM_OPS (&sst_byt_pm_ops) |
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 0109f6c2334e..a8e097433074 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c | |||
@@ -765,9 +765,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai) | |||
765 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ | 765 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ |
766 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | 766 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) |
767 | 767 | ||
768 | #define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ | 768 | #define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) |
769 | SNDRV_PCM_FMTBIT_S24_LE | \ | ||
770 | SNDRV_PCM_FMTBIT_S32_LE) | ||
771 | 769 | ||
772 | static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { | 770 | static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { |
773 | .startup = pxa_ssp_startup, | 771 | .startup = pxa_ssp_startup, |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8348352dc2c6..177bd8639ef9 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -2860,12 +2860,14 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
2860 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 2860 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); |
2861 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 2861 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
2862 | unsigned int reg_val, val; | 2862 | unsigned int reg_val, val; |
2863 | int ret = 0; | ||
2864 | 2863 | ||
2865 | if (e->reg != SND_SOC_NOPM) | 2864 | if (e->reg != SND_SOC_NOPM) { |
2866 | ret = soc_dapm_read(dapm, e->reg, ®_val); | 2865 | int ret = soc_dapm_read(dapm, e->reg, ®_val); |
2867 | else | 2866 | if (ret) |
2867 | return ret; | ||
2868 | } else { | ||
2868 | reg_val = dapm_kcontrol_get_value(kcontrol); | 2869 | reg_val = dapm_kcontrol_get_value(kcontrol); |
2870 | } | ||
2869 | 2871 | ||
2870 | val = (reg_val >> e->shift_l) & e->mask; | 2872 | val = (reg_val >> e->shift_l) & e->mask; |
2871 | ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); | 2873 | ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); |
@@ -2875,7 +2877,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
2875 | ucontrol->value.enumerated.item[1] = val; | 2877 | ucontrol->value.enumerated.item[1] = val; |
2876 | } | 2878 | } |
2877 | 2879 | ||
2878 | return ret; | 2880 | return 0; |
2879 | } | 2881 | } |
2880 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); | 2882 | EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); |
2881 | 2883 | ||
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index bf06577fea51..5819a2708d7e 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -526,8 +526,10 @@ static int assign_guest_irq(struct kvm *kvm, | |||
526 | dev->irq_requested_type |= guest_irq_type; | 526 | dev->irq_requested_type |= guest_irq_type; |
527 | if (dev->ack_notifier.gsi != -1) | 527 | if (dev->ack_notifier.gsi != -1) |
528 | kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); | 528 | kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); |
529 | } else | 529 | } else { |
530 | kvm_free_irq_source_id(kvm, dev->irq_source_id); | 530 | kvm_free_irq_source_id(kvm, dev->irq_source_id); |
531 | dev->irq_source_id = -1; | ||
532 | } | ||
531 | 533 | ||
532 | return r; | 534 | return r; |
533 | } | 535 | } |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 0df7d4b34dfe..714b94932312 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -61,6 +61,14 @@ static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn, | |||
61 | return pfn; | 61 | return pfn; |
62 | } | 62 | } |
63 | 63 | ||
64 | static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages) | ||
65 | { | ||
66 | unsigned long i; | ||
67 | |||
68 | for (i = 0; i < npages; ++i) | ||
69 | kvm_release_pfn_clean(pfn + i); | ||
70 | } | ||
71 | |||
64 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | 72 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) |
65 | { | 73 | { |
66 | gfn_t gfn, end_gfn; | 74 | gfn_t gfn, end_gfn; |
@@ -123,6 +131,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | |||
123 | if (r) { | 131 | if (r) { |
124 | printk(KERN_ERR "kvm_iommu_map_address:" | 132 | printk(KERN_ERR "kvm_iommu_map_address:" |
125 | "iommu failed to map pfn=%llx\n", pfn); | 133 | "iommu failed to map pfn=%llx\n", pfn); |
134 | kvm_unpin_pages(kvm, pfn, page_size); | ||
126 | goto unmap_pages; | 135 | goto unmap_pages; |
127 | } | 136 | } |
128 | 137 | ||
@@ -134,7 +143,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | |||
134 | return 0; | 143 | return 0; |
135 | 144 | ||
136 | unmap_pages: | 145 | unmap_pages: |
137 | kvm_iommu_put_pages(kvm, slot->base_gfn, gfn); | 146 | kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn); |
138 | return r; | 147 | return r; |
139 | } | 148 | } |
140 | 149 | ||
@@ -266,14 +275,6 @@ out_unlock: | |||
266 | return r; | 275 | return r; |
267 | } | 276 | } |
268 | 277 | ||
269 | static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages) | ||
270 | { | ||
271 | unsigned long i; | ||
272 | |||
273 | for (i = 0; i < npages; ++i) | ||
274 | kvm_release_pfn_clean(pfn + i); | ||
275 | } | ||
276 | |||
277 | static void kvm_iommu_put_pages(struct kvm *kvm, | 278 | static void kvm_iommu_put_pages(struct kvm *kvm, |
278 | gfn_t base_gfn, unsigned long npages) | 279 | gfn_t base_gfn, unsigned long npages) |
279 | { | 280 | { |