Contents of /trunk/kernel-alx/patches-3.8/0100-3.8.1-all-fixes.patch
Parent Directory | Revision Log
Revision 2117 -
(show annotations)
(download)
Mon Mar 18 12:50:44 2013 UTC (11 years, 6 months ago) by niro
File size: 220352 byte(s)
Mon Mar 18 12:50:44 2013 UTC (11 years, 6 months ago) by niro
File size: 220352 byte(s)
-3.8.2-alx-r1
1 | diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi |
2 | index 80e29c6..4801717 100644 |
3 | --- a/arch/arm/boot/dts/at91sam9n12.dtsi |
4 | +++ b/arch/arm/boot/dts/at91sam9n12.dtsi |
5 | @@ -324,8 +324,6 @@ |
6 | compatible = "atmel,at91sam9260-usart"; |
7 | reg = <0xf801c000 0x4000>; |
8 | interrupts = <5 4 5>; |
9 | - atmel,use-dma-rx; |
10 | - atmel,use-dma-tx; |
11 | pinctrl-names = "default"; |
12 | pinctrl-0 = <&pinctrl_usart0>; |
13 | status = "disabled"; |
14 | @@ -335,8 +333,6 @@ |
15 | compatible = "atmel,at91sam9260-usart"; |
16 | reg = <0xf8020000 0x4000>; |
17 | interrupts = <6 4 5>; |
18 | - atmel,use-dma-rx; |
19 | - atmel,use-dma-tx; |
20 | pinctrl-names = "default"; |
21 | pinctrl-0 = <&pinctrl_usart1>; |
22 | status = "disabled"; |
23 | @@ -346,8 +342,6 @@ |
24 | compatible = "atmel,at91sam9260-usart"; |
25 | reg = <0xf8024000 0x4000>; |
26 | interrupts = <7 4 5>; |
27 | - atmel,use-dma-rx; |
28 | - atmel,use-dma-tx; |
29 | pinctrl-names = "default"; |
30 | pinctrl-0 = <&pinctrl_usart2>; |
31 | status = "disabled"; |
32 | @@ -357,8 +351,6 @@ |
33 | compatible = "atmel,at91sam9260-usart"; |
34 | reg = <0xf8028000 0x4000>; |
35 | interrupts = <8 4 5>; |
36 | - atmel,use-dma-rx; |
37 | - atmel,use-dma-tx; |
38 | pinctrl-names = "default"; |
39 | pinctrl-0 = <&pinctrl_usart3>; |
40 | status = "disabled"; |
41 | diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi |
42 | index 8ecca69..c461e11 100644 |
43 | --- a/arch/arm/boot/dts/at91sam9x5.dtsi |
44 | +++ b/arch/arm/boot/dts/at91sam9x5.dtsi |
45 | @@ -402,8 +402,6 @@ |
46 | compatible = "atmel,at91sam9260-usart"; |
47 | reg = <0xf801c000 0x200>; |
48 | interrupts = <5 4 5>; |
49 | - atmel,use-dma-rx; |
50 | - atmel,use-dma-tx; |
51 | pinctrl-names = "default"; |
52 | pinctrl-0 = <&pinctrl_usart0>; |
53 | status = "disabled"; |
54 | @@ -413,8 +411,6 @@ |
55 | compatible = "atmel,at91sam9260-usart"; |
56 | reg = <0xf8020000 0x200>; |
57 | interrupts = <6 4 5>; |
58 | - atmel,use-dma-rx; |
59 | - atmel,use-dma-tx; |
60 | pinctrl-names = "default"; |
61 | pinctrl-0 = <&pinctrl_usart1>; |
62 | status = "disabled"; |
63 | @@ -424,8 +420,6 @@ |
64 | compatible = "atmel,at91sam9260-usart"; |
65 | reg = <0xf8024000 0x200>; |
66 | interrupts = <7 4 5>; |
67 | - atmel,use-dma-rx; |
68 | - atmel,use-dma-tx; |
69 | pinctrl-names = "default"; |
70 | pinctrl-0 = <&pinctrl_usart2>; |
71 | status = "disabled"; |
72 | diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c |
73 | index fc6692e..bd6f56b 100644 |
74 | --- a/arch/arm/kernel/sched_clock.c |
75 | +++ b/arch/arm/kernel/sched_clock.c |
76 | @@ -93,11 +93,11 @@ static void notrace update_sched_clock(void) |
77 | * detectable in cyc_to_fixed_sched_clock(). |
78 | */ |
79 | raw_local_irq_save(flags); |
80 | - cd.epoch_cyc = cyc; |
81 | + cd.epoch_cyc_copy = cyc; |
82 | smp_wmb(); |
83 | cd.epoch_ns = ns; |
84 | smp_wmb(); |
85 | - cd.epoch_cyc_copy = cyc; |
86 | + cd.epoch_cyc = cyc; |
87 | raw_local_irq_restore(flags); |
88 | } |
89 | |
90 | diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c |
91 | index 2c570cd..69858c7 100644 |
92 | --- a/arch/arm/mach-imx/clk-imx25.c |
93 | +++ b/arch/arm/mach-imx/clk-imx25.c |
94 | @@ -224,6 +224,9 @@ static int __init __mx25_clocks_init(unsigned long osc_rate) |
95 | |
96 | clk_prepare_enable(clk[emi_ahb]); |
97 | |
98 | + /* Clock source for gpt must be derived from AHB */ |
99 | + clk_set_parent(clk[per5_sel], clk[ahb]); |
100 | + |
101 | clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0"); |
102 | clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); |
103 | |
104 | diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c |
105 | index 11e2a41..26762bf 100644 |
106 | --- a/arch/arm/mach-integrator/integrator_ap.c |
107 | +++ b/arch/arm/mach-integrator/integrator_ap.c |
108 | @@ -613,7 +613,6 @@ static struct map_desc ap_io_desc_atag[] __initdata = { |
109 | static void __init ap_map_io_atag(void) |
110 | { |
111 | iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag)); |
112 | - ap_syscon_base = __io_address(INTEGRATOR_SC_BASE); |
113 | ap_map_io(); |
114 | } |
115 | |
116 | @@ -685,6 +684,7 @@ static void __init ap_init(void) |
117 | |
118 | platform_device_register(&cfi_flash_device); |
119 | |
120 | + ap_syscon_base = __io_address(INTEGRATOR_SC_BASE); |
121 | sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); |
122 | for (i = 0; i < 4; i++) { |
123 | struct lm_device *lmdev; |
124 | diff --git a/arch/arm/mach-pxa/include/mach/smemc.h b/arch/arm/mach-pxa/include/mach/smemc.h |
125 | index b7de471..b802f28 100644 |
126 | --- a/arch/arm/mach-pxa/include/mach/smemc.h |
127 | +++ b/arch/arm/mach-pxa/include/mach/smemc.h |
128 | @@ -37,6 +37,7 @@ |
129 | #define CSADRCFG1 (SMEMC_VIRT + 0x84) /* Address Configuration Register for CS1 */ |
130 | #define CSADRCFG2 (SMEMC_VIRT + 0x88) /* Address Configuration Register for CS2 */ |
131 | #define CSADRCFG3 (SMEMC_VIRT + 0x8C) /* Address Configuration Register for CS3 */ |
132 | +#define CSMSADRCFG (SMEMC_VIRT + 0xA0) /* Chip Select Configuration Register */ |
133 | |
134 | /* |
135 | * More handy macros for PCMCIA |
136 | diff --git a/arch/arm/mach-pxa/smemc.c b/arch/arm/mach-pxa/smemc.c |
137 | index 7992305..f38aa89 100644 |
138 | --- a/arch/arm/mach-pxa/smemc.c |
139 | +++ b/arch/arm/mach-pxa/smemc.c |
140 | @@ -40,6 +40,8 @@ static void pxa3xx_smemc_resume(void) |
141 | __raw_writel(csadrcfg[1], CSADRCFG1); |
142 | __raw_writel(csadrcfg[2], CSADRCFG2); |
143 | __raw_writel(csadrcfg[3], CSADRCFG3); |
144 | + /* CSMSADRCFG wakes up in its default state (0), so we need to set it */ |
145 | + __raw_writel(0x2, CSMSADRCFG); |
146 | } |
147 | |
148 | static struct syscore_ops smemc_syscore_ops = { |
149 | @@ -49,8 +51,19 @@ static struct syscore_ops smemc_syscore_ops = { |
150 | |
151 | static int __init smemc_init(void) |
152 | { |
153 | - if (cpu_is_pxa3xx()) |
154 | + if (cpu_is_pxa3xx()) { |
155 | + /* |
156 | + * The only documentation we have on the |
157 | + * Chip Select Configuration Register (CSMSADRCFG) is that |
158 | + * it must be programmed to 0x2. |
159 | + * Moreover, in the bit definitions, the second bit |
160 | + * (CSMSADRCFG[1]) is called "SETALWAYS". |
161 | + * Other bits are reserved in this register. |
162 | + */ |
163 | + __raw_writel(0x2, CSMSADRCFG); |
164 | + |
165 | register_syscore_ops(&smemc_syscore_ops); |
166 | + } |
167 | |
168 | return 0; |
169 | } |
170 | diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S |
171 | index 4135de8..13ed33c 100644 |
172 | --- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S |
173 | +++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S |
174 | @@ -40,17 +40,17 @@ |
175 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) |
176 | addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART) |
177 | bic \rd, \rd, #0xff000 |
178 | - ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] |
179 | + ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)] |
180 | and \rd, \rd, #0x00ff0000 |
181 | teq \rd, #0x00440000 @ is it 2440? |
182 | 1004: |
183 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
184 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
185 | moveq \rd, \rd, lsr #SHIFT_2440TXF |
186 | tst \rd, #S3C2410_UFSTAT_TXFULL |
187 | .endm |
188 | |
189 | .macro fifo_full_s3c2410 rd, rx |
190 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
191 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
192 | tst \rd, #S3C2410_UFSTAT_TXFULL |
193 | .endm |
194 | |
195 | @@ -68,18 +68,18 @@ |
196 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) |
197 | addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART) |
198 | bic \rd, \rd, #0xff000 |
199 | - ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] |
200 | + ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)] |
201 | and \rd, \rd, #0x00ff0000 |
202 | teq \rd, #0x00440000 @ is it 2440? |
203 | |
204 | 10000: |
205 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
206 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
207 | andne \rd, \rd, #S3C2410_UFSTAT_TXMASK |
208 | andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK |
209 | .endm |
210 | |
211 | .macro fifo_level_s3c2410 rd, rx |
212 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
213 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
214 | and \rd, \rd, #S3C2410_UFSTAT_TXMASK |
215 | .endm |
216 | |
217 | diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S |
218 | index 7615a14..6a21bee 100644 |
219 | --- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S |
220 | +++ b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S |
221 | @@ -31,10 +31,10 @@ |
222 | |
223 | @@ try the interrupt offset register, since it is there |
224 | |
225 | - ldr \irqstat, [ \base, #INTPND ] |
226 | + ldr \irqstat, [\base, #INTPND ] |
227 | teq \irqstat, #0 |
228 | beq 1002f |
229 | - ldr \irqnr, [ \base, #INTOFFSET ] |
230 | + ldr \irqnr, [\base, #INTOFFSET ] |
231 | mov \tmp, #1 |
232 | tst \irqstat, \tmp, lsl \irqnr |
233 | bne 1001f |
234 | diff --git a/arch/arm/mach-s3c24xx/pm-h1940.S b/arch/arm/mach-s3c24xx/pm-h1940.S |
235 | index c93bf2d..6183a68 100644 |
236 | --- a/arch/arm/mach-s3c24xx/pm-h1940.S |
237 | +++ b/arch/arm/mach-s3c24xx/pm-h1940.S |
238 | @@ -30,4 +30,4 @@ |
239 | |
240 | h1940_pm_return: |
241 | mov r0, #S3C2410_PA_GPIO |
242 | - ldr pc, [ r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO ] |
243 | + ldr pc, [r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO] |
244 | diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2410.S b/arch/arm/mach-s3c24xx/sleep-s3c2410.S |
245 | index dd5b638..65200ae 100644 |
246 | --- a/arch/arm/mach-s3c24xx/sleep-s3c2410.S |
247 | +++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S |
248 | @@ -45,9 +45,9 @@ ENTRY(s3c2410_cpu_suspend) |
249 | ldr r4, =S3C2410_REFRESH |
250 | ldr r5, =S3C24XX_MISCCR |
251 | ldr r6, =S3C2410_CLKCON |
252 | - ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB) |
253 | - ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB) |
254 | - ldr r9, [ r6 ] @ get CLKCON (and ensure in TLB) |
255 | + ldr r7, [r4] @ get REFRESH (and ensure in TLB) |
256 | + ldr r8, [r5] @ get MISCCR (and ensure in TLB) |
257 | + ldr r9, [r6] @ get CLKCON (and ensure in TLB) |
258 | |
259 | orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command |
260 | orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals |
261 | @@ -61,8 +61,8 @@ ENTRY(s3c2410_cpu_suspend) |
262 | @@ align next bit of code to cache line |
263 | .align 5 |
264 | s3c2410_do_sleep: |
265 | - streq r7, [ r4 ] @ SDRAM sleep command |
266 | - streq r8, [ r5 ] @ SDRAM power-down config |
267 | - streq r9, [ r6 ] @ CPU sleep |
268 | + streq r7, [r4] @ SDRAM sleep command |
269 | + streq r8, [r5] @ SDRAM power-down config |
270 | + streq r9, [r6] @ CPU sleep |
271 | 1: beq 1b |
272 | mov pc, r14 |
273 | diff --git a/arch/arm/mach-s3c24xx/sleep-s3c2412.S b/arch/arm/mach-s3c24xx/sleep-s3c2412.S |
274 | index c82418e..5adaceb 100644 |
275 | --- a/arch/arm/mach-s3c24xx/sleep-s3c2412.S |
276 | +++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S |
277 | @@ -57,12 +57,12 @@ s3c2412_sleep_enter1: |
278 | * retry, as simply returning causes the system to lock. |
279 | */ |
280 | |
281 | - ldrne r9, [ r1 ] |
282 | - strne r9, [ r1 ] |
283 | - ldrne r9, [ r2 ] |
284 | - strne r9, [ r2 ] |
285 | - ldrne r9, [ r3 ] |
286 | - strne r9, [ r3 ] |
287 | + ldrne r9, [r1] |
288 | + strne r9, [r1] |
289 | + ldrne r9, [r2] |
290 | + strne r9, [r2] |
291 | + ldrne r9, [r3] |
292 | + strne r9, [r3] |
293 | bne s3c2412_sleep_enter1 |
294 | |
295 | mov pc, r14 |
296 | diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c |
297 | index 5d59294..a78827b 100644 |
298 | --- a/arch/arm/mach-versatile/core.c |
299 | +++ b/arch/arm/mach-versatile/core.c |
300 | @@ -36,6 +36,7 @@ |
301 | #include <linux/gfp.h> |
302 | #include <linux/clkdev.h> |
303 | #include <linux/mtd/physmap.h> |
304 | +#include <linux/bitops.h> |
305 | |
306 | #include <asm/irq.h> |
307 | #include <asm/hardware/arm_timer.h> |
308 | @@ -65,16 +66,28 @@ |
309 | #define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) |
310 | #define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) |
311 | |
312 | +/* These PIC IRQs are valid in each configuration */ |
313 | +#define PIC_VALID_ALL BIT(SIC_INT_KMI0) | BIT(SIC_INT_KMI1) | \ |
314 | + BIT(SIC_INT_SCI3) | BIT(SIC_INT_UART3) | \ |
315 | + BIT(SIC_INT_CLCD) | BIT(SIC_INT_TOUCH) | \ |
316 | + BIT(SIC_INT_KEYPAD) | BIT(SIC_INT_DoC) | \ |
317 | + BIT(SIC_INT_USB) | BIT(SIC_INT_PCI0) | \ |
318 | + BIT(SIC_INT_PCI1) | BIT(SIC_INT_PCI2) | \ |
319 | + BIT(SIC_INT_PCI3) |
320 | #if 1 |
321 | #define IRQ_MMCI0A IRQ_VICSOURCE22 |
322 | #define IRQ_AACI IRQ_VICSOURCE24 |
323 | #define IRQ_ETH IRQ_VICSOURCE25 |
324 | #define PIC_MASK 0xFFD00000 |
325 | +#define PIC_VALID PIC_VALID_ALL |
326 | #else |
327 | #define IRQ_MMCI0A IRQ_SIC_MMCI0A |
328 | #define IRQ_AACI IRQ_SIC_AACI |
329 | #define IRQ_ETH IRQ_SIC_ETH |
330 | #define PIC_MASK 0 |
331 | +#define PIC_VALID PIC_VALID_ALL | BIT(SIC_INT_MMCI0A) | \ |
332 | + BIT(SIC_INT_MMCI1A) | BIT(SIC_INT_AACI) | \ |
333 | + BIT(SIC_INT_ETH) |
334 | #endif |
335 | |
336 | /* Lookup table for finding a DT node that represents the vic instance */ |
337 | @@ -102,7 +115,7 @@ void __init versatile_init_irq(void) |
338 | VERSATILE_SIC_BASE); |
339 | |
340 | fpga_irq_init(VA_SIC_BASE, "SIC", IRQ_SIC_START, |
341 | - IRQ_VICSOURCE31, ~PIC_MASK, np); |
342 | + IRQ_VICSOURCE31, PIC_VALID, np); |
343 | |
344 | /* |
345 | * Interrupts on secondary controller from 0 to 8 are routed to |
346 | diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c |
347 | index 2f84f40..e92e5e0 100644 |
348 | --- a/arch/arm/mach-versatile/pci.c |
349 | +++ b/arch/arm/mach-versatile/pci.c |
350 | @@ -23,6 +23,7 @@ |
351 | #include <linux/io.h> |
352 | |
353 | #include <mach/hardware.h> |
354 | +#include <mach/irqs.h> |
355 | #include <asm/irq.h> |
356 | #include <asm/mach/pci.h> |
357 | |
358 | @@ -327,12 +328,12 @@ static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
359 | int irq; |
360 | |
361 | /* slot, pin, irq |
362 | - * 24 1 27 |
363 | - * 25 1 28 |
364 | - * 26 1 29 |
365 | - * 27 1 30 |
366 | + * 24 1 IRQ_SIC_PCI0 |
367 | + * 25 1 IRQ_SIC_PCI1 |
368 | + * 26 1 IRQ_SIC_PCI2 |
369 | + * 27 1 IRQ_SIC_PCI3 |
370 | */ |
371 | - irq = 27 + ((slot - 24 + pin - 1) & 3); |
372 | + irq = IRQ_SIC_PCI0 + ((slot - 24 + pin - 1) & 3); |
373 | |
374 | return irq; |
375 | } |
376 | diff --git a/arch/arm/plat-samsung/include/plat/debug-macro.S b/arch/arm/plat-samsung/include/plat/debug-macro.S |
377 | index 207e275..f3a9cff 100644 |
378 | --- a/arch/arm/plat-samsung/include/plat/debug-macro.S |
379 | +++ b/arch/arm/plat-samsung/include/plat/debug-macro.S |
380 | @@ -14,12 +14,12 @@ |
381 | /* The S5PV210/S5PC110 implementations are as belows. */ |
382 | |
383 | .macro fifo_level_s5pv210 rd, rx |
384 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
385 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
386 | and \rd, \rd, #S5PV210_UFSTAT_TXMASK |
387 | .endm |
388 | |
389 | .macro fifo_full_s5pv210 rd, rx |
390 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
391 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
392 | tst \rd, #S5PV210_UFSTAT_TXFULL |
393 | .endm |
394 | |
395 | @@ -27,7 +27,7 @@ |
396 | * most widely re-used */ |
397 | |
398 | .macro fifo_level_s3c2440 rd, rx |
399 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
400 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
401 | and \rd, \rd, #S3C2440_UFSTAT_TXMASK |
402 | .endm |
403 | |
404 | @@ -36,7 +36,7 @@ |
405 | #endif |
406 | |
407 | .macro fifo_full_s3c2440 rd, rx |
408 | - ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
409 | + ldr \rd, [\rx, # S3C2410_UFSTAT] |
410 | tst \rd, #S3C2440_UFSTAT_TXFULL |
411 | .endm |
412 | |
413 | @@ -45,11 +45,11 @@ |
414 | #endif |
415 | |
416 | .macro senduart,rd,rx |
417 | - strb \rd, [\rx, # S3C2410_UTXH ] |
418 | + strb \rd, [\rx, # S3C2410_UTXH] |
419 | .endm |
420 | |
421 | .macro busyuart, rd, rx |
422 | - ldr \rd, [ \rx, # S3C2410_UFCON ] |
423 | + ldr \rd, [\rx, # S3C2410_UFCON] |
424 | tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled? |
425 | beq 1001f @ |
426 | @ FIFO enabled... |
427 | @@ -60,7 +60,7 @@ |
428 | |
429 | 1001: |
430 | @ busy waiting for non fifo |
431 | - ldr \rd, [ \rx, # S3C2410_UTRSTAT ] |
432 | + ldr \rd, [\rx, # S3C2410_UTRSTAT] |
433 | tst \rd, #S3C2410_UTRSTAT_TXFE |
434 | beq 1001b |
435 | |
436 | @@ -68,7 +68,7 @@ |
437 | .endm |
438 | |
439 | .macro waituart,rd,rx |
440 | - ldr \rd, [ \rx, # S3C2410_UFCON ] |
441 | + ldr \rd, [\rx, # S3C2410_UFCON] |
442 | tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled? |
443 | beq 1001f @ |
444 | @ FIFO enabled... |
445 | @@ -79,7 +79,7 @@ |
446 | b 1002f |
447 | 1001: |
448 | @ idle waiting for non fifo |
449 | - ldr \rd, [ \rx, # S3C2410_UTRSTAT ] |
450 | + ldr \rd, [\rx, # S3C2410_UTRSTAT] |
451 | tst \rd, #S3C2410_UTRSTAT_TXFE |
452 | beq 1001b |
453 | |
454 | diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c |
455 | index a4db3d2..41db148 100644 |
456 | --- a/arch/arm64/kernel/signal32.c |
457 | +++ b/arch/arm64/kernel/signal32.c |
458 | @@ -76,7 +76,7 @@ struct compat_sigcontext { |
459 | |
460 | struct compat_ucontext { |
461 | compat_ulong_t uc_flags; |
462 | - struct compat_ucontext *uc_link; |
463 | + compat_uptr_t uc_link; |
464 | compat_stack_t uc_stack; |
465 | struct compat_sigcontext uc_mcontext; |
466 | compat_sigset_t uc_sigmask; |
467 | @@ -703,7 +703,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, |
468 | err |= copy_siginfo_to_user32(&frame->info, info); |
469 | |
470 | __put_user_error(0, &frame->sig.uc.uc_flags, err); |
471 | - __put_user_error(NULL, &frame->sig.uc.uc_link, err); |
472 | + __put_user_error(0, &frame->sig.uc.uc_link, err); |
473 | |
474 | memset(&stack, 0, sizeof(stack)); |
475 | stack.ss_sp = (compat_uptr_t)current->sas_ss_sp; |
476 | diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h |
477 | index ee99f23..7df49fa 100644 |
478 | --- a/arch/parisc/include/asm/pgtable.h |
479 | +++ b/arch/parisc/include/asm/pgtable.h |
480 | @@ -12,11 +12,10 @@ |
481 | |
482 | #include <linux/bitops.h> |
483 | #include <linux/spinlock.h> |
484 | +#include <linux/mm_types.h> |
485 | #include <asm/processor.h> |
486 | #include <asm/cache.h> |
487 | |
488 | -struct vm_area_struct; |
489 | - |
490 | /* |
491 | * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel |
492 | * memory. For the return value to be meaningful, ADDR must be >= |
493 | @@ -40,7 +39,14 @@ struct vm_area_struct; |
494 | do{ \ |
495 | *(pteptr) = (pteval); \ |
496 | } while(0) |
497 | -#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) |
498 | + |
499 | +extern void purge_tlb_entries(struct mm_struct *, unsigned long); |
500 | + |
501 | +#define set_pte_at(mm, addr, ptep, pteval) \ |
502 | + do { \ |
503 | + set_pte(ptep, pteval); \ |
504 | + purge_tlb_entries(mm, addr); \ |
505 | + } while (0) |
506 | |
507 | #endif /* !__ASSEMBLY__ */ |
508 | |
509 | @@ -466,6 +472,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, |
510 | old = pte_val(*ptep); |
511 | new = pte_val(pte_wrprotect(__pte (old))); |
512 | } while (cmpxchg((unsigned long *) ptep, old, new) != old); |
513 | + purge_tlb_entries(mm, addr); |
514 | #else |
515 | pte_t old_pte = *ptep; |
516 | set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); |
517 | diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c |
518 | index 48e16dc..b89a85a 100644 |
519 | --- a/arch/parisc/kernel/cache.c |
520 | +++ b/arch/parisc/kernel/cache.c |
521 | @@ -419,6 +419,24 @@ void kunmap_parisc(void *addr) |
522 | EXPORT_SYMBOL(kunmap_parisc); |
523 | #endif |
524 | |
525 | +void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) |
526 | +{ |
527 | + unsigned long flags; |
528 | + |
529 | + /* Note: purge_tlb_entries can be called at startup with |
530 | + no context. */ |
531 | + |
532 | + /* Disable preemption while we play with %sr1. */ |
533 | + preempt_disable(); |
534 | + mtsp(mm->context, 1); |
535 | + purge_tlb_start(flags); |
536 | + pdtlb(addr); |
537 | + pitlb(addr); |
538 | + purge_tlb_end(flags); |
539 | + preempt_enable(); |
540 | +} |
541 | +EXPORT_SYMBOL(purge_tlb_entries); |
542 | + |
543 | void __flush_tlb_range(unsigned long sid, unsigned long start, |
544 | unsigned long end) |
545 | { |
546 | diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig |
547 | index 17903f1..dabe429 100644 |
548 | --- a/arch/powerpc/Kconfig |
549 | +++ b/arch/powerpc/Kconfig |
550 | @@ -275,6 +275,10 @@ config PPC_ADV_DEBUG_DAC_RANGE |
551 | depends on PPC_ADV_DEBUG_REGS && 44x |
552 | default y |
553 | |
554 | +config PPC_EMULATE_SSTEP |
555 | + bool |
556 | + default y if KPROBES || UPROBES || XMON || HAVE_HW_BREAKPOINT |
557 | + |
558 | source "init/Kconfig" |
559 | |
560 | source "kernel/Kconfig.freezer" |
561 | diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h |
562 | index a8fb03e..a80e32b 100644 |
563 | --- a/arch/powerpc/include/asm/eeh.h |
564 | +++ b/arch/powerpc/include/asm/eeh.h |
565 | @@ -201,6 +201,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev); |
566 | void __init eeh_addr_cache_build(void); |
567 | void eeh_add_device_tree_early(struct device_node *); |
568 | void eeh_add_device_tree_late(struct pci_bus *); |
569 | +void eeh_add_sysfs_files(struct pci_bus *); |
570 | void eeh_remove_bus_device(struct pci_dev *, int); |
571 | |
572 | /** |
573 | @@ -240,6 +241,8 @@ static inline void eeh_add_device_tree_early(struct device_node *dn) { } |
574 | |
575 | static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } |
576 | |
577 | +static inline void eeh_add_sysfs_files(struct pci_bus *bus) { } |
578 | + |
579 | static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } |
580 | |
581 | static inline void eeh_lock(void) { } |
582 | diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c |
583 | index 7206701..466a290 100644 |
584 | --- a/arch/powerpc/kernel/machine_kexec_64.c |
585 | +++ b/arch/powerpc/kernel/machine_kexec_64.c |
586 | @@ -162,6 +162,8 @@ static int kexec_all_irq_disabled = 0; |
587 | static void kexec_smp_down(void *arg) |
588 | { |
589 | local_irq_disable(); |
590 | + hard_irq_disable(); |
591 | + |
592 | mb(); /* make sure our irqs are disabled before we say they are */ |
593 | get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF; |
594 | while(kexec_all_irq_disabled == 0) |
595 | @@ -244,6 +246,8 @@ static void kexec_prepare_cpus(void) |
596 | wake_offline_cpus(); |
597 | smp_call_function(kexec_smp_down, NULL, /* wait */0); |
598 | local_irq_disable(); |
599 | + hard_irq_disable(); |
600 | + |
601 | mb(); /* make sure IRQs are disabled before we say they are */ |
602 | get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF; |
603 | |
604 | @@ -281,6 +285,7 @@ static void kexec_prepare_cpus(void) |
605 | if (ppc_md.kexec_cpu_down) |
606 | ppc_md.kexec_cpu_down(0, 0); |
607 | local_irq_disable(); |
608 | + hard_irq_disable(); |
609 | } |
610 | |
611 | #endif /* SMP */ |
612 | diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c |
613 | index 07c1269..e51c89f 100644 |
614 | --- a/arch/powerpc/kernel/of_platform.c |
615 | +++ b/arch/powerpc/kernel/of_platform.c |
616 | @@ -95,6 +95,9 @@ static int of_pci_phb_probe(struct platform_device *dev) |
617 | /* Add probed PCI devices to the device model */ |
618 | pci_bus_add_devices(phb->bus); |
619 | |
620 | + /* sysfs files should only be added after devices are added */ |
621 | + eeh_add_sysfs_files(phb->bus); |
622 | + |
623 | return 0; |
624 | } |
625 | |
626 | diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c |
627 | index 7c37379..fa12ae4 100644 |
628 | --- a/arch/powerpc/kernel/pci-common.c |
629 | +++ b/arch/powerpc/kernel/pci-common.c |
630 | @@ -1477,11 +1477,14 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus) |
631 | pcibios_allocate_bus_resources(bus); |
632 | pcibios_claim_one_bus(bus); |
633 | |
634 | + /* Fixup EEH */ |
635 | + eeh_add_device_tree_late(bus); |
636 | + |
637 | /* Add new devices to global lists. Register in proc, sysfs. */ |
638 | pci_bus_add_devices(bus); |
639 | |
640 | - /* Fixup EEH */ |
641 | - eeh_add_device_tree_late(bus); |
642 | + /* sysfs files should only be added after devices are added */ |
643 | + eeh_add_sysfs_files(bus); |
644 | } |
645 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); |
646 | |
647 | diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile |
648 | index 746e0c8..35baad9 100644 |
649 | --- a/arch/powerpc/lib/Makefile |
650 | +++ b/arch/powerpc/lib/Makefile |
651 | @@ -19,9 +19,7 @@ obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ |
652 | checksum_wrappers_64.o hweight_64.o \ |
653 | copyuser_power7.o string_64.o copypage_power7.o \ |
654 | memcpy_power7.o |
655 | -obj-$(CONFIG_XMON) += sstep.o ldstfp.o |
656 | -obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o |
657 | -obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o |
658 | +obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o |
659 | |
660 | ifeq ($(CONFIG_PPC64),y) |
661 | obj-$(CONFIG_SMP) += locks.o |
662 | diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c |
663 | index 9a04322..6b73d6c 100644 |
664 | --- a/arch/powerpc/platforms/pseries/eeh.c |
665 | +++ b/arch/powerpc/platforms/pseries/eeh.c |
666 | @@ -788,7 +788,6 @@ static void eeh_add_device_late(struct pci_dev *dev) |
667 | dev->dev.archdata.edev = edev; |
668 | |
669 | eeh_addr_cache_insert_dev(dev); |
670 | - eeh_sysfs_add_device(dev); |
671 | } |
672 | |
673 | /** |
674 | @@ -815,6 +814,29 @@ void eeh_add_device_tree_late(struct pci_bus *bus) |
675 | EXPORT_SYMBOL_GPL(eeh_add_device_tree_late); |
676 | |
677 | /** |
678 | + * eeh_add_sysfs_files - Add EEH sysfs files for the indicated PCI bus |
679 | + * @bus: PCI bus |
680 | + * |
681 | + * This routine must be used to add EEH sysfs files for PCI |
682 | + * devices which are attached to the indicated PCI bus. The PCI bus |
683 | + * is added after system boot through hotplug or dlpar. |
684 | + */ |
685 | +void eeh_add_sysfs_files(struct pci_bus *bus) |
686 | +{ |
687 | + struct pci_dev *dev; |
688 | + |
689 | + list_for_each_entry(dev, &bus->devices, bus_list) { |
690 | + eeh_sysfs_add_device(dev); |
691 | + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { |
692 | + struct pci_bus *subbus = dev->subordinate; |
693 | + if (subbus) |
694 | + eeh_add_sysfs_files(subbus); |
695 | + } |
696 | + } |
697 | +} |
698 | +EXPORT_SYMBOL_GPL(eeh_add_sysfs_files); |
699 | + |
700 | +/** |
701 | * eeh_remove_device - Undo EEH setup for the indicated pci device |
702 | * @dev: pci device to be removed |
703 | * @purge_pe: remove the PE or not |
704 | diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
705 | index f090e81..8bafa4f 100644 |
706 | --- a/arch/s390/kvm/kvm-s390.c |
707 | +++ b/arch/s390/kvm/kvm-s390.c |
708 | @@ -766,6 +766,14 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) |
709 | } else |
710 | prefix = 0; |
711 | |
712 | + /* |
713 | + * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy |
714 | + * copying in vcpu load/put. Lets update our copies before we save |
715 | + * it into the save area |
716 | + */ |
717 | + save_fp_regs(&vcpu->arch.guest_fpregs); |
718 | + save_access_regs(vcpu->run->s.regs.acrs); |
719 | + |
720 | if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs), |
721 | vcpu->arch.guest_fpregs.fprs, 128, prefix)) |
722 | return -EFAULT; |
723 | diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h |
724 | index 9661e9b..7eb57d2 100644 |
725 | --- a/arch/sparc/include/asm/hugetlb.h |
726 | +++ b/arch/sparc/include/asm/hugetlb.h |
727 | @@ -12,7 +12,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, |
728 | |
729 | static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) |
730 | { |
731 | - hugetlb_setup(mm); |
732 | } |
733 | |
734 | static inline int is_hugepage_only_range(struct mm_struct *mm, |
735 | diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h |
736 | index 4b39f74..e155388 100644 |
737 | --- a/arch/sparc/include/asm/page_64.h |
738 | +++ b/arch/sparc/include/asm/page_64.h |
739 | @@ -27,8 +27,8 @@ |
740 | #ifndef __ASSEMBLY__ |
741 | |
742 | #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) |
743 | -struct mm_struct; |
744 | -extern void hugetlb_setup(struct mm_struct *mm); |
745 | +struct pt_regs; |
746 | +extern void hugetlb_setup(struct pt_regs *regs); |
747 | #endif |
748 | |
749 | #define WANT_PAGE_VIRTUAL |
750 | diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h |
751 | index b4c258d..e696432 100644 |
752 | --- a/arch/sparc/include/asm/tsb.h |
753 | +++ b/arch/sparc/include/asm/tsb.h |
754 | @@ -157,17 +157,26 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; |
755 | andn REG2, 0x7, REG2; \ |
756 | add REG1, REG2, REG1; |
757 | |
758 | - /* This macro exists only to make the PMD translator below easier |
759 | - * to read. It hides the ELF section switch for the sun4v code |
760 | - * patching. |
761 | + /* These macros exists only to make the PMD translator below |
762 | + * easier to read. It hides the ELF section switch for the |
763 | + * sun4v code patching. |
764 | */ |
765 | -#define OR_PTE_BIT(REG, NAME) \ |
766 | +#define OR_PTE_BIT_1INSN(REG, NAME) \ |
767 | 661: or REG, _PAGE_##NAME##_4U, REG; \ |
768 | .section .sun4v_1insn_patch, "ax"; \ |
769 | .word 661b; \ |
770 | or REG, _PAGE_##NAME##_4V, REG; \ |
771 | .previous; |
772 | |
773 | +#define OR_PTE_BIT_2INSN(REG, TMP, NAME) \ |
774 | +661: sethi %hi(_PAGE_##NAME##_4U), TMP; \ |
775 | + or REG, TMP, REG; \ |
776 | + .section .sun4v_2insn_patch, "ax"; \ |
777 | + .word 661b; \ |
778 | + mov -1, TMP; \ |
779 | + or REG, _PAGE_##NAME##_4V, REG; \ |
780 | + .previous; |
781 | + |
782 | /* Load into REG the PTE value for VALID, CACHE, and SZHUGE. */ |
783 | #define BUILD_PTE_VALID_SZHUGE_CACHE(REG) \ |
784 | 661: sethi %uhi(_PAGE_VALID|_PAGE_SZHUGE_4U), REG; \ |
785 | @@ -214,12 +223,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; |
786 | andn REG1, PMD_HUGE_PROTBITS, REG2; \ |
787 | sllx REG2, PMD_PADDR_SHIFT, REG2; \ |
788 | /* REG2 now holds PFN << PAGE_SHIFT */ \ |
789 | - andcc REG1, PMD_HUGE_EXEC, %g0; \ |
790 | - bne,a,pt %xcc, 1f; \ |
791 | - OR_PTE_BIT(REG2, EXEC); \ |
792 | -1: andcc REG1, PMD_HUGE_WRITE, %g0; \ |
793 | + andcc REG1, PMD_HUGE_WRITE, %g0; \ |
794 | bne,a,pt %xcc, 1f; \ |
795 | - OR_PTE_BIT(REG2, W); \ |
796 | + OR_PTE_BIT_1INSN(REG2, W); \ |
797 | +1: andcc REG1, PMD_HUGE_EXEC, %g0; \ |
798 | + be,pt %xcc, 1f; \ |
799 | + nop; \ |
800 | + OR_PTE_BIT_2INSN(REG2, REG1, EXEC); \ |
801 | /* REG1 can now be clobbered, build final PTE */ \ |
802 | 1: BUILD_PTE_VALID_SZHUGE_CACHE(REG1); \ |
803 | ba,pt %xcc, PTE_LABEL; \ |
804 | diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S |
805 | index d4bdc7a..a313e4a 100644 |
806 | --- a/arch/sparc/kernel/tsb.S |
807 | +++ b/arch/sparc/kernel/tsb.S |
808 | @@ -136,12 +136,43 @@ tsb_miss_page_table_walk_sun4v_fastpath: |
809 | nop |
810 | |
811 | /* It is a huge page, use huge page TSB entry address we |
812 | - * calculated above. |
813 | + * calculated above. If the huge page TSB has not been |
814 | + * allocated, setup a trap stack and call hugetlb_setup() |
815 | + * to do so, then return from the trap to replay the TLB |
816 | + * miss. |
817 | + * |
818 | + * This is necessary to handle the case of transparent huge |
819 | + * pages where we don't really have a non-atomic context |
820 | + * in which to allocate the hugepage TSB hash table. When |
821 | + * the 'mm' faults in the hugepage for the first time, we |
822 | + * thus handle it here. This also makes sure that we can |
823 | + * allocate the TSB hash table on the correct NUMA node. |
824 | */ |
825 | TRAP_LOAD_TRAP_BLOCK(%g7, %g2) |
826 | - ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g2 |
827 | - cmp %g2, -1 |
828 | - movne %xcc, %g2, %g1 |
829 | + ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g1 |
830 | + cmp %g1, -1 |
831 | + bne,pt %xcc, 60f |
832 | + nop |
833 | + |
834 | +661: rdpr %pstate, %g5 |
835 | + wrpr %g5, PSTATE_AG | PSTATE_MG, %pstate |
836 | + .section .sun4v_2insn_patch, "ax" |
837 | + .word 661b |
838 | + SET_GL(1) |
839 | + nop |
840 | + .previous |
841 | + |
842 | + rdpr %tl, %g3 |
843 | + cmp %g3, 1 |
844 | + bne,pn %xcc, winfix_trampoline |
845 | + nop |
846 | + ba,pt %xcc, etrap |
847 | + rd %pc, %g7 |
848 | + call hugetlb_setup |
849 | + add %sp, PTREGS_OFF, %o0 |
850 | + ba,pt %xcc, rtrap |
851 | + nop |
852 | + |
853 | 60: |
854 | #endif |
855 | |
856 | diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c |
857 | index 097aee7..5062ff3 100644 |
858 | --- a/arch/sparc/mm/fault_64.c |
859 | +++ b/arch/sparc/mm/fault_64.c |
860 | @@ -472,8 +472,13 @@ good_area: |
861 | #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) |
862 | mm_rss = mm->context.huge_pte_count; |
863 | if (unlikely(mm_rss > |
864 | - mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) |
865 | - tsb_grow(mm, MM_TSB_HUGE, mm_rss); |
866 | + mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) { |
867 | + if (mm->context.tsb_block[MM_TSB_HUGE].tsb) |
868 | + tsb_grow(mm, MM_TSB_HUGE, mm_rss); |
869 | + else |
870 | + hugetlb_setup(regs); |
871 | + |
872 | + } |
873 | #endif |
874 | return; |
875 | |
876 | diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c |
877 | index c3b7242..82bbf04 100644 |
878 | --- a/arch/sparc/mm/init_64.c |
879 | +++ b/arch/sparc/mm/init_64.c |
880 | @@ -314,16 +314,31 @@ static void __update_mmu_tsb_insert(struct mm_struct *mm, unsigned long tsb_inde |
881 | struct tsb *tsb = mm->context.tsb_block[tsb_index].tsb; |
882 | unsigned long tag; |
883 | |
884 | + if (unlikely(!tsb)) |
885 | + return; |
886 | + |
887 | tsb += ((address >> tsb_hash_shift) & |
888 | (mm->context.tsb_block[tsb_index].tsb_nentries - 1UL)); |
889 | tag = (address >> 22UL); |
890 | tsb_insert(tsb, tag, tte); |
891 | } |
892 | |
893 | +#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) |
894 | +static inline bool is_hugetlb_pte(pte_t pte) |
895 | +{ |
896 | + if ((tlb_type == hypervisor && |
897 | + (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) || |
898 | + (tlb_type != hypervisor && |
899 | + (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U)) |
900 | + return true; |
901 | + return false; |
902 | +} |
903 | +#endif |
904 | + |
905 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) |
906 | { |
907 | - unsigned long tsb_index, tsb_hash_shift, flags; |
908 | struct mm_struct *mm; |
909 | + unsigned long flags; |
910 | pte_t pte = *ptep; |
911 | |
912 | if (tlb_type != hypervisor) { |
913 | @@ -335,25 +350,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t * |
914 | |
915 | mm = vma->vm_mm; |
916 | |
917 | - tsb_index = MM_TSB_BASE; |
918 | - tsb_hash_shift = PAGE_SHIFT; |
919 | - |
920 | spin_lock_irqsave(&mm->context.lock, flags); |
921 | |
922 | #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) |
923 | - if (mm->context.tsb_block[MM_TSB_HUGE].tsb != NULL) { |
924 | - if ((tlb_type == hypervisor && |
925 | - (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) || |
926 | - (tlb_type != hypervisor && |
927 | - (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U)) { |
928 | - tsb_index = MM_TSB_HUGE; |
929 | - tsb_hash_shift = HPAGE_SHIFT; |
930 | - } |
931 | - } |
932 | + if (mm->context.huge_pte_count && is_hugetlb_pte(pte)) |
933 | + __update_mmu_tsb_insert(mm, MM_TSB_HUGE, HPAGE_SHIFT, |
934 | + address, pte_val(pte)); |
935 | + else |
936 | #endif |
937 | - |
938 | - __update_mmu_tsb_insert(mm, tsb_index, tsb_hash_shift, |
939 | - address, pte_val(pte)); |
940 | + __update_mmu_tsb_insert(mm, MM_TSB_BASE, PAGE_SHIFT, |
941 | + address, pte_val(pte)); |
942 | |
943 | spin_unlock_irqrestore(&mm->context.lock, flags); |
944 | } |
945 | @@ -2712,14 +2718,28 @@ static void context_reload(void *__data) |
946 | load_secondary_context(mm); |
947 | } |
948 | |
949 | -void hugetlb_setup(struct mm_struct *mm) |
950 | +void hugetlb_setup(struct pt_regs *regs) |
951 | { |
952 | - struct tsb_config *tp = &mm->context.tsb_block[MM_TSB_HUGE]; |
953 | + struct mm_struct *mm = current->mm; |
954 | + struct tsb_config *tp; |
955 | |
956 | - if (likely(tp->tsb != NULL)) |
957 | - return; |
958 | + if (in_atomic() || !mm) { |
959 | + const struct exception_table_entry *entry; |
960 | + |
961 | + entry = search_exception_tables(regs->tpc); |
962 | + if (entry) { |
963 | + regs->tpc = entry->fixup; |
964 | + regs->tnpc = regs->tpc + 4; |
965 | + return; |
966 | + } |
967 | + pr_alert("Unexpected HugeTLB setup in atomic context.\n"); |
968 | + die_if_kernel("HugeTSB in atomic", regs); |
969 | + } |
970 | + |
971 | + tp = &mm->context.tsb_block[MM_TSB_HUGE]; |
972 | + if (likely(tp->tsb == NULL)) |
973 | + tsb_grow(mm, MM_TSB_HUGE, 0); |
974 | |
975 | - tsb_grow(mm, MM_TSB_HUGE, 0); |
976 | tsb_context_switch(mm); |
977 | smp_tsb_sync(mm); |
978 | |
979 | diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c |
980 | index 3e8fec3..ba6ae7f 100644 |
981 | --- a/arch/sparc/mm/tlb.c |
982 | +++ b/arch/sparc/mm/tlb.c |
983 | @@ -135,8 +135,15 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
984 | mm->context.huge_pte_count++; |
985 | else |
986 | mm->context.huge_pte_count--; |
987 | - if (mm->context.huge_pte_count == 1) |
988 | - hugetlb_setup(mm); |
989 | + |
990 | + /* Do not try to allocate the TSB hash table if we |
991 | + * don't have one already. We have various locks held |
992 | + * and thus we'll end up doing a GFP_KERNEL allocation |
993 | + * in an atomic context. |
994 | + * |
995 | + * Instead, we let the first TLB miss on a hugepage |
996 | + * take care of this. |
997 | + */ |
998 | } |
999 | |
1000 | if (!pmd_none(orig)) { |
1001 | diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c |
1002 | index 7f64743..428982b 100644 |
1003 | --- a/arch/sparc/mm/tsb.c |
1004 | +++ b/arch/sparc/mm/tsb.c |
1005 | @@ -314,7 +314,7 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss) |
1006 | retry_tsb_alloc: |
1007 | gfp_flags = GFP_KERNEL; |
1008 | if (new_size > (PAGE_SIZE * 2)) |
1009 | - gfp_flags = __GFP_NOWARN | __GFP_NORETRY; |
1010 | + gfp_flags |= __GFP_NOWARN | __GFP_NORETRY; |
1011 | |
1012 | new_tsb = kmem_cache_alloc_node(tsb_caches[new_cache_index], |
1013 | gfp_flags, numa_node_id()); |
1014 | diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
1015 | index 225543b..0694d09 100644 |
1016 | --- a/arch/x86/Kconfig |
1017 | +++ b/arch/x86/Kconfig |
1018 | @@ -1253,10 +1253,6 @@ config NODES_SHIFT |
1019 | Specify the maximum number of NUMA Nodes available on the target |
1020 | system. Increases memory reserved to accommodate various tables. |
1021 | |
1022 | -config HAVE_ARCH_ALLOC_REMAP |
1023 | - def_bool y |
1024 | - depends on X86_32 && NUMA |
1025 | - |
1026 | config ARCH_HAVE_MEMORY_PRESENT |
1027 | def_bool y |
1028 | depends on X86_32 && DISCONTIGMEM |
1029 | diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h |
1030 | index eb05fb3..8a9b3e2 100644 |
1031 | --- a/arch/x86/include/asm/mmzone_32.h |
1032 | +++ b/arch/x86/include/asm/mmzone_32.h |
1033 | @@ -14,12 +14,6 @@ extern struct pglist_data *node_data[]; |
1034 | |
1035 | #include <asm/numaq.h> |
1036 | |
1037 | -extern void resume_map_numa_kva(pgd_t *pgd); |
1038 | - |
1039 | -#else /* !CONFIG_NUMA */ |
1040 | - |
1041 | -static inline void resume_map_numa_kva(pgd_t *pgd) {} |
1042 | - |
1043 | #endif /* CONFIG_NUMA */ |
1044 | |
1045 | #ifdef CONFIG_DISCONTIGMEM |
1046 | diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
1047 | index 0a630dd..646d192 100644 |
1048 | --- a/arch/x86/kernel/cpu/mshyperv.c |
1049 | +++ b/arch/x86/kernel/cpu/mshyperv.c |
1050 | @@ -68,7 +68,8 @@ static void __init ms_hyperv_init_platform(void) |
1051 | printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n", |
1052 | ms_hyperv.features, ms_hyperv.hints); |
1053 | |
1054 | - clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); |
1055 | + if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) |
1056 | + clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); |
1057 | } |
1058 | |
1059 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
1060 | diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c |
1061 | index 2d125be..8504f36 100644 |
1062 | --- a/arch/x86/mm/numa.c |
1063 | +++ b/arch/x86/mm/numa.c |
1064 | @@ -193,7 +193,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) |
1065 | static void __init setup_node_data(int nid, u64 start, u64 end) |
1066 | { |
1067 | const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); |
1068 | - bool remapped = false; |
1069 | u64 nd_pa; |
1070 | void *nd; |
1071 | int tnid; |
1072 | @@ -205,37 +204,28 @@ static void __init setup_node_data(int nid, u64 start, u64 end) |
1073 | if (end && (end - start) < NODE_MIN_SIZE) |
1074 | return; |
1075 | |
1076 | - /* initialize remap allocator before aligning to ZONE_ALIGN */ |
1077 | - init_alloc_remap(nid, start, end); |
1078 | - |
1079 | start = roundup(start, ZONE_ALIGN); |
1080 | |
1081 | printk(KERN_INFO "Initmem setup node %d [mem %#010Lx-%#010Lx]\n", |
1082 | nid, start, end - 1); |
1083 | |
1084 | /* |
1085 | - * Allocate node data. Try remap allocator first, node-local |
1086 | - * memory and then any node. Never allocate in DMA zone. |
1087 | + * Allocate node data. Try node-local memory and then any node. |
1088 | + * Never allocate in DMA zone. |
1089 | */ |
1090 | - nd = alloc_remap(nid, nd_size); |
1091 | - if (nd) { |
1092 | - nd_pa = __pa(nd); |
1093 | - remapped = true; |
1094 | - } else { |
1095 | - nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid); |
1096 | - if (!nd_pa) { |
1097 | - pr_err("Cannot find %zu bytes in node %d\n", |
1098 | - nd_size, nid); |
1099 | - return; |
1100 | - } |
1101 | - nd = __va(nd_pa); |
1102 | + nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid); |
1103 | + if (!nd_pa) { |
1104 | + pr_err("Cannot find %zu bytes in node %d\n", |
1105 | + nd_size, nid); |
1106 | + return; |
1107 | } |
1108 | + nd = __va(nd_pa); |
1109 | |
1110 | /* report and initialize */ |
1111 | - printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]%s\n", |
1112 | - nd_pa, nd_pa + nd_size - 1, remapped ? " (remapped)" : ""); |
1113 | + printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]\n", |
1114 | + nd_pa, nd_pa + nd_size - 1); |
1115 | tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); |
1116 | - if (!remapped && tnid != nid) |
1117 | + if (tnid != nid) |
1118 | printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nid, tnid); |
1119 | |
1120 | node_data[nid] = nd; |
1121 | diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c |
1122 | index 534255a..73a6d73 100644 |
1123 | --- a/arch/x86/mm/numa_32.c |
1124 | +++ b/arch/x86/mm/numa_32.c |
1125 | @@ -73,167 +73,6 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn, |
1126 | |
1127 | extern unsigned long highend_pfn, highstart_pfn; |
1128 | |
1129 | -#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE) |
1130 | - |
1131 | -static void *node_remap_start_vaddr[MAX_NUMNODES]; |
1132 | -void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags); |
1133 | - |
1134 | -/* |
1135 | - * Remap memory allocator |
1136 | - */ |
1137 | -static unsigned long node_remap_start_pfn[MAX_NUMNODES]; |
1138 | -static void *node_remap_end_vaddr[MAX_NUMNODES]; |
1139 | -static void *node_remap_alloc_vaddr[MAX_NUMNODES]; |
1140 | - |
1141 | -/** |
1142 | - * alloc_remap - Allocate remapped memory |
1143 | - * @nid: NUMA node to allocate memory from |
1144 | - * @size: The size of allocation |
1145 | - * |
1146 | - * Allocate @size bytes from the remap area of NUMA node @nid. The |
1147 | - * size of the remap area is predetermined by init_alloc_remap() and |
1148 | - * only the callers considered there should call this function. For |
1149 | - * more info, please read the comment on top of init_alloc_remap(). |
1150 | - * |
1151 | - * The caller must be ready to handle allocation failure from this |
1152 | - * function and fall back to regular memory allocator in such cases. |
1153 | - * |
1154 | - * CONTEXT: |
1155 | - * Single CPU early boot context. |
1156 | - * |
1157 | - * RETURNS: |
1158 | - * Pointer to the allocated memory on success, %NULL on failure. |
1159 | - */ |
1160 | -void *alloc_remap(int nid, unsigned long size) |
1161 | -{ |
1162 | - void *allocation = node_remap_alloc_vaddr[nid]; |
1163 | - |
1164 | - size = ALIGN(size, L1_CACHE_BYTES); |
1165 | - |
1166 | - if (!allocation || (allocation + size) > node_remap_end_vaddr[nid]) |
1167 | - return NULL; |
1168 | - |
1169 | - node_remap_alloc_vaddr[nid] += size; |
1170 | - memset(allocation, 0, size); |
1171 | - |
1172 | - return allocation; |
1173 | -} |
1174 | - |
1175 | -#ifdef CONFIG_HIBERNATION |
1176 | -/** |
1177 | - * resume_map_numa_kva - add KVA mapping to the temporary page tables created |
1178 | - * during resume from hibernation |
1179 | - * @pgd_base - temporary resume page directory |
1180 | - */ |
1181 | -void resume_map_numa_kva(pgd_t *pgd_base) |
1182 | -{ |
1183 | - int node; |
1184 | - |
1185 | - for_each_online_node(node) { |
1186 | - unsigned long start_va, start_pfn, nr_pages, pfn; |
1187 | - |
1188 | - start_va = (unsigned long)node_remap_start_vaddr[node]; |
1189 | - start_pfn = node_remap_start_pfn[node]; |
1190 | - nr_pages = (node_remap_end_vaddr[node] - |
1191 | - node_remap_start_vaddr[node]) >> PAGE_SHIFT; |
1192 | - |
1193 | - printk(KERN_DEBUG "%s: node %d\n", __func__, node); |
1194 | - |
1195 | - for (pfn = 0; pfn < nr_pages; pfn += PTRS_PER_PTE) { |
1196 | - unsigned long vaddr = start_va + (pfn << PAGE_SHIFT); |
1197 | - pgd_t *pgd = pgd_base + pgd_index(vaddr); |
1198 | - pud_t *pud = pud_offset(pgd, vaddr); |
1199 | - pmd_t *pmd = pmd_offset(pud, vaddr); |
1200 | - |
1201 | - set_pmd(pmd, pfn_pmd(start_pfn + pfn, |
1202 | - PAGE_KERNEL_LARGE_EXEC)); |
1203 | - |
1204 | - printk(KERN_DEBUG "%s: %08lx -> pfn %08lx\n", |
1205 | - __func__, vaddr, start_pfn + pfn); |
1206 | - } |
1207 | - } |
1208 | -} |
1209 | -#endif |
1210 | - |
1211 | -/** |
1212 | - * init_alloc_remap - Initialize remap allocator for a NUMA node |
1213 | - * @nid: NUMA node to initizlie remap allocator for |
1214 | - * |
1215 | - * NUMA nodes may end up without any lowmem. As allocating pgdat and |
1216 | - * memmap on a different node with lowmem is inefficient, a special |
1217 | - * remap allocator is implemented which can be used by alloc_remap(). |
1218 | - * |
1219 | - * For each node, the amount of memory which will be necessary for |
1220 | - * pgdat and memmap is calculated and two memory areas of the size are |
1221 | - * allocated - one in the node and the other in lowmem; then, the area |
1222 | - * in the node is remapped to the lowmem area. |
1223 | - * |
1224 | - * As pgdat and memmap must be allocated in lowmem anyway, this |
1225 | - * doesn't waste lowmem address space; however, the actual lowmem |
1226 | - * which gets remapped over is wasted. The amount shouldn't be |
1227 | - * problematic on machines this feature will be used. |
1228 | - * |
1229 | - * Initialization failure isn't fatal. alloc_remap() is used |
1230 | - * opportunistically and the callers will fall back to other memory |
1231 | - * allocation mechanisms on failure. |
1232 | - */ |
1233 | -void __init init_alloc_remap(int nid, u64 start, u64 end) |
1234 | -{ |
1235 | - unsigned long start_pfn = start >> PAGE_SHIFT; |
1236 | - unsigned long end_pfn = end >> PAGE_SHIFT; |
1237 | - unsigned long size, pfn; |
1238 | - u64 node_pa, remap_pa; |
1239 | - void *remap_va; |
1240 | - |
1241 | - /* |
1242 | - * The acpi/srat node info can show hot-add memroy zones where |
1243 | - * memory could be added but not currently present. |
1244 | - */ |
1245 | - printk(KERN_DEBUG "node %d pfn: [%lx - %lx]\n", |
1246 | - nid, start_pfn, end_pfn); |
1247 | - |
1248 | - /* calculate the necessary space aligned to large page size */ |
1249 | - size = node_memmap_size_bytes(nid, start_pfn, end_pfn); |
1250 | - size += ALIGN(sizeof(pg_data_t), PAGE_SIZE); |
1251 | - size = ALIGN(size, LARGE_PAGE_BYTES); |
1252 | - |
1253 | - /* allocate node memory and the lowmem remap area */ |
1254 | - node_pa = memblock_find_in_range(start, end, size, LARGE_PAGE_BYTES); |
1255 | - if (!node_pa) { |
1256 | - pr_warning("remap_alloc: failed to allocate %lu bytes for node %d\n", |
1257 | - size, nid); |
1258 | - return; |
1259 | - } |
1260 | - memblock_reserve(node_pa, size); |
1261 | - |
1262 | - remap_pa = memblock_find_in_range(min_low_pfn << PAGE_SHIFT, |
1263 | - max_low_pfn << PAGE_SHIFT, |
1264 | - size, LARGE_PAGE_BYTES); |
1265 | - if (!remap_pa) { |
1266 | - pr_warning("remap_alloc: failed to allocate %lu bytes remap area for node %d\n", |
1267 | - size, nid); |
1268 | - memblock_free(node_pa, size); |
1269 | - return; |
1270 | - } |
1271 | - memblock_reserve(remap_pa, size); |
1272 | - remap_va = phys_to_virt(remap_pa); |
1273 | - |
1274 | - /* perform actual remap */ |
1275 | - for (pfn = 0; pfn < size >> PAGE_SHIFT; pfn += PTRS_PER_PTE) |
1276 | - set_pmd_pfn((unsigned long)remap_va + (pfn << PAGE_SHIFT), |
1277 | - (node_pa >> PAGE_SHIFT) + pfn, |
1278 | - PAGE_KERNEL_LARGE); |
1279 | - |
1280 | - /* initialize remap allocator parameters */ |
1281 | - node_remap_start_pfn[nid] = node_pa >> PAGE_SHIFT; |
1282 | - node_remap_start_vaddr[nid] = remap_va; |
1283 | - node_remap_end_vaddr[nid] = remap_va + size; |
1284 | - node_remap_alloc_vaddr[nid] = remap_va; |
1285 | - |
1286 | - printk(KERN_DEBUG "remap_alloc: node %d [%08llx-%08llx) -> [%p-%p)\n", |
1287 | - nid, node_pa, node_pa + size, remap_va, remap_va + size); |
1288 | -} |
1289 | - |
1290 | void __init initmem_init(void) |
1291 | { |
1292 | x86_numa_init(); |
1293 | diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h |
1294 | index 7178c3a..ad86ec9 100644 |
1295 | --- a/arch/x86/mm/numa_internal.h |
1296 | +++ b/arch/x86/mm/numa_internal.h |
1297 | @@ -21,12 +21,6 @@ void __init numa_reset_distance(void); |
1298 | |
1299 | void __init x86_numa_init(void); |
1300 | |
1301 | -#ifdef CONFIG_X86_64 |
1302 | -static inline void init_alloc_remap(int nid, u64 start, u64 end) { } |
1303 | -#else |
1304 | -void __init init_alloc_remap(int nid, u64 start, u64 end); |
1305 | -#endif |
1306 | - |
1307 | #ifdef CONFIG_NUMA_EMU |
1308 | void __init numa_emulation(struct numa_meminfo *numa_meminfo, |
1309 | int numa_dist_cnt); |
1310 | diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c |
1311 | index 74202c1..7d28c88 100644 |
1312 | --- a/arch/x86/power/hibernate_32.c |
1313 | +++ b/arch/x86/power/hibernate_32.c |
1314 | @@ -129,8 +129,6 @@ static int resume_physical_mapping_init(pgd_t *pgd_base) |
1315 | } |
1316 | } |
1317 | |
1318 | - resume_map_numa_kva(pgd_base); |
1319 | - |
1320 | return 0; |
1321 | } |
1322 | |
1323 | diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c |
1324 | index 83e866d..f7a080e 100644 |
1325 | --- a/arch/x86/xen/spinlock.c |
1326 | +++ b/arch/x86/xen/spinlock.c |
1327 | @@ -328,7 +328,6 @@ static noinline void xen_spin_unlock_slow(struct xen_spinlock *xl) |
1328 | if (per_cpu(lock_spinners, cpu) == xl) { |
1329 | ADD_STATS(released_slow_kicked, 1); |
1330 | xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR); |
1331 | - break; |
1332 | } |
1333 | } |
1334 | } |
1335 | diff --git a/drivers/base/bus.c b/drivers/base/bus.c |
1336 | index 24eb078..6856303 100644 |
1337 | --- a/drivers/base/bus.c |
1338 | +++ b/drivers/base/bus.c |
1339 | @@ -290,7 +290,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start, |
1340 | struct device *dev; |
1341 | int error = 0; |
1342 | |
1343 | - if (!bus) |
1344 | + if (!bus || !bus->p) |
1345 | return -EINVAL; |
1346 | |
1347 | klist_iter_init_node(&bus->p->klist_devices, &i, |
1348 | @@ -324,7 +324,7 @@ struct device *bus_find_device(struct bus_type *bus, |
1349 | struct klist_iter i; |
1350 | struct device *dev; |
1351 | |
1352 | - if (!bus) |
1353 | + if (!bus || !bus->p) |
1354 | return NULL; |
1355 | |
1356 | klist_iter_init_node(&bus->p->klist_devices, &i, |
1357 | diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
1358 | index e3bbed8..61d3e1b 100644 |
1359 | --- a/drivers/base/dd.c |
1360 | +++ b/drivers/base/dd.c |
1361 | @@ -172,6 +172,8 @@ static int deferred_probe_initcall(void) |
1362 | |
1363 | driver_deferred_probe_enable = true; |
1364 | driver_deferred_probe_trigger(); |
1365 | + /* Sort as many dependencies as possible before exiting initcalls */ |
1366 | + flush_workqueue(deferred_wq); |
1367 | return 0; |
1368 | } |
1369 | late_initcall(deferred_probe_initcall); |
1370 | diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c |
1371 | index bc6f5fa..819dfda 100644 |
1372 | --- a/drivers/dca/dca-core.c |
1373 | +++ b/drivers/dca/dca-core.c |
1374 | @@ -420,6 +420,11 @@ void unregister_dca_provider(struct dca_provider *dca, struct device *dev) |
1375 | |
1376 | raw_spin_lock_irqsave(&dca_lock, flags); |
1377 | |
1378 | + if (list_empty(&dca_domains)) { |
1379 | + raw_spin_unlock_irqrestore(&dca_lock, flags); |
1380 | + return; |
1381 | + } |
1382 | + |
1383 | list_del(&dca->node); |
1384 | |
1385 | pci_rc = dca_pci_rc_from_dev(dev); |
1386 | diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c |
1387 | index 3315e4b..b70709b 100644 |
1388 | --- a/drivers/dma/sh/shdma.c |
1389 | +++ b/drivers/dma/sh/shdma.c |
1390 | @@ -326,7 +326,7 @@ static int sh_dmae_set_slave(struct shdma_chan *schan, |
1391 | shdma_chan); |
1392 | const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, slave_id); |
1393 | if (!cfg) |
1394 | - return -ENODEV; |
1395 | + return -ENXIO; |
1396 | |
1397 | if (!try) |
1398 | sh_chan->config = cfg; |
1399 | diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c |
1400 | index bdc8302..deca78f 100644 |
1401 | --- a/drivers/gpio/gpio-em.c |
1402 | +++ b/drivers/gpio/gpio-em.c |
1403 | @@ -299,8 +299,9 @@ static int em_gio_probe(struct platform_device *pdev) |
1404 | irq_chip->irq_set_type = em_gio_irq_set_type; |
1405 | irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; |
1406 | |
1407 | - p->irq_domain = irq_domain_add_linear(pdev->dev.of_node, |
1408 | + p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, |
1409 | pdata->number_of_pins, |
1410 | + pdata->irq_base, |
1411 | &em_gio_irq_domain_ops, p); |
1412 | if (!p->irq_domain) { |
1413 | ret = -ENXIO; |
1414 | diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c |
1415 | index f2d667b..bcb2c0a 100644 |
1416 | --- a/drivers/gpu/drm/drm_crtc.c |
1417 | +++ b/drivers/gpu/drm/drm_crtc.c |
1418 | @@ -2089,7 +2089,7 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) |
1419 | |
1420 | switch (bpp) { |
1421 | case 8: |
1422 | - fmt = DRM_FORMAT_RGB332; |
1423 | + fmt = DRM_FORMAT_C8; |
1424 | break; |
1425 | case 16: |
1426 | if (depth == 15) |
1427 | @@ -3702,6 +3702,7 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, |
1428 | int *bpp) |
1429 | { |
1430 | switch (format) { |
1431 | + case DRM_FORMAT_C8: |
1432 | case DRM_FORMAT_RGB332: |
1433 | case DRM_FORMAT_BGR233: |
1434 | *depth = 8; |
1435 | diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
1436 | index 5a3770f..aaded22 100644 |
1437 | --- a/drivers/gpu/drm/drm_edid.c |
1438 | +++ b/drivers/gpu/drm/drm_edid.c |
1439 | @@ -87,9 +87,6 @@ static struct edid_quirk { |
1440 | int product_id; |
1441 | u32 quirks; |
1442 | } edid_quirk_list[] = { |
1443 | - /* ASUS VW222S */ |
1444 | - { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING }, |
1445 | - |
1446 | /* Acer AL1706 */ |
1447 | { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 }, |
1448 | /* Acer F51 */ |
1449 | @@ -357,10 +354,14 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) |
1450 | break; |
1451 | } |
1452 | } |
1453 | - if (i == 4) |
1454 | + |
1455 | + if (i == 4 && print_bad_edid) { |
1456 | dev_warn(connector->dev->dev, |
1457 | "%s: Ignoring invalid EDID block %d.\n", |
1458 | drm_get_connector_name(connector), j); |
1459 | + |
1460 | + connector->bad_edid_counter++; |
1461 | + } |
1462 | } |
1463 | |
1464 | if (valid_extensions != block[0x7e]) { |
1465 | @@ -2020,7 +2021,8 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) |
1466 | num_modes += add_cvt_modes(connector, edid); |
1467 | num_modes += add_standard_modes(connector, edid); |
1468 | num_modes += add_established_modes(connector, edid); |
1469 | - num_modes += add_inferred_modes(connector, edid); |
1470 | + if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF) |
1471 | + num_modes += add_inferred_modes(connector, edid); |
1472 | num_modes += add_cea_modes(connector, edid); |
1473 | |
1474 | if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) |
1475 | diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c |
1476 | index 3cec306..34a156f 100644 |
1477 | --- a/drivers/gpu/drm/drm_usb.c |
1478 | +++ b/drivers/gpu/drm/drm_usb.c |
1479 | @@ -18,7 +18,7 @@ int drm_get_usb_dev(struct usb_interface *interface, |
1480 | |
1481 | usbdev = interface_to_usbdev(interface); |
1482 | dev->usbdev = usbdev; |
1483 | - dev->dev = &usbdev->dev; |
1484 | + dev->dev = &interface->dev; |
1485 | |
1486 | mutex_lock(&drm_global_mutex); |
1487 | |
1488 | diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c |
1489 | index 9d4a2c2..8a7c48b 100644 |
1490 | --- a/drivers/gpu/drm/i915/i915_debugfs.c |
1491 | +++ b/drivers/gpu/drm/i915/i915_debugfs.c |
1492 | @@ -691,7 +691,7 @@ static int i915_error_state(struct seq_file *m, void *unused) |
1493 | |
1494 | seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, |
1495 | error->time.tv_usec); |
1496 | - seq_printf(m, "Kernel: " UTS_RELEASE); |
1497 | + seq_printf(m, "Kernel: " UTS_RELEASE "\n"); |
1498 | seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device); |
1499 | seq_printf(m, "EIR: 0x%08x\n", error->eir); |
1500 | seq_printf(m, "IER: 0x%08x\n", error->ier); |
1501 | @@ -888,7 +888,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) |
1502 | u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS); |
1503 | u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS); |
1504 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
1505 | - u32 rpstat; |
1506 | + u32 rpstat, cagf; |
1507 | u32 rpupei, rpcurup, rpprevup; |
1508 | u32 rpdownei, rpcurdown, rpprevdown; |
1509 | int max_freq; |
1510 | @@ -907,6 +907,11 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) |
1511 | rpdownei = I915_READ(GEN6_RP_CUR_DOWN_EI); |
1512 | rpcurdown = I915_READ(GEN6_RP_CUR_DOWN); |
1513 | rpprevdown = I915_READ(GEN6_RP_PREV_DOWN); |
1514 | + if (IS_HASWELL(dev)) |
1515 | + cagf = (rpstat & HSW_CAGF_MASK) >> HSW_CAGF_SHIFT; |
1516 | + else |
1517 | + cagf = (rpstat & GEN6_CAGF_MASK) >> GEN6_CAGF_SHIFT; |
1518 | + cagf *= GT_FREQUENCY_MULTIPLIER; |
1519 | |
1520 | gen6_gt_force_wake_put(dev_priv); |
1521 | mutex_unlock(&dev->struct_mutex); |
1522 | @@ -919,8 +924,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) |
1523 | gt_perf_status & 0xff); |
1524 | seq_printf(m, "Render p-state limit: %d\n", |
1525 | rp_state_limits & 0xff); |
1526 | - seq_printf(m, "CAGF: %dMHz\n", ((rpstat & GEN6_CAGF_MASK) >> |
1527 | - GEN6_CAGF_SHIFT) * GT_FREQUENCY_MULTIPLIER); |
1528 | + seq_printf(m, "CAGF: %dMHz\n", cagf); |
1529 | seq_printf(m, "RP CUR UP EI: %dus\n", rpupei & |
1530 | GEN6_CURICONT_MASK); |
1531 | seq_printf(m, "RP CUR UP: %dus\n", rpcurup & |
1532 | diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h |
1533 | index 12ab3bd..7339a4b 100644 |
1534 | --- a/drivers/gpu/drm/i915/i915_drv.h |
1535 | +++ b/drivers/gpu/drm/i915/i915_drv.h |
1536 | @@ -919,7 +919,7 @@ typedef struct drm_i915_private { |
1537 | bool hw_contexts_disabled; |
1538 | uint32_t hw_context_size; |
1539 | |
1540 | - bool fdi_rx_polarity_reversed; |
1541 | + u32 fdi_rx_config; |
1542 | |
1543 | struct i915_suspend_saved_registers regfile; |
1544 | |
1545 | diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
1546 | index 8febea6..de45b60 100644 |
1547 | --- a/drivers/gpu/drm/i915/i915_gem.c |
1548 | +++ b/drivers/gpu/drm/i915/i915_gem.c |
1549 | @@ -1918,9 +1918,6 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj) |
1550 | BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS); |
1551 | BUG_ON(!obj->active); |
1552 | |
1553 | - if (obj->pin_count) /* are we a framebuffer? */ |
1554 | - intel_mark_fb_idle(obj); |
1555 | - |
1556 | list_move_tail(&obj->mm_list, &dev_priv->mm.inactive_list); |
1557 | |
1558 | list_del_init(&obj->ring_list); |
1559 | @@ -3848,7 +3845,7 @@ void i915_gem_l3_remap(struct drm_device *dev) |
1560 | u32 misccpctl; |
1561 | int i; |
1562 | |
1563 | - if (!IS_IVYBRIDGE(dev)) |
1564 | + if (!HAS_L3_GPU_CACHE(dev)) |
1565 | return; |
1566 | |
1567 | if (!dev_priv->l3_parity.remap_info) |
1568 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
1569 | index 59afb7e..2bfd05a 100644 |
1570 | --- a/drivers/gpu/drm/i915/i915_reg.h |
1571 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
1572 | @@ -3927,7 +3927,7 @@ |
1573 | #define FDI_10BPC (1<<16) |
1574 | #define FDI_6BPC (2<<16) |
1575 | #define FDI_12BPC (3<<16) |
1576 | -#define FDI_LINK_REVERSE_OVERWRITE (1<<15) |
1577 | +#define FDI_RX_LINK_REVERSAL_OVERRIDE (1<<15) |
1578 | #define FDI_DMI_LINK_REVERSE_MASK (1<<14) |
1579 | #define FDI_RX_PLL_ENABLE (1<<13) |
1580 | #define FDI_FS_ERR_CORRECT_ENABLE (1<<11) |
1581 | @@ -4211,7 +4211,9 @@ |
1582 | #define GEN6_RP_INTERRUPT_LIMITS 0xA014 |
1583 | #define GEN6_RPSTAT1 0xA01C |
1584 | #define GEN6_CAGF_SHIFT 8 |
1585 | +#define HSW_CAGF_SHIFT 7 |
1586 | #define GEN6_CAGF_MASK (0x7f << GEN6_CAGF_SHIFT) |
1587 | +#define HSW_CAGF_MASK (0x7f << HSW_CAGF_SHIFT) |
1588 | #define GEN6_RP_CONTROL 0xA024 |
1589 | #define GEN6_RP_MEDIA_TURBO (1<<11) |
1590 | #define GEN6_RP_MEDIA_MODE_MASK (3<<9) |
1591 | @@ -4280,8 +4282,8 @@ |
1592 | #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9 |
1593 | #define GEN6_PCODE_WRITE_RC6VIDS 0x4 |
1594 | #define GEN6_PCODE_READ_RC6VIDS 0x5 |
1595 | -#define GEN6_ENCODE_RC6_VID(mv) (((mv) / 5) - 245) < 0 ?: 0 |
1596 | -#define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) > 0 ? ((vids) * 5) + 245 : 0) |
1597 | +#define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5) |
1598 | +#define GEN6_DECODE_RC6_VID(vids) (((vids) * 5) + 245) |
1599 | #define GEN6_PCODE_DATA 0x138128 |
1600 | #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 |
1601 | |
1602 | @@ -4524,6 +4526,7 @@ |
1603 | #define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */ |
1604 | #define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */ |
1605 | #define DDI_BUF_EMP_MASK (0xf<<24) |
1606 | +#define DDI_BUF_PORT_REVERSAL (1<<16) |
1607 | #define DDI_BUF_IS_IDLE (1<<7) |
1608 | #define DDI_A_4_LANES (1<<4) |
1609 | #define DDI_PORT_WIDTH_X1 (0<<1) |
1610 | diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c |
1611 | index 9293878..06b1786 100644 |
1612 | --- a/drivers/gpu/drm/i915/intel_crt.c |
1613 | +++ b/drivers/gpu/drm/i915/intel_crt.c |
1614 | @@ -800,10 +800,14 @@ void intel_crt_init(struct drm_device *dev) |
1615 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; |
1616 | |
1617 | /* |
1618 | - * TODO: find a proper way to discover whether we need to set the |
1619 | - * polarity reversal bit or not, instead of relying on the BIOS. |
1620 | + * TODO: find a proper way to discover whether we need to set the the |
1621 | + * polarity and link reversal bits or not, instead of relying on the |
1622 | + * BIOS. |
1623 | */ |
1624 | - if (HAS_PCH_LPT(dev)) |
1625 | - dev_priv->fdi_rx_polarity_reversed = |
1626 | - !!(I915_READ(_FDI_RXA_CTL) & FDI_RX_POLARITY_REVERSED_LPT); |
1627 | + if (HAS_PCH_LPT(dev)) { |
1628 | + u32 fdi_config = FDI_RX_POLARITY_REVERSED_LPT | |
1629 | + FDI_RX_LINK_REVERSAL_OVERRIDE; |
1630 | + |
1631 | + dev_priv->fdi_rx_config = I915_READ(_FDI_RXA_CTL) & fdi_config; |
1632 | + } |
1633 | } |
1634 | diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
1635 | index 4bad0f7..59b778d 100644 |
1636 | --- a/drivers/gpu/drm/i915/intel_ddi.c |
1637 | +++ b/drivers/gpu/drm/i915/intel_ddi.c |
1638 | @@ -178,10 +178,8 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) |
1639 | FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90); |
1640 | |
1641 | /* Enable the PCH Receiver FDI PLL */ |
1642 | - rx_ctl_val = FDI_RX_PLL_ENABLE | FDI_RX_ENHANCE_FRAME_ENABLE | |
1643 | - ((intel_crtc->fdi_lanes - 1) << 19); |
1644 | - if (dev_priv->fdi_rx_polarity_reversed) |
1645 | - rx_ctl_val |= FDI_RX_POLARITY_REVERSED_LPT; |
1646 | + rx_ctl_val = dev_priv->fdi_rx_config | FDI_RX_ENHANCE_FRAME_ENABLE | |
1647 | + FDI_RX_PLL_ENABLE | ((intel_crtc->fdi_lanes - 1) << 19); |
1648 | I915_WRITE(_FDI_RXA_CTL, rx_ctl_val); |
1649 | POSTING_READ(_FDI_RXA_CTL); |
1650 | udelay(220); |
1651 | @@ -203,7 +201,10 @@ void hsw_fdi_link_train(struct drm_crtc *crtc) |
1652 | DP_TP_CTL_LINK_TRAIN_PAT1 | |
1653 | DP_TP_CTL_ENABLE); |
1654 | |
1655 | - /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */ |
1656 | + /* Configure and enable DDI_BUF_CTL for DDI E with next voltage. |
1657 | + * DDI E does not support port reversal, the functionality is |
1658 | + * achieved on the PCH side in FDI_RX_CTL, so no need to set the |
1659 | + * port reversal bit */ |
1660 | I915_WRITE(DDI_BUF_CTL(PORT_E), |
1661 | DDI_BUF_CTL_ENABLE | |
1662 | ((intel_crtc->fdi_lanes - 1) << 1) | |
1663 | @@ -677,8 +678,11 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder, |
1664 | |
1665 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { |
1666 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1667 | + struct intel_digital_port *intel_dig_port = |
1668 | + enc_to_dig_port(encoder); |
1669 | |
1670 | - intel_dp->DP = DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW; |
1671 | + intel_dp->DP = intel_dig_port->port_reversal | |
1672 | + DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW; |
1673 | switch (intel_dp->lane_count) { |
1674 | case 1: |
1675 | intel_dp->DP |= DDI_PORT_WIDTH_X1; |
1676 | @@ -1291,11 +1295,15 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder) |
1677 | int type = intel_encoder->type; |
1678 | |
1679 | if (type == INTEL_OUTPUT_HDMI) { |
1680 | + struct intel_digital_port *intel_dig_port = |
1681 | + enc_to_dig_port(encoder); |
1682 | + |
1683 | /* In HDMI/DVI mode, the port width, and swing/emphasis values |
1684 | * are ignored so nothing special needs to be done besides |
1685 | * enabling the port. |
1686 | */ |
1687 | - I915_WRITE(DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE); |
1688 | + I915_WRITE(DDI_BUF_CTL(port), |
1689 | + intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE); |
1690 | } else if (type == INTEL_OUTPUT_EDP) { |
1691 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1692 | |
1693 | @@ -1457,6 +1465,7 @@ static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = { |
1694 | |
1695 | void intel_ddi_init(struct drm_device *dev, enum port port) |
1696 | { |
1697 | + struct drm_i915_private *dev_priv = dev->dev_private; |
1698 | struct intel_digital_port *intel_dig_port; |
1699 | struct intel_encoder *intel_encoder; |
1700 | struct drm_encoder *encoder; |
1701 | @@ -1497,6 +1506,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port) |
1702 | intel_encoder->get_hw_state = intel_ddi_get_hw_state; |
1703 | |
1704 | intel_dig_port->port = port; |
1705 | + intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) & |
1706 | + DDI_BUF_PORT_REVERSAL; |
1707 | if (hdmi_connector) |
1708 | intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port); |
1709 | else |
1710 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1711 | index da1ad9c..80aa1fc 100644 |
1712 | --- a/drivers/gpu/drm/i915/intel_display.c |
1713 | +++ b/drivers/gpu/drm/i915/intel_display.c |
1714 | @@ -154,8 +154,8 @@ static const intel_limit_t intel_limits_i9xx_sdvo = { |
1715 | .vco = { .min = 1400000, .max = 2800000 }, |
1716 | .n = { .min = 1, .max = 6 }, |
1717 | .m = { .min = 70, .max = 120 }, |
1718 | - .m1 = { .min = 10, .max = 22 }, |
1719 | - .m2 = { .min = 5, .max = 9 }, |
1720 | + .m1 = { .min = 8, .max = 18 }, |
1721 | + .m2 = { .min = 3, .max = 7 }, |
1722 | .p = { .min = 5, .max = 80 }, |
1723 | .p1 = { .min = 1, .max = 8 }, |
1724 | .p2 = { .dot_limit = 200000, |
1725 | @@ -2017,18 +2017,29 @@ void intel_unpin_fb_obj(struct drm_i915_gem_object *obj) |
1726 | |
1727 | /* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel |
1728 | * is assumed to be a power-of-two. */ |
1729 | -unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y, |
1730 | - unsigned int bpp, |
1731 | - unsigned int pitch) |
1732 | +unsigned long intel_gen4_compute_page_offset(int *x, int *y, |
1733 | + unsigned int tiling_mode, |
1734 | + unsigned int cpp, |
1735 | + unsigned int pitch) |
1736 | { |
1737 | - int tile_rows, tiles; |
1738 | + if (tiling_mode != I915_TILING_NONE) { |
1739 | + unsigned int tile_rows, tiles; |
1740 | + |
1741 | + tile_rows = *y / 8; |
1742 | + *y %= 8; |
1743 | |
1744 | - tile_rows = *y / 8; |
1745 | - *y %= 8; |
1746 | - tiles = *x / (512/bpp); |
1747 | - *x %= 512/bpp; |
1748 | + tiles = *x / (512/cpp); |
1749 | + *x %= 512/cpp; |
1750 | + |
1751 | + return tile_rows * pitch * 8 + tiles * 4096; |
1752 | + } else { |
1753 | + unsigned int offset; |
1754 | |
1755 | - return tile_rows * pitch * 8 + tiles * 4096; |
1756 | + offset = *y * pitch + *x * cpp; |
1757 | + *y = 0; |
1758 | + *x = (offset & 4095) / cpp; |
1759 | + return offset & -4096; |
1760 | + } |
1761 | } |
1762 | |
1763 | static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
1764 | @@ -2105,9 +2116,9 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
1765 | |
1766 | if (INTEL_INFO(dev)->gen >= 4) { |
1767 | intel_crtc->dspaddr_offset = |
1768 | - intel_gen4_compute_offset_xtiled(&x, &y, |
1769 | - fb->bits_per_pixel / 8, |
1770 | - fb->pitches[0]); |
1771 | + intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode, |
1772 | + fb->bits_per_pixel / 8, |
1773 | + fb->pitches[0]); |
1774 | linear_offset -= intel_crtc->dspaddr_offset; |
1775 | } else { |
1776 | intel_crtc->dspaddr_offset = linear_offset; |
1777 | @@ -2198,9 +2209,9 @@ static int ironlake_update_plane(struct drm_crtc *crtc, |
1778 | |
1779 | linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); |
1780 | intel_crtc->dspaddr_offset = |
1781 | - intel_gen4_compute_offset_xtiled(&x, &y, |
1782 | - fb->bits_per_pixel / 8, |
1783 | - fb->pitches[0]); |
1784 | + intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode, |
1785 | + fb->bits_per_pixel / 8, |
1786 | + fb->pitches[0]); |
1787 | linear_offset -= intel_crtc->dspaddr_offset; |
1788 | |
1789 | DRM_DEBUG_KMS("Writing base %08X %08lX %d %d %d\n", |
1790 | @@ -3686,6 +3697,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) |
1791 | struct intel_encoder *encoder; |
1792 | int pipe = intel_crtc->pipe; |
1793 | int plane = intel_crtc->plane; |
1794 | + u32 pctl; |
1795 | |
1796 | |
1797 | if (!intel_crtc->active) |
1798 | @@ -3705,6 +3717,13 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) |
1799 | |
1800 | intel_disable_plane(dev_priv, plane, pipe); |
1801 | intel_disable_pipe(dev_priv, pipe); |
1802 | + |
1803 | + /* Disable pannel fitter if it is on this pipe. */ |
1804 | + pctl = I915_READ(PFIT_CONTROL); |
1805 | + if ((pctl & PFIT_ENABLE) && |
1806 | + ((pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT) == pipe) |
1807 | + I915_WRITE(PFIT_CONTROL, 0); |
1808 | + |
1809 | intel_disable_pll(dev_priv, pipe); |
1810 | |
1811 | intel_crtc->active = false; |
1812 | @@ -6993,11 +7012,6 @@ void intel_mark_busy(struct drm_device *dev) |
1813 | |
1814 | void intel_mark_idle(struct drm_device *dev) |
1815 | { |
1816 | -} |
1817 | - |
1818 | -void intel_mark_fb_busy(struct drm_i915_gem_object *obj) |
1819 | -{ |
1820 | - struct drm_device *dev = obj->base.dev; |
1821 | struct drm_crtc *crtc; |
1822 | |
1823 | if (!i915_powersave) |
1824 | @@ -7007,12 +7021,11 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj) |
1825 | if (!crtc->fb) |
1826 | continue; |
1827 | |
1828 | - if (to_intel_framebuffer(crtc->fb)->obj == obj) |
1829 | - intel_increase_pllclock(crtc); |
1830 | + intel_decrease_pllclock(crtc); |
1831 | } |
1832 | } |
1833 | |
1834 | -void intel_mark_fb_idle(struct drm_i915_gem_object *obj) |
1835 | +void intel_mark_fb_busy(struct drm_i915_gem_object *obj) |
1836 | { |
1837 | struct drm_device *dev = obj->base.dev; |
1838 | struct drm_crtc *crtc; |
1839 | @@ -7025,7 +7038,7 @@ void intel_mark_fb_idle(struct drm_i915_gem_object *obj) |
1840 | continue; |
1841 | |
1842 | if (to_intel_framebuffer(crtc->fb)->obj == obj) |
1843 | - intel_decrease_pllclock(crtc); |
1844 | + intel_increase_pllclock(crtc); |
1845 | } |
1846 | } |
1847 | |
1848 | @@ -8888,6 +8901,9 @@ static struct intel_quirk intel_quirks[] = { |
1849 | |
1850 | /* Acer Aspire 5734Z must invert backlight brightness */ |
1851 | { 0x2a42, 0x1025, 0x0459, quirk_invert_brightness }, |
1852 | + |
1853 | + /* Acer Aspire 4736Z */ |
1854 | + { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness }, |
1855 | }; |
1856 | |
1857 | static void intel_init_quirks(struct drm_device *dev) |
1858 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
1859 | index 8a1bd4a..1c1840f 100644 |
1860 | --- a/drivers/gpu/drm/i915/intel_drv.h |
1861 | +++ b/drivers/gpu/drm/i915/intel_drv.h |
1862 | @@ -377,6 +377,7 @@ struct intel_dp { |
1863 | struct intel_digital_port { |
1864 | struct intel_encoder base; |
1865 | enum port port; |
1866 | + u32 port_reversal; |
1867 | struct intel_dp dp; |
1868 | struct intel_hdmi hdmi; |
1869 | }; |
1870 | @@ -439,9 +440,8 @@ extern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, |
1871 | extern void intel_dvo_init(struct drm_device *dev); |
1872 | extern void intel_tv_init(struct drm_device *dev); |
1873 | extern void intel_mark_busy(struct drm_device *dev); |
1874 | -extern void intel_mark_idle(struct drm_device *dev); |
1875 | extern void intel_mark_fb_busy(struct drm_i915_gem_object *obj); |
1876 | -extern void intel_mark_fb_idle(struct drm_i915_gem_object *obj); |
1877 | +extern void intel_mark_idle(struct drm_device *dev); |
1878 | extern bool intel_lvds_init(struct drm_device *dev); |
1879 | extern void intel_dp_init(struct drm_device *dev, int output_reg, |
1880 | enum port port); |
1881 | @@ -627,9 +627,10 @@ extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe, |
1882 | extern void intel_update_linetime_watermarks(struct drm_device *dev, int pipe, |
1883 | struct drm_display_mode *mode); |
1884 | |
1885 | -extern unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y, |
1886 | - unsigned int bpp, |
1887 | - unsigned int pitch); |
1888 | +extern unsigned long intel_gen4_compute_page_offset(int *x, int *y, |
1889 | + unsigned int tiling_mode, |
1890 | + unsigned int bpp, |
1891 | + unsigned int pitch); |
1892 | |
1893 | extern int intel_sprite_set_colorkey(struct drm_device *dev, void *data, |
1894 | struct drm_file *file_priv); |
1895 | diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c |
1896 | index bee8cb6..a3730e0 100644 |
1897 | --- a/drivers/gpu/drm/i915/intel_panel.c |
1898 | +++ b/drivers/gpu/drm/i915/intel_panel.c |
1899 | @@ -321,6 +321,9 @@ void intel_panel_enable_backlight(struct drm_device *dev, |
1900 | if (dev_priv->backlight_level == 0) |
1901 | dev_priv->backlight_level = intel_panel_get_max_backlight(dev); |
1902 | |
1903 | + dev_priv->backlight_enabled = true; |
1904 | + intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); |
1905 | + |
1906 | if (INTEL_INFO(dev)->gen >= 4) { |
1907 | uint32_t reg, tmp; |
1908 | |
1909 | @@ -356,12 +359,12 @@ void intel_panel_enable_backlight(struct drm_device *dev, |
1910 | } |
1911 | |
1912 | set_level: |
1913 | - /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. |
1914 | - * BLC_PWM_CPU_CTL may be cleared to zero automatically when these |
1915 | - * registers are set. |
1916 | + /* Check the current backlight level and try to set again if it's zero. |
1917 | + * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically |
1918 | + * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written. |
1919 | */ |
1920 | - dev_priv->backlight_enabled = true; |
1921 | - intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); |
1922 | + if (!intel_panel_get_backlight(dev)) |
1923 | + intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); |
1924 | } |
1925 | |
1926 | static void intel_panel_init_backlight(struct drm_device *dev) |
1927 | diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c |
1928 | index d7b060e..9a8d667 100644 |
1929 | --- a/drivers/gpu/drm/i915/intel_sprite.c |
1930 | +++ b/drivers/gpu/drm/i915/intel_sprite.c |
1931 | @@ -122,8 +122,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, |
1932 | |
1933 | linear_offset = y * fb->pitches[0] + x * pixel_size; |
1934 | sprsurf_offset = |
1935 | - intel_gen4_compute_offset_xtiled(&x, &y, |
1936 | - pixel_size, fb->pitches[0]); |
1937 | + intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode, |
1938 | + pixel_size, fb->pitches[0]); |
1939 | linear_offset -= sprsurf_offset; |
1940 | |
1941 | /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET |
1942 | @@ -287,8 +287,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, |
1943 | |
1944 | linear_offset = y * fb->pitches[0] + x * pixel_size; |
1945 | dvssurf_offset = |
1946 | - intel_gen4_compute_offset_xtiled(&x, &y, |
1947 | - pixel_size, fb->pitches[0]); |
1948 | + intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode, |
1949 | + pixel_size, fb->pitches[0]); |
1950 | linear_offset -= dvssurf_offset; |
1951 | |
1952 | if (obj->tiling_mode != I915_TILING_NONE) |
1953 | diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h |
1954 | index b79025d..123270e9 100644 |
1955 | --- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h |
1956 | +++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h |
1957 | @@ -16,6 +16,8 @@ enum dcb_output_type { |
1958 | |
1959 | struct dcb_output { |
1960 | int index; /* may not be raw dcb index if merging has happened */ |
1961 | + u16 hasht; |
1962 | + u16 hashm; |
1963 | enum dcb_output_type type; |
1964 | uint8_t i2c_index; |
1965 | uint8_t heads; |
1966 | @@ -25,6 +27,7 @@ struct dcb_output { |
1967 | uint8_t or; |
1968 | uint8_t link; |
1969 | bool duallink_possible; |
1970 | + uint8_t extdev; |
1971 | union { |
1972 | struct sor_conf { |
1973 | int link; |
1974 | diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c |
1975 | index 0fd87df..2d9b9d7 100644 |
1976 | --- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c |
1977 | +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c |
1978 | @@ -107,6 +107,18 @@ dcb_outp(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len) |
1979 | return 0x0000; |
1980 | } |
1981 | |
1982 | +static inline u16 |
1983 | +dcb_outp_hasht(struct dcb_output *outp) |
1984 | +{ |
1985 | + return (outp->extdev << 8) | (outp->location << 4) | outp->type; |
1986 | +} |
1987 | + |
1988 | +static inline u16 |
1989 | +dcb_outp_hashm(struct dcb_output *outp) |
1990 | +{ |
1991 | + return (outp->heads << 8) | (outp->link << 6) | outp->or; |
1992 | +} |
1993 | + |
1994 | u16 |
1995 | dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len, |
1996 | struct dcb_output *outp) |
1997 | @@ -135,34 +147,28 @@ dcb_outp_parse(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *len, |
1998 | case DCB_OUTPUT_DP: |
1999 | outp->link = (conf & 0x00000030) >> 4; |
2000 | outp->sorconf.link = outp->link; /*XXX*/ |
2001 | + outp->extdev = 0x00; |
2002 | + if (outp->location != 0) |
2003 | + outp->extdev = (conf & 0x0000ff00) >> 8; |
2004 | break; |
2005 | default: |
2006 | break; |
2007 | } |
2008 | } |
2009 | + |
2010 | + outp->hasht = dcb_outp_hasht(outp); |
2011 | + outp->hashm = dcb_outp_hashm(outp); |
2012 | } |
2013 | return dcb; |
2014 | } |
2015 | |
2016 | -static inline u16 |
2017 | -dcb_outp_hasht(struct dcb_output *outp) |
2018 | -{ |
2019 | - return outp->type; |
2020 | -} |
2021 | - |
2022 | -static inline u16 |
2023 | -dcb_outp_hashm(struct dcb_output *outp) |
2024 | -{ |
2025 | - return (outp->heads << 8) | (outp->link << 6) | outp->or; |
2026 | -} |
2027 | - |
2028 | u16 |
2029 | dcb_outp_match(struct nouveau_bios *bios, u16 type, u16 mask, |
2030 | u8 *ver, u8 *len, struct dcb_output *outp) |
2031 | { |
2032 | u16 dcb, idx = 0; |
2033 | while ((dcb = dcb_outp_parse(bios, idx++, ver, len, outp))) { |
2034 | - if (dcb_outp_hasht(outp) == type) { |
2035 | + if ((dcb_outp_hasht(outp) & 0x00ff) == (type & 0x00ff)) { |
2036 | if ((dcb_outp_hashm(outp) & mask) == mask) |
2037 | break; |
2038 | } |
2039 | diff --git a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c |
2040 | index ae7249b..4a85778 100644 |
2041 | --- a/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c |
2042 | +++ b/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c |
2043 | @@ -78,12 +78,13 @@ nv50_devinit_init(struct nouveau_object *object) |
2044 | if (ret) |
2045 | return ret; |
2046 | |
2047 | - /* if we ran the init tables, execute first script pointer for each |
2048 | - * display table output entry that has a matching dcb entry. |
2049 | + /* if we ran the init tables, we have to execute the first script |
2050 | + * pointer of each dcb entry's display encoder table in order |
2051 | + * to properly initialise each encoder. |
2052 | */ |
2053 | - while (priv->base.post && ver) { |
2054 | - u16 data = nvbios_outp_parse(bios, i++, &ver, &hdr, &cnt, &len, &info); |
2055 | - if (data && dcb_outp_match(bios, info.type, info.mask, &ver, &len, &outp)) { |
2056 | + while (priv->base.post && dcb_outp_parse(bios, i, &ver, &hdr, &outp)) { |
2057 | + if (nvbios_outp_match(bios, outp.hasht, outp.hashm, |
2058 | + &ver, &hdr, &cnt, &len, &info)) { |
2059 | struct nvbios_init init = { |
2060 | .subdev = nv_subdev(priv), |
2061 | .bios = bios, |
2062 | @@ -95,7 +96,8 @@ nv50_devinit_init(struct nouveau_object *object) |
2063 | |
2064 | nvbios_exec(&init); |
2065 | } |
2066 | - }; |
2067 | + i++; |
2068 | + } |
2069 | |
2070 | return 0; |
2071 | } |
2072 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c |
2073 | index 9175615..21a892c 100644 |
2074 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c |
2075 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c |
2076 | @@ -252,8 +252,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) |
2077 | radeon_crtc->enabled = true; |
2078 | /* adjust pm to dpms changes BEFORE enabling crtcs */ |
2079 | radeon_pm_compute_clocks(rdev); |
2080 | - if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) |
2081 | - atombios_powergate_crtc(crtc, ATOM_DISABLE); |
2082 | atombios_enable_crtc(crtc, ATOM_ENABLE); |
2083 | if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev)) |
2084 | atombios_enable_crtc_memreq(crtc, ATOM_ENABLE); |
2085 | @@ -271,8 +269,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) |
2086 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); |
2087 | atombios_enable_crtc(crtc, ATOM_DISABLE); |
2088 | radeon_crtc->enabled = false; |
2089 | - if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) |
2090 | - atombios_powergate_crtc(crtc, ATOM_ENABLE); |
2091 | /* adjust pm to dpms changes AFTER disabling crtcs */ |
2092 | radeon_pm_compute_clocks(rdev); |
2093 | break; |
2094 | @@ -1844,6 +1840,8 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) |
2095 | int i; |
2096 | |
2097 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
2098 | + if (ASIC_IS_DCE6(rdev)) |
2099 | + atombios_powergate_crtc(crtc, ATOM_ENABLE); |
2100 | |
2101 | for (i = 0; i < rdev->num_crtc; i++) { |
2102 | if (rdev->mode_info.crtcs[i] && |
2103 | diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c |
2104 | index a2d478e..1b0a4ec 100644 |
2105 | --- a/drivers/gpu/drm/radeon/evergreen.c |
2106 | +++ b/drivers/gpu/drm/radeon/evergreen.c |
2107 | @@ -403,6 +403,19 @@ void evergreen_pm_misc(struct radeon_device *rdev) |
2108 | rdev->pm.current_vddc = voltage->voltage; |
2109 | DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage); |
2110 | } |
2111 | + |
2112 | + /* starting with BTC, there is one state that is used for both |
2113 | + * MH and SH. Difference is that we always use the high clock index for |
2114 | + * mclk and vddci. |
2115 | + */ |
2116 | + if ((rdev->pm.pm_method == PM_METHOD_PROFILE) && |
2117 | + (rdev->family >= CHIP_BARTS) && |
2118 | + rdev->pm.active_crtc_count && |
2119 | + ((rdev->pm.profile_index == PM_PROFILE_MID_MH_IDX) || |
2120 | + (rdev->pm.profile_index == PM_PROFILE_LOW_MH_IDX))) |
2121 | + voltage = &rdev->pm.power_state[req_ps_idx]. |
2122 | + clock_info[rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_cm_idx].voltage; |
2123 | + |
2124 | /* 0xff01 is a flag rather then an actual voltage */ |
2125 | if (voltage->vddci == 0xff01) |
2126 | return; |
2127 | diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c |
2128 | index ff80efe..95970ec 100644 |
2129 | --- a/drivers/gpu/drm/radeon/r600_hdmi.c |
2130 | +++ b/drivers/gpu/drm/radeon/r600_hdmi.c |
2131 | @@ -544,7 +544,6 @@ void r600_hdmi_disable(struct drm_encoder *encoder) |
2132 | |
2133 | /* Called for ATOM_ENCODER_MODE_HDMI only */ |
2134 | if (!dig || !dig->afmt) { |
2135 | - WARN_ON(1); |
2136 | return; |
2137 | } |
2138 | if (!dig->afmt->enabled) |
2139 | diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
2140 | index 15f5ded..d96070b 100644 |
2141 | --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
2142 | +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c |
2143 | @@ -43,6 +43,12 @@ struct atpx_verify_interface { |
2144 | u32 function_bits; /* supported functions bit vector */ |
2145 | } __packed; |
2146 | |
2147 | +struct atpx_px_params { |
2148 | + u16 size; /* structure size in bytes (includes size field) */ |
2149 | + u32 valid_flags; /* which flags are valid */ |
2150 | + u32 flags; /* flags */ |
2151 | +} __packed; |
2152 | + |
2153 | struct atpx_power_control { |
2154 | u16 size; |
2155 | u8 dgpu_state; |
2156 | @@ -123,9 +129,61 @@ static void radeon_atpx_parse_functions(struct radeon_atpx_functions *f, u32 mas |
2157 | } |
2158 | |
2159 | /** |
2160 | + * radeon_atpx_validate_functions - validate ATPX functions |
2161 | + * |
2162 | + * @atpx: radeon atpx struct |
2163 | + * |
2164 | + * Validate that required functions are enabled (all asics). |
2165 | + * returns 0 on success, error on failure. |
2166 | + */ |
2167 | +static int radeon_atpx_validate(struct radeon_atpx *atpx) |
2168 | +{ |
2169 | + /* make sure required functions are enabled */ |
2170 | + /* dGPU power control is required */ |
2171 | + atpx->functions.power_cntl = true; |
2172 | + |
2173 | + if (atpx->functions.px_params) { |
2174 | + union acpi_object *info; |
2175 | + struct atpx_px_params output; |
2176 | + size_t size; |
2177 | + u32 valid_bits; |
2178 | + |
2179 | + info = radeon_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); |
2180 | + if (!info) |
2181 | + return -EIO; |
2182 | + |
2183 | + memset(&output, 0, sizeof(output)); |
2184 | + |
2185 | + size = *(u16 *) info->buffer.pointer; |
2186 | + if (size < 10) { |
2187 | + printk("ATPX buffer is too small: %zu\n", size); |
2188 | + kfree(info); |
2189 | + return -EINVAL; |
2190 | + } |
2191 | + size = min(sizeof(output), size); |
2192 | + |
2193 | + memcpy(&output, info->buffer.pointer, size); |
2194 | + |
2195 | + valid_bits = output.flags & output.valid_flags; |
2196 | + /* if separate mux flag is set, mux controls are required */ |
2197 | + if (valid_bits & ATPX_SEPARATE_MUX_FOR_I2C) { |
2198 | + atpx->functions.i2c_mux_cntl = true; |
2199 | + atpx->functions.disp_mux_cntl = true; |
2200 | + } |
2201 | + /* if any outputs are muxed, mux controls are required */ |
2202 | + if (valid_bits & (ATPX_CRT1_RGB_SIGNAL_MUXED | |
2203 | + ATPX_TV_SIGNAL_MUXED | |
2204 | + ATPX_DFP_SIGNAL_MUXED)) |
2205 | + atpx->functions.disp_mux_cntl = true; |
2206 | + |
2207 | + kfree(info); |
2208 | + } |
2209 | + return 0; |
2210 | +} |
2211 | + |
2212 | +/** |
2213 | * radeon_atpx_verify_interface - verify ATPX |
2214 | * |
2215 | - * @handle: acpi handle |
2216 | * @atpx: radeon atpx struct |
2217 | * |
2218 | * Execute the ATPX_FUNCTION_VERIFY_INTERFACE ATPX function |
2219 | @@ -406,8 +464,19 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) |
2220 | */ |
2221 | static int radeon_atpx_init(void) |
2222 | { |
2223 | + int r; |
2224 | + |
2225 | /* set up the ATPX handle */ |
2226 | - return radeon_atpx_verify_interface(&radeon_atpx_priv.atpx); |
2227 | + r = radeon_atpx_verify_interface(&radeon_atpx_priv.atpx); |
2228 | + if (r) |
2229 | + return r; |
2230 | + |
2231 | + /* validate the atpx setup */ |
2232 | + r = radeon_atpx_validate(&radeon_atpx_priv.atpx); |
2233 | + if (r) |
2234 | + return r; |
2235 | + |
2236 | + return 0; |
2237 | } |
2238 | |
2239 | /** |
2240 | diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c |
2241 | index 0bfa656..338fd6a 100644 |
2242 | --- a/drivers/gpu/drm/radeon/radeon_pm.c |
2243 | +++ b/drivers/gpu/drm/radeon/radeon_pm.c |
2244 | @@ -169,7 +169,7 @@ static void radeon_set_power_state(struct radeon_device *rdev) |
2245 | |
2246 | /* starting with BTC, there is one state that is used for both |
2247 | * MH and SH. Difference is that we always use the high clock index for |
2248 | - * mclk. |
2249 | + * mclk and vddci. |
2250 | */ |
2251 | if ((rdev->pm.pm_method == PM_METHOD_PROFILE) && |
2252 | (rdev->family >= CHIP_BARTS) && |
2253 | diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h |
2254 | index 87aa5f5..cc6d90f 100644 |
2255 | --- a/drivers/gpu/drm/udl/udl_drv.h |
2256 | +++ b/drivers/gpu/drm/udl/udl_drv.h |
2257 | @@ -75,6 +75,8 @@ struct udl_framebuffer { |
2258 | struct drm_framebuffer base; |
2259 | struct udl_gem_object *obj; |
2260 | bool active_16; /* active on the 16-bit channel */ |
2261 | + int x1, y1, x2, y2; /* dirty rect */ |
2262 | + spinlock_t dirty_lock; |
2263 | }; |
2264 | |
2265 | #define to_udl_fb(x) container_of(x, struct udl_framebuffer, base) |
2266 | diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c |
2267 | index d4ab3be..1eb060c 100644 |
2268 | --- a/drivers/gpu/drm/udl/udl_fb.c |
2269 | +++ b/drivers/gpu/drm/udl/udl_fb.c |
2270 | @@ -22,9 +22,9 @@ |
2271 | |
2272 | #include <drm/drm_fb_helper.h> |
2273 | |
2274 | -#define DL_DEFIO_WRITE_DELAY 5 /* fb_deferred_io.delay in jiffies */ |
2275 | +#define DL_DEFIO_WRITE_DELAY (HZ/20) /* fb_deferred_io.delay in jiffies */ |
2276 | |
2277 | -static int fb_defio = 1; /* Optionally enable experimental fb_defio mmap support */ |
2278 | +static int fb_defio = 0; /* Optionally enable experimental fb_defio mmap support */ |
2279 | static int fb_bpp = 16; |
2280 | |
2281 | module_param(fb_bpp, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); |
2282 | @@ -153,6 +153,9 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, |
2283 | struct urb *urb; |
2284 | int aligned_x; |
2285 | int bpp = (fb->base.bits_per_pixel / 8); |
2286 | + int x2, y2; |
2287 | + bool store_for_later = false; |
2288 | + unsigned long flags; |
2289 | |
2290 | if (!fb->active_16) |
2291 | return 0; |
2292 | @@ -169,8 +172,6 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, |
2293 | } |
2294 | } |
2295 | |
2296 | - start_cycles = get_cycles(); |
2297 | - |
2298 | aligned_x = DL_ALIGN_DOWN(x, sizeof(unsigned long)); |
2299 | width = DL_ALIGN_UP(width + (x-aligned_x), sizeof(unsigned long)); |
2300 | x = aligned_x; |
2301 | @@ -180,19 +181,53 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, |
2302 | (y + height > fb->base.height)) |
2303 | return -EINVAL; |
2304 | |
2305 | + /* if we are in atomic just store the info |
2306 | + can't test inside spin lock */ |
2307 | + if (in_atomic()) |
2308 | + store_for_later = true; |
2309 | + |
2310 | + x2 = x + width - 1; |
2311 | + y2 = y + height - 1; |
2312 | + |
2313 | + spin_lock_irqsave(&fb->dirty_lock, flags); |
2314 | + |
2315 | + if (fb->y1 < y) |
2316 | + y = fb->y1; |
2317 | + if (fb->y2 > y2) |
2318 | + y2 = fb->y2; |
2319 | + if (fb->x1 < x) |
2320 | + x = fb->x1; |
2321 | + if (fb->x2 > x2) |
2322 | + x2 = fb->x2; |
2323 | + |
2324 | + if (store_for_later) { |
2325 | + fb->x1 = x; |
2326 | + fb->x2 = x2; |
2327 | + fb->y1 = y; |
2328 | + fb->y2 = y2; |
2329 | + spin_unlock_irqrestore(&fb->dirty_lock, flags); |
2330 | + return 0; |
2331 | + } |
2332 | + |
2333 | + fb->x1 = fb->y1 = INT_MAX; |
2334 | + fb->x2 = fb->y2 = 0; |
2335 | + |
2336 | + spin_unlock_irqrestore(&fb->dirty_lock, flags); |
2337 | + start_cycles = get_cycles(); |
2338 | + |
2339 | urb = udl_get_urb(dev); |
2340 | if (!urb) |
2341 | return 0; |
2342 | cmd = urb->transfer_buffer; |
2343 | |
2344 | - for (i = y; i < y + height ; i++) { |
2345 | + for (i = y; i <= y2 ; i++) { |
2346 | const int line_offset = fb->base.pitches[0] * i; |
2347 | const int byte_offset = line_offset + (x * bpp); |
2348 | const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp); |
2349 | if (udl_render_hline(dev, bpp, &urb, |
2350 | (char *) fb->obj->vmapping, |
2351 | &cmd, byte_offset, dev_byte_offset, |
2352 | - width * bpp, |
2353 | + (x2 - x + 1) * bpp, |
2354 | &bytes_identical, &bytes_sent)) |
2355 | goto error; |
2356 | } |
2357 | @@ -434,6 +469,7 @@ udl_framebuffer_init(struct drm_device *dev, |
2358 | { |
2359 | int ret; |
2360 | |
2361 | + spin_lock_init(&ufb->dirty_lock); |
2362 | ufb->obj = obj; |
2363 | ret = drm_framebuffer_init(dev, &ufb->base, &udlfb_funcs); |
2364 | drm_helper_mode_fill_fb_struct(&ufb->base, mode_cmd); |
2365 | diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c |
2366 | index fa60add..cf787e1 100644 |
2367 | --- a/drivers/gpu/vga/vga_switcheroo.c |
2368 | +++ b/drivers/gpu/vga/vga_switcheroo.c |
2369 | @@ -25,6 +25,7 @@ |
2370 | #include <linux/fb.h> |
2371 | |
2372 | #include <linux/pci.h> |
2373 | +#include <linux/console.h> |
2374 | #include <linux/vga_switcheroo.h> |
2375 | |
2376 | #include <linux/vgaarb.h> |
2377 | @@ -337,8 +338,10 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) |
2378 | |
2379 | if (new_client->fb_info) { |
2380 | struct fb_event event; |
2381 | + console_lock(); |
2382 | event.info = new_client->fb_info; |
2383 | fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event); |
2384 | + console_unlock(); |
2385 | } |
2386 | |
2387 | ret = vgasr_priv.handler->switchto(new_client->id); |
2388 | diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c |
2389 | index 38ae877..0472191 100644 |
2390 | --- a/drivers/hid/hid-wiimote-ext.c |
2391 | +++ b/drivers/hid/hid-wiimote-ext.c |
2392 | @@ -403,14 +403,14 @@ static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload) |
2393 | |
2394 | if (ext->motionp) { |
2395 | input_report_key(ext->input, |
2396 | - wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x04)); |
2397 | + wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x04)); |
2398 | input_report_key(ext->input, |
2399 | - wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x08)); |
2400 | + wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x08)); |
2401 | } else { |
2402 | input_report_key(ext->input, |
2403 | - wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x01)); |
2404 | + wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x01)); |
2405 | input_report_key(ext->input, |
2406 | - wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x02)); |
2407 | + wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x02)); |
2408 | } |
2409 | |
2410 | input_sync(ext->input); |
2411 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
2412 | index eca2801..f1e7b86 100644 |
2413 | --- a/drivers/iommu/intel-iommu.c |
2414 | +++ b/drivers/iommu/intel-iommu.c |
2415 | @@ -4253,13 +4253,19 @@ static void quirk_iommu_rwbf(struct pci_dev *dev) |
2416 | { |
2417 | /* |
2418 | * Mobile 4 Series Chipset neglects to set RWBF capability, |
2419 | - * but needs it: |
2420 | + * but needs it. Same seems to hold for the desktop versions. |
2421 | */ |
2422 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); |
2423 | rwbf_quirk = 1; |
2424 | } |
2425 | |
2426 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); |
2427 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_rwbf); |
2428 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e10, quirk_iommu_rwbf); |
2429 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e20, quirk_iommu_rwbf); |
2430 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e30, quirk_iommu_rwbf); |
2431 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e40, quirk_iommu_rwbf); |
2432 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e90, quirk_iommu_rwbf); |
2433 | |
2434 | #define GGC 0x52 |
2435 | #define GGC_MEMORY_SIZE_MASK (0xf << 8) |
2436 | diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c |
2437 | index e6e3911..089e8ea 100644 |
2438 | --- a/drivers/mmc/core/mmc.c |
2439 | +++ b/drivers/mmc/core/mmc.c |
2440 | @@ -496,7 +496,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) |
2441 | * RPMB regions are defined in multiples of 128K. |
2442 | */ |
2443 | card->ext_csd.raw_rpmb_size_mult = ext_csd[EXT_CSD_RPMB_MULT]; |
2444 | - if (ext_csd[EXT_CSD_RPMB_MULT]) { |
2445 | + if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) { |
2446 | mmc_part_add(card, ext_csd[EXT_CSD_RPMB_MULT] << 17, |
2447 | EXT_CSD_PART_CONFIG_ACC_RPMB, |
2448 | "rpmb", 0, false, |
2449 | diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c |
2450 | index e07df81..b503113 100644 |
2451 | --- a/drivers/mmc/host/sdhci-esdhc-imx.c |
2452 | +++ b/drivers/mmc/host/sdhci-esdhc-imx.c |
2453 | @@ -237,15 +237,18 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg) |
2454 | |
2455 | static u16 esdhc_readw_le(struct sdhci_host *host, int reg) |
2456 | { |
2457 | + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
2458 | + struct pltfm_imx_data *imx_data = pltfm_host->priv; |
2459 | + |
2460 | if (unlikely(reg == SDHCI_HOST_VERSION)) { |
2461 | - u16 val = readw(host->ioaddr + (reg ^ 2)); |
2462 | - /* |
2463 | - * uSDHC supports SDHCI v3.0, but it's encoded as value |
2464 | - * 0x3 in host controller version register, which violates |
2465 | - * SDHCI_SPEC_300 definition. Work it around here. |
2466 | - */ |
2467 | - if ((val & SDHCI_SPEC_VER_MASK) == 3) |
2468 | - return --val; |
2469 | + reg ^= 2; |
2470 | + if (is_imx6q_usdhc(imx_data)) { |
2471 | + /* |
2472 | + * The usdhc register returns a wrong host version. |
2473 | + * Correct it here. |
2474 | + */ |
2475 | + return SDHCI_SPEC_300; |
2476 | + } |
2477 | } |
2478 | |
2479 | return readw(host->ioaddr + reg); |
2480 | diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
2481 | index 75a3f46..88291bb 100644 |
2482 | --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
2483 | +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
2484 | @@ -1434,7 +1434,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) |
2485 | } |
2486 | |
2487 | #ifdef CONFIG_RFS_ACCEL |
2488 | - priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->rx_ring_num); |
2489 | + priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool); |
2490 | if (!priv->dev->rx_cpu_rmap) |
2491 | goto err; |
2492 | |
2493 | @@ -1597,7 +1597,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, |
2494 | err = -ENOMEM; |
2495 | goto out; |
2496 | } |
2497 | - priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_RX_RINGS, |
2498 | + priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_TX_RINGS, |
2499 | GFP_KERNEL); |
2500 | if (!priv->tx_cq) { |
2501 | err = -ENOMEM; |
2502 | diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c |
2503 | index 0b2706a..508570e 100644 |
2504 | --- a/drivers/net/ppp/ppp_generic.c |
2505 | +++ b/drivers/net/ppp/ppp_generic.c |
2506 | @@ -1058,7 +1058,15 @@ ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64) |
2507 | return stats64; |
2508 | } |
2509 | |
2510 | +static struct lock_class_key ppp_tx_busylock; |
2511 | +static int ppp_dev_init(struct net_device *dev) |
2512 | +{ |
2513 | + dev->qdisc_tx_busylock = &ppp_tx_busylock; |
2514 | + return 0; |
2515 | +} |
2516 | + |
2517 | static const struct net_device_ops ppp_netdev_ops = { |
2518 | + .ndo_init = ppp_dev_init, |
2519 | .ndo_start_xmit = ppp_start_xmit, |
2520 | .ndo_do_ioctl = ppp_net_ioctl, |
2521 | .ndo_get_stats64 = ppp_get_stats64, |
2522 | diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c |
2523 | index 00d3b2d..6d25439 100644 |
2524 | --- a/drivers/net/usb/cdc_ncm.c |
2525 | +++ b/drivers/net/usb/cdc_ncm.c |
2526 | @@ -576,9 +576,14 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) |
2527 | if ((intf->num_altsetting == 2) && |
2528 | !usb_set_interface(dev->udev, |
2529 | intf->cur_altsetting->desc.bInterfaceNumber, |
2530 | - CDC_NCM_COMM_ALTSETTING_MBIM) && |
2531 | - cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
2532 | - return -ENODEV; |
2533 | + CDC_NCM_COMM_ALTSETTING_MBIM)) { |
2534 | + if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
2535 | + return -ENODEV; |
2536 | + else |
2537 | + usb_set_interface(dev->udev, |
2538 | + intf->cur_altsetting->desc.bInterfaceNumber, |
2539 | + CDC_NCM_COMM_ALTSETTING_NCM); |
2540 | + } |
2541 | #endif |
2542 | |
2543 | /* NCM data altsetting is always 1 */ |
2544 | diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h |
2545 | index 315b96e..9fdd198 100644 |
2546 | --- a/drivers/net/wireless/b43/dma.h |
2547 | +++ b/drivers/net/wireless/b43/dma.h |
2548 | @@ -169,7 +169,7 @@ struct b43_dmadesc_generic { |
2549 | |
2550 | /* DMA engine tuning knobs */ |
2551 | #define B43_TXRING_SLOTS 256 |
2552 | -#define B43_RXRING_SLOTS 64 |
2553 | +#define B43_RXRING_SLOTS 256 |
2554 | #define B43_DMA0_RX_FW598_BUFSIZE (B43_DMA0_RX_FW598_FO + IEEE80211_MAX_FRAME_LEN) |
2555 | #define B43_DMA0_RX_FW351_BUFSIZE (B43_DMA0_RX_FW351_FO + IEEE80211_MAX_FRAME_LEN) |
2556 | |
2557 | diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c |
2558 | index 800a165..1f78585 100644 |
2559 | --- a/drivers/net/wireless/p54/p54usb.c |
2560 | +++ b/drivers/net/wireless/p54/p54usb.c |
2561 | @@ -84,8 +84,8 @@ static struct usb_device_id p54u_table[] = { |
2562 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ |
2563 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ |
2564 | {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ |
2565 | - {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */ |
2566 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ |
2567 | + {USB_DEVICE(0x083a, 0x4531)}, /* T-Com Sinus 154 data II */ |
2568 | {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ |
2569 | {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ |
2570 | {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ |
2571 | diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2572 | index b7e6607..b450931 100644 |
2573 | --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2574 | +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |
2575 | @@ -285,6 +285,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { |
2576 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)}, |
2577 | /* RTL8188CUS-VL */ |
2578 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x818a, rtl92cu_hal_cfg)}, |
2579 | + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x819a, rtl92cu_hal_cfg)}, |
2580 | /* 8188 Combo for BC4 */ |
2581 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)}, |
2582 | |
2583 | @@ -363,9 +364,15 @@ static struct usb_device_id rtl8192c_usb_ids[] = { |
2584 | |
2585 | MODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids); |
2586 | |
2587 | +static int rtl8192cu_probe(struct usb_interface *intf, |
2588 | + const struct usb_device_id *id) |
2589 | +{ |
2590 | + return rtl_usb_probe(intf, id, &rtl92cu_hal_cfg); |
2591 | +} |
2592 | + |
2593 | static struct usb_driver rtl8192cu_driver = { |
2594 | .name = "rtl8192cu", |
2595 | - .probe = rtl_usb_probe, |
2596 | + .probe = rtl8192cu_probe, |
2597 | .disconnect = rtl_usb_disconnect, |
2598 | .id_table = rtl8192c_usb_ids, |
2599 | |
2600 | diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c |
2601 | index 1535efd..2106fcf 100644 |
2602 | --- a/drivers/net/wireless/rtlwifi/usb.c |
2603 | +++ b/drivers/net/wireless/rtlwifi/usb.c |
2604 | @@ -42,8 +42,12 @@ |
2605 | |
2606 | static void usbctrl_async_callback(struct urb *urb) |
2607 | { |
2608 | - if (urb) |
2609 | - kfree(urb->context); |
2610 | + if (urb) { |
2611 | + /* free dr */ |
2612 | + kfree(urb->setup_packet); |
2613 | + /* free databuf */ |
2614 | + kfree(urb->transfer_buffer); |
2615 | + } |
2616 | } |
2617 | |
2618 | static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request, |
2619 | @@ -55,39 +59,47 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request, |
2620 | u8 reqtype; |
2621 | struct usb_ctrlrequest *dr; |
2622 | struct urb *urb; |
2623 | - struct rtl819x_async_write_data { |
2624 | - u8 data[REALTEK_USB_VENQT_MAX_BUF_SIZE]; |
2625 | - struct usb_ctrlrequest dr; |
2626 | - } *buf; |
2627 | + const u16 databuf_maxlen = REALTEK_USB_VENQT_MAX_BUF_SIZE; |
2628 | + u8 *databuf; |
2629 | + |
2630 | + if (WARN_ON_ONCE(len > databuf_maxlen)) |
2631 | + len = databuf_maxlen; |
2632 | |
2633 | pipe = usb_sndctrlpipe(udev, 0); /* write_out */ |
2634 | reqtype = REALTEK_USB_VENQT_WRITE; |
2635 | |
2636 | - buf = kmalloc(sizeof(*buf), GFP_ATOMIC); |
2637 | - if (!buf) |
2638 | + dr = kmalloc(sizeof(*dr), GFP_ATOMIC); |
2639 | + if (!dr) |
2640 | return -ENOMEM; |
2641 | |
2642 | + databuf = kmalloc(databuf_maxlen, GFP_ATOMIC); |
2643 | + if (!databuf) { |
2644 | + kfree(dr); |
2645 | + return -ENOMEM; |
2646 | + } |
2647 | + |
2648 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
2649 | if (!urb) { |
2650 | - kfree(buf); |
2651 | + kfree(databuf); |
2652 | + kfree(dr); |
2653 | return -ENOMEM; |
2654 | } |
2655 | |
2656 | - dr = &buf->dr; |
2657 | - |
2658 | dr->bRequestType = reqtype; |
2659 | dr->bRequest = request; |
2660 | dr->wValue = cpu_to_le16(value); |
2661 | dr->wIndex = cpu_to_le16(index); |
2662 | dr->wLength = cpu_to_le16(len); |
2663 | /* data are already in little-endian order */ |
2664 | - memcpy(buf, pdata, len); |
2665 | + memcpy(databuf, pdata, len); |
2666 | usb_fill_control_urb(urb, udev, pipe, |
2667 | - (unsigned char *)dr, buf, len, |
2668 | - usbctrl_async_callback, buf); |
2669 | + (unsigned char *)dr, databuf, len, |
2670 | + usbctrl_async_callback, NULL); |
2671 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
2672 | - if (rc < 0) |
2673 | - kfree(buf); |
2674 | + if (rc < 0) { |
2675 | + kfree(databuf); |
2676 | + kfree(dr); |
2677 | + } |
2678 | usb_free_urb(urb); |
2679 | return rc; |
2680 | } |
2681 | @@ -941,7 +953,8 @@ static struct rtl_intf_ops rtl_usb_ops = { |
2682 | }; |
2683 | |
2684 | int rtl_usb_probe(struct usb_interface *intf, |
2685 | - const struct usb_device_id *id) |
2686 | + const struct usb_device_id *id, |
2687 | + struct rtl_hal_cfg *rtl_hal_cfg) |
2688 | { |
2689 | int err; |
2690 | struct ieee80211_hw *hw = NULL; |
2691 | @@ -976,7 +989,7 @@ int rtl_usb_probe(struct usb_interface *intf, |
2692 | usb_set_intfdata(intf, hw); |
2693 | /* init cfg & intf_ops */ |
2694 | rtlpriv->rtlhal.interface = INTF_USB; |
2695 | - rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_info); |
2696 | + rtlpriv->cfg = rtl_hal_cfg; |
2697 | rtlpriv->intf_ops = &rtl_usb_ops; |
2698 | rtl_dbgp_flag_init(hw); |
2699 | /* Init IO handler */ |
2700 | diff --git a/drivers/net/wireless/rtlwifi/usb.h b/drivers/net/wireless/rtlwifi/usb.h |
2701 | index 5235136..fb986f9 100644 |
2702 | --- a/drivers/net/wireless/rtlwifi/usb.h |
2703 | +++ b/drivers/net/wireless/rtlwifi/usb.h |
2704 | @@ -157,7 +157,8 @@ struct rtl_usb_priv { |
2705 | |
2706 | |
2707 | int rtl_usb_probe(struct usb_interface *intf, |
2708 | - const struct usb_device_id *id); |
2709 | + const struct usb_device_id *id, |
2710 | + struct rtl_hal_cfg *rtl92cu_hal_cfg); |
2711 | void rtl_usb_disconnect(struct usb_interface *intf); |
2712 | int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message); |
2713 | int rtl_usb_resume(struct usb_interface *pusb_intf); |
2714 | diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c |
2715 | index b8c5193..221f426 100644 |
2716 | --- a/drivers/net/xen-netback/interface.c |
2717 | +++ b/drivers/net/xen-netback/interface.c |
2718 | @@ -132,6 +132,7 @@ static void xenvif_up(struct xenvif *vif) |
2719 | static void xenvif_down(struct xenvif *vif) |
2720 | { |
2721 | disable_irq(vif->irq); |
2722 | + del_timer_sync(&vif->credit_timeout); |
2723 | xen_netbk_deschedule_xenvif(vif); |
2724 | xen_netbk_remove_xenvif(vif); |
2725 | } |
2726 | @@ -363,8 +364,6 @@ void xenvif_disconnect(struct xenvif *vif) |
2727 | atomic_dec(&vif->refcnt); |
2728 | wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0); |
2729 | |
2730 | - del_timer_sync(&vif->credit_timeout); |
2731 | - |
2732 | if (vif->irq) |
2733 | unbind_from_irqhandler(vif->irq, vif); |
2734 | |
2735 | diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c |
2736 | index 2b9520c..cd49ba9 100644 |
2737 | --- a/drivers/net/xen-netback/netback.c |
2738 | +++ b/drivers/net/xen-netback/netback.c |
2739 | @@ -911,13 +911,13 @@ static int netbk_count_requests(struct xenvif *vif, |
2740 | if (frags >= work_to_do) { |
2741 | netdev_err(vif->dev, "Need more frags\n"); |
2742 | netbk_fatal_tx_err(vif); |
2743 | - return -frags; |
2744 | + return -ENODATA; |
2745 | } |
2746 | |
2747 | if (unlikely(frags >= MAX_SKB_FRAGS)) { |
2748 | netdev_err(vif->dev, "Too many frags\n"); |
2749 | netbk_fatal_tx_err(vif); |
2750 | - return -frags; |
2751 | + return -E2BIG; |
2752 | } |
2753 | |
2754 | memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags), |
2755 | @@ -925,7 +925,7 @@ static int netbk_count_requests(struct xenvif *vif, |
2756 | if (txp->size > first->size) { |
2757 | netdev_err(vif->dev, "Frag is bigger than frame.\n"); |
2758 | netbk_fatal_tx_err(vif); |
2759 | - return -frags; |
2760 | + return -EIO; |
2761 | } |
2762 | |
2763 | first->size -= txp->size; |
2764 | @@ -935,7 +935,7 @@ static int netbk_count_requests(struct xenvif *vif, |
2765 | netdev_err(vif->dev, "txp->offset: %x, size: %u\n", |
2766 | txp->offset, txp->size); |
2767 | netbk_fatal_tx_err(vif); |
2768 | - return -frags; |
2769 | + return -EINVAL; |
2770 | } |
2771 | } while ((txp++)->flags & XEN_NETTXF_more_data); |
2772 | return frags; |
2773 | diff --git a/drivers/pci/access.c b/drivers/pci/access.c |
2774 | index 3af0478..32046c5 100644 |
2775 | --- a/drivers/pci/access.c |
2776 | +++ b/drivers/pci/access.c |
2777 | @@ -515,7 +515,7 @@ static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos) |
2778 | return false; |
2779 | |
2780 | switch (pos) { |
2781 | - case PCI_EXP_FLAGS_TYPE: |
2782 | + case PCI_EXP_FLAGS: |
2783 | return true; |
2784 | case PCI_EXP_DEVCAP: |
2785 | case PCI_EXP_DEVCTL: |
2786 | diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c |
2787 | index 75806be..d98a086 100644 |
2788 | --- a/drivers/pcmcia/vrc4171_card.c |
2789 | +++ b/drivers/pcmcia/vrc4171_card.c |
2790 | @@ -246,6 +246,7 @@ static int pccard_init(struct pcmcia_socket *sock) |
2791 | socket = &vrc4171_sockets[slot]; |
2792 | socket->csc_irq = search_nonuse_irq(); |
2793 | socket->io_irq = search_nonuse_irq(); |
2794 | + spin_lock_init(&socket->lock); |
2795 | |
2796 | return 0; |
2797 | } |
2798 | diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c |
2799 | index 79451f2..60cee9e 100644 |
2800 | --- a/drivers/pps/clients/pps-ldisc.c |
2801 | +++ b/drivers/pps/clients/pps-ldisc.c |
2802 | @@ -31,7 +31,7 @@ |
2803 | static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status, |
2804 | struct pps_event_time *ts) |
2805 | { |
2806 | - struct pps_device *pps = (struct pps_device *)tty->disc_data; |
2807 | + struct pps_device *pps = pps_lookup_dev(tty); |
2808 | |
2809 | BUG_ON(pps == NULL); |
2810 | |
2811 | @@ -67,9 +67,9 @@ static int pps_tty_open(struct tty_struct *tty) |
2812 | pr_err("cannot register PPS source \"%s\"\n", info.path); |
2813 | return -ENOMEM; |
2814 | } |
2815 | - tty->disc_data = pps; |
2816 | + pps->lookup_cookie = tty; |
2817 | |
2818 | - /* Should open N_TTY ldisc too */ |
2819 | + /* Now open the base class N_TTY ldisc */ |
2820 | ret = alias_n_tty_open(tty); |
2821 | if (ret < 0) { |
2822 | pr_err("cannot open tty ldisc \"%s\"\n", info.path); |
2823 | @@ -81,7 +81,6 @@ static int pps_tty_open(struct tty_struct *tty) |
2824 | return 0; |
2825 | |
2826 | err_unregister: |
2827 | - tty->disc_data = NULL; |
2828 | pps_unregister_source(pps); |
2829 | return ret; |
2830 | } |
2831 | @@ -90,11 +89,10 @@ static void (*alias_n_tty_close)(struct tty_struct *tty); |
2832 | |
2833 | static void pps_tty_close(struct tty_struct *tty) |
2834 | { |
2835 | - struct pps_device *pps = (struct pps_device *)tty->disc_data; |
2836 | + struct pps_device *pps = pps_lookup_dev(tty); |
2837 | |
2838 | alias_n_tty_close(tty); |
2839 | |
2840 | - tty->disc_data = NULL; |
2841 | dev_info(pps->dev, "removed\n"); |
2842 | pps_unregister_source(pps); |
2843 | } |
2844 | diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c |
2845 | index 2420d5a..6437703 100644 |
2846 | --- a/drivers/pps/pps.c |
2847 | +++ b/drivers/pps/pps.c |
2848 | @@ -247,12 +247,15 @@ static int pps_cdev_open(struct inode *inode, struct file *file) |
2849 | struct pps_device *pps = container_of(inode->i_cdev, |
2850 | struct pps_device, cdev); |
2851 | file->private_data = pps; |
2852 | - |
2853 | + kobject_get(&pps->dev->kobj); |
2854 | return 0; |
2855 | } |
2856 | |
2857 | static int pps_cdev_release(struct inode *inode, struct file *file) |
2858 | { |
2859 | + struct pps_device *pps = container_of(inode->i_cdev, |
2860 | + struct pps_device, cdev); |
2861 | + kobject_put(&pps->dev->kobj); |
2862 | return 0; |
2863 | } |
2864 | |
2865 | @@ -274,8 +277,10 @@ static void pps_device_destruct(struct device *dev) |
2866 | { |
2867 | struct pps_device *pps = dev_get_drvdata(dev); |
2868 | |
2869 | - /* release id here to protect others from using it while it's |
2870 | - * still in use */ |
2871 | + cdev_del(&pps->cdev); |
2872 | + |
2873 | + /* Now we can release the ID for re-use */ |
2874 | + pr_debug("deallocating pps%d\n", pps->id); |
2875 | mutex_lock(&pps_idr_lock); |
2876 | idr_remove(&pps_idr, pps->id); |
2877 | mutex_unlock(&pps_idr_lock); |
2878 | @@ -332,6 +337,7 @@ int pps_register_cdev(struct pps_device *pps) |
2879 | goto del_cdev; |
2880 | } |
2881 | |
2882 | + /* Override the release function with our own */ |
2883 | pps->dev->release = pps_device_destruct; |
2884 | |
2885 | pr_debug("source %s got cdev (%d:%d)\n", pps->info.name, |
2886 | @@ -352,11 +358,44 @@ free_idr: |
2887 | |
2888 | void pps_unregister_cdev(struct pps_device *pps) |
2889 | { |
2890 | + pr_debug("unregistering pps%d\n", pps->id); |
2891 | + pps->lookup_cookie = NULL; |
2892 | device_destroy(pps_class, pps->dev->devt); |
2893 | - cdev_del(&pps->cdev); |
2894 | } |
2895 | |
2896 | /* |
2897 | + * Look up a pps device by magic cookie. |
2898 | + * The cookie is usually a pointer to some enclosing device, but this |
2899 | + * code doesn't care; you should never be dereferencing it. |
2900 | + * |
2901 | + * This is a bit of a kludge that is currently used only by the PPS |
2902 | + * serial line discipline. It may need to be tweaked when a second user |
2903 | + * is found. |
2904 | + * |
2905 | + * There is no function interface for setting the lookup_cookie field. |
2906 | + * It's initialized to NULL when the pps device is created, and if a |
2907 | + * client wants to use it, just fill it in afterward. |
2908 | + * |
2909 | + * The cookie is automatically set to NULL in pps_unregister_source() |
2910 | + * so that it will not be used again, even if the pps device cannot |
2911 | + * be removed from the idr due to pending references holding the minor |
2912 | + * number in use. |
2913 | + */ |
2914 | +struct pps_device *pps_lookup_dev(void const *cookie) |
2915 | +{ |
2916 | + struct pps_device *pps; |
2917 | + unsigned id; |
2918 | + |
2919 | + rcu_read_lock(); |
2920 | + idr_for_each_entry(&pps_idr, pps, id) |
2921 | + if (cookie == pps->lookup_cookie) |
2922 | + break; |
2923 | + rcu_read_unlock(); |
2924 | + return pps; |
2925 | +} |
2926 | +EXPORT_SYMBOL(pps_lookup_dev); |
2927 | + |
2928 | +/* |
2929 | * Module stuff |
2930 | */ |
2931 | |
2932 | diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c |
2933 | index 8491111..03a15e0 100644 |
2934 | --- a/drivers/s390/kvm/kvm_virtio.c |
2935 | +++ b/drivers/s390/kvm/kvm_virtio.c |
2936 | @@ -422,6 +422,26 @@ static void kvm_extint_handler(struct ext_code ext_code, |
2937 | } |
2938 | |
2939 | /* |
2940 | + * For s390-virtio, we expect a page above main storage containing |
2941 | + * the virtio configuration. Try to actually load from this area |
2942 | + * in order to figure out if the host provides this page. |
2943 | + */ |
2944 | +static int __init test_devices_support(unsigned long addr) |
2945 | +{ |
2946 | + int ret = -EIO; |
2947 | + |
2948 | + asm volatile( |
2949 | + "0: lura 0,%1\n" |
2950 | + "1: xgr %0,%0\n" |
2951 | + "2:\n" |
2952 | + EX_TABLE(0b,2b) |
2953 | + EX_TABLE(1b,2b) |
2954 | + : "+d" (ret) |
2955 | + : "a" (addr) |
2956 | + : "0", "cc"); |
2957 | + return ret; |
2958 | +} |
2959 | +/* |
2960 | * Init function for virtio |
2961 | * devices are in a single page above top of "normal" mem |
2962 | */ |
2963 | @@ -432,21 +452,23 @@ static int __init kvm_devices_init(void) |
2964 | if (!MACHINE_IS_KVM) |
2965 | return -ENODEV; |
2966 | |
2967 | + if (test_devices_support(real_memory_size) < 0) |
2968 | + return -ENODEV; |
2969 | + |
2970 | + rc = vmem_add_mapping(real_memory_size, PAGE_SIZE); |
2971 | + if (rc) |
2972 | + return rc; |
2973 | + |
2974 | + kvm_devices = (void *) real_memory_size; |
2975 | + |
2976 | kvm_root = root_device_register("kvm_s390"); |
2977 | if (IS_ERR(kvm_root)) { |
2978 | rc = PTR_ERR(kvm_root); |
2979 | printk(KERN_ERR "Could not register kvm_s390 root device"); |
2980 | + vmem_remove_mapping(real_memory_size, PAGE_SIZE); |
2981 | return rc; |
2982 | } |
2983 | |
2984 | - rc = vmem_add_mapping(real_memory_size, PAGE_SIZE); |
2985 | - if (rc) { |
2986 | - root_device_unregister(kvm_root); |
2987 | - return rc; |
2988 | - } |
2989 | - |
2990 | - kvm_devices = (void *) real_memory_size; |
2991 | - |
2992 | INIT_WORK(&hotplug_work, hotplug_devices); |
2993 | |
2994 | service_subclass_irq_register(); |
2995 | diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
2996 | index 9b038e4..8f14c42 100644 |
2997 | --- a/drivers/staging/comedi/comedi_fops.c |
2998 | +++ b/drivers/staging/comedi/comedi_fops.c |
2999 | @@ -1547,6 +1547,11 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, |
3000 | /* Device config is special, because it must work on |
3001 | * an unconfigured device. */ |
3002 | if (cmd == COMEDI_DEVCONFIG) { |
3003 | + if (minor >= COMEDI_NUM_BOARD_MINORS) { |
3004 | + /* Device config not appropriate on non-board minors. */ |
3005 | + rc = -ENOTTY; |
3006 | + goto done; |
3007 | + } |
3008 | rc = do_devconfig_ioctl(dev, |
3009 | (struct comedi_devconfig __user *)arg); |
3010 | if (rc == 0) |
3011 | diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c |
3012 | index d29c4d7..d999053 100644 |
3013 | --- a/drivers/staging/comedi/drivers/ni_labpc.c |
3014 | +++ b/drivers/staging/comedi/drivers/ni_labpc.c |
3015 | @@ -1202,7 +1202,8 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) |
3016 | else |
3017 | channel = CR_CHAN(cmd->chanlist[0]); |
3018 | /* munge channel bits for differential / scan disabled mode */ |
3019 | - if (mode != MODE_SINGLE_CHAN && aref == AREF_DIFF) |
3020 | + if ((mode == MODE_SINGLE_CHAN || mode == MODE_SINGLE_CHAN_INTERVAL) && |
3021 | + aref == AREF_DIFF) |
3022 | channel *= 2; |
3023 | devpriv->command1_bits |= ADC_CHAN_BITS(channel); |
3024 | devpriv->command1_bits |= thisboard->ai_range_code[range]; |
3025 | @@ -1217,21 +1218,6 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) |
3026 | devpriv->write_byte(devpriv->command1_bits, |
3027 | dev->iobase + COMMAND1_REG); |
3028 | } |
3029 | - /* setup any external triggering/pacing (command4 register) */ |
3030 | - devpriv->command4_bits = 0; |
3031 | - if (cmd->convert_src != TRIG_EXT) |
3032 | - devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT; |
3033 | - /* XXX should discard first scan when using interval scanning |
3034 | - * since manual says it is not synced with scan clock */ |
3035 | - if (labpc_use_continuous_mode(cmd, mode) == 0) { |
3036 | - devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT; |
3037 | - if (cmd->scan_begin_src == TRIG_EXT) |
3038 | - devpriv->command4_bits |= EXT_SCAN_EN_BIT; |
3039 | - } |
3040 | - /* single-ended/differential */ |
3041 | - if (aref == AREF_DIFF) |
3042 | - devpriv->command4_bits |= ADC_DIFF_BIT; |
3043 | - devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG); |
3044 | |
3045 | devpriv->write_byte(cmd->chanlist_len, |
3046 | dev->iobase + INTERVAL_COUNT_REG); |
3047 | @@ -1311,6 +1297,22 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) |
3048 | devpriv->command3_bits &= ~ADC_FNE_INTR_EN_BIT; |
3049 | devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); |
3050 | |
3051 | + /* setup any external triggering/pacing (command4 register) */ |
3052 | + devpriv->command4_bits = 0; |
3053 | + if (cmd->convert_src != TRIG_EXT) |
3054 | + devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT; |
3055 | + /* XXX should discard first scan when using interval scanning |
3056 | + * since manual says it is not synced with scan clock */ |
3057 | + if (labpc_use_continuous_mode(cmd, mode) == 0) { |
3058 | + devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT; |
3059 | + if (cmd->scan_begin_src == TRIG_EXT) |
3060 | + devpriv->command4_bits |= EXT_SCAN_EN_BIT; |
3061 | + } |
3062 | + /* single-ended/differential */ |
3063 | + if (aref == AREF_DIFF) |
3064 | + devpriv->command4_bits |= ADC_DIFF_BIT; |
3065 | + devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG); |
3066 | + |
3067 | /* startup acquisition */ |
3068 | |
3069 | /* command2 reg */ |
3070 | diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c |
3071 | index e94f6a1..d409e14 100644 |
3072 | --- a/drivers/staging/vt6656/dpc.c |
3073 | +++ b/drivers/staging/vt6656/dpc.c |
3074 | @@ -1190,7 +1190,7 @@ static BOOL s_bHandleRxEncryption ( |
3075 | if (byDecMode == KEY_CTL_WEP) { |
3076 | // handle WEP |
3077 | if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || |
3078 | - (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE)) { |
3079 | + (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE)) { |
3080 | // Software WEP |
3081 | // 1. 3253A |
3082 | // 2. WEP 256 |
3083 | @@ -1299,7 +1299,7 @@ static BOOL s_bHostWepRxEncryption ( |
3084 | // handle WEP |
3085 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP\n"); |
3086 | if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || |
3087 | - (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE) || |
3088 | + (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE) || |
3089 | (bOnFly == FALSE)) { |
3090 | // Software WEP |
3091 | // 1. 3253A |
3092 | diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c |
3093 | index 83c04e1..9213d69 100644 |
3094 | --- a/drivers/staging/vt6656/rxtx.c |
3095 | +++ b/drivers/staging/vt6656/rxtx.c |
3096 | @@ -1454,7 +1454,7 @@ s_bPacketToWirelessUsb( |
3097 | |
3098 | pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; |
3099 | if (bNeedEncryption && pTransmitKey->pvKeyTable) { |
3100 | - if (((PSKeyTable)&pTransmitKey->pvKeyTable)->bSoftWEP == TRUE) |
3101 | + if (((PSKeyTable)pTransmitKey->pvKeyTable)->bSoftWEP == TRUE) |
3102 | bSoftWEP = TRUE; /* WEP 256 */ |
3103 | } |
3104 | |
3105 | diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c |
3106 | index fc68518..87815c5 100644 |
3107 | --- a/drivers/staging/vt6656/usbpipe.c |
3108 | +++ b/drivers/staging/vt6656/usbpipe.c |
3109 | @@ -165,6 +165,11 @@ int PIPEnsControlOut( |
3110 | if (pDevice->Flags & fMP_CONTROL_WRITES) |
3111 | return STATUS_FAILURE; |
3112 | |
3113 | + if (pDevice->Flags & fMP_CONTROL_READS) |
3114 | + return STATUS_FAILURE; |
3115 | + |
3116 | + MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); |
3117 | + |
3118 | pDevice->sUsbCtlRequest.bRequestType = 0x40; |
3119 | pDevice->sUsbCtlRequest.bRequest = byRequest; |
3120 | pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); |
3121 | @@ -179,12 +184,13 @@ int PIPEnsControlOut( |
3122 | |
3123 | ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); |
3124 | if (ntStatus != 0) { |
3125 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus); |
3126 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
3127 | + "control send request submission failed: %d\n", |
3128 | + ntStatus); |
3129 | + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); |
3130 | return STATUS_FAILURE; |
3131 | } |
3132 | - else { |
3133 | - MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES); |
3134 | - } |
3135 | + |
3136 | spin_unlock_irq(&pDevice->lock); |
3137 | for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { |
3138 | |
3139 | @@ -224,6 +230,11 @@ int PIPEnsControlIn( |
3140 | if (pDevice->Flags & fMP_CONTROL_READS) |
3141 | return STATUS_FAILURE; |
3142 | |
3143 | + if (pDevice->Flags & fMP_CONTROL_WRITES) |
3144 | + return STATUS_FAILURE; |
3145 | + |
3146 | + MP_SET_FLAG(pDevice, fMP_CONTROL_READS); |
3147 | + |
3148 | pDevice->sUsbCtlRequest.bRequestType = 0xC0; |
3149 | pDevice->sUsbCtlRequest.bRequest = byRequest; |
3150 | pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); |
3151 | @@ -237,10 +248,11 @@ int PIPEnsControlIn( |
3152 | |
3153 | ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); |
3154 | if (ntStatus != 0) { |
3155 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus); |
3156 | - }else { |
3157 | - MP_SET_FLAG(pDevice, fMP_CONTROL_READS); |
3158 | - } |
3159 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
3160 | + "control request submission failed: %d\n", ntStatus); |
3161 | + MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); |
3162 | + return STATUS_FAILURE; |
3163 | + } |
3164 | |
3165 | spin_unlock_irq(&pDevice->lock); |
3166 | for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { |
3167 | diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c |
3168 | index f2a73bd..071e058 100644 |
3169 | --- a/drivers/staging/zram/zram_drv.c |
3170 | +++ b/drivers/staging/zram/zram_drv.c |
3171 | @@ -228,11 +228,12 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, |
3172 | return 0; |
3173 | } |
3174 | |
3175 | - user_mem = kmap_atomic(page); |
3176 | if (is_partial_io(bvec)) |
3177 | /* Use a temporary buffer to decompress the page */ |
3178 | - uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL); |
3179 | - else |
3180 | + uncmem = kmalloc(PAGE_SIZE, GFP_NOIO); |
3181 | + |
3182 | + user_mem = kmap_atomic(page); |
3183 | + if (!is_partial_io(bvec)) |
3184 | uncmem = user_mem; |
3185 | |
3186 | if (!uncmem) { |
3187 | @@ -279,7 +280,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, |
3188 | * This is a partial IO. We need to read the full page |
3189 | * before to write the changes. |
3190 | */ |
3191 | - uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL); |
3192 | + uncmem = kmalloc(PAGE_SIZE, GFP_NOIO); |
3193 | if (!uncmem) { |
3194 | pr_info("Error allocating temp memory!\n"); |
3195 | ret = -ENOMEM; |
3196 | diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c |
3197 | index 09a9d35..223c736 100644 |
3198 | --- a/drivers/staging/zsmalloc/zsmalloc-main.c |
3199 | +++ b/drivers/staging/zsmalloc/zsmalloc-main.c |
3200 | @@ -222,11 +222,9 @@ struct zs_pool { |
3201 | /* |
3202 | * By default, zsmalloc uses a copy-based object mapping method to access |
3203 | * allocations that span two pages. However, if a particular architecture |
3204 | - * 1) Implements local_flush_tlb_kernel_range() and 2) Performs VM mapping |
3205 | - * faster than copying, then it should be added here so that |
3206 | - * USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use page table |
3207 | - * mapping rather than copying |
3208 | - * for object mapping. |
3209 | + * performs VM mapping faster than copying, then it should be added here |
3210 | + * so that USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use |
3211 | + * page table mapping rather than copying for object mapping. |
3212 | */ |
3213 | #if defined(CONFIG_ARM) |
3214 | #define USE_PGTABLE_MAPPING |
3215 | @@ -663,7 +661,7 @@ static inline void __zs_unmap_object(struct mapping_area *area, |
3216 | |
3217 | flush_cache_vunmap(addr, end); |
3218 | unmap_kernel_range_noflush(addr, PAGE_SIZE * 2); |
3219 | - local_flush_tlb_kernel_range(addr, end); |
3220 | + flush_tlb_kernel_range(addr, end); |
3221 | } |
3222 | |
3223 | #else /* USE_PGTABLE_MAPPING */ |
3224 | diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
3225 | index dcc0430..bfd6771 100644 |
3226 | --- a/drivers/tty/n_gsm.c |
3227 | +++ b/drivers/tty/n_gsm.c |
3228 | @@ -1689,6 +1689,8 @@ static inline void dlci_put(struct gsm_dlci *dlci) |
3229 | tty_port_put(&dlci->port); |
3230 | } |
3231 | |
3232 | +static void gsm_destroy_network(struct gsm_dlci *dlci); |
3233 | + |
3234 | /** |
3235 | * gsm_dlci_release - release DLCI |
3236 | * @dlci: DLCI to destroy |
3237 | @@ -1702,9 +1704,19 @@ static void gsm_dlci_release(struct gsm_dlci *dlci) |
3238 | { |
3239 | struct tty_struct *tty = tty_port_tty_get(&dlci->port); |
3240 | if (tty) { |
3241 | + mutex_lock(&dlci->mutex); |
3242 | + gsm_destroy_network(dlci); |
3243 | + mutex_unlock(&dlci->mutex); |
3244 | + |
3245 | + /* tty_vhangup needs the tty_lock, so unlock and |
3246 | + relock after doing the hangup. */ |
3247 | + tty_unlock(tty); |
3248 | tty_vhangup(tty); |
3249 | + tty_lock(tty); |
3250 | + tty_port_tty_set(&dlci->port, NULL); |
3251 | tty_kref_put(tty); |
3252 | } |
3253 | + dlci->state = DLCI_CLOSED; |
3254 | dlci_put(dlci); |
3255 | } |
3256 | |
3257 | @@ -2947,6 +2959,8 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp) |
3258 | |
3259 | if (dlci == NULL) |
3260 | return; |
3261 | + if (dlci->state == DLCI_CLOSED) |
3262 | + return; |
3263 | mutex_lock(&dlci->mutex); |
3264 | gsm_destroy_network(dlci); |
3265 | mutex_unlock(&dlci->mutex); |
3266 | @@ -2965,6 +2979,8 @@ out: |
3267 | static void gsmtty_hangup(struct tty_struct *tty) |
3268 | { |
3269 | struct gsm_dlci *dlci = tty->driver_data; |
3270 | + if (dlci->state == DLCI_CLOSED) |
3271 | + return; |
3272 | tty_port_hangup(&dlci->port); |
3273 | gsm_dlci_begin_close(dlci); |
3274 | } |
3275 | @@ -2972,9 +2988,12 @@ static void gsmtty_hangup(struct tty_struct *tty) |
3276 | static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, |
3277 | int len) |
3278 | { |
3279 | + int sent; |
3280 | struct gsm_dlci *dlci = tty->driver_data; |
3281 | + if (dlci->state == DLCI_CLOSED) |
3282 | + return -EINVAL; |
3283 | /* Stuff the bytes into the fifo queue */ |
3284 | - int sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock); |
3285 | + sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock); |
3286 | /* Need to kick the channel */ |
3287 | gsm_dlci_data_kick(dlci); |
3288 | return sent; |
3289 | @@ -2983,18 +3002,24 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf, |
3290 | static int gsmtty_write_room(struct tty_struct *tty) |
3291 | { |
3292 | struct gsm_dlci *dlci = tty->driver_data; |
3293 | + if (dlci->state == DLCI_CLOSED) |
3294 | + return -EINVAL; |
3295 | return TX_SIZE - kfifo_len(dlci->fifo); |
3296 | } |
3297 | |
3298 | static int gsmtty_chars_in_buffer(struct tty_struct *tty) |
3299 | { |
3300 | struct gsm_dlci *dlci = tty->driver_data; |
3301 | + if (dlci->state == DLCI_CLOSED) |
3302 | + return -EINVAL; |
3303 | return kfifo_len(dlci->fifo); |
3304 | } |
3305 | |
3306 | static void gsmtty_flush_buffer(struct tty_struct *tty) |
3307 | { |
3308 | struct gsm_dlci *dlci = tty->driver_data; |
3309 | + if (dlci->state == DLCI_CLOSED) |
3310 | + return; |
3311 | /* Caution needed: If we implement reliable transport classes |
3312 | then the data being transmitted can't simply be junked once |
3313 | it has first hit the stack. Until then we can just blow it |
3314 | @@ -3013,6 +3038,8 @@ static void gsmtty_wait_until_sent(struct tty_struct *tty, int timeout) |
3315 | static int gsmtty_tiocmget(struct tty_struct *tty) |
3316 | { |
3317 | struct gsm_dlci *dlci = tty->driver_data; |
3318 | + if (dlci->state == DLCI_CLOSED) |
3319 | + return -EINVAL; |
3320 | return dlci->modem_rx; |
3321 | } |
3322 | |
3323 | @@ -3022,6 +3049,8 @@ static int gsmtty_tiocmset(struct tty_struct *tty, |
3324 | struct gsm_dlci *dlci = tty->driver_data; |
3325 | unsigned int modem_tx = dlci->modem_tx; |
3326 | |
3327 | + if (dlci->state == DLCI_CLOSED) |
3328 | + return -EINVAL; |
3329 | modem_tx &= ~clear; |
3330 | modem_tx |= set; |
3331 | |
3332 | @@ -3040,6 +3069,8 @@ static int gsmtty_ioctl(struct tty_struct *tty, |
3333 | struct gsm_netconfig nc; |
3334 | int index; |
3335 | |
3336 | + if (dlci->state == DLCI_CLOSED) |
3337 | + return -EINVAL; |
3338 | switch (cmd) { |
3339 | case GSMIOC_ENABLE_NET: |
3340 | if (copy_from_user(&nc, (void __user *)arg, sizeof(nc))) |
3341 | @@ -3066,6 +3097,9 @@ static int gsmtty_ioctl(struct tty_struct *tty, |
3342 | |
3343 | static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old) |
3344 | { |
3345 | + struct gsm_dlci *dlci = tty->driver_data; |
3346 | + if (dlci->state == DLCI_CLOSED) |
3347 | + return; |
3348 | /* For the moment its fixed. In actual fact the speed information |
3349 | for the virtual channel can be propogated in both directions by |
3350 | the RPN control message. This however rapidly gets nasty as we |
3351 | @@ -3077,6 +3111,8 @@ static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old) |
3352 | static void gsmtty_throttle(struct tty_struct *tty) |
3353 | { |
3354 | struct gsm_dlci *dlci = tty->driver_data; |
3355 | + if (dlci->state == DLCI_CLOSED) |
3356 | + return; |
3357 | if (tty->termios.c_cflag & CRTSCTS) |
3358 | dlci->modem_tx &= ~TIOCM_DTR; |
3359 | dlci->throttled = 1; |
3360 | @@ -3087,6 +3123,8 @@ static void gsmtty_throttle(struct tty_struct *tty) |
3361 | static void gsmtty_unthrottle(struct tty_struct *tty) |
3362 | { |
3363 | struct gsm_dlci *dlci = tty->driver_data; |
3364 | + if (dlci->state == DLCI_CLOSED) |
3365 | + return; |
3366 | if (tty->termios.c_cflag & CRTSCTS) |
3367 | dlci->modem_tx |= TIOCM_DTR; |
3368 | dlci->throttled = 0; |
3369 | @@ -3098,6 +3136,8 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state) |
3370 | { |
3371 | struct gsm_dlci *dlci = tty->driver_data; |
3372 | int encode = 0; /* Off */ |
3373 | + if (dlci->state == DLCI_CLOSED) |
3374 | + return -EINVAL; |
3375 | |
3376 | if (state == -1) /* "On indefinitely" - we can't encode this |
3377 | properly */ |
3378 | diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c |
3379 | index 5981912..5c110c8 100644 |
3380 | --- a/drivers/tty/serial/imx.c |
3381 | +++ b/drivers/tty/serial/imx.c |
3382 | @@ -1213,8 +1213,14 @@ imx_console_write(struct console *co, const char *s, unsigned int count) |
3383 | struct imx_port_ucrs old_ucr; |
3384 | unsigned int ucr1; |
3385 | unsigned long flags; |
3386 | + int locked = 1; |
3387 | |
3388 | - spin_lock_irqsave(&sport->port.lock, flags); |
3389 | + if (sport->port.sysrq) |
3390 | + locked = 0; |
3391 | + else if (oops_in_progress) |
3392 | + locked = spin_trylock_irqsave(&sport->port.lock, flags); |
3393 | + else |
3394 | + spin_lock_irqsave(&sport->port.lock, flags); |
3395 | |
3396 | /* |
3397 | * First, save UCR1/2/3 and then disable interrupts |
3398 | @@ -1241,7 +1247,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count) |
3399 | |
3400 | imx_port_ucrs_restore(&sport->port, &old_ucr); |
3401 | |
3402 | - spin_unlock_irqrestore(&sport->port.lock, flags); |
3403 | + if (locked) |
3404 | + spin_unlock_irqrestore(&sport->port.lock, flags); |
3405 | } |
3406 | |
3407 | /* |
3408 | diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c |
3409 | index 8481b29..e4455e0 100644 |
3410 | --- a/drivers/tty/tty_ioctl.c |
3411 | +++ b/drivers/tty/tty_ioctl.c |
3412 | @@ -617,7 +617,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt) |
3413 | if (opt & TERMIOS_WAIT) { |
3414 | tty_wait_until_sent(tty, 0); |
3415 | if (signal_pending(current)) |
3416 | - return -EINTR; |
3417 | + return -ERESTARTSYS; |
3418 | } |
3419 | |
3420 | tty_set_termios(tty, &tmp_termios); |
3421 | @@ -684,7 +684,7 @@ static int set_termiox(struct tty_struct *tty, void __user *arg, int opt) |
3422 | if (opt & TERMIOS_WAIT) { |
3423 | tty_wait_until_sent(tty, 0); |
3424 | if (signal_pending(current)) |
3425 | - return -EINTR; |
3426 | + return -ERESTARTSYS; |
3427 | } |
3428 | |
3429 | mutex_lock(&tty->termios_mutex); |
3430 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
3431 | index 8fd8968..3b1d6bf 100644 |
3432 | --- a/drivers/tty/vt/vt.c |
3433 | +++ b/drivers/tty/vt/vt.c |
3434 | @@ -539,7 +539,7 @@ static void insert_char(struct vc_data *vc, unsigned int nr) |
3435 | { |
3436 | unsigned short *p = (unsigned short *) vc->vc_pos; |
3437 | |
3438 | - scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x) * 2); |
3439 | + scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); |
3440 | scr_memsetw(p, vc->vc_video_erase_char, nr * 2); |
3441 | vc->vc_need_wrap = 0; |
3442 | if (DO_UPDATE(vc)) |
3443 | @@ -638,7 +638,7 @@ static inline void save_screen(struct vc_data *vc) |
3444 | * Redrawing of screen |
3445 | */ |
3446 | |
3447 | -static void clear_buffer_attributes(struct vc_data *vc) |
3448 | +void clear_buffer_attributes(struct vc_data *vc) |
3449 | { |
3450 | unsigned short *p = (unsigned short *)vc->vc_origin; |
3451 | int count = vc->vc_screenbuf_size / 2; |
3452 | @@ -2987,7 +2987,7 @@ int __init vty_init(const struct file_operations *console_fops) |
3453 | |
3454 | static struct class *vtconsole_class; |
3455 | |
3456 | -static int bind_con_driver(const struct consw *csw, int first, int last, |
3457 | +static int do_bind_con_driver(const struct consw *csw, int first, int last, |
3458 | int deflt) |
3459 | { |
3460 | struct module *owner = csw->owner; |
3461 | @@ -2998,7 +2998,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, |
3462 | if (!try_module_get(owner)) |
3463 | return -ENODEV; |
3464 | |
3465 | - console_lock(); |
3466 | + WARN_CONSOLE_UNLOCKED(); |
3467 | |
3468 | /* check if driver is registered */ |
3469 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3470 | @@ -3083,11 +3083,22 @@ static int bind_con_driver(const struct consw *csw, int first, int last, |
3471 | |
3472 | retval = 0; |
3473 | err: |
3474 | - console_unlock(); |
3475 | module_put(owner); |
3476 | return retval; |
3477 | }; |
3478 | |
3479 | + |
3480 | +static int bind_con_driver(const struct consw *csw, int first, int last, |
3481 | + int deflt) |
3482 | +{ |
3483 | + int ret; |
3484 | + |
3485 | + console_lock(); |
3486 | + ret = do_bind_con_driver(csw, first, last, deflt); |
3487 | + console_unlock(); |
3488 | + return ret; |
3489 | +} |
3490 | + |
3491 | #ifdef CONFIG_VT_HW_CONSOLE_BINDING |
3492 | static int con_is_graphics(const struct consw *csw, int first, int last) |
3493 | { |
3494 | @@ -3124,6 +3135,18 @@ static int con_is_graphics(const struct consw *csw, int first, int last) |
3495 | */ |
3496 | int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) |
3497 | { |
3498 | + int retval; |
3499 | + |
3500 | + console_lock(); |
3501 | + retval = do_unbind_con_driver(csw, first, last, deflt); |
3502 | + console_unlock(); |
3503 | + return retval; |
3504 | +} |
3505 | +EXPORT_SYMBOL(unbind_con_driver); |
3506 | + |
3507 | +/* unlocked version of unbind_con_driver() */ |
3508 | +int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt) |
3509 | +{ |
3510 | struct module *owner = csw->owner; |
3511 | const struct consw *defcsw = NULL; |
3512 | struct con_driver *con_driver = NULL, *con_back = NULL; |
3513 | @@ -3132,7 +3155,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) |
3514 | if (!try_module_get(owner)) |
3515 | return -ENODEV; |
3516 | |
3517 | - console_lock(); |
3518 | + WARN_CONSOLE_UNLOCKED(); |
3519 | |
3520 | /* check if driver is registered and if it is unbindable */ |
3521 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3522 | @@ -3145,10 +3168,8 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) |
3523 | } |
3524 | } |
3525 | |
3526 | - if (retval) { |
3527 | - console_unlock(); |
3528 | + if (retval) |
3529 | goto err; |
3530 | - } |
3531 | |
3532 | retval = -ENODEV; |
3533 | |
3534 | @@ -3164,15 +3185,11 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) |
3535 | } |
3536 | } |
3537 | |
3538 | - if (retval) { |
3539 | - console_unlock(); |
3540 | + if (retval) |
3541 | goto err; |
3542 | - } |
3543 | |
3544 | - if (!con_is_bound(csw)) { |
3545 | - console_unlock(); |
3546 | + if (!con_is_bound(csw)) |
3547 | goto err; |
3548 | - } |
3549 | |
3550 | first = max(first, con_driver->first); |
3551 | last = min(last, con_driver->last); |
3552 | @@ -3199,15 +3216,14 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) |
3553 | if (!con_is_bound(csw)) |
3554 | con_driver->flag &= ~CON_DRIVER_FLAG_INIT; |
3555 | |
3556 | - console_unlock(); |
3557 | /* ignore return value, binding should not fail */ |
3558 | - bind_con_driver(defcsw, first, last, deflt); |
3559 | + do_bind_con_driver(defcsw, first, last, deflt); |
3560 | err: |
3561 | module_put(owner); |
3562 | return retval; |
3563 | |
3564 | } |
3565 | -EXPORT_SYMBOL(unbind_con_driver); |
3566 | +EXPORT_SYMBOL_GPL(do_unbind_con_driver); |
3567 | |
3568 | static int vt_bind(struct con_driver *con) |
3569 | { |
3570 | @@ -3492,28 +3508,18 @@ int con_debug_leave(void) |
3571 | } |
3572 | EXPORT_SYMBOL_GPL(con_debug_leave); |
3573 | |
3574 | -/** |
3575 | - * register_con_driver - register console driver to console layer |
3576 | - * @csw: console driver |
3577 | - * @first: the first console to take over, minimum value is 0 |
3578 | - * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1 |
3579 | - * |
3580 | - * DESCRIPTION: This function registers a console driver which can later |
3581 | - * bind to a range of consoles specified by @first and @last. It will |
3582 | - * also initialize the console driver by calling con_startup(). |
3583 | - */ |
3584 | -int register_con_driver(const struct consw *csw, int first, int last) |
3585 | +static int do_register_con_driver(const struct consw *csw, int first, int last) |
3586 | { |
3587 | struct module *owner = csw->owner; |
3588 | struct con_driver *con_driver; |
3589 | const char *desc; |
3590 | int i, retval = 0; |
3591 | |
3592 | + WARN_CONSOLE_UNLOCKED(); |
3593 | + |
3594 | if (!try_module_get(owner)) |
3595 | return -ENODEV; |
3596 | |
3597 | - console_lock(); |
3598 | - |
3599 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3600 | con_driver = ®istered_con_driver[i]; |
3601 | |
3602 | @@ -3566,10 +3572,29 @@ int register_con_driver(const struct consw *csw, int first, int last) |
3603 | } |
3604 | |
3605 | err: |
3606 | - console_unlock(); |
3607 | module_put(owner); |
3608 | return retval; |
3609 | } |
3610 | + |
3611 | +/** |
3612 | + * register_con_driver - register console driver to console layer |
3613 | + * @csw: console driver |
3614 | + * @first: the first console to take over, minimum value is 0 |
3615 | + * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1 |
3616 | + * |
3617 | + * DESCRIPTION: This function registers a console driver which can later |
3618 | + * bind to a range of consoles specified by @first and @last. It will |
3619 | + * also initialize the console driver by calling con_startup(). |
3620 | + */ |
3621 | +int register_con_driver(const struct consw *csw, int first, int last) |
3622 | +{ |
3623 | + int retval; |
3624 | + |
3625 | + console_lock(); |
3626 | + retval = do_register_con_driver(csw, first, last); |
3627 | + console_unlock(); |
3628 | + return retval; |
3629 | +} |
3630 | EXPORT_SYMBOL(register_con_driver); |
3631 | |
3632 | /** |
3633 | @@ -3585,9 +3610,18 @@ EXPORT_SYMBOL(register_con_driver); |
3634 | */ |
3635 | int unregister_con_driver(const struct consw *csw) |
3636 | { |
3637 | - int i, retval = -ENODEV; |
3638 | + int retval; |
3639 | |
3640 | console_lock(); |
3641 | + retval = do_unregister_con_driver(csw); |
3642 | + console_unlock(); |
3643 | + return retval; |
3644 | +} |
3645 | +EXPORT_SYMBOL(unregister_con_driver); |
3646 | + |
3647 | +int do_unregister_con_driver(const struct consw *csw) |
3648 | +{ |
3649 | + int i, retval = -ENODEV; |
3650 | |
3651 | /* cannot unregister a bound driver */ |
3652 | if (con_is_bound(csw)) |
3653 | @@ -3613,27 +3647,53 @@ int unregister_con_driver(const struct consw *csw) |
3654 | } |
3655 | } |
3656 | err: |
3657 | - console_unlock(); |
3658 | return retval; |
3659 | } |
3660 | -EXPORT_SYMBOL(unregister_con_driver); |
3661 | +EXPORT_SYMBOL_GPL(do_unregister_con_driver); |
3662 | |
3663 | /* |
3664 | * If we support more console drivers, this function is used |
3665 | * when a driver wants to take over some existing consoles |
3666 | * and become default driver for newly opened ones. |
3667 | * |
3668 | - * take_over_console is basically a register followed by unbind |
3669 | + * take_over_console is basically a register followed by unbind |
3670 | + */ |
3671 | +int do_take_over_console(const struct consw *csw, int first, int last, int deflt) |
3672 | +{ |
3673 | + int err; |
3674 | + |
3675 | + err = do_register_con_driver(csw, first, last); |
3676 | + /* |
3677 | + * If we get an busy error we still want to bind the console driver |
3678 | + * and return success, as we may have unbound the console driver |
3679 | + * but not unregistered it. |
3680 | + */ |
3681 | + if (err == -EBUSY) |
3682 | + err = 0; |
3683 | + if (!err) |
3684 | + do_bind_con_driver(csw, first, last, deflt); |
3685 | + |
3686 | + return err; |
3687 | +} |
3688 | +EXPORT_SYMBOL_GPL(do_take_over_console); |
3689 | + |
3690 | +/* |
3691 | + * If we support more console drivers, this function is used |
3692 | + * when a driver wants to take over some existing consoles |
3693 | + * and become default driver for newly opened ones. |
3694 | + * |
3695 | + * take_over_console is basically a register followed by unbind |
3696 | */ |
3697 | int take_over_console(const struct consw *csw, int first, int last, int deflt) |
3698 | { |
3699 | int err; |
3700 | |
3701 | err = register_con_driver(csw, first, last); |
3702 | - /* if we get an busy error we still want to bind the console driver |
3703 | + /* |
3704 | + * If we get an busy error we still want to bind the console driver |
3705 | * and return success, as we may have unbound the console driver |
3706 | - Â * but not unregistered it. |
3707 | - */ |
3708 | + * but not unregistered it. |
3709 | + */ |
3710 | if (err == -EBUSY) |
3711 | err = 0; |
3712 | if (!err) |
3713 | diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c |
3714 | index ac17a7c..99899e8 100644 |
3715 | --- a/drivers/usb/host/ehci-omap.c |
3716 | +++ b/drivers/usb/host/ehci-omap.c |
3717 | @@ -288,7 +288,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) |
3718 | { |
3719 | struct device *dev = &pdev->dev; |
3720 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
3721 | - struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; |
3722 | |
3723 | usb_remove_hcd(hcd); |
3724 | disable_put_regulator(dev->platform_data); |
3725 | @@ -298,13 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) |
3726 | pm_runtime_put_sync(dev); |
3727 | pm_runtime_disable(dev); |
3728 | |
3729 | - if (pdata->phy_reset) { |
3730 | - if (gpio_is_valid(pdata->reset_gpio_port[0])) |
3731 | - gpio_free(pdata->reset_gpio_port[0]); |
3732 | - |
3733 | - if (gpio_is_valid(pdata->reset_gpio_port[1])) |
3734 | - gpio_free(pdata->reset_gpio_port[1]); |
3735 | - } |
3736 | return 0; |
3737 | } |
3738 | |
3739 | @@ -372,7 +364,7 @@ static const struct hc_driver ehci_omap_hc_driver = { |
3740 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
3741 | }; |
3742 | |
3743 | -MODULE_ALIAS("platform:omap-ehci"); |
3744 | +MODULE_ALIAS("platform:ehci-omap"); |
3745 | MODULE_AUTHOR("Texas Instruments, Inc."); |
3746 | MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>"); |
3747 | |
3748 | diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c |
3749 | index c107d7c..59eea21 100644 |
3750 | --- a/drivers/usb/musb/am35x.c |
3751 | +++ b/drivers/usb/musb/am35x.c |
3752 | @@ -365,7 +365,7 @@ static int am35x_musb_init(struct musb *musb) |
3753 | usb_nop_xceiv_register(); |
3754 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3755 | if (IS_ERR_OR_NULL(musb->xceiv)) |
3756 | - return -ENODEV; |
3757 | + return -EPROBE_DEFER; |
3758 | |
3759 | setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); |
3760 | |
3761 | diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c |
3762 | index 14dab9f..dbb31b3 100644 |
3763 | --- a/drivers/usb/musb/blackfin.c |
3764 | +++ b/drivers/usb/musb/blackfin.c |
3765 | @@ -406,7 +406,7 @@ static int bfin_musb_init(struct musb *musb) |
3766 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3767 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
3768 | gpio_free(musb->config->gpio_vrsel); |
3769 | - return -ENODEV; |
3770 | + return -EPROBE_DEFER; |
3771 | } |
3772 | |
3773 | bfin_musb_reg_init(musb); |
3774 | diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c |
3775 | index 97996af..7c71769d 100644 |
3776 | --- a/drivers/usb/musb/da8xx.c |
3777 | +++ b/drivers/usb/musb/da8xx.c |
3778 | @@ -410,6 +410,7 @@ static int da8xx_musb_init(struct musb *musb) |
3779 | { |
3780 | void __iomem *reg_base = musb->ctrl_base; |
3781 | u32 rev; |
3782 | + int ret = -ENODEV; |
3783 | |
3784 | musb->mregs += DA8XX_MENTOR_CORE_OFFSET; |
3785 | |
3786 | @@ -420,8 +421,10 @@ static int da8xx_musb_init(struct musb *musb) |
3787 | |
3788 | usb_nop_xceiv_register(); |
3789 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3790 | - if (IS_ERR_OR_NULL(musb->xceiv)) |
3791 | + if (IS_ERR_OR_NULL(musb->xceiv)) { |
3792 | + ret = -EPROBE_DEFER; |
3793 | goto fail; |
3794 | + } |
3795 | |
3796 | setup_timer(&otg_workaround, otg_timer, (unsigned long)musb); |
3797 | |
3798 | @@ -441,7 +444,7 @@ static int da8xx_musb_init(struct musb *musb) |
3799 | musb->isr = da8xx_musb_interrupt; |
3800 | return 0; |
3801 | fail: |
3802 | - return -ENODEV; |
3803 | + return ret; |
3804 | } |
3805 | |
3806 | static int da8xx_musb_exit(struct musb *musb) |
3807 | diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c |
3808 | index b1c01ca..e040d91 100644 |
3809 | --- a/drivers/usb/musb/davinci.c |
3810 | +++ b/drivers/usb/musb/davinci.c |
3811 | @@ -380,11 +380,14 @@ static int davinci_musb_init(struct musb *musb) |
3812 | { |
3813 | void __iomem *tibase = musb->ctrl_base; |
3814 | u32 revision; |
3815 | + int ret = -ENODEV; |
3816 | |
3817 | usb_nop_xceiv_register(); |
3818 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3819 | - if (IS_ERR_OR_NULL(musb->xceiv)) |
3820 | + if (IS_ERR_OR_NULL(musb->xceiv)) { |
3821 | + ret = -EPROBE_DEFER; |
3822 | goto unregister; |
3823 | + } |
3824 | |
3825 | musb->mregs += DAVINCI_BASE_OFFSET; |
3826 | |
3827 | @@ -438,7 +441,7 @@ fail: |
3828 | usb_put_phy(musb->xceiv); |
3829 | unregister: |
3830 | usb_nop_xceiv_unregister(); |
3831 | - return -ENODEV; |
3832 | + return ret; |
3833 | } |
3834 | |
3835 | static int davinci_musb_exit(struct musb *musb) |
3836 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
3837 | index fd34867..60b41cc 100644 |
3838 | --- a/drivers/usb/musb/musb_core.c |
3839 | +++ b/drivers/usb/musb/musb_core.c |
3840 | @@ -1993,6 +1993,7 @@ fail2: |
3841 | musb_platform_exit(musb); |
3842 | |
3843 | fail1: |
3844 | + pm_runtime_disable(musb->controller); |
3845 | dev_err(musb->controller, |
3846 | "musb_init_controller failed with status %d\n", status); |
3847 | |
3848 | diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c |
3849 | index f7d764d..341a4b5 100644 |
3850 | --- a/drivers/usb/musb/musb_dsps.c |
3851 | +++ b/drivers/usb/musb/musb_dsps.c |
3852 | @@ -419,7 +419,7 @@ static int dsps_musb_init(struct musb *musb) |
3853 | usb_nop_xceiv_register(); |
3854 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3855 | if (IS_ERR_OR_NULL(musb->xceiv)) |
3856 | - return -ENODEV; |
3857 | + return -EPROBE_DEFER; |
3858 | |
3859 | /* Returns zero if e.g. not clocked */ |
3860 | rev = dsps_readl(reg_base, wrp->revision); |
3861 | diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c |
3862 | index da00af4..d7772856 100644 |
3863 | --- a/drivers/usb/musb/omap2430.c |
3864 | +++ b/drivers/usb/musb/omap2430.c |
3865 | @@ -369,7 +369,7 @@ static int omap2430_musb_init(struct musb *musb) |
3866 | musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); |
3867 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
3868 | pr_err("HS USB OTG: no transceiver configured\n"); |
3869 | - return -ENODEV; |
3870 | + return -EPROBE_DEFER; |
3871 | } |
3872 | |
3873 | musb->isr = omap2430_musb_interrupt; |
3874 | diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c |
3875 | index 3969813..464bd23 100644 |
3876 | --- a/drivers/usb/musb/tusb6010.c |
3877 | +++ b/drivers/usb/musb/tusb6010.c |
3878 | @@ -1069,7 +1069,7 @@ static int tusb_musb_init(struct musb *musb) |
3879 | usb_nop_xceiv_register(); |
3880 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3881 | if (IS_ERR_OR_NULL(musb->xceiv)) |
3882 | - return -ENODEV; |
3883 | + return -EPROBE_DEFER; |
3884 | |
3885 | pdev = to_platform_device(musb->controller); |
3886 | |
3887 | diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c |
3888 | index a27ca1a..13a3929 100644 |
3889 | --- a/drivers/usb/musb/ux500.c |
3890 | +++ b/drivers/usb/musb/ux500.c |
3891 | @@ -61,7 +61,7 @@ static int ux500_musb_init(struct musb *musb) |
3892 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
3893 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
3894 | pr_err("HS USB OTG: no transceiver configured\n"); |
3895 | - return -ENODEV; |
3896 | + return -EPROBE_DEFER; |
3897 | } |
3898 | |
3899 | musb->isr = ux500_musb_interrupt; |
3900 | @@ -108,7 +108,7 @@ static int ux500_probe(struct platform_device *pdev) |
3901 | goto err3; |
3902 | } |
3903 | |
3904 | - ret = clk_enable(clk); |
3905 | + ret = clk_prepare_enable(clk); |
3906 | if (ret) { |
3907 | dev_err(&pdev->dev, "failed to enable clock\n"); |
3908 | goto err4; |
3909 | @@ -148,7 +148,7 @@ static int ux500_probe(struct platform_device *pdev) |
3910 | return 0; |
3911 | |
3912 | err5: |
3913 | - clk_disable(clk); |
3914 | + clk_disable_unprepare(clk); |
3915 | |
3916 | err4: |
3917 | clk_put(clk); |
3918 | @@ -168,7 +168,7 @@ static int ux500_remove(struct platform_device *pdev) |
3919 | struct ux500_glue *glue = platform_get_drvdata(pdev); |
3920 | |
3921 | platform_device_unregister(glue->musb); |
3922 | - clk_disable(glue->clk); |
3923 | + clk_disable_unprepare(glue->clk); |
3924 | clk_put(glue->clk); |
3925 | kfree(glue); |
3926 | |
3927 | @@ -182,7 +182,7 @@ static int ux500_suspend(struct device *dev) |
3928 | struct musb *musb = glue_to_musb(glue); |
3929 | |
3930 | usb_phy_set_suspend(musb->xceiv, 1); |
3931 | - clk_disable(glue->clk); |
3932 | + clk_disable_unprepare(glue->clk); |
3933 | |
3934 | return 0; |
3935 | } |
3936 | @@ -193,7 +193,7 @@ static int ux500_resume(struct device *dev) |
3937 | struct musb *musb = glue_to_musb(glue); |
3938 | int ret; |
3939 | |
3940 | - ret = clk_enable(glue->clk); |
3941 | + ret = clk_prepare_enable(glue->clk); |
3942 | if (ret) { |
3943 | dev_err(dev, "failed to enable clock\n"); |
3944 | return ret; |
3945 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
3946 | index 90ceef1..d07fccf 100644 |
3947 | --- a/drivers/usb/serial/ftdi_sio.c |
3948 | +++ b/drivers/usb/serial/ftdi_sio.c |
3949 | @@ -1886,24 +1886,22 @@ static void ftdi_dtr_rts(struct usb_serial_port *port, int on) |
3950 | { |
3951 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
3952 | |
3953 | - mutex_lock(&port->serial->disc_mutex); |
3954 | - if (!port->serial->disconnected) { |
3955 | - /* Disable flow control */ |
3956 | - if (!on && usb_control_msg(port->serial->dev, |
3957 | + /* Disable flow control */ |
3958 | + if (!on) { |
3959 | + if (usb_control_msg(port->serial->dev, |
3960 | usb_sndctrlpipe(port->serial->dev, 0), |
3961 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, |
3962 | FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, |
3963 | 0, priv->interface, NULL, 0, |
3964 | WDR_TIMEOUT) < 0) { |
3965 | - dev_err(&port->dev, "error from flowcontrol urb\n"); |
3966 | + dev_err(&port->dev, "error from flowcontrol urb\n"); |
3967 | } |
3968 | - /* drop RTS and DTR */ |
3969 | - if (on) |
3970 | - set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
3971 | - else |
3972 | - clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
3973 | } |
3974 | - mutex_unlock(&port->serial->disc_mutex); |
3975 | + /* drop RTS and DTR */ |
3976 | + if (on) |
3977 | + set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
3978 | + else |
3979 | + clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
3980 | } |
3981 | |
3982 | /* |
3983 | diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c |
3984 | index b691175..d9c8651 100644 |
3985 | --- a/drivers/usb/serial/mct_u232.c |
3986 | +++ b/drivers/usb/serial/mct_u232.c |
3987 | @@ -499,19 +499,15 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on) |
3988 | unsigned int control_state; |
3989 | struct mct_u232_private *priv = usb_get_serial_port_data(port); |
3990 | |
3991 | - mutex_lock(&port->serial->disc_mutex); |
3992 | - if (!port->serial->disconnected) { |
3993 | - /* drop DTR and RTS */ |
3994 | - spin_lock_irq(&priv->lock); |
3995 | - if (on) |
3996 | - priv->control_state |= TIOCM_DTR | TIOCM_RTS; |
3997 | - else |
3998 | - priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); |
3999 | - control_state = priv->control_state; |
4000 | - spin_unlock_irq(&priv->lock); |
4001 | - mct_u232_set_modem_ctrl(port, control_state); |
4002 | - } |
4003 | - mutex_unlock(&port->serial->disc_mutex); |
4004 | + spin_lock_irq(&priv->lock); |
4005 | + if (on) |
4006 | + priv->control_state |= TIOCM_DTR | TIOCM_RTS; |
4007 | + else |
4008 | + priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); |
4009 | + control_state = priv->control_state; |
4010 | + spin_unlock_irq(&priv->lock); |
4011 | + |
4012 | + mct_u232_set_modem_ctrl(port, control_state); |
4013 | } |
4014 | |
4015 | static void mct_u232_close(struct usb_serial_port *port) |
4016 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
4017 | index 567bc77..f7d339d 100644 |
4018 | --- a/drivers/usb/serial/option.c |
4019 | +++ b/drivers/usb/serial/option.c |
4020 | @@ -479,6 +479,7 @@ static const struct option_blacklist_info four_g_w14_blacklist = { |
4021 | |
4022 | static const struct option_blacklist_info alcatel_x200_blacklist = { |
4023 | .sendsetup = BIT(0) | BIT(1), |
4024 | + .reserved = BIT(4), |
4025 | }; |
4026 | |
4027 | static const struct option_blacklist_info zte_0037_blacklist = { |
4028 | @@ -575,8 +576,14 @@ static const struct usb_device_id option_ids[] = { |
4029 | { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) }, |
4030 | { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) }, |
4031 | { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, |
4032 | + { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), |
4033 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
4034 | + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) }, |
4035 | + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, |
4036 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), |
4037 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, |
4038 | + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) }, |
4039 | + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1442, USB_CLASS_COMM, 0x02, 0xff) }, |
4040 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), |
4041 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
4042 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), |
4043 | @@ -1215,7 +1222,14 @@ static const struct usb_device_id option_ids[] = { |
4044 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), |
4045 | .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist |
4046 | }, |
4047 | - { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) }, |
4048 | + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D), |
4049 | + .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, |
4050 | + { USB_DEVICE(ALCATEL_VENDOR_ID, 0x0052), |
4051 | + .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, |
4052 | + { USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b6), |
4053 | + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
4054 | + { USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b7), |
4055 | + .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, |
4056 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), |
4057 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
4058 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, |
4059 | diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c |
4060 | index d152be9..a8d5110 100644 |
4061 | --- a/drivers/usb/serial/quatech2.c |
4062 | +++ b/drivers/usb/serial/quatech2.c |
4063 | @@ -945,19 +945,17 @@ static void qt2_dtr_rts(struct usb_serial_port *port, int on) |
4064 | struct usb_device *dev = port->serial->dev; |
4065 | struct qt2_port_private *port_priv = usb_get_serial_port_data(port); |
4066 | |
4067 | - mutex_lock(&port->serial->disc_mutex); |
4068 | - if (!port->serial->disconnected) { |
4069 | - /* Disable flow control */ |
4070 | - if (!on && qt2_setregister(dev, port_priv->device_port, |
4071 | + /* Disable flow control */ |
4072 | + if (!on) { |
4073 | + if (qt2_setregister(dev, port_priv->device_port, |
4074 | UART_MCR, 0) < 0) |
4075 | dev_warn(&port->dev, "error from flowcontrol urb\n"); |
4076 | - /* drop RTS and DTR */ |
4077 | - if (on) |
4078 | - update_mctrl(port_priv, TIOCM_DTR | TIOCM_RTS, 0); |
4079 | - else |
4080 | - update_mctrl(port_priv, 0, TIOCM_DTR | TIOCM_RTS); |
4081 | } |
4082 | - mutex_unlock(&port->serial->disc_mutex); |
4083 | + /* drop RTS and DTR */ |
4084 | + if (on) |
4085 | + update_mctrl(port_priv, TIOCM_DTR | TIOCM_RTS, 0); |
4086 | + else |
4087 | + update_mctrl(port_priv, 0, TIOCM_DTR | TIOCM_RTS); |
4088 | } |
4089 | |
4090 | static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) |
4091 | diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c |
4092 | index af06f2f..d4426c0 100644 |
4093 | --- a/drivers/usb/serial/sierra.c |
4094 | +++ b/drivers/usb/serial/sierra.c |
4095 | @@ -861,19 +861,13 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port) |
4096 | |
4097 | static void sierra_dtr_rts(struct usb_serial_port *port, int on) |
4098 | { |
4099 | - struct usb_serial *serial = port->serial; |
4100 | struct sierra_port_private *portdata; |
4101 | |
4102 | portdata = usb_get_serial_port_data(port); |
4103 | portdata->rts_state = on; |
4104 | portdata->dtr_state = on; |
4105 | |
4106 | - if (serial->dev) { |
4107 | - mutex_lock(&serial->disc_mutex); |
4108 | - if (!serial->disconnected) |
4109 | - sierra_send_setup(port); |
4110 | - mutex_unlock(&serial->disc_mutex); |
4111 | - } |
4112 | + sierra_send_setup(port); |
4113 | } |
4114 | |
4115 | static int sierra_startup(struct usb_serial *serial) |
4116 | diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c |
4117 | index 4543ea3..d938396 100644 |
4118 | --- a/drivers/usb/serial/ssu100.c |
4119 | +++ b/drivers/usb/serial/ssu100.c |
4120 | @@ -506,19 +506,16 @@ static void ssu100_dtr_rts(struct usb_serial_port *port, int on) |
4121 | { |
4122 | struct usb_device *dev = port->serial->dev; |
4123 | |
4124 | - mutex_lock(&port->serial->disc_mutex); |
4125 | - if (!port->serial->disconnected) { |
4126 | - /* Disable flow control */ |
4127 | - if (!on && |
4128 | - ssu100_setregister(dev, 0, UART_MCR, 0) < 0) |
4129 | + /* Disable flow control */ |
4130 | + if (!on) { |
4131 | + if (ssu100_setregister(dev, 0, UART_MCR, 0) < 0) |
4132 | dev_err(&port->dev, "error from flowcontrol urb\n"); |
4133 | - /* drop RTS and DTR */ |
4134 | - if (on) |
4135 | - set_mctrl(dev, TIOCM_DTR | TIOCM_RTS); |
4136 | - else |
4137 | - clear_mctrl(dev, TIOCM_DTR | TIOCM_RTS); |
4138 | } |
4139 | - mutex_unlock(&port->serial->disc_mutex); |
4140 | + /* drop RTS and DTR */ |
4141 | + if (on) |
4142 | + set_mctrl(dev, TIOCM_DTR | TIOCM_RTS); |
4143 | + else |
4144 | + clear_mctrl(dev, TIOCM_DTR | TIOCM_RTS); |
4145 | } |
4146 | |
4147 | static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) |
4148 | diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
4149 | index 64bda13..15af799 100644 |
4150 | --- a/drivers/usb/serial/usb-serial.c |
4151 | +++ b/drivers/usb/serial/usb-serial.c |
4152 | @@ -688,10 +688,20 @@ static int serial_carrier_raised(struct tty_port *port) |
4153 | static void serial_dtr_rts(struct tty_port *port, int on) |
4154 | { |
4155 | struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); |
4156 | - struct usb_serial_driver *drv = p->serial->type; |
4157 | + struct usb_serial *serial = p->serial; |
4158 | + struct usb_serial_driver *drv = serial->type; |
4159 | |
4160 | - if (drv->dtr_rts) |
4161 | + if (!drv->dtr_rts) |
4162 | + return; |
4163 | + /* |
4164 | + * Work-around bug in the tty-layer which can result in dtr_rts |
4165 | + * being called after a disconnect (and tty_unregister_device |
4166 | + * has returned). Remove once bug has been squashed. |
4167 | + */ |
4168 | + mutex_lock(&serial->disc_mutex); |
4169 | + if (!serial->disconnected) |
4170 | drv->dtr_rts(p, on); |
4171 | + mutex_unlock(&serial->disc_mutex); |
4172 | } |
4173 | |
4174 | static const struct tty_port_operations serial_port_ops = { |
4175 | diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c |
4176 | index 01c94aa..1355a6c 100644 |
4177 | --- a/drivers/usb/serial/usb_wwan.c |
4178 | +++ b/drivers/usb/serial/usb_wwan.c |
4179 | @@ -38,7 +38,6 @@ |
4180 | |
4181 | void usb_wwan_dtr_rts(struct usb_serial_port *port, int on) |
4182 | { |
4183 | - struct usb_serial *serial = port->serial; |
4184 | struct usb_wwan_port_private *portdata; |
4185 | struct usb_wwan_intf_private *intfdata; |
4186 | |
4187 | @@ -48,12 +47,11 @@ void usb_wwan_dtr_rts(struct usb_serial_port *port, int on) |
4188 | return; |
4189 | |
4190 | portdata = usb_get_serial_port_data(port); |
4191 | - mutex_lock(&serial->disc_mutex); |
4192 | + /* FIXME: locking */ |
4193 | portdata->rts_state = on; |
4194 | portdata->dtr_state = on; |
4195 | - if (serial->dev) |
4196 | - intfdata->send_setup(port); |
4197 | - mutex_unlock(&serial->disc_mutex); |
4198 | + |
4199 | + intfdata->send_setup(port); |
4200 | } |
4201 | EXPORT_SYMBOL(usb_wwan_dtr_rts); |
4202 | |
4203 | diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c |
4204 | index 16b0bf0..7ab9046 100644 |
4205 | --- a/drivers/usb/storage/initializers.c |
4206 | +++ b/drivers/usb/storage/initializers.c |
4207 | @@ -147,7 +147,7 @@ static int usb_stor_huawei_dongles_pid(struct us_data *us) |
4208 | int idProduct; |
4209 | |
4210 | idesc = &us->pusb_intf->cur_altsetting->desc; |
4211 | - idProduct = us->pusb_dev->descriptor.idProduct; |
4212 | + idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct); |
4213 | /* The first port is CDROM, |
4214 | * means the dongle in the single port mode, |
4215 | * and a switch command is required to be sent. */ |
4216 | @@ -169,7 +169,7 @@ int usb_stor_huawei_init(struct us_data *us) |
4217 | int result = 0; |
4218 | |
4219 | if (usb_stor_huawei_dongles_pid(us)) { |
4220 | - if (us->pusb_dev->descriptor.idProduct >= 0x1446) |
4221 | + if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446) |
4222 | result = usb_stor_huawei_scsi_init(us); |
4223 | else |
4224 | result = usb_stor_huawei_feature_init(us); |
4225 | diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h |
4226 | index 2c85530..65a6a75 100644 |
4227 | --- a/drivers/usb/storage/unusual_cypress.h |
4228 | +++ b/drivers/usb/storage/unusual_cypress.h |
4229 | @@ -31,7 +31,7 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999, |
4230 | "Cypress ISD-300LP", |
4231 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
4232 | |
4233 | -UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999, |
4234 | +UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x0219, |
4235 | "Super Top", |
4236 | "USB 2.0 SATA BRIDGE", |
4237 | USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0), |
4238 | diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c |
4239 | index 6bb72c0..a77c9ca 100644 |
4240 | --- a/drivers/video/backlight/adp8860_bl.c |
4241 | +++ b/drivers/video/backlight/adp8860_bl.c |
4242 | @@ -783,7 +783,7 @@ static int adp8860_i2c_suspend(struct i2c_client *client, pm_message_t message) |
4243 | |
4244 | static int adp8860_i2c_resume(struct i2c_client *client) |
4245 | { |
4246 | - adp8860_set_bits(client, ADP8860_MDCR, NSTBY); |
4247 | + adp8860_set_bits(client, ADP8860_MDCR, NSTBY | BLEN); |
4248 | |
4249 | return 0; |
4250 | } |
4251 | diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c |
4252 | index 63c882b..712c25a 100644 |
4253 | --- a/drivers/video/backlight/adp8870_bl.c |
4254 | +++ b/drivers/video/backlight/adp8870_bl.c |
4255 | @@ -957,7 +957,7 @@ static int adp8870_i2c_suspend(struct i2c_client *client, pm_message_t message) |
4256 | |
4257 | static int adp8870_i2c_resume(struct i2c_client *client) |
4258 | { |
4259 | - adp8870_set_bits(client, ADP8870_MDCR, NSTBY); |
4260 | + adp8870_set_bits(client, ADP8870_MDCR, NSTBY | BLEN); |
4261 | |
4262 | return 0; |
4263 | } |
4264 | diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c |
4265 | index fdefa8f..501c599 100644 |
4266 | --- a/drivers/video/console/fbcon.c |
4267 | +++ b/drivers/video/console/fbcon.c |
4268 | @@ -529,6 +529,33 @@ static int search_for_mapped_con(void) |
4269 | return retval; |
4270 | } |
4271 | |
4272 | +static int do_fbcon_takeover(int show_logo) |
4273 | +{ |
4274 | + int err, i; |
4275 | + |
4276 | + if (!num_registered_fb) |
4277 | + return -ENODEV; |
4278 | + |
4279 | + if (!show_logo) |
4280 | + logo_shown = FBCON_LOGO_DONTSHOW; |
4281 | + |
4282 | + for (i = first_fb_vc; i <= last_fb_vc; i++) |
4283 | + con2fb_map[i] = info_idx; |
4284 | + |
4285 | + err = do_take_over_console(&fb_con, first_fb_vc, last_fb_vc, |
4286 | + fbcon_is_default); |
4287 | + |
4288 | + if (err) { |
4289 | + for (i = first_fb_vc; i <= last_fb_vc; i++) |
4290 | + con2fb_map[i] = -1; |
4291 | + info_idx = -1; |
4292 | + } else { |
4293 | + fbcon_has_console_bind = 1; |
4294 | + } |
4295 | + |
4296 | + return err; |
4297 | +} |
4298 | + |
4299 | static int fbcon_takeover(int show_logo) |
4300 | { |
4301 | int err, i; |
4302 | @@ -815,6 +842,8 @@ static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, |
4303 | * |
4304 | * Maps a virtual console @unit to a frame buffer device |
4305 | * @newidx. |
4306 | + * |
4307 | + * This should be called with the console lock held. |
4308 | */ |
4309 | static int set_con2fb_map(int unit, int newidx, int user) |
4310 | { |
4311 | @@ -832,7 +861,7 @@ static int set_con2fb_map(int unit, int newidx, int user) |
4312 | |
4313 | if (!search_for_mapped_con() || !con_is_bound(&fb_con)) { |
4314 | info_idx = newidx; |
4315 | - return fbcon_takeover(0); |
4316 | + return do_fbcon_takeover(0); |
4317 | } |
4318 | |
4319 | if (oldidx != -1) |
4320 | @@ -840,7 +869,6 @@ static int set_con2fb_map(int unit, int newidx, int user) |
4321 | |
4322 | found = search_fb_in_map(newidx); |
4323 | |
4324 | - console_lock(); |
4325 | con2fb_map[unit] = newidx; |
4326 | if (!err && !found) |
4327 | err = con2fb_acquire_newinfo(vc, info, unit, oldidx); |
4328 | @@ -867,7 +895,6 @@ static int set_con2fb_map(int unit, int newidx, int user) |
4329 | if (!search_fb_in_map(info_idx)) |
4330 | info_idx = newidx; |
4331 | |
4332 | - console_unlock(); |
4333 | return err; |
4334 | } |
4335 | |
4336 | @@ -990,7 +1017,7 @@ static const char *fbcon_startup(void) |
4337 | } |
4338 | |
4339 | /* Setup default font */ |
4340 | - if (!p->fontdata) { |
4341 | + if (!p->fontdata && !vc->vc_font.data) { |
4342 | if (!fontname[0] || !(font = find_font(fontname))) |
4343 | font = get_default_font(info->var.xres, |
4344 | info->var.yres, |
4345 | @@ -1000,6 +1027,8 @@ static const char *fbcon_startup(void) |
4346 | vc->vc_font.height = font->height; |
4347 | vc->vc_font.data = (void *)(p->fontdata = font->data); |
4348 | vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */ |
4349 | + } else { |
4350 | + p->fontdata = vc->vc_font.data; |
4351 | } |
4352 | |
4353 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
4354 | @@ -1159,9 +1188,9 @@ static void fbcon_init(struct vc_data *vc, int init) |
4355 | ops->p = &fb_display[fg_console]; |
4356 | } |
4357 | |
4358 | -static void fbcon_free_font(struct display *p) |
4359 | +static void fbcon_free_font(struct display *p, bool freefont) |
4360 | { |
4361 | - if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) |
4362 | + if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) |
4363 | kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int)); |
4364 | p->fontdata = NULL; |
4365 | p->userfont = 0; |
4366 | @@ -1173,8 +1202,8 @@ static void fbcon_deinit(struct vc_data *vc) |
4367 | struct fb_info *info; |
4368 | struct fbcon_ops *ops; |
4369 | int idx; |
4370 | + bool free_font = true; |
4371 | |
4372 | - fbcon_free_font(p); |
4373 | idx = con2fb_map[vc->vc_num]; |
4374 | |
4375 | if (idx == -1) |
4376 | @@ -1185,6 +1214,8 @@ static void fbcon_deinit(struct vc_data *vc) |
4377 | if (!info) |
4378 | goto finished; |
4379 | |
4380 | + if (info->flags & FBINFO_MISC_FIRMWARE) |
4381 | + free_font = false; |
4382 | ops = info->fbcon_par; |
4383 | |
4384 | if (!ops) |
4385 | @@ -1196,6 +1227,8 @@ static void fbcon_deinit(struct vc_data *vc) |
4386 | ops->flags &= ~FBCON_FLAGS_INIT; |
4387 | finished: |
4388 | |
4389 | + fbcon_free_font(p, free_font); |
4390 | + |
4391 | if (!con_is_bound(&fb_con)) |
4392 | fbcon_exit(); |
4393 | |
4394 | @@ -2977,7 +3010,7 @@ static int fbcon_unbind(void) |
4395 | { |
4396 | int ret; |
4397 | |
4398 | - ret = unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc, |
4399 | + ret = do_unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc, |
4400 | fbcon_is_default); |
4401 | |
4402 | if (!ret) |
4403 | @@ -2992,6 +3025,7 @@ static inline int fbcon_unbind(void) |
4404 | } |
4405 | #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ |
4406 | |
4407 | +/* called with console_lock held */ |
4408 | static int fbcon_fb_unbind(int idx) |
4409 | { |
4410 | int i, new_idx = -1, ret = 0; |
4411 | @@ -3018,6 +3052,7 @@ static int fbcon_fb_unbind(int idx) |
4412 | return ret; |
4413 | } |
4414 | |
4415 | +/* called with console_lock held */ |
4416 | static int fbcon_fb_unregistered(struct fb_info *info) |
4417 | { |
4418 | int i, idx; |
4419 | @@ -3050,11 +3085,12 @@ static int fbcon_fb_unregistered(struct fb_info *info) |
4420 | primary_device = -1; |
4421 | |
4422 | if (!num_registered_fb) |
4423 | - unregister_con_driver(&fb_con); |
4424 | + do_unregister_con_driver(&fb_con); |
4425 | |
4426 | return 0; |
4427 | } |
4428 | |
4429 | +/* called with console_lock held */ |
4430 | static void fbcon_remap_all(int idx) |
4431 | { |
4432 | int i; |
4433 | @@ -3099,6 +3135,7 @@ static inline void fbcon_select_primary(struct fb_info *info) |
4434 | } |
4435 | #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */ |
4436 | |
4437 | +/* called with console_lock held */ |
4438 | static int fbcon_fb_registered(struct fb_info *info) |
4439 | { |
4440 | int ret = 0, i, idx; |
4441 | @@ -3115,7 +3152,7 @@ static int fbcon_fb_registered(struct fb_info *info) |
4442 | } |
4443 | |
4444 | if (info_idx != -1) |
4445 | - ret = fbcon_takeover(1); |
4446 | + ret = do_fbcon_takeover(1); |
4447 | } else { |
4448 | for (i = first_fb_vc; i <= last_fb_vc; i++) { |
4449 | if (con2fb_map_boot[i] == idx) |
4450 | @@ -3251,6 +3288,7 @@ static int fbcon_event_notify(struct notifier_block *self, |
4451 | ret = fbcon_fb_unregistered(info); |
4452 | break; |
4453 | case FB_EVENT_SET_CONSOLE_MAP: |
4454 | + /* called with console lock held */ |
4455 | con2fb = event->data; |
4456 | ret = set_con2fb_map(con2fb->console - 1, |
4457 | con2fb->framebuffer, 1); |
4458 | diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c |
4459 | index d449a74..5855d17 100644 |
4460 | --- a/drivers/video/console/vgacon.c |
4461 | +++ b/drivers/video/console/vgacon.c |
4462 | @@ -1064,7 +1064,7 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512) |
4463 | unsigned short video_port_status = vga_video_port_reg + 6; |
4464 | int font_select = 0x00, beg, i; |
4465 | char *charmap; |
4466 | - |
4467 | + bool clear_attribs = false; |
4468 | if (vga_video_type != VIDEO_TYPE_EGAM) { |
4469 | charmap = (char *) VGA_MAP_MEM(colourmap, 0); |
4470 | beg = 0x0e; |
4471 | @@ -1169,12 +1169,6 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512) |
4472 | |
4473 | /* if 512 char mode is already enabled don't re-enable it. */ |
4474 | if ((set) && (ch512 != vga_512_chars)) { |
4475 | - /* attribute controller */ |
4476 | - for (i = 0; i < MAX_NR_CONSOLES; i++) { |
4477 | - struct vc_data *c = vc_cons[i].d; |
4478 | - if (c && c->vc_sw == &vga_con) |
4479 | - c->vc_hi_font_mask = ch512 ? 0x0800 : 0; |
4480 | - } |
4481 | vga_512_chars = ch512; |
4482 | /* 256-char: enable intensity bit |
4483 | 512-char: disable intensity bit */ |
4484 | @@ -1185,8 +1179,22 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512) |
4485 | it means, but it works, and it appears necessary */ |
4486 | inb_p(video_port_status); |
4487 | vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0); |
4488 | + clear_attribs = true; |
4489 | } |
4490 | raw_spin_unlock_irq(&vga_lock); |
4491 | + |
4492 | + if (clear_attribs) { |
4493 | + for (i = 0; i < MAX_NR_CONSOLES; i++) { |
4494 | + struct vc_data *c = vc_cons[i].d; |
4495 | + if (c && c->vc_sw == &vga_con) { |
4496 | + /* force hi font mask to 0, so we always clear |
4497 | + the bit on either transition */ |
4498 | + c->vc_hi_font_mask = 0x00; |
4499 | + clear_buffer_attributes(c); |
4500 | + c->vc_hi_font_mask = ch512 ? 0x0800 : 0; |
4501 | + } |
4502 | + } |
4503 | + } |
4504 | return 0; |
4505 | } |
4506 | |
4507 | diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c |
4508 | index 3ff0105..dc61c12 100644 |
4509 | --- a/drivers/video/fbmem.c |
4510 | +++ b/drivers/video/fbmem.c |
4511 | @@ -1177,8 +1177,10 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, |
4512 | event.data = &con2fb; |
4513 | if (!lock_fb_info(info)) |
4514 | return -ENODEV; |
4515 | + console_lock(); |
4516 | event.info = info; |
4517 | ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event); |
4518 | + console_unlock(); |
4519 | unlock_fb_info(info); |
4520 | break; |
4521 | case FBIOBLANK: |
4522 | @@ -1650,7 +1652,9 @@ static int do_register_framebuffer(struct fb_info *fb_info) |
4523 | event.info = fb_info; |
4524 | if (!lock_fb_info(fb_info)) |
4525 | return -ENODEV; |
4526 | + console_lock(); |
4527 | fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); |
4528 | + console_unlock(); |
4529 | unlock_fb_info(fb_info); |
4530 | return 0; |
4531 | } |
4532 | @@ -1666,8 +1670,10 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
4533 | |
4534 | if (!lock_fb_info(fb_info)) |
4535 | return -ENODEV; |
4536 | + console_lock(); |
4537 | event.info = fb_info; |
4538 | ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); |
4539 | + console_unlock(); |
4540 | unlock_fb_info(fb_info); |
4541 | |
4542 | if (ret) |
4543 | @@ -1682,7 +1688,9 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
4544 | num_registered_fb--; |
4545 | fb_cleanup_device(fb_info); |
4546 | event.info = fb_info; |
4547 | + console_lock(); |
4548 | fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); |
4549 | + console_unlock(); |
4550 | |
4551 | /* this may free fb info */ |
4552 | put_fb_info(fb_info); |
4553 | @@ -1853,11 +1861,8 @@ int fb_new_modelist(struct fb_info *info) |
4554 | err = 1; |
4555 | |
4556 | if (!list_empty(&info->modelist)) { |
4557 | - if (!lock_fb_info(info)) |
4558 | - return -ENODEV; |
4559 | event.info = info; |
4560 | err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); |
4561 | - unlock_fb_info(info); |
4562 | } |
4563 | |
4564 | return err; |
4565 | diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c |
4566 | index a55e366..ef476b0 100644 |
4567 | --- a/drivers/video/fbsysfs.c |
4568 | +++ b/drivers/video/fbsysfs.c |
4569 | @@ -177,6 +177,8 @@ static ssize_t store_modes(struct device *device, |
4570 | if (i * sizeof(struct fb_videomode) != count) |
4571 | return -EINVAL; |
4572 | |
4573 | + if (!lock_fb_info(fb_info)) |
4574 | + return -ENODEV; |
4575 | console_lock(); |
4576 | list_splice(&fb_info->modelist, &old_list); |
4577 | fb_videomode_to_modelist((const struct fb_videomode *)buf, i, |
4578 | @@ -188,6 +190,7 @@ static ssize_t store_modes(struct device *device, |
4579 | fb_destroy_modelist(&old_list); |
4580 | |
4581 | console_unlock(); |
4582 | + unlock_fb_info(fb_info); |
4583 | |
4584 | return 0; |
4585 | } |
4586 | diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c |
4587 | index 19cfd7a..41fbd94 100644 |
4588 | --- a/drivers/video/fsl-diu-fb.c |
4589 | +++ b/drivers/video/fsl-diu-fb.c |
4590 | @@ -944,7 +944,7 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel) |
4591 | #define PF_COMP_0_MASK 0x0000000F |
4592 | #define PF_COMP_0_SHIFT 0 |
4593 | |
4594 | -#define MAKE_PF(alpha, red, blue, green, size, c0, c1, c2, c3) \ |
4595 | +#define MAKE_PF(alpha, red, green, blue, size, c0, c1, c2, c3) \ |
4596 | cpu_to_le32(PF_BYTE_F | (alpha << PF_ALPHA_C_SHIFT) | \ |
4597 | (blue << PF_BLUE_C_SHIFT) | (green << PF_GREEN_C_SHIFT) | \ |
4598 | (red << PF_RED_C_SHIFT) | (c3 << PF_COMP_3_SHIFT) | \ |
4599 | @@ -954,10 +954,10 @@ static u32 fsl_diu_get_pixel_format(unsigned int bits_per_pixel) |
4600 | switch (bits_per_pixel) { |
4601 | case 32: |
4602 | /* 0x88883316 */ |
4603 | - return MAKE_PF(3, 2, 0, 1, 3, 8, 8, 8, 8); |
4604 | + return MAKE_PF(3, 2, 1, 0, 3, 8, 8, 8, 8); |
4605 | case 24: |
4606 | /* 0x88082219 */ |
4607 | - return MAKE_PF(4, 0, 1, 2, 2, 0, 8, 8, 8); |
4608 | + return MAKE_PF(4, 0, 1, 2, 2, 8, 8, 8, 0); |
4609 | case 16: |
4610 | /* 0x65053118 */ |
4611 | return MAKE_PF(4, 2, 1, 0, 1, 5, 6, 5, 0); |
4612 | @@ -1232,6 +1232,16 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, |
4613 | return 0; |
4614 | } |
4615 | |
4616 | +static inline void fsl_diu_enable_interrupts(struct fsl_diu_data *data) |
4617 | +{ |
4618 | + u32 int_mask = INT_UNDRUN; /* enable underrun detection */ |
4619 | + |
4620 | + if (IS_ENABLED(CONFIG_NOT_COHERENT_CACHE)) |
4621 | + int_mask |= INT_VSYNC; /* enable vertical sync */ |
4622 | + |
4623 | + clrbits32(&data->diu_reg->int_mask, int_mask); |
4624 | +} |
4625 | + |
4626 | /* turn on fb if count == 1 |
4627 | */ |
4628 | static int fsl_diu_open(struct fb_info *info, int user) |
4629 | @@ -1251,19 +1261,7 @@ static int fsl_diu_open(struct fb_info *info, int user) |
4630 | if (res < 0) |
4631 | mfbi->count--; |
4632 | else { |
4633 | - struct fsl_diu_data *data = mfbi->parent; |
4634 | - |
4635 | -#ifdef CONFIG_NOT_COHERENT_CACHE |
4636 | - /* |
4637 | - * Enable underrun detection and vertical sync |
4638 | - * interrupts. |
4639 | - */ |
4640 | - clrbits32(&data->diu_reg->int_mask, |
4641 | - INT_UNDRUN | INT_VSYNC); |
4642 | -#else |
4643 | - /* Enable underrun detection */ |
4644 | - clrbits32(&data->diu_reg->int_mask, INT_UNDRUN); |
4645 | -#endif |
4646 | + fsl_diu_enable_interrupts(mfbi->parent); |
4647 | fsl_diu_enable_panel(info); |
4648 | } |
4649 | } |
4650 | @@ -1283,9 +1281,18 @@ static int fsl_diu_release(struct fb_info *info, int user) |
4651 | mfbi->count--; |
4652 | if (mfbi->count == 0) { |
4653 | struct fsl_diu_data *data = mfbi->parent; |
4654 | + bool disable = true; |
4655 | + int i; |
4656 | |
4657 | - /* Disable interrupts */ |
4658 | - out_be32(&data->diu_reg->int_mask, 0xffffffff); |
4659 | + /* Disable interrupts only if all AOIs are closed */ |
4660 | + for (i = 0; i < NUM_AOIS; i++) { |
4661 | + struct mfb_info *mi = data->fsl_diu_info[i].par; |
4662 | + |
4663 | + if (mi->count) |
4664 | + disable = false; |
4665 | + } |
4666 | + if (disable) |
4667 | + out_be32(&data->diu_reg->int_mask, 0xffffffff); |
4668 | fsl_diu_disable_panel(info); |
4669 | } |
4670 | |
4671 | @@ -1614,14 +1621,6 @@ static int fsl_diu_probe(struct platform_device *pdev) |
4672 | out_be32(&data->diu_reg->desc[1], data->dummy_ad.paddr); |
4673 | out_be32(&data->diu_reg->desc[2], data->dummy_ad.paddr); |
4674 | |
4675 | - for (i = 0; i < NUM_AOIS; i++) { |
4676 | - ret = install_fb(&data->fsl_diu_info[i]); |
4677 | - if (ret) { |
4678 | - dev_err(&pdev->dev, "could not register fb %d\n", i); |
4679 | - goto error; |
4680 | - } |
4681 | - } |
4682 | - |
4683 | /* |
4684 | * Older versions of U-Boot leave interrupts enabled, so disable |
4685 | * all of them and clear the status register. |
4686 | @@ -1630,12 +1629,21 @@ static int fsl_diu_probe(struct platform_device *pdev) |
4687 | in_be32(&data->diu_reg->int_status); |
4688 | |
4689 | ret = request_irq(data->irq, fsl_diu_isr, 0, "fsl-diu-fb", |
4690 | - &data->diu_reg); |
4691 | + data->diu_reg); |
4692 | if (ret) { |
4693 | dev_err(&pdev->dev, "could not claim irq\n"); |
4694 | goto error; |
4695 | } |
4696 | |
4697 | + for (i = 0; i < NUM_AOIS; i++) { |
4698 | + ret = install_fb(&data->fsl_diu_info[i]); |
4699 | + if (ret) { |
4700 | + dev_err(&pdev->dev, "could not register fb %d\n", i); |
4701 | + free_irq(data->irq, data->diu_reg); |
4702 | + goto error; |
4703 | + } |
4704 | + } |
4705 | + |
4706 | sysfs_attr_init(&data->dev_attr.attr); |
4707 | data->dev_attr.attr.name = "monitor"; |
4708 | data->dev_attr.attr.mode = S_IRUGO|S_IWUSR; |
4709 | @@ -1667,7 +1675,7 @@ static int fsl_diu_remove(struct platform_device *pdev) |
4710 | data = dev_get_drvdata(&pdev->dev); |
4711 | disable_lcdc(&data->fsl_diu_info[0]); |
4712 | |
4713 | - free_irq(data->irq, &data->diu_reg); |
4714 | + free_irq(data->irq, data->diu_reg); |
4715 | |
4716 | for (i = 0; i < NUM_AOIS; i++) |
4717 | uninstall_fb(&data->fsl_diu_info[i]); |
4718 | diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c |
4719 | index b1f60a0..b2db77e 100644 |
4720 | --- a/drivers/xen/evtchn.c |
4721 | +++ b/drivers/xen/evtchn.c |
4722 | @@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port) |
4723 | u->name, (void *)(unsigned long)port); |
4724 | if (rc >= 0) |
4725 | rc = evtchn_make_refcounted(port); |
4726 | + else { |
4727 | + /* bind failed, should close the port now */ |
4728 | + struct evtchn_close close; |
4729 | + close.port = port; |
4730 | + if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) |
4731 | + BUG(); |
4732 | + set_port_user(port, NULL); |
4733 | + } |
4734 | |
4735 | return rc; |
4736 | } |
4737 | @@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port) |
4738 | { |
4739 | int irq = irq_from_evtchn(port); |
4740 | |
4741 | + BUG_ON(irq < 0); |
4742 | + |
4743 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); |
4744 | |
4745 | set_port_user(port, NULL); |
4746 | diff --git a/fs/block_dev.c b/fs/block_dev.c |
4747 | index 172f849..78333a3 100644 |
4748 | --- a/fs/block_dev.c |
4749 | +++ b/fs/block_dev.c |
4750 | @@ -994,6 +994,7 @@ int revalidate_disk(struct gendisk *disk) |
4751 | |
4752 | mutex_lock(&bdev->bd_mutex); |
4753 | check_disk_size_change(disk, bdev); |
4754 | + bdev->bd_invalidated = 0; |
4755 | mutex_unlock(&bdev->bd_mutex); |
4756 | bdput(bdev); |
4757 | return ret; |
4758 | diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c |
4759 | index a68e91b..9a3945a 100644 |
4760 | --- a/fs/gfs2/bmap.c |
4761 | +++ b/fs/gfs2/bmap.c |
4762 | @@ -1286,6 +1286,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize) |
4763 | |
4764 | inode_dio_wait(inode); |
4765 | |
4766 | + ret = gfs2_rs_alloc(GFS2_I(inode)); |
4767 | + if (ret) |
4768 | + return ret; |
4769 | + |
4770 | oldsize = inode->i_size; |
4771 | if (newsize >= oldsize) |
4772 | return do_grow(inode, newsize); |
4773 | diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c |
4774 | index 54f9e6c..52e5120 100644 |
4775 | --- a/fs/lockd/clntproc.c |
4776 | +++ b/fs/lockd/clntproc.c |
4777 | @@ -550,6 +550,9 @@ again: |
4778 | status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); |
4779 | if (status < 0) |
4780 | break; |
4781 | + /* Resend the blocking lock request after a server reboot */ |
4782 | + if (resp->status == nlm_lck_denied_grace_period) |
4783 | + continue; |
4784 | if (resp->status != nlm_lck_blocked) |
4785 | break; |
4786 | } |
4787 | diff --git a/fs/namespace.c b/fs/namespace.c |
4788 | index 55605c5..a51054f 100644 |
4789 | --- a/fs/namespace.c |
4790 | +++ b/fs/namespace.c |
4791 | @@ -1238,6 +1238,14 @@ static int do_umount(struct mount *mnt, int flags) |
4792 | } |
4793 | |
4794 | /* |
4795 | + * Is the caller allowed to modify his namespace? |
4796 | + */ |
4797 | +static inline bool may_mount(void) |
4798 | +{ |
4799 | + return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN); |
4800 | +} |
4801 | + |
4802 | +/* |
4803 | * Now umount can handle mount points as well as block devices. |
4804 | * This is important for filesystems which use unnamed block devices. |
4805 | * |
4806 | @@ -1255,6 +1263,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) |
4807 | if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW)) |
4808 | return -EINVAL; |
4809 | |
4810 | + if (!may_mount()) |
4811 | + return -EPERM; |
4812 | + |
4813 | if (!(flags & UMOUNT_NOFOLLOW)) |
4814 | lookup_flags |= LOOKUP_FOLLOW; |
4815 | |
4816 | @@ -1268,10 +1279,6 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) |
4817 | if (!check_mnt(mnt)) |
4818 | goto dput_and_out; |
4819 | |
4820 | - retval = -EPERM; |
4821 | - if (!ns_capable(mnt->mnt_ns->user_ns, CAP_SYS_ADMIN)) |
4822 | - goto dput_and_out; |
4823 | - |
4824 | retval = do_umount(mnt, flags); |
4825 | dput_and_out: |
4826 | /* we mustn't call path_put() as that would clear mnt_expiry_mark */ |
4827 | @@ -1295,7 +1302,7 @@ SYSCALL_DEFINE1(oldumount, char __user *, name) |
4828 | |
4829 | static int mount_is_safe(struct path *path) |
4830 | { |
4831 | - if (ns_capable(real_mount(path->mnt)->mnt_ns->user_ns, CAP_SYS_ADMIN)) |
4832 | + if (may_mount()) |
4833 | return 0; |
4834 | return -EPERM; |
4835 | #ifdef notyet |
4836 | @@ -1633,7 +1640,7 @@ static int do_change_type(struct path *path, int flag) |
4837 | int type; |
4838 | int err = 0; |
4839 | |
4840 | - if (!ns_capable(mnt->mnt_ns->user_ns, CAP_SYS_ADMIN)) |
4841 | + if (!may_mount()) |
4842 | return -EPERM; |
4843 | |
4844 | if (path->dentry != path->mnt->mnt_root) |
4845 | @@ -1797,7 +1804,7 @@ static int do_move_mount(struct path *path, const char *old_name) |
4846 | struct mount *p; |
4847 | struct mount *old; |
4848 | int err = 0; |
4849 | - if (!ns_capable(real_mount(path->mnt)->mnt_ns->user_ns, CAP_SYS_ADMIN)) |
4850 | + if (!may_mount()) |
4851 | return -EPERM; |
4852 | if (!old_name || !*old_name) |
4853 | return -EINVAL; |
4854 | @@ -1933,16 +1940,14 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, |
4855 | int mnt_flags, const char *name, void *data) |
4856 | { |
4857 | struct file_system_type *type; |
4858 | - struct user_namespace *user_ns; |
4859 | + struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns; |
4860 | struct vfsmount *mnt; |
4861 | int err; |
4862 | |
4863 | if (!fstype) |
4864 | return -EINVAL; |
4865 | |
4866 | - /* we need capabilities... */ |
4867 | - user_ns = real_mount(path->mnt)->mnt_ns->user_ns; |
4868 | - if (!ns_capable(user_ns, CAP_SYS_ADMIN)) |
4869 | + if (!may_mount()) |
4870 | return -EPERM; |
4871 | |
4872 | type = get_fs_type(fstype); |
4873 | @@ -2567,7 +2572,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, |
4874 | struct mount *new_mnt, *root_mnt; |
4875 | int error; |
4876 | |
4877 | - if (!ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN)) |
4878 | + if (!may_mount()) |
4879 | return -EPERM; |
4880 | |
4881 | error = user_path_dir(new_root, &new); |
4882 | diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c |
4883 | index 4fa788c..434b93e 100644 |
4884 | --- a/fs/nfs/blocklayout/blocklayout.c |
4885 | +++ b/fs/nfs/blocklayout/blocklayout.c |
4886 | @@ -1273,6 +1273,7 @@ static const struct nfs_pageio_ops bl_pg_write_ops = { |
4887 | static struct pnfs_layoutdriver_type blocklayout_type = { |
4888 | .id = LAYOUT_BLOCK_VOLUME, |
4889 | .name = "LAYOUT_BLOCK_VOLUME", |
4890 | + .owner = THIS_MODULE, |
4891 | .read_pagelist = bl_read_pagelist, |
4892 | .write_pagelist = bl_write_pagelist, |
4893 | .alloc_layout_hdr = bl_alloc_layout_hdr, |
4894 | diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c |
4895 | index 264d1aa..2960512 100644 |
4896 | --- a/fs/nfs/callback_proc.c |
4897 | +++ b/fs/nfs/callback_proc.c |
4898 | @@ -183,60 +183,15 @@ static u32 initiate_file_draining(struct nfs_client *clp, |
4899 | static u32 initiate_bulk_draining(struct nfs_client *clp, |
4900 | struct cb_layoutrecallargs *args) |
4901 | { |
4902 | - struct nfs_server *server; |
4903 | - struct pnfs_layout_hdr *lo; |
4904 | - struct inode *ino; |
4905 | - u32 rv = NFS4ERR_NOMATCHING_LAYOUT; |
4906 | - struct pnfs_layout_hdr *tmp; |
4907 | - LIST_HEAD(recall_list); |
4908 | - LIST_HEAD(free_me_list); |
4909 | - struct pnfs_layout_range range = { |
4910 | - .iomode = IOMODE_ANY, |
4911 | - .offset = 0, |
4912 | - .length = NFS4_MAX_UINT64, |
4913 | - }; |
4914 | - |
4915 | - spin_lock(&clp->cl_lock); |
4916 | - rcu_read_lock(); |
4917 | - list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
4918 | - if ((args->cbl_recall_type == RETURN_FSID) && |
4919 | - memcmp(&server->fsid, &args->cbl_fsid, |
4920 | - sizeof(struct nfs_fsid))) |
4921 | - continue; |
4922 | + int stat; |
4923 | |
4924 | - list_for_each_entry(lo, &server->layouts, plh_layouts) { |
4925 | - ino = igrab(lo->plh_inode); |
4926 | - if (!ino) |
4927 | - continue; |
4928 | - spin_lock(&ino->i_lock); |
4929 | - /* Is this layout in the process of being freed? */ |
4930 | - if (NFS_I(ino)->layout != lo) { |
4931 | - spin_unlock(&ino->i_lock); |
4932 | - iput(ino); |
4933 | - continue; |
4934 | - } |
4935 | - pnfs_get_layout_hdr(lo); |
4936 | - spin_unlock(&ino->i_lock); |
4937 | - list_add(&lo->plh_bulk_recall, &recall_list); |
4938 | - } |
4939 | - } |
4940 | - rcu_read_unlock(); |
4941 | - spin_unlock(&clp->cl_lock); |
4942 | - |
4943 | - list_for_each_entry_safe(lo, tmp, |
4944 | - &recall_list, plh_bulk_recall) { |
4945 | - ino = lo->plh_inode; |
4946 | - spin_lock(&ino->i_lock); |
4947 | - set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); |
4948 | - if (pnfs_mark_matching_lsegs_invalid(lo, &free_me_list, &range)) |
4949 | - rv = NFS4ERR_DELAY; |
4950 | - list_del_init(&lo->plh_bulk_recall); |
4951 | - spin_unlock(&ino->i_lock); |
4952 | - pnfs_free_lseg_list(&free_me_list); |
4953 | - pnfs_put_layout_hdr(lo); |
4954 | - iput(ino); |
4955 | - } |
4956 | - return rv; |
4957 | + if (args->cbl_recall_type == RETURN_FSID) |
4958 | + stat = pnfs_destroy_layouts_byfsid(clp, &args->cbl_fsid, true); |
4959 | + else |
4960 | + stat = pnfs_destroy_layouts_byclid(clp, true); |
4961 | + if (stat != 0) |
4962 | + return NFS4ERR_DELAY; |
4963 | + return NFS4ERR_NOMATCHING_LAYOUT; |
4964 | } |
4965 | |
4966 | static u32 do_callback_layoutrecall(struct nfs_client *clp, |
4967 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
4968 | index cf747ef..efda60d 100644 |
4969 | --- a/fs/nfs/nfs4proc.c |
4970 | +++ b/fs/nfs/nfs4proc.c |
4971 | @@ -1463,7 +1463,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) |
4972 | struct nfs4_state_owner *sp = data->owner; |
4973 | |
4974 | if (nfs_wait_on_sequence(data->o_arg.seqid, task) != 0) |
4975 | - return; |
4976 | + goto out_wait; |
4977 | /* |
4978 | * Check if we still need to send an OPEN call, or if we can use |
4979 | * a delegation instead. |
4980 | @@ -1498,6 +1498,7 @@ unlock_no_action: |
4981 | rcu_read_unlock(); |
4982 | out_no_action: |
4983 | task->tk_action = NULL; |
4984 | +out_wait: |
4985 | nfs4_sequence_done(task, &data->o_res.seq_res); |
4986 | } |
4987 | |
4988 | @@ -2150,7 +2151,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) |
4989 | |
4990 | dprintk("%s: begin!\n", __func__); |
4991 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) |
4992 | - return; |
4993 | + goto out_wait; |
4994 | |
4995 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; |
4996 | calldata->arg.fmode = FMODE_READ|FMODE_WRITE; |
4997 | @@ -2172,16 +2173,14 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) |
4998 | |
4999 | if (!call_close) { |
5000 | /* Note: exit _without_ calling nfs4_close_done */ |
5001 | - task->tk_action = NULL; |
5002 | - nfs4_sequence_done(task, &calldata->res.seq_res); |
5003 | - goto out; |
5004 | + goto out_no_action; |
5005 | } |
5006 | |
5007 | if (calldata->arg.fmode == 0) { |
5008 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE]; |
5009 | if (calldata->roc && |
5010 | pnfs_roc_drain(inode, &calldata->roc_barrier, task)) |
5011 | - goto out; |
5012 | + goto out_wait; |
5013 | } |
5014 | |
5015 | nfs_fattr_init(calldata->res.fattr); |
5016 | @@ -2191,8 +2190,12 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) |
5017 | &calldata->res.seq_res, |
5018 | task) != 0) |
5019 | nfs_release_seqid(calldata->arg.seqid); |
5020 | -out: |
5021 | dprintk("%s: done!\n", __func__); |
5022 | + return; |
5023 | +out_no_action: |
5024 | + task->tk_action = NULL; |
5025 | +out_wait: |
5026 | + nfs4_sequence_done(task, &calldata->res.seq_res); |
5027 | } |
5028 | |
5029 | static const struct rpc_call_ops nfs4_close_ops = { |
5030 | @@ -4423,12 +4426,10 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) |
5031 | struct nfs4_unlockdata *calldata = data; |
5032 | |
5033 | if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) |
5034 | - return; |
5035 | + goto out_wait; |
5036 | if (test_bit(NFS_LOCK_INITIALIZED, &calldata->lsp->ls_flags) == 0) { |
5037 | /* Note: exit _without_ running nfs4_locku_done */ |
5038 | - task->tk_action = NULL; |
5039 | - nfs4_sequence_done(task, &calldata->res.seq_res); |
5040 | - return; |
5041 | + goto out_no_action; |
5042 | } |
5043 | calldata->timestamp = jiffies; |
5044 | if (nfs4_setup_sequence(calldata->server, |
5045 | @@ -4436,6 +4437,11 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) |
5046 | &calldata->res.seq_res, |
5047 | task) != 0) |
5048 | nfs_release_seqid(calldata->arg.seqid); |
5049 | + return; |
5050 | +out_no_action: |
5051 | + task->tk_action = NULL; |
5052 | +out_wait: |
5053 | + nfs4_sequence_done(task, &calldata->res.seq_res); |
5054 | } |
5055 | |
5056 | static const struct rpc_call_ops nfs4_locku_ops = { |
5057 | @@ -4576,7 +4582,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) |
5058 | |
5059 | dprintk("%s: begin!\n", __func__); |
5060 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) |
5061 | - return; |
5062 | + goto out_wait; |
5063 | /* Do we need to do an open_to_lock_owner? */ |
5064 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { |
5065 | if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) { |
5066 | @@ -4596,6 +4602,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) |
5067 | nfs_release_seqid(data->arg.open_seqid); |
5068 | out_release_lock_seqid: |
5069 | nfs_release_seqid(data->arg.lock_seqid); |
5070 | +out_wait: |
5071 | + nfs4_sequence_done(task, &data->res.seq_res); |
5072 | dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status); |
5073 | } |
5074 | |
5075 | @@ -6134,7 +6142,8 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags) |
5076 | status = nfs4_wait_for_completion_rpc_task(task); |
5077 | if (status == 0) |
5078 | status = task->tk_status; |
5079 | - if (status == 0) |
5080 | + /* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */ |
5081 | + if (status == 0 && lgp->res.layoutp->len) |
5082 | lseg = pnfs_layout_process(lgp); |
5083 | rpc_put_task(task); |
5084 | dprintk("<-- %s status=%d\n", __func__, status); |
5085 | diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c |
5086 | index c6f9906..88f9611 100644 |
5087 | --- a/fs/nfs/objlayout/objio_osd.c |
5088 | +++ b/fs/nfs/objlayout/objio_osd.c |
5089 | @@ -647,6 +647,7 @@ static struct pnfs_layoutdriver_type objlayout_type = { |
5090 | .flags = PNFS_LAYOUTRET_ON_SETATTR | |
5091 | PNFS_LAYOUTRET_ON_ERROR, |
5092 | |
5093 | + .owner = THIS_MODULE, |
5094 | .alloc_layout_hdr = objlayout_alloc_layout_hdr, |
5095 | .free_layout_hdr = objlayout_free_layout_hdr, |
5096 | |
5097 | diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
5098 | index d00260b..6be70f6 100644 |
5099 | --- a/fs/nfs/pnfs.c |
5100 | +++ b/fs/nfs/pnfs.c |
5101 | @@ -505,37 +505,147 @@ pnfs_destroy_layout(struct nfs_inode *nfsi) |
5102 | } |
5103 | EXPORT_SYMBOL_GPL(pnfs_destroy_layout); |
5104 | |
5105 | -/* |
5106 | - * Called by the state manger to remove all layouts established under an |
5107 | - * expired lease. |
5108 | - */ |
5109 | -void |
5110 | -pnfs_destroy_all_layouts(struct nfs_client *clp) |
5111 | +static bool |
5112 | +pnfs_layout_add_bulk_destroy_list(struct inode *inode, |
5113 | + struct list_head *layout_list) |
5114 | { |
5115 | - struct nfs_server *server; |
5116 | struct pnfs_layout_hdr *lo; |
5117 | - LIST_HEAD(tmp_list); |
5118 | + bool ret = false; |
5119 | |
5120 | - nfs4_deviceid_mark_client_invalid(clp); |
5121 | - nfs4_deviceid_purge_client(clp); |
5122 | + spin_lock(&inode->i_lock); |
5123 | + lo = NFS_I(inode)->layout; |
5124 | + if (lo != NULL && list_empty(&lo->plh_bulk_destroy)) { |
5125 | + pnfs_get_layout_hdr(lo); |
5126 | + list_add(&lo->plh_bulk_destroy, layout_list); |
5127 | + ret = true; |
5128 | + } |
5129 | + spin_unlock(&inode->i_lock); |
5130 | + return ret; |
5131 | +} |
5132 | + |
5133 | +/* Caller must hold rcu_read_lock and clp->cl_lock */ |
5134 | +static int |
5135 | +pnfs_layout_bulk_destroy_byserver_locked(struct nfs_client *clp, |
5136 | + struct nfs_server *server, |
5137 | + struct list_head *layout_list) |
5138 | +{ |
5139 | + struct pnfs_layout_hdr *lo, *next; |
5140 | + struct inode *inode; |
5141 | + |
5142 | + list_for_each_entry_safe(lo, next, &server->layouts, plh_layouts) { |
5143 | + inode = igrab(lo->plh_inode); |
5144 | + if (inode == NULL) |
5145 | + continue; |
5146 | + list_del_init(&lo->plh_layouts); |
5147 | + if (pnfs_layout_add_bulk_destroy_list(inode, layout_list)) |
5148 | + continue; |
5149 | + rcu_read_unlock(); |
5150 | + spin_unlock(&clp->cl_lock); |
5151 | + iput(inode); |
5152 | + spin_lock(&clp->cl_lock); |
5153 | + rcu_read_lock(); |
5154 | + return -EAGAIN; |
5155 | + } |
5156 | + return 0; |
5157 | +} |
5158 | + |
5159 | +static int |
5160 | +pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list, |
5161 | + bool is_bulk_recall) |
5162 | +{ |
5163 | + struct pnfs_layout_hdr *lo; |
5164 | + struct inode *inode; |
5165 | + struct pnfs_layout_range range = { |
5166 | + .iomode = IOMODE_ANY, |
5167 | + .offset = 0, |
5168 | + .length = NFS4_MAX_UINT64, |
5169 | + }; |
5170 | + LIST_HEAD(lseg_list); |
5171 | + int ret = 0; |
5172 | + |
5173 | + while (!list_empty(layout_list)) { |
5174 | + lo = list_entry(layout_list->next, struct pnfs_layout_hdr, |
5175 | + plh_bulk_destroy); |
5176 | + dprintk("%s freeing layout for inode %lu\n", __func__, |
5177 | + lo->plh_inode->i_ino); |
5178 | + inode = lo->plh_inode; |
5179 | + spin_lock(&inode->i_lock); |
5180 | + list_del_init(&lo->plh_bulk_destroy); |
5181 | + lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */ |
5182 | + if (is_bulk_recall) |
5183 | + set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); |
5184 | + if (pnfs_mark_matching_lsegs_invalid(lo, &lseg_list, &range)) |
5185 | + ret = -EAGAIN; |
5186 | + spin_unlock(&inode->i_lock); |
5187 | + pnfs_free_lseg_list(&lseg_list); |
5188 | + pnfs_put_layout_hdr(lo); |
5189 | + iput(inode); |
5190 | + } |
5191 | + return ret; |
5192 | +} |
5193 | + |
5194 | +int |
5195 | +pnfs_destroy_layouts_byfsid(struct nfs_client *clp, |
5196 | + struct nfs_fsid *fsid, |
5197 | + bool is_recall) |
5198 | +{ |
5199 | + struct nfs_server *server; |
5200 | + LIST_HEAD(layout_list); |
5201 | |
5202 | spin_lock(&clp->cl_lock); |
5203 | rcu_read_lock(); |
5204 | +restart: |
5205 | list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
5206 | - if (!list_empty(&server->layouts)) |
5207 | - list_splice_init(&server->layouts, &tmp_list); |
5208 | + if (memcmp(&server->fsid, fsid, sizeof(*fsid)) != 0) |
5209 | + continue; |
5210 | + if (pnfs_layout_bulk_destroy_byserver_locked(clp, |
5211 | + server, |
5212 | + &layout_list) != 0) |
5213 | + goto restart; |
5214 | } |
5215 | rcu_read_unlock(); |
5216 | spin_unlock(&clp->cl_lock); |
5217 | |
5218 | - while (!list_empty(&tmp_list)) { |
5219 | - lo = list_entry(tmp_list.next, struct pnfs_layout_hdr, |
5220 | - plh_layouts); |
5221 | - dprintk("%s freeing layout for inode %lu\n", __func__, |
5222 | - lo->plh_inode->i_ino); |
5223 | - list_del_init(&lo->plh_layouts); |
5224 | - pnfs_destroy_layout(NFS_I(lo->plh_inode)); |
5225 | + if (list_empty(&layout_list)) |
5226 | + return 0; |
5227 | + return pnfs_layout_free_bulk_destroy_list(&layout_list, is_recall); |
5228 | +} |
5229 | + |
5230 | +int |
5231 | +pnfs_destroy_layouts_byclid(struct nfs_client *clp, |
5232 | + bool is_recall) |
5233 | +{ |
5234 | + struct nfs_server *server; |
5235 | + LIST_HEAD(layout_list); |
5236 | + |
5237 | + spin_lock(&clp->cl_lock); |
5238 | + rcu_read_lock(); |
5239 | +restart: |
5240 | + list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
5241 | + if (pnfs_layout_bulk_destroy_byserver_locked(clp, |
5242 | + server, |
5243 | + &layout_list) != 0) |
5244 | + goto restart; |
5245 | } |
5246 | + rcu_read_unlock(); |
5247 | + spin_unlock(&clp->cl_lock); |
5248 | + |
5249 | + if (list_empty(&layout_list)) |
5250 | + return 0; |
5251 | + return pnfs_layout_free_bulk_destroy_list(&layout_list, is_recall); |
5252 | +} |
5253 | + |
5254 | +/* |
5255 | + * Called by the state manger to remove all layouts established under an |
5256 | + * expired lease. |
5257 | + */ |
5258 | +void |
5259 | +pnfs_destroy_all_layouts(struct nfs_client *clp) |
5260 | +{ |
5261 | + nfs4_deviceid_mark_client_invalid(clp); |
5262 | + nfs4_deviceid_purge_client(clp); |
5263 | + |
5264 | + pnfs_destroy_layouts_byclid(clp, false); |
5265 | } |
5266 | |
5267 | /* |
5268 | @@ -888,7 +998,7 @@ alloc_init_layout_hdr(struct inode *ino, |
5269 | atomic_set(&lo->plh_refcount, 1); |
5270 | INIT_LIST_HEAD(&lo->plh_layouts); |
5271 | INIT_LIST_HEAD(&lo->plh_segs); |
5272 | - INIT_LIST_HEAD(&lo->plh_bulk_recall); |
5273 | + INIT_LIST_HEAD(&lo->plh_bulk_destroy); |
5274 | lo->plh_inode = ino; |
5275 | lo->plh_lc_cred = get_rpccred(ctx->state->owner->so_cred); |
5276 | return lo; |
5277 | diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h |
5278 | index dbf7bba..97cb358 100644 |
5279 | --- a/fs/nfs/pnfs.h |
5280 | +++ b/fs/nfs/pnfs.h |
5281 | @@ -132,7 +132,7 @@ struct pnfs_layoutdriver_type { |
5282 | struct pnfs_layout_hdr { |
5283 | atomic_t plh_refcount; |
5284 | struct list_head plh_layouts; /* other client layouts */ |
5285 | - struct list_head plh_bulk_recall; /* clnt list of bulk recalls */ |
5286 | + struct list_head plh_bulk_destroy; |
5287 | struct list_head plh_segs; /* layout segments list */ |
5288 | nfs4_stateid plh_stateid; |
5289 | atomic_t plh_outstanding; /* number of RPCs out */ |
5290 | @@ -196,6 +196,11 @@ struct pnfs_layout_segment *pnfs_layout_process(struct nfs4_layoutget *lgp); |
5291 | void pnfs_free_lseg_list(struct list_head *tmp_list); |
5292 | void pnfs_destroy_layout(struct nfs_inode *); |
5293 | void pnfs_destroy_all_layouts(struct nfs_client *); |
5294 | +int pnfs_destroy_layouts_byfsid(struct nfs_client *clp, |
5295 | + struct nfs_fsid *fsid, |
5296 | + bool is_recall); |
5297 | +int pnfs_destroy_layouts_byclid(struct nfs_client *clp, |
5298 | + bool is_recall); |
5299 | void pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo); |
5300 | void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, |
5301 | const nfs4_stateid *new, |
5302 | diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c |
5303 | index 228a2c2..07f7a92 100644 |
5304 | --- a/fs/notify/inotify/inotify_user.c |
5305 | +++ b/fs/notify/inotify/inotify_user.c |
5306 | @@ -576,8 +576,6 @@ static int inotify_update_existing_watch(struct fsnotify_group *group, |
5307 | |
5308 | /* don't allow invalid bits: we don't want flags set */ |
5309 | mask = inotify_arg_to_mask(arg); |
5310 | - if (unlikely(!(mask & IN_ALL_EVENTS))) |
5311 | - return -EINVAL; |
5312 | |
5313 | fsn_mark = fsnotify_find_inode_mark(group, inode); |
5314 | if (!fsn_mark) |
5315 | @@ -629,8 +627,6 @@ static int inotify_new_watch(struct fsnotify_group *group, |
5316 | |
5317 | /* don't allow invalid bits: we don't want flags set */ |
5318 | mask = inotify_arg_to_mask(arg); |
5319 | - if (unlikely(!(mask & IN_ALL_EVENTS))) |
5320 | - return -EINVAL; |
5321 | |
5322 | tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL); |
5323 | if (unlikely(!tmp_i_mark)) |
5324 | diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c |
5325 | index 4f7795f..88577eb 100644 |
5326 | --- a/fs/ocfs2/dlmglue.c |
5327 | +++ b/fs/ocfs2/dlmglue.c |
5328 | @@ -2545,6 +2545,7 @@ int ocfs2_super_lock(struct ocfs2_super *osb, |
5329 | * everything is up to the caller :) */ |
5330 | status = ocfs2_should_refresh_lock_res(lockres); |
5331 | if (status < 0) { |
5332 | + ocfs2_cluster_unlock(osb, lockres, level); |
5333 | mlog_errno(status); |
5334 | goto bail; |
5335 | } |
5336 | @@ -2553,8 +2554,10 @@ int ocfs2_super_lock(struct ocfs2_super *osb, |
5337 | |
5338 | ocfs2_complete_lock_res_refresh(lockres, status); |
5339 | |
5340 | - if (status < 0) |
5341 | + if (status < 0) { |
5342 | + ocfs2_cluster_unlock(osb, lockres, level); |
5343 | mlog_errno(status); |
5344 | + } |
5345 | ocfs2_track_lock_refresh(lockres); |
5346 | } |
5347 | bail: |
5348 | diff --git a/include/linux/console.h b/include/linux/console.h |
5349 | index dedb082..47b858c 100644 |
5350 | --- a/include/linux/console.h |
5351 | +++ b/include/linux/console.h |
5352 | @@ -77,7 +77,9 @@ extern const struct consw prom_con; /* SPARC PROM console */ |
5353 | int con_is_bound(const struct consw *csw); |
5354 | int register_con_driver(const struct consw *csw, int first, int last); |
5355 | int unregister_con_driver(const struct consw *csw); |
5356 | +int do_unregister_con_driver(const struct consw *csw); |
5357 | int take_over_console(const struct consw *sw, int first, int last, int deflt); |
5358 | +int do_take_over_console(const struct consw *sw, int first, int last, int deflt); |
5359 | void give_up_console(const struct consw *sw); |
5360 | #ifdef CONFIG_HW_CONSOLE |
5361 | int con_debug_enter(struct vc_data *vc); |
5362 | diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h |
5363 | index d06cc5c..218a3b6 100644 |
5364 | --- a/include/linux/if_vlan.h |
5365 | +++ b/include/linux/if_vlan.h |
5366 | @@ -331,7 +331,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, |
5367 | struct vlan_hdr *vhdr) |
5368 | { |
5369 | __be16 proto; |
5370 | - unsigned char *rawp; |
5371 | + unsigned short *rawp; |
5372 | |
5373 | /* |
5374 | * Was a VLAN packet, grab the encapsulated protocol, which the layer |
5375 | @@ -344,8 +344,8 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, |
5376 | return; |
5377 | } |
5378 | |
5379 | - rawp = skb->data; |
5380 | - if (*(unsigned short *) rawp == 0xFFFF) |
5381 | + rawp = (unsigned short *)(vhdr + 1); |
5382 | + if (*rawp == 0xFFFF) |
5383 | /* |
5384 | * This is a magic hack to spot IPX packets. Older Novell |
5385 | * breaks the protocol design and runs IPX over 802.3 without |
5386 | diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h |
5387 | index 0cc45ae..7db3eb9 100644 |
5388 | --- a/include/linux/pps_kernel.h |
5389 | +++ b/include/linux/pps_kernel.h |
5390 | @@ -43,7 +43,7 @@ struct pps_source_info { |
5391 | int event, void *data); /* PPS echo function */ |
5392 | |
5393 | struct module *owner; |
5394 | - struct device *dev; |
5395 | + struct device *dev; /* Parent device for device_create */ |
5396 | }; |
5397 | |
5398 | struct pps_event_time { |
5399 | @@ -69,6 +69,7 @@ struct pps_device { |
5400 | wait_queue_head_t queue; /* PPS event queue */ |
5401 | |
5402 | unsigned int id; /* PPS source unique ID */ |
5403 | + void const *lookup_cookie; /* pps_lookup_dev only */ |
5404 | struct cdev cdev; |
5405 | struct device *dev; |
5406 | struct fasync_struct *async_queue; /* fasync method */ |
5407 | @@ -82,16 +83,26 @@ struct pps_device { |
5408 | extern struct device_attribute pps_attrs[]; |
5409 | |
5410 | /* |
5411 | + * Internal functions. |
5412 | + * |
5413 | + * These are not actually part of the exported API, but this is a |
5414 | + * convenient header file to put them in. |
5415 | + */ |
5416 | + |
5417 | +extern int pps_register_cdev(struct pps_device *pps); |
5418 | +extern void pps_unregister_cdev(struct pps_device *pps); |
5419 | + |
5420 | +/* |
5421 | * Exported functions |
5422 | */ |
5423 | |
5424 | extern struct pps_device *pps_register_source( |
5425 | struct pps_source_info *info, int default_params); |
5426 | extern void pps_unregister_source(struct pps_device *pps); |
5427 | -extern int pps_register_cdev(struct pps_device *pps); |
5428 | -extern void pps_unregister_cdev(struct pps_device *pps); |
5429 | extern void pps_event(struct pps_device *pps, |
5430 | struct pps_event_time *ts, int event, void *data); |
5431 | +/* Look up a pps device by magic cookie */ |
5432 | +struct pps_device *pps_lookup_dev(void const *cookie); |
5433 | |
5434 | static inline void timespec_to_pps_ktime(struct pps_ktime *kt, |
5435 | struct timespec ts) |
5436 | diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h |
5437 | index 50ae7d0..e8d6571 100644 |
5438 | --- a/include/linux/vt_kern.h |
5439 | +++ b/include/linux/vt_kern.h |
5440 | @@ -47,6 +47,7 @@ int con_set_cmap(unsigned char __user *cmap); |
5441 | int con_get_cmap(unsigned char __user *cmap); |
5442 | void scrollback(struct vc_data *vc, int lines); |
5443 | void scrollfront(struct vc_data *vc, int lines); |
5444 | +void clear_buffer_attributes(struct vc_data *vc); |
5445 | void update_region(struct vc_data *vc, unsigned long start, int count); |
5446 | void redraw_screen(struct vc_data *vc, int is_switch); |
5447 | #define update_screen(x) redraw_screen(x, 0) |
5448 | @@ -130,6 +131,8 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new); |
5449 | int vt_waitactive(int n); |
5450 | void change_console(struct vc_data *new_vc); |
5451 | void reset_vc(struct vc_data *vc); |
5452 | +extern int do_unbind_con_driver(const struct consw *csw, int first, int last, |
5453 | + int deflt); |
5454 | extern int unbind_con_driver(const struct consw *csw, int first, int last, |
5455 | int deflt); |
5456 | int vty_init(const struct file_operations *console_fops); |
5457 | diff --git a/include/net/dst.h b/include/net/dst.h |
5458 | index 9a78810..b3ebe17 100644 |
5459 | --- a/include/net/dst.h |
5460 | +++ b/include/net/dst.h |
5461 | @@ -36,13 +36,9 @@ struct dst_entry { |
5462 | struct net_device *dev; |
5463 | struct dst_ops *ops; |
5464 | unsigned long _metrics; |
5465 | - union { |
5466 | - unsigned long expires; |
5467 | - /* point to where the dst_entry copied from */ |
5468 | - struct dst_entry *from; |
5469 | - }; |
5470 | + unsigned long expires; |
5471 | struct dst_entry *path; |
5472 | - void *__pad0; |
5473 | + struct dst_entry *from; |
5474 | #ifdef CONFIG_XFRM |
5475 | struct xfrm_state *xfrm; |
5476 | #else |
5477 | diff --git a/include/net/icmp.h b/include/net/icmp.h |
5478 | index 9ac2524..081439f 100644 |
5479 | --- a/include/net/icmp.h |
5480 | +++ b/include/net/icmp.h |
5481 | @@ -41,6 +41,7 @@ struct net; |
5482 | |
5483 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); |
5484 | extern int icmp_rcv(struct sk_buff *skb); |
5485 | +extern void icmp_err(struct sk_buff *, u32 info); |
5486 | extern int icmp_init(void); |
5487 | extern void icmp_out_count(struct net *net, unsigned char type); |
5488 | |
5489 | diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h |
5490 | index 9e34c87..f071f50 100644 |
5491 | --- a/include/net/inet6_hashtables.h |
5492 | +++ b/include/net/inet6_hashtables.h |
5493 | @@ -28,16 +28,16 @@ |
5494 | |
5495 | struct inet_hashinfo; |
5496 | |
5497 | -/* I have no idea if this is a good hash for v6 or not. -DaveM */ |
5498 | static inline unsigned int inet6_ehashfn(struct net *net, |
5499 | const struct in6_addr *laddr, const u16 lport, |
5500 | const struct in6_addr *faddr, const __be16 fport) |
5501 | { |
5502 | - u32 ports = (lport ^ (__force u16)fport); |
5503 | + u32 ports = (((u32)lport) << 16) | (__force u32)fport; |
5504 | |
5505 | return jhash_3words((__force u32)laddr->s6_addr32[3], |
5506 | - (__force u32)faddr->s6_addr32[3], |
5507 | - ports, inet_ehash_secret + net_hash_mix(net)); |
5508 | + ipv6_addr_jhash(faddr), |
5509 | + ports, |
5510 | + inet_ehash_secret + net_hash_mix(net)); |
5511 | } |
5512 | |
5513 | static inline int inet6_sk_ehashfn(const struct sock *sk) |
5514 | diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h |
5515 | index a4196cb..7235ae7 100644 |
5516 | --- a/include/net/inet_sock.h |
5517 | +++ b/include/net/inet_sock.h |
5518 | @@ -203,6 +203,7 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, |
5519 | extern int inet_sk_rebuild_header(struct sock *sk); |
5520 | |
5521 | extern u32 inet_ehash_secret; |
5522 | +extern u32 ipv6_hash_secret; |
5523 | extern void build_ehash_secret(void); |
5524 | |
5525 | static inline unsigned int inet_ehashfn(struct net *net, |
5526 | diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h |
5527 | index fdc48a9..28d27a6 100644 |
5528 | --- a/include/net/ip6_fib.h |
5529 | +++ b/include/net/ip6_fib.h |
5530 | @@ -166,50 +166,35 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
5531 | |
5532 | static inline void rt6_clean_expires(struct rt6_info *rt) |
5533 | { |
5534 | - if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) |
5535 | - dst_release(rt->dst.from); |
5536 | - |
5537 | rt->rt6i_flags &= ~RTF_EXPIRES; |
5538 | - rt->dst.from = NULL; |
5539 | } |
5540 | |
5541 | static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) |
5542 | { |
5543 | - if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) |
5544 | - dst_release(rt->dst.from); |
5545 | - |
5546 | - rt->rt6i_flags |= RTF_EXPIRES; |
5547 | rt->dst.expires = expires; |
5548 | + rt->rt6i_flags |= RTF_EXPIRES; |
5549 | } |
5550 | |
5551 | -static inline void rt6_update_expires(struct rt6_info *rt, int timeout) |
5552 | +static inline void rt6_update_expires(struct rt6_info *rt0, int timeout) |
5553 | { |
5554 | - if (!(rt->rt6i_flags & RTF_EXPIRES)) { |
5555 | - if (rt->dst.from) |
5556 | - dst_release(rt->dst.from); |
5557 | - /* dst_set_expires relies on expires == 0 |
5558 | - * if it has not been set previously. |
5559 | - */ |
5560 | - rt->dst.expires = 0; |
5561 | - } |
5562 | - |
5563 | - dst_set_expires(&rt->dst, timeout); |
5564 | - rt->rt6i_flags |= RTF_EXPIRES; |
5565 | + struct rt6_info *rt; |
5566 | + |
5567 | + for (rt = rt0; rt && !(rt->rt6i_flags & RTF_EXPIRES); |
5568 | + rt = (struct rt6_info *)rt->dst.from); |
5569 | + if (rt && rt != rt0) |
5570 | + rt0->dst.expires = rt->dst.expires; |
5571 | + |
5572 | + dst_set_expires(&rt0->dst, timeout); |
5573 | + rt0->rt6i_flags |= RTF_EXPIRES; |
5574 | } |
5575 | |
5576 | static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) |
5577 | { |
5578 | struct dst_entry *new = (struct dst_entry *) from; |
5579 | |
5580 | - if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) { |
5581 | - if (new == rt->dst.from) |
5582 | - return; |
5583 | - dst_release(rt->dst.from); |
5584 | - } |
5585 | - |
5586 | rt->rt6i_flags &= ~RTF_EXPIRES; |
5587 | - rt->dst.from = new; |
5588 | dst_hold(new); |
5589 | + rt->dst.from = new; |
5590 | } |
5591 | |
5592 | static inline void ip6_rt_put(struct rt6_info *rt) |
5593 | diff --git a/include/net/ipv6.h b/include/net/ipv6.h |
5594 | index 5af66b2..5a67919 100644 |
5595 | --- a/include/net/ipv6.h |
5596 | +++ b/include/net/ipv6.h |
5597 | @@ -15,6 +15,7 @@ |
5598 | |
5599 | #include <linux/ipv6.h> |
5600 | #include <linux/hardirq.h> |
5601 | +#include <linux/jhash.h> |
5602 | #include <net/if_inet6.h> |
5603 | #include <net/ndisc.h> |
5604 | #include <net/flow.h> |
5605 | @@ -473,6 +474,17 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a) |
5606 | #endif |
5607 | } |
5608 | |
5609 | +/* more secured version of ipv6_addr_hash() */ |
5610 | +static inline u32 ipv6_addr_jhash(const struct in6_addr *a) |
5611 | +{ |
5612 | + u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; |
5613 | + |
5614 | + return jhash_3words(v, |
5615 | + (__force u32)a->s6_addr32[2], |
5616 | + (__force u32)a->s6_addr32[3], |
5617 | + ipv6_hash_secret); |
5618 | +} |
5619 | + |
5620 | static inline bool ipv6_addr_loopback(const struct in6_addr *a) |
5621 | { |
5622 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
5623 | diff --git a/include/net/sock.h b/include/net/sock.h |
5624 | index 182ca99..25afaa0 100644 |
5625 | --- a/include/net/sock.h |
5626 | +++ b/include/net/sock.h |
5627 | @@ -1037,7 +1037,7 @@ static inline void sk_refcnt_debug_dec(struct sock *sk) |
5628 | sk->sk_prot->name, sk, atomic_read(&sk->sk_prot->socks)); |
5629 | } |
5630 | |
5631 | -inline void sk_refcnt_debug_release(const struct sock *sk) |
5632 | +static inline void sk_refcnt_debug_release(const struct sock *sk) |
5633 | { |
5634 | if (atomic_read(&sk->sk_refcnt) != 1) |
5635 | printk(KERN_DEBUG "Destruction of the %s socket %p delayed, refcnt=%d\n", |
5636 | diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h |
5637 | index 2c6c85f..8f6e50a 100644 |
5638 | --- a/include/uapi/linux/serial_core.h |
5639 | +++ b/include/uapi/linux/serial_core.h |
5640 | @@ -50,7 +50,7 @@ |
5641 | #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ |
5642 | #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ |
5643 | #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ |
5644 | -#define PORT_BRCM_TRUMANAGE 24 |
5645 | +#define PORT_BRCM_TRUMANAGE 25 |
5646 | #define PORT_MAX_8250 25 /* max port ID */ |
5647 | |
5648 | /* |
5649 | diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h |
5650 | index ac90037..d2314be 100644 |
5651 | --- a/include/uapi/linux/usb/audio.h |
5652 | +++ b/include/uapi/linux/usb/audio.h |
5653 | @@ -384,14 +384,16 @@ static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_de |
5654 | int protocol) |
5655 | { |
5656 | __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); |
5657 | - return desc->baSourceID[desc->bNrInPins + control_size]; |
5658 | + return *(uac_processing_unit_bmControls(desc, protocol) |
5659 | + + control_size); |
5660 | } |
5661 | |
5662 | static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, |
5663 | int protocol) |
5664 | { |
5665 | __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); |
5666 | - return &desc->baSourceID[desc->bNrInPins + control_size + 1]; |
5667 | + return uac_processing_unit_bmControls(desc, protocol) |
5668 | + + control_size + 1; |
5669 | } |
5670 | |
5671 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
5672 | diff --git a/kernel/futex.c b/kernel/futex.c |
5673 | index 19eb089..8879430 100644 |
5674 | --- a/kernel/futex.c |
5675 | +++ b/kernel/futex.c |
5676 | @@ -2471,8 +2471,6 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, |
5677 | if (!futex_cmpxchg_enabled) |
5678 | return -ENOSYS; |
5679 | |
5680 | - WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n"); |
5681 | - |
5682 | rcu_read_lock(); |
5683 | |
5684 | ret = -ESRCH; |
5685 | diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c |
5686 | index 83e368b..a9642d5 100644 |
5687 | --- a/kernel/futex_compat.c |
5688 | +++ b/kernel/futex_compat.c |
5689 | @@ -142,8 +142,6 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
5690 | if (!futex_cmpxchg_enabled) |
5691 | return -ENOSYS; |
5692 | |
5693 | - WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n"); |
5694 | - |
5695 | rcu_read_lock(); |
5696 | |
5697 | ret = -ESRCH; |
5698 | diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c |
5699 | index 6db7a5e..cdd5607 100644 |
5700 | --- a/kernel/hrtimer.c |
5701 | +++ b/kernel/hrtimer.c |
5702 | @@ -640,21 +640,9 @@ static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base) |
5703 | * and expiry check is done in the hrtimer_interrupt or in the softirq. |
5704 | */ |
5705 | static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, |
5706 | - struct hrtimer_clock_base *base, |
5707 | - int wakeup) |
5708 | + struct hrtimer_clock_base *base) |
5709 | { |
5710 | - if (base->cpu_base->hres_active && hrtimer_reprogram(timer, base)) { |
5711 | - if (wakeup) { |
5712 | - raw_spin_unlock(&base->cpu_base->lock); |
5713 | - raise_softirq_irqoff(HRTIMER_SOFTIRQ); |
5714 | - raw_spin_lock(&base->cpu_base->lock); |
5715 | - } else |
5716 | - __raise_softirq_irqoff(HRTIMER_SOFTIRQ); |
5717 | - |
5718 | - return 1; |
5719 | - } |
5720 | - |
5721 | - return 0; |
5722 | + return base->cpu_base->hres_active && hrtimer_reprogram(timer, base); |
5723 | } |
5724 | |
5725 | static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) |
5726 | @@ -735,8 +723,7 @@ static inline int hrtimer_switch_to_hres(void) { return 0; } |
5727 | static inline void |
5728 | hrtimer_force_reprogram(struct hrtimer_cpu_base *base, int skip_equal) { } |
5729 | static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, |
5730 | - struct hrtimer_clock_base *base, |
5731 | - int wakeup) |
5732 | + struct hrtimer_clock_base *base) |
5733 | { |
5734 | return 0; |
5735 | } |
5736 | @@ -995,8 +982,21 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, |
5737 | * |
5738 | * XXX send_remote_softirq() ? |
5739 | */ |
5740 | - if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases)) |
5741 | - hrtimer_enqueue_reprogram(timer, new_base, wakeup); |
5742 | + if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases) |
5743 | + && hrtimer_enqueue_reprogram(timer, new_base)) { |
5744 | + if (wakeup) { |
5745 | + /* |
5746 | + * We need to drop cpu_base->lock to avoid a |
5747 | + * lock ordering issue vs. rq->lock. |
5748 | + */ |
5749 | + raw_spin_unlock(&new_base->cpu_base->lock); |
5750 | + raise_softirq_irqoff(HRTIMER_SOFTIRQ); |
5751 | + local_irq_restore(flags); |
5752 | + return ret; |
5753 | + } else { |
5754 | + __raise_softirq_irqoff(HRTIMER_SOFTIRQ); |
5755 | + } |
5756 | + } |
5757 | |
5758 | unlock_hrtimer_base(timer, &flags); |
5759 | |
5760 | diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c |
5761 | index 611cd60..7b5f012 100644 |
5762 | --- a/kernel/irq/spurious.c |
5763 | +++ b/kernel/irq/spurious.c |
5764 | @@ -80,13 +80,11 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force) |
5765 | |
5766 | /* |
5767 | * All handlers must agree on IRQF_SHARED, so we test just the |
5768 | - * first. Check for action->next as well. |
5769 | + * first. |
5770 | */ |
5771 | action = desc->action; |
5772 | if (!action || !(action->flags & IRQF_SHARED) || |
5773 | - (action->flags & __IRQF_TIMER) || |
5774 | - (action->handler(irq, action->dev_id) == IRQ_HANDLED) || |
5775 | - !action->next) |
5776 | + (action->flags & __IRQF_TIMER)) |
5777 | goto out; |
5778 | |
5779 | /* Already running on another processor */ |
5780 | @@ -104,6 +102,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force) |
5781 | do { |
5782 | if (handle_irq_event(desc) == IRQ_HANDLED) |
5783 | ret = IRQ_HANDLED; |
5784 | + /* Make sure that there is still a valid action */ |
5785 | action = desc->action; |
5786 | } while ((desc->istate & IRQS_PENDING) && action); |
5787 | desc->istate &= ~IRQS_POLL_INPROGRESS; |
5788 | diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c |
5789 | index a278cad..942ca27 100644 |
5790 | --- a/kernel/posix-cpu-timers.c |
5791 | +++ b/kernel/posix-cpu-timers.c |
5792 | @@ -1401,8 +1401,10 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags, |
5793 | while (!signal_pending(current)) { |
5794 | if (timer.it.cpu.expires.sched == 0) { |
5795 | /* |
5796 | - * Our timer fired and was reset. |
5797 | + * Our timer fired and was reset, below |
5798 | + * deletion can not fail. |
5799 | */ |
5800 | + posix_cpu_timer_del(&timer); |
5801 | spin_unlock_irq(&timer.it_lock); |
5802 | return 0; |
5803 | } |
5804 | @@ -1420,9 +1422,26 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags, |
5805 | * We were interrupted by a signal. |
5806 | */ |
5807 | sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp); |
5808 | - posix_cpu_timer_set(&timer, 0, &zero_it, it); |
5809 | + error = posix_cpu_timer_set(&timer, 0, &zero_it, it); |
5810 | + if (!error) { |
5811 | + /* |
5812 | + * Timer is now unarmed, deletion can not fail. |
5813 | + */ |
5814 | + posix_cpu_timer_del(&timer); |
5815 | + } |
5816 | spin_unlock_irq(&timer.it_lock); |
5817 | |
5818 | + while (error == TIMER_RETRY) { |
5819 | + /* |
5820 | + * We need to handle case when timer was or is in the |
5821 | + * middle of firing. In other cases we already freed |
5822 | + * resources. |
5823 | + */ |
5824 | + spin_lock_irq(&timer.it_lock); |
5825 | + error = posix_cpu_timer_del(&timer); |
5826 | + spin_unlock_irq(&timer.it_lock); |
5827 | + } |
5828 | + |
5829 | if ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) { |
5830 | /* |
5831 | * It actually did fire already. |
5832 | diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl |
5833 | index eb51d76..3f42652 100644 |
5834 | --- a/kernel/timeconst.pl |
5835 | +++ b/kernel/timeconst.pl |
5836 | @@ -369,10 +369,8 @@ if ($hz eq '--can') { |
5837 | die "Usage: $0 HZ\n"; |
5838 | } |
5839 | |
5840 | - @val = @{$canned_values{$hz}}; |
5841 | - if (!defined(@val)) { |
5842 | - @val = compute_values($hz); |
5843 | - } |
5844 | + $cv = $canned_values{$hz}; |
5845 | + @val = defined($cv) ? @$cv : compute_values($hz); |
5846 | output($hz, @val); |
5847 | } |
5848 | exit 0; |
5849 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
5850 | index fbc6576..033ad5b 100644 |
5851 | --- a/kernel/workqueue.c |
5852 | +++ b/kernel/workqueue.c |
5853 | @@ -1352,7 +1352,7 @@ void delayed_work_timer_fn(unsigned long __data) |
5854 | /* should have been called from irqsafe timer with irq already off */ |
5855 | __queue_work(dwork->cpu, cwq->wq, &dwork->work); |
5856 | } |
5857 | -EXPORT_SYMBOL_GPL(delayed_work_timer_fn); |
5858 | +EXPORT_SYMBOL(delayed_work_timer_fn); |
5859 | |
5860 | static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, |
5861 | struct delayed_work *dwork, unsigned long delay) |
5862 | diff --git a/mm/fadvise.c b/mm/fadvise.c |
5863 | index a47f0f5..909ec55 100644 |
5864 | --- a/mm/fadvise.c |
5865 | +++ b/mm/fadvise.c |
5866 | @@ -17,6 +17,7 @@ |
5867 | #include <linux/fadvise.h> |
5868 | #include <linux/writeback.h> |
5869 | #include <linux/syscalls.h> |
5870 | +#include <linux/swap.h> |
5871 | |
5872 | #include <asm/unistd.h> |
5873 | |
5874 | @@ -120,9 +121,22 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) |
5875 | start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT; |
5876 | end_index = (endbyte >> PAGE_CACHE_SHIFT); |
5877 | |
5878 | - if (end_index >= start_index) |
5879 | - invalidate_mapping_pages(mapping, start_index, |
5880 | + if (end_index >= start_index) { |
5881 | + unsigned long count = invalidate_mapping_pages(mapping, |
5882 | + start_index, end_index); |
5883 | + |
5884 | + /* |
5885 | + * If fewer pages were invalidated than expected then |
5886 | + * it is possible that some of the pages were on |
5887 | + * a per-cpu pagevec for a remote CPU. Drain all |
5888 | + * pagevecs and try again. |
5889 | + */ |
5890 | + if (count < (end_index - start_index + 1)) { |
5891 | + lru_add_drain_all(); |
5892 | + invalidate_mapping_pages(mapping, start_index, |
5893 | end_index); |
5894 | + } |
5895 | + } |
5896 | break; |
5897 | default: |
5898 | ret = -EINVAL; |
5899 | diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c |
5900 | index 8a5ac8c..f5c3d96 100644 |
5901 | --- a/mm/mmu_notifier.c |
5902 | +++ b/mm/mmu_notifier.c |
5903 | @@ -37,49 +37,51 @@ static struct srcu_struct srcu; |
5904 | void __mmu_notifier_release(struct mm_struct *mm) |
5905 | { |
5906 | struct mmu_notifier *mn; |
5907 | - struct hlist_node *n; |
5908 | int id; |
5909 | |
5910 | /* |
5911 | - * SRCU here will block mmu_notifier_unregister until |
5912 | - * ->release returns. |
5913 | + * srcu_read_lock() here will block synchronize_srcu() in |
5914 | + * mmu_notifier_unregister() until all registered |
5915 | + * ->release() callouts this function makes have |
5916 | + * returned. |
5917 | */ |
5918 | id = srcu_read_lock(&srcu); |
5919 | - hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist) |
5920 | - /* |
5921 | - * if ->release runs before mmu_notifier_unregister it |
5922 | - * must be handled as it's the only way for the driver |
5923 | - * to flush all existing sptes and stop the driver |
5924 | - * from establishing any more sptes before all the |
5925 | - * pages in the mm are freed. |
5926 | - */ |
5927 | - if (mn->ops->release) |
5928 | - mn->ops->release(mn, mm); |
5929 | - srcu_read_unlock(&srcu, id); |
5930 | - |
5931 | spin_lock(&mm->mmu_notifier_mm->lock); |
5932 | while (unlikely(!hlist_empty(&mm->mmu_notifier_mm->list))) { |
5933 | mn = hlist_entry(mm->mmu_notifier_mm->list.first, |
5934 | struct mmu_notifier, |
5935 | hlist); |
5936 | + |
5937 | /* |
5938 | - * We arrived before mmu_notifier_unregister so |
5939 | - * mmu_notifier_unregister will do nothing other than |
5940 | - * to wait ->release to finish and |
5941 | - * mmu_notifier_unregister to return. |
5942 | + * Unlink. This will prevent mmu_notifier_unregister() |
5943 | + * from also making the ->release() callout. |
5944 | */ |
5945 | hlist_del_init_rcu(&mn->hlist); |
5946 | + spin_unlock(&mm->mmu_notifier_mm->lock); |
5947 | + |
5948 | + /* |
5949 | + * Clear sptes. (see 'release' description in mmu_notifier.h) |
5950 | + */ |
5951 | + if (mn->ops->release) |
5952 | + mn->ops->release(mn, mm); |
5953 | + |
5954 | + spin_lock(&mm->mmu_notifier_mm->lock); |
5955 | } |
5956 | spin_unlock(&mm->mmu_notifier_mm->lock); |
5957 | |
5958 | /* |
5959 | - * synchronize_srcu here prevents mmu_notifier_release to |
5960 | - * return to exit_mmap (which would proceed freeing all pages |
5961 | - * in the mm) until the ->release method returns, if it was |
5962 | - * invoked by mmu_notifier_unregister. |
5963 | - * |
5964 | - * The mmu_notifier_mm can't go away from under us because one |
5965 | - * mm_count is hold by exit_mmap. |
5966 | + * All callouts to ->release() which we have done are complete. |
5967 | + * Allow synchronize_srcu() in mmu_notifier_unregister() to complete |
5968 | + */ |
5969 | + srcu_read_unlock(&srcu, id); |
5970 | + |
5971 | + /* |
5972 | + * mmu_notifier_unregister() may have unlinked a notifier and may |
5973 | + * still be calling out to it. Additionally, other notifiers |
5974 | + * may have been active via vmtruncate() et. al. Block here |
5975 | + * to ensure that all notifier callouts for this mm have been |
5976 | + * completed and the sptes are really cleaned up before returning |
5977 | + * to exit_mmap(). |
5978 | */ |
5979 | synchronize_srcu(&srcu); |
5980 | } |
5981 | @@ -294,31 +296,31 @@ void mmu_notifier_unregister(struct mmu_notifier *mn, struct mm_struct *mm) |
5982 | { |
5983 | BUG_ON(atomic_read(&mm->mm_count) <= 0); |
5984 | |
5985 | + spin_lock(&mm->mmu_notifier_mm->lock); |
5986 | if (!hlist_unhashed(&mn->hlist)) { |
5987 | - /* |
5988 | - * SRCU here will force exit_mmap to wait ->release to finish |
5989 | - * before freeing the pages. |
5990 | - */ |
5991 | int id; |
5992 | |
5993 | - id = srcu_read_lock(&srcu); |
5994 | /* |
5995 | - * exit_mmap will block in mmu_notifier_release to |
5996 | - * guarantee ->release is called before freeing the |
5997 | - * pages. |
5998 | + * Ensure we synchronize up with __mmu_notifier_release(). |
5999 | */ |
6000 | + id = srcu_read_lock(&srcu); |
6001 | + |
6002 | + hlist_del_rcu(&mn->hlist); |
6003 | + spin_unlock(&mm->mmu_notifier_mm->lock); |
6004 | + |
6005 | if (mn->ops->release) |
6006 | mn->ops->release(mn, mm); |
6007 | - srcu_read_unlock(&srcu, id); |
6008 | |
6009 | - spin_lock(&mm->mmu_notifier_mm->lock); |
6010 | - hlist_del_rcu(&mn->hlist); |
6011 | + /* |
6012 | + * Allow __mmu_notifier_release() to complete. |
6013 | + */ |
6014 | + srcu_read_unlock(&srcu, id); |
6015 | + } else |
6016 | spin_unlock(&mm->mmu_notifier_mm->lock); |
6017 | - } |
6018 | |
6019 | /* |
6020 | - * Wait any running method to finish, of course including |
6021 | - * ->release if it was run by mmu_notifier_relase instead of us. |
6022 | + * Wait for any running method to finish, including ->release() if it |
6023 | + * was run by __mmu_notifier_release() instead of us. |
6024 | */ |
6025 | synchronize_srcu(&srcu); |
6026 | |
6027 | diff --git a/mm/shmem.c b/mm/shmem.c |
6028 | index 5dd56f6..efd0b3a 100644 |
6029 | --- a/mm/shmem.c |
6030 | +++ b/mm/shmem.c |
6031 | @@ -2487,6 +2487,7 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) |
6032 | unsigned long inodes; |
6033 | int error = -EINVAL; |
6034 | |
6035 | + config.mpol = NULL; |
6036 | if (shmem_parse_options(data, &config, true)) |
6037 | return error; |
6038 | |
6039 | @@ -2511,8 +2512,13 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) |
6040 | sbinfo->max_inodes = config.max_inodes; |
6041 | sbinfo->free_inodes = config.max_inodes - inodes; |
6042 | |
6043 | - mpol_put(sbinfo->mpol); |
6044 | - sbinfo->mpol = config.mpol; /* transfers initial ref */ |
6045 | + /* |
6046 | + * Preserve previous mempolicy unless mpol remount option was specified. |
6047 | + */ |
6048 | + if (config.mpol) { |
6049 | + mpol_put(sbinfo->mpol); |
6050 | + sbinfo->mpol = config.mpol; /* transfers initial ref */ |
6051 | + } |
6052 | out: |
6053 | spin_unlock(&sbinfo->stat_lock); |
6054 | return error; |
6055 | diff --git a/net/core/dst.c b/net/core/dst.c |
6056 | index ee6153e..35fd12f 100644 |
6057 | --- a/net/core/dst.c |
6058 | +++ b/net/core/dst.c |
6059 | @@ -179,6 +179,7 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev, |
6060 | dst_init_metrics(dst, dst_default_metrics, true); |
6061 | dst->expires = 0UL; |
6062 | dst->path = dst; |
6063 | + dst->from = NULL; |
6064 | #ifdef CONFIG_XFRM |
6065 | dst->xfrm = NULL; |
6066 | #endif |
6067 | diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c |
6068 | index 602cd63..750f44f 100644 |
6069 | --- a/net/core/sock_diag.c |
6070 | +++ b/net/core/sock_diag.c |
6071 | @@ -121,6 +121,9 @@ static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
6072 | if (nlmsg_len(nlh) < sizeof(*req)) |
6073 | return -EINVAL; |
6074 | |
6075 | + if (req->sdiag_family >= AF_MAX) |
6076 | + return -EINVAL; |
6077 | + |
6078 | hndl = sock_diag_lock_handler(req->sdiag_family); |
6079 | if (hndl == NULL) |
6080 | err = -ENOENT; |
6081 | diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c |
6082 | index 24b384b..fcf104e 100644 |
6083 | --- a/net/ipv4/af_inet.c |
6084 | +++ b/net/ipv4/af_inet.c |
6085 | @@ -248,8 +248,12 @@ EXPORT_SYMBOL(inet_listen); |
6086 | u32 inet_ehash_secret __read_mostly; |
6087 | EXPORT_SYMBOL(inet_ehash_secret); |
6088 | |
6089 | +u32 ipv6_hash_secret __read_mostly; |
6090 | +EXPORT_SYMBOL(ipv6_hash_secret); |
6091 | + |
6092 | /* |
6093 | - * inet_ehash_secret must be set exactly once |
6094 | + * inet_ehash_secret must be set exactly once, and to a non nul value |
6095 | + * ipv6_hash_secret must be set exactly once. |
6096 | */ |
6097 | void build_ehash_secret(void) |
6098 | { |
6099 | @@ -259,7 +263,8 @@ void build_ehash_secret(void) |
6100 | get_random_bytes(&rnd, sizeof(rnd)); |
6101 | } while (rnd == 0); |
6102 | |
6103 | - cmpxchg(&inet_ehash_secret, 0, rnd); |
6104 | + if (cmpxchg(&inet_ehash_secret, 0, rnd) == 0) |
6105 | + get_random_bytes(&ipv6_hash_secret, sizeof(ipv6_hash_secret)); |
6106 | } |
6107 | EXPORT_SYMBOL(build_ehash_secret); |
6108 | |
6109 | @@ -1590,7 +1595,7 @@ static const struct net_offload udp_offload = { |
6110 | |
6111 | static const struct net_protocol icmp_protocol = { |
6112 | .handler = icmp_rcv, |
6113 | - .err_handler = ping_err, |
6114 | + .err_handler = icmp_err, |
6115 | .no_policy = 1, |
6116 | .netns_ok = 1, |
6117 | }; |
6118 | diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
6119 | index 17ff9fd..3ac5dff 100644 |
6120 | --- a/net/ipv4/icmp.c |
6121 | +++ b/net/ipv4/icmp.c |
6122 | @@ -934,6 +934,29 @@ error: |
6123 | goto drop; |
6124 | } |
6125 | |
6126 | +void icmp_err(struct sk_buff *skb, u32 info) |
6127 | +{ |
6128 | + struct iphdr *iph = (struct iphdr *)skb->data; |
6129 | + struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2)); |
6130 | + int type = icmp_hdr(skb)->type; |
6131 | + int code = icmp_hdr(skb)->code; |
6132 | + struct net *net = dev_net(skb->dev); |
6133 | + |
6134 | + /* |
6135 | + * Use ping_err to handle all icmp errors except those |
6136 | + * triggered by ICMP_ECHOREPLY which sent from kernel. |
6137 | + */ |
6138 | + if (icmph->type != ICMP_ECHOREPLY) { |
6139 | + ping_err(skb, info); |
6140 | + return; |
6141 | + } |
6142 | + |
6143 | + if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) |
6144 | + ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ICMP, 0); |
6145 | + else if (type == ICMP_REDIRECT) |
6146 | + ipv4_redirect(skb, net, 0, 0, IPPROTO_ICMP, 0); |
6147 | +} |
6148 | + |
6149 | /* |
6150 | * This table is the definition of how we handle ICMP. |
6151 | */ |
6152 | diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c |
6153 | index 6f9c072..dc454cc 100644 |
6154 | --- a/net/ipv4/ping.c |
6155 | +++ b/net/ipv4/ping.c |
6156 | @@ -322,8 +322,8 @@ void ping_err(struct sk_buff *skb, u32 info) |
6157 | struct iphdr *iph = (struct iphdr *)skb->data; |
6158 | struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2)); |
6159 | struct inet_sock *inet_sock; |
6160 | - int type = icmph->type; |
6161 | - int code = icmph->code; |
6162 | + int type = icmp_hdr(skb)->type; |
6163 | + int code = icmp_hdr(skb)->code; |
6164 | struct net *net = dev_net(skb->dev); |
6165 | struct sock *sk; |
6166 | int harderr; |
6167 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
6168 | index 5d45159..ff031a5 100644 |
6169 | --- a/net/ipv4/tcp_output.c |
6170 | +++ b/net/ipv4/tcp_output.c |
6171 | @@ -1351,8 +1351,8 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) |
6172 | return 0; |
6173 | } |
6174 | |
6175 | -/* Calculate MSS. Not accounting for SACKs here. */ |
6176 | -int tcp_mtu_to_mss(struct sock *sk, int pmtu) |
6177 | +/* Calculate MSS not accounting any TCP options. */ |
6178 | +static inline int __tcp_mtu_to_mss(struct sock *sk, int pmtu) |
6179 | { |
6180 | const struct tcp_sock *tp = tcp_sk(sk); |
6181 | const struct inet_connection_sock *icsk = inet_csk(sk); |
6182 | @@ -1381,13 +1381,17 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu) |
6183 | /* Then reserve room for full set of TCP options and 8 bytes of data */ |
6184 | if (mss_now < 48) |
6185 | mss_now = 48; |
6186 | - |
6187 | - /* Now subtract TCP options size, not including SACKs */ |
6188 | - mss_now -= tp->tcp_header_len - sizeof(struct tcphdr); |
6189 | - |
6190 | return mss_now; |
6191 | } |
6192 | |
6193 | +/* Calculate MSS. Not accounting for SACKs here. */ |
6194 | +int tcp_mtu_to_mss(struct sock *sk, int pmtu) |
6195 | +{ |
6196 | + /* Subtract TCP options size, not including SACKs */ |
6197 | + return __tcp_mtu_to_mss(sk, pmtu) - |
6198 | + (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr)); |
6199 | +} |
6200 | + |
6201 | /* Inverse of above */ |
6202 | int tcp_mss_to_mtu(struct sock *sk, int mss) |
6203 | { |
6204 | @@ -2930,7 +2934,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) |
6205 | */ |
6206 | if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->rx_opt.mss_clamp) |
6207 | tp->rx_opt.mss_clamp = tp->rx_opt.user_mss; |
6208 | - space = tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - |
6209 | + space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - |
6210 | MAX_TCP_OPTION_SPACE; |
6211 | |
6212 | syn_data = skb_copy_expand(syn, skb_headroom(syn), space, |
6213 | diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
6214 | index 363d8b7..6f9f7b6 100644 |
6215 | --- a/net/ipv6/route.c |
6216 | +++ b/net/ipv6/route.c |
6217 | @@ -300,6 +300,7 @@ static void ip6_dst_destroy(struct dst_entry *dst) |
6218 | { |
6219 | struct rt6_info *rt = (struct rt6_info *)dst; |
6220 | struct inet6_dev *idev = rt->rt6i_idev; |
6221 | + struct dst_entry *from = dst->from; |
6222 | |
6223 | if (rt->n) |
6224 | neigh_release(rt->n); |
6225 | @@ -312,8 +313,8 @@ static void ip6_dst_destroy(struct dst_entry *dst) |
6226 | in6_dev_put(idev); |
6227 | } |
6228 | |
6229 | - if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from) |
6230 | - dst_release(dst->from); |
6231 | + dst->from = NULL; |
6232 | + dst_release(from); |
6233 | |
6234 | if (rt6_has_peer(rt)) { |
6235 | struct inet_peer *peer = rt6_peer_ptr(rt); |
6236 | @@ -1054,7 +1055,6 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori |
6237 | |
6238 | rt->rt6i_gateway = ort->rt6i_gateway; |
6239 | rt->rt6i_flags = ort->rt6i_flags; |
6240 | - rt6_clean_expires(rt); |
6241 | rt->rt6i_metric = 0; |
6242 | |
6243 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); |
6244 | @@ -1859,8 +1859,6 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
6245 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == |
6246 | (RTF_DEFAULT | RTF_ADDRCONF)) |
6247 | rt6_set_from(rt, ort); |
6248 | - else |
6249 | - rt6_clean_expires(rt); |
6250 | rt->rt6i_metric = 0; |
6251 | |
6252 | #ifdef CONFIG_IPV6_SUBTREES |
6253 | diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c |
6254 | index c984413..8f32718 100644 |
6255 | --- a/net/ipv6/xfrm6_policy.c |
6256 | +++ b/net/ipv6/xfrm6_policy.c |
6257 | @@ -236,6 +236,8 @@ static void xfrm6_dst_destroy(struct dst_entry *dst) |
6258 | { |
6259 | struct xfrm_dst *xdst = (struct xfrm_dst *)dst; |
6260 | |
6261 | + if (likely(xdst->u.rt6.n)) |
6262 | + neigh_release(xdst->u.rt6.n); |
6263 | if (likely(xdst->u.rt6.rt6i_idev)) |
6264 | in6_dev_put(xdst->u.rt6.rt6i_idev); |
6265 | dst_destroy_metrics_generic(dst); |
6266 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
6267 | index 5107248..f75ba1a 100644 |
6268 | --- a/net/mac80211/mlme.c |
6269 | +++ b/net/mac80211/mlme.c |
6270 | @@ -1812,6 +1812,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata, |
6271 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, |
6272 | transmit_frame, frame_buf); |
6273 | ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; |
6274 | + ieee80211_wake_queues_by_reason(&sdata->local->hw, |
6275 | + IEEE80211_QUEUE_STOP_REASON_CSA); |
6276 | mutex_unlock(&ifmgd->mtx); |
6277 | |
6278 | /* |
6279 | @@ -1856,8 +1858,6 @@ static void ieee80211_csa_connection_drop_work(struct work_struct *work) |
6280 | container_of(work, struct ieee80211_sub_if_data, |
6281 | u.mgd.csa_connection_drop_work); |
6282 | |
6283 | - ieee80211_wake_queues_by_reason(&sdata->local->hw, |
6284 | - IEEE80211_QUEUE_STOP_REASON_CSA); |
6285 | __ieee80211_disconnect(sdata, true); |
6286 | } |
6287 | |
6288 | diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c |
6289 | index 20e4bf5..58dfe08 100644 |
6290 | --- a/security/keys/process_keys.c |
6291 | +++ b/security/keys/process_keys.c |
6292 | @@ -367,6 +367,8 @@ key_ref_t search_my_process_keyrings(struct key_type *type, |
6293 | |
6294 | switch (PTR_ERR(key_ref)) { |
6295 | case -EAGAIN: /* no key */ |
6296 | + if (ret) |
6297 | + break; |
6298 | case -ENOKEY: /* negative key */ |
6299 | ret = key_ref; |
6300 | break; |
6301 | diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c |
6302 | index 3d82232..64d5347 100644 |
6303 | --- a/sound/drivers/aloop.c |
6304 | +++ b/sound/drivers/aloop.c |
6305 | @@ -286,12 +286,14 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) |
6306 | loopback_active_notify(dpcm); |
6307 | break; |
6308 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
6309 | + case SNDRV_PCM_TRIGGER_SUSPEND: |
6310 | spin_lock(&cable->lock); |
6311 | cable->pause |= stream; |
6312 | loopback_timer_stop(dpcm); |
6313 | spin_unlock(&cable->lock); |
6314 | break; |
6315 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
6316 | + case SNDRV_PCM_TRIGGER_RESUME: |
6317 | spin_lock(&cable->lock); |
6318 | dpcm->last_jiffies = jiffies; |
6319 | cable->pause &= ~stream; |
6320 | @@ -563,7 +565,8 @@ static snd_pcm_uframes_t loopback_pointer(struct snd_pcm_substream *substream) |
6321 | static struct snd_pcm_hardware loopback_pcm_hardware = |
6322 | { |
6323 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | |
6324 | - SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE), |
6325 | + SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | |
6326 | + SNDRV_PCM_INFO_RESUME), |
6327 | .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | |
6328 | SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE | |
6329 | SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE), |
6330 | diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c |
6331 | index 136a393..e760af9 100644 |
6332 | --- a/sound/pci/ali5451/ali5451.c |
6333 | +++ b/sound/pci/ali5451/ali5451.c |
6334 | @@ -1435,7 +1435,7 @@ static snd_pcm_uframes_t snd_ali_pointer(struct snd_pcm_substream *substream) |
6335 | |
6336 | spin_lock(&codec->reg_lock); |
6337 | if (!pvoice->running) { |
6338 | - spin_unlock_irq(&codec->reg_lock); |
6339 | + spin_unlock(&codec->reg_lock); |
6340 | return 0; |
6341 | } |
6342 | outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR)); |
6343 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
6344 | index 822df97..713e9af 100644 |
6345 | --- a/sound/pci/hda/hda_codec.c |
6346 | +++ b/sound/pci/hda/hda_codec.c |
6347 | @@ -2160,11 +2160,12 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, |
6348 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); |
6349 | |
6350 | static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name, |
6351 | - int dev) |
6352 | + int start_idx) |
6353 | { |
6354 | - int idx; |
6355 | - for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */ |
6356 | - if (!find_mixer_ctl(codec, name, dev, idx)) |
6357 | + int i, idx; |
6358 | + /* 16 ctlrs should be large enough */ |
6359 | + for (i = 0, idx = start_idx; i < 16; i++, idx++) { |
6360 | + if (!find_mixer_ctl(codec, name, 0, idx)) |
6361 | return idx; |
6362 | } |
6363 | return -EBUSY; |
6364 | @@ -3132,30 +3133,29 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec, |
6365 | int err; |
6366 | struct snd_kcontrol *kctl; |
6367 | struct snd_kcontrol_new *dig_mix; |
6368 | - int idx, dev = 0; |
6369 | - const int spdif_pcm_dev = 1; |
6370 | + int idx = 0; |
6371 | + const int spdif_index = 16; |
6372 | struct hda_spdif_out *spdif; |
6373 | + struct hda_bus *bus = codec->bus; |
6374 | |
6375 | - if (codec->primary_dig_out_type == HDA_PCM_TYPE_HDMI && |
6376 | + if (bus->primary_dig_out_type == HDA_PCM_TYPE_HDMI && |
6377 | type == HDA_PCM_TYPE_SPDIF) { |
6378 | - dev = spdif_pcm_dev; |
6379 | - } else if (codec->primary_dig_out_type == HDA_PCM_TYPE_SPDIF && |
6380 | + idx = spdif_index; |
6381 | + } else if (bus->primary_dig_out_type == HDA_PCM_TYPE_SPDIF && |
6382 | type == HDA_PCM_TYPE_HDMI) { |
6383 | - for (idx = 0; idx < codec->spdif_out.used; idx++) { |
6384 | - spdif = snd_array_elem(&codec->spdif_out, idx); |
6385 | - for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { |
6386 | - kctl = find_mixer_ctl(codec, dig_mix->name, 0, idx); |
6387 | - if (!kctl) |
6388 | - break; |
6389 | - kctl->id.device = spdif_pcm_dev; |
6390 | - } |
6391 | + /* suppose a single SPDIF device */ |
6392 | + for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { |
6393 | + kctl = find_mixer_ctl(codec, dig_mix->name, 0, 0); |
6394 | + if (!kctl) |
6395 | + break; |
6396 | + kctl->id.index = spdif_index; |
6397 | } |
6398 | - codec->primary_dig_out_type = HDA_PCM_TYPE_HDMI; |
6399 | + bus->primary_dig_out_type = HDA_PCM_TYPE_HDMI; |
6400 | } |
6401 | - if (!codec->primary_dig_out_type) |
6402 | - codec->primary_dig_out_type = type; |
6403 | + if (!bus->primary_dig_out_type) |
6404 | + bus->primary_dig_out_type = type; |
6405 | |
6406 | - idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", dev); |
6407 | + idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", idx); |
6408 | if (idx < 0) { |
6409 | printk(KERN_ERR "hda_codec: too many IEC958 outputs\n"); |
6410 | return -EBUSY; |
6411 | @@ -3165,7 +3165,6 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec, |
6412 | kctl = snd_ctl_new1(dig_mix, codec); |
6413 | if (!kctl) |
6414 | return -ENOMEM; |
6415 | - kctl->id.device = dev; |
6416 | kctl->id.index = idx; |
6417 | kctl->private_value = codec->spdif_out.used - 1; |
6418 | err = snd_hda_ctl_add(codec, associated_nid, kctl); |
6419 | diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h |
6420 | index 8665540..a35cf09 100644 |
6421 | --- a/sound/pci/hda/hda_codec.h |
6422 | +++ b/sound/pci/hda/hda_codec.h |
6423 | @@ -671,6 +671,8 @@ struct hda_bus { |
6424 | unsigned int response_reset:1; /* controller was reset */ |
6425 | unsigned int in_reset:1; /* during reset operation */ |
6426 | unsigned int power_keep_link_on:1; /* don't power off HDA link */ |
6427 | + |
6428 | + int primary_dig_out_type; /* primary digital out PCM type */ |
6429 | }; |
6430 | |
6431 | /* |
6432 | @@ -837,7 +839,6 @@ struct hda_codec { |
6433 | struct mutex hash_mutex; |
6434 | struct snd_array spdif_out; |
6435 | unsigned int spdif_in_enable; /* SPDIF input enable? */ |
6436 | - int primary_dig_out_type; /* primary digital out PCM type */ |
6437 | const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ |
6438 | struct snd_array init_pins; /* initial (BIOS) pin configurations */ |
6439 | struct snd_array driver_pins; /* pin configs set by codec parser */ |
6440 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
6441 | index c78286f..63607da 100644 |
6442 | --- a/sound/pci/hda/hda_intel.c |
6443 | +++ b/sound/pci/hda/hda_intel.c |
6444 | @@ -3624,7 +3624,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { |
6445 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, |
6446 | /* 5 Series/3400 */ |
6447 | { PCI_DEVICE(0x8086, 0x3b56), |
6448 | - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, |
6449 | + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
6450 | /* Poulsbo */ |
6451 | { PCI_DEVICE(0x8086, 0x811b), |
6452 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
6453 | diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
6454 | index 807a2aa..b14813d 100644 |
6455 | --- a/sound/pci/hda/patch_hdmi.c |
6456 | +++ b/sound/pci/hda/patch_hdmi.c |
6457 | @@ -714,9 +714,10 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca) |
6458 | |
6459 | static void hdmi_setup_channel_mapping(struct hda_codec *codec, |
6460 | hda_nid_t pin_nid, bool non_pcm, int ca, |
6461 | - int channels, unsigned char *map) |
6462 | + int channels, unsigned char *map, |
6463 | + bool chmap_set) |
6464 | { |
6465 | - if (!non_pcm && map) { |
6466 | + if (!non_pcm && chmap_set) { |
6467 | hdmi_manual_setup_channel_mapping(codec, pin_nid, |
6468 | channels, map); |
6469 | } else { |
6470 | @@ -905,7 +906,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, |
6471 | pin_nid, |
6472 | channels); |
6473 | hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca, |
6474 | - channels, per_pin->chmap); |
6475 | + channels, per_pin->chmap, |
6476 | + per_pin->chmap_set); |
6477 | hdmi_stop_infoframe_trans(codec, pin_nid); |
6478 | hdmi_fill_audio_infoframe(codec, pin_nid, |
6479 | ai.bytes, sizeof(ai)); |
6480 | @@ -915,7 +917,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, |
6481 | * accordingly */ |
6482 | if (per_pin->non_pcm != non_pcm) |
6483 | hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca, |
6484 | - channels, per_pin->chmap); |
6485 | + channels, per_pin->chmap, |
6486 | + per_pin->chmap_set); |
6487 | } |
6488 | |
6489 | per_pin->non_pcm = non_pcm; |
6490 | @@ -1100,8 +1103,12 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, |
6491 | if (!static_hdmi_pcm && eld->eld_valid) { |
6492 | snd_hdmi_eld_update_pcm_info(eld, hinfo); |
6493 | if (hinfo->channels_min > hinfo->channels_max || |
6494 | - !hinfo->rates || !hinfo->formats) |
6495 | + !hinfo->rates || !hinfo->formats) { |
6496 | + per_cvt->assigned = 0; |
6497 | + hinfo->nid = 0; |
6498 | + snd_hda_spdif_ctls_unassign(codec, pin_idx); |
6499 | return -ENODEV; |
6500 | + } |
6501 | } |
6502 | |
6503 | /* Store the updated parameters */ |
6504 | @@ -1165,6 +1172,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) |
6505 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
6506 | codec->addr, pin_nid, eld->monitor_present, eld_valid); |
6507 | |
6508 | + eld->eld_valid = false; |
6509 | if (eld_valid) { |
6510 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) |
6511 | snd_hdmi_show_eld(eld); |
6512 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
6513 | index 5faaad2..47fb18d 100644 |
6514 | --- a/sound/pci/hda/patch_realtek.c |
6515 | +++ b/sound/pci/hda/patch_realtek.c |
6516 | @@ -5394,6 +5394,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
6517 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
6518 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
6519 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
6520 | + SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
6521 | |
6522 | /* All Apple entries are in codec SSIDs */ |
6523 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), |
6524 | diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c |
6525 | index 2450663..0ecd410 100644 |
6526 | --- a/sound/pci/rme32.c |
6527 | +++ b/sound/pci/rme32.c |
6528 | @@ -1017,7 +1017,7 @@ static int snd_rme32_capture_close(struct snd_pcm_substream *substream) |
6529 | spin_lock_irq(&rme32->lock); |
6530 | rme32->capture_substream = NULL; |
6531 | rme32->capture_periodsize = 0; |
6532 | - spin_unlock(&rme32->lock); |
6533 | + spin_unlock_irq(&rme32->lock); |
6534 | return 0; |
6535 | } |
6536 | |
6537 | diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c |
6538 | index ef62c43..2899cb9 100644 |
6539 | --- a/sound/soc/codecs/arizona.c |
6540 | +++ b/sound/soc/codecs/arizona.c |
6541 | @@ -910,7 +910,7 @@ static int arizona_calc_fll(struct arizona_fll *fll, |
6542 | |
6543 | cfg->n = target / (ratio * Fref); |
6544 | |
6545 | - if (target % Fref) { |
6546 | + if (target % (ratio * Fref)) { |
6547 | gcd_fll = gcd(target, ratio * Fref); |
6548 | arizona_fll_dbg(fll, "GCD=%u\n", gcd_fll); |
6549 | |
6550 | @@ -922,6 +922,15 @@ static int arizona_calc_fll(struct arizona_fll *fll, |
6551 | cfg->lambda = 0; |
6552 | } |
6553 | |
6554 | + /* Round down to 16bit range with cost of accuracy lost. |
6555 | + * Denominator must be bigger than numerator so we only |
6556 | + * take care of it. |
6557 | + */ |
6558 | + while (cfg->lambda >= (1 << 16)) { |
6559 | + cfg->theta >>= 1; |
6560 | + cfg->lambda >>= 1; |
6561 | + } |
6562 | + |
6563 | arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n", |
6564 | cfg->n, cfg->theta, cfg->lambda); |
6565 | arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n", |
6566 | diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c |
6567 | index d8c65f5..d5371e0 100644 |
6568 | --- a/sound/soc/codecs/wm2200.c |
6569 | +++ b/sound/soc/codecs/wm2200.c |
6570 | @@ -1126,9 +1126,9 @@ SOC_DOUBLE_R_TLV("IN3 Volume", WM2200_IN3L_CONTROL, WM2200_IN3R_CONTROL, |
6571 | |
6572 | SOC_DOUBLE_R("IN1 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_1L, |
6573 | WM2200_ADC_DIGITAL_VOLUME_1R, WM2200_IN1L_MUTE_SHIFT, 1, 1), |
6574 | -SOC_DOUBLE_R("IN2 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_1L, |
6575 | +SOC_DOUBLE_R("IN2 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_2L, |
6576 | WM2200_ADC_DIGITAL_VOLUME_2R, WM2200_IN2L_MUTE_SHIFT, 1, 1), |
6577 | -SOC_DOUBLE_R("IN3 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_1L, |
6578 | +SOC_DOUBLE_R("IN3 Digital Switch", WM2200_ADC_DIGITAL_VOLUME_3L, |
6579 | WM2200_ADC_DIGITAL_VOLUME_3R, WM2200_IN3L_MUTE_SHIFT, 1, 1), |
6580 | |
6581 | SOC_DOUBLE_R_TLV("IN1 Digital Volume", WM2200_ADC_DIGITAL_VOLUME_1L, |
6582 | diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
6583 | index 64d25a7..820580a 100644 |
6584 | --- a/sound/usb/quirks-table.h |
6585 | +++ b/sound/usb/quirks-table.h |
6586 | @@ -1750,7 +1750,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
6587 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
6588 | /* .vendor_name = "Roland", */ |
6589 | /* .product_name = "A-PRO", */ |
6590 | - .ifnum = 1, |
6591 | + .ifnum = 0, |
6592 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
6593 | .data = & (const struct snd_usb_midi_endpoint_info) { |
6594 | .out_cables = 0x0003, |
6595 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
6596 | index 2c97185..0115289 100644 |
6597 | --- a/sound/usb/quirks.c |
6598 | +++ b/sound/usb/quirks.c |
6599 | @@ -533,7 +533,7 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) |
6600 | { |
6601 | struct usb_host_config *config = dev->actconfig; |
6602 | int err; |
6603 | - u8 bootresponse[12]; |
6604 | + u8 bootresponse[0x12]; |
6605 | int fwsize; |
6606 | int count; |
6607 | |
6608 | diff --git a/tools/perf/Makefile b/tools/perf/Makefile |
6609 | index 8ab05e5..fb1b1c4 100644 |
6610 | --- a/tools/perf/Makefile |
6611 | +++ b/tools/perf/Makefile |
6612 | @@ -276,13 +276,13 @@ $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-event |
6613 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c |
6614 | |
6615 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
6616 | - $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c |
6617 | + $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ |
6618 | |
6619 | $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c |
6620 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c |
6621 | |
6622 | $(OUTPUT)util/pmu-bison.c: util/pmu.y |
6623 | - $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c |
6624 | + $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ |
6625 | |
6626 | $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c |
6627 | $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c |
6628 | diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c |
6629 | index aa84130..6416580 100644 |
6630 | --- a/tools/perf/ui/hist.c |
6631 | +++ b/tools/perf/ui/hist.c |
6632 | @@ -463,11 +463,15 @@ int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, |
6633 | if (!perf_hpp__format[i].cond) |
6634 | continue; |
6635 | |
6636 | + /* |
6637 | + * If there's no field_sep, we still need |
6638 | + * to display initial ' '. |
6639 | + */ |
6640 | if (!sep || !first) { |
6641 | ret = scnprintf(hpp->buf, hpp->size, "%s", sep ?: " "); |
6642 | advance_hpp(hpp, ret); |
6643 | + } else |
6644 | first = false; |
6645 | - } |
6646 | |
6647 | if (color && perf_hpp__format[i].color) |
6648 | ret = perf_hpp__format[i].color(hpp, he); |
6649 | diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y |
6650 | index 0f9914a..7bf890e 100644 |
6651 | --- a/tools/perf/util/parse-events.y |
6652 | +++ b/tools/perf/util/parse-events.y |
6653 | @@ -1,5 +1,4 @@ |
6654 | %pure-parser |
6655 | -%name-prefix "parse_events_" |
6656 | %parse-param {void *_data} |
6657 | %parse-param {void *scanner} |
6658 | %lex-param {void* scanner} |
6659 | diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y |
6660 | index ec89804..bfd7e85 100644 |
6661 | --- a/tools/perf/util/pmu.y |
6662 | +++ b/tools/perf/util/pmu.y |
6663 | @@ -1,5 +1,4 @@ |
6664 | |
6665 | -%name-prefix "perf_pmu_" |
6666 | %parse-param {struct list_head *format} |
6667 | %parse-param {char *name} |
6668 |