/[linux-patches]/genpatches-2.6/trunk/3.6/1001_linux-3.6.2.patch
Gentoo

Contents of /genpatches-2.6/trunk/3.6/1001_linux-3.6.2.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2219 - (show annotations) (download)
Fri Oct 12 23:14:46 2012 UTC (2 years, 2 months ago) by mpagano
File size: 145782 byte(s)
Linux patch 3.6.2
1 diff --git a/Makefile b/Makefile
2 index 9ed5898..af5d6a9 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 6
8 -SUBLEVEL = 1
9 +SUBLEVEL = 2
10 EXTRAVERSION =
11 NAME = Terrified Chipmunk
12
13 diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
14 index d6fde98..848ef4a 100644
15 --- a/arch/alpha/kernel/process.c
16 +++ b/arch/alpha/kernel/process.c
17 @@ -28,6 +28,7 @@
18 #include <linux/tty.h>
19 #include <linux/console.h>
20 #include <linux/slab.h>
21 +#include <linux/rcupdate.h>
22
23 #include <asm/reg.h>
24 #include <asm/uaccess.h>
25 @@ -54,8 +55,10 @@ cpu_idle(void)
26 /* FIXME -- EV6 and LCA45 know how to power down
27 the CPU. */
28
29 + rcu_idle_enter();
30 while (!need_resched())
31 cpu_relax();
32 + rcu_idle_exit();
33 schedule();
34 }
35 }
36 diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
37 index c334a23..fce38a6 100644
38 --- a/arch/arm/include/asm/syscall.h
39 +++ b/arch/arm/include/asm/syscall.h
40 @@ -8,6 +8,7 @@
41 #define _ASM_ARM_SYSCALL_H
42
43 #include <linux/err.h>
44 +#include <linux/sched.h>
45
46 extern const unsigned long sys_call_table[];
47
48 diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
49 index 66fd017..7f65be6 100644
50 --- a/arch/cris/kernel/process.c
51 +++ b/arch/cris/kernel/process.c
52 @@ -25,6 +25,7 @@
53 #include <linux/elfcore.h>
54 #include <linux/mqueue.h>
55 #include <linux/reboot.h>
56 +#include <linux/rcupdate.h>
57
58 //#define DEBUG
59
60 @@ -74,6 +75,7 @@ void cpu_idle (void)
61 {
62 /* endless idle loop with no priority at all */
63 while (1) {
64 + rcu_idle_enter();
65 while (!need_resched()) {
66 void (*idle)(void);
67 /*
68 @@ -86,6 +88,7 @@ void cpu_idle (void)
69 idle = default_idle;
70 idle();
71 }
72 + rcu_idle_exit();
73 schedule_preempt_disabled();
74 }
75 }
76 diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
77 index ff95f50..2eb7fa5 100644
78 --- a/arch/frv/kernel/process.c
79 +++ b/arch/frv/kernel/process.c
80 @@ -25,6 +25,7 @@
81 #include <linux/reboot.h>
82 #include <linux/interrupt.h>
83 #include <linux/pagemap.h>
84 +#include <linux/rcupdate.h>
85
86 #include <asm/asm-offsets.h>
87 #include <asm/uaccess.h>
88 @@ -69,12 +70,14 @@ void cpu_idle(void)
89 {
90 /* endless idle loop with no priority at all */
91 while (1) {
92 + rcu_idle_enter();
93 while (!need_resched()) {
94 check_pgt_cache();
95
96 if (!frv_dma_inprogress && idle)
97 idle();
98 }
99 + rcu_idle_exit();
100
101 schedule_preempt_disabled();
102 }
103 diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
104 index 0e9c315..f153ed1 100644
105 --- a/arch/h8300/kernel/process.c
106 +++ b/arch/h8300/kernel/process.c
107 @@ -36,6 +36,7 @@
108 #include <linux/reboot.h>
109 #include <linux/fs.h>
110 #include <linux/slab.h>
111 +#include <linux/rcupdate.h>
112
113 #include <asm/uaccess.h>
114 #include <asm/traps.h>
115 @@ -78,8 +79,10 @@ void (*idle)(void) = default_idle;
116 void cpu_idle(void)
117 {
118 while (1) {
119 + rcu_idle_enter();
120 while (!need_resched())
121 idle();
122 + rcu_idle_exit();
123 schedule_preempt_disabled();
124 }
125 }
126 diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
127 index dd6fc14..3e316ec 100644
128 --- a/arch/ia64/kernel/process.c
129 +++ b/arch/ia64/kernel/process.c
130 @@ -29,6 +29,7 @@
131 #include <linux/kdebug.h>
132 #include <linux/utsname.h>
133 #include <linux/tracehook.h>
134 +#include <linux/rcupdate.h>
135
136 #include <asm/cpu.h>
137 #include <asm/delay.h>
138 @@ -279,6 +280,7 @@ cpu_idle (void)
139
140 /* endless idle loop with no priority at all */
141 while (1) {
142 + rcu_idle_enter();
143 if (can_do_pal_halt) {
144 current_thread_info()->status &= ~TS_POLLING;
145 /*
146 @@ -309,6 +311,7 @@ cpu_idle (void)
147 normal_xtp();
148 #endif
149 }
150 + rcu_idle_exit();
151 schedule_preempt_disabled();
152 check_pgt_cache();
153 if (cpu_is_offline(cpu))
154 diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
155 index 3a4a32b..384e63f 100644
156 --- a/arch/m32r/kernel/process.c
157 +++ b/arch/m32r/kernel/process.c
158 @@ -26,6 +26,7 @@
159 #include <linux/ptrace.h>
160 #include <linux/unistd.h>
161 #include <linux/hardirq.h>
162 +#include <linux/rcupdate.h>
163
164 #include <asm/io.h>
165 #include <asm/uaccess.h>
166 @@ -82,6 +83,7 @@ void cpu_idle (void)
167 {
168 /* endless idle loop with no priority at all */
169 while (1) {
170 + rcu_idle_enter();
171 while (!need_resched()) {
172 void (*idle)(void) = pm_idle;
173
174 @@ -90,6 +92,7 @@ void cpu_idle (void)
175
176 idle();
177 }
178 + rcu_idle_exit();
179 schedule_preempt_disabled();
180 }
181 }
182 diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
183 index c488e3c..ac2892e 100644
184 --- a/arch/m68k/kernel/process.c
185 +++ b/arch/m68k/kernel/process.c
186 @@ -25,6 +25,7 @@
187 #include <linux/reboot.h>
188 #include <linux/init_task.h>
189 #include <linux/mqueue.h>
190 +#include <linux/rcupdate.h>
191
192 #include <asm/uaccess.h>
193 #include <asm/traps.h>
194 @@ -75,8 +76,10 @@ void cpu_idle(void)
195 {
196 /* endless idle loop with no priority at all */
197 while (1) {
198 + rcu_idle_enter();
199 while (!need_resched())
200 idle();
201 + rcu_idle_exit();
202 schedule_preempt_disabled();
203 }
204 }
205 diff --git a/arch/mips/Makefile b/arch/mips/Makefile
206 index 764e37a..654b1ad 100644
207 --- a/arch/mips/Makefile
208 +++ b/arch/mips/Makefile
209 @@ -225,7 +225,7 @@ KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
210 LDFLAGS += -m $(ld-emul)
211
212 ifdef CONFIG_MIPS
213 -CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -xc /dev/null | \
214 +CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
215 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
216 sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/")
217 ifdef CONFIG_64BIT
218 diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c
219 index b91ad3e..d272857 100644
220 --- a/arch/mips/ath79/clock.c
221 +++ b/arch/mips/ath79/clock.c
222 @@ -189,7 +189,7 @@ static void __init ar934x_clocks_init(void)
223 AR934X_PLL_CPU_CONFIG_NFRAC_MASK;
224
225 cpu_pll = nint * ath79_ref_clk.rate / ref_div;
226 - cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 6));
227 + cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 6));
228 cpu_pll /= (1 << out_div);
229
230 pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG);
231 @@ -203,7 +203,7 @@ static void __init ar934x_clocks_init(void)
232 AR934X_PLL_DDR_CONFIG_NFRAC_MASK;
233
234 ddr_pll = nint * ath79_ref_clk.rate / ref_div;
235 - ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 10));
236 + ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 10));
237 ddr_pll /= (1 << out_div);
238
239 clk_ctrl = ath79_pll_rr(AR934X_PLL_CPU_DDR_CLK_CTRL_REG);
240 diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
241 index fdaf65e..c6136cb 100644
242 --- a/arch/mips/kernel/Makefile
243 +++ b/arch/mips/kernel/Makefile
244 @@ -104,7 +104,7 @@ obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
245
246 obj-$(CONFIG_OF) += prom.o
247
248 -CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
249 +CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -x c /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
250
251 obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
252
253 diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile
254 index 33188b6..a3d0fef 100644
255 --- a/arch/mn10300/Makefile
256 +++ b/arch/mn10300/Makefile
257 @@ -26,7 +26,7 @@ CHECKFLAGS +=
258 PROCESSOR := unset
259 UNIT := unset
260
261 -KBUILD_CFLAGS += -mam33 -mmem-funcs -DCPU=AM33
262 +KBUILD_CFLAGS += -mam33 -DCPU=AM33 $(call cc-option,-mmem-funcs,)
263 KBUILD_AFLAGS += -mam33 -DCPU=AM33
264
265 ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y)
266 diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
267 index 7dab0cd..e9cceba 100644
268 --- a/arch/mn10300/kernel/process.c
269 +++ b/arch/mn10300/kernel/process.c
270 @@ -25,6 +25,7 @@
271 #include <linux/err.h>
272 #include <linux/fs.h>
273 #include <linux/slab.h>
274 +#include <linux/rcupdate.h>
275 #include <asm/uaccess.h>
276 #include <asm/pgtable.h>
277 #include <asm/io.h>
278 @@ -107,6 +108,7 @@ void cpu_idle(void)
279 {
280 /* endless idle loop with no priority at all */
281 for (;;) {
282 + rcu_idle_enter();
283 while (!need_resched()) {
284 void (*idle)(void);
285
286 @@ -121,6 +123,7 @@ void cpu_idle(void)
287 }
288 idle();
289 }
290 + rcu_idle_exit();
291
292 schedule_preempt_disabled();
293 }
294 diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
295 index 2c05a92..8c6b6b6 100644
296 --- a/arch/parisc/kernel/process.c
297 +++ b/arch/parisc/kernel/process.c
298 @@ -48,6 +48,7 @@
299 #include <linux/unistd.h>
300 #include <linux/kallsyms.h>
301 #include <linux/uaccess.h>
302 +#include <linux/rcupdate.h>
303
304 #include <asm/io.h>
305 #include <asm/asm-offsets.h>
306 @@ -69,8 +70,10 @@ void cpu_idle(void)
307
308 /* endless idle loop with no priority at all */
309 while (1) {
310 + rcu_idle_enter();
311 while (!need_resched())
312 barrier();
313 + rcu_idle_exit();
314 schedule_preempt_disabled();
315 check_pgt_cache();
316 }
317 diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
318 index 8cccbee..78326de 100644
319 --- a/arch/powerpc/include/asm/pci-bridge.h
320 +++ b/arch/powerpc/include/asm/pci-bridge.h
321 @@ -182,6 +182,14 @@ static inline int pci_device_from_OF_node(struct device_node *np,
322 #if defined(CONFIG_EEH)
323 static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
324 {
325 + /*
326 + * For those OF nodes whose parent isn't PCI bridge, they
327 + * don't have PCI_DN actually. So we have to skip them for
328 + * any EEH operations.
329 + */
330 + if (!dn || !PCI_DN(dn))
331 + return NULL;
332 +
333 return PCI_DN(dn)->edev;
334 }
335 #endif
336 diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
337 index ff5a6ce..8226c6c 100644
338 --- a/arch/powerpc/kernel/iommu.c
339 +++ b/arch/powerpc/kernel/iommu.c
340 @@ -215,7 +215,8 @@ static unsigned long iommu_range_alloc(struct device *dev,
341 spin_lock_irqsave(&(pool->lock), flags);
342
343 again:
344 - if ((pass == 0) && handle && *handle)
345 + if ((pass == 0) && handle && *handle &&
346 + (*handle >= pool->start) && (*handle < pool->end))
347 start = *handle;
348 else
349 start = pool->hint;
350 @@ -236,7 +237,9 @@ again:
351 * but on second pass, start at 0 in pool 0.
352 */
353 if ((start & mask) >= limit || pass > 0) {
354 + spin_unlock(&(pool->lock));
355 pool = &(tbl->pools[0]);
356 + spin_lock(&(pool->lock));
357 start = pool->start;
358 } else {
359 start &= mask;
360 diff --git a/arch/powerpc/lib/memcpy_power7.S b/arch/powerpc/lib/memcpy_power7.S
361 index 7ba6c96..0663630 100644
362 --- a/arch/powerpc/lib/memcpy_power7.S
363 +++ b/arch/powerpc/lib/memcpy_power7.S
364 @@ -239,8 +239,8 @@ _GLOBAL(memcpy_power7)
365 ori r9,r9,1 /* stream=1 */
366
367 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */
368 - cmpldi cr1,r7,0x3FF
369 - ble cr1,1f
370 + cmpldi r7,0x3FF
371 + ble 1f
372 li r7,0x3FF
373 1: lis r0,0x0E00 /* depth=7 */
374 sldi r7,r7,7
375 diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
376 index ecd394c..9a0b5f5 100644
377 --- a/arch/powerpc/platforms/pseries/eeh.c
378 +++ b/arch/powerpc/platforms/pseries/eeh.c
379 @@ -1029,7 +1029,7 @@ static void eeh_add_device_early(struct device_node *dn)
380 {
381 struct pci_controller *phb;
382
383 - if (!dn || !of_node_to_eeh_dev(dn))
384 + if (!of_node_to_eeh_dev(dn))
385 return;
386 phb = of_node_to_eeh_dev(dn)->phb;
387
388 diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
389 index 4f2680f..b68b0db 100644
390 --- a/arch/powerpc/sysdev/dart_iommu.c
391 +++ b/arch/powerpc/sysdev/dart_iommu.c
392 @@ -74,11 +74,16 @@ static int dart_is_u4;
393
394 #define DBG(...)
395
396 +static DEFINE_SPINLOCK(invalidate_lock);
397 +
398 static inline void dart_tlb_invalidate_all(void)
399 {
400 unsigned long l = 0;
401 unsigned int reg, inv_bit;
402 unsigned long limit;
403 + unsigned long flags;
404 +
405 + spin_lock_irqsave(&invalidate_lock, flags);
406
407 DBG("dart: flush\n");
408
409 @@ -111,12 +116,17 @@ retry:
410 panic("DART: TLB did not flush after waiting a long "
411 "time. Buggy U3 ?");
412 }
413 +
414 + spin_unlock_irqrestore(&invalidate_lock, flags);
415 }
416
417 static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
418 {
419 unsigned int reg;
420 unsigned int l, limit;
421 + unsigned long flags;
422 +
423 + spin_lock_irqsave(&invalidate_lock, flags);
424
425 reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
426 (bus_rpn & DART_CNTL_U4_IONE_MASK);
427 @@ -138,6 +148,8 @@ wait_more:
428 panic("DART: TLB did not flush after waiting a long "
429 "time. Buggy U4 ?");
430 }
431 +
432 + spin_unlock_irqrestore(&invalidate_lock, flags);
433 }
434
435 static void dart_flush(struct iommu_table *tbl)
436 diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
437 index 2707023..637970c 100644
438 --- a/arch/score/kernel/process.c
439 +++ b/arch/score/kernel/process.c
440 @@ -27,6 +27,7 @@
441 #include <linux/reboot.h>
442 #include <linux/elfcore.h>
443 #include <linux/pm.h>
444 +#include <linux/rcupdate.h>
445
446 void (*pm_power_off)(void);
447 EXPORT_SYMBOL(pm_power_off);
448 @@ -50,9 +51,10 @@ void __noreturn cpu_idle(void)
449 {
450 /* endless idle loop with no priority at all */
451 while (1) {
452 + rcu_idle_enter();
453 while (!need_resched())
454 barrier();
455 -
456 + rcu_idle_exit();
457 schedule_preempt_disabled();
458 }
459 }
460 diff --git a/arch/x86/Makefile b/arch/x86/Makefile
461 index 474ca35..58790bd 100644
462 --- a/arch/x86/Makefile
463 +++ b/arch/x86/Makefile
464 @@ -92,7 +92,7 @@ endif
465 ifdef CONFIG_X86_X32
466 x32_ld_ok := $(call try-run,\
467 /bin/echo -e '1: .quad 1b' | \
468 - $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" - && \
469 + $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \
470 $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
471 $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
472 ifeq ($(x32_ld_ok),y)
473 @@ -142,7 +142,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
474 KBUILD_CFLAGS += $(mflags-y)
475 KBUILD_AFLAGS += $(mflags-y)
476
477 -archscripts: scripts_basic
478 +archscripts:
479 $(Q)$(MAKE) $(build)=arch/x86/tools relocs
480
481 ###
482 diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
483 index e398bb5..8a84501 100644
484 --- a/arch/x86/boot/compressed/Makefile
485 +++ b/arch/x86/boot/compressed/Makefile
486 @@ -28,6 +28,9 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
487 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
488 $(obj)/piggy.o
489
490 +$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
491 +$(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone
492 +
493 ifeq ($(CONFIG_EFI_STUB), y)
494 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
495 endif
496 diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
497 index 49afb3f..c3520d7 100644
498 --- a/arch/x86/include/asm/pgtable.h
499 +++ b/arch/x86/include/asm/pgtable.h
500 @@ -146,8 +146,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
501
502 static inline int pmd_large(pmd_t pte)
503 {
504 - return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
505 - (_PAGE_PSE | _PAGE_PRESENT);
506 + return pmd_flags(pte) & _PAGE_PSE;
507 }
508
509 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
510 @@ -415,7 +414,13 @@ static inline int pte_hidden(pte_t pte)
511
512 static inline int pmd_present(pmd_t pmd)
513 {
514 - return pmd_flags(pmd) & _PAGE_PRESENT;
515 + /*
516 + * Checking for _PAGE_PSE is needed too because
517 + * split_huge_page will temporarily clear the present bit (but
518 + * the _PAGE_PSE flag will remain set at all times while the
519 + * _PAGE_PRESENT bit is clear).
520 + */
521 + return pmd_flags(pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE);
522 }
523
524 static inline int pmd_none(pmd_t pmd)
525 diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
526 index 92660eda..f55a4ce 100644
527 --- a/arch/x86/platform/efi/efi.c
528 +++ b/arch/x86/platform/efi/efi.c
529 @@ -890,6 +890,7 @@ void __init efi_enter_virtual_mode(void)
530 *
531 * Call EFI services through wrapper functions.
532 */
533 + efi.runtime_version = efi_systab.fw_revision;
534 efi.get_time = virt_efi_get_time;
535 efi.set_time = virt_efi_set_time;
536 efi.get_wakeup_time = virt_efi_get_wakeup_time;
537 diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
538 index 2c8d6a3..bc44311 100644
539 --- a/arch/xtensa/kernel/process.c
540 +++ b/arch/xtensa/kernel/process.c
541 @@ -31,6 +31,7 @@
542 #include <linux/mqueue.h>
543 #include <linux/fs.h>
544 #include <linux/slab.h>
545 +#include <linux/rcupdate.h>
546
547 #include <asm/pgtable.h>
548 #include <asm/uaccess.h>
549 @@ -110,8 +111,10 @@ void cpu_idle(void)
550
551 /* endless idle loop with no priority at all */
552 while (1) {
553 + rcu_idle_enter();
554 while (!need_resched())
555 platform_idle();
556 + rcu_idle_exit();
557 schedule_preempt_disabled();
558 }
559 }
560 diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
561 index e059695..d59175e 100644
562 --- a/drivers/acpi/bus.c
563 +++ b/drivers/acpi/bus.c
564 @@ -994,8 +994,6 @@ static int __init acpi_bus_init(void)
565 status = acpi_ec_ecdt_probe();
566 /* Ignore result. Not having an ECDT is not fatal. */
567
568 - acpi_bus_osc_support();
569 -
570 status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
571 if (ACPI_FAILURE(status)) {
572 printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
573 @@ -1003,6 +1001,12 @@ static int __init acpi_bus_init(void)
574 }
575
576 /*
577 + * _OSC method may exist in module level code,
578 + * so it must be run after ACPI_FULL_INITIALIZATION
579 + */
580 + acpi_bus_osc_support();
581 +
582 + /*
583 * _PDC control method may load dynamic SSDT tables,
584 * and we need to install the table handler before that.
585 */
586 diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
587 index 0113adc..2700f2e 100644
588 --- a/drivers/base/power/main.c
589 +++ b/drivers/base/power/main.c
590 @@ -996,7 +996,7 @@ int dpm_suspend_end(pm_message_t state)
591
592 error = dpm_suspend_noirq(state);
593 if (error) {
594 - dpm_resume_early(state);
595 + dpm_resume_early(resume_event(state));
596 return error;
597 }
598
599 diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
600 index 3491654..a815d44 100644
601 --- a/drivers/dma/dmaengine.c
602 +++ b/drivers/dma/dmaengine.c
603 @@ -582,7 +582,7 @@ void dmaengine_get(void)
604 list_del_rcu(&device->global_node);
605 break;
606 } else if (err)
607 - pr_err("%s: failed to get %s: (%d)\n",
608 + pr_debug("%s: failed to get %s: (%d)\n",
609 __func__, dma_chan_name(chan), err);
610 }
611 }
612 diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
613 index 6fbfc24..af81f77 100644
614 --- a/drivers/gpu/drm/drm_crtc.c
615 +++ b/drivers/gpu/drm/drm_crtc.c
616 @@ -1034,15 +1034,15 @@ void drm_mode_config_cleanup(struct drm_device *dev)
617 fb->funcs->destroy(fb);
618 }
619
620 - list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) {
621 - crtc->funcs->destroy(crtc);
622 - }
623 -
624 list_for_each_entry_safe(plane, plt, &dev->mode_config.plane_list,
625 head) {
626 plane->funcs->destroy(plane);
627 }
628
629 + list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) {
630 + crtc->funcs->destroy(crtc);
631 + }
632 +
633 idr_remove_all(&dev->mode_config.crtc_idr);
634 idr_destroy(&dev->mode_config.crtc_idr);
635 }
636 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
637 index 5249640..73fa3e1 100644
638 --- a/drivers/gpu/drm/i915/i915_irq.c
639 +++ b/drivers/gpu/drm/i915/i915_irq.c
640 @@ -680,12 +680,12 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
641 intel_opregion_gse_intr(dev);
642
643 for (i = 0; i < 3; i++) {
644 + if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))
645 + drm_handle_vblank(dev, i);
646 if (de_iir & (DE_PLANEA_FLIP_DONE_IVB << (5 * i))) {
647 intel_prepare_page_flip(dev, i);
648 intel_finish_page_flip_plane(dev, i);
649 }
650 - if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))
651 - drm_handle_vblank(dev, i);
652 }
653
654 /* check event from PCH */
655 @@ -767,6 +767,12 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
656 if (de_iir & DE_GSE)
657 intel_opregion_gse_intr(dev);
658
659 + if (de_iir & DE_PIPEA_VBLANK)
660 + drm_handle_vblank(dev, 0);
661 +
662 + if (de_iir & DE_PIPEB_VBLANK)
663 + drm_handle_vblank(dev, 1);
664 +
665 if (de_iir & DE_PLANEA_FLIP_DONE) {
666 intel_prepare_page_flip(dev, 0);
667 intel_finish_page_flip_plane(dev, 0);
668 @@ -777,12 +783,6 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
669 intel_finish_page_flip_plane(dev, 1);
670 }
671
672 - if (de_iir & DE_PIPEA_VBLANK)
673 - drm_handle_vblank(dev, 0);
674 -
675 - if (de_iir & DE_PIPEB_VBLANK)
676 - drm_handle_vblank(dev, 1);
677 -
678 /* check event from PCH */
679 if (de_iir & DE_PCH_EVENT) {
680 if (pch_iir & hotplug_mask)
681 diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
682 index 28725ce..a3e53c5 100644
683 --- a/drivers/gpu/drm/i915/i915_reg.h
684 +++ b/drivers/gpu/drm/i915/i915_reg.h
685 @@ -519,6 +519,9 @@
686 # define VS_TIMER_DISPATCH (1 << 6)
687 # define MI_FLUSH_ENABLE (1 << 12)
688
689 +#define GEN6_GT_MODE 0x20d0
690 +#define GEN6_GT_MODE_HI (1 << 9)
691 +
692 #define GFX_MODE 0x02520
693 #define GFX_MODE_GEN7 0x0229c
694 #define RING_MODE_GEN7(ring) ((ring)->mmio_base+0x29c)
695 @@ -1753,6 +1756,10 @@
696
697 /* Video Data Island Packet control */
698 #define VIDEO_DIP_DATA 0x61178
699 +/* Read the description of VIDEO_DIP_DATA (before Haswel) or VIDEO_DIP_ECC
700 + * (Haswell and newer) to see which VIDEO_DIP_DATA byte corresponds to each byte
701 + * of the infoframe structure specified by CEA-861. */
702 +#define VIDEO_DIP_DATA_SIZE 32
703 #define VIDEO_DIP_CTL 0x61170
704 /* Pre HSW: */
705 #define VIDEO_DIP_ENABLE (1 << 31)
706 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
707 index c040aee..0c7f4aa 100644
708 --- a/drivers/gpu/drm/i915/intel_display.c
709 +++ b/drivers/gpu/drm/i915/intel_display.c
710 @@ -2823,13 +2823,34 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc)
711 udelay(100);
712 }
713
714 +static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
715 +{
716 + struct drm_device *dev = crtc->dev;
717 + struct drm_i915_private *dev_priv = dev->dev_private;
718 + unsigned long flags;
719 + bool pending;
720 +
721 + if (atomic_read(&dev_priv->mm.wedged))
722 + return false;
723 +
724 + spin_lock_irqsave(&dev->event_lock, flags);
725 + pending = to_intel_crtc(crtc)->unpin_work != NULL;
726 + spin_unlock_irqrestore(&dev->event_lock, flags);
727 +
728 + return pending;
729 +}
730 +
731 static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
732 {
733 struct drm_device *dev = crtc->dev;
734 + struct drm_i915_private *dev_priv = dev->dev_private;
735
736 if (crtc->fb == NULL)
737 return;
738
739 + wait_event(dev_priv->pending_flip_queue,
740 + !intel_crtc_has_pending_flip(crtc));
741 +
742 mutex_lock(&dev->struct_mutex);
743 intel_finish_fb(crtc->fb);
744 mutex_unlock(&dev->struct_mutex);
745 @@ -6149,9 +6170,8 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
746
747 atomic_clear_mask(1 << intel_crtc->plane,
748 &obj->pending_flip.counter);
749 - if (atomic_read(&obj->pending_flip) == 0)
750 - wake_up(&dev_priv->pending_flip_queue);
751
752 + wake_up(&dev_priv->pending_flip_queue);
753 schedule_work(&work->work);
754
755 trace_i915_flip_complete(intel_crtc->plane, work->pending_flip_obj);
756 @@ -6394,7 +6414,7 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
757 default:
758 WARN_ONCE(1, "unknown plane in flip command\n");
759 ret = -ENODEV;
760 - goto err;
761 + goto err_unpin;
762 }
763
764 ret = intel_ring_begin(ring, 4);
765 diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
766 index 12dc330..34b6724 100644
767 --- a/drivers/gpu/drm/i915/intel_hdmi.c
768 +++ b/drivers/gpu/drm/i915/intel_hdmi.c
769 @@ -151,6 +151,9 @@ static void g4x_write_infoframe(struct drm_encoder *encoder,
770 I915_WRITE(VIDEO_DIP_DATA, *data);
771 data++;
772 }
773 + /* Write every possible data byte to force correct ECC calculation. */
774 + for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
775 + I915_WRITE(VIDEO_DIP_DATA, 0);
776 mmiowb();
777
778 val |= g4x_infoframe_enable(frame);
779 @@ -186,6 +189,9 @@ static void ibx_write_infoframe(struct drm_encoder *encoder,
780 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
781 data++;
782 }
783 + /* Write every possible data byte to force correct ECC calculation. */
784 + for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
785 + I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
786 mmiowb();
787
788 val |= g4x_infoframe_enable(frame);
789 @@ -224,6 +230,9 @@ static void cpt_write_infoframe(struct drm_encoder *encoder,
790 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
791 data++;
792 }
793 + /* Write every possible data byte to force correct ECC calculation. */
794 + for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
795 + I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
796 mmiowb();
797
798 val |= g4x_infoframe_enable(frame);
799 @@ -259,6 +268,9 @@ static void vlv_write_infoframe(struct drm_encoder *encoder,
800 I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
801 data++;
802 }
803 + /* Write every possible data byte to force correct ECC calculation. */
804 + for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
805 + I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
806 mmiowb();
807
808 val |= g4x_infoframe_enable(frame);
809 @@ -292,6 +304,9 @@ static void hsw_write_infoframe(struct drm_encoder *encoder,
810 I915_WRITE(data_reg + i, *data);
811 data++;
812 }
813 + /* Write every possible data byte to force correct ECC calculation. */
814 + for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
815 + I915_WRITE(data_reg + i, 0);
816 mmiowb();
817
818 val |= hsw_infoframe_enable(frame);
819 diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
820 index ba8a27b..8c73fae 100644
821 --- a/drivers/gpu/drm/i915/intel_pm.c
822 +++ b/drivers/gpu/drm/i915/intel_pm.c
823 @@ -3387,6 +3387,11 @@ static void gen6_init_clock_gating(struct drm_device *dev)
824 DISPPLANE_TRICKLE_FEED_DISABLE);
825 intel_flush_display_plane(dev_priv, pipe);
826 }
827 +
828 + /* The default value should be 0x200 according to docs, but the two
829 + * platforms I checked have a 0 for this. (Maybe BIOS overrides?) */
830 + I915_WRITE(GEN6_GT_MODE, _MASKED_BIT_DISABLE(0xffff));
831 + I915_WRITE(GEN6_GT_MODE, _MASKED_BIT_ENABLE(GEN6_GT_MODE_HI));
832 }
833
834 static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
835 diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c b/drivers/gpu/drm/nouveau/nvc0_fence.c
836 index 47ab388..8e5a2f4 100644
837 --- a/drivers/gpu/drm/nouveau/nvc0_fence.c
838 +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c
839 @@ -32,6 +32,7 @@
840 struct nvc0_fence_priv {
841 struct nouveau_fence_priv base;
842 struct nouveau_bo *bo;
843 + u32 *suspend;
844 };
845
846 struct nvc0_fence_chan {
847 @@ -125,12 +126,36 @@ nvc0_fence_context_new(struct nouveau_channel *chan, int engine)
848 static int
849 nvc0_fence_fini(struct drm_device *dev, int engine, bool suspend)
850 {
851 + struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
852 + struct nvc0_fence_priv *priv = nv_engine(dev, engine);
853 + int i;
854 +
855 + if (suspend) {
856 + priv->suspend = vmalloc(pfifo->channels * sizeof(u32));
857 + if (!priv->suspend)
858 + return -ENOMEM;
859 +
860 + for (i = 0; i < pfifo->channels; i++)
861 + priv->suspend[i] = nouveau_bo_rd32(priv->bo, i);
862 + }
863 +
864 return 0;
865 }
866
867 static int
868 nvc0_fence_init(struct drm_device *dev, int engine)
869 {
870 + struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
871 + struct nvc0_fence_priv *priv = nv_engine(dev, engine);
872 + int i;
873 +
874 + if (priv->suspend) {
875 + for (i = 0; i < pfifo->channels; i++)
876 + nouveau_bo_wr32(priv->bo, i, priv->suspend[i]);
877 + vfree(priv->suspend);
878 + priv->suspend = NULL;
879 + }
880 +
881 return 0;
882 }
883
884 diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
885 index e44a62a..d883b20 100644
886 --- a/drivers/gpu/drm/radeon/evergreen_cs.c
887 +++ b/drivers/gpu/drm/radeon/evergreen_cs.c
888 @@ -846,6 +846,16 @@ static int evergreen_cs_track_validate_texture(struct radeon_cs_parser *p,
889 return -EINVAL;
890 }
891
892 + if (!mipmap) {
893 + if (llevel) {
894 + dev_warn(p->dev, "%s:%i got NULL MIP_ADDRESS relocation\n",
895 + __func__, __LINE__);
896 + return -EINVAL;
897 + } else {
898 + return 0; /* everything's ok */
899 + }
900 + }
901 +
902 /* check mipmap size */
903 for (i = 1; i <= llevel; i++) {
904 unsigned w, h, d;
905 @@ -1081,6 +1091,27 @@ static int evergreen_cs_packet_next_reloc(struct radeon_cs_parser *p,
906 }
907
908 /**
909 + * evergreen_cs_packet_next_is_pkt3_nop() - test if the next packet is NOP
910 + * @p: structure holding the parser context.
911 + *
912 + * Check if the next packet is a relocation packet3.
913 + **/
914 +static bool evergreen_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
915 +{
916 + struct radeon_cs_packet p3reloc;
917 + int r;
918 +
919 + r = evergreen_cs_packet_parse(p, &p3reloc, p->idx);
920 + if (r) {
921 + return false;
922 + }
923 + if (p3reloc.type != PACKET_TYPE3 || p3reloc.opcode != PACKET3_NOP) {
924 + return false;
925 + }
926 + return true;
927 +}
928 +
929 +/**
930 * evergreen_cs_packet_next_vline() - parse userspace VLINE packet
931 * @parser: parser structure holding parsing context.
932 *
933 @@ -2330,7 +2361,7 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
934 for (i = 0; i < (pkt->count / 8); i++) {
935 struct radeon_bo *texture, *mipmap;
936 u32 toffset, moffset;
937 - u32 size, offset;
938 + u32 size, offset, mip_address, tex_dim;
939
940 switch (G__SQ_CONSTANT_TYPE(radeon_get_ib_value(p, idx+1+(i*8)+7))) {
941 case SQ_TEX_VTX_VALID_TEXTURE:
942 @@ -2359,14 +2390,28 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
943 }
944 texture = reloc->robj;
945 toffset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
946 +
947 /* tex mip base */
948 - r = evergreen_cs_packet_next_reloc(p, &reloc);
949 - if (r) {
950 - DRM_ERROR("bad SET_RESOURCE (tex)\n");
951 - return -EINVAL;
952 + tex_dim = ib[idx+1+(i*8)+0] & 0x7;
953 + mip_address = ib[idx+1+(i*8)+3];
954 +
955 + if ((tex_dim == SQ_TEX_DIM_2D_MSAA || tex_dim == SQ_TEX_DIM_2D_ARRAY_MSAA) &&
956 + !mip_address &&
957 + !evergreen_cs_packet_next_is_pkt3_nop(p)) {
958 + /* MIP_ADDRESS should point to FMASK for an MSAA texture.
959 + * It should be 0 if FMASK is disabled. */
960 + moffset = 0;
961 + mipmap = NULL;
962 + } else {
963 + r = evergreen_cs_packet_next_reloc(p, &reloc);
964 + if (r) {
965 + DRM_ERROR("bad SET_RESOURCE (tex)\n");
966 + return -EINVAL;
967 + }
968 + moffset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
969 + mipmap = reloc->robj;
970 }
971 - moffset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
972 - mipmap = reloc->robj;
973 +
974 r = evergreen_cs_track_validate_texture(p, texture, mipmap, idx+1+(i*8));
975 if (r)
976 return r;
977 diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
978 index f37676d..dfa2448 100644
979 --- a/drivers/gpu/drm/radeon/r600_cs.c
980 +++ b/drivers/gpu/drm/radeon/r600_cs.c
981 @@ -2180,7 +2180,8 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
982 }
983 break;
984 case PACKET3_STRMOUT_BASE_UPDATE:
985 - if (p->family < CHIP_RV770) {
986 + /* RS780 and RS880 also need this */
987 + if (p->family < CHIP_RS780) {
988 DRM_ERROR("STRMOUT_BASE_UPDATE only supported on 7xx\n");
989 return -EINVAL;
990 }
991 diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
992 index 8c593ea..27ece75 100644
993 --- a/drivers/gpu/drm/radeon/radeon_drv.c
994 +++ b/drivers/gpu/drm/radeon/radeon_drv.c
995 @@ -64,9 +64,11 @@
996 * 2.20.0 - r600-si: RADEON_INFO_TIMESTAMP query
997 * 2.21.0 - r600-r700: FMASK and CMASK
998 * 2.22.0 - r600 only: RESOLVE_BOX allowed
999 + * 2.23.0 - allow STRMOUT_BASE_UPDATE on RS780 and RS880
1000 + * 2.24.0 - eg only: allow MIP_ADDRESS=0 for MSAA textures
1001 */
1002 #define KMS_DRIVER_MAJOR 2
1003 -#define KMS_DRIVER_MINOR 22
1004 +#define KMS_DRIVER_MINOR 24
1005 #define KMS_DRIVER_PATCHLEVEL 0
1006 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
1007 int radeon_driver_unload_kms(struct drm_device *dev);
1008 diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
1009 index afaa172..443bd49 100644
1010 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
1011 +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
1012 @@ -204,6 +204,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
1013 (rdev->pdev->subsystem_device == 0x01fd))
1014 return true;
1015
1016 + /* Gateway RS690 only seems to work with MSIs. */
1017 + if ((rdev->pdev->device == 0x791f) &&
1018 + (rdev->pdev->subsystem_vendor == 0x107b) &&
1019 + (rdev->pdev->subsystem_device == 0x0185))
1020 + return true;
1021 +
1022 + /* try and enable MSIs by default on all RS690s */
1023 + if (rdev->family == CHIP_RS690)
1024 + return true;
1025 +
1026 /* RV515 seems to have MSI issues where it loses
1027 * MSI rearms occasionally. This leads to lockups and freezes.
1028 * disable it by default.
1029 diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
1030 index 7ae6066..395d7e0 100644
1031 --- a/drivers/gpu/drm/radeon/radeon_pm.c
1032 +++ b/drivers/gpu/drm/radeon/radeon_pm.c
1033 @@ -547,7 +547,9 @@ void radeon_pm_suspend(struct radeon_device *rdev)
1034 void radeon_pm_resume(struct radeon_device *rdev)
1035 {
1036 /* set up the default clocks if the MC ucode is loaded */
1037 - if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) {
1038 + if ((rdev->family >= CHIP_BARTS) &&
1039 + (rdev->family <= CHIP_CAYMAN) &&
1040 + rdev->mc_fw) {
1041 if (rdev->pm.default_vddc)
1042 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
1043 SET_VOLTAGE_TYPE_ASIC_VDDC);
1044 @@ -602,7 +604,9 @@ int radeon_pm_init(struct radeon_device *rdev)
1045 radeon_pm_print_states(rdev);
1046 radeon_pm_init_profile(rdev);
1047 /* set up the default clocks if the MC ucode is loaded */
1048 - if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) {
1049 + if ((rdev->family >= CHIP_BARTS) &&
1050 + (rdev->family <= CHIP_CAYMAN) &&
1051 + rdev->mc_fw) {
1052 if (rdev->pm.default_vddc)
1053 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
1054 SET_VOLTAGE_TYPE_ASIC_VDDC);
1055 diff --git a/drivers/gpu/drm/savage/savage_bci.c b/drivers/gpu/drm/savage/savage_bci.c
1056 index 1efbb90..c89aef4 100644
1057 --- a/drivers/gpu/drm/savage/savage_bci.c
1058 +++ b/drivers/gpu/drm/savage/savage_bci.c
1059 @@ -547,6 +547,8 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)
1060
1061 dev_priv->chipset = (enum savage_family)chipset;
1062
1063 + pci_set_master(dev->pdev);
1064 +
1065 return 0;
1066 }
1067
1068 diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
1069 index 3b6f7bf..c46c5f1 100644
1070 --- a/drivers/hid/hidraw.c
1071 +++ b/drivers/hid/hidraw.c
1072 @@ -42,6 +42,7 @@ static struct cdev hidraw_cdev;
1073 static struct class *hidraw_class;
1074 static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];
1075 static DEFINE_MUTEX(minors_lock);
1076 +static void drop_ref(struct hidraw *hid, int exists_bit);
1077
1078 static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
1079 {
1080 @@ -113,7 +114,7 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
1081 __u8 *buf;
1082 int ret = 0;
1083
1084 - if (!hidraw_table[minor]) {
1085 + if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
1086 ret = -ENODEV;
1087 goto out;
1088 }
1089 @@ -261,7 +262,7 @@ static int hidraw_open(struct inode *inode, struct file *file)
1090 }
1091
1092 mutex_lock(&minors_lock);
1093 - if (!hidraw_table[minor]) {
1094 + if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
1095 err = -ENODEV;
1096 goto out_unlock;
1097 }
1098 @@ -298,36 +299,12 @@ out:
1099 static int hidraw_release(struct inode * inode, struct file * file)
1100 {
1101 unsigned int minor = iminor(inode);
1102 - struct hidraw *dev;
1103 struct hidraw_list *list = file->private_data;
1104 - int ret;
1105 - int i;
1106 -
1107 - mutex_lock(&minors_lock);
1108 - if (!hidraw_table[minor]) {
1109 - ret = -ENODEV;
1110 - goto unlock;
1111 - }
1112
1113 + drop_ref(hidraw_table[minor], 0);
1114 list_del(&list->node);
1115 - dev = hidraw_table[minor];
1116 - if (!--dev->open) {
1117 - if (list->hidraw->exist) {
1118 - hid_hw_power(dev->hid, PM_HINT_NORMAL);
1119 - hid_hw_close(dev->hid);
1120 - } else {
1121 - kfree(list->hidraw);
1122 - }
1123 - }
1124 -
1125 - for (i = 0; i < HIDRAW_BUFFER_SIZE; ++i)
1126 - kfree(list->buffer[i].value);
1127 kfree(list);
1128 - ret = 0;
1129 -unlock:
1130 - mutex_unlock(&minors_lock);
1131 -
1132 - return ret;
1133 + return 0;
1134 }
1135
1136 static long hidraw_ioctl(struct file *file, unsigned int cmd,
1137 @@ -529,21 +506,7 @@ EXPORT_SYMBOL_GPL(hidraw_connect);
1138 void hidraw_disconnect(struct hid_device *hid)
1139 {
1140 struct hidraw *hidraw = hid->hidraw;
1141 -
1142 - mutex_lock(&minors_lock);
1143 - hidraw->exist = 0;
1144 -
1145 - device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
1146 -
1147 - hidraw_table[hidraw->minor] = NULL;
1148 -
1149 - if (hidraw->open) {
1150 - hid_hw_close(hid);
1151 - wake_up_interruptible(&hidraw->wait);
1152 - } else {
1153 - kfree(hidraw);
1154 - }
1155 - mutex_unlock(&minors_lock);
1156 + drop_ref(hidraw, 1);
1157 }
1158 EXPORT_SYMBOL_GPL(hidraw_disconnect);
1159
1160 @@ -585,3 +548,23 @@ void hidraw_exit(void)
1161 unregister_chrdev_region(dev_id, HIDRAW_MAX_DEVICES);
1162
1163 }
1164 +
1165 +static void drop_ref(struct hidraw *hidraw, int exists_bit)
1166 +{
1167 + mutex_lock(&minors_lock);
1168 + if (exists_bit) {
1169 + hid_hw_close(hidraw->hid);
1170 + hidraw->exist = 0;
1171 + if (hidraw->open)
1172 + wake_up_interruptible(&hidraw->wait);
1173 + } else {
1174 + --hidraw->open;
1175 + }
1176 +
1177 + if (!hidraw->open && !hidraw->exist) {
1178 + device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
1179 + hidraw_table[hidraw->minor] = NULL;
1180 + kfree(hidraw);
1181 + }
1182 + mutex_unlock(&minors_lock);
1183 +}
1184 diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
1185 index ef511df..8bbd6ec 100644
1186 --- a/drivers/i2c/busses/i2c-piix4.c
1187 +++ b/drivers/i2c/busses/i2c-piix4.c
1188 @@ -37,6 +37,7 @@
1189 #include <linux/stddef.h>
1190 #include <linux/ioport.h>
1191 #include <linux/i2c.h>
1192 +#include <linux/slab.h>
1193 #include <linux/init.h>
1194 #include <linux/dmi.h>
1195 #include <linux/acpi.h>
1196 diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
1197 index 2297ec1..cb9e114 100644
1198 --- a/drivers/iommu/intel-iommu.c
1199 +++ b/drivers/iommu/intel-iommu.c
1200 @@ -589,7 +589,9 @@ static void domain_update_iommu_coherency(struct dmar_domain *domain)
1201 {
1202 int i;
1203
1204 - domain->iommu_coherency = 1;
1205 + i = find_first_bit(domain->iommu_bmp, g_num_of_iommus);
1206 +
1207 + domain->iommu_coherency = i < g_num_of_iommus ? 1 : 0;
1208
1209 for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus) {
1210 if (!ecap_coherent(g_iommus[i]->ecap)) {
1211 diff --git a/drivers/media/dvb/frontends/drxk.h b/drivers/media/dvb/frontends/drxk.h
1212 index d615d7d..94fecfb 100644
1213 --- a/drivers/media/dvb/frontends/drxk.h
1214 +++ b/drivers/media/dvb/frontends/drxk.h
1215 @@ -28,6 +28,7 @@
1216 * A value of 0 (default) or lower indicates that
1217 * the correct number of parameters will be
1218 * automatically detected.
1219 + * @load_firmware_sync: Force the firmware load to be synchronous.
1220 *
1221 * On the *_gpio vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
1222 * UIO-3.
1223 @@ -39,6 +40,7 @@ struct drxk_config {
1224 bool parallel_ts;
1225 bool dynamic_clk;
1226 bool enable_merr_cfg;
1227 + bool load_firmware_sync;
1228
1229 bool antenna_dvbt;
1230 u16 antenna_gpio;
1231 diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
1232 index 1ab8154..8b4c6d5 100644
1233 --- a/drivers/media/dvb/frontends/drxk_hard.c
1234 +++ b/drivers/media/dvb/frontends/drxk_hard.c
1235 @@ -6609,15 +6609,25 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config,
1236
1237 /* Load firmware and initialize DRX-K */
1238 if (state->microcode_name) {
1239 - status = request_firmware_nowait(THIS_MODULE, 1,
1240 + if (config->load_firmware_sync) {
1241 + const struct firmware *fw = NULL;
1242 +
1243 + status = request_firmware(&fw, state->microcode_name,
1244 + state->i2c->dev.parent);
1245 + if (status < 0)
1246 + fw = NULL;
1247 + load_firmware_cb(fw, state);
1248 + } else {
1249 + status = request_firmware_nowait(THIS_MODULE, 1,
1250 state->microcode_name,
1251 state->i2c->dev.parent,
1252 GFP_KERNEL,
1253 state, load_firmware_cb);
1254 - if (status < 0) {
1255 - printk(KERN_ERR
1256 - "drxk: failed to request a firmware\n");
1257 - return NULL;
1258 + if (status < 0) {
1259 + printk(KERN_ERR
1260 + "drxk: failed to request a firmware\n");
1261 + return NULL;
1262 + }
1263 }
1264 } else if (init_drxk(state) < 0)
1265 goto error;
1266 diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
1267 index 36fe5a3..24c77a4 100644
1268 --- a/drivers/media/rc/ite-cir.c
1269 +++ b/drivers/media/rc/ite-cir.c
1270 @@ -1473,6 +1473,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1271 rdev = rc_allocate_device();
1272 if (!rdev)
1273 goto failure;
1274 + itdev->rdev = rdev;
1275
1276 ret = -ENODEV;
1277
1278 @@ -1604,7 +1605,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1279 if (ret)
1280 goto failure3;
1281
1282 - itdev->rdev = rdev;
1283 ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
1284
1285 return 0;
1286 diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
1287 index ca62b99..ab98d08 100644
1288 --- a/drivers/media/video/em28xx/em28xx-cards.c
1289 +++ b/drivers/media/video/em28xx/em28xx-cards.c
1290 @@ -2875,12 +2875,20 @@ static void em28xx_card_setup(struct em28xx *dev)
1291 }
1292
1293
1294 -#if defined(CONFIG_MODULES) && defined(MODULE)
1295 static void request_module_async(struct work_struct *work)
1296 {
1297 struct em28xx *dev = container_of(work,
1298 struct em28xx, request_module_wk);
1299
1300 + /*
1301 + * The em28xx extensions can be modules or builtin. If the
1302 + * modules are already loaded or are built in, those extensions
1303 + * can be initialised right now. Otherwise, the module init
1304 + * code will do it.
1305 + */
1306 + em28xx_init_extension(dev);
1307 +
1308 +#if defined(CONFIG_MODULES) && defined(MODULE)
1309 if (dev->has_audio_class)
1310 request_module("snd-usb-audio");
1311 else if (dev->has_alsa_audio)
1312 @@ -2890,6 +2898,7 @@ static void request_module_async(struct work_struct *work)
1313 request_module("em28xx-dvb");
1314 if (dev->board.ir_codes && !disable_ir)
1315 request_module("em28xx-rc");
1316 +#endif /* CONFIG_MODULES */
1317 }
1318
1319 static void request_modules(struct em28xx *dev)
1320 @@ -2902,10 +2911,6 @@ static void flush_request_modules(struct em28xx *dev)
1321 {
1322 flush_work_sync(&dev->request_module_wk);
1323 }
1324 -#else
1325 -#define request_modules(dev)
1326 -#define flush_request_modules(dev)
1327 -#endif /* CONFIG_MODULES */
1328
1329 /*
1330 * em28xx_release_resources()
1331 @@ -3324,13 +3329,6 @@ static int em28xx_usb_probe(struct usb_interface *interface,
1332 */
1333 mutex_unlock(&dev->lock);
1334
1335 - /*
1336 - * These extensions can be modules. If the modules are already
1337 - * loaded then we can initialise the device now, otherwise we
1338 - * will initialise it when the modules load instead.
1339 - */
1340 - em28xx_init_extension(dev);
1341 -
1342 return 0;
1343
1344 unlock_and_free:
1345 diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
1346 index a16531f..7353143 100644
1347 --- a/drivers/media/video/em28xx/em28xx-dvb.c
1348 +++ b/drivers/media/video/em28xx/em28xx-dvb.c
1349 @@ -316,6 +316,7 @@ static struct drxk_config terratec_h5_drxk = {
1350 .no_i2c_bridge = 1,
1351 .microcode_name = "dvb-usb-terratec-h5-drxk.fw",
1352 .qam_demod_parameter_count = 2,
1353 + .load_firmware_sync = true,
1354 };
1355
1356 static struct drxk_config hauppauge_930c_drxk = {
1357 @@ -325,6 +326,7 @@ static struct drxk_config hauppauge_930c_drxk = {
1358 .microcode_name = "dvb-usb-hauppauge-hvr930c-drxk.fw",
1359 .chunk_size = 56,
1360 .qam_demod_parameter_count = 2,
1361 + .load_firmware_sync = true,
1362 };
1363
1364 struct drxk_config terratec_htc_stick_drxk = {
1365 @@ -338,12 +340,14 @@ struct drxk_config terratec_htc_stick_drxk = {
1366 .antenna_dvbt = true,
1367 /* The windows driver uses the same. This will disable LNA. */
1368 .antenna_gpio = 0x6,
1369 + .load_firmware_sync = true,
1370 };
1371
1372 static struct drxk_config maxmedia_ub425_tc_drxk = {
1373 .adr = 0x29,
1374 .single_master = 1,
1375 .no_i2c_bridge = 1,
1376 + .load_firmware_sync = true,
1377 };
1378
1379 static struct drxk_config pctv_520e_drxk = {
1380 @@ -354,6 +358,7 @@ static struct drxk_config pctv_520e_drxk = {
1381 .chunk_size = 58,
1382 .antenna_dvbt = true, /* disable LNA */
1383 .antenna_gpio = (1 << 2), /* disable LNA */
1384 + .load_firmware_sync = true,
1385 };
1386
1387 static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
1388 diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c
1389 index 4877f7a..eb3c90e4 100644
1390 --- a/drivers/media/video/gspca/pac7302.c
1391 +++ b/drivers/media/video/gspca/pac7302.c
1392 @@ -616,7 +616,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
1393 sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1394 V4L2_CID_RED_BALANCE, 0, 3, 1, 1);
1395 sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1396 - V4L2_CID_RED_BALANCE, 0, 3, 1, 1);
1397 + V4L2_CID_BLUE_BALANCE, 0, 3, 1, 1);
1398
1399 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
1400 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
1401 @@ -905,6 +905,7 @@ static const struct usb_device_id device_table[] = {
1402 {USB_DEVICE(0x093a, 0x262a)},
1403 {USB_DEVICE(0x093a, 0x262c)},
1404 {USB_DEVICE(0x145f, 0x013c)},
1405 + {USB_DEVICE(0x1ae7, 0x2001)}, /* SpeedLink Snappy Mic SL-6825-SBK */
1406 {}
1407 };
1408 MODULE_DEVICE_TABLE(usb, device_table);
1409 diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
1410 index b73f033..81ba655 100644
1411 --- a/drivers/mfd/88pm860x-core.c
1412 +++ b/drivers/mfd/88pm860x-core.c
1413 @@ -21,40 +21,73 @@
1414
1415 #define INT_STATUS_NUM 3
1416
1417 +static struct resource io_parent = {
1418 + .start = 0,
1419 + .end = 0xffffffff,
1420 + .flags = IORESOURCE_IO,
1421 +};
1422 +
1423 static struct resource bk_resources[] __devinitdata = {
1424 - {PM8606_BACKLIGHT1, PM8606_BACKLIGHT1, "backlight-0", IORESOURCE_IO,},
1425 - {PM8606_BACKLIGHT2, PM8606_BACKLIGHT2, "backlight-1", IORESOURCE_IO,},
1426 - {PM8606_BACKLIGHT3, PM8606_BACKLIGHT3, "backlight-2", IORESOURCE_IO,},
1427 + {PM8606_BACKLIGHT1, PM8606_BACKLIGHT1, "backlight-0", IORESOURCE_IO,
1428 + &io_parent,},
1429 + {PM8606_BACKLIGHT2, PM8606_BACKLIGHT2, "backlight-1", IORESOURCE_IO,
1430 + &io_parent,},
1431 + {PM8606_BACKLIGHT3, PM8606_BACKLIGHT3, "backlight-2", IORESOURCE_IO,
1432 + &io_parent,},
1433 };
1434
1435 static struct resource led_resources[] __devinitdata = {
1436 - {PM8606_LED1_RED, PM8606_LED1_RED, "led0-red", IORESOURCE_IO,},
1437 - {PM8606_LED1_GREEN, PM8606_LED1_GREEN, "led0-green", IORESOURCE_IO,},
1438 - {PM8606_LED1_BLUE, PM8606_LED1_BLUE, "led0-blue", IORESOURCE_IO,},
1439 - {PM8606_LED2_RED, PM8606_LED2_RED, "led1-red", IORESOURCE_IO,},
1440 - {PM8606_LED2_GREEN, PM8606_LED2_GREEN, "led1-green", IORESOURCE_IO,},
1441 - {PM8606_LED2_BLUE, PM8606_LED2_BLUE, "led1-blue", IORESOURCE_IO,},
1442 + {PM8606_LED1_RED, PM8606_LED1_RED, "led0-red", IORESOURCE_IO,
1443 + &io_parent,},
1444 + {PM8606_LED1_GREEN, PM8606_LED1_GREEN, "led0-green", IORESOURCE_IO,
1445 + &io_parent,},
1446 + {PM8606_LED1_BLUE, PM8606_LED1_BLUE, "led0-blue", IORESOURCE_IO,
1447 + &io_parent,},
1448 + {PM8606_LED2_RED, PM8606_LED2_RED, "led1-red", IORESOURCE_IO,
1449 + &io_parent,},
1450 + {PM8606_LED2_GREEN, PM8606_LED2_GREEN, "led1-green", IORESOURCE_IO,
1451 + &io_parent,},
1452 + {PM8606_LED2_BLUE, PM8606_LED2_BLUE, "led1-blue", IORESOURCE_IO,
1453 + &io_parent,},
1454 };
1455
1456 static struct resource regulator_resources[] __devinitdata = {
1457 - {PM8607_ID_BUCK1, PM8607_ID_BUCK1, "buck-1", IORESOURCE_IO,},
1458 - {PM8607_ID_BUCK2, PM8607_ID_BUCK2, "buck-2", IORESOURCE_IO,},
1459 - {PM8607_ID_BUCK3, PM8607_ID_BUCK3, "buck-3", IORESOURCE_IO,},
1460 - {PM8607_ID_LDO1, PM8607_ID_LDO1, "ldo-01", IORESOURCE_IO,},
1461 - {PM8607_ID_LDO2, PM8607_ID_LDO2, "ldo-02", IORESOURCE_IO,},
1462 - {PM8607_ID_LDO3, PM8607_ID_LDO3, "ldo-03", IORESOURCE_IO,},
1463 - {PM8607_ID_LDO4, PM8607_ID_LDO4, "ldo-04", IORESOURCE_IO,},
1464 - {PM8607_ID_LDO5, PM8607_ID_LDO5, "ldo-05", IORESOURCE_IO,},
1465 - {PM8607_ID_LDO6, PM8607_ID_LDO6, "ldo-06", IORESOURCE_IO,},
1466 - {PM8607_ID_LDO7, PM8607_ID_LDO7, "ldo-07", IORESOURCE_IO,},
1467 - {PM8607_ID_LDO8, PM8607_ID_LDO8, "ldo-08", IORESOURCE_IO,},
1468 - {PM8607_ID_LDO9, PM8607_ID_LDO9, "ldo-09", IORESOURCE_IO,},
1469 - {PM8607_ID_LDO10, PM8607_ID_LDO10, "ldo-10", IORESOURCE_IO,},
1470 - {PM8607_ID_LDO11, PM8607_ID_LDO11, "ldo-11", IORESOURCE_IO,},
1471 - {PM8607_ID_LDO12, PM8607_ID_LDO12, "ldo-12", IORESOURCE_IO,},
1472 - {PM8607_ID_LDO13, PM8607_ID_LDO13, "ldo-13", IORESOURCE_IO,},
1473 - {PM8607_ID_LDO14, PM8607_ID_LDO14, "ldo-14", IORESOURCE_IO,},
1474 - {PM8607_ID_LDO15, PM8607_ID_LDO15, "ldo-15", IORESOURCE_IO,},
1475 + {PM8607_ID_BUCK1, PM8607_ID_BUCK1, "buck-1", IORESOURCE_IO,
1476 + &io_parent,},
1477 + {PM8607_ID_BUCK2, PM8607_ID_BUCK2, "buck-2", IORESOURCE_IO,
1478 + &io_parent,},
1479 + {PM8607_ID_BUCK3, PM8607_ID_BUCK3, "buck-3", IORESOURCE_IO,
1480 + &io_parent,},
1481 + {PM8607_ID_LDO1, PM8607_ID_LDO1, "ldo-01", IORESOURCE_IO,
1482 + &io_parent,},
1483 + {PM8607_ID_LDO2, PM8607_ID_LDO2, "ldo-02", IORESOURCE_IO,
1484 + &io_parent,},
1485 + {PM8607_ID_LDO3, PM8607_ID_LDO3, "ldo-03", IORESOURCE_IO,
1486 + &io_parent,},
1487 + {PM8607_ID_LDO4, PM8607_ID_LDO4, "ldo-04", IORESOURCE_IO,
1488 + &io_parent,},
1489 + {PM8607_ID_LDO5, PM8607_ID_LDO5, "ldo-05", IORESOURCE_IO,
1490 + &io_parent,},
1491 + {PM8607_ID_LDO6, PM8607_ID_LDO6, "ldo-06", IORESOURCE_IO,
1492 + &io_parent,},
1493 + {PM8607_ID_LDO7, PM8607_ID_LDO7, "ldo-07", IORESOURCE_IO,
1494 + &io_parent,},
1495 + {PM8607_ID_LDO8, PM8607_ID_LDO8, "ldo-08", IORESOURCE_IO,
1496 + &io_parent,},
1497 + {PM8607_ID_LDO9, PM8607_ID_LDO9, "ldo-09", IORESOURCE_IO,
1498 + &io_parent,},
1499 + {PM8607_ID_LDO10, PM8607_ID_LDO10, "ldo-10", IORESOURCE_IO,
1500 + &io_parent,},
1501 + {PM8607_ID_LDO11, PM8607_ID_LDO11, "ldo-11", IORESOURCE_IO,
1502 + &io_parent,},
1503 + {PM8607_ID_LDO12, PM8607_ID_LDO12, "ldo-12", IORESOURCE_IO,
1504 + &io_parent,},
1505 + {PM8607_ID_LDO13, PM8607_ID_LDO13, "ldo-13", IORESOURCE_IO,
1506 + &io_parent,},
1507 + {PM8607_ID_LDO14, PM8607_ID_LDO14, "ldo-14", IORESOURCE_IO,
1508 + &io_parent,},
1509 + {PM8607_ID_LDO15, PM8607_ID_LDO15, "ldo-15", IORESOURCE_IO,
1510 + &io_parent,},
1511 };
1512
1513 static struct resource touch_resources[] __devinitdata = {
1514 @@ -91,11 +124,12 @@ static struct resource charger_resources[] __devinitdata = {
1515 };
1516
1517 static struct resource preg_resources[] __devinitdata = {
1518 - {PM8606_ID_PREG, PM8606_ID_PREG, "preg", IORESOURCE_IO,},
1519 + {PM8606_ID_PREG, PM8606_ID_PREG, "preg", IORESOURCE_IO,
1520 + &io_parent,},
1521 };
1522
1523 static struct resource rtc_resources[] __devinitdata = {
1524 - {PM8607_IRQ_RTC, PM8607_IRQ_RTC, "rtc", IORESOURCE_IRQ,},
1525 + {PM8607_IRQ_RTC, PM8607_IRQ_RTC, "rtc", IORESOURCE_IRQ, &io_parent,},
1526 };
1527
1528 static struct mfd_cell bk_devs[] = {
1529 diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c
1530 index ee53757..66d08a7 100644
1531 --- a/drivers/mfd/max8925-core.c
1532 +++ b/drivers/mfd/max8925-core.c
1533 @@ -18,12 +18,19 @@
1534 #include <linux/mfd/core.h>
1535 #include <linux/mfd/max8925.h>
1536
1537 +static struct resource io_parent = {
1538 + .start = 0,
1539 + .end = 0xffffffff,
1540 + .flags = IORESOURCE_IO,
1541 +};
1542 +
1543 static struct resource backlight_resources[] = {
1544 {
1545 .name = "max8925-backlight",
1546 .start = MAX8925_WLED_MODE_CNTL,
1547 .end = MAX8925_WLED_CNTL,
1548 .flags = IORESOURCE_IO,
1549 + .parent = &io_parent,
1550 },
1551 };
1552
1553 @@ -42,6 +49,7 @@ static struct resource touch_resources[] = {
1554 .start = MAX8925_TSC_IRQ,
1555 .end = MAX8925_ADC_RES_END,
1556 .flags = IORESOURCE_IO,
1557 + .parent = &io_parent,
1558 },
1559 };
1560
1561 @@ -60,6 +68,7 @@ static struct resource power_supply_resources[] = {
1562 .start = MAX8925_CHG_IRQ1,
1563 .end = MAX8925_CHG_IRQ1_MASK,
1564 .flags = IORESOURCE_IO,
1565 + .parent = &io_parent,
1566 },
1567 };
1568
1569 @@ -118,6 +127,7 @@ static struct mfd_cell onkey_devs[] = {
1570 .start = MAX8925_##_start, \
1571 .end = MAX8925_##_end, \
1572 .flags = IORESOURCE_IO, \
1573 + .parent = &io_parent, \
1574 }
1575
1576 static struct resource regulator_resources[] = {
1577 diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
1578 index 0582429..08c6b3d 100644
1579 --- a/drivers/mmc/core/slot-gpio.c
1580 +++ b/drivers/mmc/core/slot-gpio.c
1581 @@ -100,7 +100,13 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio)
1582
1583 ctx = host->slot.handler_priv;
1584
1585 - return gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label);
1586 + ret = gpio_request_one(gpio, GPIOF_DIR_IN, ctx->ro_label);
1587 + if (ret < 0)
1588 + return ret;
1589 +
1590 + ctx->ro_gpio = gpio;
1591 +
1592 + return 0;
1593 }
1594 EXPORT_SYMBOL(mmc_gpio_request_ro);
1595
1596 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
1597 index 3a09f93..ed4945c 100644
1598 --- a/drivers/mmc/host/omap_hsmmc.c
1599 +++ b/drivers/mmc/host/omap_hsmmc.c
1600 @@ -2106,8 +2106,7 @@ static int omap_hsmmc_suspend(struct device *dev)
1601 if (ret) {
1602 host->suspended = 0;
1603 if (host->pdata->resume) {
1604 - ret = host->pdata->resume(dev, host->slot_id);
1605 - if (ret)
1606 + if (host->pdata->resume(dev, host->slot_id))
1607 dev_dbg(dev, "Unmask interrupt failed\n");
1608 }
1609 goto err;
1610 diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
1611 index 5d81427..ba0e493 100644
1612 --- a/drivers/mmc/host/sh_mmcif.c
1613 +++ b/drivers/mmc/host/sh_mmcif.c
1614 @@ -1229,6 +1229,10 @@ static irqreturn_t sh_mmcif_intr(int irq, void *dev_id)
1615 host->sd_error = true;
1616 dev_dbg(&host->pd->dev, "int err state = %08x\n", state);
1617 }
1618 + if (host->state == STATE_IDLE) {
1619 + dev_info(&host->pd->dev, "Spurious IRQ status 0x%x", state);
1620 + return IRQ_HANDLED;
1621 + }
1622 if (state & ~(INT_CMD12RBE | INT_CMD12CRE)) {
1623 if (!host->dma_active)
1624 return IRQ_WAKE_THREAD;
1625 diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c
1626 index e5bfd0e..0598d52 100644
1627 --- a/drivers/mtd/maps/autcpu12-nvram.c
1628 +++ b/drivers/mtd/maps/autcpu12-nvram.c
1629 @@ -43,7 +43,8 @@ struct map_info autcpu12_sram_map = {
1630
1631 static int __init init_autcpu12_sram (void)
1632 {
1633 - int err, save0, save1;
1634 + map_word tmp, save0, save1;
1635 + int err;
1636
1637 autcpu12_sram_map.virt = ioremap(0x12000000, SZ_128K);
1638 if (!autcpu12_sram_map.virt) {
1639 @@ -51,7 +52,7 @@ static int __init init_autcpu12_sram (void)
1640 err = -EIO;
1641 goto out;
1642 }
1643 - simple_map_init(&autcpu_sram_map);
1644 + simple_map_init(&autcpu12_sram_map);
1645
1646 /*
1647 * Check for 32K/128K
1648 @@ -61,20 +62,22 @@ static int __init init_autcpu12_sram (void)
1649 * Read and check result on ofs 0x0
1650 * Restore contents
1651 */
1652 - save0 = map_read32(&autcpu12_sram_map,0);
1653 - save1 = map_read32(&autcpu12_sram_map,0x10000);
1654 - map_write32(&autcpu12_sram_map,~save0,0x10000);
1655 + save0 = map_read(&autcpu12_sram_map, 0);
1656 + save1 = map_read(&autcpu12_sram_map, 0x10000);
1657 + tmp.x[0] = ~save0.x[0];
1658 + map_write(&autcpu12_sram_map, tmp, 0x10000);
1659 /* if we find this pattern on 0x0, we have 32K size
1660 * restore contents and exit
1661 */
1662 - if ( map_read32(&autcpu12_sram_map,0) != save0) {
1663 - map_write32(&autcpu12_sram_map,save0,0x0);
1664 + tmp = map_read(&autcpu12_sram_map, 0);
1665 + if (!map_word_equal(&autcpu12_sram_map, tmp, save0)) {
1666 + map_write(&autcpu12_sram_map, save0, 0x0);
1667 goto map;
1668 }
1669 /* We have a 128K found, restore 0x10000 and set size
1670 * to 128K
1671 */
1672 - map_write32(&autcpu12_sram_map,save1,0x10000);
1673 + map_write(&autcpu12_sram_map, save1, 0x10000);
1674 autcpu12_sram_map.size = SZ_128K;
1675
1676 map:
1677 diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
1678 index d518e4d..f8c08ec 100644
1679 --- a/drivers/mtd/mtdpart.c
1680 +++ b/drivers/mtd/mtdpart.c
1681 @@ -711,6 +711,8 @@ static const char *default_mtd_part_types[] = {
1682 * partition parsers, specified in @types. However, if @types is %NULL, then
1683 * the default list of parsers is used. The default list contains only the
1684 * "cmdlinepart" and "ofpart" parsers ATM.
1685 + * Note: If there are more then one parser in @types, the kernel only takes the
1686 + * partitions parsed out by the first parser.
1687 *
1688 * This function may return:
1689 * o a negative error code in case of failure
1690 @@ -735,11 +737,12 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
1691 if (!parser)
1692 continue;
1693 ret = (*parser->parse_fn)(master, pparts, data);
1694 + put_partition_parser(parser);
1695 if (ret > 0) {
1696 printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n",
1697 ret, parser->name, master->name);
1698 + break;
1699 }
1700 - put_partition_parser(parser);
1701 }
1702 return ret;
1703 }
1704 diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
1705 index 30d1319..c126469 100644
1706 --- a/drivers/mtd/nand/nand_bbt.c
1707 +++ b/drivers/mtd/nand/nand_bbt.c
1708 @@ -390,7 +390,7 @@ static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
1709 /* Read the mirror version, if available */
1710 if (md && (md->options & NAND_BBT_VERSION)) {
1711 scan_read_raw(mtd, buf, (loff_t)md->pages[0] << this->page_shift,
1712 - mtd->writesize, td);
1713 + mtd->writesize, md);
1714 md->version[0] = buf[bbt_get_ver_offs(mtd, md)];
1715 pr_info("Bad block table at page %d, version 0x%02X\n",
1716 md->pages[0], md->version[0]);
1717 diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
1718 index cf0cd31..5d881180 100644
1719 --- a/drivers/mtd/nand/nandsim.c
1720 +++ b/drivers/mtd/nand/nandsim.c
1721 @@ -2333,6 +2333,7 @@ static int __init ns_init_module(void)
1722 uint64_t new_size = (uint64_t)nsmtd->erasesize << overridesize;
1723 if (new_size >> overridesize != nsmtd->erasesize) {
1724 NS_ERR("overridesize is too big\n");
1725 + retval = -EINVAL;
1726 goto err_exit;
1727 }
1728 /* N.B. This relies on nand_scan not doing anything with the size before we change it */
1729 diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
1730 index ac4fd75..48f1d4e 100644
1731 --- a/drivers/mtd/nand/omap2.c
1732 +++ b/drivers/mtd/nand/omap2.c
1733 @@ -1387,7 +1387,8 @@ static int omap_nand_remove(struct platform_device *pdev)
1734 /* Release NAND device, its internal structures and partitions */
1735 nand_release(&info->mtd);
1736 iounmap(info->nand.IO_ADDR_R);
1737 - kfree(&info->mtd);
1738 + release_mem_region(info->phys_base, NAND_IO_SIZE);
1739 + kfree(info);
1740 return 0;
1741 }
1742
1743 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
1744 index 4104ea25..56b20d1 100644
1745 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
1746 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
1747 @@ -2690,10 +2690,7 @@ static int ixgbe_get_ts_info(struct net_device *dev,
1748 (1 << HWTSTAMP_FILTER_NONE) |
1749 (1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
1750 (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
1751 - (1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
1752 - (1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
1753 - (1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
1754 - (1 << HWTSTAMP_FILTER_SOME);
1755 + (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
1756 break;
1757 #endif /* CONFIG_IXGBE_PTP */
1758 default:
1759 diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
1760 index d15c888..4995673 100644
1761 --- a/drivers/net/ethernet/ti/davinci_cpdma.c
1762 +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
1763 @@ -863,6 +863,7 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
1764
1765 next_dma = desc_read(desc, hw_next);
1766 chan->head = desc_from_phys(pool, next_dma);
1767 + chan->count--;
1768 chan->stats.teardown_dequeue++;
1769
1770 /* issue callback without locks held */
1771 diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
1772 index 91d2588..1470d3e 100644
1773 --- a/drivers/net/rionet.c
1774 +++ b/drivers/net/rionet.c
1775 @@ -79,6 +79,7 @@ static int rionet_capable = 1;
1776 * on system trade-offs.
1777 */
1778 static struct rio_dev **rionet_active;
1779 +static int nact; /* total number of active rionet peers */
1780
1781 #define is_rionet_capable(src_ops, dst_ops) \
1782 ((src_ops & RIO_SRC_OPS_DATA_MSG) && \
1783 @@ -175,6 +176,7 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1784 struct ethhdr *eth = (struct ethhdr *)skb->data;
1785 u16 destid;
1786 unsigned long flags;
1787 + int add_num = 1;
1788
1789 local_irq_save(flags);
1790 if (!spin_trylock(&rnet->tx_lock)) {
1791 @@ -182,7 +184,10 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1792 return NETDEV_TX_LOCKED;
1793 }
1794
1795 - if ((rnet->tx_cnt + 1) > RIONET_TX_RING_SIZE) {
1796 + if (is_multicast_ether_addr(eth->h_dest))
1797 + add_num = nact;
1798 +
1799 + if ((rnet->tx_cnt + add_num) > RIONET_TX_RING_SIZE) {
1800 netif_stop_queue(ndev);
1801 spin_unlock_irqrestore(&rnet->tx_lock, flags);
1802 printk(KERN_ERR "%s: BUG! Tx Ring full when queue awake!\n",
1803 @@ -191,11 +196,16 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1804 }
1805
1806 if (is_multicast_ether_addr(eth->h_dest)) {
1807 + int count = 0;
1808 for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rnet->mport->sys_size);
1809 i++)
1810 - if (rionet_active[i])
1811 + if (rionet_active[i]) {
1812 rionet_queue_tx_msg(skb, ndev,
1813 rionet_active[i]);
1814 + if (count)
1815 + atomic_inc(&skb->users);
1816 + count++;
1817 + }
1818 } else if (RIONET_MAC_MATCH(eth->h_dest)) {
1819 destid = RIONET_GET_DESTID(eth->h_dest);
1820 if (rionet_active[destid])
1821 @@ -220,14 +230,17 @@ static void rionet_dbell_event(struct rio_mport *mport, void *dev_id, u16 sid, u
1822 if (info == RIONET_DOORBELL_JOIN) {
1823 if (!rionet_active[sid]) {
1824 list_for_each_entry(peer, &rionet_peers, node) {
1825 - if (peer->rdev->destid == sid)
1826 + if (peer->rdev->destid == sid) {
1827 rionet_active[sid] = peer->rdev;
1828 + nact++;
1829 + }
1830 }
1831 rio_mport_send_doorbell(mport, sid,
1832 RIONET_DOORBELL_JOIN);
1833 }
1834 } else if (info == RIONET_DOORBELL_LEAVE) {
1835 rionet_active[sid] = NULL;
1836 + nact--;
1837 } else {
1838 if (netif_msg_intr(rnet))
1839 printk(KERN_WARNING "%s: unhandled doorbell\n",
1840 @@ -523,6 +536,7 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id)
1841
1842 rc = rionet_setup_netdev(rdev->net->hport, ndev);
1843 rionet_check = 1;
1844 + nact = 0;
1845 }
1846
1847 /*
1848 diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
1849 index 32e31c5..f778aa0 100644
1850 --- a/drivers/net/usb/asix_devices.c
1851 +++ b/drivers/net/usb/asix_devices.c
1852 @@ -930,6 +930,10 @@ static const struct usb_device_id products [] = {
1853 USB_DEVICE (0x04f1, 0x3008),
1854 .driver_info = (unsigned long) &ax8817x_info,
1855 }, {
1856 + // Lenovo U2L100P 10/100
1857 + USB_DEVICE (0x17ef, 0x7203),
1858 + .driver_info = (unsigned long) &ax88772_info,
1859 +}, {
1860 // ASIX AX88772B 10/100
1861 USB_DEVICE (0x0b95, 0x772b),
1862 .driver_info = (unsigned long) &ax88772_info,
1863 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
1864 index 9f8a6b7..61859d0 100644
1865 --- a/drivers/pci/probe.c
1866 +++ b/drivers/pci/probe.c
1867 @@ -729,8 +729,10 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
1868
1869 /* Check if setup is sensible at all */
1870 if (!pass &&
1871 - (primary != bus->number || secondary <= bus->number)) {
1872 - dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n");
1873 + (primary != bus->number || secondary <= bus->number ||
1874 + secondary > subordinate)) {
1875 + dev_info(&dev->dev, "bridge configuration invalid ([bus %02x-%02x]), reconfiguring\n",
1876 + secondary, subordinate);
1877 broken = 1;
1878 }
1879
1880 diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
1881 index aff8621..f6adde4 100644
1882 --- a/drivers/s390/scsi/zfcp_aux.c
1883 +++ b/drivers/s390/scsi/zfcp_aux.c
1884 @@ -519,6 +519,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
1885
1886 rwlock_init(&port->unit_list_lock);
1887 INIT_LIST_HEAD(&port->unit_list);
1888 + atomic_set(&port->units, 0);
1889
1890 INIT_WORK(&port->gid_pn_work, zfcp_fc_port_did_lookup);
1891 INIT_WORK(&port->test_link_work, zfcp_fc_link_test_work);
1892 diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
1893 index e37f045..9646766 100644
1894 --- a/drivers/s390/scsi/zfcp_ccw.c
1895 +++ b/drivers/s390/scsi/zfcp_ccw.c
1896 @@ -39,17 +39,23 @@ void zfcp_ccw_adapter_put(struct zfcp_adapter *adapter)
1897 spin_unlock_irqrestore(&zfcp_ccw_adapter_ref_lock, flags);
1898 }
1899
1900 -static int zfcp_ccw_activate(struct ccw_device *cdev)
1901 -
1902 +/**
1903 + * zfcp_ccw_activate - activate adapter and wait for it to finish
1904 + * @cdev: pointer to belonging ccw device
1905 + * @clear: Status flags to clear.
1906 + * @tag: s390dbf trace record tag
1907 + */
1908 +static int zfcp_ccw_activate(struct ccw_device *cdev, int clear, char *tag)
1909 {
1910 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
1911
1912 if (!adapter)
1913 return 0;
1914
1915 + zfcp_erp_clear_adapter_status(adapter, clear);
1916 zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING);
1917 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
1918 - "ccresu2");
1919 + tag);
1920 zfcp_erp_wait(adapter);
1921 flush_work(&adapter->scan_work);
1922
1923 @@ -164,26 +170,29 @@ static int zfcp_ccw_set_online(struct ccw_device *cdev)
1924 BUG_ON(!zfcp_reqlist_isempty(adapter->req_list));
1925 adapter->req_no = 0;
1926
1927 - zfcp_ccw_activate(cdev);
1928 + zfcp_ccw_activate(cdev, 0, "ccsonl1");
1929 zfcp_ccw_adapter_put(adapter);
1930 return 0;
1931 }
1932
1933 /**
1934 - * zfcp_ccw_set_offline - set_offline function of zfcp driver
1935 + * zfcp_ccw_offline_sync - shut down adapter and wait for it to finish
1936 * @cdev: pointer to belonging ccw device
1937 + * @set: Status flags to set.
1938 + * @tag: s390dbf trace record tag
1939 *
1940 * This function gets called by the common i/o layer and sets an adapter
1941 * into state offline.
1942 */
1943 -static int zfcp_ccw_set_offline(struct ccw_device *cdev)
1944 +static int zfcp_ccw_offline_sync(struct ccw_device *cdev, int set, char *tag)
1945 {
1946 struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
1947
1948 if (!adapter)
1949 return 0;
1950
1951 - zfcp_erp_adapter_shutdown(adapter, 0, "ccsoff1");
1952 + zfcp_erp_set_adapter_status(adapter, set);
1953 + zfcp_erp_adapter_shutdown(adapter, 0, tag);
1954 zfcp_erp_wait(adapter);
1955
1956 zfcp_ccw_adapter_put(adapter);
1957 @@ -191,6 +200,18 @@ static int zfcp_ccw_set_offline(struct ccw_device *cdev)
1958 }
1959
1960 /**
1961 + * zfcp_ccw_set_offline - set_offline function of zfcp driver
1962 + * @cdev: pointer to belonging ccw device
1963 + *
1964 + * This function gets called by the common i/o layer and sets an adapter
1965 + * into state offline.
1966 + */
1967 +static int zfcp_ccw_set_offline(struct ccw_device *cdev)
1968 +{
1969 + return zfcp_ccw_offline_sync(cdev, 0, "ccsoff1");
1970 +}
1971 +
1972 +/**
1973 * zfcp_ccw_notify - ccw notify function
1974 * @cdev: pointer to belonging ccw device
1975 * @event: indicates if adapter was detached or attached
1976 @@ -207,6 +228,11 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event)
1977
1978 switch (event) {
1979 case CIO_GONE:
1980 + if (atomic_read(&adapter->status) &
1981 + ZFCP_STATUS_ADAPTER_SUSPENDED) { /* notification ignore */
1982 + zfcp_dbf_hba_basic("ccnigo1", adapter);
1983 + break;
1984 + }
1985 dev_warn(&cdev->dev, "The FCP device has been detached\n");
1986 zfcp_erp_adapter_shutdown(adapter, 0, "ccnoti1");
1987 break;
1988 @@ -216,6 +242,11 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event)
1989 zfcp_erp_adapter_shutdown(adapter, 0, "ccnoti2");
1990 break;
1991 case CIO_OPER:
1992 + if (atomic_read(&adapter->status) &
1993 + ZFCP_STATUS_ADAPTER_SUSPENDED) { /* notification ignore */
1994 + zfcp_dbf_hba_basic("ccniop1", adapter);
1995 + break;
1996 + }
1997 dev_info(&cdev->dev, "The FCP device is operational again\n");
1998 zfcp_erp_set_adapter_status(adapter,
1999 ZFCP_STATUS_COMMON_RUNNING);
2000 @@ -251,6 +282,28 @@ static void zfcp_ccw_shutdown(struct ccw_device *cdev)
2001 zfcp_ccw_adapter_put(adapter);
2002 }
2003
2004 +static int zfcp_ccw_suspend(struct ccw_device *cdev)
2005 +{
2006 + zfcp_ccw_offline_sync(cdev, ZFCP_STATUS_ADAPTER_SUSPENDED, "ccsusp1");
2007 + return 0;
2008 +}
2009 +
2010 +static int zfcp_ccw_thaw(struct ccw_device *cdev)
2011 +{
2012 + /* trace records for thaw and final shutdown during suspend
2013 + can only be found in system dump until the end of suspend
2014 + but not after resume because it's based on the memory image
2015 + right after the very first suspend (freeze) callback */
2016 + zfcp_ccw_activate(cdev, 0, "ccthaw1");
2017 + return 0;
2018 +}
2019 +
2020 +static int zfcp_ccw_resume(struct ccw_device *cdev)
2021 +{
2022 + zfcp_ccw_activate(cdev, ZFCP_STATUS_ADAPTER_SUSPENDED, "ccresu1");
2023 + return 0;
2024 +}
2025 +
2026 struct ccw_driver zfcp_ccw_driver = {
2027 .driver = {
2028 .owner = THIS_MODULE,
2029 @@ -263,7 +316,7 @@ struct ccw_driver zfcp_ccw_driver = {
2030 .set_offline = zfcp_ccw_set_offline,
2031 .notify = zfcp_ccw_notify,
2032 .shutdown = zfcp_ccw_shutdown,
2033 - .freeze = zfcp_ccw_set_offline,
2034 - .thaw = zfcp_ccw_activate,
2035 - .restore = zfcp_ccw_activate,
2036 + .freeze = zfcp_ccw_suspend,
2037 + .thaw = zfcp_ccw_thaw,
2038 + .restore = zfcp_ccw_resume,
2039 };
2040 diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
2041 index fbd8b4d..49b82e4 100644
2042 --- a/drivers/s390/scsi/zfcp_cfdc.c
2043 +++ b/drivers/s390/scsi/zfcp_cfdc.c
2044 @@ -293,7 +293,7 @@ void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *adapter)
2045 }
2046 read_unlock_irqrestore(&adapter->port_list_lock, flags);
2047
2048 - shost_for_each_device(sdev, port->adapter->scsi_host) {
2049 + shost_for_each_device(sdev, adapter->scsi_host) {
2050 zfcp_sdev = sdev_to_zfcp(sdev);
2051 status = atomic_read(&zfcp_sdev->status);
2052 if ((status & ZFCP_STATUS_COMMON_ACCESS_DENIED) ||
2053 diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
2054 index 3c1d220..e1a8cc2 100644
2055 --- a/drivers/s390/scsi/zfcp_dbf.c
2056 +++ b/drivers/s390/scsi/zfcp_dbf.c
2057 @@ -191,7 +191,7 @@ void zfcp_dbf_hba_def_err(struct zfcp_adapter *adapter, u64 req_id, u16 scount,
2058 length = min((u16)sizeof(struct qdio_buffer),
2059 (u16)ZFCP_DBF_PAY_MAX_REC);
2060
2061 - while ((char *)pl[payload->counter] && payload->counter < scount) {
2062 + while (payload->counter < scount && (char *)pl[payload->counter]) {
2063 memcpy(payload->data, (char *)pl[payload->counter], length);
2064 debug_event(dbf->pay, 1, payload, zfcp_dbf_plen(length));
2065 payload->counter++;
2066 @@ -200,6 +200,26 @@ void zfcp_dbf_hba_def_err(struct zfcp_adapter *adapter, u64 req_id, u16 scount,
2067 spin_unlock_irqrestore(&dbf->pay_lock, flags);
2068 }
2069
2070 +/**
2071 + * zfcp_dbf_hba_basic - trace event for basic adapter events
2072 + * @adapter: pointer to struct zfcp_adapter
2073 + */
2074 +void zfcp_dbf_hba_basic(char *tag, struct zfcp_adapter *adapter)
2075 +{
2076 + struct zfcp_dbf *dbf = adapter->dbf;
2077 + struct zfcp_dbf_hba *rec = &dbf->hba_buf;
2078 + unsigned long flags;
2079 +
2080 + spin_lock_irqsave(&dbf->hba_lock, flags);
2081 + memset(rec, 0, sizeof(*rec));
2082 +
2083 + memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
2084 + rec->id = ZFCP_DBF_HBA_BASIC;
2085 +
2086 + debug_event(dbf->hba, 1, rec, sizeof(*rec));
2087 + spin_unlock_irqrestore(&dbf->hba_lock, flags);
2088 +}
2089 +
2090 static void zfcp_dbf_set_common(struct zfcp_dbf_rec *rec,
2091 struct zfcp_adapter *adapter,
2092 struct zfcp_port *port,
2093 diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
2094 index 714f087..3ac7a4b 100644
2095 --- a/drivers/s390/scsi/zfcp_dbf.h
2096 +++ b/drivers/s390/scsi/zfcp_dbf.h
2097 @@ -154,6 +154,7 @@ enum zfcp_dbf_hba_id {
2098 ZFCP_DBF_HBA_RES = 1,
2099 ZFCP_DBF_HBA_USS = 2,
2100 ZFCP_DBF_HBA_BIT = 3,
2101 + ZFCP_DBF_HBA_BASIC = 4,
2102 };
2103
2104 /**
2105 diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
2106 index 2955e1a..1305955 100644
2107 --- a/drivers/s390/scsi/zfcp_def.h
2108 +++ b/drivers/s390/scsi/zfcp_def.h
2109 @@ -77,6 +77,7 @@ struct zfcp_reqlist;
2110 #define ZFCP_STATUS_ADAPTER_SIOSL_ISSUED 0x00000004
2111 #define ZFCP_STATUS_ADAPTER_XCONFIG_OK 0x00000008
2112 #define ZFCP_STATUS_ADAPTER_HOST_CON_INIT 0x00000010
2113 +#define ZFCP_STATUS_ADAPTER_SUSPENDED 0x00000040
2114 #define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100
2115 #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200
2116 #define ZFCP_STATUS_ADAPTER_DATA_DIV_ENABLED 0x00000400
2117 @@ -204,6 +205,7 @@ struct zfcp_port {
2118 struct zfcp_adapter *adapter; /* adapter used to access port */
2119 struct list_head unit_list; /* head of logical unit list */
2120 rwlock_t unit_list_lock; /* unit list lock */
2121 + atomic_t units; /* zfcp_unit count */
2122 atomic_t status; /* status of this remote port */
2123 u64 wwnn; /* WWNN if known */
2124 u64 wwpn; /* WWPN */
2125 diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
2126 index 36f4227..03441a7f 100644
2127 --- a/drivers/s390/scsi/zfcp_ext.h
2128 +++ b/drivers/s390/scsi/zfcp_ext.h
2129 @@ -54,6 +54,7 @@ extern void zfcp_dbf_hba_fsf_res(char *, struct zfcp_fsf_req *);
2130 extern void zfcp_dbf_hba_bit_err(char *, struct zfcp_fsf_req *);
2131 extern void zfcp_dbf_hba_berr(struct zfcp_dbf *, struct zfcp_fsf_req *);
2132 extern void zfcp_dbf_hba_def_err(struct zfcp_adapter *, u64, u16, void **);
2133 +extern void zfcp_dbf_hba_basic(char *, struct zfcp_adapter *);
2134 extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32);
2135 extern void zfcp_dbf_san_res(char *, struct zfcp_fsf_req *);
2136 extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *);
2137 @@ -158,6 +159,7 @@ extern void zfcp_scsi_dif_sense_error(struct scsi_cmnd *, int);
2138 extern struct attribute_group zfcp_sysfs_unit_attrs;
2139 extern struct attribute_group zfcp_sysfs_adapter_attrs;
2140 extern struct attribute_group zfcp_sysfs_port_attrs;
2141 +extern struct mutex zfcp_sysfs_port_units_mutex;
2142 extern struct device_attribute *zfcp_sysfs_sdev_attrs[];
2143 extern struct device_attribute *zfcp_sysfs_shost_attrs[];
2144
2145 diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
2146 index e1c1efc..48f875f 100644
2147 --- a/drivers/s390/scsi/zfcp_fsf.c
2148 +++ b/drivers/s390/scsi/zfcp_fsf.c
2149 @@ -219,7 +219,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
2150 return;
2151 }
2152
2153 - zfcp_dbf_hba_fsf_uss("fssrh_2", req);
2154 + zfcp_dbf_hba_fsf_uss("fssrh_4", req);
2155
2156 switch (sr_buf->status_type) {
2157 case FSF_STATUS_READ_PORT_CLOSED:
2158 @@ -437,6 +437,34 @@ void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
2159 }
2160 }
2161
2162 +#define ZFCP_FSF_PORTSPEED_1GBIT (1 << 0)
2163 +#define ZFCP_FSF_PORTSPEED_2GBIT (1 << 1)
2164 +#define ZFCP_FSF_PORTSPEED_4GBIT (1 << 2)
2165 +#define ZFCP_FSF_PORTSPEED_10GBIT (1 << 3)
2166 +#define ZFCP_FSF_PORTSPEED_8GBIT (1 << 4)
2167 +#define ZFCP_FSF_PORTSPEED_16GBIT (1 << 5)
2168 +#define ZFCP_FSF_PORTSPEED_NOT_NEGOTIATED (1 << 15)
2169 +
2170 +static u32 zfcp_fsf_convert_portspeed(u32 fsf_speed)
2171 +{
2172 + u32 fdmi_speed = 0;
2173 + if (fsf_speed & ZFCP_FSF_PORTSPEED_1GBIT)
2174 + fdmi_speed |= FC_PORTSPEED_1GBIT;
2175 + if (fsf_speed & ZFCP_FSF_PORTSPEED_2GBIT)
2176 + fdmi_speed |= FC_PORTSPEED_2GBIT;
2177 + if (fsf_speed & ZFCP_FSF_PORTSPEED_4GBIT)
2178 + fdmi_speed |= FC_PORTSPEED_4GBIT;
2179 + if (fsf_speed & ZFCP_FSF_PORTSPEED_10GBIT)
2180 + fdmi_speed |= FC_PORTSPEED_10GBIT;
2181 + if (fsf_speed & ZFCP_FSF_PORTSPEED_8GBIT)
2182 + fdmi_speed |= FC_PORTSPEED_8GBIT;
2183 + if (fsf_speed & ZFCP_FSF_PORTSPEED_16GBIT)
2184 + fdmi_speed |= FC_PORTSPEED_16GBIT;
2185 + if (fsf_speed & ZFCP_FSF_PORTSPEED_NOT_NEGOTIATED)
2186 + fdmi_speed |= FC_PORTSPEED_NOT_NEGOTIATED;
2187 + return fdmi_speed;
2188 +}
2189 +
2190 static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
2191 {
2192 struct fsf_qtcb_bottom_config *bottom = &req->qtcb->bottom.config;
2193 @@ -456,7 +484,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
2194 fc_host_port_name(shost) = nsp->fl_wwpn;
2195 fc_host_node_name(shost) = nsp->fl_wwnn;
2196 fc_host_port_id(shost) = ntoh24(bottom->s_id);
2197 - fc_host_speed(shost) = bottom->fc_link_speed;
2198 + fc_host_speed(shost) =
2199 + zfcp_fsf_convert_portspeed(bottom->fc_link_speed);
2200 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
2201
2202 adapter->hydra_version = bottom->adapter_type;
2203 @@ -580,7 +609,8 @@ static void zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *req)
2204 } else
2205 fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
2206 fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
2207 - fc_host_supported_speeds(shost) = bottom->supported_speed;
2208 + fc_host_supported_speeds(shost) =
2209 + zfcp_fsf_convert_portspeed(bottom->supported_speed);
2210 memcpy(fc_host_supported_fc4s(shost), bottom->supported_fc4_types,
2211 FC_FC4_LIST_SIZE);
2212 memcpy(fc_host_active_fc4s(shost), bottom->active_fc4_types,
2213 @@ -771,12 +801,14 @@ out:
2214 static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
2215 {
2216 struct scsi_device *sdev = req->data;
2217 - struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
2218 + struct zfcp_scsi_dev *zfcp_sdev;
2219 union fsf_status_qual *fsq = &req->qtcb->header.fsf_status_qual;
2220
2221 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2222 return;
2223
2224 + zfcp_sdev = sdev_to_zfcp(sdev);
2225 +
2226 switch (req->qtcb->header.fsf_status) {
2227 case FSF_PORT_HANDLE_NOT_VALID:
2228 if (fsq->word[0] == fsq->word[1]) {
2229 @@ -885,7 +917,7 @@ static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req)
2230
2231 switch (header->fsf_status) {
2232 case FSF_GOOD:
2233 - zfcp_dbf_san_res("fsscth1", req);
2234 + zfcp_dbf_san_res("fsscth2", req);
2235 ct->status = 0;
2236 break;
2237 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
2238 @@ -1739,13 +1771,15 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
2239 {
2240 struct zfcp_adapter *adapter = req->adapter;
2241 struct scsi_device *sdev = req->data;
2242 - struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
2243 + struct zfcp_scsi_dev *zfcp_sdev;
2244 struct fsf_qtcb_header *header = &req->qtcb->header;
2245 struct fsf_qtcb_bottom_support *bottom = &req->qtcb->bottom.support;
2246
2247 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2248 return;
2249
2250 + zfcp_sdev = sdev_to_zfcp(sdev);
2251 +
2252 atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
2253 ZFCP_STATUS_COMMON_ACCESS_BOXED |
2254 ZFCP_STATUS_LUN_SHARED |
2255 @@ -1856,11 +1890,13 @@ out:
2256 static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req)
2257 {
2258 struct scsi_device *sdev = req->data;
2259 - struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
2260 + struct zfcp_scsi_dev *zfcp_sdev;
2261
2262 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2263 return;
2264
2265 + zfcp_sdev = sdev_to_zfcp(sdev);
2266 +
2267 switch (req->qtcb->header.fsf_status) {
2268 case FSF_PORT_HANDLE_NOT_VALID:
2269 zfcp_erp_adapter_reopen(zfcp_sdev->port->adapter, 0, "fscuh_1");
2270 @@ -1950,7 +1986,7 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
2271 {
2272 struct fsf_qual_latency_info *lat_in;
2273 struct latency_cont *lat = NULL;
2274 - struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scsi->device);
2275 + struct zfcp_scsi_dev *zfcp_sdev;
2276 struct zfcp_blk_drv_data blktrc;
2277 int ticks = req->adapter->timer_ticks;
2278
2279 @@ -1965,6 +2001,7 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
2280
2281 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA &&
2282 !(req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
2283 + zfcp_sdev = sdev_to_zfcp(scsi->device);
2284 blktrc.flags |= ZFCP_BLK_LAT_VALID;
2285 blktrc.channel_lat = lat_in->channel_lat * ticks;
2286 blktrc.fabric_lat = lat_in->fabric_lat * ticks;
2287 @@ -2002,12 +2039,14 @@ static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req)
2288 {
2289 struct scsi_cmnd *scmnd = req->data;
2290 struct scsi_device *sdev = scmnd->device;
2291 - struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
2292 + struct zfcp_scsi_dev *zfcp_sdev;
2293 struct fsf_qtcb_header *header = &req->qtcb->header;
2294
2295 if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR))
2296 return;
2297
2298 + zfcp_sdev = sdev_to_zfcp(sdev);
2299 +
2300 switch (header->fsf_status) {
2301 case FSF_HANDLE_MISMATCH:
2302 case FSF_PORT_HANDLE_NOT_VALID:
2303 diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
2304 index b9fffc8..50b5615 100644
2305 --- a/drivers/s390/scsi/zfcp_qdio.c
2306 +++ b/drivers/s390/scsi/zfcp_qdio.c
2307 @@ -102,18 +102,22 @@ static void zfcp_qdio_int_resp(struct ccw_device *cdev, unsigned int qdio_err,
2308 {
2309 struct zfcp_qdio *qdio = (struct zfcp_qdio *) parm;
2310 struct zfcp_adapter *adapter = qdio->adapter;
2311 - struct qdio_buffer_element *sbale;
2312 int sbal_no, sbal_idx;
2313 - void *pl[ZFCP_QDIO_MAX_SBALS_PER_REQ + 1];
2314 - u64 req_id;
2315 - u8 scount;
2316
2317 if (unlikely(qdio_err)) {
2318 - memset(pl, 0, ZFCP_QDIO_MAX_SBALS_PER_REQ * sizeof(void *));
2319 if (zfcp_adapter_multi_buffer_active(adapter)) {
2320 + void *pl[ZFCP_QDIO_MAX_SBALS_PER_REQ + 1];
2321 + struct qdio_buffer_element *sbale;
2322 + u64 req_id;
2323 + u8 scount;
2324 +
2325 + memset(pl, 0,
2326 + ZFCP_QDIO_MAX_SBALS_PER_REQ * sizeof(void *));
2327 sbale = qdio->res_q[idx]->element;
2328 req_id = (u64) sbale->addr;
2329 - scount = sbale->scount + 1; /* incl. signaling SBAL */
2330 + scount = min(sbale->scount + 1,
2331 + ZFCP_QDIO_MAX_SBALS_PER_REQ + 1);
2332 + /* incl. signaling SBAL */
2333
2334 for (sbal_no = 0; sbal_no < scount; sbal_no++) {
2335 sbal_idx = (idx + sbal_no) %
2336 diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
2337 index c66af27..1e0eb08 100644
2338 --- a/drivers/s390/scsi/zfcp_sysfs.c
2339 +++ b/drivers/s390/scsi/zfcp_sysfs.c
2340 @@ -227,6 +227,8 @@ static ssize_t zfcp_sysfs_port_rescan_store(struct device *dev,
2341 static ZFCP_DEV_ATTR(adapter, port_rescan, S_IWUSR, NULL,
2342 zfcp_sysfs_port_rescan_store);
2343
2344 +DEFINE_MUTEX(zfcp_sysfs_port_units_mutex);
2345 +
2346 static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
2347 struct device_attribute *attr,
2348 const char *buf, size_t count)
2349 @@ -249,6 +251,16 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev,
2350 else
2351 retval = 0;
2352
2353 + mutex_lock(&zfcp_sysfs_port_units_mutex);
2354 + if (atomic_read(&port->units) > 0) {
2355 + retval = -EBUSY;
2356 + mutex_unlock(&zfcp_sysfs_port_units_mutex);
2357 + goto out;
2358 + }
2359 + /* port is about to be removed, so no more unit_add */
2360 + atomic_set(&port->units, -1);
2361 + mutex_unlock(&zfcp_sysfs_port_units_mutex);
2362 +
2363 write_lock_irq(&adapter->port_list_lock);
2364 list_del(&port->list);
2365 write_unlock_irq(&adapter->port_list_lock);
2366 @@ -289,12 +301,14 @@ static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
2367 {
2368 struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
2369 u64 fcp_lun;
2370 + int retval;
2371
2372 if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
2373 return -EINVAL;
2374
2375 - if (zfcp_unit_add(port, fcp_lun))
2376 - return -EINVAL;
2377 + retval = zfcp_unit_add(port, fcp_lun);
2378 + if (retval)
2379 + return retval;
2380
2381 return count;
2382 }
2383 diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c
2384 index 3f2bff0..1cd2b99 100644
2385 --- a/drivers/s390/scsi/zfcp_unit.c
2386 +++ b/drivers/s390/scsi/zfcp_unit.c
2387 @@ -104,7 +104,7 @@ static void zfcp_unit_release(struct device *dev)
2388 {
2389 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
2390
2391 - put_device(&unit->port->dev);
2392 + atomic_dec(&unit->port->units);
2393 kfree(unit);
2394 }
2395
2396 @@ -119,16 +119,27 @@ static void zfcp_unit_release(struct device *dev)
2397 int zfcp_unit_add(struct zfcp_port *port, u64 fcp_lun)
2398 {
2399 struct zfcp_unit *unit;
2400 + int retval = 0;
2401 +
2402 + mutex_lock(&zfcp_sysfs_port_units_mutex);
2403 + if (atomic_read(&port->units) == -1) {
2404 + /* port is already gone */
2405 + retval = -ENODEV;
2406 + goto out;
2407 + }
2408
2409 unit = zfcp_unit_find(port, fcp_lun);
2410 if (unit) {
2411 put_device(&unit->dev);
2412 - return -EEXIST;
2413 + retval = -EEXIST;
2414 + goto out;
2415 }
2416
2417 unit = kzalloc(sizeof(struct zfcp_unit), GFP_KERNEL);
2418 - if (!unit)
2419 - return -ENOMEM;
2420 + if (!unit) {
2421 + retval = -ENOMEM;
2422 + goto out;
2423 + }
2424
2425 unit->port = port;
2426 unit->fcp_lun = fcp_lun;
2427 @@ -139,28 +150,33 @@ int zfcp_unit_add(struct zfcp_port *port, u64 fcp_lun)
2428 if (dev_set_name(&unit->dev, "0x%016llx",
2429 (unsigned long long) fcp_lun)) {
2430 kfree(unit);
2431 - return -ENOMEM;
2432 + retval = -ENOMEM;
2433 + goto out;
2434 }
2435
2436 - get_device(&port->dev);
2437 -
2438 if (device_register(&unit->dev)) {
2439 put_device(&unit->dev);
2440 - return -ENOMEM;
2441 + retval = -ENOMEM;
2442 + goto out;
2443 }
2444
2445 if (sysfs_create_group(&unit->dev.kobj, &zfcp_sysfs_unit_attrs)) {
2446 device_unregister(&unit->dev);
2447 - return -EINVAL;
2448 + retval = -EINVAL;
2449 + goto out;
2450 }
2451
2452 + atomic_inc(&port->units); /* under zfcp_sysfs_port_units_mutex ! */
2453 +
2454 write_lock_irq(&port->unit_list_lock);
2455 list_add_tail(&unit->list, &port->unit_list);
2456 write_unlock_irq(&port->unit_list_lock);
2457
2458 zfcp_unit_scsi_scan(unit);
2459
2460 - return 0;
2461 +out:
2462 + mutex_unlock(&zfcp_sysfs_port_units_mutex);
2463 + return retval;
2464 }
2465
2466 /**
2467 diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
2468 index 68ce085..a540162 100644
2469 --- a/drivers/scsi/atp870u.c
2470 +++ b/drivers/scsi/atp870u.c
2471 @@ -1173,7 +1173,16 @@ wait_io1:
2472 outw(val, tmport);
2473 outb(2, 0x80);
2474 TCM_SYNC:
2475 - udelay(0x800);
2476 + /*
2477 + * The funny division into multiple delays is to accomodate
2478 + * arches like ARM where udelay() multiplies its argument by
2479 + * a large number to initialize a loop counter. To avoid
2480 + * overflow, the maximum supported udelay is 2000 microseconds.
2481 + *
2482 + * XXX it would be more polite to find a way to use msleep()
2483 + */
2484 + mdelay(2);
2485 + udelay(48);
2486 if ((inb(tmport) & 0x80) == 0x00) { /* bsy ? */
2487 outw(0, tmport--);
2488 outb(0, tmport);
2489 diff --git a/fs/buffer.c b/fs/buffer.c
2490 index 58e2e7b..b5f0442 100644
2491 --- a/fs/buffer.c
2492 +++ b/fs/buffer.c
2493 @@ -2312,12 +2312,6 @@ int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
2494 loff_t size;
2495 int ret;
2496
2497 - /*
2498 - * Update file times before taking page lock. We may end up failing the
2499 - * fault so this update may be superfluous but who really cares...
2500 - */
2501 - file_update_time(vma->vm_file);
2502 -
2503 lock_page(page);
2504 size = i_size_read(inode);
2505 if ((page->mapping != inode->i_mapping) ||
2506 @@ -2355,6 +2349,13 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
2507 struct super_block *sb = vma->vm_file->f_path.dentry->d_inode->i_sb;
2508
2509 sb_start_pagefault(sb);
2510 +
2511 + /*
2512 + * Update file times before taking page lock. We may end up failing the
2513 + * fault so this update may be superfluous but who really cares...
2514 + */
2515 + file_update_time(vma->vm_file);
2516 +
2517 ret = __block_page_mkwrite(vma, vmf, get_block);
2518 sb_end_pagefault(sb);
2519 return block_page_mkwrite_return(ret);
2520 diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
2521 index 53cf2aa..71d5d0a 100644
2522 --- a/fs/cifs/cifs_unicode.c
2523 +++ b/fs/cifs/cifs_unicode.c
2524 @@ -203,6 +203,27 @@ cifs_strtoUTF16(__le16 *to, const char *from, int len,
2525 int i;
2526 wchar_t wchar_to; /* needed to quiet sparse */
2527
2528 + /* special case for utf8 to handle no plane0 chars */
2529 + if (!strcmp(codepage->charset, "utf8")) {
2530 + /*
2531 + * convert utf8 -> utf16, we assume we have enough space
2532 + * as caller should have assumed conversion does not overflow
2533 + * in destination len is length in wchar_t units (16bits)
2534 + */
2535 + i = utf8s_to_utf16s(from, len, UTF16_LITTLE_ENDIAN,
2536 + (wchar_t *) to, len);
2537 +
2538 + /* if success terminate and exit */
2539 + if (i >= 0)
2540 + goto success;
2541 + /*
2542 + * if fails fall back to UCS encoding as this
2543 + * function should not return negative values
2544 + * currently can fail only if source contains
2545 + * invalid encoded characters
2546 + */
2547 + }
2548 +
2549 for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
2550 charlen = codepage->char2uni(from, len, &wchar_to);
2551 if (charlen < 1) {
2552 @@ -215,6 +236,7 @@ cifs_strtoUTF16(__le16 *to, const char *from, int len,
2553 put_unaligned_le16(wchar_to, &to[i]);
2554 }
2555
2556 +success:
2557 put_unaligned_le16(0, &to[i]);
2558 return i;
2559 }
2560 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
2561 index 6df6fa1..b39bb4a 100644
2562 --- a/fs/cifs/connect.c
2563 +++ b/fs/cifs/connect.c
2564 @@ -67,6 +67,7 @@ enum {
2565 /* Mount options that take no arguments */
2566 Opt_user_xattr, Opt_nouser_xattr,
2567 Opt_forceuid, Opt_noforceuid,
2568 + Opt_forcegid, Opt_noforcegid,
2569 Opt_noblocksend, Opt_noautotune,
2570 Opt_hard, Opt_soft, Opt_perm, Opt_noperm,
2571 Opt_mapchars, Opt_nomapchars, Opt_sfu,
2572 @@ -118,6 +119,8 @@ static const match_table_t cifs_mount_option_tokens = {
2573 { Opt_nouser_xattr, "nouser_xattr" },
2574 { Opt_forceuid, "forceuid" },
2575 { Opt_noforceuid, "noforceuid" },
2576 + { Opt_forcegid, "forcegid" },
2577 + { Opt_noforcegid, "noforcegid" },
2578 { Opt_noblocksend, "noblocksend" },
2579 { Opt_noautotune, "noautotune" },
2580 { Opt_hard, "hard" },
2581 @@ -1190,6 +1193,12 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
2582 case Opt_noforceuid:
2583 override_uid = 0;
2584 break;
2585 + case Opt_forcegid:
2586 + override_gid = 1;
2587 + break;
2588 + case Opt_noforcegid:
2589 + override_gid = 0;
2590 + break;
2591 case Opt_noblocksend:
2592 vol->noblocksnd = 1;
2593 break;
2594 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2595 index dff171c..2ce16af 100644
2596 --- a/fs/ext4/inode.c
2597 +++ b/fs/ext4/inode.c
2598 @@ -2463,6 +2463,16 @@ static int ext4_nonda_switch(struct super_block *sb)
2599 free_blocks = EXT4_C2B(sbi,
2600 percpu_counter_read_positive(&sbi->s_freeclusters_counter));
2601 dirty_blocks = percpu_counter_read_positive(&sbi->s_dirtyclusters_counter);
2602 + /*
2603 + * Start pushing delalloc when 1/2 of free blocks are dirty.
2604 + */
2605 + if (dirty_blocks && (free_blocks < 2 * dirty_blocks) &&
2606 + !writeback_in_progress(sb->s_bdi) &&
2607 + down_read_trylock(&sb->s_umount)) {
2608 + writeback_inodes_sb(sb, WB_REASON_FS_FREE_SPACE);
2609 + up_read(&sb->s_umount);
2610 + }
2611 +
2612 if (2 * free_blocks < 3 * dirty_blocks ||
2613 free_blocks < (dirty_blocks + EXT4_FREECLUSTERS_WATERMARK)) {
2614 /*
2615 @@ -2471,13 +2481,6 @@ static int ext4_nonda_switch(struct super_block *sb)
2616 */
2617 return 1;
2618 }
2619 - /*
2620 - * Even if we don't switch but are nearing capacity,
2621 - * start pushing delalloc when 1/2 of free blocks are dirty.
2622 - */
2623 - if (free_blocks < 2 * dirty_blocks)
2624 - writeback_inodes_sb_if_idle(sb, WB_REASON_FS_FREE_SPACE);
2625 -
2626 return 0;
2627 }
2628
2629 @@ -4052,6 +4055,7 @@ static int ext4_do_update_inode(handle_t *handle,
2630 struct ext4_inode_info *ei = EXT4_I(inode);
2631 struct buffer_head *bh = iloc->bh;
2632 int err = 0, rc, block;
2633 + int need_datasync = 0;
2634 uid_t i_uid;
2635 gid_t i_gid;
2636
2637 @@ -4102,7 +4106,10 @@ static int ext4_do_update_inode(handle_t *handle,
2638 raw_inode->i_file_acl_high =
2639 cpu_to_le16(ei->i_file_acl >> 32);
2640 raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
2641 - ext4_isize_set(raw_inode, ei->i_disksize);
2642 + if (ei->i_disksize != ext4_isize(raw_inode)) {
2643 + ext4_isize_set(raw_inode, ei->i_disksize);
2644 + need_datasync = 1;
2645 + }
2646 if (ei->i_disksize > 0x7fffffffULL) {
2647 struct super_block *sb = inode->i_sb;
2648 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
2649 @@ -4155,7 +4162,7 @@ static int ext4_do_update_inode(handle_t *handle,
2650 err = rc;
2651 ext4_clear_inode_state(inode, EXT4_STATE_NEW);
2652
2653 - ext4_update_inode_fsync_trans(handle, inode, 0);
2654 + ext4_update_inode_fsync_trans(handle, inode, need_datasync);
2655 out_brelse:
2656 brelse(bh);
2657 ext4_std_error(inode->i_sb, err);
2658 @@ -4780,6 +4787,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
2659 int retries = 0;
2660
2661 sb_start_pagefault(inode->i_sb);
2662 + file_update_time(vma->vm_file);
2663 /* Delalloc case is easy... */
2664 if (test_opt(inode->i_sb, DELALLOC) &&
2665 !ext4_should_journal_data(inode) &&
2666 diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
2667 index c5826c6..e2016f3 100644
2668 --- a/fs/ext4/move_extent.c
2669 +++ b/fs/ext4/move_extent.c
2670 @@ -141,55 +141,21 @@ mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
2671 }
2672
2673 /**
2674 - * mext_check_null_inode - NULL check for two inodes
2675 - *
2676 - * If inode1 or inode2 is NULL, return -EIO. Otherwise, return 0.
2677 - */
2678 -static int
2679 -mext_check_null_inode(struct inode *inode1, struct inode *inode2,
2680 - const char *function, unsigned int line)
2681 -{
2682 - int ret = 0;
2683 -
2684 - if (inode1 == NULL) {
2685 - __ext4_error(inode2->i_sb, function, line,
2686 - "Both inodes should not be NULL: "
2687 - "inode1 NULL inode2 %lu", inode2->i_ino);
2688 - ret = -EIO;
2689 - } else if (inode2 == NULL) {
2690 - __ext4_error(inode1->i_sb, function, line,
2691 - "Both inodes should not be NULL: "
2692 - "inode1 %lu inode2 NULL", inode1->i_ino);
2693 - ret = -EIO;
2694 - }
2695 - return ret;
2696 -}
2697 -
2698 -/**
2699 * double_down_write_data_sem - Acquire two inodes' write lock of i_data_sem
2700 *
2701 - * @orig_inode: original inode structure
2702 - * @donor_inode: donor inode structure
2703 - * Acquire write lock of i_data_sem of the two inodes (orig and donor) by
2704 - * i_ino order.
2705 + * Acquire write lock of i_data_sem of the two inodes
2706 */
2707 static void
2708 -double_down_write_data_sem(struct inode *orig_inode, struct inode *donor_inode)
2709 +double_down_write_data_sem(struct inode *first, struct inode *second)
2710 {
2711 - struct inode *first = orig_inode, *second = donor_inode;
2712 + if (first < second) {
2713 + down_write(&EXT4_I(first)->i_data_sem);
2714 + down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING);
2715 + } else {
2716 + down_write(&EXT4_I(second)->i_data_sem);
2717 + down_write_nested(&EXT4_I(first)->i_data_sem, SINGLE_DEPTH_NESTING);
2718
2719 - /*
2720 - * Use the inode number to provide the stable locking order instead
2721 - * of its address, because the C language doesn't guarantee you can
2722 - * compare pointers that don't come from the same array.
2723 - */
2724 - if (donor_inode->i_ino < orig_inode->i_ino) {
2725 - first = donor_inode;
2726 - second = orig_inode;
2727 }
2728 -
2729 - down_write(&EXT4_I(first)->i_data_sem);
2730 - down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING);
2731 }
2732
2733 /**
2734 @@ -969,14 +935,6 @@ mext_check_arguments(struct inode *orig_inode,
2735 return -EINVAL;
2736 }
2737
2738 - /* Files should be in the same ext4 FS */
2739 - if (orig_inode->i_sb != donor_inode->i_sb) {
2740 - ext4_debug("ext4 move extent: The argument files "
2741 - "should be in same FS [ino:orig %lu, donor %lu]\n",
2742 - orig_inode->i_ino, donor_inode->i_ino);
2743 - return -EINVAL;
2744 - }
2745 -
2746 /* Ext4 move extent supports only extent based file */
2747 if (!(ext4_test_inode_flag(orig_inode, EXT4_INODE_EXTENTS))) {
2748 ext4_debug("ext4 move extent: orig file is not extents "
2749 @@ -1072,35 +1030,19 @@ mext_check_arguments(struct inode *orig_inode,
2750 * @inode1: the inode structure
2751 * @inode2: the inode structure
2752 *
2753 - * Lock two inodes' i_mutex by i_ino order.
2754 - * If inode1 or inode2 is NULL, return -EIO. Otherwise, return 0.
2755 + * Lock two inodes' i_mutex
2756 */
2757 -static int
2758 +static void
2759 mext_inode_double_lock(struct inode *inode1, struct inode *inode2)
2760 {
2761 - int ret = 0;
2762 -
2763 - BUG_ON(inode1 == NULL && inode2 == NULL);
2764 -
2765 - ret = mext_check_null_inode(inode1, inode2, __func__, __LINE__);
2766 - if (ret < 0)
2767 - goto out;
2768 -
2769 - if (inode1 == inode2) {
2770 - mutex_lock(&inode1->i_mutex);
2771 - goto out;
2772 - }
2773 -
2774 - if (inode1->i_ino < inode2->i_ino) {
2775 + BUG_ON(inode1 == inode2);
2776 + if (inode1 < inode2) {
2777 mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT);
2778 mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD);
2779 } else {
2780 mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT);
2781 mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD);
2782 }
2783 -
2784 -out:
2785 - return ret;
2786 }
2787
2788 /**
2789 @@ -1109,28 +1051,13 @@ out:
2790 * @inode1: the inode that is released first
2791 * @inode2: the inode that is released second
2792 *
2793 - * If inode1 or inode2 is NULL, return -EIO. Otherwise, return 0.
2794 */
2795
2796 -static int
2797 +static void
2798 mext_inode_double_unlock(struct inode *inode1, struct inode *inode2)
2799 {
2800 - int ret = 0;
2801 -
2802 - BUG_ON(inode1 == NULL && inode2 == NULL);
2803 -
2804 - ret = mext_check_null_inode(inode1, inode2, __func__, __LINE__);
2805 - if (ret < 0)
2806 - goto out;
2807 -
2808 - if (inode1)
2809 - mutex_unlock(&inode1->i_mutex);
2810 -
2811 - if (inode2 && inode2 != inode1)
2812 - mutex_unlock(&inode2->i_mutex);
2813 -
2814 -out:
2815 - return ret;
2816 + mutex_unlock(&inode1->i_mutex);
2817 + mutex_unlock(&inode2->i_mutex);
2818 }
2819
2820 /**
2821 @@ -1187,16 +1114,23 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2822 ext4_lblk_t block_end, seq_start, add_blocks, file_end, seq_blocks = 0;
2823 ext4_lblk_t rest_blocks;
2824 pgoff_t orig_page_offset = 0, seq_end_page;
2825 - int ret1, ret2, depth, last_extent = 0;
2826 + int ret, depth, last_extent = 0;
2827 int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits;
2828 int data_offset_in_page;
2829 int block_len_in_page;
2830 int uninit;
2831
2832 - /* orig and donor should be different file */
2833 - if (orig_inode->i_ino == donor_inode->i_ino) {
2834 + if (orig_inode->i_sb != donor_inode->i_sb) {
2835 + ext4_debug("ext4 move extent: The argument files "
2836 + "should be in same FS [ino:orig %lu, donor %lu]\n",
2837 + orig_inode->i_ino, donor_inode->i_ino);
2838 + return -EINVAL;
2839 + }
2840 +
2841 + /* orig and donor should be different inodes */
2842 + if (orig_inode == donor_inode) {
2843 ext4_debug("ext4 move extent: The argument files should not "
2844 - "be same file [ino:orig %lu, donor %lu]\n",
2845 + "be same inode [ino:orig %lu, donor %lu]\n",
2846 orig_inode->i_ino, donor_inode->i_ino);
2847 return -EINVAL;
2848 }
2849 @@ -1208,18 +1142,21 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2850 orig_inode->i_ino, donor_inode->i_ino);
2851 return -EINVAL;
2852 }
2853 -
2854 + /* TODO: This is non obvious task to swap blocks for inodes with full
2855 + jornaling enabled */
2856 + if (ext4_should_journal_data(orig_inode) ||
2857 + ext4_should_journal_data(donor_inode)) {
2858 + return -EINVAL;
2859 + }
2860 /* Protect orig and donor inodes against a truncate */
2861 - ret1 = mext_inode_double_lock(orig_inode, donor_inode);
2862 - if (ret1 < 0)
2863 - return ret1;
2864 + mext_inode_double_lock(orig_inode, donor_inode);
2865
2866 /* Protect extent tree against block allocations via delalloc */
2867 double_down_write_data_sem(orig_inode, donor_inode);
2868 /* Check the filesystem environment whether move_extent can be done */
2869 - ret1 = mext_check_arguments(orig_inode, donor_inode, orig_start,
2870 + ret = mext_check_arguments(orig_inode, donor_inode, orig_start,
2871 donor_start, &len);
2872 - if (ret1)
2873 + if (ret)
2874 goto out;
2875
2876 file_end = (i_size_read(orig_inode) - 1) >> orig_inode->i_blkbits;
2877 @@ -1227,13 +1164,13 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2878 if (file_end < block_end)
2879 len -= block_end - file_end;
2880
2881 - ret1 = get_ext_path(orig_inode, block_start, &orig_path);
2882 - if (ret1)
2883 + ret = get_ext_path(orig_inode, block_start, &orig_path);
2884 + if (ret)
2885 goto out;
2886
2887 /* Get path structure to check the hole */
2888 - ret1 = get_ext_path(orig_inode, block_start, &holecheck_path);
2889 - if (ret1)
2890 + ret = get_ext_path(orig_inode, block_start, &holecheck_path);
2891 + if (ret)
2892 goto out;
2893
2894 depth = ext_depth(orig_inode);
2895 @@ -1252,13 +1189,13 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2896 last_extent = mext_next_extent(orig_inode,
2897 holecheck_path, &ext_cur);
2898 if (last_extent < 0) {
2899 - ret1 = last_extent;
2900 + ret = last_extent;
2901 goto out;
2902 }
2903 last_extent = mext_next_extent(orig_inode, orig_path,
2904 &ext_dummy);
2905 if (last_extent < 0) {
2906 - ret1 = last_extent;
2907 + ret = last_extent;
2908 goto out;
2909 }
2910 seq_start = le32_to_cpu(ext_cur->ee_block);
2911 @@ -1272,7 +1209,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2912 if (le32_to_cpu(ext_cur->ee_block) > block_end) {
2913 ext4_debug("ext4 move extent: The specified range of file "
2914 "may be the hole\n");
2915 - ret1 = -EINVAL;
2916 + ret = -EINVAL;
2917 goto out;
2918 }
2919
2920 @@ -1292,7 +1229,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2921 last_extent = mext_next_extent(orig_inode, holecheck_path,
2922 &ext_cur);
2923 if (last_extent < 0) {
2924 - ret1 = last_extent;
2925 + ret = last_extent;
2926 break;
2927 }
2928 add_blocks = ext4_ext_get_actual_len(ext_cur);
2929 @@ -1349,18 +1286,18 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2930 orig_page_offset,
2931 data_offset_in_page,
2932 block_len_in_page, uninit,
2933 - &ret1);
2934 + &ret);
2935
2936 /* Count how many blocks we have exchanged */
2937 *moved_len += block_len_in_page;
2938 - if (ret1 < 0)
2939 + if (ret < 0)
2940 break;
2941 if (*moved_len > len) {
2942 EXT4_ERROR_INODE(orig_inode,
2943 "We replaced blocks too much! "
2944 "sum of replaced: %llu requested: %llu",
2945 *moved_len, len);
2946 - ret1 = -EIO;
2947 + ret = -EIO;
2948 break;
2949 }
2950
2951 @@ -1374,22 +1311,22 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
2952 }
2953
2954 double_down_write_data_sem(orig_inode, donor_inode);
2955 - if (ret1 < 0)
2956 + if (ret < 0)
2957 break;
2958
2959 /* Decrease buffer counter */
2960 if (holecheck_path)
2961 ext4_ext_drop_refs(holecheck_path);
2962 - ret1 = get_ext_path(orig_inode, seq_start, &holecheck_path);
2963 - if (ret1)
2964 + ret = get_ext_path(orig_inode, seq_start, &holecheck_path);
2965 + if (ret)
2966 break;
2967 depth = holecheck_path->p_depth;
2968
2969 /* Decrease buffer counter */
2970 if (orig_path)
2971 ext4_ext_drop_refs(orig_path);
2972 - ret1 = get_ext_path(orig_inode, seq_start, &orig_path);
2973 - if (ret1)
2974 + ret = get_ext_path(orig_inode, seq_start, &orig_path);
2975 + if (ret)
2976 break;
2977
2978 ext_cur = holecheck_path[depth].p_ext;
2979 @@ -1412,12 +1349,7 @@ out:
2980 kfree(holecheck_path);
2981 }
2982 double_up_write_data_sem(orig_inode, donor_inode);
2983 - ret2 = mext_inode_double_unlock(orig_inode, donor_inode);
2984 -
2985 - if (ret1)
2986 - return ret1;
2987 - else if (ret2)
2988 - return ret2;
2989 + mext_inode_double_unlock(orig_inode, donor_inode);
2990
2991 - return 0;
2992 + return ret;
2993 }
2994 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
2995 index 2a42cc0..d13873d 100644
2996 --- a/fs/ext4/namei.c
2997 +++ b/fs/ext4/namei.c
2998 @@ -2149,9 +2149,7 @@ retry:
2999 err = PTR_ERR(inode);
3000 if (!IS_ERR(inode)) {
3001 init_special_inode(inode, inode->i_mode, rdev);
3002 -#ifdef CONFIG_EXT4_FS_XATTR
3003 inode->i_op = &ext4_special_inode_operations;
3004 -#endif
3005 err = ext4_add_nondir(handle, dentry, inode);
3006 }
3007 ext4_journal_stop(handle);
3008 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
3009 index 41f6ef6..0be1789 100644
3010 --- a/fs/ext4/resize.c
3011 +++ b/fs/ext4/resize.c
3012 @@ -200,8 +200,11 @@ static void free_flex_gd(struct ext4_new_flex_group_data *flex_gd)
3013 * be a partial of a flex group.
3014 *
3015 * @sb: super block of fs to which the groups belongs
3016 + *
3017 + * Returns 0 on a successful allocation of the metadata blocks in the
3018 + * block group.
3019 */
3020 -static void ext4_alloc_group_tables(struct super_block *sb,
3021 +static int ext4_alloc_group_tables(struct super_block *sb,
3022 struct ext4_new_flex_group_data *flex_gd,
3023 int flexbg_size)
3024 {
3025 @@ -226,6 +229,8 @@ static void ext4_alloc_group_tables(struct super_block *sb,
3026 (last_group & ~(flexbg_size - 1))));
3027 next_group:
3028 group = group_data[0].group;
3029 + if (src_group >= group_data[0].group + flex_gd->count)
3030 + return -ENOSPC;
3031 start_blk = ext4_group_first_block_no(sb, src_group);
3032 last_blk = start_blk + group_data[src_group - group].blocks_count;
3033
3034 @@ -235,7 +240,6 @@ next_group:
3035
3036 start_blk += overhead;
3037
3038 - BUG_ON(src_group >= group_data[0].group + flex_gd->count);
3039 /* We collect contiguous blocks as much as possible. */
3040 src_group++;
3041 for (; src_group <= last_group; src_group++)
3042 @@ -300,6 +304,7 @@ next_group:
3043 group_data[i].free_blocks_count);
3044 }
3045 }
3046 + return 0;
3047 }
3048
3049 static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
3050 @@ -451,6 +456,9 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
3051 gdblocks = ext4_bg_num_gdb(sb, group);
3052 start = ext4_group_first_block_no(sb, group);
3053
3054 + if (!ext4_bg_has_super(sb, group))
3055 + goto handle_itb;
3056 +
3057 /* Copy all of the GDT blocks into the backup in this group */
3058 for (j = 0, block = start + 1; j < gdblocks; j++, block++) {
3059 struct buffer_head *gdb;
3060 @@ -493,6 +501,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
3061 goto out;
3062 }
3063
3064 +handle_itb:
3065 /* Initialize group tables of the grop @group */
3066 if (!(bg_flags[i] & EXT4_BG_INODE_ZEROED))
3067 goto handle_bb;
3068 @@ -1349,13 +1358,15 @@ exit_journal:
3069 err = err2;
3070
3071 if (!err) {
3072 - int i;
3073 + int gdb_num = group / EXT4_DESC_PER_BLOCK(sb);
3074 + int gdb_num_end = ((group + flex_gd->count - 1) /
3075 + EXT4_DESC_PER_BLOCK(sb));
3076 +
3077 update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es,
3078 sizeof(struct ext4_super_block));
3079 - for (i = 0; i < flex_gd->count; i++, group++) {
3080 + for (; gdb_num <= gdb_num_end; gdb_num++) {
3081 struct buffer_head *gdb_bh;
3082 - int gdb_num;
3083 - gdb_num = group / EXT4_BLOCKS_PER_GROUP(sb);
3084 +
3085 gdb_bh = sbi->s_group_desc[gdb_num];
3086 update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data,
3087 gdb_bh->b_size);
3088 @@ -1729,7 +1740,8 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
3089 */
3090 while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count,
3091 flexbg_size)) {
3092 - ext4_alloc_group_tables(sb, flex_gd, flexbg_size);
3093 + if (ext4_alloc_group_tables(sb, flex_gd, flexbg_size) != 0)
3094 + break;
3095 err = ext4_flex_group_add(sb, resize_inode, flex_gd);
3096 if (unlikely(err))
3097 break;
3098 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
3099 index c6e0cb3..e44b233 100644
3100 --- a/fs/ext4/super.c
3101 +++ b/fs/ext4/super.c
3102 @@ -1735,7 +1735,7 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
3103
3104 static const char *token2str(int token)
3105 {
3106 - static const struct match_token *t;
3107 + const struct match_token *t;
3108
3109 for (t = tokens; t->token != Opt_err; t++)
3110 if (t->token == token && !strchr(t->pattern, '='))
3111 diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
3112 index be3efc4..5602d73 100644
3113 --- a/fs/fs-writeback.c
3114 +++ b/fs/fs-writeback.c
3115 @@ -63,6 +63,7 @@ int writeback_in_progress(struct backing_dev_info *bdi)
3116 {
3117 return test_bit(BDI_writeback_running, &bdi->state);
3118 }
3119 +EXPORT_SYMBOL(writeback_in_progress);
3120
3121 static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
3122 {
3123 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
3124 index e149b99..484b8d1 100644
3125 --- a/fs/jbd2/journal.c
3126 +++ b/fs/jbd2/journal.c
3127 @@ -1354,6 +1354,11 @@ static void jbd2_mark_journal_empty(journal_t *journal)
3128
3129 BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
3130 read_lock(&journal->j_state_lock);
3131 + /* Is it already empty? */
3132 + if (sb->s_start == 0) {
3133 + read_unlock(&journal->j_state_lock);
3134 + return;
3135 + }
3136 jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n",
3137 journal->j_tail_sequence);
3138
3139 diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
3140 index 61ea413..1224d6b 100644
3141 --- a/fs/jffs2/super.c
3142 +++ b/fs/jffs2/super.c
3143 @@ -100,6 +100,10 @@ static int jffs2_sync_fs(struct super_block *sb, int wait)
3144 {
3145 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
3146
3147 +#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
3148 + cancel_delayed_work_sync(&c->wbuf_dwork);
3149 +#endif
3150 +
3151 mutex_lock(&c->alloc_sem);
3152 jffs2_flush_wbuf_pad(c);
3153 mutex_unlock(&c->alloc_sem);
3154 diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
3155 index 6f4529d..a6597d6 100644
3156 --- a/fs/jffs2/wbuf.c
3157 +++ b/fs/jffs2/wbuf.c
3158 @@ -1044,10 +1044,10 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
3159 ops.datbuf = NULL;
3160
3161 ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
3162 - if (ret || ops.oobretlen != ops.ooblen) {
3163 + if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
3164 pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
3165 jeb->offset, ops.ooblen, ops.oobretlen, ret);
3166 - if (!ret)
3167 + if (!ret || mtd_is_bitflip(ret))
3168 ret = -EIO;
3169 return ret;
3170 }
3171 @@ -1086,10 +1086,10 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
3172 ops.datbuf = NULL;
3173
3174 ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
3175 - if (ret || ops.oobretlen != ops.ooblen) {
3176 + if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
3177 pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
3178 jeb->offset, ops.ooblen, ops.oobretlen, ret);
3179 - if (!ret)
3180 + if (!ret || mtd_is_bitflip(ret))
3181 ret = -EIO;
3182 return ret;
3183 }
3184 diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
3185 index a4d56ac..5b387a4 100644
3186 --- a/fs/nilfs2/file.c
3187 +++ b/fs/nilfs2/file.c
3188 @@ -116,6 +116,7 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
3189 if (unlikely(ret))
3190 goto out;
3191
3192 + file_update_time(vma->vm_file);
3193 ret = __block_page_mkwrite(vma, vmf, nilfs_get_block);
3194 if (ret) {
3195 nilfs_transaction_abort(inode->i_sb);
3196 diff --git a/fs/proc/page.c b/fs/proc/page.c
3197 index 7fcd0d6..b8730d9 100644
3198 --- a/fs/proc/page.c
3199 +++ b/fs/proc/page.c
3200 @@ -115,7 +115,13 @@ u64 stable_page_flags(struct page *page)
3201 u |= 1 << KPF_COMPOUND_TAIL;
3202 if (PageHuge(page))
3203 u |= 1 << KPF_HUGE;
3204 - else if (PageTransCompound(page))
3205 + /*
3206 + * PageTransCompound can be true for non-huge compound pages (slab
3207 + * pages or pages allocated by drivers with __GFP_COMP) because it
3208 + * just checks PG_head/PG_tail, so we need to check PageLRU to make
3209 + * sure a given page is a thp, not a non-huge compound page.
3210 + */
3211 + else if (PageTransCompound(page) && PageLRU(compound_trans_head(page)))
3212 u |= 1 << KPF_THP;
3213
3214 /*
3215 diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
3216 index 95b738c..df08254 100644
3217 --- a/include/linux/mempolicy.h
3218 +++ b/include/linux/mempolicy.h
3219 @@ -188,7 +188,7 @@ struct sp_node {
3220
3221 struct shared_policy {
3222 struct rb_root root;
3223 - spinlock_t lock;
3224 + struct mutex mutex;
3225 };
3226
3227 void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
3228 diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
3229 index 926142e..9497be1 100644
3230 --- a/include/net/ip_fib.h
3231 +++ b/include/net/ip_fib.h
3232 @@ -102,6 +102,7 @@ struct fib_info {
3233 unsigned char fib_dead;
3234 unsigned char fib_protocol;
3235 unsigned char fib_scope;
3236 + unsigned char fib_type;
3237 __be32 fib_prefsrc;
3238 u32 fib_priority;
3239 u32 *fib_metrics;
3240 diff --git a/kernel/rcutree.c b/kernel/rcutree.c
3241 index f280e54..f7bcd9e 100644
3242 --- a/kernel/rcutree.c
3243 +++ b/kernel/rcutree.c
3244 @@ -305,7 +305,9 @@ cpu_has_callbacks_ready_to_invoke(struct rcu_data *rdp)
3245 static int
3246 cpu_needs_another_gp(struct rcu_state *rsp, struct rcu_data *rdp)
3247 {
3248 - return *rdp->nxttail[RCU_DONE_TAIL] && !rcu_gp_in_progress(rsp);
3249 + return *rdp->nxttail[RCU_DONE_TAIL +
3250 + ACCESS_ONCE(rsp->completed) != rdp->completed] &&
3251 + !rcu_gp_in_progress(rsp);
3252 }
3253
3254 /*
3255 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
3256 index 649c9f8..1a48cdb 100644
3257 --- a/kernel/sched/core.c
3258 +++ b/kernel/sched/core.c
3259 @@ -5604,7 +5604,9 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
3260 migrate_tasks(cpu);
3261 BUG_ON(rq->nr_running != 1); /* the migration thread */
3262 raw_spin_unlock_irqrestore(&rq->lock, flags);
3263 + break;
3264
3265 + case CPU_DEAD:
3266 calc_load_migrate(rq);
3267 break;
3268 #endif
3269 diff --git a/kernel/sys.c b/kernel/sys.c
3270 index 241507f..6fab59a 100644
3271 --- a/kernel/sys.c
3272 +++ b/kernel/sys.c
3273 @@ -368,6 +368,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier);
3274 void kernel_restart(char *cmd)
3275 {
3276 kernel_restart_prepare(cmd);
3277 + disable_nonboot_cpus();
3278 if (!cmd)
3279 printk(KERN_EMERG "Restarting system.\n");
3280 else
3281 diff --git a/kernel/workqueue.c b/kernel/workqueue.c
3282 index 3c5a79e..872bd6d 100644
3283 --- a/kernel/workqueue.c
3284 +++ b/kernel/workqueue.c
3285 @@ -1927,10 +1927,9 @@ static void move_linked_works(struct work_struct *work, struct list_head *head,
3286 *nextp = n;
3287 }
3288
3289 -static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq)
3290 +static void cwq_activate_delayed_work(struct work_struct *work)
3291 {
3292 - struct work_struct *work = list_first_entry(&cwq->delayed_works,
3293 - struct work_struct, entry);
3294 + struct cpu_workqueue_struct *cwq = get_work_cwq(work);
3295
3296 trace_workqueue_activate_work(work);
3297 move_linked_works(work, &cwq->pool->worklist, NULL);
3298 @@ -1938,6 +1937,14 @@ static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq)
3299 cwq->nr_active++;
3300 }
3301
3302 +static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq)
3303 +{
3304 + struct work_struct *work = list_first_entry(&cwq->delayed_works,
3305 + struct work_struct, entry);
3306 +
3307 + cwq_activate_delayed_work(work);
3308 +}
3309 +
3310 /**
3311 * cwq_dec_nr_in_flight - decrement cwq's nr_in_flight
3312 * @cwq: cwq of interest
3313 @@ -2073,7 +2080,9 @@ __acquires(&gcwq->lock)
3314
3315 spin_unlock_irq(&gcwq->lock);
3316
3317 + smp_wmb(); /* paired with test_and_set_bit(PENDING) */
3318 work_clear_pending(work);
3319 +
3320 lock_map_acquire_read(&cwq->wq->lockdep_map);
3321 lock_map_acquire(&lockdep_map);
3322 trace_workqueue_execute_start(work);
3323 @@ -2844,6 +2853,18 @@ static int try_to_grab_pending(struct work_struct *work)
3324 smp_rmb();
3325 if (gcwq == get_work_gcwq(work)) {
3326 debug_work_deactivate(work);
3327 +
3328 + /*
3329 + * A delayed work item cannot be grabbed directly
3330 + * because it might have linked NO_COLOR work items
3331 + * which, if left on the delayed_list, will confuse
3332 + * cwq->nr_active management later on and cause
3333 + * stall. Make sure the work item is activated
3334 + * before grabbing.
3335 + */
3336 + if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
3337 + cwq_activate_delayed_work(work);
3338 +
3339 list_del_init(&work->entry);
3340 cwq_dec_nr_in_flight(get_work_cwq(work),
3341 get_work_color(work),
3342 diff --git a/lib/gcd.c b/lib/gcd.c
3343 index cce4f3c..3657f12 100644
3344 --- a/lib/gcd.c
3345 +++ b/lib/gcd.c
3346 @@ -9,6 +9,9 @@ unsigned long gcd(unsigned long a, unsigned long b)
3347
3348 if (a < b)
3349 swap(a, b);
3350 +
3351 + if (!b)
3352 + return a;
3353 while ((r = a % b) != 0) {
3354 a = b;
3355 b = r;
3356 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
3357 index bc72712..3adceaf 100644
3358 --- a/mm/hugetlb.c
3359 +++ b/mm/hugetlb.c
3360 @@ -2481,7 +2481,8 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
3361 * from page cache lookup which is in HPAGE_SIZE units.
3362 */
3363 address = address & huge_page_mask(h);
3364 - pgoff = vma_hugecache_offset(h, vma, address);
3365 + pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
3366 + vma->vm_pgoff;
3367 mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
3368
3369 /*
3370 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
3371 index 4ada3be..3d64b36 100644
3372 --- a/mm/mempolicy.c
3373 +++ b/mm/mempolicy.c
3374 @@ -607,6 +607,42 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
3375 return first;
3376 }
3377
3378 +/*
3379 + * Apply policy to a single VMA
3380 + * This must be called with the mmap_sem held for writing.
3381 + */
3382 +static int vma_replace_policy(struct vm_area_struct *vma,
3383 + struct mempolicy *pol)
3384 +{
3385 + int err;
3386 + struct mempolicy *old;
3387 + struct mempolicy *new;
3388 +
3389 + pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
3390 + vma->vm_start, vma->vm_end, vma->vm_pgoff,
3391 + vma->vm_ops, vma->vm_file,
3392 + vma->vm_ops ? vma->vm_ops->set_policy : NULL);
3393 +
3394 + new = mpol_dup(pol);
3395 + if (IS_ERR(new))
3396 + return PTR_ERR(new);
3397 +
3398 + if (vma->vm_ops && vma->vm_ops->set_policy) {
3399 + err = vma->vm_ops->set_policy(vma, new);
3400 + if (err)
3401 + goto err_out;
3402 + }
3403 +
3404 + old = vma->vm_policy;
3405 + vma->vm_policy = new; /* protected by mmap_sem */
3406 + mpol_put(old);
3407 +
3408 + return 0;
3409 + err_out:
3410 + mpol_put(new);
3411 + return err;
3412 +}
3413 +
3414 /* Step 2: apply policy to a range and do splits. */
3415 static int mbind_range(struct mm_struct *mm, unsigned long start,
3416 unsigned long end, struct mempolicy *new_pol)
3417 @@ -655,23 +691,9 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
3418 if (err)
3419 goto out;
3420 }
3421 -
3422 - /*
3423 - * Apply policy to a single VMA. The reference counting of
3424 - * policy for vma_policy linkages has already been handled by
3425 - * vma_merge and split_vma as necessary. If this is a shared
3426 - * policy then ->set_policy will increment the reference count
3427 - * for an sp node.
3428 - */
3429 - pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
3430 - vma->vm_start, vma->vm_end, vma->vm_pgoff,
3431 - vma->vm_ops, vma->vm_file,
3432 - vma->vm_ops ? vma->vm_ops->set_policy : NULL);
3433 - if (vma->vm_ops && vma->vm_ops->set_policy) {
3434 - err = vma->vm_ops->set_policy(vma, new_pol);
3435 - if (err)
3436 - goto out;
3437 - }
3438 + err = vma_replace_policy(vma, new_pol);
3439 + if (err)
3440 + goto out;
3441 }
3442
3443 out:
3444 @@ -1530,8 +1552,18 @@ struct mempolicy *get_vma_policy(struct task_struct *task,
3445 addr);
3446 if (vpol)
3447 pol = vpol;
3448 - } else if (vma->vm_policy)
3449 + } else if (vma->vm_policy) {
3450 pol = vma->vm_policy;
3451 +
3452 + /*
3453 + * shmem_alloc_page() passes MPOL_F_SHARED policy with
3454 + * a pseudo vma whose vma->vm_ops=NULL. Take a reference
3455 + * count on these policies which will be dropped by
3456 + * mpol_cond_put() later
3457 + */
3458 + if (mpol_needs_cond_ref(pol))
3459 + mpol_get(pol);
3460 + }
3461 }
3462 if (!pol)
3463 pol = &default_policy;
3464 @@ -2061,7 +2093,7 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
3465 */
3466
3467 /* lookup first element intersecting start-end */
3468 -/* Caller holds sp->lock */
3469 +/* Caller holds sp->mutex */
3470 static struct sp_node *
3471 sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
3472 {
3473 @@ -2125,36 +2157,50 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
3474
3475 if (!sp->root.rb_node)
3476 return NULL;
3477 - spin_lock(&sp->lock);
3478 + mutex_lock(&sp->mutex);
3479 sn = sp_lookup(sp, idx, idx+1);
3480 if (sn) {
3481 mpol_get(sn->policy);
3482 pol = sn->policy;
3483 }
3484 - spin_unlock(&sp->lock);
3485 + mutex_unlock(&sp->mutex);
3486 return pol;
3487 }
3488
3489 +static void sp_free(struct sp_node *n)
3490 +{
3491 + mpol_put(n->policy);
3492 + kmem_cache_free(sn_cache, n);
3493 +}
3494 +
3495 static void sp_delete(struct shared_policy *sp, struct sp_node *n)
3496 {
3497 pr_debug("deleting %lx-l%lx\n", n->start, n->end);
3498 rb_erase(&n->nd, &sp->root);
3499 - mpol_put(n->policy);
3500 - kmem_cache_free(sn_cache, n);
3501 + sp_free(n);
3502 }
3503
3504 static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
3505 struct mempolicy *pol)
3506 {
3507 - struct sp_node *n = kmem_cache_alloc(sn_cache, GFP_KERNEL);
3508 + struct sp_node *n;
3509 + struct mempolicy *newpol;
3510
3511 + n = kmem_cache_alloc(sn_cache, GFP_KERNEL);
3512 if (!n)
3513 return NULL;
3514 +
3515 + newpol = mpol_dup(pol);
3516 + if (IS_ERR(newpol)) {
3517 + kmem_cache_free(sn_cache, n);
3518 + return NULL;
3519 + }
3520 + newpol->flags |= MPOL_F_SHARED;
3521 +
3522 n->start = start;
3523 n->end = end;
3524 - mpol_get(pol);
3525 - pol->flags |= MPOL_F_SHARED; /* for unref */
3526 - n->policy = pol;
3527 + n->policy = newpol;
3528 +
3529 return n;
3530 }
3531
3532 @@ -2162,10 +2208,10 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
3533 static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
3534 unsigned long end, struct sp_node *new)
3535 {
3536 - struct sp_node *n, *new2 = NULL;
3537 + struct sp_node *n;
3538 + int ret = 0;
3539
3540 -restart:
3541 - spin_lock(&sp->lock);
3542 + mutex_lock(&sp->mutex);
3543 n = sp_lookup(sp, start, end);
3544 /* Take care of old policies in the same range. */
3545 while (n && n->start < end) {
3546 @@ -2178,16 +2224,14 @@ restart:
3547 } else {
3548 /* Old policy spanning whole new range. */
3549 if (n->end > end) {
3550 + struct sp_node *new2;
3551 + new2 = sp_alloc(end, n->end, n->policy);
3552 if (!new2) {
3553 - spin_unlock(&sp->lock);
3554 - new2 = sp_alloc(end, n->end, n->policy);
3555 - if (!new2)
3556 - return -ENOMEM;
3557 - goto restart;
3558 + ret = -ENOMEM;
3559 + goto out;
3560 }
3561 n->end = start;
3562 sp_insert(sp, new2);
3563 - new2 = NULL;
3564 break;
3565 } else
3566 n->end = start;
3567 @@ -2198,12 +2242,9 @@ restart:
3568 }
3569 if (new)
3570 sp_insert(sp, new);
3571 - spin_unlock(&sp->lock);
3572 - if (new2) {
3573 - mpol_put(new2->policy);
3574 - kmem_cache_free(sn_cache, new2);
3575 - }
3576 - return 0;
3577 +out:
3578 + mutex_unlock(&sp->mutex);
3579 + return ret;
3580 }
3581
3582 /**
3583 @@ -2221,7 +2262,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
3584 int ret;
3585
3586 sp->root = RB_ROOT; /* empty tree == default mempolicy */
3587 - spin_lock_init(&sp->lock);
3588 + mutex_init(&sp->mutex);
3589
3590 if (mpol) {
3591 struct vm_area_struct pvma;
3592 @@ -2275,7 +2316,7 @@ int mpol_set_shared_policy(struct shared_policy *info,
3593 }
3594 err = shared_policy_replace(info, vma->vm_pgoff, vma->vm_pgoff+sz, new);
3595 if (err && new)
3596 - kmem_cache_free(sn_cache, new);
3597 + sp_free(new);
3598 return err;
3599 }
3600
3601 @@ -2287,16 +2328,14 @@ void mpol_free_shared_policy(struct shared_policy *p)
3602
3603 if (!p->root.rb_node)
3604 return;
3605 - spin_lock(&p->lock);
3606 + mutex_lock(&p->mutex);
3607 next = rb_first(&p->root);
3608 while (next) {
3609 n = rb_entry(next, struct sp_node, nd);
3610 next = rb_next(&n->nd);
3611 - rb_erase(&n->nd, &p->root);
3612 - mpol_put(n->policy);
3613 - kmem_cache_free(sn_cache, n);
3614 + sp_delete(p, n);
3615 }
3616 - spin_unlock(&p->lock);
3617 + mutex_unlock(&p->mutex);
3618 }
3619
3620 /* assumes fs == KERNEL_DS */
3621 diff --git a/mm/slab.c b/mm/slab.c
3622 index c685475..d066037 100644
3623 --- a/mm/slab.c
3624 +++ b/mm/slab.c
3625 @@ -1781,9 +1781,6 @@ void __init kmem_cache_init_late(void)
3626
3627 slab_state = UP;
3628
3629 - /* Annotate slab for lockdep -- annotate the malloc caches */
3630 - init_lock_keys();
3631 -
3632 /* 6) resize the head arrays to their final sizes */
3633 mutex_lock(&slab_mutex);
3634 list_for_each_entry(cachep, &slab_caches, list)
3635 @@ -1791,6 +1788,9 @@ void __init kmem_cache_init_late(void)
3636 BUG();
3637 mutex_unlock(&slab_mutex);
3638
3639 + /* Annotate slab for lockdep -- annotate the malloc caches */
3640 + init_lock_keys();
3641 +
3642 /* Done! */
3643 slab_state = FULL;
3644
3645 diff --git a/mm/truncate.c b/mm/truncate.c
3646 index 75801ac..f38055c 100644
3647 --- a/mm/truncate.c
3648 +++ b/mm/truncate.c
3649 @@ -394,11 +394,12 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
3650 if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL))
3651 return 0;
3652
3653 + clear_page_mlock(page);
3654 +
3655 spin_lock_irq(&mapping->tree_lock);
3656 if (PageDirty(page))
3657 goto failed;
3658
3659 - clear_page_mlock(page);
3660 BUG_ON(page_has_private(page));
3661 __delete_from_page_cache(page);
3662 spin_unlock_irq(&mapping->tree_lock);
3663 diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
3664 index 8ca533c..830059d 100644
3665 --- a/net/8021q/vlan_core.c
3666 +++ b/net/8021q/vlan_core.c
3667 @@ -105,7 +105,6 @@ static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
3668 return NULL;
3669 memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
3670 skb->mac_header += VLAN_HLEN;
3671 - skb_reset_mac_len(skb);
3672 return skb;
3673 }
3674
3675 @@ -139,6 +138,8 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
3676
3677 skb_reset_network_header(skb);
3678 skb_reset_transport_header(skb);
3679 + skb_reset_mac_len(skb);
3680 +
3681 return skb;
3682
3683 err_free:
3684 diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
3685 index da80dc1..a747100 100644
3686 --- a/net/ipv4/fib_semantics.c
3687 +++ b/net/ipv4/fib_semantics.c
3688 @@ -314,6 +314,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
3689 nfi->fib_scope == fi->fib_scope &&
3690 nfi->fib_prefsrc == fi->fib_prefsrc &&
3691 nfi->fib_priority == fi->fib_priority &&
3692 + nfi->fib_type == fi->fib_type &&
3693 memcmp(nfi->fib_metrics, fi->fib_metrics,
3694 sizeof(u32) * RTAX_MAX) == 0 &&
3695 ((nfi->fib_flags ^ fi->fib_flags) & ~RTNH_F_DEAD) == 0 &&
3696 @@ -833,6 +834,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
3697 fi->fib_flags = cfg->fc_flags;
3698 fi->fib_priority = cfg->fc_priority;
3699 fi->fib_prefsrc = cfg->fc_prefsrc;
3700 + fi->fib_type = cfg->fc_type;
3701
3702 fi->fib_nhs = nhs;
3703 change_nexthops(fi) {
3704 diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
3705 index 6bc85f7..ea3e9af 100644
3706 --- a/net/ipv6/addrconf.c
3707 +++ b/net/ipv6/addrconf.c
3708 @@ -788,10 +788,16 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
3709 struct in6_addr prefix;
3710 struct rt6_info *rt;
3711 struct net *net = dev_net(ifp->idev->dev);
3712 + struct flowi6 fl6 = {};
3713 +
3714 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
3715 - rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1);
3716 + fl6.flowi6_oif = ifp->idev->dev->ifindex;
3717 + fl6.daddr = prefix;
3718 + rt = (struct rt6_info *)ip6_route_lookup(net, &fl6,
3719 + RT6_LOOKUP_F_IFACE);
3720
3721 - if (rt && addrconf_is_prefix_route(rt)) {
3722 + if (rt != net->ipv6.ip6_null_entry &&
3723 + addrconf_is_prefix_route(rt)) {
3724 if (onlink == 0) {
3725 ip6_del_rt(rt);
3726 rt = NULL;
3727 diff --git a/net/ipv6/route.c b/net/ipv6/route.c
3728 index 854e401..46eff42 100644
3729 --- a/net/ipv6/route.c
3730 +++ b/net/ipv6/route.c
3731 @@ -1589,17 +1589,18 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info)
3732 struct fib6_table *table;
3733 struct net *net = dev_net(rt->dst.dev);
3734
3735 - if (rt == net->ipv6.ip6_null_entry)
3736 - return -ENOENT;
3737 + if (rt == net->ipv6.ip6_null_entry) {
3738 + err = -ENOENT;
3739 + goto out;
3740 + }
3741
3742 table = rt->rt6i_table;
3743 write_lock_bh(&table->tb6_lock);
3744 -
3745 err = fib6_del(rt, info);
3746 - dst_release(&rt->dst);
3747 -
3748 write_unlock_bh(&table->tb6_lock);
3749
3750 +out:
3751 + dst_release(&rt->dst);
3752 return err;
3753 }
3754
3755 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
3756 index 6a3ee98..978416d 100644
3757 --- a/scripts/Kbuild.include
3758 +++ b/scripts/Kbuild.include
3759 @@ -98,24 +98,24 @@ try-run = $(shell set -e; \
3760 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
3761
3762 as-option = $(call try-run,\
3763 - $(CC) $(KBUILD_CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2))
3764 + $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
3765
3766 # as-instr
3767 # Usage: cflags-y += $(call as-instr,instr,option1,option2)
3768
3769 as-instr = $(call try-run,\
3770 - printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
3771 + printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
3772
3773 # cc-option
3774 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
3775
3776 cc-option = $(call try-run,\
3777 - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2))
3778 + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
3779
3780 # cc-option-yn
3781 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
3782 cc-option-yn = $(call try-run,\
3783 - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n)
3784 + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
3785
3786 # cc-option-align
3787 # Prefix align with either -falign or -malign
3788 @@ -125,7 +125,7 @@ cc-option-align = $(subst -functions=0,,\
3789 # cc-disable-warning
3790 # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
3791 cc-disable-warning = $(call try-run,\
3792 - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
3793 + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
3794
3795 # cc-version
3796 # Usage gcc-ver := $(call cc-version)
3797 @@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
3798 # cc-ldoption
3799 # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
3800 cc-ldoption = $(call try-run,\
3801 - $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
3802 + $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
3803
3804 # ld-option
3805 # Usage: LDFLAGS += $(call ld-option, -X)
3806 @@ -209,7 +209,7 @@ endif
3807 # >$< substitution to preserve $ when reloading .cmd file
3808 # note: when using inline perl scripts [perl -e '...$$t=1;...']
3809 # in $(cmd_xxx) double $$ your perl vars
3810 -make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))
3811 +make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))))
3812
3813 # Find any prerequisites that is newer than target or that does not exist.
3814 # PHONY targets skipped in both cases.
3815 diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
3816 index 4d908d1..c3f69ae 100644
3817 --- a/scripts/Makefile.fwinst
3818 +++ b/scripts/Makefile.fwinst
3819 @@ -27,7 +27,7 @@ endif
3820 installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
3821
3822 installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
3823 -installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./
3824 +installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/.
3825
3826 # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
3827 PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
3828 @@ -42,7 +42,7 @@ quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
3829 $(installed-fw-dirs):
3830 $(call cmd,mkdir)
3831
3832 -$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
3833 +$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $$(dir $(INSTALL_FW_PATH)/%)
3834 $(call cmd,install)
3835
3836 PHONY += __fw_install __fw_modinst FORCE
3837 diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh
3838 index debecb5..7f2126d 100644
3839 --- a/scripts/gcc-version.sh
3840 +++ b/scripts/gcc-version.sh
3841 @@ -22,10 +22,10 @@ if [ ${#compiler} -eq 0 ]; then
3842 exit 1
3843 fi
3844
3845 -MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
3846 -MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
3847 +MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1)
3848 +MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1)
3849 if [ "x$with_patchlevel" != "x" ] ; then
3850 - PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1)
3851 + PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1)
3852 printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
3853 else
3854 printf "%02d%02d\\n" $MAJOR $MINOR
3855 diff --git a/scripts/gcc-x86_32-has-stack-protector.sh b/scripts/gcc-x86_32-has-stack-protector.sh
3856 index 29493dc..12dbd0b 100644
3857 --- a/scripts/gcc-x86_32-has-stack-protector.sh
3858 +++ b/scripts/gcc-x86_32-has-stack-protector.sh
3859 @@ -1,6 +1,6 @@
3860 #!/bin/sh
3861
3862 -echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
3863 +echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
3864 if [ "$?" -eq "0" ] ; then
3865 echo y
3866 else
3867 diff --git a/scripts/gcc-x86_64-has-stack-protector.sh b/scripts/gcc-x86_64-has-stack-protector.sh
3868 index afaec61..973e8c1 100644
3869 --- a/scripts/gcc-x86_64-has-stack-protector.sh
3870 +++ b/scripts/gcc-x86_64-has-stack-protector.sh
3871 @@ -1,6 +1,6 @@
3872 #!/bin/sh
3873
3874 -echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
3875 +echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
3876 if [ "$?" -eq "0" ] ; then
3877 echo y
3878 else
3879 diff --git a/scripts/kconfig/check.sh b/scripts/kconfig/check.sh
3880 index fa59cbf..854d9c7 100755
3881 --- a/scripts/kconfig/check.sh
3882 +++ b/scripts/kconfig/check.sh
3883 @@ -1,6 +1,6 @@
3884 #!/bin/sh
3885 # Needed for systems without gettext
3886 -$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
3887 +$* -x c -o /dev/null - > /dev/null 2>&1 << EOF
3888 #include <libintl.h>
3889 int main()
3890 {
3891 diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
3892 index e3b12c0..c8e8a71 100644
3893 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh
3894 +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
3895 @@ -38,7 +38,7 @@ trap "rm -f $tmp" 0 1 2 3 15
3896
3897 # Check if we can link to ncurses
3898 check() {
3899 - $cc -xc - -o $tmp 2>/dev/null <<'EOF'
3900 + $cc -x c - -o $tmp 2>/dev/null <<'EOF'
3901 #include CURSES_LOC
3902 main() {}
3903 EOF
3904 diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
3905 index 2fbbbc1..5eb3777 100644
3906 --- a/scripts/kconfig/streamline_config.pl
3907 +++ b/scripts/kconfig/streamline_config.pl
3908 @@ -605,6 +605,8 @@ foreach my $line (@config_file) {
3909 if (defined($configs{$1})) {
3910 if ($localyesconfig) {
3911 $setconfigs{$1} = 'y';
3912 + print "$1=y\n";
3913 + next;
3914 } else {
3915 $setconfigs{$1} = $2;
3916 }
3917 diff --git a/scripts/package/buildtar b/scripts/package/buildtar
3918 index 8a7b155..d0d748e 100644
3919 --- a/scripts/package/buildtar
3920 +++ b/scripts/package/buildtar
3921 @@ -109,7 +109,7 @@ esac
3922 if tar --owner=root --group=root --help >/dev/null 2>&1; then
3923 opts="--owner=root --group=root"
3924 fi
3925 - tar cf - . $opts | ${compress} > "${tarball}${file_ext}"
3926 + tar cf - boot/* lib/* $opts | ${compress} > "${tarball}${file_ext}"
3927 )
3928
3929 echo "Tarball successfully created in ${tarball}${file_ext}"
3930 diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
3931 index 5a34355..0fe6d64 100644
3932 --- a/sound/drivers/aloop.c
3933 +++ b/sound/drivers/aloop.c
3934 @@ -120,6 +120,7 @@ struct loopback_pcm {
3935 unsigned int last_drift;
3936 unsigned long last_jiffies;
3937 struct timer_list timer;
3938 + spinlock_t timer_lock;
3939 };
3940
3941 static struct platform_device *devices[SNDRV_CARDS];
3942 @@ -170,6 +171,7 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
3943 unsigned long tick;
3944 unsigned int rate_shift = get_rate_shift(dpcm);
3945
3946 + spin_lock(&dpcm->timer_lock);
3947 if (rate_shift != dpcm->pcm_rate_shift) {
3948 dpcm->pcm_rate_shift = rate_shift;
3949 dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size);
3950 @@ -182,12 +184,15 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
3951 tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
3952 dpcm->timer.expires = jiffies + tick;
3953 add_timer(&dpcm->timer);
3954 + spin_unlock(&dpcm->timer_lock);
3955 }
3956
3957 static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
3958 {
3959 + spin_lock(&dpcm->timer_lock);
3960 del_timer(&dpcm->timer);
3961 dpcm->timer.expires = 0;
3962 + spin_unlock(&dpcm->timer_lock);
3963 }
3964
3965 #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
3966 @@ -667,6 +672,7 @@ static int loopback_open(struct snd_pcm_substream *substream)
3967 dpcm->substream = substream;
3968 setup_timer(&dpcm->timer, loopback_timer_function,
3969 (unsigned long)dpcm);
3970 + spin_lock_init(&dpcm->timer_lock);
3971
3972 cable = loopback->cables[substream->number][dev];
3973 if (!cable) {
3974 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
3975 index 1c65cc5..38fdefc 100644
3976 --- a/sound/pci/hda/hda_codec.c
3977 +++ b/sound/pci/hda/hda_codec.c
3978 @@ -3580,7 +3580,7 @@ static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
3979 /*
3980 * call suspend and power-down; used both from PM and power-save
3981 */
3982 -static void hda_call_codec_suspend(struct hda_codec *codec)
3983 +static void hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
3984 {
3985 if (codec->patch_ops.suspend)
3986 codec->patch_ops.suspend(codec);
3987 @@ -3589,7 +3589,9 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
3988 codec->afg ? codec->afg : codec->mfg,
3989 AC_PWRST_D3);
3990 #ifdef CONFIG_SND_HDA_POWER_SAVE
3991 - cancel_delayed_work(&codec->power_work);
3992 + /* Cancel delayed work if we aren't currently running from it. */
3993 + if (!in_wq)
3994 + cancel_delayed_work_sync(&codec->power_work);
3995 spin_lock(&codec->power_lock);
3996 snd_hda_update_power_acct(codec);
3997 trace_hda_power_down(codec);
3998 @@ -4410,7 +4412,7 @@ static void hda_power_work(struct work_struct *work)
3999 }
4000 spin_unlock(&codec->power_lock);
4001
4002 - hda_call_codec_suspend(codec);
4003 + hda_call_codec_suspend(codec, true);
4004 if (bus->ops.pm_notify)
4005 bus->ops.pm_notify(bus);
4006 }
4007 @@ -5076,7 +5078,7 @@ int snd_hda_suspend(struct hda_bus *bus)
4008
4009 list_for_each_entry(codec, &bus->codec_list, list) {
4010 if (hda_codec_is_power_on(codec))
4011 - hda_call_codec_suspend(codec);
4012 + hda_call_codec_suspend(codec, false);
4013 }
4014 return 0;
4015 }
4016 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
4017 index c4763c5..12a9432 100644
4018 --- a/sound/pci/hda/hda_intel.c
4019 +++ b/sound/pci/hda/hda_intel.c
4020 @@ -538,6 +538,7 @@ enum {
4021 #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */
4022 #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */
4023 #define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */
4024 +#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
4025
4026 /* quirks for ATI SB / AMD Hudson */
4027 #define AZX_DCAPS_PRESET_ATI_SB \
4028 @@ -2120,6 +2121,27 @@ static unsigned int azx_get_position(struct azx *chip,
4029
4030 if (pos >= azx_dev->bufsize)
4031 pos = 0;
4032 +
4033 + /* calculate runtime delay from LPIB */
4034 + if (azx_dev->substream->runtime &&
4035 + chip->position_fix[stream] == POS_FIX_POSBUF &&
4036 + (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) {
4037 + unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB);
4038 + int delay;
4039 + if (stream == SNDRV_PCM_STREAM_PLAYBACK)
4040 + delay = pos - lpib_pos;
4041 + else
4042 + delay = lpib_pos - pos;
4043 + if (delay < 0)
4044 + delay += azx_dev->bufsize;
4045 + if (delay >= azx_dev->period_bytes) {
4046 + snd_printdd("delay %d > period_bytes %d\n",
4047 + delay, azx_dev->period_bytes);
4048 + delay = 0; /* something is wrong */
4049 + }
4050 + azx_dev->substream->runtime->delay =
4051 + bytes_to_frames(azx_dev->substream->runtime, delay);
4052 + }
4053 return pos;
4054 }
4055
4056 @@ -3260,7 +3282,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
4057 /* CPT */
4058 { PCI_DEVICE(0x8086, 0x1c20),
4059 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
4060 - AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
4061 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4062 /* PBG */
4063 { PCI_DEVICE(0x8086, 0x1d20),
4064 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
4065 @@ -3268,23 +3290,26 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
4066 /* Panther Point */
4067 { PCI_DEVICE(0x8086, 0x1e20),
4068 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
4069 - AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
4070 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4071 /* Lynx Point */
4072 { PCI_DEVICE(0x8086, 0x8c20),
4073 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
4074 - AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
4075 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4076 /* Lynx Point-LP */
4077 { PCI_DEVICE(0x8086, 0x9c20),
4078 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
4079 - AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
4080 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4081 /* Lynx Point-LP */
4082 { PCI_DEVICE(0x8086, 0x9c21),
4083 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
4084 - AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
4085 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4086 /* Haswell */
4087 { PCI_DEVICE(0x8086, 0x0c0c),
4088 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
4089 - AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
4090 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4091 + { PCI_DEVICE(0x8086, 0x0d0c),
4092 + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
4093 + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
4094 /* SCH */
4095 { PCI_DEVICE(0x8086, 0x811b),
4096 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
4097 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
4098 index 5e22a8f..784017e 100644
4099 --- a/sound/pci/hda/patch_conexant.c
4100 +++ b/sound/pci/hda/patch_conexant.c
4101 @@ -4462,6 +4462,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
4102 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
4103 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
4104 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
4105 + SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
4106 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
4107 {}
4108 };
4109 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4110 index 4f81dd4..56a3eef 100644
4111 --- a/sound/pci/hda/patch_realtek.c
4112 +++ b/sound/pci/hda/patch_realtek.c
4113 @@ -6334,6 +6334,12 @@ static int patch_alc269(struct hda_codec *codec)
4114
4115 spec = codec->spec;
4116
4117 + alc_pick_fixup(codec, alc269_fixup_models,
4118 + alc269_fixup_tbl, alc269_fixups);
4119 + alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4120 +
4121 + alc_auto_parse_customize_define(codec);
4122 +
4123 if (codec->vendor_id == 0x10ec0269) {
4124 spec->codec_variant = ALC269_TYPE_ALC269VA;
4125 switch (alc_get_coef0(codec) & 0x00f0) {
4126 @@ -6361,12 +6367,6 @@ static int patch_alc269(struct hda_codec *codec)
4127 alc269_fill_coef(codec);
4128 }
4129
4130 - alc_pick_fixup(codec, alc269_fixup_models,
4131 - alc269_fixup_tbl, alc269_fixups);
4132 - alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4133 -
4134 - alc_auto_parse_customize_define(codec);
4135 -
4136 /* automatic parse from the BIOS config */
4137 err = alc269_parse_auto_config(codec);
4138 if (err < 0)
4139 diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
4140 index 4307717..4b4072f 100644
4141 --- a/sound/pci/hda/patch_via.c
4142 +++ b/sound/pci/hda/patch_via.c
4143 @@ -1672,7 +1672,8 @@ static void via_hp_automute(struct hda_codec *codec)
4144 struct via_spec *spec = codec->spec;
4145
4146 if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] &&
4147 - (spec->codec_type != VT1708 || spec->vt1708_jack_detect))
4148 + (spec->codec_type != VT1708 || spec->vt1708_jack_detect) &&
4149 + is_jack_detectable(codec, spec->autocfg.hp_pins[0]))
4150 present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
4151
4152 if (spec->smart51_enabled)
4153 @@ -3669,6 +3670,32 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
4154 update_power_state(codec, 0x21, AC_PWRST_D3);
4155 }
4156
4157 +/*
4158 + * pin fix-up
4159 + */
4160 +enum {
4161 + VIA_FIXUP_INTMIC_BOOST,
4162 +};
4163 +
4164 +static void via_fixup_intmic_boost(struct hda_codec *codec,
4165 + const struct hda_fixup *fix, int action)
4166 +{
4167 + if (action == HDA_FIXUP_ACT_PRE_PROBE)
4168 + override_mic_boost(codec, 0x30, 0, 2, 40);
4169 +}
4170 +
4171 +static const struct hda_fixup via_fixups[] = {
4172 + [VIA_FIXUP_INTMIC_BOOST] = {
4173 + .type = HDA_FIXUP_FUNC,
4174 + .v.func = via_fixup_intmic_boost,
4175 + },
4176 +};
4177 +
4178 +static const struct snd_pci_quirk vt2002p_fixups[] = {
4179 + SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
4180 + {}
4181 +};
4182 +
4183 /* patch for vt2002P */
4184 static int patch_vt2002P(struct hda_codec *codec)
4185 {
4186 @@ -3685,6 +3712,9 @@ static int patch_vt2002P(struct hda_codec *codec)
4187 override_mic_boost(codec, 0x29, 0, 3, 40);
4188 add_secret_dac_path(codec);
4189
4190 + snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups);
4191 + snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4192 +
4193 /* automatic parse from the BIOS config */
4194 err = via_parse_auto_config(codec);
4195 if (err < 0) {
4196 diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
4197 index 01ebbcc..11dfc33 100644
4198 --- a/sound/soc/codecs/wm5110.c
4199 +++ b/sound/soc/codecs/wm5110.c
4200 @@ -869,6 +869,8 @@ static unsigned int wm5110_digital_vu[] = {
4201 ARIZONA_ADC_DIGITAL_VOLUME_2R,
4202 ARIZONA_ADC_DIGITAL_VOLUME_3L,
4203 ARIZONA_ADC_DIGITAL_VOLUME_3R,
4204 + ARIZONA_ADC_DIGITAL_VOLUME_4L,
4205 + ARIZONA_ADC_DIGITAL_VOLUME_4R,
4206
4207 ARIZONA_DAC_DIGITAL_VOLUME_1L,
4208 ARIZONA_DAC_DIGITAL_VOLUME_1R,
4209 @@ -880,6 +882,8 @@ static unsigned int wm5110_digital_vu[] = {
4210 ARIZONA_DAC_DIGITAL_VOLUME_4R,
4211 ARIZONA_DAC_DIGITAL_VOLUME_5L,
4212 ARIZONA_DAC_DIGITAL_VOLUME_5R,
4213 + ARIZONA_DAC_DIGITAL_VOLUME_6L,
4214 + ARIZONA_DAC_DIGITAL_VOLUME_6R,
4215 };
4216
4217 static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
4218 diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
4219 index c6d2076..c9516f0 100644
4220 --- a/sound/soc/codecs/wm9712.c
4221 +++ b/sound/soc/codecs/wm9712.c
4222 @@ -146,7 +146,7 @@ SOC_SINGLE("Playback Attenuate (-6dB) Switch", AC97_MASTER_TONE, 6, 1, 0),
4223 SOC_SINGLE("Bass Volume", AC97_MASTER_TONE, 8, 15, 1),
4224 SOC_SINGLE("Treble Volume", AC97_MASTER_TONE, 0, 15, 1),
4225
4226 -SOC_SINGLE("Capture ADC Switch", AC97_REC_GAIN, 15, 1, 1),
4227 +SOC_SINGLE("Capture Switch", AC97_REC_GAIN, 15, 1, 1),
4228 SOC_ENUM("Capture Volume Steps", wm9712_enum[6]),
4229 SOC_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 63, 0),
4230 SOC_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0),
4231 diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
4232 index 61baa48..57b27ef 100644
4233 --- a/sound/soc/codecs/wm_hubs.c
4234 +++ b/sound/soc/codecs/wm_hubs.c
4235 @@ -634,6 +634,11 @@ void wm_hubs_update_class_w(struct snd_soc_codec *codec)
4236
4237 snd_soc_update_bits(codec, WM8993_CLASS_W_0,
4238 WM8993_CP_DYN_V | WM8993_CP_DYN_FREQ, enable);
4239 +
4240 + snd_soc_write(codec, WM8993_LEFT_OUTPUT_VOLUME,
4241 + snd_soc_read(codec, WM8993_LEFT_OUTPUT_VOLUME));
4242 + snd_soc_write(codec, WM8993_RIGHT_OUTPUT_VOLUME,
4243 + snd_soc_read(codec, WM8993_RIGHT_OUTPUT_VOLUME));
4244 }
4245 EXPORT_SYMBOL_GPL(wm_hubs_update_class_w);
4246
4247 diff --git a/sound/usb/card.h b/sound/usb/card.h
4248 index 2b9ffff..d9d2b5a 100644
4249 --- a/sound/usb/card.h
4250 +++ b/sound/usb/card.h
4251 @@ -92,6 +92,8 @@ struct snd_usb_endpoint {
4252 unsigned char silence_value;
4253 unsigned int stride;
4254 int iface, alt_idx;
4255 + int skip_packets; /* quirks for devices to ignore the first n packets
4256 + in a stream */
4257
4258 spinlock_t lock;
4259 struct list_head list;
4260 diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
4261 index 060dccb..d9de667 100644
4262 --- a/sound/usb/endpoint.c
4263 +++ b/sound/usb/endpoint.c
4264 @@ -31,6 +31,7 @@
4265 #include "card.h"
4266 #include "endpoint.h"
4267 #include "pcm.h"
4268 +#include "quirks.h"
4269
4270 #define EP_FLAG_ACTIVATED 0
4271 #define EP_FLAG_RUNNING 1
4272 @@ -170,6 +171,11 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep,
4273 {
4274 struct urb *urb = urb_ctx->urb;
4275
4276 + if (unlikely(ep->skip_packets > 0)) {
4277 + ep->skip_packets--;
4278 + return;
4279 + }
4280 +
4281 if (ep->sync_slave)
4282 snd_usb_handle_sync_urb(ep->sync_slave, ep, urb);
4283
4284 @@ -828,6 +834,8 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep)
4285 ep->unlink_mask = 0;
4286 ep->phase = 0;
4287
4288 + snd_usb_endpoint_start_quirk(ep);
4289 +
4290 /*
4291 * If this endpoint has a data endpoint as implicit feedback source,
4292 * don't start the urbs here. Instead, mark them all as available,
4293 diff --git a/sound/usb/helper.c b/sound/usb/helper.c
4294 index 9eed8f4..c1db28f 100644
4295 --- a/sound/usb/helper.c
4296 +++ b/sound/usb/helper.c
4297 @@ -21,6 +21,7 @@
4298
4299 #include "usbaudio.h"
4300 #include "helper.h"
4301 +#include "quirks.h"
4302
4303 /*
4304 * combine bytes and get an integer value
4305 @@ -97,6 +98,10 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
4306 memcpy(data, buf, size);
4307 kfree(buf);
4308 }
4309 +
4310 + snd_usb_ctl_msg_quirk(dev, pipe, request, requesttype,
4311 + value, index, data, size);
4312 +
4313 return err;
4314 }
4315
4316 diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
4317 index 4f40ba8..fe56c9d 100644
4318 --- a/sound/usb/mixer.c
4319 +++ b/sound/usb/mixer.c
4320 @@ -1267,6 +1267,13 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
4321 /* disable non-functional volume control */
4322 master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME);
4323 break;
4324 + case USB_ID(0x1130, 0xf211):
4325 + snd_printk(KERN_INFO
4326 + "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n");
4327 + /* disable non-functional volume control */
4328 + channels = 0;
4329 + break;
4330 +
4331 }
4332 if (channels > 0)
4333 first_ch_bits = snd_usb_combine_bytes(bmaControls + csize, csize);
4334 diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
4335 index 79780fa..d73ac9b 100644
4336 --- a/sound/usb/quirks-table.h
4337 +++ b/sound/usb/quirks-table.h
4338 @@ -2781,6 +2781,59 @@ YAMAHA_DEVICE(0x7010, "UB99"),
4339 }
4340 },
4341
4342 +/* Microsoft XboxLive Headset/Xbox Communicator */
4343 +{
4344 + USB_DEVICE(0x045e, 0x0283),
4345 + .bInterfaceClass = USB_CLASS_PER_INTERFACE,
4346 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
4347 + .vendor_name = "Microsoft",
4348 + .product_name = "XboxLive Headset/Xbox Communicator",
4349 + .ifnum = QUIRK_ANY_INTERFACE,
4350 + .type = QUIRK_COMPOSITE,
4351 + .data = &(const struct snd_usb_audio_quirk[]) {
4352 + {
4353 + /* playback */
4354 + .ifnum = 0,
4355 + .type = QUIRK_AUDIO_FIXED_ENDPOINT,
4356 + .data = &(const struct audioformat) {
4357 + .formats = SNDRV_PCM_FMTBIT_S16_LE,
4358 + .channels = 1,
4359 + .iface = 0,
4360 + .altsetting = 0,
4361 + .altset_idx = 0,
4362 + .attributes = 0,
4363 + .endpoint = 0x04,
4364 + .ep_attr = 0x05,
4365 + .rates = SNDRV_PCM_RATE_CONTINUOUS,
4366 + .rate_min = 22050,
4367 + .rate_max = 22050
4368 + }
4369 + },
4370 + {
4371 + /* capture */
4372 + .ifnum = 1,
4373 + .type = QUIRK_AUDIO_FIXED_ENDPOINT,
4374 + .data = &(const struct audioformat) {
4375 + .formats = SNDRV_PCM_FMTBIT_S16_LE,
4376 + .channels = 1,
4377 + .iface = 1,
4378 + .altsetting = 0,
4379 + .altset_idx = 0,
4380 + .attributes = 0,
4381 + .endpoint = 0x85,
4382 + .ep_attr = 0x05,
4383 + .rates = SNDRV_PCM_RATE_CONTINUOUS,
4384 + .rate_min = 16000,
4385 + .rate_max = 16000
4386 + }
4387 + },
4388 + {
4389 + .ifnum = -1
4390 + }
4391 + }
4392 + }
4393 +},
4394 +
4395 {
4396 /*
4397 * Some USB MIDI devices don't have an audio control interface,
4398 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
4399 index 2781726..0f58b4b 100644
4400 --- a/sound/usb/quirks.c
4401 +++ b/sound/usb/quirks.c
4402 @@ -761,3 +761,27 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
4403 }
4404 }
4405
4406 +void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
4407 +{
4408 + /*
4409 + * "Playback Design" products send bogus feedback data at the start
4410 + * of the stream. Ignore them.
4411 + */
4412 + if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&
4413 + ep->type == SND_USB_ENDPOINT_TYPE_SYNC)
4414 + ep->skip_packets = 4;
4415 +}
4416 +
4417 +void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
4418 + __u8 request, __u8 requesttype, __u16 value,
4419 + __u16 index, void *data, __u16 size)
4420 +{
4421 + /*
4422 + * "Playback Design" products need a 20ms delay after each
4423 + * class compliant request
4424 + */
4425 + if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
4426 + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
4427 + mdelay(20);
4428 +}
4429 +
4430 diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
4431 index 03e5e94..0ca9e91 100644
4432 --- a/sound/usb/quirks.h
4433 +++ b/sound/usb/quirks.h
4434 @@ -1,6 +1,10 @@
4435 #ifndef __USBAUDIO_QUIRKS_H
4436 #define __USBAUDIO_QUIRKS_H
4437
4438 +struct audioformat;
4439 +struct snd_usb_endpoint;
4440 +struct snd_usb_substream;
4441 +
4442 int snd_usb_create_quirk(struct snd_usb_audio *chip,
4443 struct usb_interface *iface,
4444 struct usb_driver *driver,
4445 @@ -20,4 +24,10 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
4446 int snd_usb_is_big_endian_format(struct snd_usb_audio *chip,
4447 struct audioformat *fp);
4448
4449 +void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep);
4450 +
4451 +void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
4452 + __u8 request, __u8 requesttype, __u16 value,
4453 + __u16 index, void *data, __u16 size);
4454 +
4455 #endif /* __USBAUDIO_QUIRKS_H */
4456 diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
4457 index f759f4f..fd2f922 100644
4458 --- a/tools/lguest/lguest.c
4459 +++ b/tools/lguest/lguest.c
4460 @@ -1299,6 +1299,7 @@ static struct device *new_device(const char *name, u16 type)
4461 dev->feature_len = 0;
4462 dev->num_vq = 0;
4463 dev->running = false;
4464 + dev->next = NULL;
4465
4466 /*
4467 * Append to device list. Prepending to a single-linked list is
4468 diff --git a/tools/perf/Makefile b/tools/perf/Makefile
4469 index 35655c3..3657ab0 100644
4470 --- a/tools/perf/Makefile
4471 +++ b/tools/perf/Makefile
4472 @@ -62,7 +62,7 @@ ifeq ($(ARCH),x86_64)
4473 ARCH := x86
4474 IS_X86_64 := 0
4475 ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
4476 - IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
4477 + IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
4478 endif
4479 ifeq (${IS_X86_64}, 1)
4480 RAW_ARCH := x86_64
4481 diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
4482 index a93e06c..cf397bd 100644
4483 --- a/tools/power/cpupower/Makefile
4484 +++ b/tools/power/cpupower/Makefile
4485 @@ -111,7 +111,7 @@ GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo;
4486 export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
4487
4488 # check if compiler option is supported
4489 -cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
4490 +cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
4491
4492 # use '-Os' optimization if available, else use -O2
4493 OPTIMIZATION := $(call cc-supports,-Os,-O2)

  ViewVC Help
Powered by ViewVC 1.1.20