Magellan Linux

Contents of /trunk/kernel-alx/patches-3.8/0111-3.8.12-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2175 - (show annotations) (download)
Thu May 16 13:33:01 2013 UTC (10 years, 11 months ago) by niro
File size: 105055 byte(s)
-linux-3.8.12
1 diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
2 index cb7bcc5..02b70a4 100644
3 --- a/arch/arm/boot/dts/at91sam9260.dtsi
4 +++ b/arch/arm/boot/dts/at91sam9260.dtsi
5 @@ -158,8 +158,8 @@
6 usart1 {
7 pinctrl_usart1: usart1-0 {
8 atmel,pins =
9 - <2 6 0x1 0x1 /* PB6 periph A with pullup */
10 - 2 7 0x1 0x0>; /* PB7 periph A */
11 + <1 6 0x1 0x1 /* PB6 periph A with pullup */
12 + 1 7 0x1 0x0>; /* PB7 periph A */
13 };
14
15 pinctrl_usart1_rts: usart1_rts-0 {
16 @@ -194,18 +194,18 @@
17 usart3 {
18 pinctrl_usart3: usart3-0 {
19 atmel,pins =
20 - <2 10 0x1 0x1 /* PB10 periph A with pullup */
21 - 2 11 0x1 0x0>; /* PB11 periph A */
22 + <1 10 0x1 0x1 /* PB10 periph A with pullup */
23 + 1 11 0x1 0x0>; /* PB11 periph A */
24 };
25
26 pinctrl_usart3_rts: usart3_rts-0 {
27 atmel,pins =
28 - <3 8 0x2 0x0>; /* PB8 periph B */
29 + <2 8 0x2 0x0>; /* PC8 periph B */
30 };
31
32 pinctrl_usart3_cts: usart3_cts-0 {
33 atmel,pins =
34 - <3 10 0x2 0x0>; /* PB10 periph B */
35 + <2 10 0x2 0x0>; /* PC10 periph B */
36 };
37 };
38
39 @@ -220,8 +220,8 @@
40 uart1 {
41 pinctrl_uart1: uart1-0 {
42 atmel,pins =
43 - <2 12 0x1 0x1 /* PB12 periph A with pullup */
44 - 2 13 0x1 0x0>; /* PB13 periph A */
45 + <1 12 0x1 0x1 /* PB12 periph A with pullup */
46 + 1 13 0x1 0x0>; /* PB13 periph A */
47 };
48 };
49
50 diff --git a/arch/arm/boot/dts/at91sam9g15.dtsi b/arch/arm/boot/dts/at91sam9g15.dtsi
51 index fbe7a70..28467fd 100644
52 --- a/arch/arm/boot/dts/at91sam9g15.dtsi
53 +++ b/arch/arm/boot/dts/at91sam9g15.dtsi
54 @@ -10,7 +10,7 @@
55
56 / {
57 model = "Atmel AT91SAM9G15 SoC";
58 - compatible = "atmel, at91sam9g15, atmel,at91sam9x5";
59 + compatible = "atmel,at91sam9g15", "atmel,at91sam9x5";
60
61 ahb {
62 apb {
63 diff --git a/arch/arm/boot/dts/at91sam9g15ek.dts b/arch/arm/boot/dts/at91sam9g15ek.dts
64 index 86dd3f6..5427b2d 100644
65 --- a/arch/arm/boot/dts/at91sam9g15ek.dts
66 +++ b/arch/arm/boot/dts/at91sam9g15ek.dts
67 @@ -11,6 +11,6 @@
68 /include/ "at91sam9x5ek.dtsi"
69
70 / {
71 - model = "Atmel AT91SAM9G25-EK";
72 + model = "Atmel AT91SAM9G15-EK";
73 compatible = "atmel,at91sam9g15ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
74 };
75 diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
76 index 05a718f..5fd32df 100644
77 --- a/arch/arm/boot/dts/at91sam9g25.dtsi
78 +++ b/arch/arm/boot/dts/at91sam9g25.dtsi
79 @@ -10,7 +10,7 @@
80
81 / {
82 model = "Atmel AT91SAM9G25 SoC";
83 - compatible = "atmel, at91sam9g25, atmel,at91sam9x5";
84 + compatible = "atmel,at91sam9g25", "atmel,at91sam9x5";
85
86 ahb {
87 apb {
88 diff --git a/arch/arm/boot/dts/at91sam9g35.dtsi b/arch/arm/boot/dts/at91sam9g35.dtsi
89 index f9d14a7..d6fa8af 100644
90 --- a/arch/arm/boot/dts/at91sam9g35.dtsi
91 +++ b/arch/arm/boot/dts/at91sam9g35.dtsi
92 @@ -10,7 +10,7 @@
93
94 / {
95 model = "Atmel AT91SAM9G35 SoC";
96 - compatible = "atmel, at91sam9g35, atmel,at91sam9x5";
97 + compatible = "atmel,at91sam9g35", "atmel,at91sam9x5";
98
99 ahb {
100 apb {
101 diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
102 index 54eb33b..9ac2bc2 100644
103 --- a/arch/arm/boot/dts/at91sam9x25.dtsi
104 +++ b/arch/arm/boot/dts/at91sam9x25.dtsi
105 @@ -10,7 +10,7 @@
106
107 / {
108 model = "Atmel AT91SAM9X25 SoC";
109 - compatible = "atmel, at91sam9x25, atmel,at91sam9x5";
110 + compatible = "atmel,at91sam9x25", "atmel,at91sam9x5";
111
112 ahb {
113 apb {
114 diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
115 index fb102d6..ba67d83 100644
116 --- a/arch/arm/boot/dts/at91sam9x35.dtsi
117 +++ b/arch/arm/boot/dts/at91sam9x35.dtsi
118 @@ -10,7 +10,7 @@
119
120 / {
121 model = "Atmel AT91SAM9X35 SoC";
122 - compatible = "atmel, at91sam9x35, atmel,at91sam9x5";
123 + compatible = "atmel,at91sam9x35", "atmel,at91sam9x5";
124
125 ahb {
126 apb {
127 diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
128 index 8a7cf1d..ccab256 100644
129 --- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
130 +++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
131 @@ -13,7 +13,7 @@
132 compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
133
134 chosen {
135 - bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
136 + bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
137 };
138
139 ahb {
140 diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
141 index 606d48f..8aab786 100644
142 --- a/arch/arm/configs/at91sam9g45_defconfig
143 +++ b/arch/arm/configs/at91sam9g45_defconfig
144 @@ -173,7 +173,6 @@ CONFIG_MMC=y
145 # CONFIG_MMC_BLOCK_BOUNCE is not set
146 CONFIG_SDIO_UART=m
147 CONFIG_MMC_ATMELMCI=y
148 -CONFIG_MMC_ATMELMCI_DMA=y
149 CONFIG_LEDS_ATMEL_PWM=y
150 CONFIG_LEDS_GPIO=y
151 CONFIG_LEDS_TRIGGER_TIMER=y
152 diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
153 index c094749..26e9ce4 100644
154 --- a/arch/arm/include/asm/pgtable.h
155 +++ b/arch/arm/include/asm/pgtable.h
156 @@ -61,6 +61,15 @@ extern void __pgd_error(const char *file, int line, pgd_t);
157 #define FIRST_USER_ADDRESS PAGE_SIZE
158
159 /*
160 + * Use TASK_SIZE as the ceiling argument for free_pgtables() and
161 + * free_pgd_range() to avoid freeing the modules pmd when LPAE is enabled (pmd
162 + * page shared between user and kernel).
163 + */
164 +#ifdef CONFIG_ARM_LPAE
165 +#define USER_PGTABLES_CEILING TASK_SIZE
166 +#endif
167 +
168 +/*
169 * The pgprot_* and protection_map entries will be fixed up in runtime
170 * to include the cachable and bufferable bits based on memory policy,
171 * as well as any architecture dependent bits like global/ASID and SMP
172 diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
173 index 4b67847..6b4608d 100644
174 --- a/arch/arm/mach-at91/setup.c
175 +++ b/arch/arm/mach-at91/setup.c
176 @@ -333,7 +333,7 @@ static void at91_dt_rstc(void)
177
178 of_id = of_match_node(rstc_ids, np);
179 if (!of_id)
180 - panic("AT91: rtsc no restart function availlable\n");
181 + panic("AT91: rtsc no restart function available\n");
182
183 arm_pm_restart = of_id->data;
184
185 diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
186 index 22590db..aa20002 100644
187 --- a/arch/arm/mach-omap2/cpuidle34xx.c
188 +++ b/arch/arm/mach-omap2/cpuidle34xx.c
189 @@ -265,8 +265,9 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
190 static DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
191
192 static struct cpuidle_driver omap3_idle_driver = {
193 - .name = "omap3_idle",
194 - .owner = THIS_MODULE,
195 + .name = "omap3_idle",
196 + .owner = THIS_MODULE,
197 + .en_core_tk_irqen = 1,
198 .states = {
199 {
200 .enter = omap3_enter_idle_bm,
201 diff --git a/arch/arm/mach-u300/include/mach/u300-regs.h b/arch/arm/mach-u300/include/mach/u300-regs.h
202 index 1e49d90..0320495 100644
203 --- a/arch/arm/mach-u300/include/mach/u300-regs.h
204 +++ b/arch/arm/mach-u300/include/mach/u300-regs.h
205 @@ -95,7 +95,7 @@
206 #define U300_SPI_BASE (U300_FAST_PER_PHYS_BASE+0x6000)
207
208 /* Fast UART1 on U335 only */
209 -#define U300_UART1_BASE (U300_SLOW_PER_PHYS_BASE+0x7000)
210 +#define U300_UART1_BASE (U300_FAST_PER_PHYS_BASE+0x7000)
211
212 /*
213 * SLOW peripherals
214 diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
215 index 0421498..9791820 100644
216 --- a/arch/avr32/configs/favr-32_defconfig
217 +++ b/arch/avr32/configs/favr-32_defconfig
218 @@ -122,7 +122,6 @@ CONFIG_USB_G_SERIAL=m
219 CONFIG_USB_CDC_COMPOSITE=m
220 CONFIG_MMC=y
221 CONFIG_MMC_ATMELMCI=y
222 -CONFIG_MMC_ATMELMCI_DMA=y
223 CONFIG_NEW_LEDS=y
224 CONFIG_LEDS_CLASS=y
225 CONFIG_LEDS_ATMEL_PWM=m
226 diff --git a/arch/avr32/configs/merisc_defconfig b/arch/avr32/configs/merisc_defconfig
227 index 3befab9..65de443 100644
228 --- a/arch/avr32/configs/merisc_defconfig
229 +++ b/arch/avr32/configs/merisc_defconfig
230 @@ -102,7 +102,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
231 CONFIG_LOGO=y
232 CONFIG_MMC=y
233 CONFIG_MMC_ATMELMCI=y
234 -CONFIG_MMC_ATMELMCI_DMA=y
235 CONFIG_NEW_LEDS=y
236 CONFIG_LEDS_CLASS=y
237 CONFIG_LEDS_ATMEL_PWM=y
238 diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
239 index d2bf1fd..76acbcd 100644
240 --- a/arch/ia64/include/asm/futex.h
241 +++ b/arch/ia64/include/asm/futex.h
242 @@ -106,16 +106,15 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
243 return -EFAULT;
244
245 {
246 - register unsigned long r8 __asm ("r8");
247 + register unsigned long r8 __asm ("r8") = 0;
248 unsigned long prev;
249 __asm__ __volatile__(
250 " mf;; \n"
251 - " mov %0=r0 \n"
252 " mov ar.ccv=%4;; \n"
253 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
254 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
255 "[2:]"
256 - : "=r" (r8), "=r" (prev)
257 + : "+r" (r8), "=&r" (prev)
258 : "r" (uaddr), "r" (newval),
259 "rO" ((long) (unsigned) oldval)
260 : "memory");
261 diff --git a/arch/ia64/include/asm/mca.h b/arch/ia64/include/asm/mca.h
262 index 43f96ab..8c70961 100644
263 --- a/arch/ia64/include/asm/mca.h
264 +++ b/arch/ia64/include/asm/mca.h
265 @@ -143,6 +143,7 @@ extern unsigned long __per_cpu_mca[NR_CPUS];
266 extern int cpe_vector;
267 extern int ia64_cpe_irq;
268 extern void ia64_mca_init(void);
269 +extern void ia64_mca_irq_init(void);
270 extern void ia64_mca_cpu_init(void *);
271 extern void ia64_os_mca_dispatch(void);
272 extern void ia64_os_mca_dispatch_end(void);
273 diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
274 index ad69606..f2c41828 100644
275 --- a/arch/ia64/kernel/irq.c
276 +++ b/arch/ia64/kernel/irq.c
277 @@ -23,6 +23,8 @@
278 #include <linux/interrupt.h>
279 #include <linux/kernel_stat.h>
280
281 +#include <asm/mca.h>
282 +
283 /*
284 * 'what should we do if we get a hw irq event on an illegal vector'.
285 * each architecture has to answer this themselves.
286 @@ -83,6 +85,12 @@ bool is_affinity_mask_valid(const struct cpumask *cpumask)
287
288 #endif /* CONFIG_SMP */
289
290 +int __init arch_early_irq_init(void)
291 +{
292 + ia64_mca_irq_init();
293 + return 0;
294 +}
295 +
296 #ifdef CONFIG_HOTPLUG_CPU
297 unsigned int vectors_in_migration[NR_IRQS];
298
299 diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
300 index 65bf9cd..d7396db 100644
301 --- a/arch/ia64/kernel/mca.c
302 +++ b/arch/ia64/kernel/mca.c
303 @@ -2074,22 +2074,16 @@ ia64_mca_init(void)
304 printk(KERN_INFO "MCA related initialization done\n");
305 }
306
307 +
308 /*
309 - * ia64_mca_late_init
310 - *
311 - * Opportunity to setup things that require initialization later
312 - * than ia64_mca_init. Setup a timer to poll for CPEs if the
313 - * platform doesn't support an interrupt driven mechanism.
314 - *
315 - * Inputs : None
316 - * Outputs : Status
317 + * These pieces cannot be done in ia64_mca_init() because it is called before
318 + * early_irq_init() which would wipe out our percpu irq registrations. But we
319 + * cannot leave them until ia64_mca_late_init() because by then all the other
320 + * processors have been brought online and have set their own CMC vectors to
321 + * point at a non-existant action. Called from arch_early_irq_init().
322 */
323 -static int __init
324 -ia64_mca_late_init(void)
325 +void __init ia64_mca_irq_init(void)
326 {
327 - if (!mca_init)
328 - return 0;
329 -
330 /*
331 * Configure the CMCI/P vector and handler. Interrupts for CMC are
332 * per-processor, so AP CMC interrupts are setup in smp_callin() (smpboot.c).
333 @@ -2108,6 +2102,23 @@ ia64_mca_late_init(void)
334 /* Setup the CPEI/P handler */
335 register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);
336 #endif
337 +}
338 +
339 +/*
340 + * ia64_mca_late_init
341 + *
342 + * Opportunity to setup things that require initialization later
343 + * than ia64_mca_init. Setup a timer to poll for CPEs if the
344 + * platform doesn't support an interrupt driven mechanism.
345 + *
346 + * Inputs : None
347 + * Outputs : Status
348 + */
349 +static int __init
350 +ia64_mca_late_init(void)
351 +{
352 + if (!mca_init)
353 + return 0;
354
355 register_hotcpu_notifier(&mca_cpu_notifier);
356
357 diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
358 index 4332f7e..a7869f8 100644
359 --- a/arch/ia64/kvm/vtlb.c
360 +++ b/arch/ia64/kvm/vtlb.c
361 @@ -256,7 +256,7 @@ u64 guest_vhpt_lookup(u64 iha, u64 *pte)
362 "srlz.d;;"
363 "ssm psr.i;;"
364 "srlz.d;;"
365 - : "=r"(ret) : "r"(iha), "r"(pte):"memory");
366 + : "=&r"(ret) : "r"(iha), "r"(pte) : "memory");
367
368 return ret;
369 }
370 diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S
371 index 57cf140..0c0fc7b 100644
372 --- a/arch/powerpc/kernel/cpu_setup_power.S
373 +++ b/arch/powerpc/kernel/cpu_setup_power.S
374 @@ -64,6 +64,7 @@ _GLOBAL(__restore_cpu_power8)
375 mflr r11
376 mfmsr r3
377 rldicl. r0,r3,4,63
378 + mtlr r11
379 beqlr
380 li r0,0
381 mtspr SPRN_LPID,r0
382 diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
383 index 3684cbd..bb11075 100644
384 --- a/arch/powerpc/kernel/exceptions-64s.S
385 +++ b/arch/powerpc/kernel/exceptions-64s.S
386 @@ -740,7 +740,7 @@ hardware_interrupt_relon_hv:
387 _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV)
388 FTR_SECTION_ELSE
389 _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR)
390 - ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_206)
391 + ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
392 STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment)
393 STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check)
394 STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
395 diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
396 index 116f086..1a63feb 100644
397 --- a/arch/powerpc/kernel/head_64.S
398 +++ b/arch/powerpc/kernel/head_64.S
399 @@ -490,6 +490,7 @@ _GLOBAL(copy_and_flush)
400 sync
401 addi r5,r5,8
402 addi r6,r6,8
403 + isync
404 blr
405
406 .align 8
407 diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
408 index dba1ce2..506dc9f 100644
409 --- a/arch/powerpc/platforms/cell/spufs/inode.c
410 +++ b/arch/powerpc/platforms/cell/spufs/inode.c
411 @@ -99,6 +99,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
412 if (!inode)
413 goto out;
414
415 + inode->i_ino = get_next_ino();
416 inode->i_mode = mode;
417 inode->i_uid = current_fsuid();
418 inode->i_gid = current_fsgid();
419 diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
420 index 93c6d39..b0f7d39 100644
421 --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
422 +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
423 @@ -42,6 +42,8 @@
424 * SOFTWARE.
425 */
426
427 +#include <asm/inst.h>
428 +
429 ## ISCSI CRC 32 Implementation with crc32 and pclmulqdq Instruction
430
431 .macro LABEL prefix n
432 @@ -224,10 +226,10 @@ LABEL crc_ %i
433 movdqa (bufp), %xmm0 # 2 consts: K1:K2
434
435 movq crc_init, %xmm1 # CRC for block 1
436 - pclmulqdq $0x00,%xmm0,%xmm1 # Multiply by K2
437 + PCLMULQDQ 0x00,%xmm0,%xmm1 # Multiply by K2
438
439 movq crc1, %xmm2 # CRC for block 2
440 - pclmulqdq $0x10, %xmm0, %xmm2 # Multiply by K1
441 + PCLMULQDQ 0x10, %xmm0, %xmm2 # Multiply by K1
442
443 pxor %xmm2,%xmm1
444 movq %xmm1, %rax
445 diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
446 index e4595f1..84b7789 100644
447 --- a/arch/x86/kernel/irq.c
448 +++ b/arch/x86/kernel/irq.c
449 @@ -165,10 +165,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
450 u64 arch_irq_stat(void)
451 {
452 u64 sum = atomic_read(&irq_err_count);
453 -
454 -#ifdef CONFIG_X86_IO_APIC
455 - sum += atomic_read(&irq_mis_count);
456 -#endif
457 return sum;
458 }
459
460 diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
461 index a27e763..d330b3c 100644
462 --- a/arch/x86/kvm/emulate.c
463 +++ b/arch/x86/kvm/emulate.c
464 @@ -4030,6 +4030,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
465 break;
466 case OpMem8:
467 ctxt->memop.bytes = 1;
468 + if (ctxt->memop.type == OP_REG) {
469 + ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1);
470 + fetch_register_operand(&ctxt->memop);
471 + }
472 goto mem_common;
473 case OpMem16:
474 ctxt->memop.bytes = 2;
475 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
476 index 2262003..08c6511 100644
477 --- a/arch/x86/xen/enlighten.c
478 +++ b/arch/x86/xen/enlighten.c
479 @@ -1589,8 +1589,11 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
480 switch (action) {
481 case CPU_UP_PREPARE:
482 xen_vcpu_setup(cpu);
483 - if (xen_have_vector_callback)
484 + if (xen_have_vector_callback) {
485 xen_init_lock_cpu(cpu);
486 + if (xen_feature(XENFEAT_hvm_safe_pvclock))
487 + xen_setup_timer(cpu);
488 + }
489 break;
490 default:
491 break;
492 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
493 index 34bc4ce..48d7b2c 100644
494 --- a/arch/x86/xen/smp.c
495 +++ b/arch/x86/xen/smp.c
496 @@ -658,6 +658,8 @@ static void xen_hvm_cpu_die(unsigned int cpu)
497 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
498 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
499 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
500 + xen_uninit_lock_cpu(cpu);
501 + xen_teardown_timer(cpu);
502 native_cpu_die(cpu);
503 }
504
505 diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
506 index 0296a95..054cc01 100644
507 --- a/arch/x86/xen/time.c
508 +++ b/arch/x86/xen/time.c
509 @@ -497,7 +497,11 @@ static void xen_hvm_setup_cpu_clockevents(void)
510 {
511 int cpu = smp_processor_id();
512 xen_setup_runstate_info(cpu);
513 - xen_setup_timer(cpu);
514 + /*
515 + * xen_setup_timer(cpu) - snprintf is bad in atomic context. Hence
516 + * doing it xen_hvm_cpu_notify (which gets called by smp_init during
517 + * early bootup and also during CPU hotplug events).
518 + */
519 xen_setup_cpu_clockevents();
520 }
521
522 diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
523 index bd22f86..2999966 100644
524 --- a/drivers/acpi/osl.c
525 +++ b/drivers/acpi/osl.c
526 @@ -642,7 +642,7 @@ void __init acpi_initrd_override(void *data, size_t size)
527 * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area)
528 * works fine.
529 */
530 - memblock_reserve(acpi_tables_addr, acpi_tables_addr + all_tables_size);
531 + memblock_reserve(acpi_tables_addr, all_tables_size);
532 arch_reserve_mem_area(acpi_tables_addr, all_tables_size);
533
534 p = early_ioremap(acpi_tables_addr, all_tables_size);
535 diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
536 index eb73798..77c9a92 100644
537 --- a/drivers/acpi/pci_root.c
538 +++ b/drivers/acpi/pci_root.c
539 @@ -240,8 +240,8 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root,
540 *control &= OSC_PCI_CONTROL_MASKS;
541 capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set;
542 } else {
543 - /* Run _OSC query for all possible controls. */
544 - capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS;
545 + /* Run _OSC query only with existing controls. */
546 + capbuf[OSC_CONTROL_TYPE] = root->osc_control_set;
547 }
548
549 status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
550 diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
551 index 506fbd4..25246e8 100644
552 --- a/drivers/acpi/thermal.c
553 +++ b/drivers/acpi/thermal.c
554 @@ -719,9 +719,19 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
555 return -EINVAL;
556
557 if (type == THERMAL_TRIP_ACTIVE) {
558 - /* aggressive active cooling */
559 - *trend = THERMAL_TREND_RAISING;
560 - return 0;
561 + unsigned long trip_temp;
562 + unsigned long temp = KELVIN_TO_MILLICELSIUS(tz->temperature,
563 + tz->kelvin_offset);
564 + if (thermal_get_trip_temp(thermal, trip, &trip_temp))
565 + return -EINVAL;
566 +
567 + if (temp > trip_temp) {
568 + *trend = THERMAL_TREND_RAISING;
569 + return 0;
570 + } else {
571 + /* Fall back on default trend */
572 + return -EINVAL;
573 + }
574 }
575
576 /*
577 diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
578 index ef01ac0..cc8aa9e 100644
579 --- a/drivers/ata/libata-acpi.c
580 +++ b/drivers/ata/libata-acpi.c
581 @@ -60,7 +60,8 @@ acpi_handle ata_ap_acpi_handle(struct ata_port *ap)
582 if (ap->flags & ATA_FLAG_ACPI_SATA)
583 return NULL;
584
585 - return acpi_get_child(DEVICE_ACPI_HANDLE(ap->host->dev), ap->port_no);
586 + return ap->scsi_host ?
587 + DEVICE_ACPI_HANDLE(&ap->scsi_host->shost_gendev) : NULL;
588 }
589 EXPORT_SYMBOL(ata_ap_acpi_handle);
590
591 @@ -239,28 +240,15 @@ void ata_acpi_dissociate(struct ata_host *host)
592 }
593 }
594
595 -/**
596 - * ata_acpi_gtm - execute _GTM
597 - * @ap: target ATA port
598 - * @gtm: out parameter for _GTM result
599 - *
600 - * Evaluate _GTM and store the result in @gtm.
601 - *
602 - * LOCKING:
603 - * EH context.
604 - *
605 - * RETURNS:
606 - * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure.
607 - */
608 -int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
609 +static int __ata_acpi_gtm(struct ata_port *ap, acpi_handle handle,
610 + struct ata_acpi_gtm *gtm)
611 {
612 struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER };
613 union acpi_object *out_obj;
614 acpi_status status;
615 int rc = 0;
616
617 - status = acpi_evaluate_object(ata_ap_acpi_handle(ap), "_GTM", NULL,
618 - &output);
619 + status = acpi_evaluate_object(handle, "_GTM", NULL, &output);
620
621 rc = -ENOENT;
622 if (status == AE_NOT_FOUND)
623 @@ -294,6 +282,27 @@ int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
624 return rc;
625 }
626
627 +/**
628 + * ata_acpi_gtm - execute _GTM
629 + * @ap: target ATA port
630 + * @gtm: out parameter for _GTM result
631 + *
632 + * Evaluate _GTM and store the result in @gtm.
633 + *
634 + * LOCKING:
635 + * EH context.
636 + *
637 + * RETURNS:
638 + * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure.
639 + */
640 +int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
641 +{
642 + if (ata_ap_acpi_handle(ap))
643 + return __ata_acpi_gtm(ap, ata_ap_acpi_handle(ap), gtm);
644 + else
645 + return -EINVAL;
646 +}
647 +
648 EXPORT_SYMBOL_GPL(ata_acpi_gtm);
649
650 /**
651 @@ -1095,7 +1104,7 @@ static int ata_acpi_bind_host(struct ata_port *ap, acpi_handle *handle)
652 if (!*handle)
653 return -ENODEV;
654
655 - if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
656 + if (__ata_acpi_gtm(ap, *handle, &ap->__acpi_init_gtm) == 0)
657 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
658
659 return 0;
660 diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
661 index 5dba77c..b1a664a 100644
662 --- a/drivers/ata/sata_highbank.c
663 +++ b/drivers/ata/sata_highbank.c
664 @@ -251,7 +251,7 @@ static const struct ata_port_info ahci_highbank_port_info = {
665 };
666
667 static struct scsi_host_template ahci_highbank_platform_sht = {
668 - AHCI_SHT("highbank-ahci"),
669 + AHCI_SHT("sata_highbank"),
670 };
671
672 static const struct of_device_id ahci_of_match[] = {
673 diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
674 index 93211df..ba780b7 100644
675 --- a/drivers/char/tpm/tpm.c
676 +++ b/drivers/char/tpm/tpm.c
677 @@ -1291,7 +1291,7 @@ int tpm_pm_suspend(struct device *dev)
678 {
679 struct tpm_chip *chip = dev_get_drvdata(dev);
680 struct tpm_cmd_t cmd;
681 - int rc;
682 + int rc, try;
683
684 u8 dummy_hash[TPM_DIGEST_SIZE] = { 0 };
685
686 @@ -1309,9 +1309,32 @@ int tpm_pm_suspend(struct device *dev)
687 }
688
689 /* now do the actual savestate */
690 - cmd.header.in = savestate_header;
691 - rc = transmit_cmd(chip, &cmd, SAVESTATE_RESULT_SIZE,
692 - "sending savestate before suspend");
693 + for (try = 0; try < TPM_RETRY; try++) {
694 + cmd.header.in = savestate_header;
695 + rc = transmit_cmd(chip, &cmd, SAVESTATE_RESULT_SIZE, NULL);
696 +
697 + /*
698 + * If the TPM indicates that it is too busy to respond to
699 + * this command then retry before giving up. It can take
700 + * several seconds for this TPM to be ready.
701 + *
702 + * This can happen if the TPM has already been sent the
703 + * SaveState command before the driver has loaded. TCG 1.2
704 + * specification states that any communication after SaveState
705 + * may cause the TPM to invalidate previously saved state.
706 + */
707 + if (rc != TPM_WARN_RETRY)
708 + break;
709 + msleep(TPM_TIMEOUT_RETRY);
710 + }
711 +
712 + if (rc)
713 + dev_err(chip->dev,
714 + "Error (%d) sending savestate before suspend\n", rc);
715 + else if (try > 0)
716 + dev_warn(chip->dev, "TPM savestate took %dms\n",
717 + try * TPM_TIMEOUT_RETRY);
718 +
719 return rc;
720 }
721 EXPORT_SYMBOL_GPL(tpm_pm_suspend);
722 diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
723 index 8ef7649..9c12a52 100644
724 --- a/drivers/char/tpm/tpm.h
725 +++ b/drivers/char/tpm/tpm.h
726 @@ -32,10 +32,12 @@ enum tpm_const {
727 TPM_MINOR = 224, /* officially assigned */
728 TPM_BUFSIZE = 4096,
729 TPM_NUM_DEVICES = 256,
730 + TPM_RETRY = 50, /* 5 seconds */
731 };
732
733 enum tpm_timeout {
734 TPM_TIMEOUT = 5, /* msecs */
735 + TPM_TIMEOUT_RETRY = 100 /* msecs */
736 };
737
738 /* TPM addresses */
739 @@ -44,6 +46,7 @@ enum tpm_addr {
740 TPM_ADDR = 0x4E,
741 };
742
743 +#define TPM_WARN_RETRY 0x800
744 #define TPM_WARN_DOING_SELFTEST 0x802
745 #define TPM_ERR_DEACTIVATED 0x6
746 #define TPM_ERR_DISABLED 0x7
747 diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
748 index f042f6d..fd7d66d 100644
749 --- a/drivers/i2c/busses/i2c-xiic.c
750 +++ b/drivers/i2c/busses/i2c-xiic.c
751 @@ -312,10 +312,8 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c)
752 /* last message in transfer -> STOP */
753 data |= XIIC_TX_DYN_STOP_MASK;
754 dev_dbg(i2c->adap.dev.parent, "%s TX STOP\n", __func__);
755 -
756 - xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data);
757 - } else
758 - xiic_setreg8(i2c, XIIC_DTR_REG_OFFSET, data);
759 + }
760 + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data);
761 }
762 }
763
764 diff --git a/drivers/md/md.c b/drivers/md/md.c
765 index f363135..0411bde 100644
766 --- a/drivers/md/md.c
767 +++ b/drivers/md/md.c
768 @@ -1564,8 +1564,8 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
769 sector, count, 1) == 0)
770 return -EINVAL;
771 }
772 - } else if (sb->bblog_offset == 0)
773 - rdev->badblocks.shift = -1;
774 + } else if (sb->bblog_offset != 0)
775 + rdev->badblocks.shift = 0;
776
777 if (!refdev) {
778 ret = 1;
779 @@ -3221,7 +3221,7 @@ int md_rdev_init(struct md_rdev *rdev)
780 * be used - I wonder if that matters
781 */
782 rdev->badblocks.count = 0;
783 - rdev->badblocks.shift = 0;
784 + rdev->badblocks.shift = -1; /* disabled until explicitly enabled */
785 rdev->badblocks.page = kmalloc(PAGE_SIZE, GFP_KERNEL);
786 seqlock_init(&rdev->badblocks.lock);
787 if (rdev->badblocks.page == NULL)
788 @@ -3293,9 +3293,6 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
789 goto abort_free;
790 }
791 }
792 - if (super_format == -1)
793 - /* hot-add for 0.90, or non-persistent: so no badblocks */
794 - rdev->badblocks.shift = -1;
795
796 return rdev;
797
798 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
799 index fd86b37..6af167f 100644
800 --- a/drivers/md/raid1.c
801 +++ b/drivers/md/raid1.c
802 @@ -981,7 +981,12 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
803 while (bio) { /* submit pending writes */
804 struct bio *next = bio->bi_next;
805 bio->bi_next = NULL;
806 - generic_make_request(bio);
807 + if (unlikely((bio->bi_rw & REQ_DISCARD) &&
808 + !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
809 + /* Just ignore it */
810 + bio_endio(bio, 0);
811 + else
812 + generic_make_request(bio);
813 bio = next;
814 }
815 kfree(plug);
816 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
817 index b3898d4..61ab219 100644
818 --- a/drivers/md/raid10.c
819 +++ b/drivers/md/raid10.c
820 @@ -1087,7 +1087,12 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
821 while (bio) { /* submit pending writes */
822 struct bio *next = bio->bi_next;
823 bio->bi_next = NULL;
824 - generic_make_request(bio);
825 + if (unlikely((bio->bi_rw & REQ_DISCARD) &&
826 + !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
827 + /* Just ignore it */
828 + bio_endio(bio, 0);
829 + else
830 + generic_make_request(bio);
831 bio = next;
832 }
833 kfree(plug);
834 diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
835 index 210dd03..6b40e0c 100644
836 --- a/drivers/mfd/adp5520.c
837 +++ b/drivers/mfd/adp5520.c
838 @@ -36,6 +36,7 @@ struct adp5520_chip {
839 struct blocking_notifier_head notifier_list;
840 int irq;
841 unsigned long id;
842 + uint8_t mode;
843 };
844
845 static int __adp5520_read(struct i2c_client *client,
846 @@ -326,7 +327,10 @@ static int adp5520_suspend(struct device *dev)
847 struct i2c_client *client = to_i2c_client(dev);
848 struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
849
850 - adp5520_clr_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY);
851 + adp5520_read(chip->dev, ADP5520_MODE_STATUS, &chip->mode);
852 + /* All other bits are W1C */
853 + chip->mode &= ADP5520_BL_EN | ADP5520_DIM_EN | ADP5520_nSTNBY;
854 + adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
855 return 0;
856 }
857
858 @@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)
859 struct i2c_client *client = to_i2c_client(dev);
860 struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
861
862 - adp5520_set_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY);
863 + adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode);
864 return 0;
865 }
866 #endif
867 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
868 index 089e8ea..2743b7d 100644
869 --- a/drivers/mmc/core/mmc.c
870 +++ b/drivers/mmc/core/mmc.c
871 @@ -368,13 +368,13 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
872 ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
873 card->ext_csd.raw_trim_mult =
874 ext_csd[EXT_CSD_TRIM_MULT];
875 + card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT];
876 if (card->ext_csd.rev >= 4) {
877 /*
878 * Enhanced area feature support -- check whether the eMMC
879 * card has the Enhanced area enabled. If so, export enhanced
880 * area offset and size to user by adding sysfs interface.
881 */
882 - card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT];
883 if ((ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x2) &&
884 (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE] & 0x1)) {
885 hc_erase_grp_sz =
886 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
887 index 8d13c65..009dabd 100644
888 --- a/drivers/mmc/host/Kconfig
889 +++ b/drivers/mmc/host/Kconfig
890 @@ -292,16 +292,6 @@ config MMC_ATMELMCI
891
892 If unsure, say N.
893
894 -config MMC_ATMELMCI_DMA
895 - bool "Atmel MCI DMA support"
896 - depends on MMC_ATMELMCI && (AVR32 || ARCH_AT91SAM9G45) && DMA_ENGINE
897 - help
898 - Say Y here to have the Atmel MCI driver use a DMA engine to
899 - do data transfers and thus increase the throughput and
900 - reduce the CPU utilization.
901 -
902 - If unsure, say N.
903 -
904 config MMC_MSM
905 tristate "Qualcomm SDCC Controller Support"
906 depends on MMC && ARCH_MSM
907 diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
908 index 722af1d..e75774f 100644
909 --- a/drivers/mmc/host/atmel-mci.c
910 +++ b/drivers/mmc/host/atmel-mci.c
911 @@ -178,6 +178,7 @@ struct atmel_mci {
912 void __iomem *regs;
913
914 struct scatterlist *sg;
915 + unsigned int sg_len;
916 unsigned int pio_offset;
917 unsigned int *buffer;
918 unsigned int buf_size;
919 @@ -892,6 +893,7 @@ static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
920 data->error = -EINPROGRESS;
921
922 host->sg = data->sg;
923 + host->sg_len = data->sg_len;
924 host->data = data;
925 host->data_chan = NULL;
926
927 @@ -1826,7 +1828,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
928 if (offset == sg->length) {
929 flush_dcache_page(sg_page(sg));
930 host->sg = sg = sg_next(sg);
931 - if (!sg)
932 + host->sg_len--;
933 + if (!sg || !host->sg_len)
934 goto done;
935
936 offset = 0;
937 @@ -1839,7 +1842,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
938
939 flush_dcache_page(sg_page(sg));
940 host->sg = sg = sg_next(sg);
941 - if (!sg)
942 + host->sg_len--;
943 + if (!sg || !host->sg_len)
944 goto done;
945
946 offset = 4 - remaining;
947 @@ -1890,7 +1894,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
948 nbytes += 4;
949 if (offset == sg->length) {
950 host->sg = sg = sg_next(sg);
951 - if (!sg)
952 + host->sg_len--;
953 + if (!sg || !host->sg_len)
954 goto done;
955
956 offset = 0;
957 @@ -1904,7 +1909,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
958 nbytes += remaining;
959
960 host->sg = sg = sg_next(sg);
961 - if (!sg) {
962 + host->sg_len--;
963 + if (!sg || !host->sg_len) {
964 atmci_writel(host, ATMCI_TDR, value);
965 goto done;
966 }
967 @@ -2487,10 +2493,8 @@ static int __exit atmci_remove(struct platform_device *pdev)
968 atmci_readl(host, ATMCI_SR);
969 clk_disable(host->mck);
970
971 -#ifdef CONFIG_MMC_ATMELMCI_DMA
972 if (host->dma.chan)
973 dma_release_channel(host->dma.chan);
974 -#endif
975
976 free_irq(platform_get_irq(pdev, 0), host);
977 iounmap(host->regs);
978 diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
979 index 2e5daee..a3f8a25 100644
980 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c
981 +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
982 @@ -127,7 +127,6 @@ struct gianfar_ptp_registers {
983
984 #define DRIVER "gianfar_ptp"
985 #define DEFAULT_CKSEL 1
986 -#define N_ALARM 1 /* first alarm is used internally to reset fipers */
987 #define N_EXT_TS 2
988 #define REG_SIZE sizeof(struct gianfar_ptp_registers)
989
990 @@ -410,7 +409,7 @@ static struct ptp_clock_info ptp_gianfar_caps = {
991 .owner = THIS_MODULE,
992 .name = "gianfar clock",
993 .max_adj = 512000,
994 - .n_alarm = N_ALARM,
995 + .n_alarm = 0,
996 .n_ext_ts = N_EXT_TS,
997 .n_per_out = 0,
998 .pps = 1,
999 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1000 index 0d03d38..911956e 100644
1001 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1002 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1003 @@ -2407,6 +2407,16 @@ static irqreturn_t ixgbe_msix_other(int irq, void *data)
1004 * with the write to EICR.
1005 */
1006 eicr = IXGBE_READ_REG(hw, IXGBE_EICS);
1007 +
1008 + /* The lower 16bits of the EICR register are for the queue interrupts
1009 + * which should be masked here in order to not accidently clear them if
1010 + * the bits are high when ixgbe_msix_other is called. There is a race
1011 + * condition otherwise which results in possible performance loss
1012 + * especially if the ixgbe_msix_other interrupt is triggering
1013 + * consistently (as it would when PPS is turned on for the X540 device)
1014 + */
1015 + eicr &= 0xFFFF0000;
1016 +
1017 IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
1018
1019 if (eicr & IXGBE_EICR_LSC)
1020 diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
1021 index 5b9533e..2c056b1 100644
1022 --- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
1023 +++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
1024 @@ -2237,15 +2237,15 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file,
1025 size_t count, loff_t *ppos)
1026 {
1027 struct iwl_priv *priv = file->private_data;
1028 - char *buf;
1029 - int pos = 0;
1030 - ssize_t ret = -ENOMEM;
1031 + char *buf = NULL;
1032 + ssize_t ret;
1033
1034 - ret = pos = iwl_dump_nic_event_log(priv, true, &buf, true);
1035 - if (buf) {
1036 - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1037 - kfree(buf);
1038 - }
1039 + ret = iwl_dump_nic_event_log(priv, true, &buf, true);
1040 + if (ret < 0)
1041 + goto err;
1042 + ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
1043 +err:
1044 + kfree(buf);
1045 return ret;
1046 }
1047
1048 diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c
1049 index bdba954..a8632a4 100644
1050 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c
1051 +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c
1052 @@ -707,6 +707,7 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv,
1053 void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1054 {
1055 struct iwl_addsta_cmd sta_cmd;
1056 + static const struct iwl_link_quality_cmd zero_lq = {};
1057 struct iwl_link_quality_cmd lq;
1058 int i;
1059 bool found = false;
1060 @@ -745,7 +746,9 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1061 else
1062 memcpy(&lq, priv->stations[i].lq,
1063 sizeof(struct iwl_link_quality_cmd));
1064 - send_lq = true;
1065 +
1066 + if (!memcmp(&lq, &zero_lq, sizeof(lq)))
1067 + send_lq = true;
1068 }
1069 spin_unlock_bh(&priv->sta_lock);
1070 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
1071 diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
1072 index 0bbea88..b7a5387 100644
1073 --- a/drivers/net/wireless/mwifiex/pcie.c
1074 +++ b/drivers/net/wireless/mwifiex/pcie.c
1075 @@ -1831,9 +1831,9 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
1076 if (pdev) {
1077 pci_iounmap(pdev, card->pci_mmap);
1078 pci_iounmap(pdev, card->pci_mmap1);
1079 -
1080 - pci_release_regions(pdev);
1081 pci_disable_device(pdev);
1082 + pci_release_region(pdev, 2);
1083 + pci_release_region(pdev, 0);
1084 pci_set_drvdata(pdev, NULL);
1085 }
1086 }
1087 diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
1088 index 197b446..0b55706 100644
1089 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1090 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1091 @@ -4386,6 +4386,8 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1092
1093 if (!rt2x00_rt(rt2x00dev, RT5390) &&
1094 !rt2x00_rt(rt2x00dev, RT5392)) {
1095 + u8 min_gain = rt2x00_rt(rt2x00dev, RT3070) ? 1 : 2;
1096 +
1097 rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
1098 rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0);
1099 if (rt2x00_rt(rt2x00dev, RT3070) ||
1100 @@ -4396,8 +4398,10 @@ static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
1101 &rt2x00dev->cap_flags))
1102 rt2x00_set_field8(&rfcsr, RFCSR17_R, 1);
1103 }
1104 - rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
1105 - drv_data->txmixer_gain_24g);
1106 + if (drv_data->txmixer_gain_24g >= min_gain) {
1107 + rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN,
1108 + drv_data->txmixer_gain_24g);
1109 + }
1110 rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
1111 }
1112
1113 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1114 index 5cb5820..d1b4e00 100644
1115 --- a/drivers/pci/pci.c
1116 +++ b/drivers/pci/pci.c
1117 @@ -651,15 +651,11 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
1118 error = platform_pci_set_power_state(dev, state);
1119 if (!error)
1120 pci_update_current_state(dev, state);
1121 - /* Fall back to PCI_D0 if native PM is not supported */
1122 - if (!dev->pm_cap)
1123 - dev->current_state = PCI_D0;
1124 - } else {
1125 + } else
1126 error = -ENODEV;
1127 - /* Fall back to PCI_D0 if native PM is not supported */
1128 - if (!dev->pm_cap)
1129 - dev->current_state = PCI_D0;
1130 - }
1131 +
1132 + if (error && !dev->pm_cap) /* Fall back to PCI_D0 */
1133 + dev->current_state = PCI_D0;
1134
1135 return error;
1136 }
1137 diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
1138 index 16630aa..1c77423 100644
1139 --- a/drivers/rtc/rtc-cmos.c
1140 +++ b/drivers/rtc/rtc-cmos.c
1141 @@ -805,9 +805,8 @@ static int cmos_suspend(struct device *dev)
1142 mask = RTC_IRQMASK;
1143 tmp &= ~mask;
1144 CMOS_WRITE(tmp, RTC_CONTROL);
1145 + hpet_mask_rtc_irq_bit(mask);
1146
1147 - /* shut down hpet emulation - we don't need it for alarm */
1148 - hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
1149 cmos_checkintr(cmos, tmp);
1150 }
1151 spin_unlock_irq(&rtc_lock);
1152 @@ -872,6 +871,7 @@ static int cmos_resume(struct device *dev)
1153 rtc_update_irq(cmos->rtc, 1, mask);
1154 tmp &= ~RTC_AIE;
1155 hpet_mask_rtc_irq_bit(RTC_AIE);
1156 + hpet_rtc_timer_init();
1157 } while (mask & RTC_AIE);
1158 spin_unlock_irq(&rtc_lock);
1159 }
1160 diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
1161 index c44d13f..56dcd7c 100644
1162 --- a/drivers/s390/char/sclp_cmd.c
1163 +++ b/drivers/s390/char/sclp_cmd.c
1164 @@ -567,6 +567,8 @@ static void __init sclp_add_standby_memory(void)
1165 add_memory_merged(0);
1166 }
1167
1168 +#define MEM_SCT_SIZE (1UL << SECTION_SIZE_BITS)
1169 +
1170 static void __init insert_increment(u16 rn, int standby, int assigned)
1171 {
1172 struct memory_increment *incr, *new_incr;
1173 @@ -579,7 +581,7 @@ static void __init insert_increment(u16 rn, int standby, int assigned)
1174 new_incr->rn = rn;
1175 new_incr->standby = standby;
1176 if (!standby)
1177 - new_incr->usecount = 1;
1178 + new_incr->usecount = rzm > MEM_SCT_SIZE ? rzm/MEM_SCT_SIZE : 1;
1179 last_rn = 0;
1180 prev = &sclp_mem_list;
1181 list_for_each_entry(incr, &sclp_mem_list, list) {
1182 diff --git a/drivers/staging/zsmalloc/Kconfig b/drivers/staging/zsmalloc/Kconfig
1183 index 9084565..7fab032 100644
1184 --- a/drivers/staging/zsmalloc/Kconfig
1185 +++ b/drivers/staging/zsmalloc/Kconfig
1186 @@ -1,5 +1,5 @@
1187 config ZSMALLOC
1188 - tristate "Memory allocator for compressed pages"
1189 + bool "Memory allocator for compressed pages"
1190 default n
1191 help
1192 zsmalloc is a slab-based memory allocator designed to store
1193 diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
1194 index 223c736..851a2ff 100644
1195 --- a/drivers/staging/zsmalloc/zsmalloc-main.c
1196 +++ b/drivers/staging/zsmalloc/zsmalloc-main.c
1197 @@ -657,11 +657,8 @@ static inline void __zs_unmap_object(struct mapping_area *area,
1198 struct page *pages[2], int off, int size)
1199 {
1200 unsigned long addr = (unsigned long)area->vm_addr;
1201 - unsigned long end = addr + (PAGE_SIZE * 2);
1202
1203 - flush_cache_vunmap(addr, end);
1204 - unmap_kernel_range_noflush(addr, PAGE_SIZE * 2);
1205 - flush_tlb_kernel_range(addr, end);
1206 + unmap_kernel_range(addr, PAGE_SIZE * 2);
1207 }
1208
1209 #else /* USE_PGTABLE_MAPPING */
1210 diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
1211 index ac35c90..c830b60 100644
1212 --- a/drivers/tty/pty.c
1213 +++ b/drivers/tty/pty.c
1214 @@ -675,6 +675,9 @@ static int ptmx_open(struct inode *inode, struct file *filp)
1215
1216 nonseekable_open(inode, filp);
1217
1218 + /* We refuse fsnotify events on ptmx, since it's a shared resource */
1219 + filp->f_mode |= FMODE_NONOTIFY;
1220 +
1221 retval = tty_alloc_file(filp);
1222 if (retval)
1223 return retval;
1224 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
1225 index 2c7230a..4293a3e 100644
1226 --- a/drivers/tty/serial/serial_core.c
1227 +++ b/drivers/tty/serial/serial_core.c
1228 @@ -1940,6 +1940,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
1229 mutex_unlock(&port->mutex);
1230 return 0;
1231 }
1232 + put_device(tty_dev);
1233 +
1234 if (console_suspend_enabled || !uart_console(uport))
1235 uport->suspended = 1;
1236
1237 @@ -2005,9 +2007,11 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
1238 disable_irq_wake(uport->irq);
1239 uport->irq_wake = 0;
1240 }
1241 + put_device(tty_dev);
1242 mutex_unlock(&port->mutex);
1243 return 0;
1244 }
1245 + put_device(tty_dev);
1246 uport->suspended = 0;
1247
1248 /*
1249 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
1250 index 892ecda..f34f98d 100644
1251 --- a/drivers/tty/tty_io.c
1252 +++ b/drivers/tty/tty_io.c
1253 @@ -941,10 +941,10 @@ void start_tty(struct tty_struct *tty)
1254
1255 EXPORT_SYMBOL(start_tty);
1256
1257 +/* We limit tty time update visibility to every 8 seconds or so. */
1258 static void tty_update_time(struct timespec *time)
1259 {
1260 - unsigned long sec = get_seconds();
1261 - sec -= sec % 60;
1262 + unsigned long sec = get_seconds() & ~7;
1263 if ((long)(sec - time->tv_sec) > 0)
1264 time->tv_sec = sec;
1265 }
1266 diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
1267 index 2f45bba..c0f4066 100644
1268 --- a/drivers/usb/chipidea/udc.c
1269 +++ b/drivers/usb/chipidea/udc.c
1270 @@ -461,6 +461,8 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
1271 mReq->ptr->page[i] =
1272 (mReq->req.dma + i * CI13XXX_PAGE_SIZE) & ~TD_RESERVED_MASK;
1273
1274 + wmb();
1275 +
1276 if (!list_empty(&mEp->qh.queue)) {
1277 struct ci13xxx_req *mReqPrev;
1278 int n = hw_ep_bit(mEp->num, mEp->dir);
1279 @@ -561,6 +563,12 @@ __acquires(mEp->lock)
1280 struct ci13xxx_req *mReq = \
1281 list_entry(mEp->qh.queue.next,
1282 struct ci13xxx_req, queue);
1283 +
1284 + if (mReq->zptr) {
1285 + dma_pool_free(mEp->td_pool, mReq->zptr, mReq->zdma);
1286 + mReq->zptr = NULL;
1287 + }
1288 +
1289 list_del_init(&mReq->queue);
1290 mReq->req.status = -ESHUTDOWN;
1291
1292 diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h
1293 index 4ff2384d..d12e8b5 100644
1294 --- a/drivers/usb/chipidea/udc.h
1295 +++ b/drivers/usb/chipidea/udc.h
1296 @@ -40,7 +40,7 @@ struct ci13xxx_td {
1297 #define TD_CURR_OFFSET (0x0FFFUL << 0)
1298 #define TD_FRAME_NUM (0x07FFUL << 0)
1299 #define TD_RESERVED_MASK (0x0FFFUL << 0)
1300 -} __attribute__ ((packed));
1301 +} __attribute__ ((packed, aligned(4)));
1302
1303 /* DMA layout of queue heads */
1304 struct ci13xxx_qh {
1305 @@ -57,7 +57,7 @@ struct ci13xxx_qh {
1306 /* 9 */
1307 u32 RESERVED;
1308 struct usb_ctrlrequest setup;
1309 -} __attribute__ ((packed));
1310 +} __attribute__ ((packed, aligned(4)));
1311
1312 /**
1313 * struct ci13xxx_req - usb request representation
1314 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1315 index b78fbe2..ea0a9a1 100644
1316 --- a/drivers/usb/core/devio.c
1317 +++ b/drivers/usb/core/devio.c
1318 @@ -738,6 +738,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
1319 index &= 0xff;
1320 switch (requesttype & USB_RECIP_MASK) {
1321 case USB_RECIP_ENDPOINT:
1322 + if ((index & ~USB_DIR_IN) == 0)
1323 + return 0;
1324 ret = findintfep(ps->dev, index);
1325 if (ret >= 0)
1326 ret = checkintf(ps, ret);
1327 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
1328 index 416a6dc..83b5a172 100644
1329 --- a/drivers/usb/host/ehci-hcd.c
1330 +++ b/drivers/usb/host/ehci-hcd.c
1331 @@ -670,9 +670,6 @@ int ehci_setup(struct usb_hcd *hcd)
1332 if (retval)
1333 return retval;
1334
1335 - if (ehci_is_TDI(ehci))
1336 - tdi_reset(ehci);
1337 -
1338 ehci_reset(ehci);
1339
1340 return 0;
1341 diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
1342 index 0fc6e5f..ba6a5d6 100644
1343 --- a/drivers/usb/misc/appledisplay.c
1344 +++ b/drivers/usb/misc/appledisplay.c
1345 @@ -63,6 +63,7 @@ static const struct usb_device_id appledisplay_table[] = {
1346 { APPLEDISPLAY_DEVICE(0x9219) },
1347 { APPLEDISPLAY_DEVICE(0x921c) },
1348 { APPLEDISPLAY_DEVICE(0x921d) },
1349 + { APPLEDISPLAY_DEVICE(0x9236) },
1350
1351 /* Terminating entry */
1352 { }
1353 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1354 index 8e4f40b..77f78ad 100644
1355 --- a/drivers/usb/serial/ftdi_sio.c
1356 +++ b/drivers/usb/serial/ftdi_sio.c
1357 @@ -189,6 +189,7 @@ static struct usb_device_id id_table_combined [] = {
1358 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
1359 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
1360 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
1361 + { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) },
1362 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
1363 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
1364 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
1365 @@ -870,7 +871,9 @@ static struct usb_device_id id_table_combined [] = {
1366 { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
1367 { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
1368 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1369 - { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
1370 + { USB_DEVICE(ST_VID, ST_STMCLT_2232_PID),
1371 + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1372 + { USB_DEVICE(ST_VID, ST_STMCLT_4232_PID),
1373 .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
1374 { USB_DEVICE(FTDI_VID, FTDI_RF_R106) },
1375 { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID),
1376 @@ -1792,20 +1795,24 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
1377 }
1378
1379 /*
1380 - * First and second port on STMCLiteadaptors is reserved for JTAG interface
1381 - * and the forth port for pio
1382 + * First two ports on JTAG adaptors using an FT4232 such as STMicroelectronics's
1383 + * ST Micro Connect Lite are reserved for JTAG or other non-UART interfaces and
1384 + * can be accessed from userspace.
1385 + * The next two ports are enabled as UARTs by default, where port 2 is
1386 + * a conventional RS-232 UART.
1387 */
1388 static int ftdi_stmclite_probe(struct usb_serial *serial)
1389 {
1390 struct usb_device *udev = serial->dev;
1391 struct usb_interface *interface = serial->interface;
1392
1393 - if (interface == udev->actconfig->interface[2])
1394 - return 0;
1395 -
1396 - dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
1397 + if (interface == udev->actconfig->interface[0] ||
1398 + interface == udev->actconfig->interface[1]) {
1399 + dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
1400 + return -ENODEV;
1401 + }
1402
1403 - return -ENODEV;
1404 + return 0;
1405 }
1406
1407 /*
1408 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1409 index e79861e..9852827 100644
1410 --- a/drivers/usb/serial/ftdi_sio_ids.h
1411 +++ b/drivers/usb/serial/ftdi_sio_ids.h
1412 @@ -74,6 +74,7 @@
1413 #define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
1414 #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
1415 #define FTDI_OPENDCC_GBM_PID 0xBFDC
1416 +#define FTDI_OPENDCC_GBM_BOOST_PID 0xBFDD
1417
1418 /* NZR SEM 16+ USB (http://www.nzr.de) */
1419 #define FTDI_NZR_SEM_USB_PID 0xC1E0 /* NZR SEM-LOG16+ */
1420 @@ -1150,7 +1151,8 @@
1421 * STMicroelectonics
1422 */
1423 #define ST_VID 0x0483
1424 -#define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */
1425 +#define ST_STMCLT_2232_PID 0x3746
1426 +#define ST_STMCLT_4232_PID 0x3747
1427
1428 /*
1429 * Papouch products (http://www.papouch.com/)
1430 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1431 index 558adfc..bff059a 100644
1432 --- a/drivers/usb/serial/option.c
1433 +++ b/drivers/usb/serial/option.c
1434 @@ -347,6 +347,7 @@ static void option_instat_callback(struct urb *urb);
1435 /* Olivetti products */
1436 #define OLIVETTI_VENDOR_ID 0x0b3c
1437 #define OLIVETTI_PRODUCT_OLICARD100 0xc000
1438 +#define OLIVETTI_PRODUCT_OLICARD145 0xc003
1439
1440 /* Celot products */
1441 #define CELOT_VENDOR_ID 0x211f
1442 @@ -1273,6 +1274,7 @@ static const struct usb_device_id option_ids[] = {
1443 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1444
1445 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
1446 + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
1447 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
1448 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
1449 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
1450 @@ -1350,6 +1352,12 @@ static const struct usb_device_id option_ids[] = {
1451 { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
1452 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1453 { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) },
1454 + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x02, 0x01) }, /* D-Link DWM-156 (variant) */
1455 + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x00, 0x00) }, /* D-Link DWM-156 (variant) */
1456 + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x02, 0x01) },
1457 + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) },
1458 + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) },
1459 + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
1460 { } /* Terminating entry */
1461 };
1462 MODULE_DEVICE_TABLE(usb, option_ids);
1463 diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
1464 index 070b5c0..d944088 100644
1465 --- a/drivers/usb/storage/cypress_atacb.c
1466 +++ b/drivers/usb/storage/cypress_atacb.c
1467 @@ -248,14 +248,26 @@ static int cypress_probe(struct usb_interface *intf,
1468 {
1469 struct us_data *us;
1470 int result;
1471 + struct usb_device *device;
1472
1473 result = usb_stor_probe1(&us, intf, id,
1474 (id - cypress_usb_ids) + cypress_unusual_dev_list);
1475 if (result)
1476 return result;
1477
1478 - us->protocol_name = "Transparent SCSI with Cypress ATACB";
1479 - us->proto_handler = cypress_atacb_passthrough;
1480 + /* Among CY7C68300 chips, the A revision does not support Cypress ATACB
1481 + * Filter out this revision from EEPROM default descriptor values
1482 + */
1483 + device = interface_to_usbdev(intf);
1484 + if (device->descriptor.iManufacturer != 0x38 ||
1485 + device->descriptor.iProduct != 0x4e ||
1486 + device->descriptor.iSerialNumber != 0x64) {
1487 + us->protocol_name = "Transparent SCSI with Cypress ATACB";
1488 + us->proto_handler = cypress_atacb_passthrough;
1489 + } else {
1490 + us->protocol_name = "Transparent SCSI";
1491 + us->proto_handler = usb_stor_transparent_scsi_command;
1492 + }
1493
1494 result = usb_stor_probe2(us);
1495 return result;
1496 diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
1497 index 501c599..6e696e6 100644
1498 --- a/drivers/video/console/fbcon.c
1499 +++ b/drivers/video/console/fbcon.c
1500 @@ -1228,6 +1228,8 @@ static void fbcon_deinit(struct vc_data *vc)
1501 finished:
1502
1503 fbcon_free_font(p, free_font);
1504 + if (free_font)
1505 + vc->vc_font.data = NULL;
1506
1507 if (!con_is_bound(&fb_con))
1508 fbcon_exit();
1509 diff --git a/fs/dcache.c b/fs/dcache.c
1510 index c3bbf85..de73da2 100644
1511 --- a/fs/dcache.c
1512 +++ b/fs/dcache.c
1513 @@ -1232,8 +1232,10 @@ void shrink_dcache_parent(struct dentry * parent)
1514 LIST_HEAD(dispose);
1515 int found;
1516
1517 - while ((found = select_parent(parent, &dispose)) != 0)
1518 + while ((found = select_parent(parent, &dispose)) != 0) {
1519 shrink_dentry_list(&dispose);
1520 + cond_resched();
1521 + }
1522 }
1523 EXPORT_SYMBOL(shrink_dcache_parent);
1524
1525 diff --git a/fs/exec.c b/fs/exec.c
1526 index 20df02c..ac014f1 100644
1527 --- a/fs/exec.c
1528 +++ b/fs/exec.c
1529 @@ -613,7 +613,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
1530 * when the old and new regions overlap clear from new_end.
1531 */
1532 free_pgd_range(&tlb, new_end, old_end, new_end,
1533 - vma->vm_next ? vma->vm_next->vm_start : 0);
1534 + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
1535 } else {
1536 /*
1537 * otherwise, clean from old_start; this is done to not touch
1538 @@ -622,7 +622,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
1539 * for the others its just a little faster.
1540 */
1541 free_pgd_range(&tlb, old_start, old_end, new_end,
1542 - vma->vm_next ? vma->vm_next->vm_start : 0);
1543 + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
1544 }
1545 tlb_finish_mmu(&tlb, new_end, old_end);
1546
1547 @@ -898,11 +898,13 @@ static int de_thread(struct task_struct *tsk)
1548
1549 sig->notify_count = -1; /* for exit_notify() */
1550 for (;;) {
1551 + threadgroup_change_begin(tsk);
1552 write_lock_irq(&tasklist_lock);
1553 if (likely(leader->exit_state))
1554 break;
1555 __set_current_state(TASK_KILLABLE);
1556 write_unlock_irq(&tasklist_lock);
1557 + threadgroup_change_end(tsk);
1558 schedule();
1559 if (unlikely(__fatal_signal_pending(tsk)))
1560 goto killed;
1561 @@ -960,6 +962,7 @@ static int de_thread(struct task_struct *tsk)
1562 if (unlikely(leader->ptrace))
1563 __wake_up_parent(leader, leader->parent);
1564 write_unlock_irq(&tasklist_lock);
1565 + threadgroup_change_end(tsk);
1566
1567 release_task(leader);
1568 }
1569 diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
1570 index 9873587..efea5d5 100644
1571 --- a/fs/ext4/Kconfig
1572 +++ b/fs/ext4/Kconfig
1573 @@ -71,4 +71,5 @@ config EXT4_DEBUG
1574 Enables run-time debugging support for the ext4 filesystem.
1575
1576 If you select Y here, then you will be able to turn on debugging
1577 - with a command such as "echo 1 > /sys/kernel/debug/ext4/mballoc-debug"
1578 + with a command such as:
1579 + echo 1 > /sys/module/ext4/parameters/mballoc_debug
1580 diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
1581 index 7177f9b..dbd9ae1 100644
1582 --- a/fs/ext4/ext4_jbd2.h
1583 +++ b/fs/ext4/ext4_jbd2.h
1584 @@ -170,16 +170,20 @@ static inline void ext4_journal_callback_add(handle_t *handle,
1585 * ext4_journal_callback_del: delete a registered callback
1586 * @handle: active journal transaction handle on which callback was registered
1587 * @jce: registered journal callback entry to unregister
1588 + * Return true if object was sucessfully removed
1589 */
1590 -static inline void ext4_journal_callback_del(handle_t *handle,
1591 +static inline bool ext4_journal_callback_try_del(handle_t *handle,
1592 struct ext4_journal_cb_entry *jce)
1593 {
1594 + bool deleted;
1595 struct ext4_sb_info *sbi =
1596 EXT4_SB(handle->h_transaction->t_journal->j_private);
1597
1598 spin_lock(&sbi->s_md_lock);
1599 + deleted = !list_empty(&jce->jce_list);
1600 list_del_init(&jce->jce_list);
1601 spin_unlock(&sbi->s_md_lock);
1602 + return deleted;
1603 }
1604
1605 int
1606 diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
1607 index 3278e64..e0ba8a4 100644
1608 --- a/fs/ext4/fsync.c
1609 +++ b/fs/ext4/fsync.c
1610 @@ -166,8 +166,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1611 if (journal->j_flags & JBD2_BARRIER &&
1612 !jbd2_trans_will_send_data_barrier(journal, commit_tid))
1613 needs_barrier = true;
1614 - jbd2_log_start_commit(journal, commit_tid);
1615 - ret = jbd2_log_wait_commit(journal, commit_tid);
1616 + ret = jbd2_complete_transaction(journal, commit_tid);
1617 if (needs_barrier) {
1618 err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
1619 if (!ret)
1620 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1621 index 22c5c67..c0fbd96 100644
1622 --- a/fs/ext4/inode.c
1623 +++ b/fs/ext4/inode.c
1624 @@ -55,21 +55,21 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
1625 __u16 csum_hi = 0;
1626 __u32 csum;
1627
1628 - csum_lo = raw->i_checksum_lo;
1629 + csum_lo = le16_to_cpu(raw->i_checksum_lo);
1630 raw->i_checksum_lo = 0;
1631 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
1632 EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) {
1633 - csum_hi = raw->i_checksum_hi;
1634 + csum_hi = le16_to_cpu(raw->i_checksum_hi);
1635 raw->i_checksum_hi = 0;
1636 }
1637
1638 csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)raw,
1639 EXT4_INODE_SIZE(inode->i_sb));
1640
1641 - raw->i_checksum_lo = csum_lo;
1642 + raw->i_checksum_lo = cpu_to_le16(csum_lo);
1643 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
1644 EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi))
1645 - raw->i_checksum_hi = csum_hi;
1646 + raw->i_checksum_hi = cpu_to_le16(csum_hi);
1647
1648 return csum;
1649 }
1650 @@ -216,8 +216,7 @@ void ext4_evict_inode(struct inode *inode)
1651 journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
1652 tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
1653
1654 - jbd2_log_start_commit(journal, commit_tid);
1655 - jbd2_log_wait_commit(journal, commit_tid);
1656 + jbd2_complete_transaction(journal, commit_tid);
1657 filemap_write_and_wait(&inode->i_data);
1658 }
1659 truncate_inode_pages(&inode->i_data, 0);
1660 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
1661 index 82f8c2d..b443e62 100644
1662 --- a/fs/ext4/mballoc.c
1663 +++ b/fs/ext4/mballoc.c
1664 @@ -4449,11 +4449,11 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
1665 node = rb_prev(new_node);
1666 if (node) {
1667 entry = rb_entry(node, struct ext4_free_data, efd_node);
1668 - if (can_merge(entry, new_entry)) {
1669 + if (can_merge(entry, new_entry) &&
1670 + ext4_journal_callback_try_del(handle, &entry->efd_jce)) {
1671 new_entry->efd_start_cluster = entry->efd_start_cluster;
1672 new_entry->efd_count += entry->efd_count;
1673 rb_erase(node, &(db->bb_free_root));
1674 - ext4_journal_callback_del(handle, &entry->efd_jce);
1675 kmem_cache_free(ext4_free_data_cachep, entry);
1676 }
1677 }
1678 @@ -4461,10 +4461,10 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
1679 node = rb_next(new_node);
1680 if (node) {
1681 entry = rb_entry(node, struct ext4_free_data, efd_node);
1682 - if (can_merge(new_entry, entry)) {
1683 + if (can_merge(new_entry, entry) &&
1684 + ext4_journal_callback_try_del(handle, &entry->efd_jce)) {
1685 new_entry->efd_count += entry->efd_count;
1686 rb_erase(node, &(db->bb_free_root));
1687 - ext4_journal_callback_del(handle, &entry->efd_jce);
1688 kmem_cache_free(ext4_free_data_cachep, entry);
1689 }
1690 }
1691 diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
1692 index 44734f1..fe201c6 100644
1693 --- a/fs/ext4/mmp.c
1694 +++ b/fs/ext4/mmp.c
1695 @@ -7,7 +7,7 @@
1696 #include "ext4.h"
1697
1698 /* Checksumming functions */
1699 -static __u32 ext4_mmp_csum(struct super_block *sb, struct mmp_struct *mmp)
1700 +static __le32 ext4_mmp_csum(struct super_block *sb, struct mmp_struct *mmp)
1701 {
1702 struct ext4_sb_info *sbi = EXT4_SB(sb);
1703 int offset = offsetof(struct mmp_struct, mmp_checksum);
1704 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
1705 index 9eace36..a2fe9f5 100644
1706 --- a/fs/ext4/resize.c
1707 +++ b/fs/ext4/resize.c
1708 @@ -1341,6 +1341,8 @@ static void ext4_update_super(struct super_block *sb,
1709
1710 /* Update the global fs size fields */
1711 sbi->s_groups_count += flex_gd->count;
1712 + sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,
1713 + (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));
1714
1715 /* Update the reserved block counts only once the new group is
1716 * active. */
1717 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
1718 index 24c767d..5575a45 100644
1719 --- a/fs/ext4/super.c
1720 +++ b/fs/ext4/super.c
1721 @@ -452,10 +452,13 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
1722 struct super_block *sb = journal->j_private;
1723 struct ext4_sb_info *sbi = EXT4_SB(sb);
1724 int error = is_journal_aborted(journal);
1725 - struct ext4_journal_cb_entry *jce, *tmp;
1726 + struct ext4_journal_cb_entry *jce;
1727
1728 + BUG_ON(txn->t_state == T_FINISHED);
1729 spin_lock(&sbi->s_md_lock);
1730 - list_for_each_entry_safe(jce, tmp, &txn->t_private_list, jce_list) {
1731 + while (!list_empty(&txn->t_private_list)) {
1732 + jce = list_entry(txn->t_private_list.next,
1733 + struct ext4_journal_cb_entry, jce_list);
1734 list_del_init(&jce->jce_list);
1735 spin_unlock(&sbi->s_md_lock);
1736 jce->jce_func(sb, jce, error);
1737 diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c
1738 index 8179e8b..40d13c7 100644
1739 --- a/fs/fscache/stats.c
1740 +++ b/fs/fscache/stats.c
1741 @@ -287,5 +287,5 @@ const struct file_operations fscache_stats_fops = {
1742 .open = fscache_stats_open,
1743 .read = seq_read,
1744 .llseek = seq_lseek,
1745 - .release = seq_release,
1746 + .release = single_release,
1747 };
1748 diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
1749 index 3091d42..069bf58 100644
1750 --- a/fs/jbd2/commit.c
1751 +++ b/fs/jbd2/commit.c
1752 @@ -382,7 +382,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
1753 int space_left = 0;
1754 int first_tag = 0;
1755 int tag_flag;
1756 - int i, to_free = 0;
1757 + int i;
1758 int tag_bytes = journal_tag_bytes(journal);
1759 struct buffer_head *cbh = NULL; /* For transactional checksums */
1760 __u32 crc32_sum = ~0;
1761 @@ -1126,7 +1126,7 @@ restart_loop:
1762 journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged;
1763 spin_unlock(&journal->j_history_lock);
1764
1765 - commit_transaction->t_state = T_FINISHED;
1766 + commit_transaction->t_state = T_COMMIT_CALLBACK;
1767 J_ASSERT(commit_transaction == journal->j_committing_transaction);
1768 journal->j_commit_sequence = commit_transaction->t_tid;
1769 journal->j_committing_transaction = NULL;
1770 @@ -1141,38 +1141,44 @@ restart_loop:
1771 journal->j_average_commit_time*3) / 4;
1772 else
1773 journal->j_average_commit_time = commit_time;
1774 +
1775 write_unlock(&journal->j_state_lock);
1776
1777 - if (commit_transaction->t_checkpoint_list == NULL &&
1778 - commit_transaction->t_checkpoint_io_list == NULL) {
1779 - __jbd2_journal_drop_transaction(journal, commit_transaction);
1780 - to_free = 1;
1781 + if (journal->j_checkpoint_transactions == NULL) {
1782 + journal->j_checkpoint_transactions = commit_transaction;
1783 + commit_transaction->t_cpnext = commit_transaction;
1784 + commit_transaction->t_cpprev = commit_transaction;
1785 } else {
1786 - if (journal->j_checkpoint_transactions == NULL) {
1787 - journal->j_checkpoint_transactions = commit_transaction;
1788 - commit_transaction->t_cpnext = commit_transaction;
1789 - commit_transaction->t_cpprev = commit_transaction;
1790 - } else {
1791 - commit_transaction->t_cpnext =
1792 - journal->j_checkpoint_transactions;
1793 - commit_transaction->t_cpprev =
1794 - commit_transaction->t_cpnext->t_cpprev;
1795 - commit_transaction->t_cpnext->t_cpprev =
1796 - commit_transaction;
1797 - commit_transaction->t_cpprev->t_cpnext =
1798 + commit_transaction->t_cpnext =
1799 + journal->j_checkpoint_transactions;
1800 + commit_transaction->t_cpprev =
1801 + commit_transaction->t_cpnext->t_cpprev;
1802 + commit_transaction->t_cpnext->t_cpprev =
1803 + commit_transaction;
1804 + commit_transaction->t_cpprev->t_cpnext =
1805 commit_transaction;
1806 - }
1807 }
1808 spin_unlock(&journal->j_list_lock);
1809 -
1810 + /* Drop all spin_locks because commit_callback may be block.
1811 + * __journal_remove_checkpoint() can not destroy transaction
1812 + * under us because it is not marked as T_FINISHED yet */
1813 if (journal->j_commit_callback)
1814 journal->j_commit_callback(journal, commit_transaction);
1815
1816 trace_jbd2_end_commit(journal, commit_transaction);
1817 jbd_debug(1, "JBD2: commit %d complete, head %d\n",
1818 journal->j_commit_sequence, journal->j_tail_sequence);
1819 - if (to_free)
1820 - jbd2_journal_free_transaction(commit_transaction);
1821
1822 + write_lock(&journal->j_state_lock);
1823 + spin_lock(&journal->j_list_lock);
1824 + commit_transaction->t_state = T_FINISHED;
1825 + /* Recheck checkpoint lists after j_list_lock was dropped */
1826 + if (commit_transaction->t_checkpoint_list == NULL &&
1827 + commit_transaction->t_checkpoint_io_list == NULL) {
1828 + __jbd2_journal_drop_transaction(journal, commit_transaction);
1829 + jbd2_journal_free_transaction(commit_transaction);
1830 + }
1831 + spin_unlock(&journal->j_list_lock);
1832 + write_unlock(&journal->j_state_lock);
1833 wake_up(&journal->j_wait_done_commit);
1834 }
1835 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
1836 index dbf41f9..42f8cf6c 100644
1837 --- a/fs/jbd2/journal.c
1838 +++ b/fs/jbd2/journal.c
1839 @@ -698,6 +698,37 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
1840 }
1841
1842 /*
1843 + * When this function returns the transaction corresponding to tid
1844 + * will be completed. If the transaction has currently running, start
1845 + * committing that transaction before waiting for it to complete. If
1846 + * the transaction id is stale, it is by definition already completed,
1847 + * so just return SUCCESS.
1848 + */
1849 +int jbd2_complete_transaction(journal_t *journal, tid_t tid)
1850 +{
1851 + int need_to_wait = 1;
1852 +
1853 + read_lock(&journal->j_state_lock);
1854 + if (journal->j_running_transaction &&
1855 + journal->j_running_transaction->t_tid == tid) {
1856 + if (journal->j_commit_request != tid) {
1857 + /* transaction not yet started, so request it */
1858 + read_unlock(&journal->j_state_lock);
1859 + jbd2_log_start_commit(journal, tid);
1860 + goto wait_commit;
1861 + }
1862 + } else if (!(journal->j_committing_transaction &&
1863 + journal->j_committing_transaction->t_tid == tid))
1864 + need_to_wait = 0;
1865 + read_unlock(&journal->j_state_lock);
1866 + if (!need_to_wait)
1867 + return 0;
1868 +wait_commit:
1869 + return jbd2_log_wait_commit(journal, tid);
1870 +}
1871 +EXPORT_SYMBOL(jbd2_complete_transaction);
1872 +
1873 +/*
1874 * Log buffer allocation routines:
1875 */
1876
1877 diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
1878 index ca0a080..193f04c 100644
1879 --- a/fs/lockd/clntlock.c
1880 +++ b/fs/lockd/clntlock.c
1881 @@ -144,6 +144,9 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
1882 timeout);
1883 if (ret < 0)
1884 return -ERESTARTSYS;
1885 + /* Reset the lock status after a server reboot so we resend */
1886 + if (block->b_status == nlm_lck_denied_grace_period)
1887 + block->b_status = nlm_lck_blocked;
1888 req->a_res.status = block->b_status;
1889 return 0;
1890 }
1891 diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
1892 index 52e5120..54f9e6c 100644
1893 --- a/fs/lockd/clntproc.c
1894 +++ b/fs/lockd/clntproc.c
1895 @@ -550,9 +550,6 @@ again:
1896 status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT);
1897 if (status < 0)
1898 break;
1899 - /* Resend the blocking lock request after a server reboot */
1900 - if (resp->status == nlm_lck_denied_grace_period)
1901 - continue;
1902 if (resp->status != nlm_lck_blocked)
1903 break;
1904 }
1905 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1906 index 3d905e3..51d53a4 100644
1907 --- a/fs/nfs/nfs4proc.c
1908 +++ b/fs/nfs/nfs4proc.c
1909 @@ -1374,6 +1374,12 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state
1910 case -ENOMEM:
1911 err = 0;
1912 goto out;
1913 + case -NFS4ERR_DELAY:
1914 + case -NFS4ERR_GRACE:
1915 + set_bit(NFS_DELEGATED_STATE, &state->flags);
1916 + ssleep(1);
1917 + err = -EAGAIN;
1918 + goto out;
1919 }
1920 err = nfs4_handle_exception(server, err, &exception);
1921 } while (exception.retry);
1922 diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
1923 index 9d1c5db..ec668e1 100644
1924 --- a/fs/nfsd/nfs4proc.c
1925 +++ b/fs/nfsd/nfs4proc.c
1926 @@ -931,14 +931,14 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1927 nfs4_lock_state();
1928 status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
1929 cstate, stateid, WR_STATE, &filp);
1930 - if (filp)
1931 - get_file(filp);
1932 - nfs4_unlock_state();
1933 -
1934 if (status) {
1935 + nfs4_unlock_state();
1936 dprintk("NFSD: nfsd4_write: couldn't process stateid!\n");
1937 return status;
1938 }
1939 + if (filp)
1940 + get_file(filp);
1941 + nfs4_unlock_state();
1942
1943 cnt = write->wr_buflen;
1944 write->wr_how_written = write->wr_stable_how;
1945 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1946 index a8309c6..53a7c64 100644
1947 --- a/fs/nfsd/nfs4state.c
1948 +++ b/fs/nfsd/nfs4state.c
1949 @@ -210,13 +210,7 @@ static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag)
1950 {
1951 if (atomic_dec_and_test(&fp->fi_access[oflag])) {
1952 nfs4_file_put_fd(fp, oflag);
1953 - /*
1954 - * It's also safe to get rid of the RDWR open *if*
1955 - * we no longer have need of the other kind of access
1956 - * or if we already have the other kind of open:
1957 - */
1958 - if (fp->fi_fds[1-oflag]
1959 - || atomic_read(&fp->fi_access[1 - oflag]) == 0)
1960 + if (atomic_read(&fp->fi_access[1 - oflag]) == 0)
1961 nfs4_file_put_fd(fp, O_RDWR);
1962 }
1963 }
1964 diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
1965 index d1dd710..cd5e6c1 100644
1966 --- a/fs/nfsd/nfs4xdr.c
1967 +++ b/fs/nfsd/nfs4xdr.c
1968 @@ -344,10 +344,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
1969 all 32 bits of 'nseconds'. */
1970 READ_BUF(12);
1971 len += 12;
1972 - READ32(dummy32);
1973 - if (dummy32)
1974 - return nfserr_inval;
1975 - READ32(iattr->ia_atime.tv_sec);
1976 + READ64(iattr->ia_atime.tv_sec);
1977 READ32(iattr->ia_atime.tv_nsec);
1978 if (iattr->ia_atime.tv_nsec >= (u32)1000000000)
1979 return nfserr_inval;
1980 @@ -370,10 +367,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
1981 all 32 bits of 'nseconds'. */
1982 READ_BUF(12);
1983 len += 12;
1984 - READ32(dummy32);
1985 - if (dummy32)
1986 - return nfserr_inval;
1987 - READ32(iattr->ia_mtime.tv_sec);
1988 + READ64(iattr->ia_mtime.tv_sec);
1989 READ32(iattr->ia_mtime.tv_nsec);
1990 if (iattr->ia_mtime.tv_nsec >= (u32)1000000000)
1991 return nfserr_inval;
1992 @@ -2386,8 +2380,7 @@ out_acl:
1993 if (bmval1 & FATTR4_WORD1_TIME_ACCESS) {
1994 if ((buflen -= 12) < 0)
1995 goto out_resource;
1996 - WRITE32(0);
1997 - WRITE32(stat.atime.tv_sec);
1998 + WRITE64((s64)stat.atime.tv_sec);
1999 WRITE32(stat.atime.tv_nsec);
2000 }
2001 if (bmval1 & FATTR4_WORD1_TIME_DELTA) {
2002 @@ -2400,15 +2393,13 @@ out_acl:
2003 if (bmval1 & FATTR4_WORD1_TIME_METADATA) {
2004 if ((buflen -= 12) < 0)
2005 goto out_resource;
2006 - WRITE32(0);
2007 - WRITE32(stat.ctime.tv_sec);
2008 + WRITE64((s64)stat.ctime.tv_sec);
2009 WRITE32(stat.ctime.tv_nsec);
2010 }
2011 if (bmval1 & FATTR4_WORD1_TIME_MODIFY) {
2012 if ((buflen -= 12) < 0)
2013 goto out_resource;
2014 - WRITE32(0);
2015 - WRITE32(stat.mtime.tv_sec);
2016 + WRITE64((s64)stat.mtime.tv_sec);
2017 WRITE32(stat.mtime.tv_nsec);
2018 }
2019 if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {
2020 diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
2021 index 07f7a92..595343e 100644
2022 --- a/fs/notify/inotify/inotify_user.c
2023 +++ b/fs/notify/inotify/inotify_user.c
2024 @@ -574,7 +574,6 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
2025 int add = (arg & IN_MASK_ADD);
2026 int ret;
2027
2028 - /* don't allow invalid bits: we don't want flags set */
2029 mask = inotify_arg_to_mask(arg);
2030
2031 fsn_mark = fsnotify_find_inode_mark(group, inode);
2032 @@ -625,7 +624,6 @@ static int inotify_new_watch(struct fsnotify_group *group,
2033 struct idr *idr = &group->inotify_data.idr;
2034 spinlock_t *idr_lock = &group->inotify_data.idr_lock;
2035
2036 - /* don't allow invalid bits: we don't want flags set */
2037 mask = inotify_arg_to_mask(arg);
2038
2039 tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
2040 @@ -753,6 +751,10 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
2041 int ret;
2042 unsigned flags = 0;
2043
2044 + /* don't allow invalid bits: we don't want flags set */
2045 + if (unlikely(!(mask & ALL_INOTIFY_BITS)))
2046 + return -EINVAL;
2047 +
2048 f = fdget(fd);
2049 if (unlikely(!f.file))
2050 return -EBADF;
2051 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
2052 index 1f8c823..d924812 100644
2053 --- a/fs/sysfs/dir.c
2054 +++ b/fs/sysfs/dir.c
2055 @@ -1012,6 +1012,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
2056 enum kobj_ns_type type;
2057 const void *ns;
2058 ino_t ino;
2059 + loff_t off;
2060
2061 type = sysfs_ns_type(parent_sd);
2062 ns = sysfs_info(dentry->d_sb)->ns[type];
2063 @@ -1034,6 +1035,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
2064 return 0;
2065 }
2066 mutex_lock(&sysfs_mutex);
2067 + off = filp->f_pos;
2068 for (pos = sysfs_dir_pos(ns, parent_sd, filp->f_pos, pos);
2069 pos;
2070 pos = sysfs_dir_next_pos(ns, parent_sd, filp->f_pos, pos)) {
2071 @@ -1045,19 +1047,24 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
2072 len = strlen(name);
2073 ino = pos->s_ino;
2074 type = dt_type(pos);
2075 - filp->f_pos = pos->s_hash;
2076 + off = filp->f_pos = pos->s_hash;
2077 filp->private_data = sysfs_get(pos);
2078
2079 mutex_unlock(&sysfs_mutex);
2080 - ret = filldir(dirent, name, len, filp->f_pos, ino, type);
2081 + ret = filldir(dirent, name, len, off, ino, type);
2082 mutex_lock(&sysfs_mutex);
2083 if (ret < 0)
2084 break;
2085 }
2086 mutex_unlock(&sysfs_mutex);
2087 - if ((filp->f_pos > 1) && !pos) { /* EOF */
2088 - filp->f_pos = INT_MAX;
2089 +
2090 + /* don't reference last entry if its refcount is dropped */
2091 + if (!pos) {
2092 filp->private_data = NULL;
2093 +
2094 + /* EOF and not changed as 0 or 1 in read/write path */
2095 + if (off == filp->f_pos && off > 1)
2096 + filp->f_pos = INT_MAX;
2097 }
2098 return 0;
2099 }
2100 diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
2101 index 5cf680a..f50a87d 100644
2102 --- a/include/asm-generic/pgtable.h
2103 +++ b/include/asm-generic/pgtable.h
2104 @@ -7,6 +7,16 @@
2105 #include <linux/mm_types.h>
2106 #include <linux/bug.h>
2107
2108 +/*
2109 + * On almost all architectures and configurations, 0 can be used as the
2110 + * upper ceiling to free_pgtables(): on many architectures it has the same
2111 + * effect as using TASK_SIZE. However, there is one configuration which
2112 + * must impose a more careful limit, to avoid freeing kernel pgtables.
2113 + */
2114 +#ifndef USER_PGTABLES_CEILING
2115 +#define USER_PGTABLES_CEILING 0UL
2116 +#endif
2117 +
2118 #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
2119 extern int ptep_set_access_flags(struct vm_area_struct *vma,
2120 unsigned long address, pte_t *ptep,
2121 diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
2122 index 7d73905..2322df7 100644
2123 --- a/include/linux/cgroup.h
2124 +++ b/include/linux/cgroup.h
2125 @@ -303,9 +303,6 @@ struct cftype {
2126 /* CFTYPE_* flags */
2127 unsigned int flags;
2128
2129 - /* file xattrs */
2130 - struct simple_xattrs xattrs;
2131 -
2132 int (*open)(struct inode *inode, struct file *file);
2133 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
2134 struct file *file,
2135 diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
2136 index ae221a7..c4d870b 100644
2137 --- a/include/linux/ipc_namespace.h
2138 +++ b/include/linux/ipc_namespace.h
2139 @@ -43,8 +43,8 @@ struct ipc_namespace {
2140
2141 size_t shm_ctlmax;
2142 size_t shm_ctlall;
2143 + unsigned long shm_tot;
2144 int shm_ctlmni;
2145 - int shm_tot;
2146 /*
2147 * Defines whether IPC_RMID is forced for _all_ shm segments regardless
2148 * of shmctl()
2149 diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
2150 index e30b663..383bef0 100644
2151 --- a/include/linux/jbd2.h
2152 +++ b/include/linux/jbd2.h
2153 @@ -498,6 +498,7 @@ struct transaction_s
2154 T_COMMIT,
2155 T_COMMIT_DFLUSH,
2156 T_COMMIT_JFLUSH,
2157 + T_COMMIT_CALLBACK,
2158 T_FINISHED
2159 } t_state;
2160
2161 @@ -1210,6 +1211,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
2162 int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
2163 int jbd2_journal_force_commit_nested(journal_t *journal);
2164 int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
2165 +int jbd2_complete_transaction(journal_t *journal, tid_t tid);
2166 int jbd2_log_do_checkpoint(journal_t *journal);
2167 int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
2168
2169 diff --git a/include/linux/sched.h b/include/linux/sched.h
2170 index 7e49270..f5ad26e 100644
2171 --- a/include/linux/sched.h
2172 +++ b/include/linux/sched.h
2173 @@ -2486,27 +2486,18 @@ static inline void threadgroup_change_end(struct task_struct *tsk)
2174 *
2175 * Lock the threadgroup @tsk belongs to. No new task is allowed to enter
2176 * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
2177 - * perform exec. This is useful for cases where the threadgroup needs to
2178 - * stay stable across blockable operations.
2179 + * change ->group_leader/pid. This is useful for cases where the threadgroup
2180 + * needs to stay stable across blockable operations.
2181 *
2182 * fork and exit paths explicitly call threadgroup_change_{begin|end}() for
2183 * synchronization. While held, no new task will be added to threadgroup
2184 * and no existing live task will have its PF_EXITING set.
2185 *
2186 - * During exec, a task goes and puts its thread group through unusual
2187 - * changes. After de-threading, exclusive access is assumed to resources
2188 - * which are usually shared by tasks in the same group - e.g. sighand may
2189 - * be replaced with a new one. Also, the exec'ing task takes over group
2190 - * leader role including its pid. Exclude these changes while locked by
2191 - * grabbing cred_guard_mutex which is used to synchronize exec path.
2192 + * de_thread() does threadgroup_change_{begin|end}() when a non-leader
2193 + * sub-thread becomes a new leader.
2194 */
2195 static inline void threadgroup_lock(struct task_struct *tsk)
2196 {
2197 - /*
2198 - * exec uses exit for de-threading nesting group_rwsem inside
2199 - * cred_guard_mutex. Grab cred_guard_mutex first.
2200 - */
2201 - mutex_lock(&tsk->signal->cred_guard_mutex);
2202 down_write(&tsk->signal->group_rwsem);
2203 }
2204
2205 @@ -2519,7 +2510,6 @@ static inline void threadgroup_lock(struct task_struct *tsk)
2206 static inline void threadgroup_unlock(struct task_struct *tsk)
2207 {
2208 up_write(&tsk->signal->group_rwsem);
2209 - mutex_unlock(&tsk->signal->cred_guard_mutex);
2210 }
2211 #else
2212 static inline void threadgroup_change_begin(struct task_struct *tsk) {}
2213 diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
2214 index f841ba4..dfb42ca 100644
2215 --- a/include/sound/emu10k1.h
2216 +++ b/include/sound/emu10k1.h
2217 @@ -1787,6 +1787,7 @@ struct snd_emu10k1 {
2218 unsigned int next_free_voice;
2219
2220 const struct firmware *firmware;
2221 + const struct firmware *dock_fw;
2222
2223 #ifdef CONFIG_PM_SLEEP
2224 unsigned int *saved_ptr;
2225 diff --git a/ipc/shm.c b/ipc/shm.c
2226 index 4fa6d8f..9bab650 100644
2227 --- a/ipc/shm.c
2228 +++ b/ipc/shm.c
2229 @@ -462,7 +462,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
2230 size_t size = params->u.size;
2231 int error;
2232 struct shmid_kernel *shp;
2233 - int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
2234 + size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
2235 struct file * file;
2236 char name[13];
2237 int id;
2238 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
2239 index 1e23664..cddf1d9 100644
2240 --- a/kernel/cgroup.c
2241 +++ b/kernel/cgroup.c
2242 @@ -162,6 +162,9 @@ struct cfent {
2243 struct list_head node;
2244 struct dentry *dentry;
2245 struct cftype *type;
2246 +
2247 + /* file xattrs */
2248 + struct simple_xattrs xattrs;
2249 };
2250
2251 /*
2252 @@ -908,13 +911,12 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
2253 } else {
2254 struct cfent *cfe = __d_cfe(dentry);
2255 struct cgroup *cgrp = dentry->d_parent->d_fsdata;
2256 - struct cftype *cft = cfe->type;
2257
2258 WARN_ONCE(!list_empty(&cfe->node) &&
2259 cgrp != &cgrp->root->top_cgroup,
2260 "cfe still linked for %s\n", cfe->type->name);
2261 + simple_xattrs_free(&cfe->xattrs);
2262 kfree(cfe);
2263 - simple_xattrs_free(&cft->xattrs);
2264 }
2265 iput(inode);
2266 }
2267 @@ -2066,7 +2068,7 @@ static int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
2268 if (!group)
2269 return -ENOMEM;
2270 /* pre-allocate to guarantee space while iterating in rcu read-side. */
2271 - retval = flex_array_prealloc(group, 0, group_size - 1, GFP_KERNEL);
2272 + retval = flex_array_prealloc(group, 0, group_size, GFP_KERNEL);
2273 if (retval)
2274 goto out_free_group_list;
2275
2276 @@ -2553,7 +2555,7 @@ static struct simple_xattrs *__d_xattrs(struct dentry *dentry)
2277 if (S_ISDIR(dentry->d_inode->i_mode))
2278 return &__d_cgrp(dentry)->xattrs;
2279 else
2280 - return &__d_cft(dentry)->xattrs;
2281 + return &__d_cfe(dentry)->xattrs;
2282 }
2283
2284 static inline int xattr_enabled(struct dentry *dentry)
2285 @@ -2729,8 +2731,6 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
2286 umode_t mode;
2287 char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 };
2288
2289 - simple_xattrs_init(&cft->xattrs);
2290 -
2291 if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) {
2292 strcpy(name, subsys->name);
2293 strcat(name, ".");
2294 @@ -2755,6 +2755,7 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
2295 cfe->type = (void *)cft;
2296 cfe->dentry = dentry;
2297 dentry->d_fsdata = cfe;
2298 + simple_xattrs_init(&cfe->xattrs);
2299 list_add_tail(&cfe->node, &parent->files);
2300 cfe = NULL;
2301 }
2302 diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
2303 index e4cee8d..60f7e32 100644
2304 --- a/kernel/hrtimer.c
2305 +++ b/kernel/hrtimer.c
2306 @@ -298,6 +298,10 @@ ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec)
2307 } else {
2308 unsigned long rem = do_div(nsec, NSEC_PER_SEC);
2309
2310 + /* Make sure nsec fits into long */
2311 + if (unlikely(nsec > KTIME_SEC_MAX))
2312 + return (ktime_t){ .tv64 = KTIME_MAX };
2313 +
2314 tmp = ktime_set((long)nsec, rem);
2315 }
2316
2317 @@ -1308,6 +1312,8 @@ retry:
2318
2319 expires = ktime_sub(hrtimer_get_expires(timer),
2320 base->offset);
2321 + if (expires.tv64 < 0)
2322 + expires.tv64 = KTIME_MAX;
2323 if (expires.tv64 < expires_next.tv64)
2324 expires_next = expires;
2325 break;
2326 diff --git a/kernel/rcutree_trace.c b/kernel/rcutree_trace.c
2327 index 0d095dc..93f8e8f 100644
2328 --- a/kernel/rcutree_trace.c
2329 +++ b/kernel/rcutree_trace.c
2330 @@ -97,7 +97,7 @@ static const struct file_operations rcubarrier_fops = {
2331 .open = rcubarrier_open,
2332 .read = seq_read,
2333 .llseek = no_llseek,
2334 - .release = seq_release,
2335 + .release = single_release,
2336 };
2337
2338 #ifdef CONFIG_RCU_BOOST
2339 @@ -208,7 +208,7 @@ static const struct file_operations rcuexp_fops = {
2340 .open = rcuexp_open,
2341 .read = seq_read,
2342 .llseek = no_llseek,
2343 - .release = seq_release,
2344 + .release = single_release,
2345 };
2346
2347 #ifdef CONFIG_RCU_BOOST
2348 @@ -308,7 +308,7 @@ static const struct file_operations rcuhier_fops = {
2349 .open = rcuhier_open,
2350 .read = seq_read,
2351 .llseek = no_llseek,
2352 - .release = seq_release,
2353 + .release = single_release,
2354 };
2355
2356 static void show_one_rcugp(struct seq_file *m, struct rcu_state *rsp)
2357 @@ -350,7 +350,7 @@ static const struct file_operations rcugp_fops = {
2358 .open = rcugp_open,
2359 .read = seq_read,
2360 .llseek = no_llseek,
2361 - .release = seq_release,
2362 + .release = single_release,
2363 };
2364
2365 static void print_one_rcu_pending(struct seq_file *m, struct rcu_data *rdp)
2366 diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
2367 index a13987a..239a323 100644
2368 --- a/kernel/time/tick-broadcast.c
2369 +++ b/kernel/time/tick-broadcast.c
2370 @@ -66,6 +66,8 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc)
2371 */
2372 int tick_check_broadcast_device(struct clock_event_device *dev)
2373 {
2374 + struct clock_event_device *cur = tick_broadcast_device.evtdev;
2375 +
2376 if ((dev->features & CLOCK_EVT_FEAT_DUMMY) ||
2377 (tick_broadcast_device.evtdev &&
2378 tick_broadcast_device.evtdev->rating >= dev->rating) ||
2379 @@ -73,6 +75,8 @@ int tick_check_broadcast_device(struct clock_event_device *dev)
2380 return 0;
2381
2382 clockevents_exchange_device(tick_broadcast_device.evtdev, dev);
2383 + if (cur)
2384 + cur->event_handler = clockevents_handle_noop;
2385 tick_broadcast_device.evtdev = dev;
2386 if (!cpumask_empty(tick_get_broadcast_mask()))
2387 tick_broadcast_start_periodic(dev);
2388 diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
2389 index b1600a6..7076b3f 100644
2390 --- a/kernel/time/tick-common.c
2391 +++ b/kernel/time/tick-common.c
2392 @@ -323,6 +323,7 @@ static void tick_shutdown(unsigned int *cpup)
2393 */
2394 dev->mode = CLOCK_EVT_MODE_UNUSED;
2395 clockevents_exchange_device(dev, NULL);
2396 + dev->event_handler = clockevents_handle_noop;
2397 td->evtdev = NULL;
2398 }
2399 raw_spin_unlock_irqrestore(&tick_device_lock, flags);
2400 diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
2401 index 35cc3a8..03dbc77 100644
2402 --- a/kernel/trace/ftrace.c
2403 +++ b/kernel/trace/ftrace.c
2404 @@ -650,7 +650,7 @@ int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
2405
2406 pages = DIV_ROUND_UP(functions, PROFILES_PER_PAGE);
2407
2408 - for (i = 0; i < pages; i++) {
2409 + for (i = 1; i < pages; i++) {
2410 pg->next = (void *)get_zeroed_page(GFP_KERNEL);
2411 if (!pg->next)
2412 goto out_free;
2413 @@ -3714,7 +3714,8 @@ out:
2414 if (fail)
2415 return -EINVAL;
2416
2417 - ftrace_graph_filter_enabled = 1;
2418 + ftrace_graph_filter_enabled = !!(*idx);
2419 +
2420 return 0;
2421 }
2422
2423 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
2424 index fe1d581..1c82852 100644
2425 --- a/kernel/trace/trace.c
2426 +++ b/kernel/trace/trace.c
2427 @@ -4885,6 +4885,8 @@ static __init int tracer_init_debugfs(void)
2428 trace_access_lock_init();
2429
2430 d_tracer = tracing_init_dentry();
2431 + if (!d_tracer)
2432 + return 0;
2433
2434 trace_create_file("trace_options", 0644, d_tracer,
2435 NULL, &tracing_iter_fops);
2436 diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
2437 index 83a8b5b..b20428c 100644
2438 --- a/kernel/trace/trace_stack.c
2439 +++ b/kernel/trace/trace_stack.c
2440 @@ -20,13 +20,24 @@
2441
2442 #define STACK_TRACE_ENTRIES 500
2443
2444 +#ifdef CC_USING_FENTRY
2445 +# define fentry 1
2446 +#else
2447 +# define fentry 0
2448 +#endif
2449 +
2450 static unsigned long stack_dump_trace[STACK_TRACE_ENTRIES+1] =
2451 { [0 ... (STACK_TRACE_ENTRIES)] = ULONG_MAX };
2452 static unsigned stack_dump_index[STACK_TRACE_ENTRIES];
2453
2454 +/*
2455 + * Reserve one entry for the passed in ip. This will allow
2456 + * us to remove most or all of the stack size overhead
2457 + * added by the stack tracer itself.
2458 + */
2459 static struct stack_trace max_stack_trace = {
2460 - .max_entries = STACK_TRACE_ENTRIES,
2461 - .entries = stack_dump_trace,
2462 + .max_entries = STACK_TRACE_ENTRIES - 1,
2463 + .entries = &stack_dump_trace[1],
2464 };
2465
2466 static unsigned long max_stack_size;
2467 @@ -39,25 +50,34 @@ static DEFINE_MUTEX(stack_sysctl_mutex);
2468 int stack_tracer_enabled;
2469 static int last_stack_tracer_enabled;
2470
2471 -static inline void check_stack(void)
2472 +static inline void
2473 +check_stack(unsigned long ip, unsigned long *stack)
2474 {
2475 unsigned long this_size, flags;
2476 unsigned long *p, *top, *start;
2477 + static int tracer_frame;
2478 + int frame_size = ACCESS_ONCE(tracer_frame);
2479 int i;
2480
2481 - this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
2482 + this_size = ((unsigned long)stack) & (THREAD_SIZE-1);
2483 this_size = THREAD_SIZE - this_size;
2484 + /* Remove the frame of the tracer */
2485 + this_size -= frame_size;
2486
2487 if (this_size <= max_stack_size)
2488 return;
2489
2490 /* we do not handle interrupt stacks yet */
2491 - if (!object_is_on_stack(&this_size))
2492 + if (!object_is_on_stack(stack))
2493 return;
2494
2495 local_irq_save(flags);
2496 arch_spin_lock(&max_stack_lock);
2497
2498 + /* In case another CPU set the tracer_frame on us */
2499 + if (unlikely(!frame_size))
2500 + this_size -= tracer_frame;
2501 +
2502 /* a race could have already updated it */
2503 if (this_size <= max_stack_size)
2504 goto out;
2505 @@ -70,10 +90,18 @@ static inline void check_stack(void)
2506 save_stack_trace(&max_stack_trace);
2507
2508 /*
2509 + * Add the passed in ip from the function tracer.
2510 + * Searching for this on the stack will skip over
2511 + * most of the overhead from the stack tracer itself.
2512 + */
2513 + stack_dump_trace[0] = ip;
2514 + max_stack_trace.nr_entries++;
2515 +
2516 + /*
2517 * Now find where in the stack these are.
2518 */
2519 i = 0;
2520 - start = &this_size;
2521 + start = stack;
2522 top = (unsigned long *)
2523 (((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE);
2524
2525 @@ -97,6 +125,18 @@ static inline void check_stack(void)
2526 found = 1;
2527 /* Start the search from here */
2528 start = p + 1;
2529 + /*
2530 + * We do not want to show the overhead
2531 + * of the stack tracer stack in the
2532 + * max stack. If we haven't figured
2533 + * out what that is, then figure it out
2534 + * now.
2535 + */
2536 + if (unlikely(!tracer_frame) && i == 1) {
2537 + tracer_frame = (p - stack) *
2538 + sizeof(unsigned long);
2539 + max_stack_size -= tracer_frame;
2540 + }
2541 }
2542 }
2543
2544 @@ -113,6 +153,7 @@ static void
2545 stack_trace_call(unsigned long ip, unsigned long parent_ip,
2546 struct ftrace_ops *op, struct pt_regs *pt_regs)
2547 {
2548 + unsigned long stack;
2549 int cpu;
2550
2551 preempt_disable_notrace();
2552 @@ -122,7 +163,26 @@ stack_trace_call(unsigned long ip, unsigned long parent_ip,
2553 if (per_cpu(trace_active, cpu)++ != 0)
2554 goto out;
2555
2556 - check_stack();
2557 + /*
2558 + * When fentry is used, the traced function does not get
2559 + * its stack frame set up, and we lose the parent.
2560 + * The ip is pretty useless because the function tracer
2561 + * was called before that function set up its stack frame.
2562 + * In this case, we use the parent ip.
2563 + *
2564 + * By adding the return address of either the parent ip
2565 + * or the current ip we can disregard most of the stack usage
2566 + * caused by the stack tracer itself.
2567 + *
2568 + * The function tracer always reports the address of where the
2569 + * mcount call was, but the stack will hold the return address.
2570 + */
2571 + if (fentry)
2572 + ip = parent_ip;
2573 + else
2574 + ip += MCOUNT_INSN_SIZE;
2575 +
2576 + check_stack(ip, &stack);
2577
2578 out:
2579 per_cpu(trace_active, cpu)--;
2580 @@ -371,6 +431,8 @@ static __init int stack_trace_init(void)
2581 struct dentry *d_tracer;
2582
2583 d_tracer = tracing_init_dentry();
2584 + if (!d_tracer)
2585 + return 0;
2586
2587 trace_create_file("stack_max_size", 0644, d_tracer,
2588 &max_stack_size, &stack_max_size_fops);
2589 diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
2590 index 96cffb2..847f88a 100644
2591 --- a/kernel/trace/trace_stat.c
2592 +++ b/kernel/trace/trace_stat.c
2593 @@ -307,6 +307,8 @@ static int tracing_stat_init(void)
2594 struct dentry *d_tracing;
2595
2596 d_tracing = tracing_init_dentry();
2597 + if (!d_tracing)
2598 + return 0;
2599
2600 stat_dir = debugfs_create_dir("trace_stat", d_tracing);
2601 if (!stat_dir)
2602 diff --git a/lib/oid_registry.c b/lib/oid_registry.c
2603 index d8de11f..318f382 100644
2604 --- a/lib/oid_registry.c
2605 +++ b/lib/oid_registry.c
2606 @@ -9,6 +9,7 @@
2607 * 2 of the Licence, or (at your option) any later version.
2608 */
2609
2610 +#include <linux/module.h>
2611 #include <linux/export.h>
2612 #include <linux/oid_registry.h>
2613 #include <linux/kernel.h>
2614 @@ -16,6 +17,10 @@
2615 #include <linux/bug.h>
2616 #include "oid_registry_data.c"
2617
2618 +MODULE_DESCRIPTION("OID Registry");
2619 +MODULE_AUTHOR("Red Hat, Inc.");
2620 +MODULE_LICENSE("GPL");
2621 +
2622 /**
2623 * look_up_OID - Find an OID registration for the specified data
2624 * @data: Binary representation of the OID
2625 diff --git a/mm/mmap.c b/mm/mmap.c
2626 index 90db251..32f3372 100644
2627 --- a/mm/mmap.c
2628 +++ b/mm/mmap.c
2629 @@ -2289,7 +2289,7 @@ static void unmap_region(struct mm_struct *mm,
2630 update_hiwater_rss(mm);
2631 unmap_vmas(&tlb, vma, start, end);
2632 free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
2633 - next ? next->vm_start : 0);
2634 + next ? next->vm_start : USER_PGTABLES_CEILING);
2635 tlb_finish_mmu(&tlb, start, end);
2636 }
2637
2638 @@ -2667,7 +2667,7 @@ void exit_mmap(struct mm_struct *mm)
2639 /* Use -1 here to ensure all VMAs in the mm are unmapped */
2640 unmap_vmas(&tlb, vma, 0, -1);
2641
2642 - free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, 0);
2643 + free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
2644 tlb_finish_mmu(&tlb, 0, -1);
2645
2646 /*
2647 diff --git a/mm/page_io.c b/mm/page_io.c
2648 index 78eee32..6182870 100644
2649 --- a/mm/page_io.c
2650 +++ b/mm/page_io.c
2651 @@ -214,6 +214,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
2652 kiocb.ki_left = PAGE_SIZE;
2653 kiocb.ki_nbytes = PAGE_SIZE;
2654
2655 + set_page_writeback(page);
2656 unlock_page(page);
2657 ret = mapping->a_ops->direct_IO(KERNEL_WRITE,
2658 &kiocb, &iov,
2659 @@ -222,7 +223,23 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
2660 if (ret == PAGE_SIZE) {
2661 count_vm_event(PSWPOUT);
2662 ret = 0;
2663 + } else {
2664 + /*
2665 + * In the case of swap-over-nfs, this can be a
2666 + * temporary failure if the system has limited
2667 + * memory for allocating transmit buffers.
2668 + * Mark the page dirty and avoid
2669 + * rotate_reclaimable_page but rate-limit the
2670 + * messages but do not flag PageError like
2671 + * the normal direct-to-bio case as it could
2672 + * be temporary.
2673 + */
2674 + set_page_dirty(page);
2675 + ClearPageReclaim(page);
2676 + pr_err_ratelimited("Write error on dio swapfile (%Lu)\n",
2677 + page_file_offset(page));
2678 }
2679 + end_page_writeback(page);
2680 return ret;
2681 }
2682
2683 diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
2684 index 79a48f3..64619f4 100644
2685 --- a/net/mac80211/pm.c
2686 +++ b/net/mac80211/pm.c
2687 @@ -52,8 +52,8 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
2688 ieee80211_stop_queues_by_reason(hw,
2689 IEEE80211_QUEUE_STOP_REASON_SUSPEND);
2690
2691 - /* flush out all packets */
2692 - synchronize_net();
2693 + /* flush out all packets and station cleanup call_rcu()s */
2694 + rcu_barrier();
2695
2696 drv_flush(local, false);
2697
2698 diff --git a/net/wireless/reg.c b/net/wireless/reg.c
2699 index 82c4fc7..91ef82b 100644
2700 --- a/net/wireless/reg.c
2701 +++ b/net/wireless/reg.c
2702 @@ -883,7 +883,7 @@ static void handle_channel(struct wiphy *wiphy,
2703 return;
2704
2705 REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq);
2706 - chan->flags = IEEE80211_CHAN_DISABLED;
2707 + chan->flags |= IEEE80211_CHAN_DISABLED;
2708 return;
2709 }
2710
2711 diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
2712 index 3368939..68b85e1 100644
2713 --- a/scripts/kconfig/streamline_config.pl
2714 +++ b/scripts/kconfig/streamline_config.pl
2715 @@ -156,7 +156,6 @@ sub read_kconfig {
2716
2717 my $state = "NONE";
2718 my $config;
2719 - my @kconfigs;
2720
2721 my $cont = 0;
2722 my $line;
2723 @@ -190,7 +189,13 @@ sub read_kconfig {
2724
2725 # collect any Kconfig sources
2726 if (/^source\s*"(.*)"/) {
2727 - $kconfigs[$#kconfigs+1] = $1;
2728 + my $kconfig = $1;
2729 + # prevent reading twice.
2730 + if (!defined($read_kconfigs{$kconfig})) {
2731 + $read_kconfigs{$kconfig} = 1;
2732 + read_kconfig($kconfig);
2733 + }
2734 + next;
2735 }
2736
2737 # configs found
2738 @@ -250,14 +255,6 @@ sub read_kconfig {
2739 }
2740 }
2741 close($kinfile);
2742 -
2743 - # read in any configs that were found.
2744 - foreach my $kconfig (@kconfigs) {
2745 - if (!defined($read_kconfigs{$kconfig})) {
2746 - $read_kconfigs{$kconfig} = 1;
2747 - read_kconfig($kconfig);
2748 - }
2749 - }
2750 }
2751
2752 if ($kconfig) {
2753 diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
2754 index e6b0166..bdd888e 100644
2755 --- a/sound/pci/emu10k1/emu10k1_main.c
2756 +++ b/sound/pci/emu10k1/emu10k1_main.c
2757 @@ -657,14 +657,14 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
2758 return 0;
2759 }
2760
2761 -static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu)
2762 +static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu,
2763 + const struct firmware *fw_entry)
2764 {
2765 int n, i;
2766 int reg;
2767 int value;
2768 unsigned int write_post;
2769 unsigned long flags;
2770 - const struct firmware *fw_entry = emu->firmware;
2771
2772 if (!fw_entry)
2773 return -EIO;
2774 @@ -725,9 +725,34 @@ static int emu1010_firmware_thread(void *data)
2775 /* Return to Audio Dock programming mode */
2776 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
2777 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
2778 - err = snd_emu1010_load_firmware(emu);
2779 - if (err != 0)
2780 - continue;
2781 +
2782 + if (!emu->dock_fw) {
2783 + const char *filename = NULL;
2784 + switch (emu->card_capabilities->emu_model) {
2785 + case EMU_MODEL_EMU1010:
2786 + filename = DOCK_FILENAME;
2787 + break;
2788 + case EMU_MODEL_EMU1010B:
2789 + filename = MICRO_DOCK_FILENAME;
2790 + break;
2791 + case EMU_MODEL_EMU1616:
2792 + filename = MICRO_DOCK_FILENAME;
2793 + break;
2794 + }
2795 + if (filename) {
2796 + err = request_firmware(&emu->dock_fw,
2797 + filename,
2798 + &emu->pci->dev);
2799 + if (err)
2800 + continue;
2801 + }
2802 + }
2803 +
2804 + if (emu->dock_fw) {
2805 + err = snd_emu1010_load_firmware(emu, emu->dock_fw);
2806 + if (err)
2807 + continue;
2808 + }
2809
2810 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
2811 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
2812 @@ -862,7 +887,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
2813 filename, emu->firmware->size);
2814 }
2815
2816 - err = snd_emu1010_load_firmware(emu);
2817 + err = snd_emu1010_load_firmware(emu, emu->firmware);
2818 if (err != 0) {
2819 snd_printk(KERN_INFO "emu1010: Loading Firmware failed\n");
2820 return err;
2821 @@ -1253,6 +1278,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
2822 kthread_stop(emu->emu1010.firmware_thread);
2823 if (emu->firmware)
2824 release_firmware(emu->firmware);
2825 + if (emu->dock_fw)
2826 + release_firmware(emu->dock_fw);
2827 if (emu->irq >= 0)
2828 free_irq(emu->irq, emu);
2829 /* remove reserved page */
2830 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2831 index ee975a2..7f45d48 100644
2832 --- a/sound/pci/hda/patch_realtek.c
2833 +++ b/sound/pci/hda/patch_realtek.c
2834 @@ -5823,6 +5823,7 @@ enum {
2835 ALC269_TYPE_ALC280,
2836 ALC269_TYPE_ALC282,
2837 ALC269_TYPE_ALC284,
2838 + ALC269_TYPE_ALC286,
2839 };
2840
2841 /*
2842 @@ -5846,6 +5847,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
2843 case ALC269_TYPE_ALC269VB:
2844 case ALC269_TYPE_ALC269VD:
2845 case ALC269_TYPE_ALC282:
2846 + case ALC269_TYPE_ALC286:
2847 ssids = alc269_ssids;
2848 break;
2849 default:
2850 @@ -6451,6 +6453,9 @@ static int patch_alc269(struct hda_codec *codec)
2851 case 0x10ec0292:
2852 spec->codec_variant = ALC269_TYPE_ALC284;
2853 break;
2854 + case 0x10ec0286:
2855 + spec->codec_variant = ALC269_TYPE_ALC286;
2856 + break;
2857 }
2858
2859 /* automatic parse from the BIOS config */
2860 @@ -7157,6 +7162,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
2861 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
2862 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
2863 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
2864 + { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
2865 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
2866 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
2867 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
2868 diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
2869 index a4c16fd..5d36319 100644
2870 --- a/sound/soc/codecs/max98088.c
2871 +++ b/sound/soc/codecs/max98088.c
2872 @@ -2006,7 +2006,7 @@ static int max98088_probe(struct snd_soc_codec *codec)
2873 ret);
2874 goto err_access;
2875 }
2876 - dev_info(codec->dev, "revision %c\n", ret + 'A');
2877 + dev_info(codec->dev, "revision %c\n", ret - 0x40 + 'A');
2878
2879 snd_soc_write(codec, M98088_REG_51_PWR_SYS, M98088_PWRSV);
2880
2881 diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
2882 index e2ca12f..40dd50a 100644
2883 --- a/sound/usb/6fire/pcm.c
2884 +++ b/sound/usb/6fire/pcm.c
2885 @@ -575,7 +575,6 @@ static void usb6fire_pcm_init_urb(struct pcm_urb *urb,
2886 urb->instance.pipe = in ? usb_rcvisocpipe(chip->dev, ep)
2887 : usb_sndisocpipe(chip->dev, ep);
2888 urb->instance.interval = 1;
2889 - urb->instance.transfer_flags = URB_ISO_ASAP;
2890 urb->instance.complete = handler;
2891 urb->instance.context = urb;
2892 urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB;
2893 diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
2894 index fde9a7a..b45e29b 100644
2895 --- a/sound/usb/caiaq/audio.c
2896 +++ b/sound/usb/caiaq/audio.c
2897 @@ -670,7 +670,6 @@ static void read_completed(struct urb *urb)
2898
2899 if (send_it) {
2900 out->number_of_packets = outframe;
2901 - out->transfer_flags = URB_ISO_ASAP;
2902 usb_submit_urb(out, GFP_ATOMIC);
2903 } else {
2904 struct snd_usb_caiaq_cb_info *oinfo = out->context;
2905 @@ -686,7 +685,6 @@ requeue:
2906 }
2907
2908 urb->number_of_packets = FRAMES_PER_URB;
2909 - urb->transfer_flags = URB_ISO_ASAP;
2910 usb_submit_urb(urb, GFP_ATOMIC);
2911 }
2912
2913 @@ -751,7 +749,6 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret)
2914 * BYTES_PER_FRAME;
2915 urbs[i]->context = &dev->data_cb_info[i];
2916 urbs[i]->interval = 1;
2917 - urbs[i]->transfer_flags = URB_ISO_ASAP;
2918 urbs[i]->number_of_packets = FRAMES_PER_URB;
2919 urbs[i]->complete = (dir == SNDRV_PCM_STREAM_CAPTURE) ?
2920 read_completed : write_completed;
2921 diff --git a/sound/usb/card.c b/sound/usb/card.c
2922 index ccf95cf..a9d5779 100644
2923 --- a/sound/usb/card.c
2924 +++ b/sound/usb/card.c
2925 @@ -612,7 +612,9 @@ int snd_usb_autoresume(struct snd_usb_audio *chip)
2926 int err = -ENODEV;
2927
2928 down_read(&chip->shutdown_rwsem);
2929 - if (!chip->shutdown && !chip->probing)
2930 + if (chip->probing)
2931 + err = 0;
2932 + else if (!chip->shutdown)
2933 err = usb_autopm_get_interface(chip->pm_intf);
2934 up_read(&chip->shutdown_rwsem);
2935
2936 diff --git a/sound/usb/card.h b/sound/usb/card.h
2937 index 8a751b4..d32ea41 100644
2938 --- a/sound/usb/card.h
2939 +++ b/sound/usb/card.h
2940 @@ -116,6 +116,7 @@ struct snd_usb_substream {
2941 unsigned int altset_idx; /* USB data format: index of alternate setting */
2942 unsigned int txfr_quirk:1; /* allow sub-frame alignment */
2943 unsigned int fmt_type; /* USB audio format type (1-3) */
2944 + unsigned int pkt_offset_adj; /* Bytes to drop from beginning of packets (for non-compliant devices) */
2945
2946 unsigned int running: 1; /* running status */
2947
2948 diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
2949 index 21049b8..63cca3a 100644
2950 --- a/sound/usb/endpoint.c
2951 +++ b/sound/usb/endpoint.c
2952 @@ -677,7 +677,7 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
2953 if (!u->urb->transfer_buffer)
2954 goto out_of_memory;
2955 u->urb->pipe = ep->pipe;
2956 - u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
2957 + u->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
2958 u->urb->interval = 1 << ep->datainterval;
2959 u->urb->context = u;
2960 u->urb->complete = snd_complete_urb;
2961 @@ -716,8 +716,7 @@ static int sync_ep_set_params(struct snd_usb_endpoint *ep,
2962 u->urb->transfer_dma = ep->sync_dma + i * 4;
2963 u->urb->transfer_buffer_length = 4;
2964 u->urb->pipe = ep->pipe;
2965 - u->urb->transfer_flags = URB_ISO_ASAP |
2966 - URB_NO_TRANSFER_DMA_MAP;
2967 + u->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
2968 u->urb->number_of_packets = 1;
2969 u->urb->interval = 1 << ep->syncinterval;
2970 u->urb->context = u;
2971 diff --git a/sound/usb/midi.c b/sound/usb/midi.c
2972 index 34b9bb7..e5fee18 100644
2973 --- a/sound/usb/midi.c
2974 +++ b/sound/usb/midi.c
2975 @@ -126,7 +126,6 @@ struct snd_usb_midi {
2976 struct snd_usb_midi_in_endpoint *in;
2977 } endpoints[MIDI_MAX_ENDPOINTS];
2978 unsigned long input_triggered;
2979 - bool autopm_reference;
2980 unsigned int opened[2];
2981 unsigned char disconnected;
2982 unsigned char input_running;
2983 @@ -1040,7 +1039,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
2984 {
2985 struct snd_usb_midi* umidi = substream->rmidi->private_data;
2986 struct snd_kcontrol *ctl;
2987 - int err;
2988
2989 down_read(&umidi->disc_rwsem);
2990 if (umidi->disconnected) {
2991 @@ -1051,13 +1049,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
2992 mutex_lock(&umidi->mutex);
2993 if (open) {
2994 if (!umidi->opened[0] && !umidi->opened[1]) {
2995 - err = usb_autopm_get_interface(umidi->iface);
2996 - umidi->autopm_reference = err >= 0;
2997 - if (err < 0 && err != -EACCES) {
2998 - mutex_unlock(&umidi->mutex);
2999 - up_read(&umidi->disc_rwsem);
3000 - return -EIO;
3001 - }
3002 if (umidi->roland_load_ctl) {
3003 ctl = umidi->roland_load_ctl;
3004 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
3005 @@ -1080,8 +1071,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
3006 snd_ctl_notify(umidi->card,
3007 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
3008 }
3009 - if (umidi->autopm_reference)
3010 - usb_autopm_put_interface(umidi->iface);
3011 }
3012 }
3013 mutex_unlock(&umidi->mutex);
3014 @@ -2256,6 +2245,8 @@ int snd_usbmidi_create(struct snd_card *card,
3015 return err;
3016 }
3017
3018 + usb_autopm_get_interface_no_resume(umidi->iface);
3019 +
3020 list_add_tail(&umidi->list, midi_list);
3021 return 0;
3022 }
3023 diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
3024 index 8b81cb5..6ad617b 100644
3025 --- a/sound/usb/misc/ua101.c
3026 +++ b/sound/usb/misc/ua101.c
3027 @@ -1120,8 +1120,7 @@ static int alloc_stream_urbs(struct ua101 *ua, struct ua101_stream *stream,
3028 usb_init_urb(&urb->urb);
3029 urb->urb.dev = ua->dev;
3030 urb->urb.pipe = stream->usb_pipe;
3031 - urb->urb.transfer_flags = URB_ISO_ASAP |
3032 - URB_NO_TRANSFER_DMA_MAP;
3033 + urb->urb.transfer_flags = URB_NO_TRANSFER_DMA_MAP;
3034 urb->urb.transfer_buffer = addr;
3035 urb->urb.transfer_dma = dma;
3036 urb->urb.transfer_buffer_length = max_packet_size;
3037 diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
3038 index d82e378..bcc50ed 100644
3039 --- a/sound/usb/pcm.c
3040 +++ b/sound/usb/pcm.c
3041 @@ -1161,7 +1161,7 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
3042 stride = runtime->frame_bits >> 3;
3043
3044 for (i = 0; i < urb->number_of_packets; i++) {
3045 - cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
3046 + cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj;
3047 if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
3048 snd_printdd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
3049 // continue;
3050 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
3051 index b9ca776..f581c3e 100644
3052 --- a/sound/usb/quirks.c
3053 +++ b/sound/usb/quirks.c
3054 @@ -837,6 +837,7 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs,
3055 break;
3056 }
3057 snd_emuusb_set_samplerate(subs->stream->chip, emu_samplerate_id);
3058 + subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
3059 }
3060
3061 void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
3062 diff --git a/sound/usb/stream.c b/sound/usb/stream.c
3063 index ad181d5..cfc4d4e 100644
3064 --- a/sound/usb/stream.c
3065 +++ b/sound/usb/stream.c
3066 @@ -94,6 +94,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
3067 subs->dev = as->chip->dev;
3068 subs->txfr_quirk = as->chip->txfr_quirk;
3069 subs->speed = snd_usb_get_speed(subs->dev);
3070 + subs->pkt_offset_adj = 0;
3071
3072 snd_usb_set_pcm_ops(as->pcm, stream);
3073
3074 @@ -396,6 +397,14 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
3075 if (!csep && altsd->bNumEndpoints >= 2)
3076 csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT);
3077
3078 + /*
3079 + * If we can't locate the USB_DT_CS_ENDPOINT descriptor in the extra
3080 + * bytes after the first endpoint, go search the entire interface.
3081 + * Some devices have it directly *before* the standard endpoint.
3082 + */
3083 + if (!csep)
3084 + csep = snd_usb_find_desc(alts->extra, alts->extralen, NULL, USB_DT_CS_ENDPOINT);
3085 +
3086 if (!csep || csep->bLength < 7 ||
3087 csep->bDescriptorSubtype != UAC_EP_GENERAL) {
3088 snd_printk(KERN_WARNING "%d:%u:%d : no or invalid"
3089 diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c
3090 index 1e7a47a..bf618e1 100644
3091 --- a/sound/usb/usx2y/usb_stream.c
3092 +++ b/sound/usb/usx2y/usb_stream.c
3093 @@ -69,7 +69,6 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
3094 ++u, transfer += transfer_length) {
3095 struct urb *urb = urbs[u];
3096 struct usb_iso_packet_descriptor *desc;
3097 - urb->transfer_flags = URB_ISO_ASAP;
3098 urb->transfer_buffer = transfer;
3099 urb->dev = dev;
3100 urb->pipe = pipe;
3101 diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
3102 index 520ef96..b376532 100644
3103 --- a/sound/usb/usx2y/usbusx2yaudio.c
3104 +++ b/sound/usb/usx2y/usbusx2yaudio.c
3105 @@ -503,7 +503,6 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
3106 if (0 == i)
3107 atomic_set(&subs->state, state_STARTING3);
3108 urb->dev = usX2Y->dev;
3109 - urb->transfer_flags = URB_ISO_ASAP;
3110 for (pack = 0; pack < nr_of_packs(); pack++) {
3111 urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack;
3112 urb->iso_frame_desc[pack].length = subs->maxpacksize;
3113 diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
3114 index cc56007..f2a1acd 100644
3115 --- a/sound/usb/usx2y/usx2yhwdeppcm.c
3116 +++ b/sound/usb/usx2y/usx2yhwdeppcm.c
3117 @@ -443,7 +443,6 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
3118 if (0 == u)
3119 atomic_set(&subs->state, state_STARTING3);
3120 urb->dev = usX2Y->dev;
3121 - urb->transfer_flags = URB_ISO_ASAP;
3122 for (pack = 0; pack < nr_of_packs(); pack++) {
3123 urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs());
3124 urb->iso_frame_desc[pack].length = subs->maxpacksize;