/[linux-patches]/hardened/2.6/trunk/2.6.28/1007_linux-2.6.28.8.patch
Gentoo

Contents of /hardened/2.6/trunk/2.6.28/1007_linux-2.6.28.8.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1519 - (show annotations) (download)
Wed Mar 18 19:25:21 2009 UTC (5 years, 3 months ago) by gengor
File size: 140281 byte(s)
Update 2.6.28 hardened-extras trunk/
1 diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
2 index e88d417..c7fc01e 100644
3 --- a/arch/arm/mach-rpc/riscpc.c
4 +++ b/arch/arm/mach-rpc/riscpc.c
5 @@ -19,6 +19,7 @@
6 #include <linux/serial_8250.h>
7 #include <linux/ata_platform.h>
8 #include <linux/io.h>
9 +#include <linux/i2c.h>
10
11 #include <asm/elf.h>
12 #include <asm/mach-types.h>
13 @@ -201,8 +202,13 @@ static struct platform_device *devs[] __initdata = {
14 &pata_device,
15 };
16
17 +static struct i2c_board_info i2c_rtc = {
18 + I2C_BOARD_INFO("pcf8583", 0x50)
19 +};
20 +
21 static int __init rpc_init(void)
22 {
23 + i2c_register_board_info(0, &i2c_rtc, 1);
24 return platform_add_devices(devs, ARRAY_SIZE(devs));
25 }
26
27 diff --git a/arch/ia64/include/asm/mmzone.h b/arch/ia64/include/asm/mmzone.h
28 index 34efe88..f2ca320 100644
29 --- a/arch/ia64/include/asm/mmzone.h
30 +++ b/arch/ia64/include/asm/mmzone.h
31 @@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned long pfn)
32 #endif
33 }
34
35 -#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
36 -extern int early_pfn_to_nid(unsigned long pfn);
37 -#endif
38 -
39 #ifdef CONFIG_IA64_DIG /* DIG systems are small */
40 # define MAX_PHYSNODE_ID 8
41 # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8)
42 diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
43 index b73bf18..3efea7d 100644
44 --- a/arch/ia64/mm/numa.c
45 +++ b/arch/ia64/mm/numa.c
46 @@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr)
47 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
48 * the section resides.
49 */
50 -int early_pfn_to_nid(unsigned long pfn)
51 +int __meminit __early_pfn_to_nid(unsigned long pfn)
52 {
53 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
54
55 @@ -70,7 +70,7 @@ int early_pfn_to_nid(unsigned long pfn)
56 return node_memblk[i].nid;
57 }
58
59 - return 0;
60 + return -1;
61 }
62
63 #ifdef CONFIG_MEMORY_HOTPLUG
64 diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
65 index ac5d541..6c5b409 100644
66 --- a/arch/mips/include/asm/compat.h
67 +++ b/arch/mips/include/asm/compat.h
68 @@ -3,6 +3,8 @@
69 /*
70 * Architecture specific compatibility types
71 */
72 +#include <linux/seccomp.h>
73 +#include <linux/thread_info.h>
74 #include <linux/types.h>
75 #include <asm/page.h>
76 #include <asm/ptrace.h>
77 @@ -218,4 +220,9 @@ struct compat_shmid64_ds {
78 compat_ulong_t __unused2;
79 };
80
81 +static inline int is_compat_task(void)
82 +{
83 + return test_thread_flag(TIF_32BIT);
84 +}
85 +
86 #endif /* _ASM_COMPAT_H */
87 diff --git a/arch/mips/include/asm/seccomp.h b/arch/mips/include/asm/seccomp.h
88 index 36ed440..a6772e9 100644
89 --- a/arch/mips/include/asm/seccomp.h
90 +++ b/arch/mips/include/asm/seccomp.h
91 @@ -1,6 +1,5 @@
92 #ifndef __ASM_SECCOMP_H
93
94 -#include <linux/thread_info.h>
95 #include <linux/unistd.h>
96
97 #define __NR_seccomp_read __NR_read
98 diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
99 index d811a8c..4774c2f 100644
100 --- a/arch/powerpc/include/asm/compat.h
101 +++ b/arch/powerpc/include/asm/compat.h
102 @@ -210,5 +210,10 @@ struct compat_shmid64_ds {
103 compat_ulong_t __unused6;
104 };
105
106 +static inline int is_compat_task(void)
107 +{
108 + return test_thread_flag(TIF_32BIT);
109 +}
110 +
111 #endif /* __KERNEL__ */
112 #endif /* _ASM_POWERPC_COMPAT_H */
113 diff --git a/arch/powerpc/include/asm/seccomp.h b/arch/powerpc/include/asm/seccomp.h
114 index 853765e..00c1d91 100644
115 --- a/arch/powerpc/include/asm/seccomp.h
116 +++ b/arch/powerpc/include/asm/seccomp.h
117 @@ -1,10 +1,6 @@
118 #ifndef _ASM_POWERPC_SECCOMP_H
119 #define _ASM_POWERPC_SECCOMP_H
120
121 -#ifdef __KERNEL__
122 -#include <linux/thread_info.h>
123 -#endif
124 -
125 #include <linux/unistd.h>
126
127 #define __NR_seccomp_read __NR_read
128 diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
129 index ada0692..73cb6a3 100644
130 --- a/arch/powerpc/kernel/align.c
131 +++ b/arch/powerpc/kernel/align.c
132 @@ -367,27 +367,24 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
133 static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg,
134 unsigned int flags)
135 {
136 - char *ptr = (char *) &current->thread.TS_FPR(reg);
137 - int i, ret;
138 + char *ptr0 = (char *) &current->thread.TS_FPR(reg);
139 + char *ptr1 = (char *) &current->thread.TS_FPR(reg+1);
140 + int i, ret, sw = 0;
141
142 if (!(flags & F))
143 return 0;
144 if (reg & 1)
145 return 0; /* invalid form: FRS/FRT must be even */
146 - if (!(flags & SW)) {
147 - /* not byte-swapped - easy */
148 - if (!(flags & ST))
149 - ret = __copy_from_user(ptr, addr, 16);
150 - else
151 - ret = __copy_to_user(addr, ptr, 16);
152 - } else {
153 - /* each FPR value is byte-swapped separately */
154 - ret = 0;
155 - for (i = 0; i < 16; ++i) {
156 - if (!(flags & ST))
157 - ret |= __get_user(ptr[i^7], addr + i);
158 - else
159 - ret |= __put_user(ptr[i^7], addr + i);
160 + if (flags & SW)
161 + sw = 7;
162 + ret = 0;
163 + for (i = 0; i < 8; ++i) {
164 + if (!(flags & ST)) {
165 + ret |= __get_user(ptr0[i^sw], addr + i);
166 + ret |= __get_user(ptr1[i^sw], addr + i + 8);
167 + } else {
168 + ret |= __put_user(ptr0[i^sw], addr + i);
169 + ret |= __put_user(ptr1[i^sw], addr + i + 8);
170 }
171 }
172 if (ret)
173 diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
174 index f260b58..0e70625 100644
175 --- a/arch/sparc/include/asm/compat.h
176 +++ b/arch/sparc/include/asm/compat.h
177 @@ -240,4 +240,9 @@ struct compat_shmid64_ds {
178 unsigned int __unused2;
179 };
180
181 +static inline int is_compat_task(void)
182 +{
183 + return test_thread_flag(TIF_32BIT);
184 +}
185 +
186 #endif /* _ASM_SPARC64_COMPAT_H */
187 diff --git a/arch/sparc/include/asm/seccomp.h b/arch/sparc/include/asm/seccomp.h
188 index 7fcd996..adca1bc 100644
189 --- a/arch/sparc/include/asm/seccomp.h
190 +++ b/arch/sparc/include/asm/seccomp.h
191 @@ -1,11 +1,5 @@
192 #ifndef _ASM_SECCOMP_H
193
194 -#include <linux/thread_info.h> /* already defines TIF_32BIT */
195 -
196 -#ifndef TIF_32BIT
197 -#error "unexpected TIF_32BIT on sparc64"
198 -#endif
199 -
200 #include <linux/unistd.h>
201
202 #define __NR_seccomp_read __NR_read
203 diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c
204 index 3b9f4d6..e1a9598 100644
205 --- a/arch/sparc64/kernel/chmc.c
206 +++ b/arch/sparc64/kernel/chmc.c
207 @@ -306,6 +306,7 @@ static int jbusmc_print_dimm(int syndrome_code,
208 buf[1] = '?';
209 buf[2] = '?';
210 buf[3] = '\0';
211 + return 0;
212 }
213 p = dp->controller;
214 prop = &p->layout;
215 diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
216 index 81ccd22..356e80b 100644
217 --- a/arch/sparc64/kernel/traps.c
218 +++ b/arch/sparc64/kernel/traps.c
219 @@ -1,6 +1,6 @@
220 /* arch/sparc64/kernel/traps.c
221 *
222 - * Copyright (C) 1995,1997,2008 David S. Miller (davem@davemloft.net)
223 + * Copyright (C) 1995,1997,2008,2009 David S. Miller (davem@davemloft.net)
224 * Copyright (C) 1997,1999,2000 Jakub Jelinek (jakub@redhat.com)
225 */
226
227 @@ -313,6 +313,21 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
228 return;
229
230 if (regs->tstate & TSTATE_PRIV) {
231 + /* Test if this comes from uaccess places. */
232 + const struct exception_table_entry *entry;
233 +
234 + entry = search_exception_tables(regs->tpc);
235 + if (entry) {
236 + /* Ouch, somebody is trying VM hole tricks on us... */
237 +#ifdef DEBUG_EXCEPTIONS
238 + printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc);
239 + printk("EX_TABLE: insn<%016lx> fixup<%016lx>\n",
240 + regs->tpc, entry->fixup);
241 +#endif
242 + regs->tpc = entry->fixup;
243 + regs->tnpc = regs->tpc + 4;
244 + return;
245 + }
246 printk("sun4v_data_access_exception: ADDR[%016lx] "
247 "CTX[%04x] TYPE[%04x], going.\n",
248 addr, ctx, type);
249 diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
250 index 256b00b..5a0d76d 100644
251 --- a/arch/x86/ia32/ia32entry.S
252 +++ b/arch/x86/ia32/ia32entry.S
253 @@ -418,9 +418,9 @@ ENTRY(ia32_syscall)
254 orl $TS_COMPAT,TI_status(%r10)
255 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
256 jnz ia32_tracesys
257 -ia32_do_syscall:
258 cmpl $(IA32_NR_syscalls-1),%eax
259 - ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
260 + ja ia32_badsys
261 +ia32_do_call:
262 IA32_ARG_FIXUP
263 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
264 ia32_sysret:
265 @@ -435,7 +435,9 @@ ia32_tracesys:
266 call syscall_trace_enter
267 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
268 RESTORE_REST
269 - jmp ia32_do_syscall
270 + cmpl $(IA32_NR_syscalls-1),%eax
271 + ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
272 + jmp ia32_do_call
273 END(ia32_syscall)
274
275 ia32_badsys:
276 diff --git a/arch/x86/include/asm/math_emu.h b/arch/x86/include/asm/math_emu.h
277 index 5a65b10..031f626 100644
278 --- a/arch/x86/include/asm/math_emu.h
279 +++ b/arch/x86/include/asm/math_emu.h
280 @@ -1,31 +1,18 @@
281 #ifndef _ASM_X86_MATH_EMU_H
282 #define _ASM_X86_MATH_EMU_H
283
284 +#include <asm/ptrace.h>
285 +#include <asm/vm86.h>
286 +
287 /* This structure matches the layout of the data saved to the stack
288 following a device-not-present interrupt, part of it saved
289 automatically by the 80386/80486.
290 */
291 -struct info {
292 +struct math_emu_info {
293 long ___orig_eip;
294 - long ___ebx;
295 - long ___ecx;
296 - long ___edx;
297 - long ___esi;
298 - long ___edi;
299 - long ___ebp;
300 - long ___eax;
301 - long ___ds;
302 - long ___es;
303 - long ___fs;
304 - long ___orig_eax;
305 - long ___eip;
306 - long ___cs;
307 - long ___eflags;
308 - long ___esp;
309 - long ___ss;
310 - long ___vm86_es; /* This and the following only in vm86 mode */
311 - long ___vm86_ds;
312 - long ___vm86_fs;
313 - long ___vm86_gs;
314 + union {
315 + struct pt_regs *regs;
316 + struct kernel_vm86_regs *vm86;
317 + };
318 };
319 #endif /* _ASM_X86_MATH_EMU_H */
320 diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
321 index 07f1af4..105fb90 100644
322 --- a/arch/x86/include/asm/mmzone_32.h
323 +++ b/arch/x86/include/asm/mmzone_32.h
324 @@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void)
325 get_memcfg_numa_flat();
326 }
327
328 -extern int early_pfn_to_nid(unsigned long pfn);
329 -
330 extern void resume_map_numa_kva(pgd_t *pgd);
331
332 #else /* !CONFIG_NUMA */
333 diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h
334 index a5b3817..a29f48c 100644
335 --- a/arch/x86/include/asm/mmzone_64.h
336 +++ b/arch/x86/include/asm/mmzone_64.h
337 @@ -40,8 +40,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
338 #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
339 NODE_DATA(nid)->node_spanned_pages)
340
341 -extern int early_pfn_to_nid(unsigned long pfn);
342 -
343 #ifdef CONFIG_NUMA_EMU
344 #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024)
345 #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
346 diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
347 index ba3e2ff..a660ece 100644
348 --- a/arch/x86/include/asm/paravirt.h
349 +++ b/arch/x86/include/asm/paravirt.h
350 @@ -1352,14 +1352,7 @@ static inline void arch_leave_lazy_cpu_mode(void)
351 PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave);
352 }
353
354 -static inline void arch_flush_lazy_cpu_mode(void)
355 -{
356 - if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)) {
357 - arch_leave_lazy_cpu_mode();
358 - arch_enter_lazy_cpu_mode();
359 - }
360 -}
361 -
362 +void arch_flush_lazy_cpu_mode(void);
363
364 #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
365 static inline void arch_enter_lazy_mmu_mode(void)
366 @@ -1372,13 +1365,7 @@ static inline void arch_leave_lazy_mmu_mode(void)
367 PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave);
368 }
369
370 -static inline void arch_flush_lazy_mmu_mode(void)
371 -{
372 - if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) {
373 - arch_leave_lazy_mmu_mode();
374 - arch_enter_lazy_mmu_mode();
375 - }
376 -}
377 +void arch_flush_lazy_mmu_mode(void);
378
379 static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
380 unsigned long phys, pgprot_t flags)
381 diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
382 index 5ca01e3..06d6f30 100644
383 --- a/arch/x86/include/asm/processor.h
384 +++ b/arch/x86/include/asm/processor.h
385 @@ -349,7 +349,7 @@ struct i387_soft_struct {
386 u8 no_update;
387 u8 rm;
388 u8 alimit;
389 - struct info *info;
390 + struct math_emu_info *info;
391 u32 entry_eip;
392 };
393
394 diff --git a/arch/x86/include/asm/seccomp_32.h b/arch/x86/include/asm/seccomp_32.h
395 index a6ad87b..b811d6f 100644
396 --- a/arch/x86/include/asm/seccomp_32.h
397 +++ b/arch/x86/include/asm/seccomp_32.h
398 @@ -1,12 +1,6 @@
399 #ifndef _ASM_X86_SECCOMP_32_H
400 #define _ASM_X86_SECCOMP_32_H
401
402 -#include <linux/thread_info.h>
403 -
404 -#ifdef TIF_32BIT
405 -#error "unexpected TIF_32BIT on i386"
406 -#endif
407 -
408 #include <linux/unistd.h>
409
410 #define __NR_seccomp_read __NR_read
411 diff --git a/arch/x86/include/asm/seccomp_64.h b/arch/x86/include/asm/seccomp_64.h
412 index 4171bb7..84ec1bd 100644
413 --- a/arch/x86/include/asm/seccomp_64.h
414 +++ b/arch/x86/include/asm/seccomp_64.h
415 @@ -1,14 +1,6 @@
416 #ifndef _ASM_X86_SECCOMP_64_H
417 #define _ASM_X86_SECCOMP_64_H
418
419 -#include <linux/thread_info.h>
420 -
421 -#ifdef TIF_32BIT
422 -#error "unexpected TIF_32BIT on x86_64"
423 -#else
424 -#define TIF_32BIT TIF_IA32
425 -#endif
426 -
427 #include <linux/unistd.h>
428 #include <asm/ia32_unistd.h>
429
430 diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
431 index 45dee28..6941aa7 100644
432 --- a/arch/x86/include/asm/traps.h
433 +++ b/arch/x86/include/asm/traps.h
434 @@ -41,7 +41,7 @@ dotraplinkage void do_int3(struct pt_regs *, long);
435 dotraplinkage void do_overflow(struct pt_regs *, long);
436 dotraplinkage void do_bounds(struct pt_regs *, long);
437 dotraplinkage void do_invalid_op(struct pt_regs *, long);
438 -dotraplinkage void do_device_not_available(struct pt_regs *, long);
439 +dotraplinkage void do_device_not_available(struct pt_regs);
440 dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long);
441 dotraplinkage void do_invalid_TSS(struct pt_regs *, long);
442 dotraplinkage void do_segment_not_present(struct pt_regs *, long);
443 @@ -74,8 +74,8 @@ extern int kstack_depth_to_print;
444
445 #ifdef CONFIG_X86_32
446 void math_error(void __user *);
447 +void math_emulate(struct math_emu_info *);
448 unsigned long patch_espfix_desc(unsigned long, unsigned long);
449 -asmlinkage void math_emulate(long);
450 #endif
451
452 #endif /* _ASM_X86_TRAPS_H */
453 diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
454 index c78c048..18f41b5 100644
455 --- a/arch/x86/kernel/cpu/mtrr/main.c
456 +++ b/arch/x86/kernel/cpu/mtrr/main.c
457 @@ -1600,8 +1600,7 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
458
459 /* kvm/qemu doesn't have mtrr set right, don't trim them all */
460 if (!highest_pfn) {
461 - WARN(!kvm_para_available(), KERN_WARNING
462 - "WARNING: strange, CPU MTRRs all blank?\n");
463 + printk(KERN_INFO "CPU MTRRs all blank - virtualized system.\n");
464 return 0;
465 }
466
467 diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
468 index 067d8de..d82891c 100644
469 --- a/arch/x86/kernel/hpet.c
470 +++ b/arch/x86/kernel/hpet.c
471 @@ -267,6 +267,8 @@ static void hpet_set_mode(enum clock_event_mode mode,
472 now = hpet_readl(HPET_COUNTER);
473 cmp = now + (unsigned long) delta;
474 cfg = hpet_readl(HPET_Tn_CFG(timer));
475 + /* Make sure we use edge triggered interrupts */
476 + cfg &= ~HPET_TN_LEVEL;
477 cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
478 HPET_TN_SETVAL | HPET_TN_32BIT;
479 hpet_writel(cfg, HPET_Tn_CFG(timer));
480 diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
481 index e4c8fb6..dcba6c5 100644
482 --- a/arch/x86/kernel/paravirt.c
483 +++ b/arch/x86/kernel/paravirt.c
484 @@ -268,6 +268,30 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
485 return __get_cpu_var(paravirt_lazy_mode);
486 }
487
488 +void arch_flush_lazy_mmu_mode(void)
489 +{
490 + preempt_disable();
491 +
492 + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
493 + arch_leave_lazy_mmu_mode();
494 + arch_enter_lazy_mmu_mode();
495 + }
496 +
497 + preempt_enable();
498 +}
499 +
500 +void arch_flush_lazy_cpu_mode(void)
501 +{
502 + preempt_disable();
503 +
504 + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) {
505 + arch_leave_lazy_cpu_mode();
506 + arch_enter_lazy_cpu_mode();
507 + }
508 +
509 + preempt_enable();
510 +}
511 +
512 struct pv_info pv_info = {
513 .name = "bare hardware",
514 .paravirt_enabled = 0,
515 diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
516 index 0a6d8c1..17fde52 100644
517 --- a/arch/x86/kernel/ptrace.c
518 +++ b/arch/x86/kernel/ptrace.c
519 @@ -1512,7 +1512,7 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
520 #ifdef CONFIG_X86_32
521 # define IS_IA32 1
522 #elif defined CONFIG_IA32_EMULATION
523 -# define IS_IA32 test_thread_flag(TIF_IA32)
524 +# define IS_IA32 is_compat_task()
525 #else
526 # define IS_IA32 0
527 #endif
528 diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
529 index cc5a254..4e0afee 100644
530 --- a/arch/x86/kernel/reboot.c
531 +++ b/arch/x86/kernel/reboot.c
532 @@ -202,6 +202,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
533 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"),
534 },
535 },
536 + { /* Handle problems with rebooting on Dell XPS710 */
537 + .callback = set_bios_reboot,
538 + .ident = "Dell XPS710",
539 + .matches = {
540 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
541 + DMI_MATCH(DMI_PRODUCT_NAME, "Dell XPS710"),
542 + },
543 + },
544 { }
545 };
546
547 diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
548 index 662f1b4..70bdbb5 100644
549 --- a/arch/x86/kernel/traps.c
550 +++ b/arch/x86/kernel/traps.c
551 @@ -912,7 +912,7 @@ asmlinkage void math_state_restore(void)
552 EXPORT_SYMBOL_GPL(math_state_restore);
553
554 #ifndef CONFIG_MATH_EMULATION
555 -asmlinkage void math_emulate(long arg)
556 +void math_emulate(struct math_emu_info *info)
557 {
558 printk(KERN_EMERG
559 "math-emulation not enabled and no coprocessor found.\n");
560 @@ -922,16 +922,19 @@ asmlinkage void math_emulate(long arg)
561 }
562 #endif /* CONFIG_MATH_EMULATION */
563
564 -dotraplinkage void __kprobes
565 -do_device_not_available(struct pt_regs *regs, long error)
566 +dotraplinkage void __kprobes do_device_not_available(struct pt_regs regs)
567 {
568 #ifdef CONFIG_X86_32
569 if (read_cr0() & X86_CR0_EM) {
570 - conditional_sti(regs);
571 - math_emulate(0);
572 + struct math_emu_info info = { };
573 +
574 + conditional_sti(&regs);
575 +
576 + info.regs = &regs;
577 + math_emulate(&info);
578 } else {
579 math_state_restore(); /* interrupts still off */
580 - conditional_sti(regs);
581 + conditional_sti(&regs);
582 }
583 #else
584 math_state_restore();
585 diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
586 index 254ee07..8f92321 100644
587 --- a/arch/x86/kernel/vmiclock_32.c
588 +++ b/arch/x86/kernel/vmiclock_32.c
589 @@ -283,10 +283,13 @@ void __devinit vmi_time_ap_init(void)
590 #endif
591
592 /** vmi clocksource */
593 +static struct clocksource clocksource_vmi;
594
595 static cycle_t read_real_cycles(void)
596 {
597 - return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
598 + cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
599 + return ret >= clocksource_vmi.cycle_last ?
600 + ret : clocksource_vmi.cycle_last;
601 }
602
603 static struct clocksource clocksource_vmi = {
604 diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c
605 index c7b06fe..5d87f58 100644
606 --- a/arch/x86/math-emu/fpu_entry.c
607 +++ b/arch/x86/math-emu/fpu_entry.c
608 @@ -131,7 +131,7 @@ u_char emulating = 0;
609 static int valid_prefix(u_char *Byte, u_char __user ** fpu_eip,
610 overrides * override);
611
612 -asmlinkage void math_emulate(long arg)
613 +void math_emulate(struct math_emu_info *info)
614 {
615 u_char FPU_modrm, byte1;
616 unsigned short code;
617 @@ -161,7 +161,7 @@ asmlinkage void math_emulate(long arg)
618 RE_ENTRANT_CHECK_ON;
619 #endif /* RE_ENTRANT_CHECKING */
620
621 - SETUP_DATA_AREA(arg);
622 + FPU_info = info;
623
624 FPU_ORIG_EIP = FPU_EIP;
625
626 @@ -659,7 +659,7 @@ static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
627 }
628 }
629
630 -void math_abort(struct info *info, unsigned int signal)
631 +void math_abort(struct math_emu_info *info, unsigned int signal)
632 {
633 FPU_EIP = FPU_ORIG_EIP;
634 current->thread.trap_no = 16;
635 diff --git a/arch/x86/math-emu/fpu_proto.h b/arch/x86/math-emu/fpu_proto.h
636 index aa49b6a..9779df4 100644
637 --- a/arch/x86/math-emu/fpu_proto.h
638 +++ b/arch/x86/math-emu/fpu_proto.h
639 @@ -51,8 +51,8 @@ extern void ffreep(void);
640 extern void fst_i_(void);
641 extern void fstp_i(void);
642 /* fpu_entry.c */
643 -asmlinkage extern void math_emulate(long arg);
644 -extern void math_abort(struct info *info, unsigned int signal);
645 +extern void math_emulate(struct math_emu_info *info);
646 +extern void math_abort(struct math_emu_info *info, unsigned int signal);
647 /* fpu_etc.c */
648 extern void FPU_etc(void);
649 /* fpu_tags.c */
650 diff --git a/arch/x86/math-emu/fpu_system.h b/arch/x86/math-emu/fpu_system.h
651 index 13488fa..50fa0ec 100644
652 --- a/arch/x86/math-emu/fpu_system.h
653 +++ b/arch/x86/math-emu/fpu_system.h
654 @@ -16,10 +16,6 @@
655 #include <linux/kernel.h>
656 #include <linux/mm.h>
657
658 -/* This sets the pointer FPU_info to point to the argument part
659 - of the stack frame of math_emulate() */
660 -#define SETUP_DATA_AREA(arg) FPU_info = (struct info *) &arg
661 -
662 /* s is always from a cpu register, and the cpu does bounds checking
663 * during register load --> no further bounds checks needed */
664 #define LDT_DESCRIPTOR(s) (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3])
665 @@ -38,12 +34,12 @@
666 #define I387 (current->thread.xstate)
667 #define FPU_info (I387->soft.info)
668
669 -#define FPU_CS (*(unsigned short *) &(FPU_info->___cs))
670 -#define FPU_SS (*(unsigned short *) &(FPU_info->___ss))
671 -#define FPU_DS (*(unsigned short *) &(FPU_info->___ds))
672 -#define FPU_EAX (FPU_info->___eax)
673 -#define FPU_EFLAGS (FPU_info->___eflags)
674 -#define FPU_EIP (FPU_info->___eip)
675 +#define FPU_CS (*(unsigned short *) &(FPU_info->regs->cs))
676 +#define FPU_SS (*(unsigned short *) &(FPU_info->regs->ss))
677 +#define FPU_DS (*(unsigned short *) &(FPU_info->regs->ds))
678 +#define FPU_EAX (FPU_info->regs->ax)
679 +#define FPU_EFLAGS (FPU_info->regs->flags)
680 +#define FPU_EIP (FPU_info->regs->ip)
681 #define FPU_ORIG_EIP (FPU_info->___orig_eip)
682
683 #define FPU_lookahead (I387->soft.lookahead)
684 diff --git a/arch/x86/math-emu/get_address.c b/arch/x86/math-emu/get_address.c
685 index d701e2b..420b3b6 100644
686 --- a/arch/x86/math-emu/get_address.c
687 +++ b/arch/x86/math-emu/get_address.c
688 @@ -29,46 +29,43 @@
689 #define FPU_WRITE_BIT 0x10
690
691 static int reg_offset[] = {
692 - offsetof(struct info, ___eax),
693 - offsetof(struct info, ___ecx),
694 - offsetof(struct info, ___edx),
695 - offsetof(struct info, ___ebx),
696 - offsetof(struct info, ___esp),
697 - offsetof(struct info, ___ebp),
698 - offsetof(struct info, ___esi),
699 - offsetof(struct info, ___edi)
700 + offsetof(struct pt_regs, ax),
701 + offsetof(struct pt_regs, cx),
702 + offsetof(struct pt_regs, dx),
703 + offsetof(struct pt_regs, bx),
704 + offsetof(struct pt_regs, sp),
705 + offsetof(struct pt_regs, bp),
706 + offsetof(struct pt_regs, si),
707 + offsetof(struct pt_regs, di)
708 };
709
710 -#define REG_(x) (*(long *)(reg_offset[(x)]+(u_char *) FPU_info))
711 +#define REG_(x) (*(long *)(reg_offset[(x)] + (u_char *)FPU_info->regs))
712
713 static int reg_offset_vm86[] = {
714 - offsetof(struct info, ___cs),
715 - offsetof(struct info, ___vm86_ds),
716 - offsetof(struct info, ___vm86_es),
717 - offsetof(struct info, ___vm86_fs),
718 - offsetof(struct info, ___vm86_gs),
719 - offsetof(struct info, ___ss),
720 - offsetof(struct info, ___vm86_ds)
721 + offsetof(struct pt_regs, cs),
722 + offsetof(struct kernel_vm86_regs, ds),
723 + offsetof(struct kernel_vm86_regs, es),
724 + offsetof(struct kernel_vm86_regs, fs),
725 + offsetof(struct kernel_vm86_regs, gs),
726 + offsetof(struct pt_regs, ss),
727 + offsetof(struct kernel_vm86_regs, ds)
728 };
729
730 #define VM86_REG_(x) (*(unsigned short *) \
731 - (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info))
732 -
733 -/* This dummy, gs is not saved on the stack. */
734 -#define ___GS ___ds
735 + (reg_offset_vm86[((unsigned)x)] + (u_char *)FPU_info->regs))
736
737 static int reg_offset_pm[] = {
738 - offsetof(struct info, ___cs),
739 - offsetof(struct info, ___ds),
740 - offsetof(struct info, ___es),
741 - offsetof(struct info, ___fs),
742 - offsetof(struct info, ___GS),
743 - offsetof(struct info, ___ss),
744 - offsetof(struct info, ___ds)
745 + offsetof(struct pt_regs, cs),
746 + offsetof(struct pt_regs, ds),
747 + offsetof(struct pt_regs, es),
748 + offsetof(struct pt_regs, fs),
749 + offsetof(struct pt_regs, ds), /* dummy, not saved on stack */
750 + offsetof(struct pt_regs, ss),
751 + offsetof(struct pt_regs, ds)
752 };
753
754 #define PM_REG_(x) (*(unsigned short *) \
755 - (reg_offset_pm[((unsigned)x)]+(u_char *) FPU_info))
756 + (reg_offset_pm[((unsigned)x)] + (u_char *)FPU_info->regs))
757
758 /* Decode the SIB byte. This function assumes mod != 0 */
759 static int sib(int mod, unsigned long *fpu_eip)
760 @@ -349,34 +346,34 @@ void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
761 }
762 switch (rm) {
763 case 0:
764 - address += FPU_info->___ebx + FPU_info->___esi;
765 + address += FPU_info->regs->bx + FPU_info->regs->si;
766 break;
767 case 1:
768 - address += FPU_info->___ebx + FPU_info->___edi;
769 + address += FPU_info->regs->bx + FPU_info->regs->di;
770 break;
771 case 2:
772 - address += FPU_info->___ebp + FPU_info->___esi;
773 + address += FPU_info->regs->bp + FPU_info->regs->si;
774 if (addr_modes.override.segment == PREFIX_DEFAULT)
775 addr_modes.override.segment = PREFIX_SS_;
776 break;
777 case 3:
778 - address += FPU_info->___ebp + FPU_info->___edi;
779 + address += FPU_info->regs->bp + FPU_info->regs->di;
780 if (addr_modes.override.segment == PREFIX_DEFAULT)
781 addr_modes.override.segment = PREFIX_SS_;
782 break;
783 case 4:
784 - address += FPU_info->___esi;
785 + address += FPU_info->regs->si;
786 break;
787 case 5:
788 - address += FPU_info->___edi;
789 + address += FPU_info->regs->di;
790 break;
791 case 6:
792 - address += FPU_info->___ebp;
793 + address += FPU_info->regs->bp;
794 if (addr_modes.override.segment == PREFIX_DEFAULT)
795 addr_modes.override.segment = PREFIX_SS_;
796 break;
797 case 7:
798 - address += FPU_info->___ebx;
799 + address += FPU_info->regs->bx;
800 break;
801 }
802
803 diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
804 index cebcbf1..eefd445 100644
805 --- a/arch/x86/mm/numa_64.c
806 +++ b/arch/x86/mm/numa_64.c
807 @@ -145,7 +145,7 @@ int __init compute_hash_shift(struct bootnode *nodes, int numnodes,
808 return shift;
809 }
810
811 -int early_pfn_to_nid(unsigned long pfn)
812 +int __meminit __early_pfn_to_nid(unsigned long pfn)
813 {
814 return phys_to_nid(pfn << PAGE_SHIFT);
815 }
816 diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
817 index e9f80c7..10131fb 100644
818 --- a/arch/x86/oprofile/op_model_ppro.c
819 +++ b/arch/x86/oprofile/op_model_ppro.c
820 @@ -78,8 +78,18 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
821 if (cpu_has_arch_perfmon) {
822 union cpuid10_eax eax;
823 eax.full = cpuid_eax(0xa);
824 - if (counter_width < eax.split.bit_width)
825 - counter_width = eax.split.bit_width;
826 +
827 + /*
828 + * For Core2 (family 6, model 15), don't reset the
829 + * counter width:
830 + */
831 + if (!(eax.split.version_id == 0 &&
832 + current_cpu_data.x86 == 6 &&
833 + current_cpu_data.x86_model == 15)) {
834 +
835 + if (counter_width < eax.split.bit_width)
836 + counter_width = eax.split.bit_width;
837 + }
838 }
839
840 /* clear all counters */
841 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
842 index 5e4686d..59439c4 100644
843 --- a/arch/x86/xen/enlighten.c
844 +++ b/arch/x86/xen/enlighten.c
845 @@ -1669,6 +1669,9 @@ asmlinkage void __init xen_start_kernel(void)
846 possible map and a non-dummy shared_info. */
847 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
848
849 + local_irq_disable();
850 + early_boot_irqs_off();
851 +
852 xen_raw_console_write("mapping kernel into physical memory\n");
853 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
854
855 diff --git a/crypto/algapi.c b/crypto/algapi.c
856 index 7c41e74..56c62e2 100644
857 --- a/crypto/algapi.c
858 +++ b/crypto/algapi.c
859 @@ -149,6 +149,9 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg)
860 if (q == alg)
861 goto err;
862
863 + if (crypto_is_moribund(q))
864 + continue;
865 +
866 if (crypto_is_larval(q)) {
867 if (!strcmp(alg->cra_driver_name, q->cra_driver_name))
868 goto err;
869 @@ -197,7 +200,7 @@ void crypto_alg_tested(const char *name, int err)
870
871 down_write(&crypto_alg_sem);
872 list_for_each_entry(q, &crypto_alg_list, cra_list) {
873 - if (!crypto_is_larval(q))
874 + if (crypto_is_moribund(q) || !crypto_is_larval(q))
875 continue;
876
877 test = (struct crypto_larval *)q;
878 @@ -210,6 +213,7 @@ void crypto_alg_tested(const char *name, int err)
879 goto unlock;
880
881 found:
882 + q->cra_flags |= CRYPTO_ALG_DEAD;
883 alg = test->adult;
884 if (err || list_empty(&alg->cra_list))
885 goto complete;
886 diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
887 index 30f3ef2..4aa9477 100644
888 --- a/drivers/acpi/ec.c
889 +++ b/drivers/acpi/ec.c
890 @@ -759,9 +759,10 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level,
891 struct acpi_namespace_node *node = handle;
892 struct acpi_ec *ec = context;
893 int value = 0;
894 - if (sscanf(node->name.ascii, "_Q%x", &value) == 1) {
895 +
896 + if (sscanf(node->name.ascii, "_Q%2x", &value) == 1)
897 acpi_ec_add_query_handler(ec, value, handle, NULL, NULL);
898 - }
899 +
900 return AE_OK;
901 }
902
903 diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
904 index bb7d50d..ad55db1 100644
905 --- a/drivers/acpi/power.c
906 +++ b/drivers/acpi/power.c
907 @@ -151,7 +151,7 @@ static int acpi_power_get_state(acpi_handle handle, int *state)
908 *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON:
909 ACPI_POWER_RESOURCE_STATE_OFF;
910
911 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
912 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%4.4s] is %s\n",
913 acpi_ut_get_node_name(handle),
914 *state ? "on" : "off"));
915
916 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
917 index bc6695e..b07b2ff 100644
918 --- a/drivers/ata/libata-core.c
919 +++ b/drivers/ata/libata-core.c
920 @@ -1251,14 +1251,16 @@ static u64 ata_id_n_sectors(const u16 *id)
921 {
922 if (ata_id_has_lba(id)) {
923 if (ata_id_has_lba48(id))
924 - return ata_id_u64(id, 100);
925 + return ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
926 else
927 - return ata_id_u32(id, 60);
928 + return ata_id_u32(id, ATA_ID_LBA_CAPACITY);
929 } else {
930 if (ata_id_current_chs_valid(id))
931 - return ata_id_u32(id, 57);
932 + return id[ATA_ID_CUR_CYLS] * id[ATA_ID_CUR_HEADS] *
933 + id[ATA_ID_CUR_SECTORS];
934 else
935 - return id[1] * id[3] * id[6];
936 + return id[ATA_ID_CYLS] * id[ATA_ID_HEADS] *
937 + id[ATA_ID_SECTORS];
938 }
939 }
940
941 diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
942 index 4de18d0..97a7dbc 100644
943 --- a/drivers/ata/libata-eh.c
944 +++ b/drivers/ata/libata-eh.c
945 @@ -2366,11 +2366,14 @@ int ata_eh_reset(struct ata_link *link, int classify,
946 }
947
948 /* prereset() might have cleared ATA_EH_RESET. If so,
949 - * bang classes and return.
950 + * bang classes, thaw and return.
951 */
952 if (reset && !(ehc->i.action & ATA_EH_RESET)) {
953 ata_link_for_each_dev(dev, link)
954 classes[dev->devno] = ATA_DEV_NONE;
955 + if ((ap->pflags & ATA_PFLAG_FROZEN) &&
956 + ata_is_host_link(link))
957 + ata_eh_thaw_port(ap);
958 rc = 0;
959 goto out;
960 }
961 diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
962 index 937c9c0..10f000d 100644
963 --- a/drivers/atm/fore200e.c
964 +++ b/drivers/atm/fore200e.c
965 @@ -2519,8 +2519,8 @@ fore200e_load_and_start_fw(struct fore200e* fore200e)
966 return err;
967
968 sprintf(buf, "%s%s", fore200e->bus->proc_name, FW_EXT);
969 - if (request_firmware(&firmware, buf, device) == 1) {
970 - printk(FORE200E "missing %s firmware image\n", fore200e->bus->model_name);
971 + if ((err = request_firmware(&firmware, buf, device)) < 0) {
972 + printk(FORE200E "problem loading firmware image %s\n", fore200e->bus->model_name);
973 return err;
974 }
975
976 diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
977 index 93f3690..8e54c1f 100644
978 --- a/drivers/block/aoe/aoe.h
979 +++ b/drivers/block/aoe/aoe.h
980 @@ -18,6 +18,7 @@
981 enum {
982 AOECMD_ATA,
983 AOECMD_CFG,
984 + AOECMD_VEND_MIN = 0xf0,
985
986 AOEFL_RSP = (1<<3),
987 AOEFL_ERR = (1<<2),
988 diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
989 index 9157d64..b67629a 100644
990 --- a/drivers/block/aoe/aoenet.c
991 +++ b/drivers/block/aoe/aoenet.c
992 @@ -153,6 +153,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
993 aoecmd_cfg_rsp(skb);
994 break;
995 default:
996 + if (h->cmd >= AOECMD_VEND_MIN)
997 + break; /* don't complain about vendor commands */
998 printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
999 }
1000 exit:
1001 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
1002 index 2d19f0c..676278e 100644
1003 --- a/drivers/block/xen-blkfront.c
1004 +++ b/drivers/block/xen-blkfront.c
1005 @@ -40,6 +40,7 @@
1006 #include <linux/hdreg.h>
1007 #include <linux/cdrom.h>
1008 #include <linux/module.h>
1009 +#include <linux/scatterlist.h>
1010
1011 #include <xen/xenbus.h>
1012 #include <xen/grant_table.h>
1013 @@ -82,6 +83,7 @@ struct blkfront_info
1014 enum blkif_state connected;
1015 int ring_ref;
1016 struct blkif_front_ring ring;
1017 + struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
1018 unsigned int evtchn, irq;
1019 struct request_queue *rq;
1020 struct work_struct work;
1021 @@ -204,12 +206,11 @@ static int blkif_queue_request(struct request *req)
1022 struct blkfront_info *info = req->rq_disk->private_data;
1023 unsigned long buffer_mfn;
1024 struct blkif_request *ring_req;
1025 - struct req_iterator iter;
1026 - struct bio_vec *bvec;
1027 unsigned long id;
1028 unsigned int fsect, lsect;
1029 - int ref;
1030 + int i, ref;
1031 grant_ref_t gref_head;
1032 + struct scatterlist *sg;
1033
1034 if (unlikely(info->connected != BLKIF_STATE_CONNECTED))
1035 return 1;
1036 @@ -238,12 +239,13 @@ static int blkif_queue_request(struct request *req)
1037 if (blk_barrier_rq(req))
1038 ring_req->operation = BLKIF_OP_WRITE_BARRIER;
1039
1040 - ring_req->nr_segments = 0;
1041 - rq_for_each_segment(bvec, req, iter) {
1042 - BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST);
1043 - buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
1044 - fsect = bvec->bv_offset >> 9;
1045 - lsect = fsect + (bvec->bv_len >> 9) - 1;
1046 + ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg);
1047 + BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST);
1048 +
1049 + for_each_sg(info->sg, sg, ring_req->nr_segments, i) {
1050 + buffer_mfn = pfn_to_mfn(page_to_pfn(sg_page(sg)));
1051 + fsect = sg->offset >> 9;
1052 + lsect = fsect + (sg->length >> 9) - 1;
1053 /* install a grant reference. */
1054 ref = gnttab_claim_grant_reference(&gref_head);
1055 BUG_ON(ref == -ENOSPC);
1056 @@ -254,16 +256,12 @@ static int blkif_queue_request(struct request *req)
1057 buffer_mfn,
1058 rq_data_dir(req) );
1059
1060 - info->shadow[id].frame[ring_req->nr_segments] =
1061 - mfn_to_pfn(buffer_mfn);
1062 -
1063 - ring_req->seg[ring_req->nr_segments] =
1064 + info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn);
1065 + ring_req->seg[i] =
1066 (struct blkif_request_segment) {
1067 .gref = ref,
1068 .first_sect = fsect,
1069 .last_sect = lsect };
1070 -
1071 - ring_req->nr_segments++;
1072 }
1073
1074 info->ring.req_prod_pvt++;
1075 @@ -628,6 +626,8 @@ static int setup_blkring(struct xenbus_device *dev,
1076 SHARED_RING_INIT(sring);
1077 FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);
1078
1079 + sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST);
1080 +
1081 err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring));
1082 if (err < 0) {
1083 free_page((unsigned long)sring);
1084 diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
1085 index c771418..4373adb 100644
1086 --- a/drivers/char/agp/intel-agp.c
1087 +++ b/drivers/char/agp/intel-agp.c
1088 @@ -633,13 +633,15 @@ static void intel_i830_init_gtt_entries(void)
1089 break;
1090 }
1091 }
1092 - if (gtt_entries > 0)
1093 + if (gtt_entries > 0) {
1094 dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
1095 gtt_entries / KB(1), local ? "local" : "stolen");
1096 - else
1097 + gtt_entries /= KB(4);
1098 + } else {
1099 dev_info(&agp_bridge->dev->dev,
1100 "no pre-allocated video memory detected\n");
1101 - gtt_entries /= KB(4);
1102 + gtt_entries = 0;
1103 + }
1104
1105 intel_private.gtt_entries = gtt_entries;
1106 }
1107 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
1108 index 40df3e1..fab7ca2 100644
1109 --- a/drivers/hid/hid-core.c
1110 +++ b/drivers/hid/hid-core.c
1111 @@ -1302,6 +1302,12 @@ static const struct hid_device_id hid_blacklist[] = {
1112 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1113 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1114 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1115 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
1116 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
1117 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
1118 + { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
1119 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
1120 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
1121
1122 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
1123 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
1124 @@ -1529,10 +1535,6 @@ static const struct hid_device_id hid_ignore_list[] = {
1125 { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) },
1126 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
1127 { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
1128 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
1129 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
1130 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
1131 - { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
1132 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
1133 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
1134 { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
1135 @@ -1543,8 +1545,6 @@ static const struct hid_device_id hid_ignore_list[] = {
1136 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) },
1137 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) },
1138 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
1139 - { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
1140 - { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
1141 { }
1142 };
1143
1144 diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
1145 index 67067e9..71556e6 100644
1146 --- a/drivers/hwmon/f71882fg.c
1147 +++ b/drivers/hwmon/f71882fg.c
1148 @@ -837,7 +837,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address)
1149
1150 devid = superio_inw(sioaddr, SIO_REG_MANID);
1151 if (devid != SIO_FINTEK_ID) {
1152 - printk(KERN_INFO DRVNAME ": Not a Fintek device\n");
1153 + pr_debug(DRVNAME ": Not a Fintek device\n");
1154 goto exit;
1155 }
1156
1157 diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
1158 index b74c957..7601cc2 100644
1159 --- a/drivers/hwmon/it87.c
1160 +++ b/drivers/hwmon/it87.c
1161 @@ -207,7 +207,7 @@ static inline u16 FAN16_TO_REG(long rpm)
1162
1163 #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\
1164 ((val)+500)/1000),-128,127))
1165 -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000)
1166 +#define TEMP_FROM_REG(val) ((val) * 1000)
1167
1168 #define PWM_TO_REG(val) ((val) >> 1)
1169 #define PWM_FROM_REG(val) (((val)&0x7f) << 1)
1170 @@ -261,9 +261,9 @@ struct it87_data {
1171 u8 has_fan; /* Bitfield, fans enabled */
1172 u16 fan[5]; /* Register values, possibly combined */
1173 u16 fan_min[5]; /* Register values, possibly combined */
1174 - u8 temp[3]; /* Register value */
1175 - u8 temp_high[3]; /* Register value */
1176 - u8 temp_low[3]; /* Register value */
1177 + s8 temp[3]; /* Register value */
1178 + s8 temp_high[3]; /* Register value */
1179 + s8 temp_low[3]; /* Register value */
1180 u8 sensor; /* Register value */
1181 u8 fan_div[3]; /* Register encoding, shifted right */
1182 u8 vid; /* Register encoding, combined */
1183 diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c
1184 index 75089fe..c9a8d6f 100644
1185 --- a/drivers/i2c/busses/i2c-acorn.c
1186 +++ b/drivers/i2c/busses/i2c-acorn.c
1187 @@ -84,6 +84,7 @@ static struct i2c_algo_bit_data ioc_data = {
1188
1189 static struct i2c_adapter ioc_ops = {
1190 .id = I2C_HW_B_IOC,
1191 + .nr = 0,
1192 .algo_data = &ioc_data,
1193 };
1194
1195 @@ -91,7 +92,7 @@ static int __init i2c_ioc_init(void)
1196 {
1197 force_ones = FORCE_ONES | SCL | SDA;
1198
1199 - return i2c_bit_add_bus(&ioc_ops);
1200 + return i2c_bit_add_numbered_bus(&ioc_ops);
1201 }
1202
1203 module_init(i2c_ioc_init);
1204 diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
1205 index 3972208..c688237 100644
1206 --- a/drivers/i2c/busses/i2c-amd8111.c
1207 +++ b/drivers/i2c/busses/i2c-amd8111.c
1208 @@ -72,7 +72,7 @@ static unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
1209 {
1210 int timeout = 500;
1211
1212 - while (timeout-- && (inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF))
1213 + while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout)
1214 udelay(1);
1215
1216 if (!timeout) {
1217 @@ -88,7 +88,7 @@ static unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
1218 {
1219 int timeout = 500;
1220
1221 - while (timeout-- && (~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF))
1222 + while ((~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF) && --timeout)
1223 udelay(1);
1224
1225 if (!timeout) {
1226 diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
1227 index 906f9b9..7f80d51 100644
1228 --- a/drivers/i2c/busses/i2c-pxa.c
1229 +++ b/drivers/i2c/busses/i2c-pxa.c
1230 @@ -644,7 +644,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
1231
1232 i2c_pxa_start_message(i2c);
1233
1234 - while (timeout-- && i2c->msg_num > 0) {
1235 + while (i2c->msg_num > 0 && --timeout) {
1236 i2c_pxa_handler(0, i2c);
1237 udelay(10);
1238 }
1239 diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
1240 index c6a63f4..feb00df 100644
1241 --- a/drivers/i2c/i2c-core.c
1242 +++ b/drivers/i2c/i2c-core.c
1243 @@ -1831,7 +1831,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
1244 case I2C_SMBUS_QUICK:
1245 msg[0].len = 0;
1246 /* Special case: The read/write field is used as data */
1247 - msg[0].flags = flags | (read_write==I2C_SMBUS_READ)?I2C_M_RD:0;
1248 + msg[0].flags = flags | (read_write == I2C_SMBUS_READ ?
1249 + I2C_M_RD : 0);
1250 num = 1;
1251 break;
1252 case I2C_SMBUS_BYTE:
1253 diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
1254 index c41c3b9..e60fc63 100644
1255 --- a/drivers/ide/ide-iops.c
1256 +++ b/drivers/ide/ide-iops.c
1257 @@ -324,6 +324,8 @@ void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf,
1258 u8 io_32bit = drive->io_32bit;
1259 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
1260
1261 + len++;
1262 +
1263 if (io_32bit) {
1264 unsigned long uninitialized_var(flags);
1265
1266 diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
1267 index 2caf9da..7890be3 100644
1268 --- a/drivers/infiniband/hw/nes/nes_cm.c
1269 +++ b/drivers/infiniband/hw/nes/nes_cm.c
1270 @@ -2495,12 +2495,14 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
1271 int ret = 0;
1272 struct nes_vnic *nesvnic;
1273 struct nes_device *nesdev;
1274 + struct nes_ib_device *nesibdev;
1275
1276 nesvnic = to_nesvnic(nesqp->ibqp.device);
1277 if (!nesvnic)
1278 return -EINVAL;
1279
1280 nesdev = nesvnic->nesdev;
1281 + nesibdev = nesvnic->nesibdev;
1282
1283 nes_debug(NES_DBG_CM, "netdev refcnt = %u.\n",
1284 atomic_read(&nesvnic->netdev->refcnt));
1285 @@ -2512,6 +2514,8 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
1286 } else {
1287 /* Need to free the Last Streaming Mode Message */
1288 if (nesqp->ietf_frame) {
1289 + if (nesqp->lsmm_mr)
1290 + nesibdev->ibdev.dereg_mr(nesqp->lsmm_mr);
1291 pci_free_consistent(nesdev->pcidev,
1292 nesqp->private_data_len+sizeof(struct ietf_mpa_frame),
1293 nesqp->ietf_frame, nesqp->ietf_frame_pbase);
1294 @@ -2545,6 +2549,10 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1295 struct iw_cm_event cm_event;
1296 struct nes_hw_qp_wqe *wqe;
1297 struct nes_v4_quad nes_quad;
1298 + struct nes_ib_device *nesibdev;
1299 + struct ib_mr *ibmr = NULL;
1300 + struct ib_phys_buf ibphysbuf;
1301 + struct nes_pd *nespd;
1302 u32 crc_value;
1303 int ret;
1304
1305 @@ -2605,6 +2613,26 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1306 if (cm_id->remote_addr.sin_addr.s_addr !=
1307 cm_id->local_addr.sin_addr.s_addr) {
1308 u64temp = (unsigned long)nesqp;
1309 + nesibdev = nesvnic->nesibdev;
1310 + nespd = nesqp->nespd;
1311 + ibphysbuf.addr = nesqp->ietf_frame_pbase;
1312 + ibphysbuf.size = conn_param->private_data_len +
1313 + sizeof(struct ietf_mpa_frame);
1314 + ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd,
1315 + &ibphysbuf, 1,
1316 + IB_ACCESS_LOCAL_WRITE,
1317 + (u64 *)&nesqp->ietf_frame);
1318 + if (!ibmr) {
1319 + nes_debug(NES_DBG_CM, "Unable to register memory region"
1320 + "for lSMM for cm_node = %p \n",
1321 + cm_node);
1322 + return -ENOMEM;
1323 + }
1324 +
1325 + ibmr->pd = &nespd->ibpd;
1326 + ibmr->device = nespd->ibpd.device;
1327 + nesqp->lsmm_mr = ibmr;
1328 +
1329 u64temp |= NES_SW_CONTEXT_ALIGN>>1;
1330 set_wqe_64bit_value(wqe->wqe_words,
1331 NES_IWARP_SQ_WQE_COMP_CTX_LOW_IDX,
1332 @@ -2615,14 +2643,13 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1333 wqe->wqe_words[NES_IWARP_SQ_WQE_TOTAL_PAYLOAD_IDX] =
1334 cpu_to_le32(conn_param->private_data_len +
1335 sizeof(struct ietf_mpa_frame));
1336 - wqe->wqe_words[NES_IWARP_SQ_WQE_FRAG0_LOW_IDX] =
1337 - cpu_to_le32((u32)nesqp->ietf_frame_pbase);
1338 - wqe->wqe_words[NES_IWARP_SQ_WQE_FRAG0_HIGH_IDX] =
1339 - cpu_to_le32((u32)((u64)nesqp->ietf_frame_pbase >> 32));
1340 + set_wqe_64bit_value(wqe->wqe_words,
1341 + NES_IWARP_SQ_WQE_FRAG0_LOW_IDX,
1342 + (u64)nesqp->ietf_frame);
1343 wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] =
1344 cpu_to_le32(conn_param->private_data_len +
1345 sizeof(struct ietf_mpa_frame));
1346 - wqe->wqe_words[NES_IWARP_SQ_WQE_STAG0_IDX] = 0;
1347 + wqe->wqe_words[NES_IWARP_SQ_WQE_STAG0_IDX] = ibmr->lkey;
1348
1349 nesqp->nesqp_context->ird_ord_sizes |=
1350 cpu_to_le32(NES_QPCONTEXT_ORDIRD_LSMM_PRESENT |
1351 diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
1352 index d36c9a0..e0f658d 100644
1353 --- a/drivers/infiniband/hw/nes/nes_verbs.c
1354 +++ b/drivers/infiniband/hw/nes/nes_verbs.c
1355 @@ -1360,8 +1360,10 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1356 NES_QPCONTEXT_MISC_RQ_SIZE_SHIFT);
1357 nesqp->nesqp_context->misc |= cpu_to_le32((u32)nesqp->hwqp.sq_encoded_size <<
1358 NES_QPCONTEXT_MISC_SQ_SIZE_SHIFT);
1359 + if (!udata) {
1360 nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_PRIV_EN);
1361 nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_FAST_REGISTER_EN);
1362 + }
1363 nesqp->nesqp_context->cqs = cpu_to_le32(nesqp->nesscq->hw_cq.cq_number +
1364 ((u32)nesqp->nesrcq->hw_cq.cq_number << 16));
1365 u64temp = (u64)nesqp->hwqp.sq_pbase;
1366 diff --git a/drivers/infiniband/hw/nes/nes_verbs.h b/drivers/infiniband/hw/nes/nes_verbs.h
1367 index 6c6b4da..ae0ca9b 100644
1368 --- a/drivers/infiniband/hw/nes/nes_verbs.h
1369 +++ b/drivers/infiniband/hw/nes/nes_verbs.h
1370 @@ -134,6 +134,7 @@ struct nes_qp {
1371 struct ietf_mpa_frame *ietf_frame;
1372 dma_addr_t ietf_frame_pbase;
1373 wait_queue_head_t state_waitq;
1374 + struct ib_mr *lsmm_mr;
1375 unsigned long socket;
1376 struct nes_hw_qp hwqp;
1377 struct work_struct work;
1378 diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
1379 index 9c788e2..4101bf0 100644
1380 --- a/drivers/md/raid1.c
1381 +++ b/drivers/md/raid1.c
1382 @@ -1233,8 +1233,9 @@ static void end_sync_write(struct bio *bio, int error)
1383 update_head_pos(mirror, r1_bio);
1384
1385 if (atomic_dec_and_test(&r1_bio->remaining)) {
1386 - md_done_sync(mddev, r1_bio->sectors, uptodate);
1387 + sector_t s = r1_bio->sectors;
1388 put_buf(r1_bio);
1389 + md_done_sync(mddev, s, uptodate);
1390 }
1391 }
1392
1393 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1394 index 970a96e..b2fde77 100644
1395 --- a/drivers/md/raid10.c
1396 +++ b/drivers/md/raid10.c
1397 @@ -1236,6 +1236,7 @@ static void end_sync_read(struct bio *bio, int error)
1398 /* for reconstruct, we always reschedule after a read.
1399 * for resync, only after all reads
1400 */
1401 + rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev);
1402 if (test_bit(R10BIO_IsRecover, &r10_bio->state) ||
1403 atomic_dec_and_test(&r10_bio->remaining)) {
1404 /* we have read all the blocks,
1405 @@ -1243,7 +1244,6 @@ static void end_sync_read(struct bio *bio, int error)
1406 */
1407 reschedule_retry(r10_bio);
1408 }
1409 - rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev);
1410 }
1411
1412 static void end_sync_write(struct bio *bio, int error)
1413 @@ -1264,11 +1264,13 @@ static void end_sync_write(struct bio *bio, int error)
1414
1415 update_head_pos(i, r10_bio);
1416
1417 + rdev_dec_pending(conf->mirrors[d].rdev, mddev);
1418 while (atomic_dec_and_test(&r10_bio->remaining)) {
1419 if (r10_bio->master_bio == NULL) {
1420 /* the primary of several recovery bios */
1421 - md_done_sync(mddev, r10_bio->sectors, 1);
1422 + sector_t s = r10_bio->sectors;
1423 put_buf(r10_bio);
1424 + md_done_sync(mddev, s, 1);
1425 break;
1426 } else {
1427 r10bio_t *r10_bio2 = (r10bio_t *)r10_bio->master_bio;
1428 @@ -1276,7 +1278,6 @@ static void end_sync_write(struct bio *bio, int error)
1429 r10_bio = r10_bio2;
1430 }
1431 }
1432 - rdev_dec_pending(conf->mirrors[d].rdev, mddev);
1433 }
1434
1435 /*
1436 @@ -1749,8 +1750,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1437 if (!go_faster && conf->nr_waiting)
1438 msleep_interruptible(1000);
1439
1440 - bitmap_cond_end_sync(mddev->bitmap, sector_nr);
1441 -
1442 /* Again, very different code for resync and recovery.
1443 * Both must result in an r10bio with a list of bios that
1444 * have bi_end_io, bi_sector, bi_bdev set,
1445 @@ -1886,6 +1885,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1446 /* resync. Schedule a read for every block at this virt offset */
1447 int count = 0;
1448
1449 + bitmap_cond_end_sync(mddev->bitmap, sector_nr);
1450 +
1451 if (!bitmap_start_sync(mddev->bitmap, sector_nr,
1452 &sync_blocks, mddev->degraded) &&
1453 !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
1454 @@ -2010,13 +2011,13 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1455 /* There is nowhere to write, so all non-sync
1456 * drives must be failed, so try the next chunk...
1457 */
1458 - {
1459 - sector_t sec = max_sector - sector_nr;
1460 - sectors_skipped += sec;
1461 + if (sector_nr + max_sync < max_sector)
1462 + max_sector = sector_nr + max_sync;
1463 +
1464 + sectors_skipped += (max_sector - sector_nr);
1465 chunks_skipped ++;
1466 sector_nr = max_sector;
1467 goto skipped;
1468 - }
1469 }
1470
1471 static int run(mddev_t *mddev)
1472 diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c
1473 index c112bdd..edfd41f 100644
1474 --- a/drivers/media/common/tuners/tda8290.c
1475 +++ b/drivers/media/common/tuners/tda8290.c
1476 @@ -724,7 +724,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
1477 fe->ops.analog_ops.info.name = name;
1478
1479 if (priv->ver & TDA8290) {
1480 - tda8290_init_tuner(fe);
1481 + if (priv->ver & (TDA8275 | TDA8275A))
1482 + tda8290_init_tuner(fe);
1483 tda8290_init_if(fe);
1484 } else if (priv->ver & TDA8295)
1485 tda8295_init_if(fe);
1486 diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
1487 index cf4d893..3e08d98 100644
1488 --- a/drivers/media/dvb/frontends/s5h1409.c
1489 +++ b/drivers/media/dvb/frontends/s5h1409.c
1490 @@ -545,9 +545,6 @@ static int s5h1409_set_frontend(struct dvb_frontend *fe,
1491
1492 s5h1409_enable_modulation(fe, p->u.vsb.modulation);
1493
1494 - /* Allow the demod to settle */
1495 - msleep(100);
1496 -
1497 if (fe->ops.tuner_ops.set_params) {
1498 if (fe->ops.i2c_gate_ctrl)
1499 fe->ops.i2c_gate_ctrl(fe, 1);
1500 @@ -562,6 +559,10 @@ static int s5h1409_set_frontend(struct dvb_frontend *fe,
1501 s5h1409_set_qam_interleave_mode(fe);
1502 }
1503
1504 + /* Issue a reset to the demod so it knows to resync against the
1505 + newly tuned frequency */
1506 + s5h1409_softreset(fe);
1507 +
1508 return 0;
1509 }
1510
1511 diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
1512 index 4bae38d..999f037 100644
1513 --- a/drivers/media/video/ivtv/ivtv-ioctl.c
1514 +++ b/drivers/media/video/ivtv/ivtv-ioctl.c
1515 @@ -1750,6 +1750,18 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg)
1516 break;
1517 }
1518
1519 + case IVTV_IOC_DMA_FRAME:
1520 + case VIDEO_GET_PTS:
1521 + case VIDEO_GET_FRAME_COUNT:
1522 + case VIDEO_GET_EVENT:
1523 + case VIDEO_PLAY:
1524 + case VIDEO_STOP:
1525 + case VIDEO_FREEZE:
1526 + case VIDEO_CONTINUE:
1527 + case VIDEO_COMMAND:
1528 + case VIDEO_TRY_COMMAND:
1529 + return ivtv_decoder_ioctls(file, cmd, (void *)arg);
1530 +
1531 default:
1532 return -EINVAL;
1533 }
1534 @@ -1792,18 +1804,6 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
1535 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
1536 return 0;
1537
1538 - case IVTV_IOC_DMA_FRAME:
1539 - case VIDEO_GET_PTS:
1540 - case VIDEO_GET_FRAME_COUNT:
1541 - case VIDEO_GET_EVENT:
1542 - case VIDEO_PLAY:
1543 - case VIDEO_STOP:
1544 - case VIDEO_FREEZE:
1545 - case VIDEO_CONTINUE:
1546 - case VIDEO_COMMAND:
1547 - case VIDEO_TRY_COMMAND:
1548 - return ivtv_decoder_ioctls(filp, cmd, (void *)arg);
1549 -
1550 default:
1551 break;
1552 }
1553 diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
1554 index cc02fb1..8e7976a 100644
1555 --- a/drivers/media/video/saa7127.c
1556 +++ b/drivers/media/video/saa7127.c
1557 @@ -149,7 +149,7 @@ static const struct i2c_reg_value saa7127_init_config_common[] = {
1558 { SAA7127_REG_COPYGEN_0, 0x77 },
1559 { SAA7127_REG_COPYGEN_1, 0x41 },
1560 { SAA7127_REG_COPYGEN_2, 0x00 }, /* Macrovision enable/disable */
1561 - { SAA7127_REG_OUTPUT_PORT_CONTROL, 0x9e },
1562 + { SAA7127_REG_OUTPUT_PORT_CONTROL, 0xbf },
1563 { SAA7127_REG_GAIN_LUMINANCE_RGB, 0x00 },
1564 { SAA7127_REG_GAIN_COLORDIFF_RGB, 0x00 },
1565 { SAA7127_REG_INPUT_PORT_CONTROL_1, 0x80 }, /* for color bars */
1566 @@ -479,12 +479,18 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
1567 break;
1568
1569 case SAA7127_OUTPUT_TYPE_COMPOSITE:
1570 - state->reg_2d = 0x08; /* 00001000 CVBS only, RGB DAC's off (high impedance mode) */
1571 + if (state->ident == V4L2_IDENT_SAA7129)
1572 + state->reg_2d = 0x20; /* CVBS only */
1573 + else
1574 + state->reg_2d = 0x08; /* 00001000 CVBS only, RGB DAC's off (high impedance mode) */
1575 state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */
1576 break;
1577
1578 case SAA7127_OUTPUT_TYPE_SVIDEO:
1579 - state->reg_2d = 0xff; /* 11111111 croma -> R, luma -> CVBS + G + B */
1580 + if (state->ident == V4L2_IDENT_SAA7129)
1581 + state->reg_2d = 0x18; /* Y + C */
1582 + else
1583 + state->reg_2d = 0xff; /*11111111 croma -> R, luma -> CVBS + G + B */
1584 state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */
1585 break;
1586
1587 @@ -499,7 +505,10 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
1588 break;
1589
1590 case SAA7127_OUTPUT_TYPE_BOTH:
1591 - state->reg_2d = 0xbf;
1592 + if (state->ident == V4L2_IDENT_SAA7129)
1593 + state->reg_2d = 0x38;
1594 + else
1595 + state->reg_2d = 0xbf;
1596 state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */
1597 break;
1598
1599 @@ -691,24 +700,6 @@ static int saa7127_probe(struct i2c_client *client,
1600
1601 i2c_set_clientdata(client, state);
1602
1603 - /* Configure Encoder */
1604 -
1605 - v4l_dbg(1, debug, client, "Configuring encoder\n");
1606 - saa7127_write_inittab(client, saa7127_init_config_common);
1607 - saa7127_set_std(client, V4L2_STD_NTSC);
1608 - saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH);
1609 - saa7127_set_vps(client, &vbi);
1610 - saa7127_set_wss(client, &vbi);
1611 - saa7127_set_cc(client, &vbi);
1612 - saa7127_set_xds(client, &vbi);
1613 - if (test_image == 1)
1614 - /* The Encoder has an internal Colorbar generator */
1615 - /* This can be used for debugging */
1616 - saa7127_set_input_type(client, SAA7127_INPUT_TYPE_TEST_IMAGE);
1617 - else
1618 - saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL);
1619 - saa7127_set_video_enable(client, 1);
1620 -
1621 if (id->driver_data) { /* Chip type is already known */
1622 state->ident = id->driver_data;
1623 } else { /* Needs detection */
1624 @@ -730,6 +721,23 @@ static int saa7127_probe(struct i2c_client *client,
1625
1626 v4l_info(client, "%s found @ 0x%x (%s)\n", client->name,
1627 client->addr << 1, client->adapter->name);
1628 +
1629 + v4l_dbg(1, debug, client, "Configuring encoder\n");
1630 + saa7127_write_inittab(client, saa7127_init_config_common);
1631 + saa7127_set_std(client, V4L2_STD_NTSC);
1632 + saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH);
1633 + saa7127_set_vps(client, &vbi);
1634 + saa7127_set_wss(client, &vbi);
1635 + saa7127_set_cc(client, &vbi);
1636 + saa7127_set_xds(client, &vbi);
1637 + if (test_image == 1)
1638 + /* The Encoder has an internal Colorbar generator */
1639 + /* This can be used for debugging */
1640 + saa7127_set_input_type(client, SAA7127_INPUT_TYPE_TEST_IMAGE);
1641 + else
1642 + saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL);
1643 + saa7127_set_video_enable(client, 1);
1644 +
1645 if (state->ident == V4L2_IDENT_SAA7129)
1646 saa7127_write_inittab(client, saa7129_init_config_extra);
1647 return 0;
1648 diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c
1649 index 94c9f91..6bcca61 100644
1650 --- a/drivers/misc/acer-wmi.c
1651 +++ b/drivers/misc/acer-wmi.c
1652 @@ -1297,7 +1297,7 @@ static int __init acer_wmi_init(void)
1653
1654 set_quirks();
1655
1656 - if (!acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
1657 + if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
1658 interface->capability &= ~ACER_CAP_BRIGHTNESS;
1659 printk(ACER_INFO "Brightness must be controlled by "
1660 "generic video driver\n");
1661 diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
1662 index 05e2982..174a35f 100644
1663 --- a/drivers/misc/hpilo.c
1664 +++ b/drivers/misc/hpilo.c
1665 @@ -710,6 +710,7 @@ out:
1666
1667 static struct pci_device_id ilo_devices[] = {
1668 { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB204) },
1669 + { PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3307) },
1670 { }
1671 };
1672 MODULE_DEVICE_TABLE(pci, ilo_devices);
1673 diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
1674 index 3d067c3..db7e4c4 100644
1675 --- a/drivers/mmc/card/block.c
1676 +++ b/drivers/mmc/card/block.c
1677 @@ -514,7 +514,7 @@ static int mmc_blk_probe(struct mmc_card *card)
1678 if (err)
1679 goto out;
1680
1681 - string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2,
1682 + string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
1683 cap_str, sizeof(cap_str));
1684 printk(KERN_INFO "%s: %s %s %s %s\n",
1685 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
1686 diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
1687 index b92b172..b9f1e84 100644
1688 --- a/drivers/mmc/card/mmc_test.c
1689 +++ b/drivers/mmc/card/mmc_test.c
1690 @@ -494,7 +494,7 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
1691
1692 sg_init_one(&sg, test->buffer, 512);
1693
1694 - ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
1695 + ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
1696 if (ret)
1697 return ret;
1698
1699 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
1700 index 9c50e6f..34ce270 100644
1701 --- a/drivers/mmc/core/mmc_ops.c
1702 +++ b/drivers/mmc/core/mmc_ops.c
1703 @@ -248,12 +248,15 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
1704
1705 sg_init_one(&sg, data_buf, len);
1706
1707 - /*
1708 - * The spec states that CSR and CID accesses have a timeout
1709 - * of 64 clock cycles.
1710 - */
1711 - data.timeout_ns = 0;
1712 - data.timeout_clks = 64;
1713 + if (opcode == MMC_SEND_CSD || opcode == MMC_SEND_CID) {
1714 + /*
1715 + * The spec states that CSR and CID accesses have a timeout
1716 + * of 64 clock cycles.
1717 + */
1718 + data.timeout_ns = 0;
1719 + data.timeout_clks = 64;
1720 + } else
1721 + mmc_set_data_timeout(&data, card);
1722
1723 mmc_wait_for_req(host, &mrq);
1724
1725 diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
1726 index 3b2085b..c6e5539 100644
1727 --- a/drivers/mmc/host/s3cmci.c
1728 +++ b/drivers/mmc/host/s3cmci.c
1729 @@ -329,7 +329,7 @@ static void do_pio_write(struct s3cmci_host *host)
1730
1731 to_ptr = host->base + host->sdidata;
1732
1733 - while ((fifo = fifo_free(host))) {
1734 + while ((fifo = fifo_free(host)) > 3) {
1735 if (!host->pio_bytes) {
1736 res = get_data_buffer(host, &host->pio_bytes,
1737 &host->pio_ptr);
1738 @@ -793,8 +793,7 @@ static void s3cmci_dma_setup(struct s3cmci_host *host,
1739 host->mem->start + host->sdidata);
1740
1741 if (!setup_ok) {
1742 - s3c2410_dma_config(host->dma, 4,
1743 - (S3C2410_DCON_HWTRIG | S3C2410_DCON_CH0_SDI));
1744 + s3c2410_dma_config(host->dma, 4, 0);
1745 s3c2410_dma_set_buffdone_fn(host->dma,
1746 s3cmci_dma_done_callback);
1747 s3c2410_dma_setflags(host->dma, S3C2410_DMAF_AUTOSTART);
1748 diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
1749 index 9bd7026..51e89e0 100644
1750 --- a/drivers/mmc/host/sdhci-pci.c
1751 +++ b/drivers/mmc/host/sdhci-pci.c
1752 @@ -107,6 +107,7 @@ static const struct sdhci_pci_fixes sdhci_ene_714 = {
1753
1754 static const struct sdhci_pci_fixes sdhci_cafe = {
1755 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
1756 + SDHCI_QUIRK_NO_BUSY_IRQ |
1757 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
1758 };
1759
1760 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
1761 index 4d010a9..b4f6b3c 100644
1762 --- a/drivers/mmc/host/sdhci.c
1763 +++ b/drivers/mmc/host/sdhci.c
1764 @@ -1286,8 +1286,11 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
1765 if (host->cmd->data)
1766 DBG("Cannot wait for busy signal when also "
1767 "doing a data transfer");
1768 - else
1769 + else if (!(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
1770 return;
1771 +
1772 + /* The controller does not support the end-of-busy IRQ,
1773 + * fall through and take the SDHCI_INT_RESPONSE */
1774 }
1775
1776 if (intmask & SDHCI_INT_RESPONSE)
1777 @@ -1718,7 +1721,9 @@ int sdhci_add_host(struct sdhci_host *host)
1778 #endif
1779
1780 #ifdef CONFIG_LEDS_CLASS
1781 - host->led.name = mmc_hostname(mmc);
1782 + snprintf(host->led_name, sizeof(host->led_name),
1783 + "%s::", mmc_hostname(mmc));
1784 + host->led.name = host->led_name;
1785 host->led.brightness = LED_OFF;
1786 host->led.default_trigger = mmc_hostname(mmc);
1787 host->led.brightness_set = sdhci_led_control;
1788 diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
1789 index 31f4b15..04c02ac 100644
1790 --- a/drivers/mmc/host/sdhci.h
1791 +++ b/drivers/mmc/host/sdhci.h
1792 @@ -210,6 +210,8 @@ struct sdhci_host {
1793 #define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
1794 /* Controller supports high speed but doesn't have the caps bit set */
1795 #define SDHCI_QUIRK_FORCE_HIGHSPEED (1<<14)
1796 +/* Controller does not provide transfer-complete interrupt when not busy */
1797 +#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<15)
1798
1799 int irq; /* Device IRQ */
1800 void __iomem * ioaddr; /* Mapped address */
1801 @@ -222,6 +224,7 @@ struct sdhci_host {
1802
1803 #ifdef CONFIG_LEDS_CLASS
1804 struct led_classdev led; /* LED control */
1805 + char led_name[32];
1806 #endif
1807
1808 spinlock_t lock; /* Mutex */
1809 diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
1810 index 6dd9aff..18cba9e 100644
1811 --- a/drivers/mtd/devices/mtd_dataflash.c
1812 +++ b/drivers/mtd/devices/mtd_dataflash.c
1813 @@ -815,7 +815,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
1814 if (!(info->flags & IS_POW2PS))
1815 return info;
1816 }
1817 - }
1818 + } else
1819 + return info;
1820 }
1821 }
1822
1823 diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
1824 index de57490..aee6f1a 100644
1825 --- a/drivers/net/usb/asix.c
1826 +++ b/drivers/net/usb/asix.c
1827 @@ -1450,6 +1450,14 @@ static const struct usb_device_id products [] = {
1828 // Cables-to-Go USB Ethernet Adapter
1829 USB_DEVICE(0x0b95, 0x772a),
1830 .driver_info = (unsigned long) &ax88772_info,
1831 +}, {
1832 + // ABOCOM for pci
1833 + USB_DEVICE(0x14ea, 0xab11),
1834 + .driver_info = (unsigned long) &ax88178_info,
1835 +}, {
1836 + // ASIX 88772a
1837 + USB_DEVICE(0x0db0, 0xa877),
1838 + .driver_info = (unsigned long) &ax88772_info,
1839 },
1840 { }, // END
1841 };
1842 diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
1843 index 0e061df..55e8ecc 100644
1844 --- a/drivers/net/usb/cdc_ether.c
1845 +++ b/drivers/net/usb/cdc_ether.c
1846 @@ -559,6 +559,11 @@ static const struct usb_device_id products [] = {
1847 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
1848 USB_CDC_PROTO_NONE),
1849 .driver_info = (unsigned long) &cdc_info,
1850 +}, {
1851 + /* Ericsson F3507g */
1852 + USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
1853 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
1854 + .driver_info = (unsigned long) &cdc_info,
1855 },
1856 { }, // END
1857 };
1858 diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
1859 index e24f7b3..04882c8 100644
1860 --- a/drivers/net/usb/zaurus.c
1861 +++ b/drivers/net/usb/zaurus.c
1862 @@ -341,6 +341,11 @@ static const struct usb_device_id products [] = {
1863 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
1864 USB_CDC_PROTO_NONE),
1865 .driver_info = (unsigned long) &bogus_mdlm_info,
1866 +}, {
1867 + /* Motorola MOTOMAGX phones */
1868 + USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM,
1869 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
1870 + .driver_info = (unsigned long) &bogus_mdlm_info,
1871 },
1872
1873 /* Olympus has some models with a Zaurus-compatible option.
1874 diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
1875 index 47c1c48..6c0e347 100644
1876 --- a/drivers/net/wireless/rtl8187_dev.c
1877 +++ b/drivers/net/wireless/rtl8187_dev.c
1878 @@ -40,6 +40,10 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
1879 {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B},
1880 {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B},
1881 {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B},
1882 + /* Surecom */
1883 + {USB_DEVICE(0x0769, 0x11F2), .driver_info = DEVICE_RTL8187},
1884 + /* Logitech */
1885 + {USB_DEVICE(0x0789, 0x010C), .driver_info = DEVICE_RTL8187},
1886 /* Netgear */
1887 {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187},
1888 {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187},
1889 @@ -49,8 +53,16 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
1890 /* Sitecom */
1891 {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
1892 {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
1893 + /* Sphairon Access Systems GmbH */
1894 + {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
1895 + /* Dick Smith Electronics */
1896 + {USB_DEVICE(0x1371, 0x9401), .driver_info = DEVICE_RTL8187},
1897 /* Abocom */
1898 {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
1899 + /* Qcom */
1900 + {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187},
1901 + /* AirLive */
1902 + {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187},
1903 {}
1904 };
1905
1906 diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
1907 index aac7006..d0c9736 100644
1908 --- a/drivers/pci/pcie/aer/aerdrv_core.c
1909 +++ b/drivers/pci/pcie/aer/aerdrv_core.c
1910 @@ -108,6 +108,34 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
1911 }
1912 #endif /* 0 */
1913
1914 +
1915 +static void set_device_error_reporting(struct pci_dev *dev, void *data)
1916 +{
1917 + bool enable = *((bool *)data);
1918 +
1919 + if (dev->pcie_type != PCIE_RC_PORT &&
1920 + dev->pcie_type != PCIE_SW_UPSTREAM_PORT &&
1921 + dev->pcie_type != PCIE_SW_DOWNSTREAM_PORT)
1922 + return;
1923 +
1924 + if (enable)
1925 + pci_enable_pcie_error_reporting(dev);
1926 + else
1927 + pci_disable_pcie_error_reporting(dev);
1928 +}
1929 +
1930 +/**
1931 + * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports.
1932 + * @dev: pointer to root port's pci_dev data structure
1933 + * @enable: true = enable error reporting, false = disable error reporting.
1934 + */
1935 +static void set_downstream_devices_error_reporting(struct pci_dev *dev,
1936 + bool enable)
1937 +{
1938 + set_device_error_reporting(dev, &enable);
1939 + pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable);
1940 +}
1941 +
1942 static int find_device_iter(struct device *device, void *data)
1943 {
1944 struct pci_dev *dev;
1945 @@ -525,15 +553,11 @@ void aer_enable_rootport(struct aer_rpc *rpc)
1946 pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, &reg32);
1947 pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32);
1948
1949 - /* Enable Root Port device reporting error itself */
1950 - pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, &reg16);
1951 - reg16 = reg16 |
1952 - PCI_EXP_DEVCTL_CERE |
1953 - PCI_EXP_DEVCTL_NFERE |
1954 - PCI_EXP_DEVCTL_FERE |
1955 - PCI_EXP_DEVCTL_URRE;
1956 - pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL,
1957 - reg16);
1958 + /*
1959 + * Enable error reporting for the root port device and downstream port
1960 + * devices.
1961 + */
1962 + set_downstream_devices_error_reporting(pdev, true);
1963
1964 /* Enable Root Port's interrupt in response to error messages */
1965 pci_write_config_dword(pdev,
1966 @@ -553,6 +577,12 @@ static void disable_root_aer(struct aer_rpc *rpc)
1967 u32 reg32;
1968 int pos;
1969
1970 + /*
1971 + * Disable error reporting for the root port device and downstream port
1972 + * devices.
1973 + */
1974 + set_downstream_devices_error_reporting(pdev, false);
1975 +
1976 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
1977 /* Disable Root's interrupt in response to error messages */
1978 pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0);
1979 diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
1980 index 584422d..e22e7fb 100644
1981 --- a/drivers/pci/pcie/portdrv_pci.c
1982 +++ b/drivers/pci/pcie/portdrv_pci.c
1983 @@ -101,14 +101,13 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
1984
1985 pcie_portdrv_save_config(dev);
1986
1987 - pci_enable_pcie_error_reporting(dev);
1988 -
1989 return 0;
1990 }
1991
1992 static void pcie_portdrv_remove (struct pci_dev *dev)
1993 {
1994 pcie_port_device_remove(dev);
1995 + pci_disable_device(dev);
1996 kfree(pci_get_drvdata(dev));
1997 }
1998
1999 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
2000 index 5f4f85f..4fafcec 100644
2001 --- a/drivers/pci/quirks.c
2002 +++ b/drivers/pci/quirks.c
2003 @@ -23,6 +23,7 @@
2004 #include <linux/acpi.h>
2005 #include <linux/kallsyms.h>
2006 #include <linux/dmi.h>
2007 +#include <linux/pci-aspm.h>
2008 #include "pci.h"
2009
2010 int isa_dma_bridge_buggy;
2011 @@ -1543,6 +1544,30 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
2012 }
2013 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
2014
2015 +/*
2016 + * The 82575 and 82598 may experience data corruption issues when transitioning
2017 + * out of L0S. To prevent this we need to disable L0S on the pci-e link
2018 + */
2019 +static void __devinit quirk_disable_aspm_l0s(struct pci_dev *dev)
2020 +{
2021 + dev_info(&dev->dev, "Disabling L0s\n");
2022 + pci_disable_link_state(dev, PCIE_LINK_STATE_L0S);
2023 +}
2024 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s);
2025 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s);
2026 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s);
2027 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s);
2028 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s);
2029 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s);
2030 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s);
2031 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s);
2032 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s);
2033 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s);
2034 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s);
2035 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
2036 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
2037 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
2038 +
2039 static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
2040 {
2041 /* rev 1 ncr53c810 chips don't set the class at all which means
2042 @@ -1778,7 +1803,6 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
2043 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
2044 quirk_msi_ht_cap);
2045
2046 -
2047 /* The nVidia CK804 chipset may have 2 HT MSI mappings.
2048 * MSI are supported if the MSI capability set in any of these mappings.
2049 */
2050 @@ -1829,6 +1853,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
2051 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
2052 ht_enable_msi_mapping);
2053
2054 +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE,
2055 + ht_enable_msi_mapping);
2056 +
2057 /* The P5N32-SLI Premium motherboard from Asus has a problem with msi
2058 * for the MCP55 NIC. It is not yet determined whether the msi problem
2059 * also affects other devices. As for now, turn off msi for this device.
2060 diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
2061 index a48e499..34be88d 100644
2062 --- a/drivers/scsi/hptiop.c
2063 +++ b/drivers/scsi/hptiop.c
2064 @@ -1251,6 +1251,7 @@ static struct pci_device_id hptiop_id_table[] = {
2065 { PCI_VDEVICE(TTI, 0x3530), (kernel_ulong_t)&hptiop_itl_ops },
2066 { PCI_VDEVICE(TTI, 0x3560), (kernel_ulong_t)&hptiop_itl_ops },
2067 { PCI_VDEVICE(TTI, 0x4322), (kernel_ulong_t)&hptiop_itl_ops },
2068 + { PCI_VDEVICE(TTI, 0x4321), (kernel_ulong_t)&hptiop_itl_ops },
2069 { PCI_VDEVICE(TTI, 0x4210), (kernel_ulong_t)&hptiop_itl_ops },
2070 { PCI_VDEVICE(TTI, 0x4211), (kernel_ulong_t)&hptiop_itl_ops },
2071 { PCI_VDEVICE(TTI, 0x4310), (kernel_ulong_t)&hptiop_itl_ops },
2072 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
2073 index 5081b39..726d147 100644
2074 --- a/drivers/scsi/sd.c
2075 +++ b/drivers/scsi/sd.c
2076 @@ -106,6 +106,7 @@ static void scsi_disk_release(struct device *cdev);
2077 static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
2078 static void sd_print_result(struct scsi_disk *, int);
2079
2080 +static DEFINE_SPINLOCK(sd_index_lock);
2081 static DEFINE_IDA(sd_index_ida);
2082
2083 /* This semaphore is used to mediate the 0->1 reference get in the
2084 @@ -1847,7 +1848,9 @@ static int sd_probe(struct device *dev)
2085 if (!ida_pre_get(&sd_index_ida, GFP_KERNEL))
2086 goto out_put;
2087
2088 + spin_lock(&sd_index_lock);
2089 error = ida_get_new(&sd_index_ida, &index);
2090 + spin_unlock(&sd_index_lock);
2091 } while (error == -EAGAIN);
2092
2093 if (error)
2094 @@ -1910,7 +1913,9 @@ static int sd_probe(struct device *dev)
2095 return 0;
2096
2097 out_free_index:
2098 + spin_lock(&sd_index_lock);
2099 ida_remove(&sd_index_ida, index);
2100 + spin_unlock(&sd_index_lock);
2101 out_put:
2102 put_disk(gd);
2103 out_free:
2104 @@ -1960,7 +1965,9 @@ static void scsi_disk_release(struct device *dev)
2105 struct scsi_disk *sdkp = to_scsi_disk(dev);
2106 struct gendisk *disk = sdkp->disk;
2107
2108 + spin_lock(&sd_index_lock);
2109 ida_remove(&sd_index_ida, sdkp->index);
2110 + spin_unlock(&sd_index_lock);
2111
2112 disk->private_data = NULL;
2113 put_disk(disk);
2114 diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
2115 index 303272a..a181ccf 100644
2116 --- a/drivers/serial/8250.c
2117 +++ b/drivers/serial/8250.c
2118 @@ -2014,6 +2014,20 @@ static int serial8250_startup(struct uart_port *port)
2119
2120 serial8250_set_mctrl(&up->port, up->port.mctrl);
2121
2122 + /* Serial over Lan (SoL) hack:
2123 + Intel 8257x Gigabit ethernet chips have a
2124 + 16550 emulation, to be used for Serial Over Lan.
2125 + Those chips take a longer time than a normal
2126 + serial device to signalize that a transmission
2127 + data was queued. Due to that, the above test generally
2128 + fails. One solution would be to delay the reading of
2129 + iir. However, this is not reliable, since the timeout
2130 + is variable. So, let's just don't test if we receive
2131 + TX irq. This way, we'll never enable UART_BUG_TXEN.
2132 + */
2133 + if (up->port.flags & UPF_NO_TXEN_TEST)
2134 + goto dont_test_tx_en;
2135 +
2136 /*
2137 * Do a quick test to see if we receive an
2138 * interrupt when we enable the TX irq.
2139 @@ -2033,6 +2047,7 @@ static int serial8250_startup(struct uart_port *port)
2140 up->bugs &= ~UART_BUG_TXEN;
2141 }
2142
2143 +dont_test_tx_en:
2144 spin_unlock_irqrestore(&up->port.lock, flags);
2145
2146 /*
2147 diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
2148 index c4fbd9e..f2662a2 100644
2149 --- a/drivers/serial/8250_pci.c
2150 +++ b/drivers/serial/8250_pci.c
2151 @@ -758,6 +758,21 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
2152 return setup_port(priv, port, bar, offset, board->reg_shift);
2153 }
2154
2155 +static int skip_tx_en_setup(struct serial_private *priv,
2156 + const struct pciserial_board *board,
2157 + struct uart_port *port, int idx)
2158 +{
2159 + port->flags |= UPF_NO_TXEN_TEST;
2160 + printk(KERN_DEBUG "serial8250: skipping TxEn test for device "
2161 + "[%04x:%04x] subsystem [%04x:%04x]\n",
2162 + priv->dev->vendor,
2163 + priv->dev->device,
2164 + priv->dev->subsystem_vendor,
2165 + priv->dev->subsystem_device);
2166 +
2167 + return pci_default_setup(priv, board, port, idx);
2168 +}
2169 +
2170 /* This should be in linux/pci_ids.h */
2171 #define PCI_VENDOR_ID_SBSMODULARIO 0x124B
2172 #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
2173 @@ -824,6 +839,27 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
2174 .init = pci_inteli960ni_init,
2175 .setup = pci_default_setup,
2176 },
2177 + {
2178 + .vendor = PCI_VENDOR_ID_INTEL,
2179 + .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
2180 + .subvendor = PCI_ANY_ID,
2181 + .subdevice = PCI_ANY_ID,
2182 + .setup = skip_tx_en_setup,
2183 + },
2184 + {
2185 + .vendor = PCI_VENDOR_ID_INTEL,
2186 + .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
2187 + .subvendor = PCI_ANY_ID,
2188 + .subdevice = PCI_ANY_ID,
2189 + .setup = skip_tx_en_setup,
2190 + },
2191 + {
2192 + .vendor = PCI_VENDOR_ID_INTEL,
2193 + .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
2194 + .subvendor = PCI_ANY_ID,
2195 + .subdevice = PCI_ANY_ID,
2196 + .setup = skip_tx_en_setup,
2197 + },
2198 /*
2199 * ITE
2200 */
2201 diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
2202 index 338cf8a..edec3a9 100644
2203 --- a/drivers/serial/jsm/jsm_driver.c
2204 +++ b/drivers/serial/jsm/jsm_driver.c
2205 @@ -84,6 +84,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2206 brd->pci_dev = pdev;
2207 if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM)
2208 brd->maxports = 4;
2209 + else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8)
2210 + brd->maxports = 8;
2211 else
2212 brd->maxports = 2;
2213
2214 @@ -212,6 +214,7 @@ static struct pci_device_id jsm_pci_tbl[] = {
2215 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 },
2216 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 },
2217 { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 },
2218 + { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 },
2219 { 0, }
2220 };
2221 MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);
2222 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
2223 index d50a99f..4b3549b 100644
2224 --- a/drivers/usb/class/cdc-acm.c
2225 +++ b/drivers/usb/class/cdc-acm.c
2226 @@ -1370,6 +1370,8 @@ static struct usb_device_id acm_ids[] = {
2227 { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */
2228 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
2229 },
2230 + { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
2231 + },
2232
2233 /* control interfaces with various AT-command sets */
2234 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
2235 diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
2236 index 8497f63..e00127c 100644
2237 --- a/drivers/usb/core/message.c
2238 +++ b/drivers/usb/core/message.c
2239 @@ -651,7 +651,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type,
2240 if (result <= 0 && result != -ETIMEDOUT)
2241 continue;
2242 if (result > 1 && ((u8 *)buf)[1] != type) {
2243 - result = -EPROTO;
2244 + result = -ENODATA;
2245 continue;
2246 }
2247 break;
2248 @@ -694,8 +694,13 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid,
2249 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
2250 (USB_DT_STRING << 8) + index, langid, buf, size,
2251 USB_CTRL_GET_TIMEOUT);
2252 - if (!(result == 0 || result == -EPIPE))
2253 - break;
2254 + if (result == 0 || result == -EPIPE)
2255 + continue;
2256 + if (result > 1 && ((u8 *) buf)[1] != USB_DT_STRING) {
2257 + result = -ENODATA;
2258 + continue;
2259 + }
2260 + break;
2261 }
2262 return result;
2263 }
2264 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
2265 index 4725d15..e551bb3 100644
2266 --- a/drivers/usb/host/ehci-hcd.c
2267 +++ b/drivers/usb/host/ehci-hcd.c
2268 @@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd)
2269 * periodic_size can shrink by USBCMD update if hcc_params allows.
2270 */
2271 ehci->periodic_size = DEFAULT_I_TDPS;
2272 + INIT_LIST_HEAD(&ehci->cached_itd_list);
2273 if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
2274 return retval;
2275
2276 @@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd)
2277
2278 ehci->reclaim = NULL;
2279 ehci->next_uframe = -1;
2280 + ehci->clock_frame = -1;
2281
2282 /*
2283 * dedicate a qh for the async ring head, since we couldn't unlink
2284 diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
2285 index 0431397..10d5291 100644
2286 --- a/drivers/usb/host/ehci-mem.c
2287 +++ b/drivers/usb/host/ehci-mem.c
2288 @@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh)
2289
2290 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
2291 {
2292 + free_cached_itd_list(ehci);
2293 if (ehci->async)
2294 qh_put (ehci->async);
2295 ehci->async = NULL;
2296 diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
2297 index a081ee6..07bcb93 100644
2298 --- a/drivers/usb/host/ehci-sched.c
2299 +++ b/drivers/usb/host/ehci-sched.c
2300 @@ -1004,7 +1004,8 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
2301
2302 is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0;
2303 stream->bEndpointAddress &= 0x0f;
2304 - stream->ep->hcpriv = NULL;
2305 + if (stream->ep)
2306 + stream->ep->hcpriv = NULL;
2307
2308 if (stream->rescheduled) {
2309 ehci_info (ehci, "ep%d%s-iso rescheduled "
2310 @@ -1653,14 +1654,28 @@ itd_complete (
2311 (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
2312 }
2313 iso_stream_put (ehci, stream);
2314 - /* OK to recycle this ITD now that its completion callback ran. */
2315 +
2316 done:
2317 usb_put_urb(urb);
2318 itd->urb = NULL;
2319 - itd->stream = NULL;
2320 - list_move(&itd->itd_list, &stream->free_list);
2321 - iso_stream_put(ehci, stream);
2322 -
2323 + if (ehci->clock_frame != itd->frame || itd->index[7] != -1) {
2324 + /* OK to recycle this ITD now. */
2325 + itd->stream = NULL;
2326 + list_move(&itd->itd_list, &stream->free_list);
2327 + iso_stream_put(ehci, stream);
2328 + } else {
2329 + /* HW might remember this ITD, so we can't recycle it yet.
2330 + * Move it to a safe place until a new frame starts.
2331 + */
2332 + list_move(&itd->itd_list, &ehci->cached_itd_list);
2333 + if (stream->refcount == 2) {
2334 + /* If iso_stream_put() were called here, stream
2335 + * would be freed. Instead, just prevent reuse.
2336 + */
2337 + stream->ep->hcpriv = NULL;
2338 + stream->ep = NULL;
2339 + }
2340 + }
2341 return retval;
2342 }
2343
2344 @@ -2101,6 +2116,20 @@ done:
2345
2346 /*-------------------------------------------------------------------------*/
2347
2348 +static void free_cached_itd_list(struct ehci_hcd *ehci)
2349 +{
2350 + struct ehci_itd *itd, *n;
2351 +
2352 + list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
2353 + struct ehci_iso_stream *stream = itd->stream;
2354 + itd->stream = NULL;
2355 + list_move(&itd->itd_list, &stream->free_list);
2356 + iso_stream_put(ehci, stream);
2357 + }
2358 +}
2359 +
2360 +/*-------------------------------------------------------------------------*/
2361 +
2362 static void
2363 scan_periodic (struct ehci_hcd *ehci)
2364 {
2365 @@ -2115,10 +2144,17 @@ scan_periodic (struct ehci_hcd *ehci)
2366 * Touches as few pages as possible: cache-friendly.
2367 */
2368 now_uframe = ehci->next_uframe;
2369 - if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state))
2370 + if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) {
2371 clock = ehci_readl(ehci, &ehci->regs->frame_index);
2372 - else
2373 + clock_frame = (clock >> 3) % ehci->periodic_size;
2374 + } else {
2375 clock = now_uframe + mod - 1;
2376 + clock_frame = -1;
2377 + }
2378 + if (ehci->clock_frame != clock_frame) {
2379 + free_cached_itd_list(ehci);
2380 + ehci->clock_frame = clock_frame;
2381 + }
2382 clock %= mod;
2383 clock_frame = clock >> 3;
2384
2385 @@ -2277,6 +2313,10 @@ restart:
2386 /* rescan the rest of this frame, then ... */
2387 clock = now;
2388 clock_frame = clock >> 3;
2389 + if (ehci->clock_frame != clock_frame) {
2390 + free_cached_itd_list(ehci);
2391 + ehci->clock_frame = clock_frame;
2392 + }
2393 } else {
2394 now_uframe++;
2395 now_uframe %= mod;
2396 diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
2397 index c7d4b5a..fe97688 100644
2398 --- a/drivers/usb/host/ehci.h
2399 +++ b/drivers/usb/host/ehci.h
2400 @@ -87,6 +87,10 @@ struct ehci_hcd { /* one per controller */
2401 int next_uframe; /* scan periodic, start here */
2402 unsigned periodic_sched; /* periodic activity count */
2403
2404 + /* list of itds completed while clock_frame was still active */
2405 + struct list_head cached_itd_list;
2406 + unsigned clock_frame;
2407 +
2408 /* per root hub port */
2409 unsigned long reset_done [EHCI_MAX_ROOT_PORTS];
2410
2411 @@ -210,6 +214,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
2412 }
2413 }
2414
2415 +static void free_cached_itd_list(struct ehci_hcd *ehci);
2416 +
2417 /*-------------------------------------------------------------------------*/
2418
2419 #include <linux/usb/ehci_def.h>
2420 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2421 index d0ed63d..5c3da3f 100644
2422 --- a/drivers/usb/serial/option.c
2423 +++ b/drivers/usb/serial/option.c
2424 @@ -289,6 +289,9 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
2425 #define ERICSSON_VENDOR_ID 0x0bdb
2426 #define ERICSSON_PRODUCT_F3507G 0x1900
2427
2428 +#define BENQ_VENDOR_ID 0x04a5
2429 +#define BENQ_PRODUCT_H10 0x4068
2430 +
2431 static struct usb_device_id option_ids[] = {
2432 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
2433 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
2434 @@ -498,6 +501,8 @@ static struct usb_device_id option_ids[] = {
2435 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
2436 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
2437 { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) },
2438 + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
2439 + { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */
2440 { } /* Terminating entry */
2441 };
2442 MODULE_DEVICE_TABLE(usb, option_ids);
2443 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
2444 index 729a256..781d581 100644
2445 --- a/drivers/usb/storage/unusual_devs.h
2446 +++ b/drivers/usb/storage/unusual_devs.h
2447 @@ -876,13 +876,13 @@ UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff,
2448 "Genesys Logic",
2449 "USB to IDE Optical",
2450 US_SC_DEVICE, US_PR_DEVICE, NULL,
2451 - US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
2452 + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
2453
2454 UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff,
2455 "Genesys Logic",
2456 "USB to IDE Disk",
2457 US_SC_DEVICE, US_PR_DEVICE, NULL,
2458 - US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
2459 + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
2460
2461 /* Reported by Hanno Boeck <hanno@gmx.de>
2462 * Taken from the Lycoris Kernel */
2463 diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
2464 index 0b798fd..74c92d3 100644
2465 --- a/drivers/watchdog/ks8695_wdt.c
2466 +++ b/drivers/watchdog/ks8695_wdt.c
2467 @@ -21,6 +21,7 @@
2468 #include <linux/watchdog.h>
2469 #include <linux/io.h>
2470 #include <linux/uaccess.h>
2471 +#include <mach/timex.h>
2472 #include <mach/regs-timer.h>
2473
2474 #define WDT_DEFAULT_TIME 5 /* seconds */
2475 diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
2476 index 57027f4..f3553fa 100644
2477 --- a/drivers/watchdog/rc32434_wdt.c
2478 +++ b/drivers/watchdog/rc32434_wdt.c
2479 @@ -34,104 +34,89 @@
2480 #include <asm/time.h>
2481 #include <asm/mach-rc32434/integ.h>
2482
2483 -#define MAX_TIMEOUT 20
2484 -#define RC32434_WDT_INTERVAL (15 * HZ)
2485 -
2486 -#define VERSION "0.2"
2487 +#define VERSION "0.4"
2488
2489 static struct {
2490 - struct completion stop;
2491 - int running;
2492 - struct timer_list timer;
2493 - int queue;
2494 - int default_ticks;
2495 unsigned long inuse;
2496 } rc32434_wdt_device;
2497
2498 static struct integ __iomem *wdt_reg;
2499 -static int ticks = 100 * HZ;
2500
2501 static int expect_close;
2502 -static int timeout;
2503 +
2504 +/* Board internal clock speed in Hz,
2505 + * the watchdog timer ticks at. */
2506 +extern unsigned int idt_cpu_freq;
2507 +
2508 +/* translate wtcompare value to seconds and vice versa */
2509 +#define WTCOMP2SEC(x) (x / idt_cpu_freq)
2510 +#define SEC2WTCOMP(x) (x * idt_cpu_freq)
2511 +
2512 +/* Use a default timeout of 20s. This should be
2513 + * safe for CPU clock speeds up to 400MHz, as
2514 + * ((2 ^ 32) - 1) / (400MHz / 2) = 21s. */
2515 +#define WATCHDOG_TIMEOUT 20
2516 +
2517 +static int timeout = WATCHDOG_TIMEOUT;
2518
2519 static int nowayout = WATCHDOG_NOWAYOUT;
2520 module_param(nowayout, int, 0);
2521 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
2522 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
2523
2524 +/* apply or and nand masks to data read from addr and write back */
2525 +#define SET_BITS(addr, or, nand) \
2526 + writel((readl(&addr) | or) & ~nand, &addr)
2527
2528 static void rc32434_wdt_start(void)
2529 {
2530 - u32 val;
2531 -
2532 - if (!rc32434_wdt_device.inuse) {
2533 - writel(0, &wdt_reg->wtcount);
2534 + u32 or, nand;
2535
2536 - val = RC32434_ERR_WRE;
2537 - writel(readl(&wdt_reg->errcs) | val, &wdt_reg->errcs);
2538 + /* zero the counter before enabling */
2539 + writel(0, &wdt_reg->wtcount);
2540
2541 - val = RC32434_WTC_EN;
2542 - writel(readl(&wdt_reg->wtc) | val, &wdt_reg->wtc);
2543 - }
2544 - rc32434_wdt_device.running++;
2545 -}
2546 + /* don't generate a non-maskable interrupt,
2547 + * do a warm reset instead */
2548 + nand = 1 << RC32434_ERR_WNE;
2549 + or = 1 << RC32434_ERR_WRE;
2550
2551 -static void rc32434_wdt_stop(void)
2552 -{
2553 - u32 val;
2554 + /* reset the ERRCS timeout bit in case it's set */
2555 + nand |= 1 << RC32434_ERR_WTO;
2556
2557 - if (rc32434_wdt_device.running) {
2558 + SET_BITS(wdt_reg->errcs, or, nand);
2559
2560 - val = ~RC32434_WTC_EN;
2561 - writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc);
2562 + /* reset WTC timeout bit and enable WDT */
2563 + nand = 1 << RC32434_WTC_TO;
2564 + or = 1 << RC32434_WTC_EN;
2565
2566 - val = ~RC32434_ERR_WRE;
2567 - writel(readl(&wdt_reg->errcs) & val, &wdt_reg->errcs);
2568 + SET_BITS(wdt_reg->wtc, or, nand);
2569 +}
2570
2571 - rc32434_wdt_device.running = 0;
2572 - }
2573 +static void rc32434_wdt_stop(void)
2574 +{
2575 + /* Disable WDT */
2576 + SET_BITS(wdt_reg->wtc, 0, 1 << RC32434_WTC_EN);
2577 }
2578
2579 -static void rc32434_wdt_set(int new_timeout)
2580 +static int rc32434_wdt_set(int new_timeout)
2581 {
2582 - u32 cmp = new_timeout * HZ;
2583 - u32 state, val;
2584 + int max_to = WTCOMP2SEC((u32)-1);
2585
2586 + if (new_timeout < 0 || new_timeout > max_to) {
2587 + printk(KERN_ERR KBUILD_MODNAME
2588 + ": timeout value must be between 0 and %d",
2589 + max_to);
2590 + return -EINVAL;
2591 + }
2592 timeout = new_timeout;
2593 - /*
2594 - * store and disable WTC
2595 - */
2596 - state = (u32)(readl(&wdt_reg->wtc) & RC32434_WTC_EN);
2597 - val = ~RC32434_WTC_EN;
2598 - writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc);
2599 -
2600 - writel(0, &wdt_reg->wtcount);
2601 - writel(cmp, &wdt_reg->wtcompare);
2602 -
2603 - /*
2604 - * restore WTC
2605 - */
2606 -
2607 - writel(readl(&wdt_reg->wtc) | state, &wdt_reg);
2608 -}
2609 + writel(SEC2WTCOMP(timeout), &wdt_reg->wtcompare);
2610
2611 -static void rc32434_wdt_reset(void)
2612 -{
2613 - ticks = rc32434_wdt_device.default_ticks;
2614 + return 0;
2615 }
2616
2617 -static void rc32434_wdt_update(unsigned long unused)
2618 +static void rc32434_wdt_ping(void)
2619 {
2620 - if (rc32434_wdt_device.running)
2621 - ticks--;
2622 -
2623 writel(0, &wdt_reg->wtcount);
2624 -
2625 - if (rc32434_wdt_device.queue && ticks)
2626 - mod_timer(&rc32434_wdt_device.timer,
2627 - jiffies + RC32434_WDT_INTERVAL);
2628 - else
2629 - complete(&rc32434_wdt_device.stop);
2630 }
2631
2632 static int rc32434_wdt_open(struct inode *inode, struct file *file)
2633 @@ -142,19 +127,23 @@ static int rc32434_wdt_open(struct inode *inode, struct file *file)
2634 if (nowayout)
2635 __module_get(THIS_MODULE);
2636
2637 + rc32434_wdt_start();
2638 + rc32434_wdt_ping();
2639 +
2640 return nonseekable_open(inode, file);
2641 }
2642
2643 static int rc32434_wdt_release(struct inode *inode, struct file *file)
2644 {
2645 - if (expect_close && nowayout == 0) {
2646 + if (expect_close == 42) {
2647 rc32434_wdt_stop();
2648 printk(KERN_INFO KBUILD_MODNAME ": disabling watchdog timer\n");
2649 module_put(THIS_MODULE);
2650 - } else
2651 + } else {
2652 printk(KERN_CRIT KBUILD_MODNAME
2653 ": device closed unexpectedly. WDT will not stop !\n");
2654 -
2655 + rc32434_wdt_ping();
2656 + }
2657 clear_bit(0, &rc32434_wdt_device.inuse);
2658 return 0;
2659 }
2660 @@ -174,10 +163,10 @@ static ssize_t rc32434_wdt_write(struct file *file, const char *data,
2661 if (get_user(c, data + i))
2662 return -EFAULT;
2663 if (c == 'V')
2664 - expect_close = 1;
2665 + expect_close = 42;
2666 }
2667 }
2668 - rc32434_wdt_update(0);
2669 + rc32434_wdt_ping();
2670 return len;
2671 }
2672 return 0;
2673 @@ -197,11 +186,11 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
2674 };
2675 switch (cmd) {
2676 case WDIOC_KEEPALIVE:
2677 - rc32434_wdt_reset();
2678 + rc32434_wdt_ping();
2679 break;
2680 case WDIOC_GETSTATUS:
2681 case WDIOC_GETBOOTSTATUS:
2682 - value = readl(&wdt_reg->wtcount);
2683 + value = 0;
2684 if (copy_to_user(argp, &value, sizeof(int)))
2685 return -EFAULT;
2686 break;
2687 @@ -218,6 +207,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
2688 break;
2689 case WDIOS_DISABLECARD:
2690 rc32434_wdt_stop();
2691 + break;
2692 default:
2693 return -EINVAL;
2694 }
2695 @@ -225,11 +215,9 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
2696 case WDIOC_SETTIMEOUT:
2697 if (copy_from_user(&new_timeout, argp, sizeof(int)))
2698 return -EFAULT;
2699 - if (new_timeout < 1)
2700 + if (rc32434_wdt_set(new_timeout))
2701 return -EINVAL;
2702 - if (new_timeout > MAX_TIMEOUT)
2703 - return -EINVAL;
2704 - rc32434_wdt_set(new_timeout);
2705 + /* Fall through */
2706 case WDIOC_GETTIMEOUT:
2707 return copy_to_user(argp, &timeout, sizeof(int));
2708 default:
2709 @@ -254,15 +242,15 @@ static struct miscdevice rc32434_wdt_miscdev = {
2710 .fops = &rc32434_wdt_fops,
2711 };
2712
2713 -static char banner[] = KERN_INFO KBUILD_MODNAME
2714 +static char banner[] __devinitdata = KERN_INFO KBUILD_MODNAME
2715 ": Watchdog Timer version " VERSION ", timer margin: %d sec\n";
2716
2717 -static int rc32434_wdt_probe(struct platform_device *pdev)
2718 +static int __devinit rc32434_wdt_probe(struct platform_device *pdev)
2719 {
2720 int ret;
2721 struct resource *r;
2722
2723 - r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb500_wdt_res");
2724 + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb532_wdt_res");
2725 if (!r) {
2726 printk(KERN_ERR KBUILD_MODNAME
2727 "failed to retrieve resources\n");
2728 @@ -277,24 +265,12 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
2729 }
2730
2731 ret = misc_register(&rc32434_wdt_miscdev);
2732 -
2733 if (ret < 0) {
2734 printk(KERN_ERR KBUILD_MODNAME
2735 "failed to register watchdog device\n");
2736 goto unmap;
2737 }
2738
2739 - init_completion(&rc32434_wdt_device.stop);
2740 - rc32434_wdt_device.queue = 0;
2741 -
2742 - clear_bit(0, &rc32434_wdt_device.inuse);
2743 -
2744 - setup_timer(&rc32434_wdt_device.timer, rc32434_wdt_update, 0L);
2745 -
2746 - rc32434_wdt_device.default_ticks = ticks;
2747 -
2748 - rc32434_wdt_start();
2749 -
2750 printk(banner, timeout);
2751
2752 return 0;
2753 @@ -304,23 +280,17 @@ unmap:
2754 return ret;
2755 }
2756
2757 -static int rc32434_wdt_remove(struct platform_device *pdev)
2758 +static int __devexit rc32434_wdt_remove(struct platform_device *pdev)
2759 {
2760 - if (rc32434_wdt_device.queue) {
2761 - rc32434_wdt_device.queue = 0;
2762 - wait_for_completion(&rc32434_wdt_device.stop);
2763 - }
2764 misc_deregister(&rc32434_wdt_miscdev);
2765 -
2766 iounmap(wdt_reg);
2767 -
2768 return 0;
2769 }
2770
2771 static struct platform_driver rc32434_wdt = {
2772 .probe = rc32434_wdt_probe,
2773 - .remove = rc32434_wdt_remove,
2774 - .driver = {
2775 + .remove = __devexit_p(rc32434_wdt_remove),
2776 + .driver = {
2777 .name = "rc32434_wdt",
2778 }
2779 };
2780 diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
2781 index e078b7a..4c1cb9a 100644
2782 --- a/fs/cifs/CHANGES
2783 +++ b/fs/cifs/CHANGES
2784 @@ -1,3 +1,5 @@
2785 +Fix oops in cifs_dfs_ref.c when prefixpath is not reachable when using DFS.
2786 +
2787 Version 1.55
2788 ------------
2789 Various fixes to make delete of open files behavior more predictable
2790 diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
2791 index 2851d5d..3cfa452 100644
2792 --- a/fs/cifs/sess.c
2793 +++ b/fs/cifs/sess.c
2794 @@ -228,7 +228,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
2795
2796 kfree(ses->serverOS);
2797 /* UTF-8 string will not grow more than four times as big as UCS-16 */
2798 - ses->serverOS = kzalloc(4 * len, GFP_KERNEL);
2799 + ses->serverOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
2800 if (ses->serverOS != NULL)
2801 cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp);
2802 data += 2 * (len + 1);
2803 @@ -241,7 +241,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
2804 return rc;
2805
2806 kfree(ses->serverNOS);
2807 - ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */
2808 + ses->serverNOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
2809 if (ses->serverNOS != NULL) {
2810 cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len,
2811 nls_cp);
2812 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
2813 index c8f8d59..61cb48f 100644
2814 --- a/fs/compat_ioctl.c
2815 +++ b/fs/compat_ioctl.c
2816 @@ -1938,6 +1938,8 @@ ULONG_IOCTL(SET_BITMAP_FILE)
2817 /* Big K */
2818 COMPATIBLE_IOCTL(PIO_FONT)
2819 COMPATIBLE_IOCTL(GIO_FONT)
2820 +COMPATIBLE_IOCTL(PIO_CMAP)
2821 +COMPATIBLE_IOCTL(GIO_CMAP)
2822 ULONG_IOCTL(KDSIGACCEPT)
2823 COMPATIBLE_IOCTL(KDGETKEYCODE)
2824 COMPATIBLE_IOCTL(KDSETKEYCODE)
2825 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2826 index dfccef5..0b0c0fa 100644
2827 --- a/fs/ext4/ext4.h
2828 +++ b/fs/ext4/ext4.h
2829 @@ -862,7 +862,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
2830 {
2831 unsigned len = le16_to_cpu(dlen);
2832
2833 - if (len == EXT4_MAX_REC_LEN)
2834 + if (len == EXT4_MAX_REC_LEN || len == 0)
2835 return 1 << 16;
2836 return len;
2837 }
2838 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
2839 index b363c49..03c0819 100644
2840 --- a/fs/ext4/ialloc.c
2841 +++ b/fs/ext4/ialloc.c
2842 @@ -703,6 +703,13 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
2843
2844 if (sbi->s_log_groups_per_flex) {
2845 ret2 = find_group_flex(sb, dir, &group);
2846 + if (ret2 == -1) {
2847 + ret2 = find_group_other(sb, dir, &group);
2848 + if (ret2 == 0 && printk_ratelimit())
2849 + printk(KERN_NOTICE "ext4: find_group_flex "
2850 + "failed, fallback succeeded dir %lu\n",
2851 + dir->i_ino);
2852 + }
2853 goto got_group;
2854 }
2855
2856 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2857 index ccb6947..b7f20b0 100644
2858 --- a/fs/ext4/inode.c
2859 +++ b/fs/ext4/inode.c
2860 @@ -46,8 +46,10 @@
2861 static inline int ext4_begin_ordered_truncate(struct inode *inode,
2862 loff_t new_size)
2863 {
2864 - return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode,
2865 - new_size);
2866 + return jbd2_journal_begin_ordered_truncate(
2867 + EXT4_SB(inode->i_sb)->s_journal,
2868 + &EXT4_I(inode)->jinode,
2869 + new_size);
2870 }
2871
2872 static void ext4_invalidatepage(struct page *page, unsigned long offset);
2873 @@ -1345,6 +1347,10 @@ retry:
2874 goto out;
2875 }
2876
2877 + /* We cannot recurse into the filesystem as the transaction is already
2878 + * started */
2879 + flags |= AOP_FLAG_NOFS;
2880 +
2881 page = grab_cache_page_write_begin(mapping, index, flags);
2882 if (!page) {
2883 ext4_journal_stop(handle);
2884 @@ -1354,7 +1360,7 @@ retry:
2885 *pagep = page;
2886
2887 ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
2888 - ext4_get_block);
2889 + ext4_get_block);
2890
2891 if (!ret && ext4_should_journal_data(inode)) {
2892 ret = walk_page_buffers(handle, page_buffers(page),
2893 @@ -2400,6 +2406,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2894 struct inode *inode = mapping->host;
2895 int no_nrwrite_index_update;
2896 long pages_written = 0, pages_skipped;
2897 + int range_cyclic, cycled = 1, io_done = 0;
2898 int needed_blocks, ret = 0, nr_to_writebump = 0;
2899 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2900
2901 @@ -2437,9 +2444,15 @@ static int ext4_da_writepages(struct address_space *mapping,
2902 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
2903 range_whole = 1;
2904
2905 - if (wbc->range_cyclic)
2906 + range_cyclic = wbc->range_cyclic;
2907 + if (wbc->range_cyclic) {
2908 index = mapping->writeback_index;
2909 - else
2910 + if (index)
2911 + cycled = 0;
2912 + wbc->range_start = index << PAGE_CACHE_SHIFT;
2913 + wbc->range_end = LLONG_MAX;
2914 + wbc->range_cyclic = 0;
2915 + } else
2916 index = wbc->range_start >> PAGE_CACHE_SHIFT;
2917
2918 mpd.wbc = wbc;
2919 @@ -2453,6 +2466,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2920 wbc->no_nrwrite_index_update = 1;
2921 pages_skipped = wbc->pages_skipped;
2922
2923 +retry:
2924 while (!ret && wbc->nr_to_write > 0) {
2925
2926 /*
2927 @@ -2495,6 +2509,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2928 pages_written += mpd.pages_written;
2929 wbc->pages_skipped = pages_skipped;
2930 ret = 0;
2931 + io_done = 1;
2932 } else if (wbc->nr_to_write)
2933 /*
2934 * There is no more writeout needed
2935 @@ -2503,6 +2518,13 @@ static int ext4_da_writepages(struct address_space *mapping,
2936 */
2937 break;
2938 }
2939 + if (!io_done && !cycled) {
2940 + cycled = 1;
2941 + index = 0;
2942 + wbc->range_start = index << PAGE_CACHE_SHIFT;
2943 + wbc->range_end = mapping->writeback_index - 1;
2944 + goto retry;
2945 + }
2946 if (pages_skipped != wbc->pages_skipped)
2947 printk(KERN_EMERG "This should not happen leaving %s "
2948 "with nr_to_write = %ld ret = %d\n",
2949 @@ -2510,6 +2532,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2950
2951 /* Update index */
2952 index += pages_written;
2953 + wbc->range_cyclic = range_cyclic;
2954 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
2955 /*
2956 * set the writeback_index so that range_cyclic
2957 @@ -2584,6 +2607,9 @@ retry:
2958 ret = PTR_ERR(handle);
2959 goto out;
2960 }
2961 + /* We cannot recurse into the filesystem as the transaction is already
2962 + * started */
2963 + flags |= AOP_FLAG_NOFS;
2964
2965 page = grab_cache_page_write_begin(mapping, index, flags);
2966 if (!page) {
2967 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
2968 index 775ef32..f8e923f 100644
2969 --- a/fs/ext4/mballoc.c
2970 +++ b/fs/ext4/mballoc.c
2971 @@ -3690,6 +3690,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
2972 pa->pa_free = pa->pa_len;
2973 atomic_set(&pa->pa_count, 1);
2974 spin_lock_init(&pa->pa_lock);
2975 + INIT_LIST_HEAD(&pa->pa_inode_list);
2976 + INIT_LIST_HEAD(&pa->pa_group_list);
2977 pa->pa_deleted = 0;
2978 pa->pa_linear = 0;
2979
2980 @@ -3748,6 +3750,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
2981 atomic_set(&pa->pa_count, 1);
2982 spin_lock_init(&pa->pa_lock);
2983 INIT_LIST_HEAD(&pa->pa_inode_list);
2984 + INIT_LIST_HEAD(&pa->pa_group_list);
2985 pa->pa_deleted = 0;
2986 pa->pa_linear = 1;
2987
2988 @@ -4456,23 +4459,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
2989 pa->pa_free -= ac->ac_b_ex.fe_len;
2990 pa->pa_len -= ac->ac_b_ex.fe_len;
2991 spin_unlock(&pa->pa_lock);
2992 - /*
2993 - * We want to add the pa to the right bucket.
2994 - * Remove it from the list and while adding
2995 - * make sure the list to which we are adding
2996 - * doesn't grow big.
2997 - */
2998 - if (likely(pa->pa_free)) {
2999 - spin_lock(pa->pa_obj_lock);
3000 - list_del_rcu(&pa->pa_inode_list);
3001 - spin_unlock(pa->pa_obj_lock);
3002 - ext4_mb_add_n_trim(ac);
3003 - }
3004 }
3005 - ext4_mb_put_pa(ac, ac->ac_sb, pa);
3006 }
3007 if (ac->alloc_semp)
3008 up_read(ac->alloc_semp);
3009 + if (pa) {
3010 + /*
3011 + * We want to add the pa to the right bucket.
3012 + * Remove it from the list and while adding
3013 + * make sure the list to which we are adding
3014 + * doesn't grow big. We need to release
3015 + * alloc_semp before calling ext4_mb_add_n_trim()
3016 + */
3017 + if (pa->pa_linear && likely(pa->pa_free)) {
3018 + spin_lock(pa->pa_obj_lock);
3019 + list_del_rcu(&pa->pa_inode_list);
3020 + spin_unlock(pa->pa_obj_lock);
3021 + ext4_mb_add_n_trim(ac);
3022 + }
3023 + ext4_mb_put_pa(ac, ac->ac_sb, pa);
3024 + }
3025 if (ac->ac_bitmap_page)
3026 page_cache_release(ac->ac_bitmap_page);
3027 if (ac->ac_buddy_page)
3028 diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
3029 index f2a9cf4..9aa0fbe 100644
3030 --- a/fs/ext4/migrate.c
3031 +++ b/fs/ext4/migrate.c
3032 @@ -480,7 +480,7 @@ int ext4_ext_migrate(struct inode *inode)
3033 + 1);
3034 if (IS_ERR(handle)) {
3035 retval = PTR_ERR(handle);
3036 - goto err_out;
3037 + return retval;
3038 }
3039 tmp_inode = ext4_new_inode(handle,
3040 inode->i_sb->s_root->d_inode,
3041 @@ -488,8 +488,7 @@ int ext4_ext_migrate(struct inode *inode)
3042 if (IS_ERR(tmp_inode)) {
3043 retval = -ENOMEM;
3044 ext4_journal_stop(handle);
3045 - tmp_inode = NULL;
3046 - goto err_out;
3047 + return retval;
3048 }
3049 i_size_write(tmp_inode, i_size_read(inode));
3050 /*
3051 @@ -617,8 +616,7 @@ err_out:
3052
3053 ext4_journal_stop(handle);
3054
3055 - if (tmp_inode)
3056 - iput(tmp_inode);
3057 + iput(tmp_inode);
3058
3059 return retval;
3060 }
3061 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
3062 index d38e3e1..e522b8c 100644
3063 --- a/fs/ext4/super.c
3064 +++ b/fs/ext4/super.c
3065 @@ -2914,15 +2914,15 @@ static void ext4_write_super(struct super_block *sb)
3066
3067 static int ext4_sync_fs(struct super_block *sb, int wait)
3068 {
3069 - int ret = 0;
3070 + tid_t target;
3071
3072 trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
3073 sb->s_dirt = 0;
3074 - if (wait)
3075 - ret = ext4_force_commit(sb);
3076 - else
3077 - jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL);
3078 - return ret;
3079 + if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target)) {
3080 + if (wait)
3081 + jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target);
3082 + }
3083 + return 0;
3084 }
3085
3086 /*
3087 diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
3088 index e5eaa62..e3fe991 100644
3089 --- a/fs/fs-writeback.c
3090 +++ b/fs/fs-writeback.c
3091 @@ -274,6 +274,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
3092 int ret;
3093
3094 BUG_ON(inode->i_state & I_SYNC);
3095 + WARN_ON(inode->i_state & I_NEW);
3096
3097 /* Set I_SYNC, reset I_DIRTY */
3098 dirty = inode->i_state & I_DIRTY;
3099 @@ -298,6 +299,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
3100 }
3101
3102 spin_lock(&inode_lock);
3103 + WARN_ON(inode->i_state & I_NEW);
3104 inode->i_state &= ~I_SYNC;
3105 if (!(inode->i_state & I_FREEING)) {
3106 if (!(inode->i_state & I_DIRTY) &&
3107 @@ -470,6 +472,11 @@ void generic_sync_sb_inodes(struct super_block *sb,
3108 break;
3109 }
3110
3111 + if (inode->i_state & I_NEW) {
3112 + requeue_io(inode);
3113 + continue;
3114 + }
3115 +
3116 if (wbc->nonblocking && bdi_write_congested(bdi)) {
3117 wbc->encountered_congestion = 1;
3118 if (!sb_is_blkdev_sb(sb))
3119 @@ -531,7 +538,7 @@ void generic_sync_sb_inodes(struct super_block *sb,
3120 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
3121 struct address_space *mapping;
3122
3123 - if (inode->i_state & (I_FREEING|I_WILL_FREE))
3124 + if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW))
3125 continue;
3126 mapping = inode->i_mapping;
3127 if (mapping->nrpages == 0)
3128 diff --git a/fs/inode.c b/fs/inode.c
3129 index 0487ddb..7b2acc1 100644
3130 --- a/fs/inode.c
3131 +++ b/fs/inode.c
3132 @@ -339,6 +339,7 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
3133 invalidate_inode_buffers(inode);
3134 if (!atomic_read(&inode->i_count)) {
3135 list_move(&inode->i_list, dispose);
3136 + WARN_ON(inode->i_state & I_NEW);
3137 inode->i_state |= I_FREEING;
3138 count++;
3139 continue;
3140 @@ -440,6 +441,7 @@ static void prune_icache(int nr_to_scan)
3141 continue;
3142 }
3143 list_move(&inode->i_list, &freeable);
3144 + WARN_ON(inode->i_state & I_NEW);
3145 inode->i_state |= I_FREEING;
3146 nr_pruned++;
3147 }
3148 @@ -595,6 +597,7 @@ void unlock_new_inode(struct inode *inode)
3149 * just created it (so there can be no old holders
3150 * that haven't tested I_LOCK).
3151 */
3152 + WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW));
3153 inode->i_state &= ~(I_LOCK|I_NEW);
3154 wake_up_inode(inode);
3155 }
3156 @@ -1041,6 +1044,7 @@ void generic_delete_inode(struct inode *inode)
3157
3158 list_del_init(&inode->i_list);
3159 list_del_init(&inode->i_sb_list);
3160 + WARN_ON(inode->i_state & I_NEW);
3161 inode->i_state |= I_FREEING;
3162 inodes_stat.nr_inodes--;
3163 spin_unlock(&inode_lock);
3164 @@ -1082,16 +1086,19 @@ static void generic_forget_inode(struct inode *inode)
3165 spin_unlock(&inode_lock);
3166 return;
3167 }
3168 + WARN_ON(inode->i_state & I_NEW);
3169 inode->i_state |= I_WILL_FREE;
3170 spin_unlock(&inode_lock);
3171 write_inode_now(inode, 1);
3172 spin_lock(&inode_lock);
3173 + WARN_ON(inode->i_state & I_NEW);
3174 inode->i_state &= ~I_WILL_FREE;
3175 inodes_stat.nr_unused--;
3176 hlist_del_init(&inode->i_hash);
3177 }
3178 list_del_init(&inode->i_list);
3179 list_del_init(&inode->i_sb_list);
3180 + WARN_ON(inode->i_state & I_NEW);
3181 inode->i_state |= I_FREEING;
3182 inodes_stat.nr_inodes--;
3183 spin_unlock(&inode_lock);
3184 diff --git a/fs/inotify.c b/fs/inotify.c
3185 index dae3f28..331f2e8 100644
3186 --- a/fs/inotify.c
3187 +++ b/fs/inotify.c
3188 @@ -156,7 +156,7 @@ static int inotify_handle_get_wd(struct inotify_handle *ih,
3189 int ret;
3190
3191 do {
3192 - if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL)))
3193 + if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS)))
3194 return -ENOSPC;
3195 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd);
3196 } while (ret == -EAGAIN);
3197 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
3198 index e70d657..a8fb64d 100644
3199 --- a/fs/jbd2/journal.c
3200 +++ b/fs/jbd2/journal.c
3201 @@ -430,7 +430,7 @@ int __jbd2_log_space_left(journal_t *journal)
3202 }
3203
3204 /*
3205 - * Called under j_state_lock. Returns true if a transaction was started.
3206 + * Called under j_state_lock. Returns true if a transaction commit was started.
3207 */
3208 int __jbd2_log_start_commit(journal_t *journal, tid_t target)
3209 {
3210 @@ -498,7 +498,8 @@ int jbd2_journal_force_commit_nested(journal_t *journal)
3211
3212 /*
3213 * Start a commit of the current running transaction (if any). Returns true
3214 - * if a transaction was started, and fills its tid in at *ptid
3215 + * if a transaction is going to be committed (or is currently already
3216 + * committing), and fills its tid in at *ptid
3217 */
3218 int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
3219 {
3220 @@ -508,15 +509,19 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
3221 if (journal->j_running_transaction) {
3222 tid_t tid = journal->j_running_transaction->t_tid;
3223
3224 - ret = __jbd2_log_start_commit(journal, tid);
3225 - if (ret && ptid)
3226 + __jbd2_log_start_commit(journal, tid);
3227 + /* There's a running transaction and we've just made sure
3228 + * it's commit has been scheduled. */
3229 + if (ptid)
3230 *ptid = tid;
3231 - } else if (journal->j_committing_transaction && ptid) {
3232 + ret = 1;
3233 + } else if (journal->j_committing_transaction) {
3234 /*
3235 * If ext3_write_super() recently started a commit, then we
3236 * have to wait for completion of that transaction
3237 */
3238 - *ptid = journal->j_committing_transaction->t_tid;
3239 + if (ptid)
3240 + *ptid = journal->j_committing_transaction->t_tid;
3241 ret = 1;
3242 }
3243 spin_unlock(&journal->j_state_lock);
3244 diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
3245 index 39b7805..89f63ba 100644
3246 --- a/fs/jbd2/transaction.c
3247 +++ b/fs/jbd2/transaction.c
3248 @@ -2050,26 +2050,46 @@ done:
3249 }
3250
3251 /*
3252 - * This function must be called when inode is journaled in ordered mode
3253 - * before truncation happens. It starts writeout of truncated part in
3254 - * case it is in the committing transaction so that we stand to ordered
3255 - * mode consistency guarantees.
3256 + * File truncate and transaction commit interact with each other in a
3257 + * non-trivial way. If a transaction writing data block A is
3258 + * committing, we cannot discard the data by truncate until we have
3259 + * written them. Otherwise if we crashed after the transaction with
3260 + * write has committed but before the transaction with truncate has
3261 + * committed, we could see stale data in block A. This function is a
3262 + * helper to solve this problem. It starts writeout of the truncated
3263 + * part in case it is in the committing transaction.
3264 + *
3265 + * Filesystem code must call this function when inode is journaled in
3266 + * ordered mode before truncation happens and after the inode has been
3267 + * placed on orphan list with the new inode size. The second condition
3268 + * avoids the race that someone writes new data and we start
3269 + * committing the transaction after this function has been called but
3270 + * before a transaction for truncate is started (and furthermore it
3271 + * allows us to optimize the case where the addition to orphan list
3272 + * happens in the same transaction as write --- we don't have to write
3273 + * any data in such case).
3274 */
3275 -int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,
3276 +int jbd2_journal_begin_ordered_truncate(journal_t *journal,
3277 + struct jbd2_inode *jinode,
3278 loff_t new_size)
3279 {
3280 - journal_t *journal;
3281 - transaction_t *commit_trans;
3282 + transaction_t *inode_trans, *commit_trans;
3283 int ret = 0;
3284
3285 - if (!inode->i_transaction && !inode->i_next_transaction)
3286 + /* This is a quick check to avoid locking if not necessary */
3287 + if (!jinode->i_transaction)
3288 goto out;
3289 - journal = inode->i_transaction->t_journal;
3290 + /* Locks are here just to force reading of recent values, it is
3291 + * enough that the transaction was not committing before we started
3292 + * a transaction adding the inode to orphan list */
3293 spin_lock(&journal->j_state_lock);
3294 commit_trans = journal->j_committing_transaction;
3295 spin_unlock(&journal->j_state_lock);
3296 - if (inode->i_transaction == commit_trans) {
3297 - ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping,
3298 + spin_lock(&journal->j_list_lock);
3299 + inode_trans = jinode->i_transaction;
3300 + spin_unlock(&journal->j_list_lock);
3301 + if (inode_trans == commit_trans) {
3302 + ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,
3303 new_size, LLONG_MAX);
3304 if (ret)
3305 jbd2_journal_abort(journal, ret);
3306 diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
3307 index 6ca08ad..1fc1e92 100644
3308 --- a/fs/jffs2/readinode.c
3309 +++ b/fs/jffs2/readinode.c
3310 @@ -220,7 +220,7 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
3311 struct jffs2_tmp_dnode_info *tn)
3312 {
3313 uint32_t fn_end = tn->fn->ofs + tn->fn->size;
3314 - struct jffs2_tmp_dnode_info *this;
3315 + struct jffs2_tmp_dnode_info *this, *ptn;
3316
3317 dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw));
3318
3319 @@ -251,11 +251,18 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
3320 if (this) {
3321 /* If the node is coincident with another at a lower address,
3322 back up until the other node is found. It may be relevant */
3323 - while (this->overlapped)
3324 - this = tn_prev(this);
3325 -
3326 - /* First node should never be marked overlapped */
3327 - BUG_ON(!this);
3328 + while (this->overlapped) {
3329 + ptn = tn_prev(this);
3330 + if (!ptn) {
3331 + /*
3332 + * We killed a node which set the overlapped
3333 + * flags during the scan. Fix it up.
3334 + */
3335 + this->overlapped = 0;
3336 + break;
3337 + }
3338 + this = ptn;
3339 + }
3340 dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole");
3341 }
3342
3343 @@ -360,7 +367,17 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
3344 }
3345 if (!this->overlapped)
3346 break;
3347 - this = tn_prev(this);
3348 +
3349 + ptn = tn_prev(this);
3350 + if (!ptn) {
3351 + /*
3352 + * We killed a node which set the overlapped
3353 + * flags during the scan. Fix it up.
3354 + */
3355 + this->overlapped = 0;
3356 + break;
3357 + }
3358 + this = ptn;
3359 }
3360 }
3361
3362 @@ -456,8 +473,15 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c,
3363 eat_last(&rii->tn_root, &last->rb);
3364 ver_insert(&ver_root, last);
3365
3366 - if (unlikely(last->overlapped))
3367 - continue;
3368 + if (unlikely(last->overlapped)) {
3369 + if (pen)
3370 + continue;
3371 + /*
3372 + * We killed a node which set the overlapped
3373 + * flags during the scan. Fix it up.
3374 + */
3375 + last->overlapped = 0;
3376 + }
3377
3378 /* Now we have a bunch of nodes in reverse version
3379 order, in the tree at ver_root. Most of the time,
3380 diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
3381 index d4d14e9..3657926 100644
3382 --- a/fs/ocfs2/journal.h
3383 +++ b/fs/ocfs2/journal.h
3384 @@ -445,8 +445,10 @@ static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode)
3385 static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
3386 loff_t new_size)
3387 {
3388 - return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode,
3389 - new_size);
3390 + return jbd2_journal_begin_ordered_truncate(
3391 + OCFS2_SB(inode->i_sb)->journal->j_journal,
3392 + &OCFS2_I(inode)->ip_jinode,
3393 + new_size);
3394 }
3395
3396 #endif /* OCFS2_JOURNAL_H */
3397 diff --git a/fs/pipe.c b/fs/pipe.c
3398 index 47b34d2..01f8b78 100644
3399 --- a/fs/pipe.c
3400 +++ b/fs/pipe.c
3401 @@ -699,12 +699,12 @@ pipe_rdwr_fasync(int fd, struct file *filp, int on)
3402 int retval;
3403
3404 mutex_lock(&inode->i_mutex);
3405 -
3406 retval = fasync_helper(fd, filp, on, &pipe->fasync_readers);
3407 -
3408 - if (retval >= 0)
3409 + if (retval >= 0) {
3410 retval = fasync_helper(fd, filp, on, &pipe->fasync_writers);
3411 -
3412 + if (retval < 0) /* this can happen only if on == T */
3413 + fasync_helper(-1, filp, 0, &pipe->fasync_readers);
3414 + }
3415 mutex_unlock(&inode->i_mutex);
3416
3417 if (retval < 0)
3418 diff --git a/fs/proc/page.c b/fs/proc/page.c
3419 index 767d95a..e998383 100644
3420 --- a/fs/proc/page.c
3421 +++ b/fs/proc/page.c
3422 @@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {
3423 #define KPF_RECLAIM 9
3424 #define KPF_BUDDY 10
3425
3426 -#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
3427 +#define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)
3428
3429 static ssize_t kpageflags_read(struct file *file, char __user *buf,
3430 size_t count, loff_t *ppos)
3431 @@ -107,7 +107,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
3432 else
3433 kflags = ppage->flags;
3434
3435 - uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) |
3436 + uflags = kpf_copy_bit(kflags, KPF_LOCKED, PG_locked) |
3437 kpf_copy_bit(kflags, KPF_ERROR, PG_error) |
3438 kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) |
3439 kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) |
3440 diff --git a/fs/seq_file.c b/fs/seq_file.c
3441 index 3404ec8..a3a61f9 100644
3442 --- a/fs/seq_file.c
3443 +++ b/fs/seq_file.c
3444 @@ -48,8 +48,16 @@ int seq_open(struct file *file, const struct seq_operations *op)
3445 */
3446 file->f_version = 0;
3447
3448 - /* SEQ files support lseek, but not pread/pwrite */
3449 - file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
3450 + /*
3451 + * seq_files support lseek() and pread(). They do not implement
3452 + * write() at all, but we clear FMODE_PWRITE here for historical
3453 + * reasons.
3454 + *
3455 + * If a client of seq_files a) implements file.write() and b) wishes to
3456 + * support pwrite() then that client will need to implement its own
3457 + * file.open() which calls seq_open() and then sets FMODE_PWRITE.
3458 + */
3459 + file->f_mode &= ~FMODE_PWRITE;
3460 return 0;
3461 }
3462 EXPORT_SYMBOL(seq_open);
3463 @@ -131,6 +139,22 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
3464 int err = 0;
3465
3466 mutex_lock(&m->lock);
3467 +
3468 + /* Don't assume *ppos is where we left it */
3469 + if (unlikely(*ppos != m->read_pos)) {
3470 + m->read_pos = *ppos;
3471 + while ((err = traverse(m, *ppos)) == -EAGAIN)
3472 + ;
3473 + if (err) {
3474 + /* With prejudice... */
3475 + m->read_pos = 0;
3476 + m->version = 0;
3477 + m->index = 0;
3478 + m->count = 0;
3479 + goto Done;
3480 + }
3481 + }
3482 +
3483 /*
3484 * seq_file->op->..m_start/m_stop/m_next may do special actions
3485 * or optimisations based on the file->f_version, so we want to
3486 @@ -230,8 +254,10 @@ Fill:
3487 Done:
3488 if (!copied)
3489 copied = err;
3490 - else
3491 + else {
3492 *ppos += copied;
3493 + m->read_pos += copied;
3494 + }
3495 file->f_version = m->version;
3496 mutex_unlock(&m->lock);
3497 return copied;
3498 @@ -266,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
3499 if (offset < 0)
3500 break;
3501 retval = offset;
3502 - if (offset != file->f_pos) {
3503 + if (offset != m->read_pos) {
3504 while ((retval=traverse(m, offset)) == -EAGAIN)
3505 ;
3506 if (retval) {
3507 /* with extreme prejudice... */
3508 file->f_pos = 0;
3509 + m->read_pos = 0;
3510 m->version = 0;
3511 m->index = 0;
3512 m->count = 0;
3513 } else {
3514 + m->read_pos = offset;
3515 retval = file->f_pos = offset;
3516 }
3517 }
3518 diff --git a/fs/timerfd.c b/fs/timerfd.c
3519 index 6a123b8..b042bd7 100644
3520 --- a/fs/timerfd.c
3521 +++ b/fs/timerfd.c
3522 @@ -186,10 +186,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
3523 BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
3524 BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
3525
3526 - if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
3527 - return -EINVAL;
3528 - if (clockid != CLOCK_MONOTONIC &&
3529 - clockid != CLOCK_REALTIME)
3530 + if ((flags & ~TFD_CREATE_FLAGS) ||
3531 + (clockid != CLOCK_MONOTONIC &&
3532 + clockid != CLOCK_REALTIME))
3533 return -EINVAL;
3534
3535 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
3536 @@ -201,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
3537 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS);
3538
3539 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
3540 - flags & (O_CLOEXEC | O_NONBLOCK));
3541 + flags & TFD_SHARED_FCNTL_FLAGS);
3542 if (ufd < 0)
3543 kfree(ctx);
3544
3545 @@ -219,7 +218,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
3546 if (copy_from_user(&ktmr, utmr, sizeof(ktmr)))
3547 return -EFAULT;
3548
3549 - if (!timespec_valid(&ktmr.it_value) ||
3550 + if ((flags & ~TFD_SETTIME_FLAGS) ||
3551 + !timespec_valid(&ktmr.it_value) ||
3552 !timespec_valid(&ktmr.it_interval))
3553 return -EINVAL;
3554
3555 diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
3556 index 152b34d..4986239 100644
3557 --- a/include/drm/i915_drm.h
3558 +++ b/include/drm/i915_drm.h
3559 @@ -177,6 +177,8 @@ typedef struct _drm_i915_sarea {
3560 #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
3561 #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
3562 #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
3563 +#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
3564 +#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
3565 #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
3566 #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
3567 #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
3568 diff --git a/include/linux/fs.h b/include/linux/fs.h
3569 index 4b91924..7e413d3 100644
3570 --- a/include/linux/fs.h
3571 +++ b/include/linux/fs.h
3572 @@ -63,24 +63,30 @@ extern int dir_notify_enable;
3573 #define MAY_ACCESS 16
3574 #define MAY_OPEN 32
3575
3576 +/*
3577 + * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
3578 + * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
3579 + */
3580 +
3581 /* file is open for reading */
3582 #define FMODE_READ ((__force fmode_t)1)
3583 /* file is open for writing */
3584 #define FMODE_WRITE ((__force fmode_t)2)
3585 /* file is seekable */
3586 #define FMODE_LSEEK ((__force fmode_t)4)
3587 -/* file can be accessed using pread/pwrite */
3588 +/* file can be accessed using pread */
3589 #define FMODE_PREAD ((__force fmode_t)8)
3590 -#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
3591 +/* file can be accessed using pwrite */
3592 +#define FMODE_PWRITE ((__force fmode_t)16)
3593 /* File is opened for execution with sys_execve / sys_uselib */
3594 -#define FMODE_EXEC ((__force fmode_t)16)
3595 +#define FMODE_EXEC ((__force fmode_t)32)
3596 /* File is opened with O_NDELAY (only set for block devices) */
3597 -#define FMODE_NDELAY ((__force fmode_t)32)
3598 +#define FMODE_NDELAY ((__force fmode_t)64)
3599 /* File is opened with O_EXCL (only set for block devices) */
3600 -#define FMODE_EXCL ((__force fmode_t)64)
3601 +#define FMODE_EXCL ((__force fmode_t)128)
3602 /* File is opened using open(.., 3, ..) and is writeable only for ioctls
3603 (specialy hack for floppy.c) */
3604 -#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
3605 +#define FMODE_WRITE_IOCTL ((__force fmode_t)256)
3606
3607 #define RW_MASK 1
3608 #define RWA_MASK 2
3609 diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
3610 index 7c31d67..56593cb 100644
3611 --- a/include/linux/jbd2.h
3612 +++ b/include/linux/jbd2.h
3613 @@ -1087,7 +1087,8 @@ extern int jbd2_journal_clear_err (journal_t *);
3614 extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
3615 extern int jbd2_journal_force_commit(journal_t *);
3616 extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
3617 -extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
3618 +extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
3619 + struct jbd2_inode *inode, loff_t new_size);
3620 extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
3621 extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
3622
3623 diff --git a/include/linux/mm.h b/include/linux/mm.h
3624 index 86b836d..5c7f5f5 100644
3625 --- a/include/linux/mm.h
3626 +++ b/include/linux/mm.h
3627 @@ -1027,10 +1027,23 @@ extern void free_bootmem_with_active_regions(int nid,
3628 typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
3629 extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
3630 extern void sparse_memory_present_with_active_regions(int nid);
3631 -#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
3632 -extern int early_pfn_to_nid(unsigned long pfn);
3633 -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3634 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
3635 +
3636 +#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
3637 + !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
3638 +static inline int __early_pfn_to_nid(unsigned long pfn)
3639 +{
3640 + return 0;
3641 +}
3642 +#else
3643 +/* please see mm/page_alloc.c */
3644 +extern int __meminit early_pfn_to_nid(unsigned long pfn);
3645 +#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
3646 +/* there is a per-arch backend function. */
3647 +extern int __meminit __early_pfn_to_nid(unsigned long pfn);
3648 +#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3649 +#endif
3650 +
3651 extern void set_dma_reserve(unsigned long new_dma_reserve);
3652 extern void memmap_init_zone(unsigned long, int, unsigned long,
3653 unsigned long, enum memmap_context);
3654 diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
3655 index 35a7b5e..796f1e5 100644
3656 --- a/include/linux/mmzone.h
3657 +++ b/include/linux/mmzone.h
3658 @@ -1067,7 +1067,7 @@ void sparse_init(void);
3659 #endif /* CONFIG_SPARSEMEM */
3660
3661 #ifdef CONFIG_NODES_SPAN_OTHER_NODES
3662 -#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
3663 +bool early_pfn_in_nid(unsigned long pfn, int nid);
3664 #else
3665 #define early_pfn_in_nid(pfn, nid) (1)
3666 #endif
3667 diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
3668 index c525afc..d81bc13 100644
3669 --- a/include/linux/pci_ids.h
3670 +++ b/include/linux/pci_ids.h
3671 @@ -1445,6 +1445,7 @@
3672 #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
3673 #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
3674 #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
3675 +#define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1
3676 #define PCI_DEVICE_ID_NEO_2DB9 0x00C8
3677 #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9
3678 #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
3679 @@ -2317,6 +2318,9 @@
3680 #define PCI_DEVICE_ID_INTEL_82378 0x0484
3681 #define PCI_DEVICE_ID_INTEL_I960 0x0960
3682 #define PCI_DEVICE_ID_INTEL_I960RM 0x0962
3683 +#define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062
3684 +#define PCI_DEVICE_ID_INTEL_82573E_SOL 0x1085
3685 +#define PCI_DEVICE_ID_INTEL_82573L_SOL 0x108F
3686 #define PCI_DEVICE_ID_INTEL_82815_MC 0x1130
3687 #define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132
3688 #define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
3689 diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
3690 index dc50bcc..cbb25fc 100644
3691 --- a/include/linux/seq_file.h
3692 +++ b/include/linux/seq_file.h
3693 @@ -19,6 +19,7 @@ struct seq_file {
3694 size_t from;
3695 size_t count;
3696 loff_t index;
3697 + loff_t read_pos;
3698 u64 version;
3699 struct mutex lock;
3700 const struct seq_operations *op;
3701 diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
3702 index 4e4f127..a551e97 100644
3703 --- a/include/linux/serial_core.h
3704 +++ b/include/linux/serial_core.h
3705 @@ -288,6 +288,7 @@ struct uart_port {
3706 #define UPF_HARDPPS_CD ((__force upf_t) (1 << 11))
3707 #define UPF_LOW_LATENCY ((__force upf_t) (1 << 13))
3708 #define UPF_BUGGY_UART ((__force upf_t) (1 << 14))
3709 +#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
3710 #define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16))
3711 #define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
3712 #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
3713 diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
3714 index 2725f4e..37af3d5 100644
3715 --- a/include/linux/skbuff.h
3716 +++ b/include/linux/skbuff.h
3717 @@ -411,15 +411,6 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
3718 void *here);
3719 extern void skb_under_panic(struct sk_buff *skb, int len,
3720 void *here);
3721 -extern void skb_truesize_bug(struct sk_buff *skb);
3722 -
3723 -static inline void skb_truesize_check(struct sk_buff *skb)
3724 -{
3725 - int len = sizeof(struct sk_buff) + skb->len;
3726 -
3727 - if (unlikely((int)skb->truesize < len))
3728 - skb_truesize_bug(skb);
3729 -}
3730
3731 extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
3732 int getfrag(void *from, char *to, int offset,
3733 diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
3734 index 86cb050..2d07929 100644
3735 --- a/include/linux/timerfd.h
3736 +++ b/include/linux/timerfd.h
3737 @@ -11,13 +11,21 @@
3738 /* For O_CLOEXEC and O_NONBLOCK */
3739 #include <linux/fcntl.h>
3740
3741 -/* Flags for timerfd_settime. */
3742 +/*
3743 + * CAREFUL: Check include/asm-generic/fcntl.h when defining
3744 + * new flags, since they might collide with O_* ones. We want
3745 + * to re-use O_* flags that couldn't possibly have a meaning
3746 + * from eventfd, in order to leave a free define-space for
3747 + * shared O_* flags.
3748 + */
3749 #define TFD_TIMER_ABSTIME (1 << 0)
3750 -
3751 -/* Flags for timerfd_create. */
3752 #define TFD_CLOEXEC O_CLOEXEC
3753 #define TFD_NONBLOCK O_NONBLOCK
3754
3755 +#define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)
3756 +/* Flags for timerfd_create. */
3757 +#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS
3758 +/* Flags for timerfd_settime. */
3759 +#define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME
3760
3761 #endif /* _LINUX_TIMERFD_H */
3762 -
3763 diff --git a/include/net/sock.h b/include/net/sock.h
3764 index 2f47107..4ae672f 100644
3765 --- a/include/net/sock.h
3766 +++ b/include/net/sock.h
3767 @@ -784,7 +784,6 @@ static inline void sk_mem_uncharge(struct sock *sk, int size)
3768
3769 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
3770 {
3771 - skb_truesize_check(skb);
3772 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
3773 sk->sk_wmem_queued -= skb->truesize;
3774 sk_mem_uncharge(sk, skb->truesize);
3775 diff --git a/kernel/fork.c b/kernel/fork.c
3776 index f2c9c60..8f753e5 100644
3777 --- a/kernel/fork.c
3778 +++ b/kernel/fork.c
3779 @@ -1176,10 +1176,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
3780 #endif
3781 clear_all_latency_tracing(p);
3782
3783 - /* Our parent execution domain becomes current domain
3784 - These must match for thread signalling to apply */
3785 - p->parent_exec_id = p->self_exec_id;
3786 -
3787 /* ok, now we should be set up.. */
3788 p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL);
3789 p->pdeath_signal = 0;
3790 @@ -1217,10 +1213,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,
3791 set_task_cpu(p, smp_processor_id());
3792
3793 /* CLONE_PARENT re-uses the old parent */
3794 - if (clone_flags & (CLONE_PARENT|CLONE_THREAD))
3795 + if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
3796 p->real_parent = current->real_parent;
3797 - else
3798 + p->parent_exec_id = current->parent_exec_id;
3799 + } else {
3800 p->real_parent = current;
3801 + p->parent_exec_id = current->self_exec_id;
3802 + }
3803
3804 spin_lock(&current->sighand->siglock);
3805
3806 diff --git a/kernel/seccomp.c b/kernel/seccomp.c
3807 index ad64fcb..57d4b13 100644
3808 --- a/kernel/seccomp.c
3809 +++ b/kernel/seccomp.c
3810 @@ -8,6 +8,7 @@
3811
3812 #include <linux/seccomp.h>
3813 #include <linux/sched.h>
3814 +#include <linux/compat.h>
3815
3816 /* #define SECCOMP_DEBUG 1 */
3817 #define NR_SECCOMP_MODES 1
3818 @@ -22,7 +23,7 @@ static int mode1_syscalls[] = {
3819 0, /* null terminated */
3820 };
3821
3822 -#ifdef TIF_32BIT
3823 +#ifdef CONFIG_COMPAT
3824 static int mode1_syscalls_32[] = {
3825 __NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,
3826 0, /* null terminated */
3827 @@ -37,8 +38,8 @@ void __secure_computing(int this_syscall)
3828 switch (mode) {
3829 case 1:
3830 syscall = mode1_syscalls;
3831 -#ifdef TIF_32BIT
3832 - if (test_thread_flag(TIF_32BIT))
3833 +#ifdef CONFIG_COMPAT
3834 + if (is_compat_task())
3835 syscall = mode1_syscalls_32;
3836 #endif
3837 do {
3838 diff --git a/kernel/tsacct.c b/kernel/tsacct.c
3839 index 8ebcd85..5275fba 100644
3840 --- a/kernel/tsacct.c
3841 +++ b/kernel/tsacct.c
3842 @@ -120,8 +120,10 @@ void acct_update_integrals(struct task_struct *tsk)
3843 if (likely(tsk->mm)) {
3844 cputime_t time, dtime;
3845 struct timeval value;
3846 + unsigned long flags;
3847 u64 delta;
3848
3849 + local_irq_save(flags);
3850 time = tsk->stime + tsk->utime;
3851 dtime = cputime_sub(time, tsk->acct_timexpd);
3852 jiffies_to_timeval(cputime_to_jiffies(dtime), &value);
3853 @@ -129,10 +131,12 @@ void acct_update_integrals(struct task_struct *tsk)
3854 delta = delta * USEC_PER_SEC + value.tv_usec;
3855
3856 if (delta == 0)
3857 - return;
3858 + goto out;
3859 tsk->acct_timexpd = time;
3860 tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
3861 tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
3862 + out:
3863 + local_irq_restore(flags);
3864 }
3865 }
3866
3867 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
3868 index d8ac014..566ee21 100644
3869 --- a/mm/page_alloc.c
3870 +++ b/mm/page_alloc.c
3871 @@ -2974,7 +2974,7 @@ static int __meminit next_active_region_index_in_nid(int index, int nid)
3872 * was used and there are no special requirements, this is a convenient
3873 * alternative
3874 */
3875 -int __meminit early_pfn_to_nid(unsigned long pfn)
3876 +int __meminit __early_pfn_to_nid(unsigned long pfn)
3877 {
3878 int i;
3879
3880 @@ -2985,10 +2985,33 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
3881 if (start_pfn <= pfn && pfn < end_pfn)
3882 return early_node_map[i].nid;
3883 }
3884 + /* This is a memory hole */
3885 + return -1;
3886 +}
3887 +#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3888 +
3889 +int __meminit early_pfn_to_nid(unsigned long pfn)
3890 +{
3891 + int nid;
3892
3893 + nid = __early_pfn_to_nid(pfn);
3894 + if (nid >= 0)
3895 + return nid;
3896 + /* just returns 0 */
3897 return 0;
3898 }
3899 -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3900 +
3901 +#ifdef CONFIG_NODES_SPAN_OTHER_NODES
3902 +bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
3903 +{
3904 + int nid;
3905 +
3906 + nid = __early_pfn_to_nid(pfn);
3907 + if (nid >= 0 && nid != node)
3908 + return false;
3909 + return true;
3910 +}
3911 +#endif
3912
3913 /* Basic iterator support to walk early_node_map[] */
3914 #define for_each_active_range_index_in_nid(i, nid) \
3915 diff --git a/mm/vmalloc.c b/mm/vmalloc.c
3916 index 0380ea5..4172ce4 100644
3917 --- a/mm/vmalloc.c
3918 +++ b/mm/vmalloc.c
3919 @@ -323,6 +323,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
3920 unsigned long addr;
3921 int purged = 0;
3922
3923 + BUG_ON(!size);
3924 BUG_ON(size & ~PAGE_MASK);
3925
3926 va = kmalloc_node(sizeof(struct vmap_area),
3927 @@ -334,6 +335,9 @@ retry:
3928 addr = ALIGN(vstart, align);
3929
3930 spin_lock(&vmap_area_lock);
3931 + if (addr + size - 1 < addr)
3932 + goto overflow;
3933 +
3934 /* XXX: could have a last_hole cache */
3935 n = vmap_area_root.rb_node;
3936 if (n) {
3937 @@ -365,6 +369,8 @@ retry:
3938
3939 while (addr + size > first->va_start && addr + size <= vend) {
3940 addr = ALIGN(first->va_end + PAGE_SIZE, align);
3941 + if (addr + size - 1 < addr)
3942 + goto overflow;
3943
3944 n = rb_next(&first->rb_node);
3945 if (n)
3946 @@ -375,6 +381,7 @@ retry:
3947 }
3948 found:
3949 if (addr + size > vend) {
3950 +overflow:
3951 spin_unlock(&vmap_area_lock);
3952 if (!purged) {
3953 purge_vmap_area_lazy();
3954 @@ -476,6 +483,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
3955 static DEFINE_SPINLOCK(purge_lock);
3956 LIST_HEAD(valist);
3957 struct vmap_area *va;
3958 + struct vmap_area *n_va;
3959 int nr = 0;
3960
3961 /*
3962 @@ -515,7 +523,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
3963
3964 if (nr) {
3965 spin_lock(&vmap_area_lock);
3966 - list_for_each_entry(va, &valist, purge_list)
3967 + list_for_each_entry_safe(va, n_va, &valist, purge_list)
3968 __free_vmap_area(va);
3969 spin_unlock(&vmap_area_lock);
3970 }
3971 @@ -989,6 +997,8 @@ void __init vmalloc_init(void)
3972 void unmap_kernel_range(unsigned long addr, unsigned long size)
3973 {
3974 unsigned long end = addr + size;
3975 +
3976 + flush_cache_vunmap(addr, end);
3977 vunmap_page_range(addr, end);
3978 flush_tlb_kernel_range(addr, end);
3979 }
3980 diff --git a/net/core/skbuff.c b/net/core/skbuff.c
3981 index d61aa52..aa89c30 100644
3982 --- a/net/core/skbuff.c
3983 +++ b/net/core/skbuff.c
3984 @@ -143,14 +143,6 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
3985 BUG();
3986 }
3987
3988 -void skb_truesize_bug(struct sk_buff *skb)
3989 -{
3990 - WARN(net_ratelimit(), KERN_ERR "SKB BUG: Invalid truesize (%u) "
3991 - "len=%u, sizeof(sk_buff)=%Zd\n",
3992 - skb->truesize, skb->len, sizeof(struct sk_buff));
3993 -}
3994 -EXPORT_SYMBOL(skb_truesize_bug);
3995 -
3996 /* Allocate a new skbuff. We do this ourselves so we can fill in a few
3997 * 'private' fields and also do memory statistics to find all the
3998 * [BEEP] leaks.
3999 diff --git a/net/core/sock.c b/net/core/sock.c
4000 index a7a0975..1b0f74c 100644
4001 --- a/net/core/sock.c
4002 +++ b/net/core/sock.c
4003 @@ -696,7 +696,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
4004 if (len < 0)
4005 return -EINVAL;
4006
4007 - v.val = 0;
4008 + memset(&v, 0, sizeof(v));
4009
4010 switch(optname) {
4011 case SO_DEBUG:
4012 @@ -1137,7 +1137,6 @@ void sock_rfree(struct sk_buff *skb)
4013 {
4014 struct sock *sk = skb->sk;
4015
4016 - skb_truesize_check(skb);
4017 atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
4018 sk_mem_uncharge(skb->sk, skb->truesize);
4019 }
4020 diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
4021 index d4dc222..0d34372 100644
4022 --- a/scripts/mod/file2alias.c
4023 +++ b/scripts/mod/file2alias.c
4024 @@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size,
4025 static int do_hid_entry(const char *filename,
4026 struct hid_device_id *id, char *alias)
4027 {
4028 + id->bus = TO_NATIVE(id->bus);
4029 id->vendor = TO_NATIVE(id->vendor);
4030 id->product = TO_NATIVE(id->product);
4031
4032 diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
4033 index f58701a..350794a 100644
4034 --- a/security/selinux/netlabel.c
4035 +++ b/security/selinux/netlabel.c
4036 @@ -386,11 +386,12 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)
4037 if (!S_ISSOCK(inode->i_mode) ||
4038 ((mask & (MAY_WRITE | MAY_APPEND)) == 0))
4039 return 0;
4040 -
4041 sock = SOCKET_I(inode);
4042 sk = sock->sk;
4043 + if (sk == NULL)
4044 + return 0;
4045 sksec = sk->sk_security;
4046 - if (sksec->nlbl_state != NLBL_REQUIRE)
4047 + if (sksec == NULL || sksec->nlbl_state != NLBL_REQUIRE)
4048 return 0;
4049
4050 local_bh_disable();
4051 @@ -490,8 +491,10 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock,
4052 lock_sock(sk);
4053 rc = netlbl_sock_getattr(sk, &secattr);
4054 release_sock(sk);
4055 - if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
4056 + if (rc == 0)
4057 rc = -EACCES;
4058 + else if (rc == -ENOMSG)
4059 + rc = 0;
4060 netlbl_secattr_destroy(&secattr);
4061 }
4062
4063 diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c
4064 index a466443..2fa9299 100644
4065 --- a/sound/core/oss/rate.c
4066 +++ b/sound/core/oss/rate.c
4067 @@ -157,7 +157,7 @@ static void resample_shrink(struct snd_pcm_plugin *plugin,
4068 while (dst_frames1 > 0) {
4069 S1 = S2;
4070 if (src_frames1-- > 0) {
4071 - S1 = *src;
4072 + S2 = *src;
4073 src += src_step;
4074 }
4075 if (pos & ~R_MASK) {
4076 diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
4077 index 3f00ddf..c7c54e7 100644
4078 --- a/sound/pci/aw2/aw2-alsa.c
4079 +++ b/sound/pci/aw2/aw2-alsa.c
4080 @@ -165,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444);
4081 MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");
4082
4083 static struct pci_device_id snd_aw2_ids[] = {
4084 - {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID,
4085 + {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0,
4086 0, 0, 0},
4087 {0}
4088 };
4089 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4090 index 4c8961a..7123a6e 100644
4091 --- a/sound/pci/hda/patch_realtek.c
4092 +++ b/sound/pci/hda/patch_realtek.c
4093 @@ -6778,6 +6778,7 @@ static int patch_alc882(struct hda_codec *codec)
4094 case 0x106b2800: /* AppleTV */
4095 board_config = ALC885_IMAC24;
4096 break;
4097 + case 0x106b00a0: /* MacBookPro3,1 - Another revision */
4098 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
4099 case 0x106b00a4: /* MacbookPro4,1 */
4100 case 0x106b2c00: /* Macbook Pro rev3 */
4101 diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
4102 index 1f9fcfe..96f4c8d 100644
4103 --- a/sound/pci/hda/patch_sigmatel.c
4104 +++ b/sound/pci/hda/patch_sigmatel.c
4105 @@ -4668,7 +4668,7 @@ again:
4106 case STAC_DELL_M4_3:
4107 spec->num_dmics = 1;
4108 spec->num_smuxes = 0;
4109 - spec->num_dmuxes = 0;
4110 + spec->num_dmuxes = 1;
4111 break;
4112 default:
4113 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
4114 diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
4115 index a962166..d74cc25 100644
4116 --- a/sound/pci/oxygen/virtuoso.c
4117 +++ b/sound/pci/oxygen/virtuoso.c
4118 @@ -26,7 +26,7 @@
4119 * SPI 0 -> 1st PCM1796 (front)
4120 * SPI 1 -> 2nd PCM1796 (surround)
4121 * SPI 2 -> 3rd PCM1796 (center/LFE)
4122 - * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
4123 + * SPI 4 -> 4th PCM1796 (back)
4124 *
4125 * GPIO 2 -> M0 of CS5381
4126 * GPIO 3 -> M1 of CS5381
4127 @@ -207,12 +207,6 @@ static void xonar_gpio_changed(struct oxygen *chip);
4128 static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
4129 u8 reg, u8 value)
4130 {
4131 - /*
4132 - * We don't want to do writes on SPI 4 because the EEPROM, which shares
4133 - * the same pin, might get confused and broken. We'd better take care
4134 - * that the driver works with the default register values ...
4135 - */
4136 -#if 0
4137 /* maps ALSA channel pair number to SPI output */
4138 static const u8 codec_map[4] = {
4139 0, 1, 2, 4
4140 @@ -223,7 +217,6 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
4141 (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
4142 OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
4143 (reg << 8) | value);
4144 -#endif
4145 }
4146
4147 static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
4148 @@ -757,9 +750,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
4149
4150 static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
4151 {
4152 - if (!strncmp(template->name, "Master Playback ", 16))
4153 - /* disable volume/mute because they would require SPI writes */
4154 - return 1;
4155 if (!strncmp(template->name, "CD Capture ", 11))
4156 /* CD in is actually connected to the video in pin */
4157 template->private_value ^= AC97_CD ^ AC97_VIDEO;
4158 @@ -850,8 +840,9 @@ static const struct oxygen_model model_xonar_d2 = {
4159 .dac_volume_min = 0x0f,
4160 .dac_volume_max = 0xff,
4161 .misc_flags = OXYGEN_MISC_MIDI,
4162 - .function_flags = OXYGEN_FUNCTION_SPI,
4163 - .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
4164 + .function_flags = OXYGEN_FUNCTION_SPI |
4165 + OXYGEN_FUNCTION_ENABLE_SPI_4_5,
4166 + .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
4167 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
4168 };
4169
4170 diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
4171 index f44c153..a51190e 100644
4172 --- a/sound/usb/usbaudio.c
4173 +++ b/sound/usb/usbaudio.c
4174 @@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
4175 * build the rate table and bitmap flags
4176 */
4177 int r, idx;
4178 - unsigned int nonzero_rates = 0;
4179
4180 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
4181 if (fp->rate_table == NULL) {
4182 @@ -2532,24 +2531,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
4183 return -1;
4184 }
4185
4186 - fp->nr_rates = nr_rates;
4187 - fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
4188 + fp->nr_rates = 0;
4189 + fp->rate_min = fp->rate_max = 0;
4190 for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
4191 unsigned int rate = combine_triple(&fmt[idx]);
4192 + if (!rate)
4193 + continue;
4194 /* C-Media CM6501 mislabels its 96 kHz altsetting */
4195 if (rate == 48000 && nr_rates == 1 &&
4196 - chip->usb_id == USB_ID(0x0d8c, 0x0201) &&
4197 + (chip->usb_id == USB_ID(0x0d8c, 0x0201) ||
4198 + chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
4199 fp->altsetting == 5 && fp->maxpacksize == 392)
4200 rate = 96000;
4201 - fp->rate_table[r] = rate;
4202 - nonzero_rates |= rate;
4203 - if (rate < fp->rate_min)
4204 + fp->rate_table[fp->nr_rates] = rate;
4205 + if (!fp->rate_min || rate < fp->rate_min)
4206 fp->rate_min = rate;
4207 - else if (rate > fp->rate_max)
4208 + if (!fp->rate_max || rate > fp->rate_max)
4209 fp->rate_max = rate;
4210 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
4211 + fp->nr_rates++;
4212 }
4213 - if (!nonzero_rates) {
4214 + if (!fp->nr_rates) {
4215 hwc_debug("All rates were zero. Skipping format!\n");
4216 return -1;
4217 }
4218 diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
4219 index 5962e4b..343f896 100644
4220 --- a/sound/usb/usbmidi.c
4221 +++ b/sound/usb/usbmidi.c
4222 @@ -1628,6 +1628,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
4223 }
4224
4225 ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
4226 + ep_info.out_interval = 0;
4227 ep_info.out_cables = endpoint->out_cables & 0x5555;
4228 err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
4229 if (err < 0)

  ViewVC Help
Powered by ViewVC 1.1.20