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