Magellan Linux

Contents of /trunk/kernel-magellan/patches-4.2/0100-4.2.1-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2706 - (show annotations) (download)
Mon Nov 2 12:48:51 2015 UTC (8 years, 6 months ago) by niro
File size: 153483 byte(s)
-linux-4.2.1
1 diff --git a/Documentation/ABI/testing/configfs-usb-gadget-loopback b/Documentation/ABI/testing/configfs-usb-gadget-loopback
2 index 9aae5bfb9908..06beefbcf061 100644
3 --- a/Documentation/ABI/testing/configfs-usb-gadget-loopback
4 +++ b/Documentation/ABI/testing/configfs-usb-gadget-loopback
5 @@ -5,4 +5,4 @@ Description:
6 The attributes:
7
8 qlen - depth of loopback queue
9 - bulk_buflen - buffer length
10 + buflen - buffer length
11 diff --git a/Documentation/ABI/testing/configfs-usb-gadget-sourcesink b/Documentation/ABI/testing/configfs-usb-gadget-sourcesink
12 index 29477c319f61..bc7ff731aa0c 100644
13 --- a/Documentation/ABI/testing/configfs-usb-gadget-sourcesink
14 +++ b/Documentation/ABI/testing/configfs-usb-gadget-sourcesink
15 @@ -9,4 +9,4 @@ Description:
16 isoc_maxpacket - 0 - 1023 (fs), 0 - 1024 (hs/ss)
17 isoc_mult - 0..2 (hs/ss only)
18 isoc_maxburst - 0..15 (ss only)
19 - qlen - buffer length
20 + buflen - buffer length
21 diff --git a/Documentation/device-mapper/statistics.txt b/Documentation/device-mapper/statistics.txt
22 index 4919b2dfd1b3..6f5ef944ca4c 100644
23 --- a/Documentation/device-mapper/statistics.txt
24 +++ b/Documentation/device-mapper/statistics.txt
25 @@ -121,6 +121,10 @@ Messages
26
27 Output format:
28 <region_id>: <start_sector>+<length> <step> <program_id> <aux_data>
29 + precise_timestamps histogram:n1,n2,n3,...
30 +
31 + The strings "precise_timestamps" and "histogram" are printed only
32 + if they were specified when creating the region.
33
34 @stats_print <region_id> [<starting_line> <number_of_lines>]
35
36 diff --git a/Documentation/usb/gadget-testing.txt b/Documentation/usb/gadget-testing.txt
37 index 592678009c15..b24d3ef89166 100644
38 --- a/Documentation/usb/gadget-testing.txt
39 +++ b/Documentation/usb/gadget-testing.txt
40 @@ -237,9 +237,7 @@ Testing the LOOPBACK function
41 -----------------------------
42
43 device: run the gadget
44 -host: test-usb
45 -
46 -http://www.linux-usb.org/usbtest/testusb.c
47 +host: test-usb (tools/usb/testusb.c)
48
49 8. MASS STORAGE function
50 ========================
51 @@ -586,9 +584,8 @@ Testing the SOURCESINK function
52 -------------------------------
53
54 device: run the gadget
55 -host: test-usb
56 +host: test-usb (tools/usb/testusb.c)
57
58 -http://www.linux-usb.org/usbtest/testusb.c
59
60 16. UAC1 function
61 =================
62 diff --git a/Makefile b/Makefile
63 index c3615937df38..a03efc18aa48 100644
64 --- a/Makefile
65 +++ b/Makefile
66 @@ -1,6 +1,6 @@
67 VERSION = 4
68 PATCHLEVEL = 2
69 -SUBLEVEL = 0
70 +SUBLEVEL = 1
71 EXTRAVERSION =
72 NAME = Hurr durr I'ma sheep
73
74 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
75 index 1c5021002fe4..ede2526ecf1f 100644
76 --- a/arch/arm/Kconfig
77 +++ b/arch/arm/Kconfig
78 @@ -536,6 +536,7 @@ config ARCH_ORION5X
79 select MVEBU_MBUS
80 select PCI
81 select PLAT_ORION_LEGACY
82 + select MULTI_IRQ_HANDLER
83 help
84 Support for the following Marvell Orion 5x series SoCs:
85 Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182),
86 diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts b/arch/arm/boot/dts/exynos3250-rinato.dts
87 index 031853b75528..baa9b2f52009 100644
88 --- a/arch/arm/boot/dts/exynos3250-rinato.dts
89 +++ b/arch/arm/boot/dts/exynos3250-rinato.dts
90 @@ -182,7 +182,7 @@
91
92 display-timings {
93 timing-0 {
94 - clock-frequency = <0>;
95 + clock-frequency = <4600000>;
96 hactive = <320>;
97 vactive = <320>;
98 hfront-porch = <1>;
99 diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
100 index 22316d00493e..858efd0c861d 100644
101 --- a/arch/arm/boot/dts/rk3288.dtsi
102 +++ b/arch/arm/boot/dts/rk3288.dtsi
103 @@ -626,7 +626,7 @@
104 compatible = "rockchip,rk3288-wdt", "snps,dw-wdt";
105 reg = <0xff800000 0x100>;
106 clocks = <&cru PCLK_WDT>;
107 - interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
108 + interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
109 status = "disabled";
110 };
111
112 diff --git a/arch/arm/mach-bcm/bcm63xx_smp.c b/arch/arm/mach-bcm/bcm63xx_smp.c
113 index 3f014f18cea5..b8e18cc8f237 100644
114 --- a/arch/arm/mach-bcm/bcm63xx_smp.c
115 +++ b/arch/arm/mach-bcm/bcm63xx_smp.c
116 @@ -127,7 +127,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu,
117 }
118
119 /* Locate the secondary CPU node */
120 - dn = of_get_cpu_node(cpu_logical_map(cpu), NULL);
121 + dn = of_get_cpu_node(cpu, NULL);
122 if (!dn) {
123 pr_err("SMP: failed to locate secondary CPU%d node\n", cpu);
124 ret = -ENODEV;
125 diff --git a/arch/arm/mach-omap2/clockdomains7xx_data.c b/arch/arm/mach-omap2/clockdomains7xx_data.c
126 index 57d5df0c1fbd..7581e036bda6 100644
127 --- a/arch/arm/mach-omap2/clockdomains7xx_data.c
128 +++ b/arch/arm/mach-omap2/clockdomains7xx_data.c
129 @@ -331,7 +331,7 @@ static struct clockdomain l4per2_7xx_clkdm = {
130 .dep_bit = DRA7XX_L4PER2_STATDEP_SHIFT,
131 .wkdep_srcs = l4per2_wkup_sleep_deps,
132 .sleepdep_srcs = l4per2_wkup_sleep_deps,
133 - .flags = CLKDM_CAN_HWSUP_SWSUP,
134 + .flags = CLKDM_CAN_SWSUP,
135 };
136
137 static struct clockdomain mpu0_7xx_clkdm = {
138 diff --git a/arch/arm/mach-orion5x/include/mach/irqs.h b/arch/arm/mach-orion5x/include/mach/irqs.h
139 index a6fa9d8f12d8..2431d9923427 100644
140 --- a/arch/arm/mach-orion5x/include/mach/irqs.h
141 +++ b/arch/arm/mach-orion5x/include/mach/irqs.h
142 @@ -16,42 +16,42 @@
143 /*
144 * Orion Main Interrupt Controller
145 */
146 -#define IRQ_ORION5X_BRIDGE 0
147 -#define IRQ_ORION5X_DOORBELL_H2C 1
148 -#define IRQ_ORION5X_DOORBELL_C2H 2
149 -#define IRQ_ORION5X_UART0 3
150 -#define IRQ_ORION5X_UART1 4
151 -#define IRQ_ORION5X_I2C 5
152 -#define IRQ_ORION5X_GPIO_0_7 6
153 -#define IRQ_ORION5X_GPIO_8_15 7
154 -#define IRQ_ORION5X_GPIO_16_23 8
155 -#define IRQ_ORION5X_GPIO_24_31 9
156 -#define IRQ_ORION5X_PCIE0_ERR 10
157 -#define IRQ_ORION5X_PCIE0_INT 11
158 -#define IRQ_ORION5X_USB1_CTRL 12
159 -#define IRQ_ORION5X_DEV_BUS_ERR 14
160 -#define IRQ_ORION5X_PCI_ERR 15
161 -#define IRQ_ORION5X_USB_BR_ERR 16
162 -#define IRQ_ORION5X_USB0_CTRL 17
163 -#define IRQ_ORION5X_ETH_RX 18
164 -#define IRQ_ORION5X_ETH_TX 19
165 -#define IRQ_ORION5X_ETH_MISC 20
166 -#define IRQ_ORION5X_ETH_SUM 21
167 -#define IRQ_ORION5X_ETH_ERR 22
168 -#define IRQ_ORION5X_IDMA_ERR 23
169 -#define IRQ_ORION5X_IDMA_0 24
170 -#define IRQ_ORION5X_IDMA_1 25
171 -#define IRQ_ORION5X_IDMA_2 26
172 -#define IRQ_ORION5X_IDMA_3 27
173 -#define IRQ_ORION5X_CESA 28
174 -#define IRQ_ORION5X_SATA 29
175 -#define IRQ_ORION5X_XOR0 30
176 -#define IRQ_ORION5X_XOR1 31
177 +#define IRQ_ORION5X_BRIDGE (1 + 0)
178 +#define IRQ_ORION5X_DOORBELL_H2C (1 + 1)
179 +#define IRQ_ORION5X_DOORBELL_C2H (1 + 2)
180 +#define IRQ_ORION5X_UART0 (1 + 3)
181 +#define IRQ_ORION5X_UART1 (1 + 4)
182 +#define IRQ_ORION5X_I2C (1 + 5)
183 +#define IRQ_ORION5X_GPIO_0_7 (1 + 6)
184 +#define IRQ_ORION5X_GPIO_8_15 (1 + 7)
185 +#define IRQ_ORION5X_GPIO_16_23 (1 + 8)
186 +#define IRQ_ORION5X_GPIO_24_31 (1 + 9)
187 +#define IRQ_ORION5X_PCIE0_ERR (1 + 10)
188 +#define IRQ_ORION5X_PCIE0_INT (1 + 11)
189 +#define IRQ_ORION5X_USB1_CTRL (1 + 12)
190 +#define IRQ_ORION5X_DEV_BUS_ERR (1 + 14)
191 +#define IRQ_ORION5X_PCI_ERR (1 + 15)
192 +#define IRQ_ORION5X_USB_BR_ERR (1 + 16)
193 +#define IRQ_ORION5X_USB0_CTRL (1 + 17)
194 +#define IRQ_ORION5X_ETH_RX (1 + 18)
195 +#define IRQ_ORION5X_ETH_TX (1 + 19)
196 +#define IRQ_ORION5X_ETH_MISC (1 + 20)
197 +#define IRQ_ORION5X_ETH_SUM (1 + 21)
198 +#define IRQ_ORION5X_ETH_ERR (1 + 22)
199 +#define IRQ_ORION5X_IDMA_ERR (1 + 23)
200 +#define IRQ_ORION5X_IDMA_0 (1 + 24)
201 +#define IRQ_ORION5X_IDMA_1 (1 + 25)
202 +#define IRQ_ORION5X_IDMA_2 (1 + 26)
203 +#define IRQ_ORION5X_IDMA_3 (1 + 27)
204 +#define IRQ_ORION5X_CESA (1 + 28)
205 +#define IRQ_ORION5X_SATA (1 + 29)
206 +#define IRQ_ORION5X_XOR0 (1 + 30)
207 +#define IRQ_ORION5X_XOR1 (1 + 31)
208
209 /*
210 * Orion General Purpose Pins
211 */
212 -#define IRQ_ORION5X_GPIO_START 32
213 +#define IRQ_ORION5X_GPIO_START 33
214 #define NR_GPIO_IRQS 32
215
216 #define NR_IRQS (IRQ_ORION5X_GPIO_START + NR_GPIO_IRQS)
217 diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
218 index cd4bac4d7e43..086ecb87d885 100644
219 --- a/arch/arm/mach-orion5x/irq.c
220 +++ b/arch/arm/mach-orion5x/irq.c
221 @@ -42,7 +42,7 @@ __exception_irq_entry orion5x_legacy_handle_irq(struct pt_regs *regs)
222 stat = readl_relaxed(MAIN_IRQ_CAUSE);
223 stat &= readl_relaxed(MAIN_IRQ_MASK);
224 if (stat) {
225 - unsigned int hwirq = __fls(stat);
226 + unsigned int hwirq = 1 + __fls(stat);
227 handle_IRQ(hwirq, regs);
228 return;
229 }
230 @@ -51,7 +51,7 @@ __exception_irq_entry orion5x_legacy_handle_irq(struct pt_regs *regs)
231
232 void __init orion5x_init_irq(void)
233 {
234 - orion_irq_init(0, MAIN_IRQ_MASK);
235 + orion_irq_init(1, MAIN_IRQ_MASK);
236
237 #ifdef CONFIG_MULTI_IRQ_HANDLER
238 set_handle_irq(orion5x_legacy_handle_irq);
239 diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
240 index 8fcec1cc101e..01b3e3683ede 100644
241 --- a/arch/arm/mach-rockchip/platsmp.c
242 +++ b/arch/arm/mach-rockchip/platsmp.c
243 @@ -72,29 +72,22 @@ static struct reset_control *rockchip_get_core_reset(int cpu)
244 static int pmu_set_power_domain(int pd, bool on)
245 {
246 u32 val = (on) ? 0 : BIT(pd);
247 + struct reset_control *rstc = rockchip_get_core_reset(pd);
248 int ret;
249
250 + if (IS_ERR(rstc) && read_cpuid_part() != ARM_CPU_PART_CORTEX_A9) {
251 + pr_err("%s: could not get reset control for core %d\n",
252 + __func__, pd);
253 + return PTR_ERR(rstc);
254 + }
255 +
256 /*
257 * We need to soft reset the cpu when we turn off the cpu power domain,
258 * or else the active processors might be stalled when the individual
259 * processor is powered down.
260 */
261 - if (read_cpuid_part() != ARM_CPU_PART_CORTEX_A9) {
262 - struct reset_control *rstc = rockchip_get_core_reset(pd);
263 -
264 - if (IS_ERR(rstc)) {
265 - pr_err("%s: could not get reset control for core %d\n",
266 - __func__, pd);
267 - return PTR_ERR(rstc);
268 - }
269 -
270 - if (on)
271 - reset_control_deassert(rstc);
272 - else
273 - reset_control_assert(rstc);
274 -
275 - reset_control_put(rstc);
276 - }
277 + if (!IS_ERR(rstc) && !on)
278 + reset_control_assert(rstc);
279
280 ret = regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), val);
281 if (ret < 0) {
282 @@ -112,6 +105,12 @@ static int pmu_set_power_domain(int pd, bool on)
283 }
284 }
285
286 + if (!IS_ERR(rstc)) {
287 + if (on)
288 + reset_control_deassert(rstc);
289 + reset_control_put(rstc);
290 + }
291 +
292 return 0;
293 }
294
295 @@ -146,8 +145,12 @@ static int rockchip_boot_secondary(unsigned int cpu, struct task_struct *idle)
296 * the mailbox:
297 * sram_base_addr + 4: 0xdeadbeaf
298 * sram_base_addr + 8: start address for pc
299 + * The cpu0 need to wait the other cpus other than cpu0 entering
300 + * the wfe state.The wait time is affected by many aspects.
301 + * (e.g: cpu frequency, bootrom frequency, sram frequency, ...)
302 * */
303 - udelay(10);
304 + mdelay(1); /* ensure the cpus other than cpu0 to startup */
305 +
306 writel(virt_to_phys(secondary_startup), sram_base_addr + 8);
307 writel(0xDEADBEAF, sram_base_addr + 4);
308 dsb_sev();
309 diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
310 index b027a89737b6..c6d601cc9764 100644
311 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
312 +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
313 @@ -421,14 +421,20 @@ long kvmppc_do_h_remove(struct kvm *kvm, unsigned long flags,
314 rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
315 v = pte & ~HPTE_V_HVLOCK;
316 if (v & HPTE_V_VALID) {
317 - u64 pte1;
318 -
319 - pte1 = be64_to_cpu(hpte[1]);
320 hpte[0] &= ~cpu_to_be64(HPTE_V_VALID);
321 - rb = compute_tlbie_rb(v, pte1, pte_index);
322 + rb = compute_tlbie_rb(v, be64_to_cpu(hpte[1]), pte_index);
323 do_tlbies(kvm, &rb, 1, global_invalidates(kvm, flags), true);
324 - /* Read PTE low word after tlbie to get final R/C values */
325 - remove_revmap_chain(kvm, pte_index, rev, v, pte1);
326 + /*
327 + * The reference (R) and change (C) bits in a HPT
328 + * entry can be set by hardware at any time up until
329 + * the HPTE is invalidated and the TLB invalidation
330 + * sequence has completed. This means that when
331 + * removing a HPTE, we need to re-read the HPTE after
332 + * the invalidation sequence has completed in order to
333 + * obtain reliable values of R and C.
334 + */
335 + remove_revmap_chain(kvm, pte_index, rev, v,
336 + be64_to_cpu(hpte[1]));
337 }
338 r = rev->guest_rpte & ~HPTE_GR_RESERVED;
339 note_hpte_modification(kvm, rev);
340 diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
341 index faa86e9c0551..76408cf0ad04 100644
342 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
343 +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
344 @@ -1127,6 +1127,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
345 cmpwi r12, BOOK3S_INTERRUPT_H_DOORBELL
346 bne 3f
347 lbz r0, HSTATE_HOST_IPI(r13)
348 + cmpwi r0, 0
349 beq 4f
350 b guest_exit_cont
351 3:
352 diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
353 index ca070d260af2..b80512b9ef59 100644
354 --- a/arch/s390/kernel/setup.c
355 +++ b/arch/s390/kernel/setup.c
356 @@ -688,7 +688,7 @@ static void __init setup_memory(void)
357 /*
358 * Setup hardware capabilities.
359 */
360 -static void __init setup_hwcaps(void)
361 +static int __init setup_hwcaps(void)
362 {
363 static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 };
364 struct cpuid cpu_id;
365 @@ -754,9 +754,11 @@ static void __init setup_hwcaps(void)
366 elf_hwcap |= HWCAP_S390_TE;
367
368 /*
369 - * Vector extension HWCAP_S390_VXRS is bit 11.
370 + * Vector extension HWCAP_S390_VXRS is bit 11. The Vector extension
371 + * can be disabled with the "novx" parameter. Use MACHINE_HAS_VX
372 + * instead of facility bit 129.
373 */
374 - if (test_facility(129))
375 + if (MACHINE_HAS_VX)
376 elf_hwcap |= HWCAP_S390_VXRS;
377 get_cpu_id(&cpu_id);
378 add_device_randomness(&cpu_id, sizeof(cpu_id));
379 @@ -793,7 +795,9 @@ static void __init setup_hwcaps(void)
380 strcpy(elf_platform, "z13");
381 break;
382 }
383 + return 0;
384 }
385 +arch_initcall(setup_hwcaps);
386
387 /*
388 * Add system information as device randomness
389 @@ -881,11 +885,6 @@ void __init setup_arch(char **cmdline_p)
390 cpu_init();
391
392 /*
393 - * Setup capabilities (ELF_HWCAP & ELF_PLATFORM).
394 - */
395 - setup_hwcaps();
396 -
397 - /*
398 * Create kernel page tables and switch to virtual addressing.
399 */
400 paging_init();
401 diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c
402 index 64d7cf1b50e1..440df0c7a2ee 100644
403 --- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
404 +++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
405 @@ -294,6 +294,7 @@ static struct ahash_alg ghash_async_alg = {
406 .cra_name = "ghash",
407 .cra_driver_name = "ghash-clmulni",
408 .cra_priority = 400,
409 + .cra_ctxsize = sizeof(struct ghash_async_ctx),
410 .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
411 .cra_blocksize = GHASH_BLOCK_SIZE,
412 .cra_type = &crypto_ahash_type,
413 diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
414 index e49ee24da85e..9393896717d0 100644
415 --- a/arch/x86/kernel/acpi/boot.c
416 +++ b/arch/x86/kernel/acpi/boot.c
417 @@ -445,6 +445,7 @@ static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger,
418 polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
419
420 mp_override_legacy_irq(bus_irq, polarity, trigger, gsi);
421 + acpi_penalize_sci_irq(bus_irq, trigger, polarity);
422
423 /*
424 * stash over-ride to indicate we've been here
425 diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
426 index 844f56c5616d..c93c27df9919 100644
427 --- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
428 +++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
429 @@ -146,6 +146,27 @@ void mce_intel_hcpu_update(unsigned long cpu)
430 per_cpu(cmci_storm_state, cpu) = CMCI_STORM_NONE;
431 }
432
433 +static void cmci_toggle_interrupt_mode(bool on)
434 +{
435 + unsigned long flags, *owned;
436 + int bank;
437 + u64 val;
438 +
439 + raw_spin_lock_irqsave(&cmci_discover_lock, flags);
440 + owned = this_cpu_ptr(mce_banks_owned);
441 + for_each_set_bit(bank, owned, MAX_NR_BANKS) {
442 + rdmsrl(MSR_IA32_MCx_CTL2(bank), val);
443 +
444 + if (on)
445 + val |= MCI_CTL2_CMCI_EN;
446 + else
447 + val &= ~MCI_CTL2_CMCI_EN;
448 +
449 + wrmsrl(MSR_IA32_MCx_CTL2(bank), val);
450 + }
451 + raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
452 +}
453 +
454 unsigned long cmci_intel_adjust_timer(unsigned long interval)
455 {
456 if ((this_cpu_read(cmci_backoff_cnt) > 0) &&
457 @@ -175,7 +196,7 @@ unsigned long cmci_intel_adjust_timer(unsigned long interval)
458 */
459 if (!atomic_read(&cmci_storm_on_cpus)) {
460 __this_cpu_write(cmci_storm_state, CMCI_STORM_NONE);
461 - cmci_reenable();
462 + cmci_toggle_interrupt_mode(true);
463 cmci_recheck();
464 }
465 return CMCI_POLL_INTERVAL;
466 @@ -186,22 +207,6 @@ unsigned long cmci_intel_adjust_timer(unsigned long interval)
467 }
468 }
469
470 -static void cmci_storm_disable_banks(void)
471 -{
472 - unsigned long flags, *owned;
473 - int bank;
474 - u64 val;
475 -
476 - raw_spin_lock_irqsave(&cmci_discover_lock, flags);
477 - owned = this_cpu_ptr(mce_banks_owned);
478 - for_each_set_bit(bank, owned, MAX_NR_BANKS) {
479 - rdmsrl(MSR_IA32_MCx_CTL2(bank), val);
480 - val &= ~MCI_CTL2_CMCI_EN;
481 - wrmsrl(MSR_IA32_MCx_CTL2(bank), val);
482 - }
483 - raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
484 -}
485 -
486 static bool cmci_storm_detect(void)
487 {
488 unsigned int cnt = __this_cpu_read(cmci_storm_cnt);
489 @@ -223,7 +228,7 @@ static bool cmci_storm_detect(void)
490 if (cnt <= CMCI_STORM_THRESHOLD)
491 return false;
492
493 - cmci_storm_disable_banks();
494 + cmci_toggle_interrupt_mode(false);
495 __this_cpu_write(cmci_storm_state, CMCI_STORM_ACTIVE);
496 r = atomic_add_return(1, &cmci_storm_on_cpus);
497 mce_timer_kick(CMCI_STORM_INTERVAL);
498 diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
499 index 44171462bd2a..82362ad2f25d 100644
500 --- a/arch/x86/kvm/mmu.c
501 +++ b/arch/x86/kvm/mmu.c
502 @@ -357,12 +357,6 @@ static u64 __get_spte_lockless(u64 *sptep)
503 {
504 return ACCESS_ONCE(*sptep);
505 }
506 -
507 -static bool __check_direct_spte_mmio_pf(u64 spte)
508 -{
509 - /* It is valid if the spte is zapped. */
510 - return spte == 0ull;
511 -}
512 #else
513 union split_spte {
514 struct {
515 @@ -478,23 +472,6 @@ retry:
516
517 return spte.spte;
518 }
519 -
520 -static bool __check_direct_spte_mmio_pf(u64 spte)
521 -{
522 - union split_spte sspte = (union split_spte)spte;
523 - u32 high_mmio_mask = shadow_mmio_mask >> 32;
524 -
525 - /* It is valid if the spte is zapped. */
526 - if (spte == 0ull)
527 - return true;
528 -
529 - /* It is valid if the spte is being zapped. */
530 - if (sspte.spte_low == 0ull &&
531 - (sspte.spte_high & high_mmio_mask) == high_mmio_mask)
532 - return true;
533 -
534 - return false;
535 -}
536 #endif
537
538 static bool spte_is_locklessly_modifiable(u64 spte)
539 @@ -3299,21 +3276,6 @@ static bool quickly_check_mmio_pf(struct kvm_vcpu *vcpu, u64 addr, bool direct)
540 return vcpu_match_mmio_gva(vcpu, addr);
541 }
542
543 -
544 -/*
545 - * On direct hosts, the last spte is only allows two states
546 - * for mmio page fault:
547 - * - It is the mmio spte
548 - * - It is zapped or it is being zapped.
549 - *
550 - * This function completely checks the spte when the last spte
551 - * is not the mmio spte.
552 - */
553 -static bool check_direct_spte_mmio_pf(u64 spte)
554 -{
555 - return __check_direct_spte_mmio_pf(spte);
556 -}
557 -
558 static u64 walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr)
559 {
560 struct kvm_shadow_walk_iterator iterator;
561 @@ -3356,13 +3318,6 @@ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct)
562 }
563
564 /*
565 - * It's ok if the gva is remapped by other cpus on shadow guest,
566 - * it's a BUG if the gfn is not a mmio page.
567 - */
568 - if (direct && !check_direct_spte_mmio_pf(spte))
569 - return RET_MMIO_PF_BUG;
570 -
571 - /*
572 * If the page table is zapped by other cpus, let CPU fault again on
573 * the address.
574 */
575 diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h
576 index 677bfcf4ee5d..28f33a8b7f5f 100644
577 --- a/arch/xtensa/include/asm/traps.h
578 +++ b/arch/xtensa/include/asm/traps.h
579 @@ -25,30 +25,39 @@ static inline void spill_registers(void)
580 {
581 #if XCHAL_NUM_AREGS > 16
582 __asm__ __volatile__ (
583 - " call12 1f\n"
584 + " call8 1f\n"
585 " _j 2f\n"
586 " retw\n"
587 " .align 4\n"
588 "1:\n"
589 +#if XCHAL_NUM_AREGS == 32
590 + " _entry a1, 32\n"
591 + " addi a8, a0, 3\n"
592 + " _entry a1, 16\n"
593 + " mov a12, a12\n"
594 + " retw\n"
595 +#else
596 " _entry a1, 48\n"
597 - " addi a12, a0, 3\n"
598 -#if XCHAL_NUM_AREGS > 32
599 - " .rept (" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n"
600 + " call12 1f\n"
601 + " retw\n"
602 + " .align 4\n"
603 + "1:\n"
604 + " .rept (" __stringify(XCHAL_NUM_AREGS) " - 16) / 12\n"
605 " _entry a1, 48\n"
606 " mov a12, a0\n"
607 " .endr\n"
608 -#endif
609 - " _entry a1, 48\n"
610 + " _entry a1, 16\n"
611 #if XCHAL_NUM_AREGS % 12 == 0
612 - " mov a8, a8\n"
613 -#elif XCHAL_NUM_AREGS % 12 == 4
614 " mov a12, a12\n"
615 -#elif XCHAL_NUM_AREGS % 12 == 8
616 +#elif XCHAL_NUM_AREGS % 12 == 4
617 " mov a4, a4\n"
618 +#elif XCHAL_NUM_AREGS % 12 == 8
619 + " mov a8, a8\n"
620 #endif
621 " retw\n"
622 +#endif
623 "2:\n"
624 - : : : "a12", "a13", "memory");
625 + : : : "a8", "a9", "memory");
626 #else
627 __asm__ __volatile__ (
628 " mov a12, a12\n"
629 diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
630 index 82bbfa5a05b3..a2a902140c4e 100644
631 --- a/arch/xtensa/kernel/entry.S
632 +++ b/arch/xtensa/kernel/entry.S
633 @@ -568,12 +568,13 @@ user_exception_exit:
634 * (if we have restored WSBITS-1 frames).
635 */
636
637 +2:
638 #if XCHAL_HAVE_THREADPTR
639 l32i a3, a1, PT_THREADPTR
640 wur a3, threadptr
641 #endif
642
643 -2: j common_exception_exit
644 + j common_exception_exit
645
646 /* This is the kernel exception exit.
647 * We avoided to do a MOVSP when we entered the exception, but we
648 @@ -1820,7 +1821,7 @@ ENDPROC(system_call)
649 mov a12, a0
650 .endr
651 #endif
652 - _entry a1, 48
653 + _entry a1, 16
654 #if XCHAL_NUM_AREGS % 12 == 0
655 mov a8, a8
656 #elif XCHAL_NUM_AREGS % 12 == 4
657 @@ -1844,7 +1845,7 @@ ENDPROC(system_call)
658
659 ENTRY(_switch_to)
660
661 - entry a1, 16
662 + entry a1, 48
663
664 mov a11, a3 # and 'next' (a3)
665
666 diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
667 index ff6d8adc9cda..fb765524cc3d 100644
668 --- a/drivers/acpi/acpi_pnp.c
669 +++ b/drivers/acpi/acpi_pnp.c
670 @@ -153,6 +153,7 @@ static const struct acpi_device_id acpi_pnp_device_ids[] = {
671 {"AEI0250"}, /* PROLiNK 1456VH ISA PnP K56flex Fax Modem */
672 {"AEI1240"}, /* Actiontec ISA PNP 56K X2 Fax Modem */
673 {"AKY1021"}, /* Rockwell 56K ACF II Fax+Data+Voice Modem */
674 + {"ALI5123"}, /* ALi Fast Infrared Controller */
675 {"AZT4001"}, /* AZT3005 PnP SOUND DEVICE */
676 {"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
677 {"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */
678 diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
679 index cfd7581cc19f..b09ad554430a 100644
680 --- a/drivers/acpi/pci_link.c
681 +++ b/drivers/acpi/pci_link.c
682 @@ -826,6 +826,22 @@ void acpi_penalize_isa_irq(int irq, int active)
683 }
684
685 /*
686 + * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with
687 + * PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for
688 + * PCI IRQs.
689 + */
690 +void acpi_penalize_sci_irq(int irq, int trigger, int polarity)
691 +{
692 + if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) {
693 + if (trigger != ACPI_MADT_TRIGGER_LEVEL ||
694 + polarity != ACPI_MADT_POLARITY_ACTIVE_LOW)
695 + acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_ALWAYS;
696 + else
697 + acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING;
698 + }
699 +}
700 +
701 +/*
702 * Over-ride default table to reserve additional IRQs for use by ISA
703 * e.g. acpi_irq_isa=5
704 * Useful for telling ACPI how not to interfere with your ISA sound card.
705 diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
706 index 7e62751abfac..a46660204e3a 100644
707 --- a/drivers/ata/ahci.c
708 +++ b/drivers/ata/ahci.c
709 @@ -351,6 +351,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
710 /* JMicron 362B and 362C have an AHCI function with IDE class code */
711 { PCI_VDEVICE(JMICRON, 0x2362), board_ahci_ign_iferr },
712 { PCI_VDEVICE(JMICRON, 0x236f), board_ahci_ign_iferr },
713 + /* May need to update quirk_jmicron_async_suspend() for additions */
714
715 /* ATI */
716 { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */
717 @@ -1451,18 +1452,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
718 else if (pdev->vendor == 0x177d && pdev->device == 0xa01c)
719 ahci_pci_bar = AHCI_PCI_BAR_CAVIUM;
720
721 - /*
722 - * The JMicron chip 361/363 contains one SATA controller and one
723 - * PATA controller,for powering on these both controllers, we must
724 - * follow the sequence one by one, otherwise one of them can not be
725 - * powered on successfully, so here we disable the async suspend
726 - * method for these chips.
727 - */
728 - if (pdev->vendor == PCI_VENDOR_ID_JMICRON &&
729 - (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 ||
730 - pdev->device == PCI_DEVICE_ID_JMICRON_JMB361))
731 - device_disable_async_suspend(&pdev->dev);
732 -
733 /* acquire resources */
734 rc = pcim_enable_device(pdev);
735 if (rc)
736 diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
737 index 47e418b8c8ba..4d1a5d2c4287 100644
738 --- a/drivers/ata/pata_jmicron.c
739 +++ b/drivers/ata/pata_jmicron.c
740 @@ -143,18 +143,6 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
741 };
742 const struct ata_port_info *ppi[] = { &info, NULL };
743
744 - /*
745 - * The JMicron chip 361/363 contains one SATA controller and one
746 - * PATA controller,for powering on these both controllers, we must
747 - * follow the sequence one by one, otherwise one of them can not be
748 - * powered on successfully, so here we disable the async suspend
749 - * method for these chips.
750 - */
751 - if (pdev->vendor == PCI_VENDOR_ID_JMICRON &&
752 - (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 ||
753 - pdev->device == PCI_DEVICE_ID_JMICRON_JMB361))
754 - device_disable_async_suspend(&pdev->dev);
755 -
756 return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0);
757 }
758
759 diff --git a/drivers/auxdisplay/ks0108.c b/drivers/auxdisplay/ks0108.c
760 index 5b93852392b8..0d752851a1ee 100644
761 --- a/drivers/auxdisplay/ks0108.c
762 +++ b/drivers/auxdisplay/ks0108.c
763 @@ -139,6 +139,7 @@ static int __init ks0108_init(void)
764
765 ks0108_pardevice = parport_register_device(ks0108_parport, KS0108_NAME,
766 NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
767 + parport_put_port(ks0108_parport);
768 if (ks0108_pardevice == NULL) {
769 printk(KERN_ERR KS0108_NAME ": ERROR: "
770 "parport didn't register new device\n");
771 diff --git a/drivers/base/devres.c b/drivers/base/devres.c
772 index c8a53d1e019f..875464690117 100644
773 --- a/drivers/base/devres.c
774 +++ b/drivers/base/devres.c
775 @@ -297,10 +297,10 @@ void * devres_get(struct device *dev, void *new_res,
776 if (!dr) {
777 add_dr(dev, &new_dr->node);
778 dr = new_dr;
779 - new_dr = NULL;
780 + new_res = NULL;
781 }
782 spin_unlock_irqrestore(&dev->devres_lock, flags);
783 - devres_free(new_dr);
784 + devres_free(new_res);
785
786 return dr->data;
787 }
788 diff --git a/drivers/base/platform.c b/drivers/base/platform.c
789 index 063f0ab15259..f80aaaf9f610 100644
790 --- a/drivers/base/platform.c
791 +++ b/drivers/base/platform.c
792 @@ -375,9 +375,7 @@ int platform_device_add(struct platform_device *pdev)
793
794 while (--i >= 0) {
795 struct resource *r = &pdev->resource[i];
796 - unsigned long type = resource_type(r);
797 -
798 - if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
799 + if (r->parent)
800 release_resource(r);
801 }
802
803 @@ -408,9 +406,7 @@ void platform_device_del(struct platform_device *pdev)
804
805 for (i = 0; i < pdev->num_resources; i++) {
806 struct resource *r = &pdev->resource[i];
807 - unsigned long type = resource_type(r);
808 -
809 - if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
810 + if (r->parent)
811 release_resource(r);
812 }
813 }
814 diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
815 index acef9f9f759a..652b5a367c1f 100644
816 --- a/drivers/base/power/clock_ops.c
817 +++ b/drivers/base/power/clock_ops.c
818 @@ -38,7 +38,7 @@ struct pm_clock_entry {
819 * @dev: The device for the given clock
820 * @ce: PM clock entry corresponding to the clock.
821 */
822 -static inline int __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce)
823 +static inline void __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce)
824 {
825 int ret;
826
827 @@ -50,8 +50,6 @@ static inline int __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce)
828 dev_err(dev, "%s: failed to enable clk %p, error %d\n",
829 __func__, ce->clk, ret);
830 }
831 -
832 - return ret;
833 }
834
835 /**
836 diff --git a/drivers/clk/pistachio/clk-pistachio.c b/drivers/clk/pistachio/clk-pistachio.c
837 index 8c0fe8828f99..c4ceb5eaf46c 100644
838 --- a/drivers/clk/pistachio/clk-pistachio.c
839 +++ b/drivers/clk/pistachio/clk-pistachio.c
840 @@ -159,9 +159,15 @@ PNAME(mux_debug) = { "mips_pll_mux", "rpu_v_pll_mux",
841 "wifi_pll_mux", "bt_pll_mux" };
842 static u32 mux_debug_idx[] = { 0x0, 0x1, 0x2, 0x4, 0x8, 0x10 };
843
844 -static unsigned int pistachio_critical_clks[] __initdata = {
845 - CLK_MIPS,
846 - CLK_PERIPH_SYS,
847 +static unsigned int pistachio_critical_clks_core[] __initdata = {
848 + CLK_MIPS
849 +};
850 +
851 +static unsigned int pistachio_critical_clks_sys[] __initdata = {
852 + PERIPH_CLK_SYS,
853 + PERIPH_CLK_SYS_BUS,
854 + PERIPH_CLK_DDR,
855 + PERIPH_CLK_ROM,
856 };
857
858 static void __init pistachio_clk_init(struct device_node *np)
859 @@ -193,8 +199,8 @@ static void __init pistachio_clk_init(struct device_node *np)
860
861 pistachio_clk_register_provider(p);
862
863 - pistachio_clk_force_enable(p, pistachio_critical_clks,
864 - ARRAY_SIZE(pistachio_critical_clks));
865 + pistachio_clk_force_enable(p, pistachio_critical_clks_core,
866 + ARRAY_SIZE(pistachio_critical_clks_core));
867 }
868 CLK_OF_DECLARE(pistachio_clk, "img,pistachio-clk", pistachio_clk_init);
869
870 @@ -261,6 +267,9 @@ static void __init pistachio_clk_periph_init(struct device_node *np)
871 ARRAY_SIZE(pistachio_periph_gates));
872
873 pistachio_clk_register_provider(p);
874 +
875 + pistachio_clk_force_enable(p, pistachio_critical_clks_sys,
876 + ARRAY_SIZE(pistachio_critical_clks_sys));
877 }
878 CLK_OF_DECLARE(pistachio_clk_periph, "img,pistachio-clk-periph",
879 pistachio_clk_periph_init);
880 diff --git a/drivers/clk/pistachio/clk-pll.c b/drivers/clk/pistachio/clk-pll.c
881 index e17dada0dd21..c9b459821084 100644
882 --- a/drivers/clk/pistachio/clk-pll.c
883 +++ b/drivers/clk/pistachio/clk-pll.c
884 @@ -65,6 +65,12 @@
885 #define MIN_OUTPUT_FRAC 12000000UL
886 #define MAX_OUTPUT_FRAC 1600000000UL
887
888 +/* Fractional PLL operating modes */
889 +enum pll_mode {
890 + PLL_MODE_FRAC,
891 + PLL_MODE_INT,
892 +};
893 +
894 struct pistachio_clk_pll {
895 struct clk_hw hw;
896 void __iomem *base;
897 @@ -88,12 +94,10 @@ static inline void pll_lock(struct pistachio_clk_pll *pll)
898 cpu_relax();
899 }
900
901 -static inline u32 do_div_round_closest(u64 dividend, u32 divisor)
902 +static inline u64 do_div_round_closest(u64 dividend, u64 divisor)
903 {
904 dividend += divisor / 2;
905 - do_div(dividend, divisor);
906 -
907 - return dividend;
908 + return div64_u64(dividend, divisor);
909 }
910
911 static inline struct pistachio_clk_pll *to_pistachio_pll(struct clk_hw *hw)
912 @@ -101,6 +105,29 @@ static inline struct pistachio_clk_pll *to_pistachio_pll(struct clk_hw *hw)
913 return container_of(hw, struct pistachio_clk_pll, hw);
914 }
915
916 +static inline enum pll_mode pll_frac_get_mode(struct clk_hw *hw)
917 +{
918 + struct pistachio_clk_pll *pll = to_pistachio_pll(hw);
919 + u32 val;
920 +
921 + val = pll_readl(pll, PLL_CTRL3) & PLL_FRAC_CTRL3_DSMPD;
922 + return val ? PLL_MODE_INT : PLL_MODE_FRAC;
923 +}
924 +
925 +static inline void pll_frac_set_mode(struct clk_hw *hw, enum pll_mode mode)
926 +{
927 + struct pistachio_clk_pll *pll = to_pistachio_pll(hw);
928 + u32 val;
929 +
930 + val = pll_readl(pll, PLL_CTRL3);
931 + if (mode == PLL_MODE_INT)
932 + val |= PLL_FRAC_CTRL3_DSMPD | PLL_FRAC_CTRL3_DACPD;
933 + else
934 + val &= ~(PLL_FRAC_CTRL3_DSMPD | PLL_FRAC_CTRL3_DACPD);
935 +
936 + pll_writel(pll, val, PLL_CTRL3);
937 +}
938 +
939 static struct pistachio_pll_rate_table *
940 pll_get_params(struct pistachio_clk_pll *pll, unsigned long fref,
941 unsigned long fout)
942 @@ -136,8 +163,7 @@ static int pll_gf40lp_frac_enable(struct clk_hw *hw)
943 u32 val;
944
945 val = pll_readl(pll, PLL_CTRL3);
946 - val &= ~(PLL_FRAC_CTRL3_PD | PLL_FRAC_CTRL3_DACPD |
947 - PLL_FRAC_CTRL3_DSMPD | PLL_FRAC_CTRL3_FOUTPOSTDIVPD |
948 + val &= ~(PLL_FRAC_CTRL3_PD | PLL_FRAC_CTRL3_FOUTPOSTDIVPD |
949 PLL_FRAC_CTRL3_FOUT4PHASEPD | PLL_FRAC_CTRL3_FOUTVCOPD);
950 pll_writel(pll, val, PLL_CTRL3);
951
952 @@ -173,7 +199,7 @@ static int pll_gf40lp_frac_set_rate(struct clk_hw *hw, unsigned long rate,
953 struct pistachio_clk_pll *pll = to_pistachio_pll(hw);
954 struct pistachio_pll_rate_table *params;
955 int enabled = pll_gf40lp_frac_is_enabled(hw);
956 - u32 val, vco, old_postdiv1, old_postdiv2;
957 + u64 val, vco, old_postdiv1, old_postdiv2;
958 const char *name = __clk_get_name(hw->clk);
959
960 if (rate < MIN_OUTPUT_FRAC || rate > MAX_OUTPUT_FRAC)
961 @@ -183,17 +209,21 @@ static int pll_gf40lp_frac_set_rate(struct clk_hw *hw, unsigned long rate,
962 if (!params || !params->refdiv)
963 return -EINVAL;
964
965 - vco = params->fref * params->fbdiv / params->refdiv;
966 + /* calculate vco */
967 + vco = params->fref;
968 + vco *= (params->fbdiv << 24) + params->frac;
969 + vco = div64_u64(vco, params->refdiv << 24);
970 +
971 if (vco < MIN_VCO_FRAC_FRAC || vco > MAX_VCO_FRAC_FRAC)
972 - pr_warn("%s: VCO %u is out of range %lu..%lu\n", name, vco,
973 + pr_warn("%s: VCO %llu is out of range %lu..%lu\n", name, vco,
974 MIN_VCO_FRAC_FRAC, MAX_VCO_FRAC_FRAC);
975
976 - val = params->fref / params->refdiv;
977 + val = div64_u64(params->fref, params->refdiv);
978 if (val < MIN_PFD)
979 - pr_warn("%s: PFD %u is too low (min %lu)\n",
980 + pr_warn("%s: PFD %llu is too low (min %lu)\n",
981 name, val, MIN_PFD);
982 if (val > vco / 16)
983 - pr_warn("%s: PFD %u is too high (max %u)\n",
984 + pr_warn("%s: PFD %llu is too high (max %llu)\n",
985 name, val, vco / 16);
986
987 val = pll_readl(pll, PLL_CTRL1);
988 @@ -227,6 +257,12 @@ static int pll_gf40lp_frac_set_rate(struct clk_hw *hw, unsigned long rate,
989 (params->postdiv2 << PLL_FRAC_CTRL2_POSTDIV2_SHIFT);
990 pll_writel(pll, val, PLL_CTRL2);
991
992 + /* set operating mode */
993 + if (params->frac)
994 + pll_frac_set_mode(hw, PLL_MODE_FRAC);
995 + else
996 + pll_frac_set_mode(hw, PLL_MODE_INT);
997 +
998 if (enabled)
999 pll_lock(pll);
1000
1001 @@ -237,8 +273,7 @@ static unsigned long pll_gf40lp_frac_recalc_rate(struct clk_hw *hw,
1002 unsigned long parent_rate)
1003 {
1004 struct pistachio_clk_pll *pll = to_pistachio_pll(hw);
1005 - u32 val, prediv, fbdiv, frac, postdiv1, postdiv2;
1006 - u64 rate = parent_rate;
1007 + u64 val, prediv, fbdiv, frac, postdiv1, postdiv2, rate;
1008
1009 val = pll_readl(pll, PLL_CTRL1);
1010 prediv = (val >> PLL_CTRL1_REFDIV_SHIFT) & PLL_CTRL1_REFDIV_MASK;
1011 @@ -251,7 +286,13 @@ static unsigned long pll_gf40lp_frac_recalc_rate(struct clk_hw *hw,
1012 PLL_FRAC_CTRL2_POSTDIV2_MASK;
1013 frac = (val >> PLL_FRAC_CTRL2_FRAC_SHIFT) & PLL_FRAC_CTRL2_FRAC_MASK;
1014
1015 - rate *= (fbdiv << 24) + frac;
1016 + /* get operating mode (int/frac) and calculate rate accordingly */
1017 + rate = parent_rate;
1018 + if (pll_frac_get_mode(hw) == PLL_MODE_FRAC)
1019 + rate *= (fbdiv << 24) + frac;
1020 + else
1021 + rate *= (fbdiv << 24);
1022 +
1023 rate = do_div_round_closest(rate, (prediv * postdiv1 * postdiv2) << 24);
1024
1025 return rate;
1026 @@ -279,7 +320,7 @@ static int pll_gf40lp_laint_enable(struct clk_hw *hw)
1027 u32 val;
1028
1029 val = pll_readl(pll, PLL_CTRL1);
1030 - val &= ~(PLL_INT_CTRL1_PD | PLL_INT_CTRL1_DSMPD |
1031 + val &= ~(PLL_INT_CTRL1_PD |
1032 PLL_INT_CTRL1_FOUTPOSTDIVPD | PLL_INT_CTRL1_FOUTVCOPD);
1033 pll_writel(pll, val, PLL_CTRL1);
1034
1035 @@ -325,12 +366,12 @@ static int pll_gf40lp_laint_set_rate(struct clk_hw *hw, unsigned long rate,
1036 if (!params || !params->refdiv)
1037 return -EINVAL;
1038
1039 - vco = params->fref * params->fbdiv / params->refdiv;
1040 + vco = div_u64(params->fref * params->fbdiv, params->refdiv);
1041 if (vco < MIN_VCO_LA || vco > MAX_VCO_LA)
1042 pr_warn("%s: VCO %u is out of range %lu..%lu\n", name, vco,
1043 MIN_VCO_LA, MAX_VCO_LA);
1044
1045 - val = params->fref / params->refdiv;
1046 + val = div_u64(params->fref, params->refdiv);
1047 if (val < MIN_PFD)
1048 pr_warn("%s: PFD %u is too low (min %lu)\n",
1049 name, val, MIN_PFD);
1050 diff --git a/drivers/clk/pistachio/clk.h b/drivers/clk/pistachio/clk.h
1051 index 52fabbc24624..8d45178dbde3 100644
1052 --- a/drivers/clk/pistachio/clk.h
1053 +++ b/drivers/clk/pistachio/clk.h
1054 @@ -95,13 +95,13 @@ struct pistachio_fixed_factor {
1055 }
1056
1057 struct pistachio_pll_rate_table {
1058 - unsigned long fref;
1059 - unsigned long fout;
1060 - unsigned int refdiv;
1061 - unsigned int fbdiv;
1062 - unsigned int postdiv1;
1063 - unsigned int postdiv2;
1064 - unsigned int frac;
1065 + unsigned long long fref;
1066 + unsigned long long fout;
1067 + unsigned long long refdiv;
1068 + unsigned long long fbdiv;
1069 + unsigned long long postdiv1;
1070 + unsigned long long postdiv2;
1071 + unsigned long long frac;
1072 };
1073
1074 enum pistachio_pll_type {
1075 diff --git a/drivers/clk/pxa/clk-pxa25x.c b/drivers/clk/pxa/clk-pxa25x.c
1076 index 6cd88d963a7f..542e45ef5087 100644
1077 --- a/drivers/clk/pxa/clk-pxa25x.c
1078 +++ b/drivers/clk/pxa/clk-pxa25x.c
1079 @@ -79,7 +79,7 @@ unsigned int pxa25x_get_clk_frequency_khz(int info)
1080 clks[3] / 1000000, (clks[3] % 1000000) / 10000);
1081 }
1082
1083 - return (unsigned int)clks[0];
1084 + return (unsigned int)clks[0] / KHz;
1085 }
1086
1087 static unsigned long clk_pxa25x_memory_get_rate(struct clk_hw *hw,
1088 diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c
1089 index 9a31b77eed23..5b82d30baf9f 100644
1090 --- a/drivers/clk/pxa/clk-pxa27x.c
1091 +++ b/drivers/clk/pxa/clk-pxa27x.c
1092 @@ -80,7 +80,7 @@ unsigned int pxa27x_get_clk_frequency_khz(int info)
1093 pr_info("System bus clock: %ld.%02ldMHz\n",
1094 clks[4] / 1000000, (clks[4] % 1000000) / 10000);
1095 }
1096 - return (unsigned int)clks[0];
1097 + return (unsigned int)clks[0] / KHz;
1098 }
1099
1100 bool pxa27x_is_ppll_disabled(void)
1101 diff --git a/drivers/clk/pxa/clk-pxa3xx.c b/drivers/clk/pxa/clk-pxa3xx.c
1102 index ac03ba49e9d1..4af4eed5f89f 100644
1103 --- a/drivers/clk/pxa/clk-pxa3xx.c
1104 +++ b/drivers/clk/pxa/clk-pxa3xx.c
1105 @@ -78,7 +78,7 @@ unsigned int pxa3xx_get_clk_frequency_khz(int info)
1106 pr_info("System bus clock: %ld.%02ldMHz\n",
1107 clks[4] / 1000000, (clks[4] % 1000000) / 10000);
1108 }
1109 - return (unsigned int)clks[0];
1110 + return (unsigned int)clks[0] / KHz;
1111 }
1112
1113 static unsigned long clk_pxa3xx_ac97_get_rate(struct clk_hw *hw,
1114 diff --git a/drivers/clk/qcom/gcc-apq8084.c b/drivers/clk/qcom/gcc-apq8084.c
1115 index 54a756b90a37..457c540585f9 100644
1116 --- a/drivers/clk/qcom/gcc-apq8084.c
1117 +++ b/drivers/clk/qcom/gcc-apq8084.c
1118 @@ -2105,6 +2105,7 @@ static struct clk_branch gcc_ce1_clk = {
1119 "ce1_clk_src",
1120 },
1121 .num_parents = 1,
1122 + .flags = CLK_SET_RATE_PARENT,
1123 .ops = &clk_branch2_ops,
1124 },
1125 },
1126 diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c
1127 index c66f7bc2ae87..5d75bffab141 100644
1128 --- a/drivers/clk/qcom/gcc-msm8916.c
1129 +++ b/drivers/clk/qcom/gcc-msm8916.c
1130 @@ -2278,7 +2278,7 @@ static struct clk_branch gcc_prng_ahb_clk = {
1131 .halt_check = BRANCH_HALT_VOTED,
1132 .clkr = {
1133 .enable_reg = 0x45004,
1134 - .enable_mask = BIT(0),
1135 + .enable_mask = BIT(8),
1136 .hw.init = &(struct clk_init_data){
1137 .name = "gcc_prng_ahb_clk",
1138 .parent_names = (const char *[]){
1139 diff --git a/drivers/clk/qcom/gcc-msm8974.c b/drivers/clk/qcom/gcc-msm8974.c
1140 index c39d09874e74..f06a082e3e87 100644
1141 --- a/drivers/clk/qcom/gcc-msm8974.c
1142 +++ b/drivers/clk/qcom/gcc-msm8974.c
1143 @@ -1783,6 +1783,7 @@ static struct clk_branch gcc_ce1_clk = {
1144 "ce1_clk_src",
1145 },
1146 .num_parents = 1,
1147 + .flags = CLK_SET_RATE_PARENT,
1148 .ops = &clk_branch2_ops,
1149 },
1150 },
1151 diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
1152 index 4f817ed9e6ee..0211162ee879 100644
1153 --- a/drivers/clk/rockchip/clk-rk3288.c
1154 +++ b/drivers/clk/rockchip/clk-rk3288.c
1155 @@ -578,7 +578,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
1156 COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0,
1157 RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS,
1158 RK3288_CLKGATE_CON(2), 5, GFLAGS),
1159 - MUX(SCLK_MAC, "mac_clk", mux_mac_p, 0,
1160 + MUX(SCLK_MAC, "mac_clk", mux_mac_p, CLK_SET_RATE_PARENT,
1161 RK3288_CLKSEL_CON(21), 4, 1, MFLAGS),
1162 GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 0,
1163 RK3288_CLKGATE_CON(5), 3, GFLAGS),
1164 diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
1165 index cae2c048488d..d1af2fc53c5f 100644
1166 --- a/drivers/clk/samsung/clk-exynos4.c
1167 +++ b/drivers/clk/samsung/clk-exynos4.c
1168 @@ -86,6 +86,7 @@
1169 #define DIV_PERIL4 0xc560
1170 #define DIV_PERIL5 0xc564
1171 #define E4X12_DIV_CAM1 0xc568
1172 +#define E4X12_GATE_BUS_FSYS1 0xc744
1173 #define GATE_SCLK_CAM 0xc820
1174 #define GATE_IP_CAM 0xc920
1175 #define GATE_IP_TV 0xc924
1176 @@ -1097,6 +1098,7 @@ static struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = {
1177 0),
1178 GATE(CLK_PPMUIMAGE, "ppmuimage", "aclk200", E4X12_GATE_IP_IMAGE, 9, 0,
1179 0),
1180 + GATE(CLK_TSADC, "tsadc", "aclk133", E4X12_GATE_BUS_FSYS1, 16, 0, 0),
1181 GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
1182 GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0),
1183 GATE(CLK_SYSREG, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1,
1184 diff --git a/drivers/clk/samsung/clk-s5pv210.c b/drivers/clk/samsung/clk-s5pv210.c
1185 index cf7e8fa7b624..793cb1d2f7ae 100644
1186 --- a/drivers/clk/samsung/clk-s5pv210.c
1187 +++ b/drivers/clk/samsung/clk-s5pv210.c
1188 @@ -828,6 +828,8 @@ static void __init __s5pv210_clk_init(struct device_node *np,
1189
1190 s5pv210_clk_sleep_init();
1191
1192 + samsung_clk_of_add_provider(np, ctx);
1193 +
1194 pr_info("%s clocks: mout_apll = %ld, mout_mpll = %ld\n"
1195 "\tmout_epll = %ld, mout_vpll = %ld\n",
1196 is_s5p6442 ? "S5P6442" : "S5PV210",
1197 diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
1198 index a96dd8e53fdb..b674ffc4f5ce 100644
1199 --- a/drivers/clk/versatile/clk-sp810.c
1200 +++ b/drivers/clk/versatile/clk-sp810.c
1201 @@ -128,8 +128,8 @@ static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
1202 {
1203 struct clk_sp810 *sp810 = data;
1204
1205 - if (WARN_ON(clkspec->args_count != 1 || clkspec->args[0] >
1206 - ARRAY_SIZE(sp810->timerclken)))
1207 + if (WARN_ON(clkspec->args_count != 1 ||
1208 + clkspec->args[0] >= ARRAY_SIZE(sp810->timerclken)))
1209 return NULL;
1210
1211 return sp810->timerclken[clkspec->args[0]].clk;
1212 diff --git a/drivers/crypto/vmx/aes_ctr.c b/drivers/crypto/vmx/aes_ctr.c
1213 index 7adae42a7b79..ed3838781b4c 100644
1214 --- a/drivers/crypto/vmx/aes_ctr.c
1215 +++ b/drivers/crypto/vmx/aes_ctr.c
1216 @@ -113,6 +113,7 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc *desc,
1217 struct scatterlist *src, unsigned int nbytes)
1218 {
1219 int ret;
1220 + u64 inc;
1221 struct blkcipher_walk walk;
1222 struct p8_aes_ctr_ctx *ctx =
1223 crypto_tfm_ctx(crypto_blkcipher_tfm(desc->tfm));
1224 @@ -140,7 +141,12 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc *desc,
1225 walk.iv);
1226 pagefault_enable();
1227
1228 - crypto_inc(walk.iv, AES_BLOCK_SIZE);
1229 + /* We need to update IV mostly for last bytes/round */
1230 + inc = (nbytes & AES_BLOCK_MASK) / AES_BLOCK_SIZE;
1231 + if (inc > 0)
1232 + while (inc--)
1233 + crypto_inc(walk.iv, AES_BLOCK_SIZE);
1234 +
1235 nbytes &= AES_BLOCK_SIZE - 1;
1236 ret = blkcipher_walk_done(desc, &walk, nbytes);
1237 }
1238 diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
1239 index 6c5c20c6108e..228053921b3f 100644
1240 --- a/drivers/crypto/vmx/aesp8-ppc.pl
1241 +++ b/drivers/crypto/vmx/aesp8-ppc.pl
1242 @@ -1437,28 +1437,28 @@ Load_ctr32_enc_key:
1243 ?vperm v31,v31,$out0,$keyperm
1244 lvx v25,$x10,$key_ # pre-load round[2]
1245
1246 - vadduwm $two,$one,$one
1247 + vadduqm $two,$one,$one
1248 subi $inp,$inp,15 # undo "caller"
1249 $SHL $len,$len,4
1250
1251 - vadduwm $out1,$ivec,$one # counter values ...
1252 - vadduwm $out2,$ivec,$two
1253 + vadduqm $out1,$ivec,$one # counter values ...
1254 + vadduqm $out2,$ivec,$two
1255 vxor $out0,$ivec,$rndkey0 # ... xored with rndkey[0]
1256 le?li $idx,8
1257 - vadduwm $out3,$out1,$two
1258 + vadduqm $out3,$out1,$two
1259 vxor $out1,$out1,$rndkey0
1260 le?lvsl $inpperm,0,$idx
1261 - vadduwm $out4,$out2,$two
1262 + vadduqm $out4,$out2,$two
1263 vxor $out2,$out2,$rndkey0
1264 le?vspltisb $tmp,0x0f
1265 - vadduwm $out5,$out3,$two
1266 + vadduqm $out5,$out3,$two
1267 vxor $out3,$out3,$rndkey0
1268 le?vxor $inpperm,$inpperm,$tmp # transform for lvx_u/stvx_u
1269 - vadduwm $out6,$out4,$two
1270 + vadduqm $out6,$out4,$two
1271 vxor $out4,$out4,$rndkey0
1272 - vadduwm $out7,$out5,$two
1273 + vadduqm $out7,$out5,$two
1274 vxor $out5,$out5,$rndkey0
1275 - vadduwm $ivec,$out6,$two # next counter value
1276 + vadduqm $ivec,$out6,$two # next counter value
1277 vxor $out6,$out6,$rndkey0
1278 vxor $out7,$out7,$rndkey0
1279
1280 @@ -1594,27 +1594,27 @@ Loop_ctr32_enc8x_middle:
1281
1282 vcipherlast $in0,$out0,$in0
1283 vcipherlast $in1,$out1,$in1
1284 - vadduwm $out1,$ivec,$one # counter values ...
1285 + vadduqm $out1,$ivec,$one # counter values ...
1286 vcipherlast $in2,$out2,$in2
1287 - vadduwm $out2,$ivec,$two
1288 + vadduqm $out2,$ivec,$two
1289 vxor $out0,$ivec,$rndkey0 # ... xored with rndkey[0]
1290 vcipherlast $in3,$out3,$in3
1291 - vadduwm $out3,$out1,$two
1292 + vadduqm $out3,$out1,$two
1293 vxor $out1,$out1,$rndkey0
1294 vcipherlast $in4,$out4,$in4
1295 - vadduwm $out4,$out2,$two
1296 + vadduqm $out4,$out2,$two
1297 vxor $out2,$out2,$rndkey0
1298 vcipherlast $in5,$out5,$in5
1299 - vadduwm $out5,$out3,$two
1300 + vadduqm $out5,$out3,$two
1301 vxor $out3,$out3,$rndkey0
1302 vcipherlast $in6,$out6,$in6
1303 - vadduwm $out6,$out4,$two
1304 + vadduqm $out6,$out4,$two
1305 vxor $out4,$out4,$rndkey0
1306 vcipherlast $in7,$out7,$in7
1307 - vadduwm $out7,$out5,$two
1308 + vadduqm $out7,$out5,$two
1309 vxor $out5,$out5,$rndkey0
1310 le?vperm $in0,$in0,$in0,$inpperm
1311 - vadduwm $ivec,$out6,$two # next counter value
1312 + vadduqm $ivec,$out6,$two # next counter value
1313 vxor $out6,$out6,$rndkey0
1314 le?vperm $in1,$in1,$in1,$inpperm
1315 vxor $out7,$out7,$rndkey0
1316 diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl b/drivers/crypto/vmx/ghashp8-ppc.pl
1317 index 0a6f899839dd..d8429cb71f02 100644
1318 --- a/drivers/crypto/vmx/ghashp8-ppc.pl
1319 +++ b/drivers/crypto/vmx/ghashp8-ppc.pl
1320 @@ -61,6 +61,12 @@ $code=<<___;
1321 mtspr 256,r0
1322 li r10,0x30
1323 lvx_u $H,0,r4 # load H
1324 + le?xor r7,r7,r7
1325 + le?addi r7,r7,0x8 # need a vperm start with 08
1326 + le?lvsr 5,0,r7
1327 + le?vspltisb 6,0x0f
1328 + le?vxor 5,5,6 # set a b-endian mask
1329 + le?vperm $H,$H,$H,5
1330
1331 vspltisb $xC2,-16 # 0xf0
1332 vspltisb $t0,1 # one
1333 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1334 index 27df17a0e620..89c3dd62ba21 100644
1335 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1336 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
1337 @@ -75,6 +75,11 @@ void amdgpu_connector_hotplug(struct drm_connector *connector)
1338 if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
1339 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
1340 } else if (amdgpu_atombios_dp_needs_link_train(amdgpu_connector)) {
1341 + /* Don't try to start link training before we
1342 + * have the dpcd */
1343 + if (!amdgpu_atombios_dp_get_dpcd(amdgpu_connector))
1344 + return;
1345 +
1346 /* set it to OFF so that drm_helper_connector_dpms()
1347 * won't return immediately since the current state
1348 * is ON at this point.
1349 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
1350 index db5422e65ec5..a8207e5a8549 100644
1351 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
1352 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
1353 @@ -97,18 +97,12 @@ int amdgpu_ih_ring_init(struct amdgpu_device *adev, unsigned ring_size,
1354 /* add 8 bytes for the rptr/wptr shadows and
1355 * add them to the end of the ring allocation.
1356 */
1357 - adev->irq.ih.ring = kzalloc(adev->irq.ih.ring_size + 8, GFP_KERNEL);
1358 + adev->irq.ih.ring = pci_alloc_consistent(adev->pdev,
1359 + adev->irq.ih.ring_size + 8,
1360 + &adev->irq.ih.rb_dma_addr);
1361 if (adev->irq.ih.ring == NULL)
1362 return -ENOMEM;
1363 - adev->irq.ih.rb_dma_addr = pci_map_single(adev->pdev,
1364 - (void *)adev->irq.ih.ring,
1365 - adev->irq.ih.ring_size,
1366 - PCI_DMA_BIDIRECTIONAL);
1367 - if (pci_dma_mapping_error(adev->pdev, adev->irq.ih.rb_dma_addr)) {
1368 - dev_err(&adev->pdev->dev, "Failed to DMA MAP the IH RB page\n");
1369 - kfree((void *)adev->irq.ih.ring);
1370 - return -ENOMEM;
1371 - }
1372 + memset((void *)adev->irq.ih.ring, 0, adev->irq.ih.ring_size + 8);
1373 adev->irq.ih.wptr_offs = (adev->irq.ih.ring_size / 4) + 0;
1374 adev->irq.ih.rptr_offs = (adev->irq.ih.ring_size / 4) + 1;
1375 }
1376 @@ -148,9 +142,9 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev)
1377 /* add 8 bytes for the rptr/wptr shadows and
1378 * add them to the end of the ring allocation.
1379 */
1380 - pci_unmap_single(adev->pdev, adev->irq.ih.rb_dma_addr,
1381 - adev->irq.ih.ring_size + 8, PCI_DMA_BIDIRECTIONAL);
1382 - kfree((void *)adev->irq.ih.ring);
1383 + pci_free_consistent(adev->pdev, adev->irq.ih.ring_size + 8,
1384 + (void *)adev->irq.ih.ring,
1385 + adev->irq.ih.rb_dma_addr);
1386 adev->irq.ih.ring = NULL;
1387 }
1388 } else {
1389 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
1390 index f5c22556ec2c..2abc661845b6 100644
1391 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
1392 +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
1393 @@ -374,7 +374,8 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[])
1394 unsigned height_in_mb = ALIGN(height / 16, 2);
1395 unsigned fs_in_mb = width_in_mb * height_in_mb;
1396
1397 - unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size;
1398 + unsigned image_size, tmp, min_dpb_size, num_dpb_buffer;
1399 + unsigned min_ctx_size = 0;
1400
1401 image_size = width * height;
1402 image_size += image_size / 2;
1403 diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
1404 index 9ba0a7d5bc8e..92b6acadfc52 100644
1405 --- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
1406 +++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
1407 @@ -139,7 +139,8 @@ amdgpu_atombios_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *m
1408
1409 tx_buf[0] = msg->address & 0xff;
1410 tx_buf[1] = msg->address >> 8;
1411 - tx_buf[2] = msg->request << 4;
1412 + tx_buf[2] = (msg->request << 4) |
1413 + ((msg->address >> 16) & 0xf);
1414 tx_buf[3] = msg->size ? (msg->size - 1) : 0;
1415
1416 switch (msg->request & ~DP_AUX_I2C_MOT) {
1417 diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
1418 index e70a26f587a0..e774a437dd65 100644
1419 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
1420 +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
1421 @@ -1331,7 +1331,7 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev,
1422 tmp = REG_SET_FIELD(wm_mask, DPG_WATERMARK_MASK_CONTROL, URGENCY_WATERMARK_MASK, 2);
1423 WREG32(mmDPG_WATERMARK_MASK_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1424 tmp = RREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset);
1425 - tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_a);
1426 + tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_b);
1427 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_HIGH_WATERMARK, line_time);
1428 WREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1429 /* restore original selection */
1430 diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
1431 index dcb402ee048a..c4a21a7afd68 100644
1432 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
1433 +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
1434 @@ -1329,7 +1329,7 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev,
1435 tmp = REG_SET_FIELD(wm_mask, DPG_WATERMARK_MASK_CONTROL, URGENCY_WATERMARK_MASK, 2);
1436 WREG32(mmDPG_WATERMARK_MASK_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1437 tmp = RREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset);
1438 - tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_a);
1439 + tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_b);
1440 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_HIGH_WATERMARK, line_time);
1441 WREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1442 /* restore original selection */
1443 diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
1444 index 884b4f9b81c4..603146ec9868 100644
1445 --- a/drivers/gpu/drm/i915/i915_drv.c
1446 +++ b/drivers/gpu/drm/i915/i915_drv.c
1447 @@ -683,15 +683,18 @@ static int i915_drm_suspend_late(struct drm_device *drm_dev, bool hibernation)
1448
1449 pci_disable_device(drm_dev->pdev);
1450 /*
1451 - * During hibernation on some GEN4 platforms the BIOS may try to access
1452 + * During hibernation on some platforms the BIOS may try to access
1453 * the device even though it's already in D3 and hang the machine. So
1454 * leave the device in D0 on those platforms and hope the BIOS will
1455 - * power down the device properly. Platforms where this was seen:
1456 - * Lenovo Thinkpad X301, X61s
1457 + * power down the device properly. The issue was seen on multiple old
1458 + * GENs with different BIOS vendors, so having an explicit blacklist
1459 + * is inpractical; apply the workaround on everything pre GEN6. The
1460 + * platforms where the issue was seen:
1461 + * Lenovo Thinkpad X301, X61s, X60, T60, X41
1462 + * Fujitsu FSC S7110
1463 + * Acer Aspire 1830T
1464 */
1465 - if (!(hibernation &&
1466 - drm_dev->pdev->subsystem_vendor == PCI_VENDOR_ID_LENOVO &&
1467 - INTEL_INFO(dev_priv)->gen == 4))
1468 + if (!(hibernation && INTEL_INFO(dev_priv)->gen < 6))
1469 pci_set_power_state(drm_dev->pdev, PCI_D3hot);
1470
1471 return 0;
1472 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
1473 index fd1de451c8c6..e1df8feb05be 100644
1474 --- a/drivers/gpu/drm/i915/i915_drv.h
1475 +++ b/drivers/gpu/drm/i915/i915_drv.h
1476 @@ -3303,13 +3303,13 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val);
1477 #define I915_READ64(reg) dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true)
1478
1479 #define I915_READ64_2x32(lower_reg, upper_reg) ({ \
1480 - u32 upper, lower, tmp; \
1481 - tmp = I915_READ(upper_reg); \
1482 + u32 upper, lower, old_upper, loop = 0; \
1483 + upper = I915_READ(upper_reg); \
1484 do { \
1485 - upper = tmp; \
1486 + old_upper = upper; \
1487 lower = I915_READ(lower_reg); \
1488 - tmp = I915_READ(upper_reg); \
1489 - } while (upper != tmp); \
1490 + upper = I915_READ(upper_reg); \
1491 + } while (upper != old_upper && loop++ < 2); \
1492 (u64)upper << 32 | lower; })
1493
1494 #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg)
1495 diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
1496 index a7fa14516cda..5e6b4a29e503 100644
1497 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
1498 +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
1499 @@ -1024,6 +1024,7 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,
1500 u32 old_read = obj->base.read_domains;
1501 u32 old_write = obj->base.write_domain;
1502
1503 + obj->dirty = 1; /* be paranoid */
1504 obj->base.write_domain = obj->base.pending_write_domain;
1505 if (obj->base.write_domain == 0)
1506 obj->base.pending_read_domains |= obj->base.read_domains;
1507 @@ -1031,7 +1032,6 @@ i915_gem_execbuffer_move_to_active(struct list_head *vmas,
1508
1509 i915_vma_move_to_active(vma, ring);
1510 if (obj->base.write_domain) {
1511 - obj->dirty = 1;
1512 i915_gem_request_assign(&obj->last_write_req, req);
1513
1514 intel_fb_obj_invalidate(obj, ring, ORIGIN_CS);
1515 diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
1516 index bcb41e61877d..fb842d6e343f 100644
1517 --- a/drivers/gpu/drm/i915/intel_csr.c
1518 +++ b/drivers/gpu/drm/i915/intel_csr.c
1519 @@ -350,7 +350,7 @@ static void finish_csr_load(const struct firmware *fw, void *context)
1520 }
1521 csr->mmio_count = dmc_header->mmio_count;
1522 for (i = 0; i < dmc_header->mmio_count; i++) {
1523 - if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE &&
1524 + if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE ||
1525 dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
1526 DRM_ERROR(" Firmware has wrong mmio address 0x%x\n",
1527 dmc_header->mmioaddr[i]);
1528 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1529 index 87476ff181dd..107c6c0519fd 100644
1530 --- a/drivers/gpu/drm/i915/intel_display.c
1531 +++ b/drivers/gpu/drm/i915/intel_display.c
1532 @@ -14665,6 +14665,24 @@ void intel_modeset_init(struct drm_device *dev)
1533 if (INTEL_INFO(dev)->num_pipes == 0)
1534 return;
1535
1536 + /*
1537 + * There may be no VBT; and if the BIOS enabled SSC we can
1538 + * just keep using it to avoid unnecessary flicker. Whereas if the
1539 + * BIOS isn't using it, don't assume it will work even if the VBT
1540 + * indicates as much.
1541 + */
1542 + if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) {
1543 + bool bios_lvds_use_ssc = !!(I915_READ(PCH_DREF_CONTROL) &
1544 + DREF_SSC1_ENABLE);
1545 +
1546 + if (dev_priv->vbt.lvds_use_ssc != bios_lvds_use_ssc) {
1547 + DRM_DEBUG_KMS("SSC %sabled by BIOS, overriding VBT which says %sabled\n",
1548 + bios_lvds_use_ssc ? "en" : "dis",
1549 + dev_priv->vbt.lvds_use_ssc ? "en" : "dis");
1550 + dev_priv->vbt.lvds_use_ssc = bios_lvds_use_ssc;
1551 + }
1552 + }
1553 +
1554 intel_init_display(dev);
1555 intel_init_audio(dev);
1556
1557 @@ -15160,7 +15178,6 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
1558
1559 void intel_modeset_gem_init(struct drm_device *dev)
1560 {
1561 - struct drm_i915_private *dev_priv = dev->dev_private;
1562 struct drm_crtc *c;
1563 struct drm_i915_gem_object *obj;
1564 int ret;
1565 @@ -15169,16 +15186,6 @@ void intel_modeset_gem_init(struct drm_device *dev)
1566 intel_init_gt_powersave(dev);
1567 mutex_unlock(&dev->struct_mutex);
1568
1569 - /*
1570 - * There may be no VBT; and if the BIOS enabled SSC we can
1571 - * just keep using it to avoid unnecessary flicker. Whereas if the
1572 - * BIOS isn't using it, don't assume it will work even if the VBT
1573 - * indicates as much.
1574 - */
1575 - if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
1576 - dev_priv->vbt.lvds_use_ssc = !!(I915_READ(PCH_DREF_CONTROL) &
1577 - DREF_SSC1_ENABLE);
1578 -
1579 intel_modeset_init_hw(dev);
1580
1581 intel_setup_overlay(dev);
1582 diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
1583 index 1df0e1fe235f..bd8f8863eb0e 100644
1584 --- a/drivers/gpu/drm/i915/intel_dp.c
1585 +++ b/drivers/gpu/drm/i915/intel_dp.c
1586 @@ -4987,9 +4987,12 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
1587
1588 intel_dp_probe_oui(intel_dp);
1589
1590 - if (!intel_dp_probe_mst(intel_dp))
1591 + if (!intel_dp_probe_mst(intel_dp)) {
1592 + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1593 + intel_dp_check_link_status(intel_dp);
1594 + drm_modeset_unlock(&dev->mode_config.connection_mutex);
1595 goto mst_fail;
1596 -
1597 + }
1598 } else {
1599 if (intel_dp->is_mst) {
1600 if (intel_dp_check_mst_status(intel_dp) == -EINVAL)
1601 @@ -4997,10 +5000,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
1602 }
1603
1604 if (!intel_dp->is_mst) {
1605 - /*
1606 - * we'll check the link status via the normal hot plug path later -
1607 - * but for short hpds we should check it now
1608 - */
1609 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1610 intel_dp_check_link_status(intel_dp);
1611 drm_modeset_unlock(&dev->mode_config.connection_mutex);
1612 diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
1613 index b5a5558ecd63..68b25dd525f0 100644
1614 --- a/drivers/gpu/drm/i915/intel_dsi.c
1615 +++ b/drivers/gpu/drm/i915/intel_dsi.c
1616 @@ -1036,11 +1036,7 @@ void intel_dsi_init(struct drm_device *dev)
1617 intel_connector->unregister = intel_connector_unregister;
1618
1619 /* Pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI port C */
1620 - if (dev_priv->vbt.dsi.config->dual_link) {
1621 - /* XXX: does dual link work on either pipe? */
1622 - intel_encoder->crtc_mask = (1 << PIPE_A);
1623 - intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
1624 - } else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
1625 + if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
1626 intel_encoder->crtc_mask = (1 << PIPE_A);
1627 intel_dsi->ports = (1 << PORT_A);
1628 } else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIC) {
1629 @@ -1048,6 +1044,9 @@ void intel_dsi_init(struct drm_device *dev)
1630 intel_dsi->ports = (1 << PORT_C);
1631 }
1632
1633 + if (dev_priv->vbt.dsi.config->dual_link)
1634 + intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
1635 +
1636 /* Create a DSI host (and a device) for each port. */
1637 for_each_dsi_port(port, intel_dsi->ports) {
1638 struct intel_dsi_host *host;
1639 diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
1640 index a8dbb3ef4e3c..7c6225c84ba6 100644
1641 --- a/drivers/gpu/drm/qxl/qxl_display.c
1642 +++ b/drivers/gpu/drm/qxl/qxl_display.c
1643 @@ -160,9 +160,35 @@ static int qxl_add_monitors_config_modes(struct drm_connector *connector,
1644 *pwidth = head->width;
1645 *pheight = head->height;
1646 drm_mode_probed_add(connector, mode);
1647 + /* remember the last custom size for mode validation */
1648 + qdev->monitors_config_width = mode->hdisplay;
1649 + qdev->monitors_config_height = mode->vdisplay;
1650 return 1;
1651 }
1652
1653 +static struct mode_size {
1654 + int w;
1655 + int h;
1656 +} common_modes[] = {
1657 + { 640, 480},
1658 + { 720, 480},
1659 + { 800, 600},
1660 + { 848, 480},
1661 + {1024, 768},
1662 + {1152, 768},
1663 + {1280, 720},
1664 + {1280, 800},
1665 + {1280, 854},
1666 + {1280, 960},
1667 + {1280, 1024},
1668 + {1440, 900},
1669 + {1400, 1050},
1670 + {1680, 1050},
1671 + {1600, 1200},
1672 + {1920, 1080},
1673 + {1920, 1200}
1674 +};
1675 +
1676 static int qxl_add_common_modes(struct drm_connector *connector,
1677 unsigned pwidth,
1678 unsigned pheight)
1679 @@ -170,29 +196,6 @@ static int qxl_add_common_modes(struct drm_connector *connector,
1680 struct drm_device *dev = connector->dev;
1681 struct drm_display_mode *mode = NULL;
1682 int i;
1683 - struct mode_size {
1684 - int w;
1685 - int h;
1686 - } common_modes[] = {
1687 - { 640, 480},
1688 - { 720, 480},
1689 - { 800, 600},
1690 - { 848, 480},
1691 - {1024, 768},
1692 - {1152, 768},
1693 - {1280, 720},
1694 - {1280, 800},
1695 - {1280, 854},
1696 - {1280, 960},
1697 - {1280, 1024},
1698 - {1440, 900},
1699 - {1400, 1050},
1700 - {1680, 1050},
1701 - {1600, 1200},
1702 - {1920, 1080},
1703 - {1920, 1200}
1704 - };
1705 -
1706 for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
1707 mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h,
1708 60, false, false, false);
1709 @@ -823,11 +826,22 @@ static int qxl_conn_get_modes(struct drm_connector *connector)
1710 static int qxl_conn_mode_valid(struct drm_connector *connector,
1711 struct drm_display_mode *mode)
1712 {
1713 + struct drm_device *ddev = connector->dev;
1714 + struct qxl_device *qdev = ddev->dev_private;
1715 + int i;
1716 +
1717 /* TODO: is this called for user defined modes? (xrandr --add-mode)
1718 * TODO: check that the mode fits in the framebuffer */
1719 - DRM_DEBUG("%s: %dx%d status=%d\n", mode->name, mode->hdisplay,
1720 - mode->vdisplay, mode->status);
1721 - return MODE_OK;
1722 +
1723 + if(qdev->monitors_config_width == mode->hdisplay &&
1724 + qdev->monitors_config_height == mode->vdisplay)
1725 + return MODE_OK;
1726 +
1727 + for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
1728 + if (common_modes[i].w == mode->hdisplay && common_modes[i].h == mode->vdisplay)
1729 + return MODE_OK;
1730 + }
1731 + return MODE_BAD;
1732 }
1733
1734 static struct drm_encoder *qxl_best_encoder(struct drm_connector *connector)
1735 diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
1736 index d8549690801d..01a86948eb8c 100644
1737 --- a/drivers/gpu/drm/qxl/qxl_drv.h
1738 +++ b/drivers/gpu/drm/qxl/qxl_drv.h
1739 @@ -325,6 +325,8 @@ struct qxl_device {
1740 struct work_struct fb_work;
1741
1742 struct drm_property *hotplug_mode_update_property;
1743 + int monitors_config_width;
1744 + int monitors_config_height;
1745 };
1746
1747 /* forward declaration for QXL_INFO_IO */
1748 diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
1749 index f81e0d7d0232..9cd49c584263 100644
1750 --- a/drivers/gpu/drm/radeon/atombios_dp.c
1751 +++ b/drivers/gpu/drm/radeon/atombios_dp.c
1752 @@ -171,8 +171,9 @@ radeon_dp_aux_transfer_atom(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
1753 return -E2BIG;
1754
1755 tx_buf[0] = msg->address & 0xff;
1756 - tx_buf[1] = msg->address >> 8;
1757 - tx_buf[2] = msg->request << 4;
1758 + tx_buf[1] = (msg->address >> 8) & 0xff;
1759 + tx_buf[2] = (msg->request << 4) |
1760 + ((msg->address >> 16) & 0xf);
1761 tx_buf[3] = msg->size ? (msg->size - 1) : 0;
1762
1763 switch (msg->request & ~DP_AUX_I2C_MOT) {
1764 diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
1765 index fbc8d88d6e5d..2c02e99b5f95 100644
1766 --- a/drivers/gpu/drm/radeon/radeon_audio.c
1767 +++ b/drivers/gpu/drm/radeon/radeon_audio.c
1768 @@ -522,13 +522,15 @@ static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
1769 return err;
1770 }
1771
1772 - if (drm_rgb_quant_range_selectable(radeon_connector_edid(connector))) {
1773 - if (radeon_encoder->output_csc == RADEON_OUTPUT_CSC_TVRGB)
1774 - frame.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED;
1775 - else
1776 - frame.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
1777 - } else {
1778 - frame.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
1779 + if (radeon_encoder->output_csc != RADEON_OUTPUT_CSC_BYPASS) {
1780 + if (drm_rgb_quant_range_selectable(radeon_connector_edid(connector))) {
1781 + if (radeon_encoder->output_csc == RADEON_OUTPUT_CSC_TVRGB)
1782 + frame.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED;
1783 + else
1784 + frame.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
1785 + } else {
1786 + frame.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
1787 + }
1788 }
1789
1790 err = hdmi_avi_infoframe_pack(&frame, buffer, sizeof(buffer));
1791 diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
1792 index 94b21ae70ef7..5a2cafb4f1bc 100644
1793 --- a/drivers/gpu/drm/radeon/radeon_connectors.c
1794 +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
1795 @@ -95,6 +95,11 @@ void radeon_connector_hotplug(struct drm_connector *connector)
1796 if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
1797 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
1798 } else if (radeon_dp_needs_link_train(radeon_connector)) {
1799 + /* Don't try to start link training before we
1800 + * have the dpcd */
1801 + if (!radeon_dp_getdpcd(radeon_connector))
1802 + return;
1803 +
1804 /* set it to OFF so that drm_helper_connector_dpms()
1805 * won't return immediately since the current state
1806 * is ON at this point.
1807 diff --git a/drivers/gpu/drm/radeon/radeon_dp_auxch.c b/drivers/gpu/drm/radeon/radeon_dp_auxch.c
1808 index fcbd60bb0349..3b0c229d7dcd 100644
1809 --- a/drivers/gpu/drm/radeon/radeon_dp_auxch.c
1810 +++ b/drivers/gpu/drm/radeon/radeon_dp_auxch.c
1811 @@ -116,8 +116,8 @@ radeon_dp_aux_transfer_native(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg
1812 AUX_SW_WR_BYTES(bytes));
1813
1814 /* write the data header into the registers */
1815 - /* request, addres, msg size */
1816 - byte = (msg->request << 4);
1817 + /* request, address, msg size */
1818 + byte = (msg->request << 4) | ((msg->address >> 16) & 0xf);
1819 WREG32(AUX_SW_DATA + aux_offset[instance],
1820 AUX_SW_DATA_MASK(byte) | AUX_SW_AUTOINCREMENT_DISABLE);
1821
1822 diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
1823 index a2dbbbe0d8d7..39bf74793b8b 100644
1824 --- a/drivers/hid/hid-cp2112.c
1825 +++ b/drivers/hid/hid-cp2112.c
1826 @@ -537,7 +537,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
1827 struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data;
1828 struct hid_device *hdev = dev->hdev;
1829 u8 buf[64];
1830 - __be16 word;
1831 + __le16 word;
1832 ssize_t count;
1833 size_t read_length = 0;
1834 unsigned int retries;
1835 @@ -554,7 +554,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
1836 if (I2C_SMBUS_READ == read_write)
1837 count = cp2112_read_req(buf, addr, read_length);
1838 else
1839 - count = cp2112_write_req(buf, addr, data->byte, NULL,
1840 + count = cp2112_write_req(buf, addr, command, NULL,
1841 0);
1842 break;
1843 case I2C_SMBUS_BYTE_DATA:
1844 @@ -569,7 +569,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
1845 break;
1846 case I2C_SMBUS_WORD_DATA:
1847 read_length = 2;
1848 - word = cpu_to_be16(data->word);
1849 + word = cpu_to_le16(data->word);
1850
1851 if (I2C_SMBUS_READ == read_write)
1852 count = cp2112_write_read_req(buf, addr, read_length,
1853 @@ -582,7 +582,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
1854 size = I2C_SMBUS_WORD_DATA;
1855 read_write = I2C_SMBUS_READ;
1856 read_length = 2;
1857 - word = cpu_to_be16(data->word);
1858 + word = cpu_to_le16(data->word);
1859
1860 count = cp2112_write_read_req(buf, addr, read_length, command,
1861 (u8 *)&word, 2);
1862 @@ -675,7 +675,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr,
1863 data->byte = buf[0];
1864 break;
1865 case I2C_SMBUS_WORD_DATA:
1866 - data->word = be16_to_cpup((__be16 *)buf);
1867 + data->word = le16_to_cpup((__le16 *)buf);
1868 break;
1869 case I2C_SMBUS_BLOCK_DATA:
1870 if (read_length > I2C_SMBUS_BLOCK_MAX) {
1871 diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
1872 index bfbe1bedda7f..eab5bd6a2442 100644
1873 --- a/drivers/hid/usbhid/hid-core.c
1874 +++ b/drivers/hid/usbhid/hid-core.c
1875 @@ -164,7 +164,7 @@ static void hid_io_error(struct hid_device *hid)
1876 if (time_after(jiffies, usbhid->stop_retry)) {
1877
1878 /* Retries failed, so do a port reset unless we lack bandwidth*/
1879 - if (test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
1880 + if (!test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
1881 && !test_and_set_bit(HID_RESET_PENDING, &usbhid->iofl)) {
1882
1883 schedule_work(&usbhid->reset_work);
1884 diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
1885 index 13ea1ea23328..bda69a4355fa 100644
1886 --- a/drivers/iio/accel/mma8452.c
1887 +++ b/drivers/iio/accel/mma8452.c
1888 @@ -229,7 +229,7 @@ static int mma8452_get_hp_filter_index(struct mma8452_data *data,
1889 int i = mma8452_get_odr_index(data);
1890
1891 return mma8452_get_int_plus_micros_index(mma8452_hp_filter_cutoff[i],
1892 - ARRAY_SIZE(mma8452_scales[0]), val, val2);
1893 + ARRAY_SIZE(mma8452_hp_filter_cutoff[0]), val, val2);
1894 }
1895
1896 static int mma8452_read_hp_filter(struct mma8452_data *data, int *hz, int *uHz)
1897 diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
1898 index b3d0e94f72eb..8d2439345673 100644
1899 --- a/drivers/iio/gyro/Kconfig
1900 +++ b/drivers/iio/gyro/Kconfig
1901 @@ -53,7 +53,8 @@ config ADXRS450
1902 config BMG160
1903 tristate "BOSCH BMG160 Gyro Sensor"
1904 depends on I2C
1905 - select IIO_TRIGGERED_BUFFER if IIO_BUFFER
1906 + select IIO_BUFFER
1907 + select IIO_TRIGGERED_BUFFER
1908 help
1909 Say yes here to build support for Bosch BMG160 Tri-axis Gyro Sensor
1910 driver. This driver also supports BMI055 gyroscope.
1911 diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
1912 index 2fd68f2219a7..d42e4fe2c7ed 100644
1913 --- a/drivers/iio/imu/adis16400_core.c
1914 +++ b/drivers/iio/imu/adis16400_core.c
1915 @@ -780,7 +780,7 @@ static struct adis16400_chip_info adis16400_chips[] = {
1916 .flags = ADIS16400_HAS_PROD_ID |
1917 ADIS16400_HAS_SERIAL_NUMBER |
1918 ADIS16400_BURST_DIAG_STAT,
1919 - .gyro_scale_micro = IIO_DEGREE_TO_RAD(10000), /* 0.01 deg/s */
1920 + .gyro_scale_micro = IIO_DEGREE_TO_RAD(40000), /* 0.04 deg/s */
1921 .accel_scale_micro = IIO_G_TO_M_S_2(833), /* 1/1200 g */
1922 .temp_scale_nano = 73860000, /* 0.07386 C */
1923 .temp_offset = 31000000 / 73860, /* 31 C = 0x00 */
1924 diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
1925 index 989605dd6f78..b94bfd3f595b 100644
1926 --- a/drivers/iio/imu/adis16480.c
1927 +++ b/drivers/iio/imu/adis16480.c
1928 @@ -110,6 +110,10 @@
1929 struct adis16480_chip_info {
1930 unsigned int num_channels;
1931 const struct iio_chan_spec *channels;
1932 + unsigned int gyro_max_val;
1933 + unsigned int gyro_max_scale;
1934 + unsigned int accel_max_val;
1935 + unsigned int accel_max_scale;
1936 };
1937
1938 struct adis16480 {
1939 @@ -497,19 +501,21 @@ static int adis16480_set_filter_freq(struct iio_dev *indio_dev,
1940 static int adis16480_read_raw(struct iio_dev *indio_dev,
1941 const struct iio_chan_spec *chan, int *val, int *val2, long info)
1942 {
1943 + struct adis16480 *st = iio_priv(indio_dev);
1944 +
1945 switch (info) {
1946 case IIO_CHAN_INFO_RAW:
1947 return adis_single_conversion(indio_dev, chan, 0, val);
1948 case IIO_CHAN_INFO_SCALE:
1949 switch (chan->type) {
1950 case IIO_ANGL_VEL:
1951 - *val = 0;
1952 - *val2 = IIO_DEGREE_TO_RAD(20000); /* 0.02 degree/sec */
1953 - return IIO_VAL_INT_PLUS_MICRO;
1954 + *val = st->chip_info->gyro_max_scale;
1955 + *val2 = st->chip_info->gyro_max_val;
1956 + return IIO_VAL_FRACTIONAL;
1957 case IIO_ACCEL:
1958 - *val = 0;
1959 - *val2 = IIO_G_TO_M_S_2(800); /* 0.8 mg */
1960 - return IIO_VAL_INT_PLUS_MICRO;
1961 + *val = st->chip_info->accel_max_scale;
1962 + *val2 = st->chip_info->accel_max_val;
1963 + return IIO_VAL_FRACTIONAL;
1964 case IIO_MAGN:
1965 *val = 0;
1966 *val2 = 100; /* 0.0001 gauss */
1967 @@ -674,18 +680,39 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
1968 [ADIS16375] = {
1969 .channels = adis16485_channels,
1970 .num_channels = ARRAY_SIZE(adis16485_channels),
1971 + /*
1972 + * storing the value in rad/degree and the scale in degree
1973 + * gives us the result in rad and better precession than
1974 + * storing the scale directly in rad.
1975 + */
1976 + .gyro_max_val = IIO_RAD_TO_DEGREE(22887),
1977 + .gyro_max_scale = 300,
1978 + .accel_max_val = IIO_M_S_2_TO_G(21973),
1979 + .accel_max_scale = 18,
1980 },
1981 [ADIS16480] = {
1982 .channels = adis16480_channels,
1983 .num_channels = ARRAY_SIZE(adis16480_channels),
1984 + .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
1985 + .gyro_max_scale = 450,
1986 + .accel_max_val = IIO_M_S_2_TO_G(12500),
1987 + .accel_max_scale = 5,
1988 },
1989 [ADIS16485] = {
1990 .channels = adis16485_channels,
1991 .num_channels = ARRAY_SIZE(adis16485_channels),
1992 + .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
1993 + .gyro_max_scale = 450,
1994 + .accel_max_val = IIO_M_S_2_TO_G(20000),
1995 + .accel_max_scale = 5,
1996 },
1997 [ADIS16488] = {
1998 .channels = adis16480_channels,
1999 .num_channels = ARRAY_SIZE(adis16480_channels),
2000 + .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
2001 + .gyro_max_scale = 450,
2002 + .accel_max_val = IIO_M_S_2_TO_G(22500),
2003 + .accel_max_scale = 18,
2004 },
2005 };
2006
2007 diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
2008 index 6eee1b044c60..b3fda9ee4174 100644
2009 --- a/drivers/iio/industrialio-buffer.c
2010 +++ b/drivers/iio/industrialio-buffer.c
2011 @@ -151,7 +151,7 @@ unsigned int iio_buffer_poll(struct file *filp,
2012 struct iio_buffer *rb = indio_dev->buffer;
2013
2014 if (!indio_dev->info)
2015 - return -ENODEV;
2016 + return 0;
2017
2018 poll_wait(filp, &rb->pollq, wait);
2019 if (iio_buffer_ready(indio_dev, rb, rb->watermark, 0))
2020 diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
2021 index 894d8137c4cf..52d4fcb0de1d 100644
2022 --- a/drivers/iio/industrialio-event.c
2023 +++ b/drivers/iio/industrialio-event.c
2024 @@ -84,7 +84,7 @@ static unsigned int iio_event_poll(struct file *filep,
2025 unsigned int events = 0;
2026
2027 if (!indio_dev->info)
2028 - return -ENODEV;
2029 + return events;
2030
2031 poll_wait(filep, &ev_int->wait, wait);
2032
2033 diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
2034 index 1fe93cfea7d3..9d0672b58c31 100644
2035 --- a/drivers/md/dm-cache-target.c
2036 +++ b/drivers/md/dm-cache-target.c
2037 @@ -1729,6 +1729,8 @@ static void remap_cell_to_origin_clear_discard(struct cache *cache,
2038 remap_to_origin(cache, bio);
2039 issue(cache, bio);
2040 }
2041 +
2042 + free_prison_cell(cache, cell);
2043 }
2044
2045 static void remap_cell_to_cache_dirty(struct cache *cache, struct dm_bio_prison_cell *cell,
2046 @@ -1763,6 +1765,8 @@ static void remap_cell_to_cache_dirty(struct cache *cache, struct dm_bio_prison_
2047 remap_to_cache(cache, bio, cblock);
2048 issue(cache, bio);
2049 }
2050 +
2051 + free_prison_cell(cache, cell);
2052 }
2053
2054 /*----------------------------------------------------------------*/
2055 diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
2056 index 8a8b48fa901a..8289804ccd99 100644
2057 --- a/drivers/md/dm-stats.c
2058 +++ b/drivers/md/dm-stats.c
2059 @@ -457,12 +457,24 @@ static int dm_stats_list(struct dm_stats *stats, const char *program,
2060 list_for_each_entry(s, &stats->list, list_entry) {
2061 if (!program || !strcmp(program, s->program_id)) {
2062 len = s->end - s->start;
2063 - DMEMIT("%d: %llu+%llu %llu %s %s\n", s->id,
2064 + DMEMIT("%d: %llu+%llu %llu %s %s", s->id,
2065 (unsigned long long)s->start,
2066 (unsigned long long)len,
2067 (unsigned long long)s->step,
2068 s->program_id,
2069 s->aux_data);
2070 + if (s->stat_flags & STAT_PRECISE_TIMESTAMPS)
2071 + DMEMIT(" precise_timestamps");
2072 + if (s->n_histogram_entries) {
2073 + unsigned i;
2074 + DMEMIT(" histogram:");
2075 + for (i = 0; i < s->n_histogram_entries; i++) {
2076 + if (i)
2077 + DMEMIT(",");
2078 + DMEMIT("%llu", s->histogram_boundaries[i]);
2079 + }
2080 + }
2081 + DMEMIT("\n");
2082 }
2083 }
2084 mutex_unlock(&stats->mutex);
2085 diff --git a/drivers/of/address.c b/drivers/of/address.c
2086 index 8bfda6ade2c0..384574c3987c 100644
2087 --- a/drivers/of/address.c
2088 +++ b/drivers/of/address.c
2089 @@ -845,10 +845,10 @@ struct device_node *of_find_matching_node_by_address(struct device_node *from,
2090 struct resource res;
2091
2092 while (dn) {
2093 - if (of_address_to_resource(dn, 0, &res))
2094 - continue;
2095 - if (res.start == base_address)
2096 + if (!of_address_to_resource(dn, 0, &res) &&
2097 + res.start == base_address)
2098 return dn;
2099 +
2100 dn = of_find_matching_node(dn, matches);
2101 }
2102
2103 diff --git a/drivers/pci/access.c b/drivers/pci/access.c
2104 index d9b64a175990..b965c12168b7 100644
2105 --- a/drivers/pci/access.c
2106 +++ b/drivers/pci/access.c
2107 @@ -439,6 +439,56 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = {
2108 .release = pci_vpd_pci22_release,
2109 };
2110
2111 +static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count,
2112 + void *arg)
2113 +{
2114 + struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
2115 + ssize_t ret;
2116 +
2117 + if (!tdev)
2118 + return -ENODEV;
2119 +
2120 + ret = pci_read_vpd(tdev, pos, count, arg);
2121 + pci_dev_put(tdev);
2122 + return ret;
2123 +}
2124 +
2125 +static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count,
2126 + const void *arg)
2127 +{
2128 + struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
2129 + ssize_t ret;
2130 +
2131 + if (!tdev)
2132 + return -ENODEV;
2133 +
2134 + ret = pci_write_vpd(tdev, pos, count, arg);
2135 + pci_dev_put(tdev);
2136 + return ret;
2137 +}
2138 +
2139 +static const struct pci_vpd_ops pci_vpd_f0_ops = {
2140 + .read = pci_vpd_f0_read,
2141 + .write = pci_vpd_f0_write,
2142 + .release = pci_vpd_pci22_release,
2143 +};
2144 +
2145 +static int pci_vpd_f0_dev_check(struct pci_dev *dev)
2146 +{
2147 + struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
2148 + int ret = 0;
2149 +
2150 + if (!tdev)
2151 + return -ENODEV;
2152 + if (!tdev->vpd || !tdev->multifunction ||
2153 + dev->class != tdev->class || dev->vendor != tdev->vendor ||
2154 + dev->device != tdev->device)
2155 + ret = -ENODEV;
2156 +
2157 + pci_dev_put(tdev);
2158 + return ret;
2159 +}
2160 +
2161 int pci_vpd_pci22_init(struct pci_dev *dev)
2162 {
2163 struct pci_vpd_pci22 *vpd;
2164 @@ -447,12 +497,21 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
2165 cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
2166 if (!cap)
2167 return -ENODEV;
2168 + if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0) {
2169 + int ret = pci_vpd_f0_dev_check(dev);
2170 +
2171 + if (ret)
2172 + return ret;
2173 + }
2174 vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC);
2175 if (!vpd)
2176 return -ENOMEM;
2177
2178 vpd->base.len = PCI_VPD_PCI22_SIZE;
2179 - vpd->base.ops = &pci_vpd_pci22_ops;
2180 + if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0)
2181 + vpd->base.ops = &pci_vpd_f0_ops;
2182 + else
2183 + vpd->base.ops = &pci_vpd_pci22_ops;
2184 mutex_init(&vpd->lock);
2185 vpd->cap = cap;
2186 vpd->busy = false;
2187 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
2188 index e9fd0e90fa3b..dbd13854f21e 100644
2189 --- a/drivers/pci/quirks.c
2190 +++ b/drivers/pci/quirks.c
2191 @@ -1569,6 +1569,18 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB3
2192
2193 #endif
2194
2195 +static void quirk_jmicron_async_suspend(struct pci_dev *dev)
2196 +{
2197 + if (dev->multifunction) {
2198 + device_disable_async_suspend(&dev->dev);
2199 + dev_info(&dev->dev, "async suspend disabled to avoid multi-function power-on ordering issue\n");
2200 + }
2201 +}
2202 +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE, 8, quirk_jmicron_async_suspend);
2203 +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0, quirk_jmicron_async_suspend);
2204 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_JMICRON, 0x2362, quirk_jmicron_async_suspend);
2205 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_JMICRON, 0x236f, quirk_jmicron_async_suspend);
2206 +
2207 #ifdef CONFIG_X86_IO_APIC
2208 static void quirk_alder_ioapic(struct pci_dev *pdev)
2209 {
2210 @@ -1894,6 +1906,15 @@ static void quirk_netmos(struct pci_dev *dev)
2211 DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID,
2212 PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos);
2213
2214 +static void quirk_f0_vpd_link(struct pci_dev *dev)
2215 +{
2216 + if (!dev->multifunction || !PCI_FUNC(dev->devfn))
2217 + return;
2218 + dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0;
2219 +}
2220 +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
2221 + PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link);
2222 +
2223 static void quirk_e100_interrupt(struct pci_dev *dev)
2224 {
2225 u16 command, pmcsr;
2226 @@ -2829,12 +2850,15 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);
2227
2228 static void fixup_ti816x_class(struct pci_dev *dev)
2229 {
2230 + u32 class = dev->class;
2231 +
2232 /* TI 816x devices do not have class code set when in PCIe boot mode */
2233 - dev_info(&dev->dev, "Setting PCI class for 816x PCIe device\n");
2234 - dev->class = PCI_CLASS_MULTIMEDIA_VIDEO;
2235 + dev->class = PCI_CLASS_MULTIMEDIA_VIDEO << 8;
2236 + dev_info(&dev->dev, "PCI class overridden (%#08x -> %#08x)\n",
2237 + class, dev->class);
2238 }
2239 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_TI, 0xb800,
2240 - PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class);
2241 + PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class);
2242
2243 /* Some PCIe devices do not work reliably with the claimed maximum
2244 * payload size supported.
2245 diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
2246 index bd2b75c0d1d1..4fa7bcaf454e 100644
2247 --- a/drivers/regulator/pbias-regulator.c
2248 +++ b/drivers/regulator/pbias-regulator.c
2249 @@ -30,6 +30,7 @@
2250 struct pbias_reg_info {
2251 u32 enable;
2252 u32 enable_mask;
2253 + u32 disable_val;
2254 u32 vmode;
2255 unsigned int enable_time;
2256 char *name;
2257 @@ -62,6 +63,7 @@ static const struct pbias_reg_info pbias_mmc_omap2430 = {
2258 .enable = BIT(1),
2259 .enable_mask = BIT(1),
2260 .vmode = BIT(0),
2261 + .disable_val = 0,
2262 .enable_time = 100,
2263 .name = "pbias_mmc_omap2430"
2264 };
2265 @@ -77,6 +79,7 @@ static const struct pbias_reg_info pbias_sim_omap3 = {
2266 static const struct pbias_reg_info pbias_mmc_omap4 = {
2267 .enable = BIT(26) | BIT(22),
2268 .enable_mask = BIT(26) | BIT(25) | BIT(22),
2269 + .disable_val = BIT(25),
2270 .vmode = BIT(21),
2271 .enable_time = 100,
2272 .name = "pbias_mmc_omap4"
2273 @@ -85,6 +88,7 @@ static const struct pbias_reg_info pbias_mmc_omap4 = {
2274 static const struct pbias_reg_info pbias_mmc_omap5 = {
2275 .enable = BIT(27) | BIT(26),
2276 .enable_mask = BIT(27) | BIT(25) | BIT(26),
2277 + .disable_val = BIT(25),
2278 .vmode = BIT(21),
2279 .enable_time = 100,
2280 .name = "pbias_mmc_omap5"
2281 @@ -159,6 +163,7 @@ static int pbias_regulator_probe(struct platform_device *pdev)
2282 drvdata[data_idx].desc.enable_reg = res->start;
2283 drvdata[data_idx].desc.enable_mask = info->enable_mask;
2284 drvdata[data_idx].desc.enable_val = info->enable;
2285 + drvdata[data_idx].desc.disable_val = info->disable_val;
2286
2287 cfg.init_data = pbias_matches[idx].init_data;
2288 cfg.driver_data = &drvdata[data_idx];
2289 diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
2290 index 75d0457a77b7..fa7036c4daf9 100644
2291 --- a/drivers/soc/tegra/pmc.c
2292 +++ b/drivers/soc/tegra/pmc.c
2293 @@ -736,12 +736,12 @@ void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
2294 u32 value, checksum;
2295
2296 if (!pmc->soc->has_tsense_reset)
2297 - goto out;
2298 + return;
2299
2300 np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip");
2301 if (!np) {
2302 dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
2303 - goto out;
2304 + return;
2305 }
2306
2307 if (of_property_read_u32(np, "nvidia,i2c-controller-id", &ctrl_id)) {
2308 diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
2309 index 59705ab23577..c9357bb393d3 100644
2310 --- a/drivers/spi/spi-bcm2835.c
2311 +++ b/drivers/spi/spi-bcm2835.c
2312 @@ -553,13 +553,11 @@ static int bcm2835_spi_transfer_one(struct spi_master *master,
2313 spi_used_hz = cdiv ? (clk_hz / cdiv) : (clk_hz / 65536);
2314 bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
2315
2316 - /* handle all the modes */
2317 + /* handle all the 3-wire mode */
2318 if ((spi->mode & SPI_3WIRE) && (tfr->rx_buf))
2319 cs |= BCM2835_SPI_CS_REN;
2320 - if (spi->mode & SPI_CPOL)
2321 - cs |= BCM2835_SPI_CS_CPOL;
2322 - if (spi->mode & SPI_CPHA)
2323 - cs |= BCM2835_SPI_CS_CPHA;
2324 + else
2325 + cs &= ~BCM2835_SPI_CS_REN;
2326
2327 /* for gpio_cs set dummy CS so that no HW-CS get changed
2328 * we can not run this in bcm2835_spi_set_cs, as it does
2329 @@ -592,6 +590,25 @@ static int bcm2835_spi_transfer_one(struct spi_master *master,
2330 return bcm2835_spi_transfer_one_irq(master, spi, tfr, cs);
2331 }
2332
2333 +static int bcm2835_spi_prepare_message(struct spi_master *master,
2334 + struct spi_message *msg)
2335 +{
2336 + struct spi_device *spi = msg->spi;
2337 + struct bcm2835_spi *bs = spi_master_get_devdata(master);
2338 + u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
2339 +
2340 + cs &= ~(BCM2835_SPI_CS_CPOL | BCM2835_SPI_CS_CPHA);
2341 +
2342 + if (spi->mode & SPI_CPOL)
2343 + cs |= BCM2835_SPI_CS_CPOL;
2344 + if (spi->mode & SPI_CPHA)
2345 + cs |= BCM2835_SPI_CS_CPHA;
2346 +
2347 + bcm2835_wr(bs, BCM2835_SPI_CS, cs);
2348 +
2349 + return 0;
2350 +}
2351 +
2352 static void bcm2835_spi_handle_err(struct spi_master *master,
2353 struct spi_message *msg)
2354 {
2355 @@ -739,6 +756,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
2356 master->set_cs = bcm2835_spi_set_cs;
2357 master->transfer_one = bcm2835_spi_transfer_one;
2358 master->handle_err = bcm2835_spi_handle_err;
2359 + master->prepare_message = bcm2835_spi_prepare_message;
2360 master->dev.of_node = pdev->dev.of_node;
2361
2362 bs = spi_master_get_devdata(master);
2363 diff --git a/drivers/spi/spi-bitbang-txrx.h b/drivers/spi/spi-bitbang-txrx.h
2364 index 06b34e5bcfa3..47bb9b898dfd 100644
2365 --- a/drivers/spi/spi-bitbang-txrx.h
2366 +++ b/drivers/spi/spi-bitbang-txrx.h
2367 @@ -49,7 +49,7 @@ bitbang_txrx_be_cpha0(struct spi_device *spi,
2368 {
2369 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
2370
2371 - bool oldbit = !(word & 1);
2372 + u32 oldbit = (!(word & (1<<(bits-1)))) << 31;
2373 /* clock starts at inactive polarity */
2374 for (word <<= (32 - bits); likely(bits); bits--) {
2375
2376 @@ -81,7 +81,7 @@ bitbang_txrx_be_cpha1(struct spi_device *spi,
2377 {
2378 /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
2379
2380 - bool oldbit = !(word & (1 << 31));
2381 + u32 oldbit = (!(word & (1<<(bits-1)))) << 31;
2382 /* clock starts at inactive polarity */
2383 for (word <<= (32 - bits); likely(bits); bits--) {
2384
2385 diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
2386 index eb03e1215195..7edede6e024b 100644
2387 --- a/drivers/spi/spi-dw-mmio.c
2388 +++ b/drivers/spi/spi-dw-mmio.c
2389 @@ -74,6 +74,9 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
2390
2391 dws->max_freq = clk_get_rate(dwsmmio->clk);
2392
2393 + of_property_read_u32(pdev->dev.of_node, "reg-io-width",
2394 + &dws->reg_io_width);
2395 +
2396 num_cs = 4;
2397
2398 if (pdev->dev.of_node)
2399 diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
2400 index 8d67d03c71eb..4fbfcdc5cb24 100644
2401 --- a/drivers/spi/spi-dw.c
2402 +++ b/drivers/spi/spi-dw.c
2403 @@ -194,7 +194,7 @@ static void dw_writer(struct dw_spi *dws)
2404 else
2405 txw = *(u16 *)(dws->tx);
2406 }
2407 - dw_writel(dws, DW_SPI_DR, txw);
2408 + dw_write_io_reg(dws, DW_SPI_DR, txw);
2409 dws->tx += dws->n_bytes;
2410 }
2411 }
2412 @@ -205,7 +205,7 @@ static void dw_reader(struct dw_spi *dws)
2413 u16 rxw;
2414
2415 while (max--) {
2416 - rxw = dw_readl(dws, DW_SPI_DR);
2417 + rxw = dw_read_io_reg(dws, DW_SPI_DR);
2418 /* Care rx only if the transfer's original "rx" is not null */
2419 if (dws->rx_end - dws->len) {
2420 if (dws->n_bytes == 1)
2421 diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
2422 index 6c91391c1a4f..b75ed327d5a2 100644
2423 --- a/drivers/spi/spi-dw.h
2424 +++ b/drivers/spi/spi-dw.h
2425 @@ -109,6 +109,7 @@ struct dw_spi {
2426 u32 fifo_len; /* depth of the FIFO buffer */
2427 u32 max_freq; /* max bus freq supported */
2428
2429 + u32 reg_io_width; /* DR I/O width in bytes */
2430 u16 bus_num;
2431 u16 num_cs; /* supported slave numbers */
2432
2433 @@ -145,11 +146,45 @@ static inline u32 dw_readl(struct dw_spi *dws, u32 offset)
2434 return __raw_readl(dws->regs + offset);
2435 }
2436
2437 +static inline u16 dw_readw(struct dw_spi *dws, u32 offset)
2438 +{
2439 + return __raw_readw(dws->regs + offset);
2440 +}
2441 +
2442 static inline void dw_writel(struct dw_spi *dws, u32 offset, u32 val)
2443 {
2444 __raw_writel(val, dws->regs + offset);
2445 }
2446
2447 +static inline void dw_writew(struct dw_spi *dws, u32 offset, u16 val)
2448 +{
2449 + __raw_writew(val, dws->regs + offset);
2450 +}
2451 +
2452 +static inline u32 dw_read_io_reg(struct dw_spi *dws, u32 offset)
2453 +{
2454 + switch (dws->reg_io_width) {
2455 + case 2:
2456 + return dw_readw(dws, offset);
2457 + case 4:
2458 + default:
2459 + return dw_readl(dws, offset);
2460 + }
2461 +}
2462 +
2463 +static inline void dw_write_io_reg(struct dw_spi *dws, u32 offset, u32 val)
2464 +{
2465 + switch (dws->reg_io_width) {
2466 + case 2:
2467 + dw_writew(dws, offset, val);
2468 + break;
2469 + case 4:
2470 + default:
2471 + dw_writel(dws, offset, val);
2472 + break;
2473 + }
2474 +}
2475 +
2476 static inline void spi_enable_chip(struct dw_spi *dws, int enable)
2477 {
2478 dw_writel(dws, DW_SPI_SSIENR, (enable ? 1 : 0));
2479 diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
2480 index acce90ac7371..bb916c8d40db 100644
2481 --- a/drivers/spi/spi-img-spfi.c
2482 +++ b/drivers/spi/spi-img-spfi.c
2483 @@ -105,6 +105,10 @@ struct img_spfi {
2484 bool rx_dma_busy;
2485 };
2486
2487 +struct img_spfi_device_data {
2488 + bool gpio_requested;
2489 +};
2490 +
2491 static inline u32 spfi_readl(struct img_spfi *spfi, u32 reg)
2492 {
2493 return readl(spfi->regs + reg);
2494 @@ -267,15 +271,15 @@ static int img_spfi_start_pio(struct spi_master *master,
2495 cpu_relax();
2496 }
2497
2498 - ret = spfi_wait_all_done(spfi);
2499 - if (ret < 0)
2500 - return ret;
2501 -
2502 if (rx_bytes > 0 || tx_bytes > 0) {
2503 dev_err(spfi->dev, "PIO transfer timed out\n");
2504 return -ETIMEDOUT;
2505 }
2506
2507 + ret = spfi_wait_all_done(spfi);
2508 + if (ret < 0)
2509 + return ret;
2510 +
2511 return 0;
2512 }
2513
2514 @@ -440,21 +444,50 @@ static int img_spfi_unprepare(struct spi_master *master,
2515
2516 static int img_spfi_setup(struct spi_device *spi)
2517 {
2518 - int ret;
2519 -
2520 - ret = gpio_request_one(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ?
2521 - GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
2522 - dev_name(&spi->dev));
2523 - if (ret)
2524 - dev_err(&spi->dev, "can't request chipselect gpio %d\n",
2525 + int ret = -EINVAL;
2526 + struct img_spfi_device_data *spfi_data = spi_get_ctldata(spi);
2527 +
2528 + if (!spfi_data) {
2529 + spfi_data = kzalloc(sizeof(*spfi_data), GFP_KERNEL);
2530 + if (!spfi_data)
2531 + return -ENOMEM;
2532 + spfi_data->gpio_requested = false;
2533 + spi_set_ctldata(spi, spfi_data);
2534 + }
2535 + if (!spfi_data->gpio_requested) {
2536 + ret = gpio_request_one(spi->cs_gpio,
2537 + (spi->mode & SPI_CS_HIGH) ?
2538 + GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
2539 + dev_name(&spi->dev));
2540 + if (ret)
2541 + dev_err(&spi->dev, "can't request chipselect gpio %d\n",
2542 spi->cs_gpio);
2543 -
2544 + else
2545 + spfi_data->gpio_requested = true;
2546 + } else {
2547 + if (gpio_is_valid(spi->cs_gpio)) {
2548 + int mode = ((spi->mode & SPI_CS_HIGH) ?
2549 + GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH);
2550 +
2551 + ret = gpio_direction_output(spi->cs_gpio, mode);
2552 + if (ret)
2553 + dev_err(&spi->dev, "chipselect gpio %d setup failed (%d)\n",
2554 + spi->cs_gpio, ret);
2555 + }
2556 + }
2557 return ret;
2558 }
2559
2560 static void img_spfi_cleanup(struct spi_device *spi)
2561 {
2562 - gpio_free(spi->cs_gpio);
2563 + struct img_spfi_device_data *spfi_data = spi_get_ctldata(spi);
2564 +
2565 + if (spfi_data) {
2566 + if (spfi_data->gpio_requested)
2567 + gpio_free(spi->cs_gpio);
2568 + kfree(spfi_data);
2569 + spi_set_ctldata(spi, NULL);
2570 + }
2571 }
2572
2573 static void img_spfi_config(struct spi_master *master, struct spi_device *spi,
2574 diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
2575 index 58673841286c..3d09e0b69b73 100644
2576 --- a/drivers/spi/spi-omap2-mcspi.c
2577 +++ b/drivers/spi/spi-omap2-mcspi.c
2578 @@ -245,6 +245,7 @@ static void omap2_mcspi_set_enable(const struct spi_device *spi, int enable)
2579
2580 static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable)
2581 {
2582 + struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master);
2583 u32 l;
2584
2585 /* The controller handles the inverted chip selects
2586 @@ -255,6 +256,12 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable)
2587 enable = !enable;
2588
2589 if (spi->controller_state) {
2590 + int err = pm_runtime_get_sync(mcspi->dev);
2591 + if (err < 0) {
2592 + dev_err(mcspi->dev, "failed to get sync: %d\n", err);
2593 + return;
2594 + }
2595 +
2596 l = mcspi_cached_chconf0(spi);
2597
2598 if (enable)
2599 @@ -263,6 +270,9 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable)
2600 l |= OMAP2_MCSPI_CHCONF_FORCE;
2601
2602 mcspi_write_chconf0(spi, l);
2603 +
2604 + pm_runtime_mark_last_busy(mcspi->dev);
2605 + pm_runtime_put_autosuspend(mcspi->dev);
2606 }
2607 }
2608
2609 diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
2610 index 8cad107a5b3f..a87cfd4ba17b 100644
2611 --- a/drivers/spi/spi-orion.c
2612 +++ b/drivers/spi/spi-orion.c
2613 @@ -41,6 +41,11 @@
2614 #define ORION_SPI_DATA_OUT_REG 0x08
2615 #define ORION_SPI_DATA_IN_REG 0x0c
2616 #define ORION_SPI_INT_CAUSE_REG 0x10
2617 +#define ORION_SPI_TIMING_PARAMS_REG 0x18
2618 +
2619 +#define ORION_SPI_TMISO_SAMPLE_MASK (0x3 << 6)
2620 +#define ORION_SPI_TMISO_SAMPLE_1 (1 << 6)
2621 +#define ORION_SPI_TMISO_SAMPLE_2 (2 << 6)
2622
2623 #define ORION_SPI_MODE_CPOL (1 << 11)
2624 #define ORION_SPI_MODE_CPHA (1 << 12)
2625 @@ -70,6 +75,7 @@ struct orion_spi_dev {
2626 unsigned int min_divisor;
2627 unsigned int max_divisor;
2628 u32 prescale_mask;
2629 + bool is_errata_50mhz_ac;
2630 };
2631
2632 struct orion_spi {
2633 @@ -195,6 +201,41 @@ orion_spi_mode_set(struct spi_device *spi)
2634 writel(reg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
2635 }
2636
2637 +static void
2638 +orion_spi_50mhz_ac_timing_erratum(struct spi_device *spi, unsigned int speed)
2639 +{
2640 + u32 reg;
2641 + struct orion_spi *orion_spi;
2642 +
2643 + orion_spi = spi_master_get_devdata(spi->master);
2644 +
2645 + /*
2646 + * Erratum description: (Erratum NO. FE-9144572) The device
2647 + * SPI interface supports frequencies of up to 50 MHz.
2648 + * However, due to this erratum, when the device core clock is
2649 + * 250 MHz and the SPI interfaces is configured for 50MHz SPI
2650 + * clock and CPOL=CPHA=1 there might occur data corruption on
2651 + * reads from the SPI device.
2652 + * Erratum Workaround:
2653 + * Work in one of the following configurations:
2654 + * 1. Set CPOL=CPHA=0 in "SPI Interface Configuration
2655 + * Register".
2656 + * 2. Set TMISO_SAMPLE value to 0x2 in "SPI Timing Parameters 1
2657 + * Register" before setting the interface.
2658 + */
2659 + reg = readl(spi_reg(orion_spi, ORION_SPI_TIMING_PARAMS_REG));
2660 + reg &= ~ORION_SPI_TMISO_SAMPLE_MASK;
2661 +
2662 + if (clk_get_rate(orion_spi->clk) == 250000000 &&
2663 + speed == 50000000 && spi->mode & SPI_CPOL &&
2664 + spi->mode & SPI_CPHA)
2665 + reg |= ORION_SPI_TMISO_SAMPLE_2;
2666 + else
2667 + reg |= ORION_SPI_TMISO_SAMPLE_1; /* This is the default value */
2668 +
2669 + writel(reg, spi_reg(orion_spi, ORION_SPI_TIMING_PARAMS_REG));
2670 +}
2671 +
2672 /*
2673 * called only when no transfer is active on the bus
2674 */
2675 @@ -216,6 +257,9 @@ orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
2676
2677 orion_spi_mode_set(spi);
2678
2679 + if (orion_spi->devdata->is_errata_50mhz_ac)
2680 + orion_spi_50mhz_ac_timing_erratum(spi, speed);
2681 +
2682 rc = orion_spi_baudrate_set(spi, speed);
2683 if (rc)
2684 return rc;
2685 @@ -413,6 +457,14 @@ static const struct orion_spi_dev armada_375_spi_dev_data = {
2686 .prescale_mask = ARMADA_SPI_CLK_PRESCALE_MASK,
2687 };
2688
2689 +static const struct orion_spi_dev armada_380_spi_dev_data = {
2690 + .typ = ARMADA_SPI,
2691 + .max_hz = 50000000,
2692 + .max_divisor = 1920,
2693 + .prescale_mask = ARMADA_SPI_CLK_PRESCALE_MASK,
2694 + .is_errata_50mhz_ac = true,
2695 +};
2696 +
2697 static const struct of_device_id orion_spi_of_match_table[] = {
2698 {
2699 .compatible = "marvell,orion-spi",
2700 @@ -428,7 +480,7 @@ static const struct of_device_id orion_spi_of_match_table[] = {
2701 },
2702 {
2703 .compatible = "marvell,armada-380-spi",
2704 - .data = &armada_xp_spi_dev_data,
2705 + .data = &armada_380_spi_dev_data,
2706 },
2707 {
2708 .compatible = "marvell,armada-390-spi",
2709 diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
2710 index d3370a612d84..a7629f8edfca 100644
2711 --- a/drivers/spi/spi-sh-msiof.c
2712 +++ b/drivers/spi/spi-sh-msiof.c
2713 @@ -48,8 +48,8 @@ struct sh_msiof_spi_priv {
2714 const struct sh_msiof_chipdata *chipdata;
2715 struct sh_msiof_spi_info *info;
2716 struct completion done;
2717 - int tx_fifo_size;
2718 - int rx_fifo_size;
2719 + unsigned int tx_fifo_size;
2720 + unsigned int rx_fifo_size;
2721 void *tx_dma_page;
2722 void *rx_dma_page;
2723 dma_addr_t tx_dma_addr;
2724 @@ -95,8 +95,6 @@ struct sh_msiof_spi_priv {
2725 #define MDR2_WDLEN1(i) (((i) - 1) << 16) /* Word Count (1-64/256 (SH, A1))) */
2726 #define MDR2_GRPMASK1 0x00000001 /* Group Output Mask 1 (SH, A1) */
2727
2728 -#define MAX_WDLEN 256U
2729 -
2730 /* TSCR and RSCR */
2731 #define SCR_BRPS_MASK 0x1f00 /* Prescaler Setting (1-32) */
2732 #define SCR_BRPS(i) (((i) - 1) << 8)
2733 @@ -850,7 +848,12 @@ static int sh_msiof_transfer_one(struct spi_master *master,
2734 * DMA supports 32-bit words only, hence pack 8-bit and 16-bit
2735 * words, with byte resp. word swapping.
2736 */
2737 - unsigned int l = min(len, MAX_WDLEN * 4);
2738 + unsigned int l = 0;
2739 +
2740 + if (tx_buf)
2741 + l = min(len, p->tx_fifo_size * 4);
2742 + if (rx_buf)
2743 + l = min(len, p->rx_fifo_size * 4);
2744
2745 if (bits <= 8) {
2746 if (l & 3)
2747 @@ -963,7 +966,7 @@ static const struct sh_msiof_chipdata sh_data = {
2748
2749 static const struct sh_msiof_chipdata r8a779x_data = {
2750 .tx_fifo_size = 64,
2751 - .rx_fifo_size = 256,
2752 + .rx_fifo_size = 64,
2753 .master_flags = SPI_MASTER_MUST_TX,
2754 };
2755
2756 diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
2757 index 133f53a9c1d4..a339c1e9997a 100644
2758 --- a/drivers/spi/spi-xilinx.c
2759 +++ b/drivers/spi/spi-xilinx.c
2760 @@ -249,19 +249,23 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
2761 xspi->tx_ptr = t->tx_buf;
2762 xspi->rx_ptr = t->rx_buf;
2763 remaining_words = t->len / xspi->bytes_per_word;
2764 - reinit_completion(&xspi->done);
2765
2766 if (xspi->irq >= 0 && remaining_words > xspi->buffer_size) {
2767 + u32 isr;
2768 use_irq = true;
2769 - xspi->write_fn(XSPI_INTR_TX_EMPTY,
2770 - xspi->regs + XIPIF_V123B_IISR_OFFSET);
2771 - /* Enable the global IPIF interrupt */
2772 - xspi->write_fn(XIPIF_V123B_GINTR_ENABLE,
2773 - xspi->regs + XIPIF_V123B_DGIER_OFFSET);
2774 /* Inhibit irq to avoid spurious irqs on tx_empty*/
2775 cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET);
2776 xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT,
2777 xspi->regs + XSPI_CR_OFFSET);
2778 + /* ACK old irqs (if any) */
2779 + isr = xspi->read_fn(xspi->regs + XIPIF_V123B_IISR_OFFSET);
2780 + if (isr)
2781 + xspi->write_fn(isr,
2782 + xspi->regs + XIPIF_V123B_IISR_OFFSET);
2783 + /* Enable the global IPIF interrupt */
2784 + xspi->write_fn(XIPIF_V123B_GINTR_ENABLE,
2785 + xspi->regs + XIPIF_V123B_DGIER_OFFSET);
2786 + reinit_completion(&xspi->done);
2787 }
2788
2789 while (remaining_words) {
2790 @@ -302,8 +306,10 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
2791 remaining_words -= n_words;
2792 }
2793
2794 - if (use_irq)
2795 + if (use_irq) {
2796 xspi->write_fn(0, xspi->regs + XIPIF_V123B_DGIER_OFFSET);
2797 + xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
2798 + }
2799
2800 return t->len;
2801 }
2802 diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c
2803 index 934af3ff7897..b0fc027cf485 100644
2804 --- a/drivers/staging/comedi/drivers/adl_pci7x3x.c
2805 +++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c
2806 @@ -120,8 +120,20 @@ static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev,
2807 {
2808 unsigned long reg = (unsigned long)s->private;
2809
2810 - if (comedi_dio_update_state(s, data))
2811 - outl(s->state, dev->iobase + reg);
2812 + if (comedi_dio_update_state(s, data)) {
2813 + unsigned int val = s->state;
2814 +
2815 + if (s->n_chan == 16) {
2816 + /*
2817 + * It seems the PCI-7230 needs the 16-bit DO state
2818 + * to be shifted left by 16 bits before being written
2819 + * to the 32-bit register. Set the value in both
2820 + * halves of the register to be sure.
2821 + */
2822 + val |= val << 16;
2823 + }
2824 + outl(val, dev->iobase + reg);
2825 + }
2826
2827 data[1] = s->state;
2828
2829 diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
2830 index eaa9add491df..dc0b25a54088 100644
2831 --- a/drivers/staging/comedi/drivers/usbduxsigma.c
2832 +++ b/drivers/staging/comedi/drivers/usbduxsigma.c
2833 @@ -550,27 +550,6 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev,
2834 if (err)
2835 return 3;
2836
2837 - /* Step 4: fix up any arguments */
2838 -
2839 - if (high_speed) {
2840 - /*
2841 - * every 2 channels get a time window of 125us. Thus, if we
2842 - * sample all 16 channels we need 1ms. If we sample only one
2843 - * channel we need only 125us
2844 - */
2845 - devpriv->ai_interval = interval;
2846 - devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval);
2847 - } else {
2848 - /* interval always 1ms */
2849 - devpriv->ai_interval = 1;
2850 - devpriv->ai_timer = cmd->scan_begin_arg / 1000000;
2851 - }
2852 - if (devpriv->ai_timer < 1)
2853 - err |= -EINVAL;
2854 -
2855 - if (err)
2856 - return 4;
2857 -
2858 return 0;
2859 }
2860
2861 @@ -668,6 +647,22 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev,
2862
2863 down(&devpriv->sem);
2864
2865 + if (devpriv->high_speed) {
2866 + /*
2867 + * every 2 channels get a time window of 125us. Thus, if we
2868 + * sample all 16 channels we need 1ms. If we sample only one
2869 + * channel we need only 125us
2870 + */
2871 + unsigned int interval = usbduxsigma_chans_to_interval(len);
2872 +
2873 + devpriv->ai_interval = interval;
2874 + devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval);
2875 + } else {
2876 + /* interval always 1ms */
2877 + devpriv->ai_interval = 1;
2878 + devpriv->ai_timer = cmd->scan_begin_arg / 1000000;
2879 + }
2880 +
2881 for (i = 0; i < len; i++) {
2882 unsigned int chan = CR_CHAN(cmd->chanlist[i]);
2883
2884 @@ -917,25 +912,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,
2885 if (err)
2886 return 3;
2887
2888 - /* Step 4: fix up any arguments */
2889 -
2890 - /* we count in timer steps */
2891 - if (high_speed) {
2892 - /* timing of the conversion itself: every 125 us */
2893 - devpriv->ao_timer = cmd->convert_arg / 125000;
2894 - } else {
2895 - /*
2896 - * timing of the scan: every 1ms
2897 - * we get all channels at once
2898 - */
2899 - devpriv->ao_timer = cmd->scan_begin_arg / 1000000;
2900 - }
2901 - if (devpriv->ao_timer < 1)
2902 - err |= -EINVAL;
2903 -
2904 - if (err)
2905 - return 4;
2906 -
2907 return 0;
2908 }
2909
2910 @@ -948,6 +924,20 @@ static int usbduxsigma_ao_cmd(struct comedi_device *dev,
2911
2912 down(&devpriv->sem);
2913
2914 + if (cmd->convert_src == TRIG_TIMER) {
2915 + /*
2916 + * timing of the conversion itself: every 125 us
2917 + * at high speed (not used yet)
2918 + */
2919 + devpriv->ao_timer = cmd->convert_arg / 125000;
2920 + } else {
2921 + /*
2922 + * timing of the scan: every 1ms
2923 + * we get all channels at once
2924 + */
2925 + devpriv->ao_timer = cmd->scan_begin_arg / 1000000;
2926 + }
2927 +
2928 devpriv->ao_counter = devpriv->ao_timer;
2929
2930 if (cmd->start_src == TRIG_NOW) {
2931 diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
2932 index c6cdb43b864c..476808261fa8 100644
2933 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
2934 +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
2935 @@ -1826,8 +1826,8 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
2936 return;
2937 }
2938
2939 - if (queue_index != TXCMD_QUEUE)
2940 - netdev_warn(dev, "%s(): queue index != TXCMD_QUEUE\n",
2941 + if (queue_index == TXCMD_QUEUE)
2942 + netdev_warn(dev, "%s(): queue index == TXCMD_QUEUE\n",
2943 __func__);
2944
2945 memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
2946 diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
2947 index bb8087e70127..44269d58eb51 100644
2948 --- a/drivers/staging/unisys/visorbus/visorchipset.c
2949 +++ b/drivers/staging/unisys/visorbus/visorchipset.c
2950 @@ -2381,6 +2381,9 @@ static struct acpi_driver unisys_acpi_driver = {
2951 .remove = visorchipset_exit,
2952 },
2953 };
2954 +
2955 +MODULE_DEVICE_TABLE(acpi, unisys_device_ids);
2956 +
2957 static __init uint32_t visorutil_spar_detect(void)
2958 {
2959 unsigned int eax, ebx, ecx, edx;
2960 diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
2961 index d75a66c72750..b470df122642 100644
2962 --- a/drivers/tty/serial/8250/8250_omap.c
2963 +++ b/drivers/tty/serial/8250/8250_omap.c
2964 @@ -100,6 +100,7 @@ struct omap8250_priv {
2965 struct work_struct qos_work;
2966 struct uart_8250_dma omap8250_dma;
2967 spinlock_t rx_dma_lock;
2968 + bool rx_dma_broken;
2969 };
2970
2971 static u32 uart_read(struct uart_8250_port *up, u32 reg)
2972 @@ -754,6 +755,7 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
2973 struct omap8250_priv *priv = p->port.private_data;
2974 struct uart_8250_dma *dma = p->dma;
2975 unsigned long flags;
2976 + int ret;
2977
2978 spin_lock_irqsave(&priv->rx_dma_lock, flags);
2979
2980 @@ -762,7 +764,9 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
2981 return;
2982 }
2983
2984 - dmaengine_pause(dma->rxchan);
2985 + ret = dmaengine_pause(dma->rxchan);
2986 + if (WARN_ON_ONCE(ret))
2987 + priv->rx_dma_broken = true;
2988
2989 spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
2990
2991 @@ -806,6 +810,9 @@ static int omap_8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
2992 break;
2993 }
2994
2995 + if (priv->rx_dma_broken)
2996 + return -EINVAL;
2997 +
2998 spin_lock_irqsave(&priv->rx_dma_lock, flags);
2999
3000 if (dma->rx_running)
3001 @@ -1180,6 +1187,11 @@ static int omap8250_probe(struct platform_device *pdev)
3002
3003 if (of_machine_is_compatible("ti,am33xx"))
3004 priv->habit |= OMAP_DMA_TX_KICK;
3005 + /*
3006 + * pause is currently not supported atleast on omap-sdma
3007 + * and edma on most earlier kernels.
3008 + */
3009 + priv->rx_dma_broken = true;
3010 }
3011 }
3012 #endif
3013 diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
3014 index e55f18b93fe7..46ddce479f26 100644
3015 --- a/drivers/tty/serial/8250/8250_pci.c
3016 +++ b/drivers/tty/serial/8250/8250_pci.c
3017 @@ -2017,6 +2017,12 @@ pci_wch_ch38x_setup(struct serial_private *priv,
3018 #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250
3019 #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470
3020
3021 +#define PCI_VENDOR_ID_PERICOM 0x12D8
3022 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951
3023 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7952 0x7952
3024 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7954 0x7954
3025 +#define PCI_DEVICE_ID_PERICOM_PI7C9X7958 0x7958
3026 +
3027 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
3028 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
3029 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588
3030 @@ -2331,27 +2337,12 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
3031 * Pericom
3032 */
3033 {
3034 - .vendor = 0x12d8,
3035 - .device = 0x7952,
3036 - .subvendor = PCI_ANY_ID,
3037 - .subdevice = PCI_ANY_ID,
3038 - .setup = pci_pericom_setup,
3039 - },
3040 - {
3041 - .vendor = 0x12d8,
3042 - .device = 0x7954,
3043 - .subvendor = PCI_ANY_ID,
3044 - .subdevice = PCI_ANY_ID,
3045 - .setup = pci_pericom_setup,
3046 - },
3047 - {
3048 - .vendor = 0x12d8,
3049 - .device = 0x7958,
3050 - .subvendor = PCI_ANY_ID,
3051 - .subdevice = PCI_ANY_ID,
3052 - .setup = pci_pericom_setup,
3053 + .vendor = PCI_VENDOR_ID_PERICOM,
3054 + .device = PCI_ANY_ID,
3055 + .subvendor = PCI_ANY_ID,
3056 + .subdevice = PCI_ANY_ID,
3057 + .setup = pci_pericom_setup,
3058 },
3059 -
3060 /*
3061 * PLX
3062 */
3063 @@ -3056,6 +3047,10 @@ enum pci_board_num_t {
3064 pbn_fintek_8,
3065 pbn_fintek_12,
3066 pbn_wch384_4,
3067 + pbn_pericom_PI7C9X7951,
3068 + pbn_pericom_PI7C9X7952,
3069 + pbn_pericom_PI7C9X7954,
3070 + pbn_pericom_PI7C9X7958,
3071 };
3072
3073 /*
3074 @@ -3881,7 +3876,6 @@ static struct pciserial_board pci_boards[] = {
3075 .base_baud = 115200,
3076 .first_offset = 0x40,
3077 },
3078 -
3079 [pbn_wch384_4] = {
3080 .flags = FL_BASE0,
3081 .num_ports = 4,
3082 @@ -3889,6 +3883,33 @@ static struct pciserial_board pci_boards[] = {
3083 .uart_offset = 8,
3084 .first_offset = 0xC0,
3085 },
3086 + /*
3087 + * Pericom PI7C9X795[1248] Uno/Dual/Quad/Octal UART
3088 + */
3089 + [pbn_pericom_PI7C9X7951] = {
3090 + .flags = FL_BASE0,
3091 + .num_ports = 1,
3092 + .base_baud = 921600,
3093 + .uart_offset = 0x8,
3094 + },
3095 + [pbn_pericom_PI7C9X7952] = {
3096 + .flags = FL_BASE0,
3097 + .num_ports = 2,
3098 + .base_baud = 921600,
3099 + .uart_offset = 0x8,
3100 + },
3101 + [pbn_pericom_PI7C9X7954] = {
3102 + .flags = FL_BASE0,
3103 + .num_ports = 4,
3104 + .base_baud = 921600,
3105 + .uart_offset = 0x8,
3106 + },
3107 + [pbn_pericom_PI7C9X7958] = {
3108 + .flags = FL_BASE0,
3109 + .num_ports = 8,
3110 + .base_baud = 921600,
3111 + .uart_offset = 0x8,
3112 + },
3113 };
3114
3115 static const struct pci_device_id blacklist[] = {
3116 @@ -5154,6 +5175,25 @@ static struct pci_device_id serial_pci_tbl[] = {
3117 0,
3118 0, pbn_exar_XR17V8358 },
3119 /*
3120 + * Pericom PI7C9X795[1248] Uno/Dual/Quad/Octal UART
3121 + */
3122 + { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7951,
3123 + PCI_ANY_ID, PCI_ANY_ID,
3124 + 0,
3125 + 0, pbn_pericom_PI7C9X7951 },
3126 + { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7952,
3127 + PCI_ANY_ID, PCI_ANY_ID,
3128 + 0,
3129 + 0, pbn_pericom_PI7C9X7952 },
3130 + { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7954,
3131 + PCI_ANY_ID, PCI_ANY_ID,
3132 + 0,
3133 + 0, pbn_pericom_PI7C9X7954 },
3134 + { PCI_VENDOR_ID_PERICOM, PCI_DEVICE_ID_PERICOM_PI7C9X7958,
3135 + PCI_ANY_ID, PCI_ANY_ID,
3136 + 0,
3137 + 0, pbn_pericom_PI7C9X7958 },
3138 + /*
3139 * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
3140 */
3141 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
3142 diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
3143 index 50a09cd76d50..658b392d1170 100644
3144 --- a/drivers/tty/serial/8250/8250_pnp.c
3145 +++ b/drivers/tty/serial/8250/8250_pnp.c
3146 @@ -41,6 +41,12 @@ static const struct pnp_device_id pnp_dev_table[] = {
3147 { "AEI1240", 0 },
3148 /* Rockwell 56K ACF II Fax+Data+Voice Modem */
3149 { "AKY1021", 0 /*SPCI_FL_NO_SHIRQ*/ },
3150 + /*
3151 + * ALi Fast Infrared Controller
3152 + * Native driver (ali-ircc) is broken so at least
3153 + * it can be used with irtty-sir.
3154 + */
3155 + { "ALI5123", 0 },
3156 /* AZT3005 PnP SOUND DEVICE */
3157 { "AZT4001", 0 },
3158 /* Best Data Products Inc. Smart One 336F PnP Modem */
3159 @@ -364,6 +370,11 @@ static const struct pnp_device_id pnp_dev_table[] = {
3160 /* Winbond CIR port, should not be probed. We should keep track
3161 of it to prevent the legacy serial driver from probing it */
3162 { "WEC1022", CIR_PORT },
3163 + /*
3164 + * SMSC IrCC SIR/FIR port, should not be probed by serial driver
3165 + * as well so its own driver can bind to it.
3166 + */
3167 + { "SMCF010", CIR_PORT },
3168 { "", 0 }
3169 };
3170
3171 diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c
3172 index 7d79425c2b09..d11621e2cf1d 100644
3173 --- a/drivers/tty/serial/8250/8250_uniphier.c
3174 +++ b/drivers/tty/serial/8250/8250_uniphier.c
3175 @@ -218,6 +218,7 @@ static int uniphier_uart_probe(struct platform_device *pdev)
3176 ret = serial8250_register_8250_port(&up);
3177 if (ret < 0) {
3178 dev_err(dev, "failed to register 8250 port\n");
3179 + clk_disable_unprepare(priv->clk);
3180 return ret;
3181 }
3182
3183 diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c
3184 index 35c55505b3eb..5a41b8fbb10a 100644
3185 --- a/drivers/tty/serial/men_z135_uart.c
3186 +++ b/drivers/tty/serial/men_z135_uart.c
3187 @@ -392,7 +392,6 @@ static irqreturn_t men_z135_intr(int irq, void *data)
3188 struct men_z135_port *uart = (struct men_z135_port *)data;
3189 struct uart_port *port = &uart->port;
3190 bool handled = false;
3191 - unsigned long flags;
3192 int irq_id;
3193
3194 uart->stat_reg = ioread32(port->membase + MEN_Z135_STAT_REG);
3195 @@ -401,7 +400,7 @@ static irqreturn_t men_z135_intr(int irq, void *data)
3196 if (!irq_id)
3197 goto out;
3198
3199 - spin_lock_irqsave(&port->lock, flags);
3200 + spin_lock(&port->lock);
3201 /* It's save to write to IIR[7:6] RXC[9:8] */
3202 iowrite8(irq_id, port->membase + MEN_Z135_STAT_REG);
3203
3204 @@ -427,7 +426,7 @@ static irqreturn_t men_z135_intr(int irq, void *data)
3205 handled = true;
3206 }
3207
3208 - spin_unlock_irqrestore(&port->lock, flags);
3209 + spin_unlock(&port->lock);
3210 out:
3211 return IRQ_RETVAL(handled);
3212 }
3213 @@ -717,7 +716,7 @@ static void men_z135_set_termios(struct uart_port *port,
3214
3215 baud = uart_get_baud_rate(port, termios, old, 0, uart_freq / 16);
3216
3217 - spin_lock(&port->lock);
3218 + spin_lock_irq(&port->lock);
3219 if (tty_termios_baud_rate(termios))
3220 tty_termios_encode_baud_rate(termios, baud, baud);
3221
3222 @@ -725,7 +724,7 @@ static void men_z135_set_termios(struct uart_port *port,
3223 iowrite32(bd_reg, port->membase + MEN_Z135_BAUD_REG);
3224
3225 uart_update_timeout(port, termios->c_cflag, baud);
3226 - spin_unlock(&port->lock);
3227 + spin_unlock_irq(&port->lock);
3228 }
3229
3230 static const char *men_z135_type(struct uart_port *port)
3231 diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
3232 index 67d0c213b1c7..5916311eecb1 100644
3233 --- a/drivers/tty/serial/samsung.c
3234 +++ b/drivers/tty/serial/samsung.c
3235 @@ -295,15 +295,6 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport,
3236 if (ourport->tx_mode != S3C24XX_TX_DMA)
3237 enable_tx_dma(ourport);
3238
3239 - while (xmit->tail & (dma_get_cache_alignment() - 1)) {
3240 - if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull)
3241 - return 0;
3242 - wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
3243 - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
3244 - port->icount.tx++;
3245 - count--;
3246 - }
3247 -
3248 dma->tx_size = count & ~(dma_get_cache_alignment() - 1);
3249 dma->tx_transfer_addr = dma->tx_addr + xmit->tail;
3250
3251 @@ -342,7 +333,9 @@ static void s3c24xx_serial_start_next_tx(struct s3c24xx_uart_port *ourport)
3252 return;
3253 }
3254
3255 - if (!ourport->dma || !ourport->dma->tx_chan || count < port->fifosize)
3256 + if (!ourport->dma || !ourport->dma->tx_chan ||
3257 + count < ourport->min_dma_size ||
3258 + xmit->tail & (dma_get_cache_alignment() - 1))
3259 s3c24xx_serial_start_tx_pio(ourport);
3260 else
3261 s3c24xx_serial_start_tx_dma(ourport, count);
3262 @@ -736,15 +729,20 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
3263 struct uart_port *port = &ourport->port;
3264 struct circ_buf *xmit = &port->state->xmit;
3265 unsigned long flags;
3266 - int count;
3267 + int count, dma_count = 0;
3268
3269 spin_lock_irqsave(&port->lock, flags);
3270
3271 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
3272
3273 - if (ourport->dma && ourport->dma->tx_chan && count >= port->fifosize) {
3274 - s3c24xx_serial_start_tx_dma(ourport, count);
3275 - goto out;
3276 + if (ourport->dma && ourport->dma->tx_chan &&
3277 + count >= ourport->min_dma_size) {
3278 + int align = dma_get_cache_alignment() -
3279 + (xmit->tail & (dma_get_cache_alignment() - 1));
3280 + if (count-align >= ourport->min_dma_size) {
3281 + dma_count = count-align;
3282 + count = align;
3283 + }
3284 }
3285
3286 if (port->x_char) {
3287 @@ -765,14 +763,24 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
3288
3289 /* try and drain the buffer... */
3290
3291 - count = port->fifosize;
3292 - while (!uart_circ_empty(xmit) && count-- > 0) {
3293 + if (count > port->fifosize) {
3294 + count = port->fifosize;
3295 + dma_count = 0;
3296 + }
3297 +
3298 + while (!uart_circ_empty(xmit) && count > 0) {
3299 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull)
3300 break;
3301
3302 wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
3303 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
3304 port->icount.tx++;
3305 + count--;
3306 + }
3307 +
3308 + if (!count && dma_count) {
3309 + s3c24xx_serial_start_tx_dma(ourport, dma_count);
3310 + goto out;
3311 }
3312
3313 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) {
3314 @@ -1838,6 +1846,13 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
3315 else if (ourport->info->fifosize)
3316 ourport->port.fifosize = ourport->info->fifosize;
3317
3318 + /*
3319 + * DMA transfers must be aligned at least to cache line size,
3320 + * so find minimal transfer size suitable for DMA mode
3321 + */
3322 + ourport->min_dma_size = max_t(int, ourport->port.fifosize,
3323 + dma_get_cache_alignment());
3324 +
3325 probe_index++;
3326
3327 dbg("%s: initialising port %p...\n", __func__, ourport);
3328 diff --git a/drivers/tty/serial/samsung.h b/drivers/tty/serial/samsung.h
3329 index d275032aa68d..fc5deaa4f382 100644
3330 --- a/drivers/tty/serial/samsung.h
3331 +++ b/drivers/tty/serial/samsung.h
3332 @@ -82,6 +82,7 @@ struct s3c24xx_uart_port {
3333 unsigned char tx_claimed;
3334 unsigned int pm_level;
3335 unsigned long baudclk_rate;
3336 + unsigned int min_dma_size;
3337
3338 unsigned int rx_irq;
3339 unsigned int tx_irq;
3340 diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
3341 index 69e769c35cf5..06ecd1e6871c 100644
3342 --- a/drivers/usb/dwc3/ep0.c
3343 +++ b/drivers/usb/dwc3/ep0.c
3344 @@ -820,6 +820,11 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
3345 unsigned maxp = ep0->endpoint.maxpacket;
3346
3347 transfer_size += (maxp - (transfer_size % maxp));
3348 +
3349 + /* Maximum of DWC3_EP0_BOUNCE_SIZE can only be received */
3350 + if (transfer_size > DWC3_EP0_BOUNCE_SIZE)
3351 + transfer_size = DWC3_EP0_BOUNCE_SIZE;
3352 +
3353 transferred = min_t(u32, ur->length,
3354 transfer_size - length);
3355 memcpy(ur->buf, dwc->ep0_bounce, transferred);
3356 @@ -941,11 +946,14 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
3357 return;
3358 }
3359
3360 - WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE);
3361 -
3362 maxpacket = dep->endpoint.maxpacket;
3363 transfer_size = roundup(req->request.length, maxpacket);
3364
3365 + if (transfer_size > DWC3_EP0_BOUNCE_SIZE) {
3366 + dev_WARN(dwc->dev, "bounce buf can't handle req len\n");
3367 + transfer_size = DWC3_EP0_BOUNCE_SIZE;
3368 + }
3369 +
3370 dwc->ep0_bounced = true;
3371
3372 /*
3373 diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
3374 index 531861547253..96d935b00504 100644
3375 --- a/drivers/usb/gadget/function/f_uac2.c
3376 +++ b/drivers/usb/gadget/function/f_uac2.c
3377 @@ -975,6 +975,29 @@ free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep)
3378 "%s:%d Error!\n", __func__, __LINE__);
3379 }
3380
3381 +static void set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts,
3382 + struct usb_endpoint_descriptor *ep_desc,
3383 + unsigned int factor, bool is_playback)
3384 +{
3385 + int chmask, srate, ssize;
3386 + u16 max_packet_size;
3387 +
3388 + if (is_playback) {
3389 + chmask = uac2_opts->p_chmask;
3390 + srate = uac2_opts->p_srate;
3391 + ssize = uac2_opts->p_ssize;
3392 + } else {
3393 + chmask = uac2_opts->c_chmask;
3394 + srate = uac2_opts->c_srate;
3395 + ssize = uac2_opts->c_ssize;
3396 + }
3397 +
3398 + max_packet_size = num_channels(chmask) * ssize *
3399 + DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)));
3400 + ep_desc->wMaxPacketSize = cpu_to_le16(min(max_packet_size,
3401 + le16_to_cpu(ep_desc->wMaxPacketSize)));
3402 +}
3403 +
3404 static int
3405 afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
3406 {
3407 @@ -1070,10 +1093,14 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
3408 uac2->p_prm.uac2 = uac2;
3409 uac2->c_prm.uac2 = uac2;
3410
3411 + /* Calculate wMaxPacketSize according to audio bandwidth */
3412 + set_ep_max_packet_size(uac2_opts, &fs_epin_desc, 1000, true);
3413 + set_ep_max_packet_size(uac2_opts, &fs_epout_desc, 1000, false);
3414 + set_ep_max_packet_size(uac2_opts, &hs_epin_desc, 8000, true);
3415 + set_ep_max_packet_size(uac2_opts, &hs_epout_desc, 8000, false);
3416 +
3417 hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
3418 - hs_epout_desc.wMaxPacketSize = fs_epout_desc.wMaxPacketSize;
3419 hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
3420 - hs_epin_desc.wMaxPacketSize = fs_epin_desc.wMaxPacketSize;
3421
3422 ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, NULL);
3423 if (ret)
3424 diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
3425 index 309706fe4bf0..9704053dfe05 100644
3426 --- a/drivers/usb/gadget/udc/m66592-udc.c
3427 +++ b/drivers/usb/gadget/udc/m66592-udc.c
3428 @@ -1052,7 +1052,7 @@ static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
3429 tmp = m66592_read(m66592, M66592_INTSTS0) &
3430 M66592_CTSQ;
3431 udelay(1);
3432 - } while (tmp != M66592_CS_IDST || timeout-- > 0);
3433 + } while (tmp != M66592_CS_IDST && timeout-- > 0);
3434
3435 if (tmp == M66592_CS_IDST)
3436 m66592_bset(m66592,
3437 diff --git a/drivers/usb/host/ehci-sysfs.c b/drivers/usb/host/ehci-sysfs.c
3438 index 5e44407aa099..5216f2b09d63 100644
3439 --- a/drivers/usb/host/ehci-sysfs.c
3440 +++ b/drivers/usb/host/ehci-sysfs.c
3441 @@ -29,7 +29,7 @@ static ssize_t show_companion(struct device *dev,
3442 int count = PAGE_SIZE;
3443 char *ptr = buf;
3444
3445 - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
3446 + ehci = hcd_to_ehci(dev_get_drvdata(dev));
3447 nports = HCS_N_PORTS(ehci->hcs_params);
3448
3449 for (index = 0; index < nports; ++index) {
3450 @@ -54,7 +54,7 @@ static ssize_t store_companion(struct device *dev,
3451 struct ehci_hcd *ehci;
3452 int portnum, new_owner;
3453
3454 - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
3455 + ehci = hcd_to_ehci(dev_get_drvdata(dev));
3456 new_owner = PORT_OWNER; /* Owned by companion */
3457 if (sscanf(buf, "%d", &portnum) != 1)
3458 return -EINVAL;
3459 @@ -85,7 +85,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev,
3460 struct ehci_hcd *ehci;
3461 int n;
3462
3463 - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
3464 + ehci = hcd_to_ehci(dev_get_drvdata(dev));
3465 n = scnprintf(buf, PAGE_SIZE, "%d\n", ehci->uframe_periodic_max);
3466 return n;
3467 }
3468 @@ -101,7 +101,7 @@ static ssize_t store_uframe_periodic_max(struct device *dev,
3469 unsigned long flags;
3470 ssize_t ret;
3471
3472 - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
3473 + ehci = hcd_to_ehci(dev_get_drvdata(dev));
3474 if (kstrtouint(buf, 0, &uframe_periodic_max) < 0)
3475 return -EINVAL;
3476
3477 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
3478 index 4c8b3b82103d..a5a0376bbd48 100644
3479 --- a/drivers/usb/serial/ftdi_sio.c
3480 +++ b/drivers/usb/serial/ftdi_sio.c
3481 @@ -605,6 +605,10 @@ static const struct usb_device_id id_table_combined[] = {
3482 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
3483 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
3484 { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
3485 + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) },
3486 + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
3487 + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2WI_PID) },
3488 + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX3_PID) },
3489 /*
3490 * ELV devices:
3491 */
3492 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
3493 index 792e054126de..2943b97b2a83 100644
3494 --- a/drivers/usb/serial/ftdi_sio_ids.h
3495 +++ b/drivers/usb/serial/ftdi_sio_ids.h
3496 @@ -568,6 +568,14 @@
3497 */
3498 #define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
3499
3500 +/*
3501 + * CustomWare / ShipModul NMEA multiplexers product ids (FTDI_VID)
3502 + */
3503 +#define FTDI_CUSTOMWARE_MINIPLEX_PID 0xfd48 /* MiniPlex first generation NMEA Multiplexer */
3504 +#define FTDI_CUSTOMWARE_MINIPLEX2_PID 0xfd49 /* MiniPlex-USB and MiniPlex-2 series */
3505 +#define FTDI_CUSTOMWARE_MINIPLEX2WI_PID 0xfd4a /* MiniPlex-2Wi */
3506 +#define FTDI_CUSTOMWARE_MINIPLEX3_PID 0xfd4b /* MiniPlex-3 series */
3507 +
3508
3509 /********************************/
3510 /** third-party VID/PID combos **/
3511 diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
3512 index f5257af33ecf..ae682e4eeaef 100644
3513 --- a/drivers/usb/serial/pl2303.c
3514 +++ b/drivers/usb/serial/pl2303.c
3515 @@ -362,21 +362,38 @@ static speed_t pl2303_encode_baud_rate_direct(unsigned char buf[4],
3516 static speed_t pl2303_encode_baud_rate_divisor(unsigned char buf[4],
3517 speed_t baud)
3518 {
3519 - unsigned int tmp;
3520 + unsigned int baseline, mantissa, exponent;
3521
3522 /*
3523 * Apparently the formula is:
3524 - * baudrate = 12M * 32 / (2^buf[1]) / buf[0]
3525 + * baudrate = 12M * 32 / (mantissa * 4^exponent)
3526 + * where
3527 + * mantissa = buf[8:0]
3528 + * exponent = buf[11:9]
3529 */
3530 - tmp = 12000000 * 32 / baud;
3531 + baseline = 12000000 * 32;
3532 + mantissa = baseline / baud;
3533 + if (mantissa == 0)
3534 + mantissa = 1; /* Avoid dividing by zero if baud > 32*12M. */
3535 + exponent = 0;
3536 + while (mantissa >= 512) {
3537 + if (exponent < 7) {
3538 + mantissa >>= 2; /* divide by 4 */
3539 + exponent++;
3540 + } else {
3541 + /* Exponent is maxed. Trim mantissa and leave. */
3542 + mantissa = 511;
3543 + break;
3544 + }
3545 + }
3546 +
3547 buf[3] = 0x80;
3548 buf[2] = 0;
3549 - buf[1] = (tmp >= 256);
3550 - while (tmp >= 256) {
3551 - tmp >>= 2;
3552 - buf[1] <<= 1;
3553 - }
3554 - buf[0] = tmp;
3555 + buf[1] = exponent << 1 | mantissa >> 8;
3556 + buf[0] = mantissa & 0xff;
3557 +
3558 + /* Calculate and return the exact baud rate. */
3559 + baud = (baseline / mantissa) >> (exponent << 1);
3560
3561 return baud;
3562 }
3563 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
3564 index d156545728c2..ebcec8cda858 100644
3565 --- a/drivers/usb/serial/qcserial.c
3566 +++ b/drivers/usb/serial/qcserial.c
3567 @@ -139,6 +139,7 @@ static const struct usb_device_id id_table[] = {
3568 {USB_DEVICE(0x0AF0, 0x8120)}, /* Option GTM681W */
3569
3570 /* non-Gobi Sierra Wireless devices */
3571 + {DEVICE_SWI(0x03f0, 0x4e1d)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
3572 {DEVICE_SWI(0x0f3d, 0x68a2)}, /* Sierra Wireless MC7700 */
3573 {DEVICE_SWI(0x114f, 0x68a2)}, /* Sierra Wireless MC7750 */
3574 {DEVICE_SWI(0x1199, 0x68a2)}, /* Sierra Wireless MC7710 */
3575 diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
3576 index 8fceec7298e0..6ed804450a5a 100644
3577 --- a/drivers/usb/serial/symbolserial.c
3578 +++ b/drivers/usb/serial/symbolserial.c
3579 @@ -94,7 +94,7 @@ exit:
3580
3581 static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port)
3582 {
3583 - struct symbol_private *priv = usb_get_serial_data(port->serial);
3584 + struct symbol_private *priv = usb_get_serial_port_data(port);
3585 unsigned long flags;
3586 int result = 0;
3587
3588 @@ -120,7 +120,7 @@ static void symbol_close(struct usb_serial_port *port)
3589 static void symbol_throttle(struct tty_struct *tty)
3590 {
3591 struct usb_serial_port *port = tty->driver_data;
3592 - struct symbol_private *priv = usb_get_serial_data(port->serial);
3593 + struct symbol_private *priv = usb_get_serial_port_data(port);
3594
3595 spin_lock_irq(&priv->lock);
3596 priv->throttled = true;
3597 @@ -130,7 +130,7 @@ static void symbol_throttle(struct tty_struct *tty)
3598 static void symbol_unthrottle(struct tty_struct *tty)
3599 {
3600 struct usb_serial_port *port = tty->driver_data;
3601 - struct symbol_private *priv = usb_get_serial_data(port->serial);
3602 + struct symbol_private *priv = usb_get_serial_port_data(port);
3603 int result;
3604 bool was_throttled;
3605
3606 diff --git a/fs/ceph/super.c b/fs/ceph/super.c
3607 index d1c833c321b9..7b6bfcbf801c 100644
3608 --- a/fs/ceph/super.c
3609 +++ b/fs/ceph/super.c
3610 @@ -479,7 +479,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
3611 if (fsopt->max_readdir_bytes != CEPH_MAX_READDIR_BYTES_DEFAULT)
3612 seq_printf(m, ",readdir_max_bytes=%d", fsopt->max_readdir_bytes);
3613 if (strcmp(fsopt->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT))
3614 - seq_printf(m, ",snapdirname=%s", fsopt->snapdir_name);
3615 + seq_show_option(m, "snapdirname", fsopt->snapdir_name);
3616
3617 return 0;
3618 }
3619 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
3620 index 0a9fb6b53126..6a1119e87fbb 100644
3621 --- a/fs/cifs/cifsfs.c
3622 +++ b/fs/cifs/cifsfs.c
3623 @@ -394,17 +394,17 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
3624 struct sockaddr *srcaddr;
3625 srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;
3626
3627 - seq_printf(s, ",vers=%s", tcon->ses->server->vals->version_string);
3628 + seq_show_option(s, "vers", tcon->ses->server->vals->version_string);
3629 cifs_show_security(s, tcon->ses);
3630 cifs_show_cache_flavor(s, cifs_sb);
3631
3632 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
3633 seq_puts(s, ",multiuser");
3634 else if (tcon->ses->user_name)
3635 - seq_printf(s, ",username=%s", tcon->ses->user_name);
3636 + seq_show_option(s, "username", tcon->ses->user_name);
3637
3638 if (tcon->ses->domainName)
3639 - seq_printf(s, ",domain=%s", tcon->ses->domainName);
3640 + seq_show_option(s, "domain", tcon->ses->domainName);
3641
3642 if (srcaddr->sa_family != AF_UNSPEC) {
3643 struct sockaddr_in *saddr4;
3644 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
3645 index 58987b5c514b..9981064c4a54 100644
3646 --- a/fs/ext4/super.c
3647 +++ b/fs/ext4/super.c
3648 @@ -1763,10 +1763,10 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
3649 }
3650
3651 if (sbi->s_qf_names[USRQUOTA])
3652 - seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]);
3653 + seq_show_option(seq, "usrjquota", sbi->s_qf_names[USRQUOTA]);
3654
3655 if (sbi->s_qf_names[GRPQUOTA])
3656 - seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]);
3657 + seq_show_option(seq, "grpjquota", sbi->s_qf_names[GRPQUOTA]);
3658 #endif
3659 }
3660
3661 diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
3662 index 2982445947e1..894fb01a91da 100644
3663 --- a/fs/gfs2/super.c
3664 +++ b/fs/gfs2/super.c
3665 @@ -1334,11 +1334,11 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
3666 if (is_ancestor(root, sdp->sd_master_dir))
3667 seq_puts(s, ",meta");
3668 if (args->ar_lockproto[0])
3669 - seq_printf(s, ",lockproto=%s", args->ar_lockproto);
3670 + seq_show_option(s, "lockproto", args->ar_lockproto);
3671 if (args->ar_locktable[0])
3672 - seq_printf(s, ",locktable=%s", args->ar_locktable);
3673 + seq_show_option(s, "locktable", args->ar_locktable);
3674 if (args->ar_hostdata[0])
3675 - seq_printf(s, ",hostdata=%s", args->ar_hostdata);
3676 + seq_show_option(s, "hostdata", args->ar_hostdata);
3677 if (args->ar_spectator)
3678 seq_puts(s, ",spectator");
3679 if (args->ar_localflocks)
3680 diff --git a/fs/hfs/super.c b/fs/hfs/super.c
3681 index 55c03b9e9070..4574fdd3d421 100644
3682 --- a/fs/hfs/super.c
3683 +++ b/fs/hfs/super.c
3684 @@ -136,9 +136,9 @@ static int hfs_show_options(struct seq_file *seq, struct dentry *root)
3685 struct hfs_sb_info *sbi = HFS_SB(root->d_sb);
3686
3687 if (sbi->s_creator != cpu_to_be32(0x3f3f3f3f))
3688 - seq_printf(seq, ",creator=%.4s", (char *)&sbi->s_creator);
3689 + seq_show_option_n(seq, "creator", (char *)&sbi->s_creator, 4);
3690 if (sbi->s_type != cpu_to_be32(0x3f3f3f3f))
3691 - seq_printf(seq, ",type=%.4s", (char *)&sbi->s_type);
3692 + seq_show_option_n(seq, "type", (char *)&sbi->s_type, 4);
3693 seq_printf(seq, ",uid=%u,gid=%u",
3694 from_kuid_munged(&init_user_ns, sbi->s_uid),
3695 from_kgid_munged(&init_user_ns, sbi->s_gid));
3696 diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c
3697 index c90b72ee676d..bb806e58c977 100644
3698 --- a/fs/hfsplus/options.c
3699 +++ b/fs/hfsplus/options.c
3700 @@ -218,9 +218,9 @@ int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
3701 struct hfsplus_sb_info *sbi = HFSPLUS_SB(root->d_sb);
3702
3703 if (sbi->creator != HFSPLUS_DEF_CR_TYPE)
3704 - seq_printf(seq, ",creator=%.4s", (char *)&sbi->creator);
3705 + seq_show_option_n(seq, "creator", (char *)&sbi->creator, 4);
3706 if (sbi->type != HFSPLUS_DEF_CR_TYPE)
3707 - seq_printf(seq, ",type=%.4s", (char *)&sbi->type);
3708 + seq_show_option_n(seq, "type", (char *)&sbi->type, 4);
3709 seq_printf(seq, ",umask=%o,uid=%u,gid=%u", sbi->umask,
3710 from_kuid_munged(&init_user_ns, sbi->uid),
3711 from_kgid_munged(&init_user_ns, sbi->gid));
3712 diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
3713 index 059597b23f67..2ac99db3750e 100644
3714 --- a/fs/hostfs/hostfs_kern.c
3715 +++ b/fs/hostfs/hostfs_kern.c
3716 @@ -260,7 +260,7 @@ static int hostfs_show_options(struct seq_file *seq, struct dentry *root)
3717 size_t offset = strlen(root_ino) + 1;
3718
3719 if (strlen(root_path) > offset)
3720 - seq_printf(seq, ",%s", root_path + offset);
3721 + seq_show_option(seq, root_path + offset, NULL);
3722
3723 if (append)
3724 seq_puts(seq, ",append");
3725 diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
3726 index a0872f239f04..9e92c9c2d319 100644
3727 --- a/fs/hpfs/namei.c
3728 +++ b/fs/hpfs/namei.c
3729 @@ -8,6 +8,17 @@
3730 #include <linux/sched.h>
3731 #include "hpfs_fn.h"
3732
3733 +static void hpfs_update_directory_times(struct inode *dir)
3734 +{
3735 + time_t t = get_seconds();
3736 + if (t == dir->i_mtime.tv_sec &&
3737 + t == dir->i_ctime.tv_sec)
3738 + return;
3739 + dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t;
3740 + dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0;
3741 + hpfs_write_inode_nolock(dir);
3742 +}
3743 +
3744 static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
3745 {
3746 const unsigned char *name = dentry->d_name.name;
3747 @@ -99,6 +110,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
3748 result->i_mode = mode | S_IFDIR;
3749 hpfs_write_inode_nolock(result);
3750 }
3751 + hpfs_update_directory_times(dir);
3752 d_instantiate(dentry, result);
3753 hpfs_unlock(dir->i_sb);
3754 return 0;
3755 @@ -187,6 +199,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
3756 result->i_mode = mode | S_IFREG;
3757 hpfs_write_inode_nolock(result);
3758 }
3759 + hpfs_update_directory_times(dir);
3760 d_instantiate(dentry, result);
3761 hpfs_unlock(dir->i_sb);
3762 return 0;
3763 @@ -262,6 +275,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de
3764 insert_inode_hash(result);
3765
3766 hpfs_write_inode_nolock(result);
3767 + hpfs_update_directory_times(dir);
3768 d_instantiate(dentry, result);
3769 brelse(bh);
3770 hpfs_unlock(dir->i_sb);
3771 @@ -340,6 +354,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
3772 insert_inode_hash(result);
3773
3774 hpfs_write_inode_nolock(result);
3775 + hpfs_update_directory_times(dir);
3776 d_instantiate(dentry, result);
3777 hpfs_unlock(dir->i_sb);
3778 return 0;
3779 @@ -423,6 +438,8 @@ again:
3780 out1:
3781 hpfs_brelse4(&qbh);
3782 out:
3783 + if (!err)
3784 + hpfs_update_directory_times(dir);
3785 hpfs_unlock(dir->i_sb);
3786 return err;
3787 }
3788 @@ -477,6 +494,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
3789 out1:
3790 hpfs_brelse4(&qbh);
3791 out:
3792 + if (!err)
3793 + hpfs_update_directory_times(dir);
3794 hpfs_unlock(dir->i_sb);
3795 return err;
3796 }
3797 @@ -595,7 +614,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
3798 goto end1;
3799 }
3800
3801 - end:
3802 +end:
3803 hpfs_i(i)->i_parent_dir = new_dir->i_ino;
3804 if (S_ISDIR(i->i_mode)) {
3805 inc_nlink(new_dir);
3806 @@ -610,6 +629,10 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
3807 brelse(bh);
3808 }
3809 end1:
3810 + if (!err) {
3811 + hpfs_update_directory_times(old_dir);
3812 + hpfs_update_directory_times(new_dir);
3813 + }
3814 hpfs_unlock(i->i_sb);
3815 return err;
3816 }
3817 diff --git a/fs/libfs.c b/fs/libfs.c
3818 index 102edfd39000..c7cbfb092e94 100644
3819 --- a/fs/libfs.c
3820 +++ b/fs/libfs.c
3821 @@ -1185,7 +1185,7 @@ void make_empty_dir_inode(struct inode *inode)
3822 inode->i_uid = GLOBAL_ROOT_UID;
3823 inode->i_gid = GLOBAL_ROOT_GID;
3824 inode->i_rdev = 0;
3825 - inode->i_size = 2;
3826 + inode->i_size = 0;
3827 inode->i_blkbits = PAGE_SHIFT;
3828 inode->i_blocks = 0;
3829
3830 diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
3831 index 719f7f4c7a37..33efa334ec76 100644
3832 --- a/fs/ocfs2/file.c
3833 +++ b/fs/ocfs2/file.c
3834 @@ -2372,6 +2372,20 @@ relock:
3835 /* buffered aio wouldn't have proper lock coverage today */
3836 BUG_ON(written == -EIOCBQUEUED && !(iocb->ki_flags & IOCB_DIRECT));
3837
3838 + /*
3839 + * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
3840 + * function pointer which is called when o_direct io completes so that
3841 + * it can unlock our rw lock.
3842 + * Unfortunately there are error cases which call end_io and others
3843 + * that don't. so we don't have to unlock the rw_lock if either an
3844 + * async dio is going to do it in the future or an end_io after an
3845 + * error has already done it.
3846 + */
3847 + if ((written == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) {
3848 + rw_level = -1;
3849 + unaligned_dio = 0;
3850 + }
3851 +
3852 if (unlikely(written <= 0))
3853 goto no_sync;
3854
3855 @@ -2396,20 +2410,6 @@ relock:
3856 }
3857
3858 no_sync:
3859 - /*
3860 - * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
3861 - * function pointer which is called when o_direct io completes so that
3862 - * it can unlock our rw lock.
3863 - * Unfortunately there are error cases which call end_io and others
3864 - * that don't. so we don't have to unlock the rw_lock if either an
3865 - * async dio is going to do it in the future or an end_io after an
3866 - * error has already done it.
3867 - */
3868 - if ((ret == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) {
3869 - rw_level = -1;
3870 - unaligned_dio = 0;
3871 - }
3872 -
3873 if (unaligned_dio) {
3874 ocfs2_iocb_clear_unaligned_aio(iocb);
3875 mutex_unlock(&OCFS2_I(inode)->ip_unaligned_aio);
3876 diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
3877 index 403c5660b306..a482e312c7b2 100644
3878 --- a/fs/ocfs2/super.c
3879 +++ b/fs/ocfs2/super.c
3880 @@ -1550,8 +1550,8 @@ static int ocfs2_show_options(struct seq_file *s, struct dentry *root)
3881 seq_printf(s, ",localflocks,");
3882
3883 if (osb->osb_cluster_stack[0])
3884 - seq_printf(s, ",cluster_stack=%.*s", OCFS2_STACK_LABEL_LEN,
3885 - osb->osb_cluster_stack);
3886 + seq_show_option_n(s, "cluster_stack", osb->osb_cluster_stack,
3887 + OCFS2_STACK_LABEL_LEN);
3888 if (opts & OCFS2_MOUNT_USRQUOTA)
3889 seq_printf(s, ",usrquota");
3890 if (opts & OCFS2_MOUNT_GRPQUOTA)
3891 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
3892 index 7466ff339c66..79073d68b475 100644
3893 --- a/fs/overlayfs/super.c
3894 +++ b/fs/overlayfs/super.c
3895 @@ -588,10 +588,10 @@ static int ovl_show_options(struct seq_file *m, struct dentry *dentry)
3896 struct super_block *sb = dentry->d_sb;
3897 struct ovl_fs *ufs = sb->s_fs_info;
3898
3899 - seq_printf(m, ",lowerdir=%s", ufs->config.lowerdir);
3900 + seq_show_option(m, "lowerdir", ufs->config.lowerdir);
3901 if (ufs->config.upperdir) {
3902 - seq_printf(m, ",upperdir=%s", ufs->config.upperdir);
3903 - seq_printf(m, ",workdir=%s", ufs->config.workdir);
3904 + seq_show_option(m, "upperdir", ufs->config.upperdir);
3905 + seq_show_option(m, "workdir", ufs->config.workdir);
3906 }
3907 return 0;
3908 }
3909 diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
3910 index 0e4cf728126f..4a62fe8cc3bf 100644
3911 --- a/fs/reiserfs/super.c
3912 +++ b/fs/reiserfs/super.c
3913 @@ -714,18 +714,20 @@ static int reiserfs_show_options(struct seq_file *seq, struct dentry *root)
3914 seq_puts(seq, ",acl");
3915
3916 if (REISERFS_SB(s)->s_jdev)
3917 - seq_printf(seq, ",jdev=%s", REISERFS_SB(s)->s_jdev);
3918 + seq_show_option(seq, "jdev", REISERFS_SB(s)->s_jdev);
3919
3920 if (journal->j_max_commit_age != journal->j_default_max_commit_age)
3921 seq_printf(seq, ",commit=%d", journal->j_max_commit_age);
3922
3923 #ifdef CONFIG_QUOTA
3924 if (REISERFS_SB(s)->s_qf_names[USRQUOTA])
3925 - seq_printf(seq, ",usrjquota=%s", REISERFS_SB(s)->s_qf_names[USRQUOTA]);
3926 + seq_show_option(seq, "usrjquota",
3927 + REISERFS_SB(s)->s_qf_names[USRQUOTA]);
3928 else if (opts & (1 << REISERFS_USRQUOTA))
3929 seq_puts(seq, ",usrquota");
3930 if (REISERFS_SB(s)->s_qf_names[GRPQUOTA])
3931 - seq_printf(seq, ",grpjquota=%s", REISERFS_SB(s)->s_qf_names[GRPQUOTA]);
3932 + seq_show_option(seq, "grpjquota",
3933 + REISERFS_SB(s)->s_qf_names[GRPQUOTA]);
3934 else if (opts & (1 << REISERFS_GRPQUOTA))
3935 seq_puts(seq, ",grpquota");
3936 if (REISERFS_SB(s)->s_jquota_fmt) {
3937 diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
3938 index 74bcbabfa523..b14bbd6bb05f 100644
3939 --- a/fs/xfs/libxfs/xfs_da_format.h
3940 +++ b/fs/xfs/libxfs/xfs_da_format.h
3941 @@ -680,8 +680,15 @@ typedef struct xfs_attr_leaf_name_remote {
3942 typedef struct xfs_attr_leafblock {
3943 xfs_attr_leaf_hdr_t hdr; /* constant-structure header block */
3944 xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name */
3945 - xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf */
3946 - xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf */
3947 + /*
3948 + * The rest of the block contains the following structures after the
3949 + * leaf entries, growing from the bottom up. The variables are never
3950 + * referenced and definining them can actually make gcc optimize away
3951 + * accesses to the 'entries' array above index 0 so don't do that.
3952 + *
3953 + * xfs_attr_leaf_name_local_t namelist;
3954 + * xfs_attr_leaf_name_remote_t valuelist;
3955 + */
3956 } xfs_attr_leafblock_t;
3957
3958 /*
3959 diff --git a/fs/xfs/libxfs/xfs_dir2_data.c b/fs/xfs/libxfs/xfs_dir2_data.c
3960 index de1ea16f5748..534bbf283d6b 100644
3961 --- a/fs/xfs/libxfs/xfs_dir2_data.c
3962 +++ b/fs/xfs/libxfs/xfs_dir2_data.c
3963 @@ -252,7 +252,8 @@ xfs_dir3_data_reada_verify(
3964 return;
3965 case cpu_to_be32(XFS_DIR2_DATA_MAGIC):
3966 case cpu_to_be32(XFS_DIR3_DATA_MAGIC):
3967 - xfs_dir3_data_verify(bp);
3968 + bp->b_ops = &xfs_dir3_data_buf_ops;
3969 + bp->b_ops->verify_read(bp);
3970 return;
3971 default:
3972 xfs_buf_ioerror(bp, -EFSCORRUPTED);
3973 diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
3974 index 41b80d3d3877..06bb4218b362 100644
3975 --- a/fs/xfs/libxfs/xfs_dir2_node.c
3976 +++ b/fs/xfs/libxfs/xfs_dir2_node.c
3977 @@ -2132,6 +2132,7 @@ xfs_dir2_node_replace(
3978 int error; /* error return value */
3979 int i; /* btree level */
3980 xfs_ino_t inum; /* new inode number */
3981 + int ftype; /* new file type */
3982 xfs_dir2_leaf_t *leaf; /* leaf structure */
3983 xfs_dir2_leaf_entry_t *lep; /* leaf entry being changed */
3984 int rval; /* internal return value */
3985 @@ -2145,7 +2146,14 @@ xfs_dir2_node_replace(
3986 state = xfs_da_state_alloc();
3987 state->args = args;
3988 state->mp = args->dp->i_mount;
3989 +
3990 + /*
3991 + * We have to save new inode number and ftype since
3992 + * xfs_da3_node_lookup_int() is going to overwrite them
3993 + */
3994 inum = args->inumber;
3995 + ftype = args->filetype;
3996 +
3997 /*
3998 * Lookup the entry to change in the btree.
3999 */
4000 @@ -2183,7 +2191,7 @@ xfs_dir2_node_replace(
4001 * Fill in the new inode number and log the entry.
4002 */
4003 dep->inumber = cpu_to_be64(inum);
4004 - args->dp->d_ops->data_put_ftype(dep, args->filetype);
4005 + args->dp->d_ops->data_put_ftype(dep, ftype);
4006 xfs_dir2_data_log_entry(args, state->extrablk.bp, dep);
4007 rval = 0;
4008 }
4009 diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
4010 index 3859f5e27a4d..458fced2c0f9 100644
4011 --- a/fs/xfs/xfs_aops.c
4012 +++ b/fs/xfs/xfs_aops.c
4013 @@ -356,7 +356,8 @@ xfs_end_bio(
4014 {
4015 xfs_ioend_t *ioend = bio->bi_private;
4016
4017 - ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error;
4018 + if (!ioend->io_error && !test_bit(BIO_UPTODATE, &bio->bi_flags))
4019 + ioend->io_error = error;
4020
4021 /* Toss bio and pass work off to an xfsdatad thread */
4022 bio->bi_private = NULL;
4023 diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
4024 index 1fb16562c159..bbd9b1f10ffb 100644
4025 --- a/fs/xfs/xfs_super.c
4026 +++ b/fs/xfs/xfs_super.c
4027 @@ -511,9 +511,9 @@ xfs_showargs(
4028 seq_printf(m, "," MNTOPT_LOGBSIZE "=%dk", mp->m_logbsize >> 10);
4029
4030 if (mp->m_logname)
4031 - seq_printf(m, "," MNTOPT_LOGDEV "=%s", mp->m_logname);
4032 + seq_show_option(m, MNTOPT_LOGDEV, mp->m_logname);
4033 if (mp->m_rtname)
4034 - seq_printf(m, "," MNTOPT_RTDEV "=%s", mp->m_rtname);
4035 + seq_show_option(m, MNTOPT_RTDEV, mp->m_rtname);
4036
4037 if (mp->m_dalign > 0)
4038 seq_printf(m, "," MNTOPT_SUNIT "=%d",
4039 diff --git a/include/linux/acpi.h b/include/linux/acpi.h
4040 index d2445fa9999f..0b2394f61af4 100644
4041 --- a/include/linux/acpi.h
4042 +++ b/include/linux/acpi.h
4043 @@ -221,7 +221,7 @@ struct pci_dev;
4044
4045 int acpi_pci_irq_enable (struct pci_dev *dev);
4046 void acpi_penalize_isa_irq(int irq, int active);
4047 -
4048 +void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
4049 void acpi_pci_irq_disable (struct pci_dev *dev);
4050
4051 extern int ec_read(u8 addr, u8 *val);
4052 diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
4053 index f79148261d16..7bb7f673cb3f 100644
4054 --- a/include/linux/iio/iio.h
4055 +++ b/include/linux/iio/iio.h
4056 @@ -645,6 +645,15 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
4057 #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
4058
4059 /**
4060 + * IIO_RAD_TO_DEGREE() - Convert rad to degree
4061 + * @rad: A value in rad
4062 + *
4063 + * Returns the given value converted from rad to degree
4064 + */
4065 +#define IIO_RAD_TO_DEGREE(rad) \
4066 + (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL)
4067 +
4068 +/**
4069 * IIO_G_TO_M_S_2() - Convert g to meter / second**2
4070 * @g: A value in g
4071 *
4072 @@ -652,4 +661,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
4073 */
4074 #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
4075
4076 +/**
4077 + * IIO_M_S_2_TO_G() - Convert meter / second**2 to g
4078 + * @ms2: A value in meter / second**2
4079 + *
4080 + * Returns the given value converted from meter / second**2 to g
4081 + */
4082 +#define IIO_M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL)
4083 +
4084 #endif /* _INDUSTRIAL_IO_H_ */
4085 diff --git a/include/linux/pci.h b/include/linux/pci.h
4086 index 860c751810fc..1d4eb6057f72 100644
4087 --- a/include/linux/pci.h
4088 +++ b/include/linux/pci.h
4089 @@ -180,6 +180,8 @@ enum pci_dev_flags {
4090 PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6),
4091 /* Do not use PM reset even if device advertises NoSoftRst- */
4092 PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
4093 + /* Get VPD from function 0 VPD */
4094 + PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
4095 };
4096
4097 enum pci_irq_reroute_variant {
4098 diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
4099 index 912a7c482649..d4c7271382cb 100644
4100 --- a/include/linux/seq_file.h
4101 +++ b/include/linux/seq_file.h
4102 @@ -149,6 +149,41 @@ static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
4103 #endif
4104 }
4105
4106 +/**
4107 + * seq_show_options - display mount options with appropriate escapes.
4108 + * @m: the seq_file handle
4109 + * @name: the mount option name
4110 + * @value: the mount option name's value, can be NULL
4111 + */
4112 +static inline void seq_show_option(struct seq_file *m, const char *name,
4113 + const char *value)
4114 +{
4115 + seq_putc(m, ',');
4116 + seq_escape(m, name, ",= \t\n\\");
4117 + if (value) {
4118 + seq_putc(m, '=');
4119 + seq_escape(m, value, ", \t\n\\");
4120 + }
4121 +}
4122 +
4123 +/**
4124 + * seq_show_option_n - display mount options with appropriate escapes
4125 + * where @value must be a specific length.
4126 + * @m: the seq_file handle
4127 + * @name: the mount option name
4128 + * @value: the mount option name's value, cannot be NULL
4129 + * @length: the length of @value to display
4130 + *
4131 + * This is a macro since this uses "length" to define the size of the
4132 + * stack buffer.
4133 + */
4134 +#define seq_show_option_n(m, name, value, length) { \
4135 + char val_buf[length + 1]; \
4136 + strncpy(val_buf, value, length); \
4137 + val_buf[length] = '\0'; \
4138 + seq_show_option(m, name, val_buf); \
4139 +}
4140 +
4141 #define SEQ_START_TOKEN ((void *)1)
4142 /*
4143 * Helpers for iteration over list_head-s in seq_files
4144 diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
4145 index 061aca3a962d..d34611e35a30 100644
4146 --- a/include/uapi/linux/dm-ioctl.h
4147 +++ b/include/uapi/linux/dm-ioctl.h
4148 @@ -267,9 +267,9 @@ enum {
4149 #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
4150
4151 #define DM_VERSION_MAJOR 4
4152 -#define DM_VERSION_MINOR 32
4153 +#define DM_VERSION_MINOR 33
4154 #define DM_VERSION_PATCHLEVEL 0
4155 -#define DM_VERSION_EXTRA "-ioctl (2015-6-26)"
4156 +#define DM_VERSION_EXTRA "-ioctl (2015-8-18)"
4157
4158 /* Status bits */
4159 #define DM_READONLY_FLAG (1 << 0) /* In/Out */
4160 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
4161 index f89d9292eee6..c6c4240e7d28 100644
4162 --- a/kernel/cgroup.c
4163 +++ b/kernel/cgroup.c
4164 @@ -1334,7 +1334,7 @@ static int cgroup_show_options(struct seq_file *seq,
4165
4166 for_each_subsys(ss, ssid)
4167 if (root->subsys_mask & (1 << ssid))
4168 - seq_printf(seq, ",%s", ss->name);
4169 + seq_show_option(seq, ss->name, NULL);
4170 if (root->flags & CGRP_ROOT_NOPREFIX)
4171 seq_puts(seq, ",noprefix");
4172 if (root->flags & CGRP_ROOT_XATTR)
4173 @@ -1342,13 +1342,14 @@ static int cgroup_show_options(struct seq_file *seq,
4174
4175 spin_lock(&release_agent_path_lock);
4176 if (strlen(root->release_agent_path))
4177 - seq_printf(seq, ",release_agent=%s", root->release_agent_path);
4178 + seq_show_option(seq, "release_agent",
4179 + root->release_agent_path);
4180 spin_unlock(&release_agent_path_lock);
4181
4182 if (test_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags))
4183 seq_puts(seq, ",clone_children");
4184 if (strlen(root->name))
4185 - seq_printf(seq, ",name=%s", root->name);
4186 + seq_show_option(seq, "name", root->name);
4187 return 0;
4188 }
4189
4190 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
4191 index 78b4bad10081..e9673433cc01 100644
4192 --- a/kernel/sched/core.c
4193 +++ b/kernel/sched/core.c
4194 @@ -5433,6 +5433,14 @@ static int sched_cpu_active(struct notifier_block *nfb,
4195 case CPU_STARTING:
4196 set_cpu_rq_start_time();
4197 return NOTIFY_OK;
4198 + case CPU_ONLINE:
4199 + /*
4200 + * At this point a starting CPU has marked itself as online via
4201 + * set_cpu_online(). But it might not yet have marked itself
4202 + * as active, which is essential from here on.
4203 + *
4204 + * Thus, fall-through and help the starting CPU along.
4205 + */
4206 case CPU_DOWN_FAILED:
4207 set_cpu_active((long)hcpu, true);
4208 return NOTIFY_OK;
4209 diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
4210 index 6da82bcb0a8b..8fd97dac538a 100644
4211 --- a/mm/memory_hotplug.c
4212 +++ b/mm/memory_hotplug.c
4213 @@ -1248,6 +1248,14 @@ int __ref add_memory(int nid, u64 start, u64 size)
4214
4215 mem_hotplug_begin();
4216
4217 + /*
4218 + * Add new range to memblock so that when hotadd_new_pgdat() is called
4219 + * to allocate new pgdat, get_pfn_range_for_nid() will be able to find
4220 + * this new range and calculate total pages correctly. The range will
4221 + * be removed at hot-remove time.
4222 + */
4223 + memblock_add_node(start, size, nid);
4224 +
4225 new_node = !node_online(nid);
4226 if (new_node) {
4227 pgdat = hotadd_new_pgdat(nid, start);
4228 @@ -1277,7 +1285,6 @@ int __ref add_memory(int nid, u64 start, u64 size)
4229
4230 /* create new memmap entry */
4231 firmware_map_add_hotplug(start, start + size, "System RAM");
4232 - memblock_add_node(start, size, nid);
4233
4234 goto out;
4235
4236 @@ -1286,6 +1293,7 @@ error:
4237 if (new_pgdat)
4238 rollback_node_hotadd(nid, pgdat);
4239 release_memory_resource(res);
4240 + memblock_remove(start, size);
4241
4242 out:
4243 mem_hotplug_done();
4244 diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
4245 index f30329f72641..69a4d30a9ccf 100644
4246 --- a/net/ceph/ceph_common.c
4247 +++ b/net/ceph/ceph_common.c
4248 @@ -517,8 +517,11 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
4249 struct ceph_options *opt = client->options;
4250 size_t pos = m->count;
4251
4252 - if (opt->name)
4253 - seq_printf(m, "name=%s,", opt->name);
4254 + if (opt->name) {
4255 + seq_puts(m, "name=");
4256 + seq_escape(m, opt->name, ", \t\n\\");
4257 + seq_putc(m, ',');
4258 + }
4259 if (opt->key)
4260 seq_puts(m, "secret=<hidden>,");
4261
4262 diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
4263 index 564079c5c49d..cdf4c589a391 100644
4264 --- a/security/selinux/hooks.c
4265 +++ b/security/selinux/hooks.c
4266 @@ -1100,7 +1100,7 @@ static void selinux_write_opts(struct seq_file *m,
4267 seq_puts(m, prefix);
4268 if (has_comma)
4269 seq_putc(m, '\"');
4270 - seq_puts(m, opts->mnt_opts[i]);
4271 + seq_escape(m, opts->mnt_opts[i], "\"\n\\");
4272 if (has_comma)
4273 seq_putc(m, '\"');
4274 }
4275 diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
4276 index 36d842570745..69c63b92e078 100644
4277 --- a/sound/soc/codecs/adav80x.c
4278 +++ b/sound/soc/codecs/adav80x.c
4279 @@ -865,7 +865,6 @@ const struct regmap_config adav80x_regmap_config = {
4280 .val_bits = 8,
4281 .pad_bits = 1,
4282 .reg_bits = 7,
4283 - .read_flag_mask = 0x01,
4284
4285 .max_register = ADAV80X_PLL_OUTE,
4286
4287 diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
4288 index 802e05eae3e9..4180827a8480 100644
4289 --- a/sound/soc/codecs/arizona.c
4290 +++ b/sound/soc/codecs/arizona.c
4291 @@ -1756,17 +1756,6 @@ int arizona_init_dai(struct arizona_priv *priv, int id)
4292 }
4293 EXPORT_SYMBOL_GPL(arizona_init_dai);
4294
4295 -static irqreturn_t arizona_fll_clock_ok(int irq, void *data)
4296 -{
4297 - struct arizona_fll *fll = data;
4298 -
4299 - arizona_fll_dbg(fll, "clock OK\n");
4300 -
4301 - complete(&fll->ok);
4302 -
4303 - return IRQ_HANDLED;
4304 -}
4305 -
4306 static struct {
4307 unsigned int min;
4308 unsigned int max;
4309 @@ -2048,17 +2037,18 @@ static int arizona_is_enabled_fll(struct arizona_fll *fll)
4310 static int arizona_enable_fll(struct arizona_fll *fll)
4311 {
4312 struct arizona *arizona = fll->arizona;
4313 - unsigned long time_left;
4314 bool use_sync = false;
4315 int already_enabled = arizona_is_enabled_fll(fll);
4316 struct arizona_fll_cfg cfg;
4317 + int i;
4318 + unsigned int val;
4319
4320 if (already_enabled < 0)
4321 return already_enabled;
4322
4323 if (already_enabled) {
4324 /* Facilitate smooth refclk across the transition */
4325 - regmap_update_bits_async(fll->arizona->regmap, fll->base + 0x7,
4326 + regmap_update_bits_async(fll->arizona->regmap, fll->base + 0x9,
4327 ARIZONA_FLL1_GAIN_MASK, 0);
4328 regmap_update_bits_async(fll->arizona->regmap, fll->base + 1,
4329 ARIZONA_FLL1_FREERUN,
4330 @@ -2110,9 +2100,6 @@ static int arizona_enable_fll(struct arizona_fll *fll)
4331 if (!already_enabled)
4332 pm_runtime_get(arizona->dev);
4333
4334 - /* Clear any pending completions */
4335 - try_wait_for_completion(&fll->ok);
4336 -
4337 regmap_update_bits_async(arizona->regmap, fll->base + 1,
4338 ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA);
4339 if (use_sync)
4340 @@ -2124,10 +2111,24 @@ static int arizona_enable_fll(struct arizona_fll *fll)
4341 regmap_update_bits_async(arizona->regmap, fll->base + 1,
4342 ARIZONA_FLL1_FREERUN, 0);
4343
4344 - time_left = wait_for_completion_timeout(&fll->ok,
4345 - msecs_to_jiffies(250));
4346 - if (time_left == 0)
4347 + arizona_fll_dbg(fll, "Waiting for FLL lock...\n");
4348 + val = 0;
4349 + for (i = 0; i < 15; i++) {
4350 + if (i < 5)
4351 + usleep_range(200, 400);
4352 + else
4353 + msleep(20);
4354 +
4355 + regmap_read(arizona->regmap,
4356 + ARIZONA_INTERRUPT_RAW_STATUS_5,
4357 + &val);
4358 + if (val & (ARIZONA_FLL1_CLOCK_OK_STS << (fll->id - 1)))
4359 + break;
4360 + }
4361 + if (i == 15)
4362 arizona_fll_warn(fll, "Timed out waiting for lock\n");
4363 + else
4364 + arizona_fll_dbg(fll, "FLL locked (%d polls)\n", i);
4365
4366 return 0;
4367 }
4368 @@ -2212,11 +2213,8 @@ EXPORT_SYMBOL_GPL(arizona_set_fll);
4369 int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
4370 int ok_irq, struct arizona_fll *fll)
4371 {
4372 - int ret;
4373 unsigned int val;
4374
4375 - init_completion(&fll->ok);
4376 -
4377 fll->id = id;
4378 fll->base = base;
4379 fll->arizona = arizona;
4380 @@ -2238,13 +2236,6 @@ int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
4381 snprintf(fll->clock_ok_name, sizeof(fll->clock_ok_name),
4382 "FLL%d clock OK", id);
4383
4384 - ret = arizona_request_irq(arizona, ok_irq, fll->clock_ok_name,
4385 - arizona_fll_clock_ok, fll);
4386 - if (ret != 0) {
4387 - dev_err(arizona->dev, "Failed to get FLL%d clock OK IRQ: %d\n",
4388 - id, ret);
4389 - }
4390 -
4391 regmap_update_bits(arizona->regmap, fll->base + 1,
4392 ARIZONA_FLL1_FREERUN, 0);
4393
4394 diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
4395 index 43deb0462309..36867d05e0bb 100644
4396 --- a/sound/soc/codecs/arizona.h
4397 +++ b/sound/soc/codecs/arizona.h
4398 @@ -242,7 +242,6 @@ struct arizona_fll {
4399 int id;
4400 unsigned int base;
4401 unsigned int vco_mult;
4402 - struct completion ok;
4403
4404 unsigned int fout;
4405 int sync_src;
4406 diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
4407 index 9bc78e57513d..ff72cd8c236e 100644
4408 --- a/sound/soc/codecs/rt5640.c
4409 +++ b/sound/soc/codecs/rt5640.c
4410 @@ -984,6 +984,35 @@ static int rt5640_hp_event(struct snd_soc_dapm_widget *w,
4411 return 0;
4412 }
4413
4414 +static int rt5640_lout_event(struct snd_soc_dapm_widget *w,
4415 + struct snd_kcontrol *kcontrol, int event)
4416 +{
4417 + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
4418 +
4419 + switch (event) {
4420 + case SND_SOC_DAPM_POST_PMU:
4421 + hp_amp_power_on(codec);
4422 + snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
4423 + RT5640_PWR_LM, RT5640_PWR_LM);
4424 + snd_soc_update_bits(codec, RT5640_OUTPUT,
4425 + RT5640_L_MUTE | RT5640_R_MUTE, 0);
4426 + break;
4427 +
4428 + case SND_SOC_DAPM_PRE_PMD:
4429 + snd_soc_update_bits(codec, RT5640_OUTPUT,
4430 + RT5640_L_MUTE | RT5640_R_MUTE,
4431 + RT5640_L_MUTE | RT5640_R_MUTE);
4432 + snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
4433 + RT5640_PWR_LM, 0);
4434 + break;
4435 +
4436 + default:
4437 + return 0;
4438 + }
4439 +
4440 + return 0;
4441 +}
4442 +
4443 static int rt5640_hp_power_event(struct snd_soc_dapm_widget *w,
4444 struct snd_kcontrol *kcontrol, int event)
4445 {
4446 @@ -1179,13 +1208,16 @@ static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = {
4447 0, rt5640_spo_l_mix, ARRAY_SIZE(rt5640_spo_l_mix)),
4448 SND_SOC_DAPM_MIXER("SPOR MIX", SND_SOC_NOPM, 0,
4449 0, rt5640_spo_r_mix, ARRAY_SIZE(rt5640_spo_r_mix)),
4450 - SND_SOC_DAPM_MIXER("LOUT MIX", RT5640_PWR_ANLG1, RT5640_PWR_LM_BIT, 0,
4451 + SND_SOC_DAPM_MIXER("LOUT MIX", SND_SOC_NOPM, 0, 0,
4452 rt5640_lout_mix, ARRAY_SIZE(rt5640_lout_mix)),
4453 SND_SOC_DAPM_SUPPLY_S("Improve HP Amp Drv", 1, SND_SOC_NOPM,
4454 0, 0, rt5640_hp_power_event, SND_SOC_DAPM_POST_PMU),
4455 SND_SOC_DAPM_PGA_S("HP Amp", 1, SND_SOC_NOPM, 0, 0,
4456 rt5640_hp_event,
4457 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
4458 + SND_SOC_DAPM_PGA_S("LOUT amp", 1, SND_SOC_NOPM, 0, 0,
4459 + rt5640_lout_event,
4460 + SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
4461 SND_SOC_DAPM_SUPPLY("HP L Amp", RT5640_PWR_ANLG1,
4462 RT5640_PWR_HP_L_BIT, 0, NULL, 0),
4463 SND_SOC_DAPM_SUPPLY("HP R Amp", RT5640_PWR_ANLG1,
4464 @@ -1500,8 +1532,10 @@ static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
4465 {"HP R Playback", "Switch", "HP Amp"},
4466 {"HPOL", NULL, "HP L Playback"},
4467 {"HPOR", NULL, "HP R Playback"},
4468 - {"LOUTL", NULL, "LOUT MIX"},
4469 - {"LOUTR", NULL, "LOUT MIX"},
4470 +
4471 + {"LOUT amp", NULL, "LOUT MIX"},
4472 + {"LOUTL", NULL, "LOUT amp"},
4473 + {"LOUTR", NULL, "LOUT amp"},
4474 };
4475
4476 static const struct snd_soc_dapm_route rt5640_specific_dapm_routes[] = {
4477 diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
4478 index 961bd7e5877e..58713733d314 100644
4479 --- a/sound/soc/codecs/rt5645.c
4480 +++ b/sound/soc/codecs/rt5645.c
4481 @@ -3232,6 +3232,13 @@ static struct dmi_system_id dmi_platform_intel_braswell[] = {
4482 DMI_MATCH(DMI_PRODUCT_NAME, "Strago"),
4483 },
4484 },
4485 + {
4486 + .ident = "Google Celes",
4487 + .callback = strago_quirk_cb,
4488 + .matches = {
4489 + DMI_MATCH(DMI_PRODUCT_NAME, "Celes"),
4490 + },
4491 + },
4492 { }
4493 };
4494
4495 diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c
4496 index 8bf2e2c4bafb..9e371eb3e4fa 100644
4497 --- a/sound/soc/samsung/arndale_rt5631.c
4498 +++ b/sound/soc/samsung/arndale_rt5631.c
4499 @@ -116,15 +116,6 @@ static int arndale_audio_probe(struct platform_device *pdev)
4500 return ret;
4501 }
4502
4503 -static int arndale_audio_remove(struct platform_device *pdev)
4504 -{
4505 - struct snd_soc_card *card = platform_get_drvdata(pdev);
4506 -
4507 - snd_soc_unregister_card(card);
4508 -
4509 - return 0;
4510 -}
4511 -
4512 static const struct of_device_id samsung_arndale_rt5631_of_match[] __maybe_unused = {
4513 { .compatible = "samsung,arndale-rt5631", },
4514 { .compatible = "samsung,arndale-alc5631", },
4515 @@ -139,7 +130,6 @@ static struct platform_driver arndale_audio_driver = {
4516 .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match),
4517 },
4518 .probe = arndale_audio_probe,
4519 - .remove = arndale_audio_remove,
4520 };
4521
4522 module_platform_driver(arndale_audio_driver);