Magellan Linux

Annotation of /trunk/kernel26-alx/patches-2.6.27-r3/0119-2.6.27.20-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1176 - (hide annotations) (download)
Thu Oct 14 15:11:06 2010 UTC (13 years, 8 months ago) by niro
File size: 112529 byte(s)
-2.6.27-alx-r3: new magellan 0.5.2 kernel
1 niro 1176 diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
2     index ce8470f..f78262e 100644
3     --- a/arch/arm/mach-rpc/riscpc.c
4     +++ b/arch/arm/mach-rpc/riscpc.c
5     @@ -18,6 +18,7 @@
6     #include <linux/device.h>
7     #include <linux/serial_8250.h>
8     #include <linux/ata_platform.h>
9     +#include <linux/i2c.h>
10    
11     #include <asm/elf.h>
12     #include <asm/io.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/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
65     index d811a8c..4774c2f 100644
66     --- a/arch/powerpc/include/asm/compat.h
67     +++ b/arch/powerpc/include/asm/compat.h
68     @@ -210,5 +210,10 @@ struct compat_shmid64_ds {
69     compat_ulong_t __unused6;
70     };
71    
72     +static inline int is_compat_task(void)
73     +{
74     + return test_thread_flag(TIF_32BIT);
75     +}
76     +
77     #endif /* __KERNEL__ */
78     #endif /* _ASM_POWERPC_COMPAT_H */
79     diff --git a/arch/powerpc/include/asm/seccomp.h b/arch/powerpc/include/asm/seccomp.h
80     index 853765e..00c1d91 100644
81     --- a/arch/powerpc/include/asm/seccomp.h
82     +++ b/arch/powerpc/include/asm/seccomp.h
83     @@ -1,10 +1,6 @@
84     #ifndef _ASM_POWERPC_SECCOMP_H
85     #define _ASM_POWERPC_SECCOMP_H
86    
87     -#ifdef __KERNEL__
88     -#include <linux/thread_info.h>
89     -#endif
90     -
91     #include <linux/unistd.h>
92    
93     #define __NR_seccomp_read __NR_read
94     diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
95     index ada0692..73cb6a3 100644
96     --- a/arch/powerpc/kernel/align.c
97     +++ b/arch/powerpc/kernel/align.c
98     @@ -367,27 +367,24 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
99     static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg,
100     unsigned int flags)
101     {
102     - char *ptr = (char *) &current->thread.TS_FPR(reg);
103     - int i, ret;
104     + char *ptr0 = (char *) &current->thread.TS_FPR(reg);
105     + char *ptr1 = (char *) &current->thread.TS_FPR(reg+1);
106     + int i, ret, sw = 0;
107    
108     if (!(flags & F))
109     return 0;
110     if (reg & 1)
111     return 0; /* invalid form: FRS/FRT must be even */
112     - if (!(flags & SW)) {
113     - /* not byte-swapped - easy */
114     - if (!(flags & ST))
115     - ret = __copy_from_user(ptr, addr, 16);
116     - else
117     - ret = __copy_to_user(addr, ptr, 16);
118     - } else {
119     - /* each FPR value is byte-swapped separately */
120     - ret = 0;
121     - for (i = 0; i < 16; ++i) {
122     - if (!(flags & ST))
123     - ret |= __get_user(ptr[i^7], addr + i);
124     - else
125     - ret |= __put_user(ptr[i^7], addr + i);
126     + if (flags & SW)
127     + sw = 7;
128     + ret = 0;
129     + for (i = 0; i < 8; ++i) {
130     + if (!(flags & ST)) {
131     + ret |= __get_user(ptr0[i^sw], addr + i);
132     + ret |= __get_user(ptr1[i^sw], addr + i + 8);
133     + } else {
134     + ret |= __put_user(ptr0[i^sw], addr + i);
135     + ret |= __put_user(ptr1[i^sw], addr + i + 8);
136     }
137     }
138     if (ret)
139     diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
140     index f260b58..0e70625 100644
141     --- a/arch/sparc/include/asm/compat.h
142     +++ b/arch/sparc/include/asm/compat.h
143     @@ -240,4 +240,9 @@ struct compat_shmid64_ds {
144     unsigned int __unused2;
145     };
146    
147     +static inline int is_compat_task(void)
148     +{
149     + return test_thread_flag(TIF_32BIT);
150     +}
151     +
152     #endif /* _ASM_SPARC64_COMPAT_H */
153     diff --git a/arch/sparc/include/asm/ptrace_32.h b/arch/sparc/include/asm/ptrace_32.h
154     index d409c4f..4cef450 100644
155     --- a/arch/sparc/include/asm/ptrace_32.h
156     +++ b/arch/sparc/include/asm/ptrace_32.h
157     @@ -62,6 +62,8 @@ struct sparc_stackf {
158    
159     #ifdef __KERNEL__
160    
161     +#include <asm/system.h>
162     +
163     static inline bool pt_regs_is_syscall(struct pt_regs *regs)
164     {
165     return (regs->psr & PSR_SYSCALL);
166     @@ -72,6 +74,14 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
167     return (regs->psr &= ~PSR_SYSCALL);
168     }
169    
170     +#define arch_ptrace_stop_needed(exit_code, info) \
171     +({ flush_user_windows(); \
172     + current_thread_info()->w_saved != 0; \
173     +})
174     +
175     +#define arch_ptrace_stop(exit_code, info) \
176     + synchronize_user_stack()
177     +
178     #define user_mode(regs) (!((regs)->psr & PSR_PS))
179     #define instruction_pointer(regs) ((regs)->pc)
180     #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
181     diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
182     index 06e4914..a54074a 100644
183     --- a/arch/sparc/include/asm/ptrace_64.h
184     +++ b/arch/sparc/include/asm/ptrace_64.h
185     @@ -113,6 +113,8 @@ struct sparc_trapf {
186    
187     #ifdef __KERNEL__
188    
189     +#include <asm/system.h>
190     +
191     static inline int pt_regs_trap_type(struct pt_regs *regs)
192     {
193     return regs->magic & 0x1ff;
194     @@ -128,6 +130,14 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
195     return (regs->tstate &= ~TSTATE_SYSCALL);
196     }
197    
198     +#define arch_ptrace_stop_needed(exit_code, info) \
199     +({ flush_user_windows(); \
200     + get_thread_wsaved() != 0; \
201     +})
202     +
203     +#define arch_ptrace_stop(exit_code, info) \
204     + synchronize_user_stack()
205     +
206     struct global_reg_snapshot {
207     unsigned long tstate;
208     unsigned long tpc;
209     diff --git a/arch/sparc/include/asm/seccomp.h b/arch/sparc/include/asm/seccomp.h
210     index 7fcd996..adca1bc 100644
211     --- a/arch/sparc/include/asm/seccomp.h
212     +++ b/arch/sparc/include/asm/seccomp.h
213     @@ -1,11 +1,5 @@
214     #ifndef _ASM_SECCOMP_H
215    
216     -#include <linux/thread_info.h> /* already defines TIF_32BIT */
217     -
218     -#ifndef TIF_32BIT
219     -#error "unexpected TIF_32BIT on sparc64"
220     -#endif
221     -
222     #include <linux/unistd.h>
223    
224     #define __NR_seccomp_read __NR_read
225     diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
226     index c824df1..eb19724 100644
227     --- a/arch/sparc64/kernel/traps.c
228     +++ b/arch/sparc64/kernel/traps.c
229     @@ -1,6 +1,6 @@
230     /* arch/sparc64/kernel/traps.c
231     *
232     - * Copyright (C) 1995,1997,2008 David S. Miller (davem@davemloft.net)
233     + * Copyright (C) 1995,1997,2008,2009 David S. Miller (davem@davemloft.net)
234     * Copyright (C) 1997,1999,2000 Jakub Jelinek (jakub@redhat.com)
235     */
236    
237     @@ -262,6 +262,21 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
238     return;
239    
240     if (regs->tstate & TSTATE_PRIV) {
241     + /* Test if this comes from uaccess places. */
242     + const struct exception_table_entry *entry;
243     +
244     + entry = search_exception_tables(regs->tpc);
245     + if (entry) {
246     + /* Ouch, somebody is trying VM hole tricks on us... */
247     +#ifdef DEBUG_EXCEPTIONS
248     + printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc);
249     + printk("EX_TABLE: insn<%016lx> fixup<%016lx>\n",
250     + regs->tpc, entry->fixup);
251     +#endif
252     + regs->tpc = entry->fixup;
253     + regs->tnpc = regs->tpc + 4;
254     + return;
255     + }
256     printk("sun4v_data_access_exception: ADDR[%016lx] "
257     "CTX[%04x] TYPE[%04x], going.\n",
258     addr, ctx, type);
259     diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
260     index ffc1bb4..5e65290 100644
261     --- a/arch/x86/ia32/ia32entry.S
262     +++ b/arch/x86/ia32/ia32entry.S
263     @@ -424,9 +424,9 @@ ENTRY(ia32_syscall)
264     orl $TS_COMPAT,TI_status(%r10)
265     testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
266     jnz ia32_tracesys
267     -ia32_do_syscall:
268     cmpl $(IA32_NR_syscalls-1),%eax
269     - ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
270     + ja ia32_badsys
271     +ia32_do_call:
272     IA32_ARG_FIXUP
273     call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
274     ia32_sysret:
275     @@ -441,7 +441,9 @@ ia32_tracesys:
276     call syscall_trace_enter
277     LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
278     RESTORE_REST
279     - jmp ia32_do_syscall
280     + cmpl $(IA32_NR_syscalls-1),%eax
281     + ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
282     + jmp ia32_do_call
283     END(ia32_syscall)
284    
285     ia32_badsys:
286     diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
287     index 885c826..ebd4638 100644
288     --- a/arch/x86/kernel/cpu/mtrr/main.c
289     +++ b/arch/x86/kernel/cpu/mtrr/main.c
290     @@ -1496,8 +1496,7 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
291    
292     /* kvm/qemu doesn't have mtrr set right, don't trim them all */
293     if (!highest_pfn) {
294     - WARN(!kvm_para_available(), KERN_WARNING
295     - "WARNING: strange, CPU MTRRs all blank?\n");
296     + printk(KERN_INFO "CPU MTRRs all blank - virtualized system.\n");
297     return 0;
298     }
299    
300     diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
301     index 61a83b7..6ad530f 100644
302     --- a/arch/x86/kernel/io_apic_64.c
303     +++ b/arch/x86/kernel/io_apic_64.c
304     @@ -1729,7 +1729,7 @@ static inline void __init check_timer(void)
305     setup_timer_IRQ0_pin(apic1, pin1, cfg->vector);
306     }
307     unmask_IO_APIC_irq(0);
308     - if (!no_timer_check && timer_irq_works()) {
309     + if (no_timer_check || timer_irq_works()) {
310     if (nmi_watchdog == NMI_IO_APIC) {
311     setup_nmi();
312     enable_8259A_irq(0);
313     diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
314     index e37dccc..12fe589 100644
315     --- a/arch/x86/kernel/ptrace.c
316     +++ b/arch/x86/kernel/ptrace.c
317     @@ -1403,7 +1403,7 @@ static void syscall_trace(struct pt_regs *regs)
318     #ifdef CONFIG_X86_32
319     # define IS_IA32 1
320     #elif defined CONFIG_IA32_EMULATION
321     -# define IS_IA32 test_thread_flag(TIF_IA32)
322     +# define IS_IA32 is_compat_task()
323     #else
324     # define IS_IA32 0
325     #endif
326     diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
327     index 724adfc..dfaa343 100644
328     --- a/arch/x86/kernel/reboot.c
329     +++ b/arch/x86/kernel/reboot.c
330     @@ -193,6 +193,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
331     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"),
332     },
333     },
334     + { /* Handle problems with rebooting on Dell XPS710 */
335     + .callback = set_bios_reboot,
336     + .ident = "Dell XPS710",
337     + .matches = {
338     + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
339     + DMI_MATCH(DMI_PRODUCT_NAME, "Dell XPS710"),
340     + },
341     + },
342     { }
343     };
344    
345     diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
346     index 6953859..3339772 100644
347     --- a/arch/x86/kernel/vmiclock_32.c
348     +++ b/arch/x86/kernel/vmiclock_32.c
349     @@ -280,10 +280,13 @@ void __devinit vmi_time_ap_init(void)
350     #endif
351    
352     /** vmi clocksource */
353     +static struct clocksource clocksource_vmi;
354    
355     static cycle_t read_real_cycles(void)
356     {
357     - return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
358     + cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
359     + return ret >= clocksource_vmi.cycle_last ?
360     + ret : clocksource_vmi.cycle_last;
361     }
362    
363     static struct clocksource clocksource_vmi = {
364     diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
365     index a4dd793..4020c3c 100644
366     --- a/arch/x86/mm/numa_64.c
367     +++ b/arch/x86/mm/numa_64.c
368     @@ -145,7 +145,7 @@ int __init compute_hash_shift(struct bootnode *nodes, int numnodes,
369     return shift;
370     }
371    
372     -int early_pfn_to_nid(unsigned long pfn)
373     +int __meminit __early_pfn_to_nid(unsigned long pfn)
374     {
375     return phys_to_nid(pfn << PAGE_SHIFT);
376     }
377     diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
378     index 6bbcf8a..001c099 100644
379     --- a/arch/x86/xen/enlighten.c
380     +++ b/arch/x86/xen/enlighten.c
381     @@ -1707,6 +1707,9 @@ asmlinkage void __init xen_start_kernel(void)
382     possible map and a non-dummy shared_info. */
383     per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
384    
385     + local_irq_disable();
386     + early_boot_irqs_off();
387     +
388     xen_raw_console_write("mapping kernel into physical memory\n");
389     pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
390    
391     diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
392     index 566206a..2694998 100644
393     --- a/drivers/acpi/ec.c
394     +++ b/drivers/acpi/ec.c
395     @@ -759,9 +759,10 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level,
396     struct acpi_namespace_node *node = handle;
397     struct acpi_ec *ec = context;
398     int value = 0;
399     - if (sscanf(node->name.ascii, "_Q%x", &value) == 1) {
400     +
401     + if (sscanf(node->name.ascii, "_Q%2x", &value) == 1)
402     acpi_ec_add_query_handler(ec, value, handle, NULL, NULL);
403     - }
404     +
405     return AE_OK;
406     }
407    
408     diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
409     index f38e2af..2bcf350 100644
410     --- a/drivers/ata/libata-core.c
411     +++ b/drivers/ata/libata-core.c
412     @@ -1190,14 +1190,16 @@ static u64 ata_id_n_sectors(const u16 *id)
413     {
414     if (ata_id_has_lba(id)) {
415     if (ata_id_has_lba48(id))
416     - return ata_id_u64(id, 100);
417     + return ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
418     else
419     - return ata_id_u32(id, 60);
420     + return ata_id_u32(id, ATA_ID_LBA_CAPACITY);
421     } else {
422     if (ata_id_current_chs_valid(id))
423     - return ata_id_u32(id, 57);
424     + return id[ATA_ID_CUR_CYLS] * id[ATA_ID_CUR_HEADS] *
425     + id[ATA_ID_CUR_SECTORS];
426     else
427     - return id[1] * id[3] * id[6];
428     + return id[ATA_ID_CYLS] * id[ATA_ID_HEADS] *
429     + id[ATA_ID_SECTORS];
430     }
431     }
432    
433     diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
434     index 154e7d6..22995d7 100644
435     --- a/drivers/ata/libata-eh.c
436     +++ b/drivers/ata/libata-eh.c
437     @@ -2272,11 +2272,14 @@ int ata_eh_reset(struct ata_link *link, int classify,
438     }
439    
440     /* prereset() might have cleared ATA_EH_RESET. If so,
441     - * bang classes and return.
442     + * bang classes, thaw and return.
443     */
444     if (reset && !(ehc->i.action & ATA_EH_RESET)) {
445     ata_link_for_each_dev(dev, link)
446     classes[dev->devno] = ATA_DEV_NONE;
447     + if ((ap->pflags & ATA_PFLAG_FROZEN) &&
448     + ata_is_host_link(link))
449     + ata_eh_thaw_port(ap);
450     rc = 0;
451     goto out;
452     }
453     diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
454     index 73338d2..31c18f4 100644
455     --- a/drivers/atm/fore200e.c
456     +++ b/drivers/atm/fore200e.c
457     @@ -2578,8 +2578,8 @@ fore200e_load_and_start_fw(struct fore200e* fore200e)
458     return err;
459    
460     sprintf(buf, "%s%s", fore200e->bus->proc_name, FW_EXT);
461     - if (request_firmware(&firmware, buf, device) == 1) {
462     - printk(FORE200E "missing %s firmware image\n", fore200e->bus->model_name);
463     + if ((err = request_firmware(&firmware, buf, device)) < 0) {
464     + printk(FORE200E "problem loading firmware image %s\n", fore200e->bus->model_name);
465     return err;
466     }
467    
468     diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
469     index 5b4c6e6..5552cef 100644
470     --- a/drivers/block/aoe/aoe.h
471     +++ b/drivers/block/aoe/aoe.h
472     @@ -18,6 +18,7 @@
473     enum {
474     AOECMD_ATA,
475     AOECMD_CFG,
476     + AOECMD_VEND_MIN = 0xf0,
477    
478     AOEFL_RSP = (1<<3),
479     AOEFL_ERR = (1<<2),
480     diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
481     index 0c81ca7..8d73e61 100644
482     --- a/drivers/block/aoe/aoenet.c
483     +++ b/drivers/block/aoe/aoenet.c
484     @@ -154,6 +154,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
485     aoecmd_cfg_rsp(skb);
486     break;
487     default:
488     + if (h->cmd >= AOECMD_VEND_MIN)
489     + break; /* don't complain about vendor commands */
490     printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
491     }
492     exit:
493     diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
494     index 3ca643c..ffab750 100644
495     --- a/drivers/block/xen-blkfront.c
496     +++ b/drivers/block/xen-blkfront.c
497     @@ -40,6 +40,7 @@
498     #include <linux/hdreg.h>
499     #include <linux/cdrom.h>
500     #include <linux/module.h>
501     +#include <linux/scatterlist.h>
502    
503     #include <xen/xenbus.h>
504     #include <xen/grant_table.h>
505     @@ -82,6 +83,7 @@ struct blkfront_info
506     enum blkif_state connected;
507     int ring_ref;
508     struct blkif_front_ring ring;
509     + struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
510     unsigned int evtchn, irq;
511     struct request_queue *rq;
512     struct work_struct work;
513     @@ -203,12 +205,11 @@ static int blkif_queue_request(struct request *req)
514     struct blkfront_info *info = req->rq_disk->private_data;
515     unsigned long buffer_mfn;
516     struct blkif_request *ring_req;
517     - struct req_iterator iter;
518     - struct bio_vec *bvec;
519     unsigned long id;
520     unsigned int fsect, lsect;
521     - int ref;
522     + int i, ref;
523     grant_ref_t gref_head;
524     + struct scatterlist *sg;
525    
526     if (unlikely(info->connected != BLKIF_STATE_CONNECTED))
527     return 1;
528     @@ -237,12 +238,13 @@ static int blkif_queue_request(struct request *req)
529     if (blk_barrier_rq(req))
530     ring_req->operation = BLKIF_OP_WRITE_BARRIER;
531    
532     - ring_req->nr_segments = 0;
533     - rq_for_each_segment(bvec, req, iter) {
534     - BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST);
535     - buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page));
536     - fsect = bvec->bv_offset >> 9;
537     - lsect = fsect + (bvec->bv_len >> 9) - 1;
538     + ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg);
539     + BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST);
540     +
541     + for_each_sg(info->sg, sg, ring_req->nr_segments, i) {
542     + buffer_mfn = pfn_to_mfn(page_to_pfn(sg_page(sg)));
543     + fsect = sg->offset >> 9;
544     + lsect = fsect + (sg->length >> 9) - 1;
545     /* install a grant reference. */
546     ref = gnttab_claim_grant_reference(&gref_head);
547     BUG_ON(ref == -ENOSPC);
548     @@ -253,16 +255,12 @@ static int blkif_queue_request(struct request *req)
549     buffer_mfn,
550     rq_data_dir(req) );
551    
552     - info->shadow[id].frame[ring_req->nr_segments] =
553     - mfn_to_pfn(buffer_mfn);
554     -
555     - ring_req->seg[ring_req->nr_segments] =
556     + info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn);
557     + ring_req->seg[i] =
558     (struct blkif_request_segment) {
559     .gref = ref,
560     .first_sect = fsect,
561     .last_sect = lsect };
562     -
563     - ring_req->nr_segments++;
564     }
565    
566     info->ring.req_prod_pvt++;
567     @@ -592,6 +590,8 @@ static int setup_blkring(struct xenbus_device *dev,
568     SHARED_RING_INIT(sring);
569     FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);
570    
571     + sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST);
572     +
573     err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring));
574     if (err < 0) {
575     free_page((unsigned long)sring);
576     diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
577     index 5eb23fa..c052627 100644
578     --- a/drivers/char/agp/intel-agp.c
579     +++ b/drivers/char/agp/intel-agp.c
580     @@ -633,13 +633,15 @@ static void intel_i830_init_gtt_entries(void)
581     break;
582     }
583     }
584     - if (gtt_entries > 0)
585     + if (gtt_entries > 0) {
586     dev_info(&agp_bridge->dev->dev, "detected %dK %s memory\n",
587     gtt_entries / KB(1), local ? "local" : "stolen");
588     - else
589     + gtt_entries /= KB(4);
590     + } else {
591     dev_info(&agp_bridge->dev->dev,
592     "no pre-allocated video memory detected\n");
593     - gtt_entries /= KB(4);
594     + gtt_entries = 0;
595     + }
596    
597     intel_private.gtt_entries = gtt_entries;
598     }
599     diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
600     index 67067e9..71556e6 100644
601     --- a/drivers/hwmon/f71882fg.c
602     +++ b/drivers/hwmon/f71882fg.c
603     @@ -837,7 +837,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address)
604    
605     devid = superio_inw(sioaddr, SIO_REG_MANID);
606     if (devid != SIO_FINTEK_ID) {
607     - printk(KERN_INFO DRVNAME ": Not a Fintek device\n");
608     + pr_debug(DRVNAME ": Not a Fintek device\n");
609     goto exit;
610     }
611    
612     diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
613     index d793cc0..c620b20 100644
614     --- a/drivers/hwmon/it87.c
615     +++ b/drivers/hwmon/it87.c
616     @@ -207,7 +207,7 @@ static inline u16 FAN16_TO_REG(long rpm)
617    
618     #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\
619     ((val)+500)/1000),-128,127))
620     -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000)
621     +#define TEMP_FROM_REG(val) ((val) * 1000)
622    
623     #define PWM_TO_REG(val) ((val) >> 1)
624     #define PWM_FROM_REG(val) (((val)&0x7f) << 1)
625     @@ -261,9 +261,9 @@ struct it87_data {
626     u8 has_fan; /* Bitfield, fans enabled */
627     u16 fan[5]; /* Register values, possibly combined */
628     u16 fan_min[5]; /* Register values, possibly combined */
629     - u8 temp[3]; /* Register value */
630     - u8 temp_high[3]; /* Register value */
631     - u8 temp_low[3]; /* Register value */
632     + s8 temp[3]; /* Register value */
633     + s8 temp_high[3]; /* Register value */
634     + s8 temp_low[3]; /* Register value */
635     u8 sensor; /* Register value */
636     u8 fan_div[3]; /* Register encoding, shifted right */
637     u8 vid; /* Register encoding, combined */
638     diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c
639     index 75089fe..c9a8d6f 100644
640     --- a/drivers/i2c/busses/i2c-acorn.c
641     +++ b/drivers/i2c/busses/i2c-acorn.c
642     @@ -84,6 +84,7 @@ static struct i2c_algo_bit_data ioc_data = {
643    
644     static struct i2c_adapter ioc_ops = {
645     .id = I2C_HW_B_IOC,
646     + .nr = 0,
647     .algo_data = &ioc_data,
648     };
649    
650     @@ -91,7 +92,7 @@ static int __init i2c_ioc_init(void)
651     {
652     force_ones = FORCE_ONES | SCL | SDA;
653    
654     - return i2c_bit_add_bus(&ioc_ops);
655     + return i2c_bit_add_numbered_bus(&ioc_ops);
656     }
657    
658     module_init(i2c_ioc_init);
659     diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
660     index 3972208..c688237 100644
661     --- a/drivers/i2c/busses/i2c-amd8111.c
662     +++ b/drivers/i2c/busses/i2c-amd8111.c
663     @@ -72,7 +72,7 @@ static unsigned int amd_ec_wait_write(struct amd_smbus *smbus)
664     {
665     int timeout = 500;
666    
667     - while (timeout-- && (inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF))
668     + while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout)
669     udelay(1);
670    
671     if (!timeout) {
672     @@ -88,7 +88,7 @@ static unsigned int amd_ec_wait_read(struct amd_smbus *smbus)
673     {
674     int timeout = 500;
675    
676     - while (timeout-- && (~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF))
677     + while ((~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF) && --timeout)
678     udelay(1);
679    
680     if (!timeout) {
681     diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
682     index 44d8384..cdbae97 100644
683     --- a/drivers/i2c/busses/i2c-pxa.c
684     +++ b/drivers/i2c/busses/i2c-pxa.c
685     @@ -604,7 +604,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
686    
687     i2c_pxa_start_message(i2c);
688    
689     - while (timeout-- && i2c->msg_num > 0) {
690     + while (i2c->msg_num > 0 && --timeout) {
691     i2c_pxa_handler(0, i2c);
692     udelay(10);
693     }
694     diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
695     index b346a68..a10d0d2 100644
696     --- a/drivers/i2c/i2c-core.c
697     +++ b/drivers/i2c/i2c-core.c
698     @@ -1795,7 +1795,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
699     case I2C_SMBUS_QUICK:
700     msg[0].len = 0;
701     /* Special case: The read/write field is used as data */
702     - msg[0].flags = flags | (read_write==I2C_SMBUS_READ)?I2C_M_RD:0;
703     + msg[0].flags = flags | (read_write == I2C_SMBUS_READ ?
704     + I2C_M_RD : 0);
705     num = 1;
706     break;
707     case I2C_SMBUS_BYTE:
708     diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
709     index 2cbadff..40fbf42 100644
710     --- a/drivers/ide/ide-iops.c
711     +++ b/drivers/ide/ide-iops.c
712     @@ -325,6 +325,8 @@ void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf,
713     u8 io_32bit = drive->io_32bit;
714     u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
715    
716     + len++;
717     +
718     if (io_32bit) {
719     unsigned long uninitialized_var(flags);
720    
721     diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
722     index 499d3cf..6f732ff 100644
723     --- a/drivers/infiniband/hw/nes/nes_cm.c
724     +++ b/drivers/infiniband/hw/nes/nes_cm.c
725     @@ -2474,12 +2474,14 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
726     int ret = 0;
727     struct nes_vnic *nesvnic;
728     struct nes_device *nesdev;
729     + struct nes_ib_device *nesibdev;
730    
731     nesvnic = to_nesvnic(nesqp->ibqp.device);
732     if (!nesvnic)
733     return -EINVAL;
734    
735     nesdev = nesvnic->nesdev;
736     + nesibdev = nesvnic->nesibdev;
737    
738     nes_debug(NES_DBG_CM, "netdev refcnt = %u.\n",
739     atomic_read(&nesvnic->netdev->refcnt));
740     @@ -2491,6 +2493,8 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
741     } else {
742     /* Need to free the Last Streaming Mode Message */
743     if (nesqp->ietf_frame) {
744     + if (nesqp->lsmm_mr)
745     + nesibdev->ibdev.dereg_mr(nesqp->lsmm_mr);
746     pci_free_consistent(nesdev->pcidev,
747     nesqp->private_data_len+sizeof(struct ietf_mpa_frame),
748     nesqp->ietf_frame, nesqp->ietf_frame_pbase);
749     @@ -2524,6 +2528,10 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
750     struct iw_cm_event cm_event;
751     struct nes_hw_qp_wqe *wqe;
752     struct nes_v4_quad nes_quad;
753     + struct nes_ib_device *nesibdev;
754     + struct ib_mr *ibmr = NULL;
755     + struct ib_phys_buf ibphysbuf;
756     + struct nes_pd *nespd;
757     u32 crc_value;
758     int ret;
759    
760     @@ -2584,6 +2592,26 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
761     if (cm_id->remote_addr.sin_addr.s_addr !=
762     cm_id->local_addr.sin_addr.s_addr) {
763     u64temp = (unsigned long)nesqp;
764     + nesibdev = nesvnic->nesibdev;
765     + nespd = nesqp->nespd;
766     + ibphysbuf.addr = nesqp->ietf_frame_pbase;
767     + ibphysbuf.size = conn_param->private_data_len +
768     + sizeof(struct ietf_mpa_frame);
769     + ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd,
770     + &ibphysbuf, 1,
771     + IB_ACCESS_LOCAL_WRITE,
772     + (u64 *)&nesqp->ietf_frame);
773     + if (!ibmr) {
774     + nes_debug(NES_DBG_CM, "Unable to register memory region"
775     + "for lSMM for cm_node = %p \n",
776     + cm_node);
777     + return -ENOMEM;
778     + }
779     +
780     + ibmr->pd = &nespd->ibpd;
781     + ibmr->device = nespd->ibpd.device;
782     + nesqp->lsmm_mr = ibmr;
783     +
784     u64temp |= NES_SW_CONTEXT_ALIGN>>1;
785     set_wqe_64bit_value(wqe->wqe_words,
786     NES_IWARP_SQ_WQE_COMP_CTX_LOW_IDX,
787     @@ -2594,14 +2622,13 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
788     wqe->wqe_words[NES_IWARP_SQ_WQE_TOTAL_PAYLOAD_IDX] =
789     cpu_to_le32(conn_param->private_data_len +
790     sizeof(struct ietf_mpa_frame));
791     - wqe->wqe_words[NES_IWARP_SQ_WQE_FRAG0_LOW_IDX] =
792     - cpu_to_le32((u32)nesqp->ietf_frame_pbase);
793     - wqe->wqe_words[NES_IWARP_SQ_WQE_FRAG0_HIGH_IDX] =
794     - cpu_to_le32((u32)((u64)nesqp->ietf_frame_pbase >> 32));
795     + set_wqe_64bit_value(wqe->wqe_words,
796     + NES_IWARP_SQ_WQE_FRAG0_LOW_IDX,
797     + (u64)nesqp->ietf_frame);
798     wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] =
799     cpu_to_le32(conn_param->private_data_len +
800     sizeof(struct ietf_mpa_frame));
801     - wqe->wqe_words[NES_IWARP_SQ_WQE_STAG0_IDX] = 0;
802     + wqe->wqe_words[NES_IWARP_SQ_WQE_STAG0_IDX] = ibmr->lkey;
803    
804     nesqp->nesqp_context->ird_ord_sizes |=
805     cpu_to_le32(NES_QPCONTEXT_ORDIRD_LSMM_PRESENT |
806     diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
807     index d79942e..7c79451 100644
808     --- a/drivers/infiniband/hw/nes/nes_verbs.c
809     +++ b/drivers/infiniband/hw/nes/nes_verbs.c
810     @@ -1338,8 +1338,10 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
811     NES_QPCONTEXT_MISC_RQ_SIZE_SHIFT);
812     nesqp->nesqp_context->misc |= cpu_to_le32((u32)nesqp->hwqp.sq_encoded_size <<
813     NES_QPCONTEXT_MISC_SQ_SIZE_SHIFT);
814     + if (!udata) {
815     nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_PRIV_EN);
816     nesqp->nesqp_context->misc |= cpu_to_le32(NES_QPCONTEXT_MISC_FAST_REGISTER_EN);
817     + }
818     nesqp->nesqp_context->cqs = cpu_to_le32(nesqp->nesscq->hw_cq.cq_number +
819     ((u32)nesqp->nesrcq->hw_cq.cq_number << 16));
820     u64temp = (u64)nesqp->hwqp.sq_pbase;
821     diff --git a/drivers/infiniband/hw/nes/nes_verbs.h b/drivers/infiniband/hw/nes/nes_verbs.h
822     index 6c6b4da..ae0ca9b 100644
823     --- a/drivers/infiniband/hw/nes/nes_verbs.h
824     +++ b/drivers/infiniband/hw/nes/nes_verbs.h
825     @@ -134,6 +134,7 @@ struct nes_qp {
826     struct ietf_mpa_frame *ietf_frame;
827     dma_addr_t ietf_frame_pbase;
828     wait_queue_head_t state_waitq;
829     + struct ib_mr *lsmm_mr;
830     unsigned long socket;
831     struct nes_hw_qp hwqp;
832     struct work_struct work;
833     diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
834     index 03a5ab7..2b510a3 100644
835     --- a/drivers/md/raid1.c
836     +++ b/drivers/md/raid1.c
837     @@ -1229,8 +1229,9 @@ static void end_sync_write(struct bio *bio, int error)
838     update_head_pos(mirror, r1_bio);
839    
840     if (atomic_dec_and_test(&r1_bio->remaining)) {
841     - md_done_sync(mddev, r1_bio->sectors, uptodate);
842     + sector_t s = r1_bio->sectors;
843     put_buf(r1_bio);
844     + md_done_sync(mddev, s, uptodate);
845     }
846     }
847    
848     diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
849     index 941576d..dc50f98 100644
850     --- a/drivers/md/raid10.c
851     +++ b/drivers/md/raid10.c
852     @@ -1231,6 +1231,7 @@ static void end_sync_read(struct bio *bio, int error)
853     /* for reconstruct, we always reschedule after a read.
854     * for resync, only after all reads
855     */
856     + rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev);
857     if (test_bit(R10BIO_IsRecover, &r10_bio->state) ||
858     atomic_dec_and_test(&r10_bio->remaining)) {
859     /* we have read all the blocks,
860     @@ -1238,7 +1239,6 @@ static void end_sync_read(struct bio *bio, int error)
861     */
862     reschedule_retry(r10_bio);
863     }
864     - rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev);
865     }
866    
867     static void end_sync_write(struct bio *bio, int error)
868     @@ -1259,11 +1259,13 @@ static void end_sync_write(struct bio *bio, int error)
869    
870     update_head_pos(i, r10_bio);
871    
872     + rdev_dec_pending(conf->mirrors[d].rdev, mddev);
873     while (atomic_dec_and_test(&r10_bio->remaining)) {
874     if (r10_bio->master_bio == NULL) {
875     /* the primary of several recovery bios */
876     - md_done_sync(mddev, r10_bio->sectors, 1);
877     + sector_t s = r10_bio->sectors;
878     put_buf(r10_bio);
879     + md_done_sync(mddev, s, 1);
880     break;
881     } else {
882     r10bio_t *r10_bio2 = (r10bio_t *)r10_bio->master_bio;
883     @@ -1271,7 +1273,6 @@ static void end_sync_write(struct bio *bio, int error)
884     r10_bio = r10_bio2;
885     }
886     }
887     - rdev_dec_pending(conf->mirrors[d].rdev, mddev);
888     }
889    
890     /*
891     @@ -1747,8 +1748,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
892     if (!go_faster && conf->nr_waiting)
893     msleep_interruptible(1000);
894    
895     - bitmap_cond_end_sync(mddev->bitmap, sector_nr);
896     -
897     /* Again, very different code for resync and recovery.
898     * Both must result in an r10bio with a list of bios that
899     * have bi_end_io, bi_sector, bi_bdev set,
900     @@ -1884,6 +1883,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
901     /* resync. Schedule a read for every block at this virt offset */
902     int count = 0;
903    
904     + bitmap_cond_end_sync(mddev->bitmap, sector_nr);
905     +
906     if (!bitmap_start_sync(mddev->bitmap, sector_nr,
907     &sync_blocks, mddev->degraded) &&
908     !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
909     @@ -2009,13 +2010,13 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
910     /* There is nowhere to write, so all non-sync
911     * drives must be failed, so try the next chunk...
912     */
913     - {
914     - sector_t sec = max_sector - sector_nr;
915     - sectors_skipped += sec;
916     + if (sector_nr + max_sync < max_sector)
917     + max_sector = sector_nr + max_sync;
918     +
919     + sectors_skipped += (max_sector - sector_nr);
920     chunks_skipped ++;
921     sector_nr = max_sector;
922     goto skipped;
923     - }
924     }
925    
926     static int run(mddev_t *mddev)
927     diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c
928     index 91204d3..9690264 100644
929     --- a/drivers/media/common/tuners/tda8290.c
930     +++ b/drivers/media/common/tuners/tda8290.c
931     @@ -726,7 +726,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
932     fe->ops.analog_ops.info.name = name;
933    
934     if (priv->ver & TDA8290) {
935     - tda8290_init_tuner(fe);
936     + if (priv->ver & (TDA8275 | TDA8275A))
937     + tda8290_init_tuner(fe);
938     tda8290_init_if(fe);
939     } else if (priv->ver & TDA8295)
940     tda8295_init_if(fe);
941     diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
942     index 7500a1c..3541938 100644
943     --- a/drivers/media/dvb/frontends/s5h1409.c
944     +++ b/drivers/media/dvb/frontends/s5h1409.c
945     @@ -542,9 +542,6 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe,
946    
947     s5h1409_enable_modulation(fe, p->u.vsb.modulation);
948    
949     - /* Allow the demod to settle */
950     - msleep(100);
951     -
952     if (fe->ops.tuner_ops.set_params) {
953     if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1);
954     fe->ops.tuner_ops.set_params(fe, p);
955     @@ -557,6 +554,10 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe,
956     s5h1409_set_qam_interleave_mode(fe);
957     }
958    
959     + /* Issue a reset to the demod so it knows to resync against the
960     + newly tuned frequency */
961     + s5h1409_softreset(fe);
962     +
963     return 0;
964     }
965    
966     diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
967     index 6103030..21f2aca 100644
968     --- a/drivers/media/video/ivtv/ivtv-ioctl.c
969     +++ b/drivers/media/video/ivtv/ivtv-ioctl.c
970     @@ -1744,6 +1744,18 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg)
971     break;
972     }
973    
974     + case IVTV_IOC_DMA_FRAME:
975     + case VIDEO_GET_PTS:
976     + case VIDEO_GET_FRAME_COUNT:
977     + case VIDEO_GET_EVENT:
978     + case VIDEO_PLAY:
979     + case VIDEO_STOP:
980     + case VIDEO_FREEZE:
981     + case VIDEO_CONTINUE:
982     + case VIDEO_COMMAND:
983     + case VIDEO_TRY_COMMAND:
984     + return ivtv_decoder_ioctls(file, cmd, (void *)arg);
985     +
986     default:
987     return -EINVAL;
988     }
989     @@ -1786,18 +1798,6 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f
990     ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
991     return 0;
992    
993     - case IVTV_IOC_DMA_FRAME:
994     - case VIDEO_GET_PTS:
995     - case VIDEO_GET_FRAME_COUNT:
996     - case VIDEO_GET_EVENT:
997     - case VIDEO_PLAY:
998     - case VIDEO_STOP:
999     - case VIDEO_FREEZE:
1000     - case VIDEO_CONTINUE:
1001     - case VIDEO_COMMAND:
1002     - case VIDEO_TRY_COMMAND:
1003     - return ivtv_decoder_ioctls(filp, cmd, (void *)arg);
1004     -
1005     default:
1006     break;
1007     }
1008     diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
1009     index 05e2982..174a35f 100644
1010     --- a/drivers/misc/hpilo.c
1011     +++ b/drivers/misc/hpilo.c
1012     @@ -710,6 +710,7 @@ out:
1013    
1014     static struct pci_device_id ilo_devices[] = {
1015     { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB204) },
1016     + { PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3307) },
1017     { }
1018     };
1019     MODULE_DEVICE_TABLE(pci, ilo_devices);
1020     diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
1021     index b92b172..b9f1e84 100644
1022     --- a/drivers/mmc/card/mmc_test.c
1023     +++ b/drivers/mmc/card/mmc_test.c
1024     @@ -494,7 +494,7 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
1025    
1026     sg_init_one(&sg, test->buffer, 512);
1027    
1028     - ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
1029     + ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
1030     if (ret)
1031     return ret;
1032    
1033     diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
1034     index ae16d84..42b70d7 100644
1035     --- a/drivers/mmc/host/s3cmci.c
1036     +++ b/drivers/mmc/host/s3cmci.c
1037     @@ -756,8 +756,7 @@ static void s3cmci_dma_setup(struct s3cmci_host *host,
1038     host->mem->start + host->sdidata);
1039    
1040     if (!setup_ok) {
1041     - s3c2410_dma_config(host->dma, 4,
1042     - (S3C2410_DCON_HWTRIG | S3C2410_DCON_CH0_SDI));
1043     + s3c2410_dma_config(host->dma, 4, 0);
1044     s3c2410_dma_set_buffdone_fn(host->dma,
1045     s3cmci_dma_done_callback);
1046     s3c2410_dma_setflags(host->dma, S3C2410_DMAF_AUTOSTART);
1047     diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
1048     index e3a8133..cc0feae 100644
1049     --- a/drivers/mmc/host/sdhci.c
1050     +++ b/drivers/mmc/host/sdhci.c
1051     @@ -1690,7 +1690,9 @@ int sdhci_add_host(struct sdhci_host *host)
1052     #endif
1053    
1054     #ifdef CONFIG_LEDS_CLASS
1055     - host->led.name = mmc_hostname(mmc);
1056     + snprintf(host->led_name, sizeof(host->led_name),
1057     + "%s::", mmc_hostname(mmc));
1058     + host->led.name = host->led_name;
1059     host->led.brightness = LED_OFF;
1060     host->led.default_trigger = mmc_hostname(mmc);
1061     host->led.brightness_set = sdhci_led_control;
1062     diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
1063     index 197d4a0..590d78f 100644
1064     --- a/drivers/mmc/host/sdhci.h
1065     +++ b/drivers/mmc/host/sdhci.h
1066     @@ -220,6 +220,7 @@ struct sdhci_host {
1067    
1068     #ifdef CONFIG_LEDS_CLASS
1069     struct led_classdev led; /* LED control */
1070     + char led_name[32];
1071     #endif
1072    
1073     spinlock_t lock; /* Mutex */
1074     diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
1075     index 8bd0dea..90279da 100644
1076     --- a/drivers/mtd/devices/mtd_dataflash.c
1077     +++ b/drivers/mtd/devices/mtd_dataflash.c
1078     @@ -628,7 +628,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
1079     if (!(info->flags & IS_POW2PS))
1080     return info;
1081     }
1082     - }
1083     + } else
1084     + return info;
1085     }
1086     }
1087    
1088     diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
1089     index 3fe0176..e6e3bf5 100644
1090     --- a/drivers/net/sis190.c
1091     +++ b/drivers/net/sis190.c
1092     @@ -317,6 +317,7 @@ static struct mii_chip_info {
1093     unsigned int type;
1094     u32 feature;
1095     } mii_chip_table[] = {
1096     + { "Atheros PHY AR8012", { 0x004d, 0xd020 }, LAN, 0 },
1097     { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 },
1098     { "Broadcom PHY AC131", { 0x0143, 0xbc70 }, LAN, 0 },
1099     { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 },
1100     diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
1101     index 37ecf84..375a0bd 100644
1102     --- a/drivers/net/usb/asix.c
1103     +++ b/drivers/net/usb/asix.c
1104     @@ -1444,6 +1444,18 @@ static const struct usb_device_id products [] = {
1105     // Apple USB Ethernet Adapter
1106     USB_DEVICE(0x05ac, 0x1402),
1107     .driver_info = (unsigned long) &ax88772_info,
1108     +}, {
1109     + // Cables-to-Go USB Ethernet Adapter
1110     + USB_DEVICE(0x0b95, 0x772a),
1111     + .driver_info = (unsigned long) &ax88772_info,
1112     +}, {
1113     + // ABOCOM for pci
1114     + USB_DEVICE(0x14ea, 0xab11),
1115     + .driver_info = (unsigned long) &ax88178_info,
1116     +}, {
1117     + // ASIX 88772a
1118     + USB_DEVICE(0x0db0, 0xa877),
1119     + .driver_info = (unsigned long) &ax88772_info,
1120     },
1121     { }, // END
1122     };
1123     diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
1124     index 0e061df..55e8ecc 100644
1125     --- a/drivers/net/usb/cdc_ether.c
1126     +++ b/drivers/net/usb/cdc_ether.c
1127     @@ -559,6 +559,11 @@ static const struct usb_device_id products [] = {
1128     USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
1129     USB_CDC_PROTO_NONE),
1130     .driver_info = (unsigned long) &cdc_info,
1131     +}, {
1132     + /* Ericsson F3507g */
1133     + USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1900, USB_CLASS_COMM,
1134     + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
1135     + .driver_info = (unsigned long) &cdc_info,
1136     },
1137     { }, // END
1138     };
1139     diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
1140     index e24f7b3..04882c8 100644
1141     --- a/drivers/net/usb/zaurus.c
1142     +++ b/drivers/net/usb/zaurus.c
1143     @@ -341,6 +341,11 @@ static const struct usb_device_id products [] = {
1144     USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
1145     USB_CDC_PROTO_NONE),
1146     .driver_info = (unsigned long) &bogus_mdlm_info,
1147     +}, {
1148     + /* Motorola MOTOMAGX phones */
1149     + USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM,
1150     + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
1151     + .driver_info = (unsigned long) &bogus_mdlm_info,
1152     },
1153    
1154     /* Olympus has some models with a Zaurus-compatible option.
1155     diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
1156     index ef84732..cee6288 100644
1157     --- a/drivers/net/wireless/rtl8187_dev.c
1158     +++ b/drivers/net/wireless/rtl8187_dev.c
1159     @@ -40,6 +40,10 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
1160     {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B},
1161     {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B},
1162     {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B},
1163     + /* Surecom */
1164     + {USB_DEVICE(0x0769, 0x11F2), .driver_info = DEVICE_RTL8187},
1165     + /* Logitech */
1166     + {USB_DEVICE(0x0789, 0x010C), .driver_info = DEVICE_RTL8187},
1167     /* Netgear */
1168     {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187},
1169     {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187},
1170     @@ -49,8 +53,16 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
1171     /* Sitecom */
1172     {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
1173     {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
1174     + /* Sphairon Access Systems GmbH */
1175     + {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
1176     + /* Dick Smith Electronics */
1177     + {USB_DEVICE(0x1371, 0x9401), .driver_info = DEVICE_RTL8187},
1178     /* Abocom */
1179     {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
1180     + /* Qcom */
1181     + {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187},
1182     + /* AirLive */
1183     + {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187},
1184     {}
1185     };
1186    
1187     diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
1188     index ee5e7b5..4dccc0a 100644
1189     --- a/drivers/pci/pcie/aer/aerdrv_core.c
1190     +++ b/drivers/pci/pcie/aer/aerdrv_core.c
1191     @@ -134,6 +134,34 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
1192     }
1193     #endif /* 0 */
1194    
1195     +
1196     +static void set_device_error_reporting(struct pci_dev *dev, void *data)
1197     +{
1198     + bool enable = *((bool *)data);
1199     +
1200     + if (dev->pcie_type != PCIE_RC_PORT &&
1201     + dev->pcie_type != PCIE_SW_UPSTREAM_PORT &&
1202     + dev->pcie_type != PCIE_SW_DOWNSTREAM_PORT)
1203     + return;
1204     +
1205     + if (enable)
1206     + pci_enable_pcie_error_reporting(dev);
1207     + else
1208     + pci_disable_pcie_error_reporting(dev);
1209     +}
1210     +
1211     +/**
1212     + * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports.
1213     + * @dev: pointer to root port's pci_dev data structure
1214     + * @enable: true = enable error reporting, false = disable error reporting.
1215     + */
1216     +static void set_downstream_devices_error_reporting(struct pci_dev *dev,
1217     + bool enable)
1218     +{
1219     + set_device_error_reporting(dev, &enable);
1220     + pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable);
1221     +}
1222     +
1223     static int find_device_iter(struct device *device, void *data)
1224     {
1225     struct pci_dev *dev;
1226     @@ -551,15 +579,11 @@ void aer_enable_rootport(struct aer_rpc *rpc)
1227     pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, &reg32);
1228     pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32);
1229    
1230     - /* Enable Root Port device reporting error itself */
1231     - pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, &reg16);
1232     - reg16 = reg16 |
1233     - PCI_EXP_DEVCTL_CERE |
1234     - PCI_EXP_DEVCTL_NFERE |
1235     - PCI_EXP_DEVCTL_FERE |
1236     - PCI_EXP_DEVCTL_URRE;
1237     - pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL,
1238     - reg16);
1239     + /*
1240     + * Enable error reporting for the root port device and downstream port
1241     + * devices.
1242     + */
1243     + set_downstream_devices_error_reporting(pdev, true);
1244    
1245     /* Enable Root Port's interrupt in response to error messages */
1246     pci_write_config_dword(pdev,
1247     @@ -579,6 +603,12 @@ static void disable_root_aer(struct aer_rpc *rpc)
1248     u32 reg32;
1249     int pos;
1250    
1251     + /*
1252     + * Disable error reporting for the root port device and downstream port
1253     + * devices.
1254     + */
1255     + set_downstream_devices_error_reporting(pdev, false);
1256     +
1257     pos = pci_find_aer_capability(pdev);
1258     /* Disable Root's interrupt in response to error messages */
1259     pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0);
1260     diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
1261     index 6abfafc..e6b77cb 100644
1262     --- a/drivers/pci/pcie/portdrv_pci.c
1263     +++ b/drivers/pci/pcie/portdrv_pci.c
1264     @@ -109,14 +109,13 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
1265    
1266     pcie_portdrv_save_config(dev);
1267    
1268     - pci_enable_pcie_error_reporting(dev);
1269     -
1270     return 0;
1271     }
1272    
1273     static void pcie_portdrv_remove (struct pci_dev *dev)
1274     {
1275     pcie_port_device_remove(dev);
1276     + pci_disable_device(dev);
1277     kfree(pci_get_drvdata(dev));
1278     }
1279    
1280     diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1281     index 9236e7f..d0e5769 100644
1282     --- a/drivers/pci/quirks.c
1283     +++ b/drivers/pci/quirks.c
1284     @@ -22,6 +22,7 @@
1285     #include <linux/delay.h>
1286     #include <linux/acpi.h>
1287     #include <linux/kallsyms.h>
1288     +#include <linux/pci-aspm.h>
1289     #include "pci.h"
1290    
1291     /* The Mellanox Tavor device gives false positive parity errors
1292     @@ -1542,6 +1543,30 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1293     }
1294     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
1295    
1296     +/*
1297     + * The 82575 and 82598 may experience data corruption issues when transitioning
1298     + * out of L0S. To prevent this we need to disable L0S on the pci-e link
1299     + */
1300     +static void __devinit quirk_disable_aspm_l0s(struct pci_dev *dev)
1301     +{
1302     + dev_info(&dev->dev, "Disabling L0s\n");
1303     + pci_disable_link_state(dev, PCIE_LINK_STATE_L0S);
1304     +}
1305     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s);
1306     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s);
1307     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s);
1308     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s);
1309     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s);
1310     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s);
1311     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s);
1312     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s);
1313     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s);
1314     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s);
1315     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s);
1316     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
1317     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
1318     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
1319     +
1320     static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1321     {
1322     /* rev 1 ncr53c810 chips don't set the class at all which means
1323     @@ -1856,7 +1881,6 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
1324     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
1325     quirk_msi_ht_cap);
1326    
1327     -
1328     /* The nVidia CK804 chipset may have 2 HT MSI mappings.
1329     * MSI are supported if the MSI capability set in any of these mappings.
1330     */
1331     @@ -1907,6 +1931,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
1332     PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
1333     ht_enable_msi_mapping);
1334    
1335     +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE,
1336     + ht_enable_msi_mapping);
1337     +
1338     static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
1339     {
1340     struct pci_dev *host_bridge;
1341     diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
1342     index a48e499..34be88d 100644
1343     --- a/drivers/scsi/hptiop.c
1344     +++ b/drivers/scsi/hptiop.c
1345     @@ -1251,6 +1251,7 @@ static struct pci_device_id hptiop_id_table[] = {
1346     { PCI_VDEVICE(TTI, 0x3530), (kernel_ulong_t)&hptiop_itl_ops },
1347     { PCI_VDEVICE(TTI, 0x3560), (kernel_ulong_t)&hptiop_itl_ops },
1348     { PCI_VDEVICE(TTI, 0x4322), (kernel_ulong_t)&hptiop_itl_ops },
1349     + { PCI_VDEVICE(TTI, 0x4321), (kernel_ulong_t)&hptiop_itl_ops },
1350     { PCI_VDEVICE(TTI, 0x4210), (kernel_ulong_t)&hptiop_itl_ops },
1351     { PCI_VDEVICE(TTI, 0x4211), (kernel_ulong_t)&hptiop_itl_ops },
1352     { PCI_VDEVICE(TTI, 0x4310), (kernel_ulong_t)&hptiop_itl_ops },
1353     diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
1354     index b7ea69c..0353e8b 100644
1355     --- a/drivers/scsi/sd.c
1356     +++ b/drivers/scsi/sd.c
1357     @@ -99,6 +99,7 @@ static void scsi_disk_release(struct device *cdev);
1358     static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
1359     static void sd_print_result(struct scsi_disk *, int);
1360    
1361     +static DEFINE_SPINLOCK(sd_index_lock);
1362     static DEFINE_IDA(sd_index_ida);
1363    
1364     /* This semaphore is used to mediate the 0->1 reference get in the
1365     @@ -1817,7 +1818,9 @@ static int sd_probe(struct device *dev)
1366     if (!ida_pre_get(&sd_index_ida, GFP_KERNEL))
1367     goto out_put;
1368    
1369     + spin_lock(&sd_index_lock);
1370     error = ida_get_new(&sd_index_ida, &index);
1371     + spin_unlock(&sd_index_lock);
1372     } while (error == -EAGAIN);
1373    
1374     if (error)
1375     @@ -1891,7 +1894,9 @@ static int sd_probe(struct device *dev)
1376     return 0;
1377    
1378     out_free_index:
1379     + spin_lock(&sd_index_lock);
1380     ida_remove(&sd_index_ida, index);
1381     + spin_unlock(&sd_index_lock);
1382     out_put:
1383     put_disk(gd);
1384     out_free:
1385     @@ -1941,7 +1946,9 @@ static void scsi_disk_release(struct device *dev)
1386     struct scsi_disk *sdkp = to_scsi_disk(dev);
1387     struct gendisk *disk = sdkp->disk;
1388    
1389     + spin_lock(&sd_index_lock);
1390     ida_remove(&sd_index_ida, sdkp->index);
1391     + spin_unlock(&sd_index_lock);
1392    
1393     disk->private_data = NULL;
1394     put_disk(disk);
1395     diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
1396     index 9ccc563..3499a9d 100644
1397     --- a/drivers/serial/8250.c
1398     +++ b/drivers/serial/8250.c
1399     @@ -1956,6 +1956,20 @@ static int serial8250_startup(struct uart_port *port)
1400    
1401     serial8250_set_mctrl(&up->port, up->port.mctrl);
1402    
1403     + /* Serial over Lan (SoL) hack:
1404     + Intel 8257x Gigabit ethernet chips have a
1405     + 16550 emulation, to be used for Serial Over Lan.
1406     + Those chips take a longer time than a normal
1407     + serial device to signalize that a transmission
1408     + data was queued. Due to that, the above test generally
1409     + fails. One solution would be to delay the reading of
1410     + iir. However, this is not reliable, since the timeout
1411     + is variable. So, let's just don't test if we receive
1412     + TX irq. This way, we'll never enable UART_BUG_TXEN.
1413     + */
1414     + if (up->port.flags & UPF_NO_TXEN_TEST)
1415     + goto dont_test_tx_en;
1416     +
1417     /*
1418     * Do a quick test to see if we receive an
1419     * interrupt when we enable the TX irq.
1420     @@ -1975,6 +1989,7 @@ static int serial8250_startup(struct uart_port *port)
1421     up->bugs &= ~UART_BUG_TXEN;
1422     }
1423    
1424     +dont_test_tx_en:
1425     spin_unlock_irqrestore(&up->port.lock, flags);
1426    
1427     /*
1428     diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
1429     index 056071d..9f72ad7 100644
1430     --- a/drivers/serial/8250_pci.c
1431     +++ b/drivers/serial/8250_pci.c
1432     @@ -762,6 +762,21 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
1433     return setup_port(priv, port, bar, offset, board->reg_shift);
1434     }
1435    
1436     +static int skip_tx_en_setup(struct serial_private *priv,
1437     + const struct pciserial_board *board,
1438     + struct uart_port *port, int idx)
1439     +{
1440     + port->flags |= UPF_NO_TXEN_TEST;
1441     + printk(KERN_DEBUG "serial8250: skipping TxEn test for device "
1442     + "[%04x:%04x] subsystem [%04x:%04x]\n",
1443     + priv->dev->vendor,
1444     + priv->dev->device,
1445     + priv->dev->subsystem_vendor,
1446     + priv->dev->subsystem_device);
1447     +
1448     + return pci_default_setup(priv, board, port, idx);
1449     +}
1450     +
1451     /* This should be in linux/pci_ids.h */
1452     #define PCI_VENDOR_ID_SBSMODULARIO 0x124B
1453     #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
1454     @@ -828,6 +843,27 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1455     .init = pci_inteli960ni_init,
1456     .setup = pci_default_setup,
1457     },
1458     + {
1459     + .vendor = PCI_VENDOR_ID_INTEL,
1460     + .device = PCI_DEVICE_ID_INTEL_8257X_SOL,
1461     + .subvendor = PCI_ANY_ID,
1462     + .subdevice = PCI_ANY_ID,
1463     + .setup = skip_tx_en_setup,
1464     + },
1465     + {
1466     + .vendor = PCI_VENDOR_ID_INTEL,
1467     + .device = PCI_DEVICE_ID_INTEL_82573L_SOL,
1468     + .subvendor = PCI_ANY_ID,
1469     + .subdevice = PCI_ANY_ID,
1470     + .setup = skip_tx_en_setup,
1471     + },
1472     + {
1473     + .vendor = PCI_VENDOR_ID_INTEL,
1474     + .device = PCI_DEVICE_ID_INTEL_82573E_SOL,
1475     + .subvendor = PCI_ANY_ID,
1476     + .subdevice = PCI_ANY_ID,
1477     + .setup = skip_tx_en_setup,
1478     + },
1479     /*
1480     * ITE
1481     */
1482     diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
1483     index 338cf8a..edec3a9 100644
1484     --- a/drivers/serial/jsm/jsm_driver.c
1485     +++ b/drivers/serial/jsm/jsm_driver.c
1486     @@ -84,6 +84,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1487     brd->pci_dev = pdev;
1488     if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM)
1489     brd->maxports = 4;
1490     + else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8)
1491     + brd->maxports = 8;
1492     else
1493     brd->maxports = 2;
1494    
1495     @@ -212,6 +214,7 @@ static struct pci_device_id jsm_pci_tbl[] = {
1496     { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 },
1497     { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 },
1498     { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 },
1499     + { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 },
1500     { 0, }
1501     };
1502     MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);
1503     diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1504     index 61524fc..a250cae 100644
1505     --- a/drivers/usb/class/cdc-acm.c
1506     +++ b/drivers/usb/class/cdc-acm.c
1507     @@ -1365,6 +1365,8 @@ static struct usb_device_id acm_ids[] = {
1508     { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */
1509     .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1510     },
1511     + { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
1512     + },
1513    
1514     /* control interfaces with various AT-command sets */
1515     { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
1516     diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1517     index 9cfa366..2aa2a58 100644
1518     --- a/drivers/usb/core/message.c
1519     +++ b/drivers/usb/core/message.c
1520     @@ -651,7 +651,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type,
1521     if (result <= 0 && result != -ETIMEDOUT)
1522     continue;
1523     if (result > 1 && ((u8 *)buf)[1] != type) {
1524     - result = -EPROTO;
1525     + result = -ENODATA;
1526     continue;
1527     }
1528     break;
1529     @@ -694,8 +694,13 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid,
1530     USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
1531     (USB_DT_STRING << 8) + index, langid, buf, size,
1532     USB_CTRL_GET_TIMEOUT);
1533     - if (!(result == 0 || result == -EPIPE))
1534     - break;
1535     + if (result == 0 || result == -EPIPE)
1536     + continue;
1537     + if (result > 1 && ((u8 *) buf)[1] != USB_DT_STRING) {
1538     + result = -ENODATA;
1539     + continue;
1540     + }
1541     + break;
1542     }
1543     return result;
1544     }
1545     diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
1546     index dc21ade..df7b605 100644
1547     --- a/drivers/usb/host/ehci-hcd.c
1548     +++ b/drivers/usb/host/ehci-hcd.c
1549     @@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd)
1550     * periodic_size can shrink by USBCMD update if hcc_params allows.
1551     */
1552     ehci->periodic_size = DEFAULT_I_TDPS;
1553     + INIT_LIST_HEAD(&ehci->cached_itd_list);
1554     if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
1555     return retval;
1556    
1557     @@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd)
1558    
1559     ehci->reclaim = NULL;
1560     ehci->next_uframe = -1;
1561     + ehci->clock_frame = -1;
1562    
1563     /*
1564     * dedicate a qh for the async ring head, since we couldn't unlink
1565     diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
1566     index 0431397..10d5291 100644
1567     --- a/drivers/usb/host/ehci-mem.c
1568     +++ b/drivers/usb/host/ehci-mem.c
1569     @@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh)
1570    
1571     static void ehci_mem_cleanup (struct ehci_hcd *ehci)
1572     {
1573     + free_cached_itd_list(ehci);
1574     if (ehci->async)
1575     qh_put (ehci->async);
1576     ehci->async = NULL;
1577     diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1578     index a081ee6..07bcb93 100644
1579     --- a/drivers/usb/host/ehci-sched.c
1580     +++ b/drivers/usb/host/ehci-sched.c
1581     @@ -1004,7 +1004,8 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
1582    
1583     is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0;
1584     stream->bEndpointAddress &= 0x0f;
1585     - stream->ep->hcpriv = NULL;
1586     + if (stream->ep)
1587     + stream->ep->hcpriv = NULL;
1588    
1589     if (stream->rescheduled) {
1590     ehci_info (ehci, "ep%d%s-iso rescheduled "
1591     @@ -1653,14 +1654,28 @@ itd_complete (
1592     (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out");
1593     }
1594     iso_stream_put (ehci, stream);
1595     - /* OK to recycle this ITD now that its completion callback ran. */
1596     +
1597     done:
1598     usb_put_urb(urb);
1599     itd->urb = NULL;
1600     - itd->stream = NULL;
1601     - list_move(&itd->itd_list, &stream->free_list);
1602     - iso_stream_put(ehci, stream);
1603     -
1604     + if (ehci->clock_frame != itd->frame || itd->index[7] != -1) {
1605     + /* OK to recycle this ITD now. */
1606     + itd->stream = NULL;
1607     + list_move(&itd->itd_list, &stream->free_list);
1608     + iso_stream_put(ehci, stream);
1609     + } else {
1610     + /* HW might remember this ITD, so we can't recycle it yet.
1611     + * Move it to a safe place until a new frame starts.
1612     + */
1613     + list_move(&itd->itd_list, &ehci->cached_itd_list);
1614     + if (stream->refcount == 2) {
1615     + /* If iso_stream_put() were called here, stream
1616     + * would be freed. Instead, just prevent reuse.
1617     + */
1618     + stream->ep->hcpriv = NULL;
1619     + stream->ep = NULL;
1620     + }
1621     + }
1622     return retval;
1623     }
1624    
1625     @@ -2101,6 +2116,20 @@ done:
1626    
1627     /*-------------------------------------------------------------------------*/
1628    
1629     +static void free_cached_itd_list(struct ehci_hcd *ehci)
1630     +{
1631     + struct ehci_itd *itd, *n;
1632     +
1633     + list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) {
1634     + struct ehci_iso_stream *stream = itd->stream;
1635     + itd->stream = NULL;
1636     + list_move(&itd->itd_list, &stream->free_list);
1637     + iso_stream_put(ehci, stream);
1638     + }
1639     +}
1640     +
1641     +/*-------------------------------------------------------------------------*/
1642     +
1643     static void
1644     scan_periodic (struct ehci_hcd *ehci)
1645     {
1646     @@ -2115,10 +2144,17 @@ scan_periodic (struct ehci_hcd *ehci)
1647     * Touches as few pages as possible: cache-friendly.
1648     */
1649     now_uframe = ehci->next_uframe;
1650     - if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state))
1651     + if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) {
1652     clock = ehci_readl(ehci, &ehci->regs->frame_index);
1653     - else
1654     + clock_frame = (clock >> 3) % ehci->periodic_size;
1655     + } else {
1656     clock = now_uframe + mod - 1;
1657     + clock_frame = -1;
1658     + }
1659     + if (ehci->clock_frame != clock_frame) {
1660     + free_cached_itd_list(ehci);
1661     + ehci->clock_frame = clock_frame;
1662     + }
1663     clock %= mod;
1664     clock_frame = clock >> 3;
1665    
1666     @@ -2277,6 +2313,10 @@ restart:
1667     /* rescan the rest of this frame, then ... */
1668     clock = now;
1669     clock_frame = clock >> 3;
1670     + if (ehci->clock_frame != clock_frame) {
1671     + free_cached_itd_list(ehci);
1672     + ehci->clock_frame = clock_frame;
1673     + }
1674     } else {
1675     now_uframe++;
1676     now_uframe %= mod;
1677     diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
1678     index 5799298..33459d7 100644
1679     --- a/drivers/usb/host/ehci.h
1680     +++ b/drivers/usb/host/ehci.h
1681     @@ -87,6 +87,10 @@ struct ehci_hcd { /* one per controller */
1682     int next_uframe; /* scan periodic, start here */
1683     unsigned periodic_sched; /* periodic activity count */
1684    
1685     + /* list of itds completed while clock_frame was still active */
1686     + struct list_head cached_itd_list;
1687     + unsigned clock_frame;
1688     +
1689     /* per root hub port */
1690     unsigned long reset_done [EHCI_MAX_ROOT_PORTS];
1691    
1692     @@ -208,6 +212,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
1693     }
1694     }
1695    
1696     +static void free_cached_itd_list(struct ehci_hcd *ehci);
1697     +
1698     /*-------------------------------------------------------------------------*/
1699    
1700     /* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
1701     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1702     index 876bf36..9930150 100644
1703     --- a/drivers/usb/serial/option.c
1704     +++ b/drivers/usb/serial/option.c
1705     @@ -289,6 +289,9 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
1706     #define ERICSSON_VENDOR_ID 0x0bdb
1707     #define ERICSSON_PRODUCT_F3507G 0x1900
1708    
1709     +#define BENQ_VENDOR_ID 0x04a5
1710     +#define BENQ_PRODUCT_H10 0x4068
1711     +
1712     static struct usb_device_id option_ids[] = {
1713     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
1714     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
1715     @@ -498,6 +501,8 @@ static struct usb_device_id option_ids[] = {
1716     { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
1717     { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
1718     { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) },
1719     + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
1720     + { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */
1721     { } /* Terminating entry */
1722     };
1723     MODULE_DEVICE_TABLE(usb, option_ids);
1724     diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1725     index d775cfe..019bd62 100644
1726     --- a/drivers/usb/storage/unusual_devs.h
1727     +++ b/drivers/usb/storage/unusual_devs.h
1728     @@ -953,13 +953,13 @@ UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff,
1729     "Genesys Logic",
1730     "USB to IDE Optical",
1731     US_SC_DEVICE, US_PR_DEVICE, NULL,
1732     - US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
1733     + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
1734    
1735     UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff,
1736     "Genesys Logic",
1737     "USB to IDE Disk",
1738     US_SC_DEVICE, US_PR_DEVICE, NULL,
1739     - US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
1740     + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ),
1741    
1742     /* Reported by Hanno Boeck <hanno@gmx.de>
1743     * Taken from the Lycoris Kernel */
1744     diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
1745     index 0b798fd..74c92d3 100644
1746     --- a/drivers/watchdog/ks8695_wdt.c
1747     +++ b/drivers/watchdog/ks8695_wdt.c
1748     @@ -21,6 +21,7 @@
1749     #include <linux/watchdog.h>
1750     #include <linux/io.h>
1751     #include <linux/uaccess.h>
1752     +#include <mach/timex.h>
1753     #include <mach/regs-timer.h>
1754    
1755     #define WDT_DEFAULT_TIME 5 /* seconds */
1756     diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
1757     index c9c73b6..e96f2ef 100644
1758     --- a/drivers/watchdog/rc32434_wdt.c
1759     +++ b/drivers/watchdog/rc32434_wdt.c
1760     @@ -33,104 +33,89 @@
1761     #include <asm/time.h>
1762     #include <asm/mach-rc32434/integ.h>
1763    
1764     -#define MAX_TIMEOUT 20
1765     -#define RC32434_WDT_INTERVAL (15 * HZ)
1766     -
1767     -#define VERSION "0.2"
1768     +#define VERSION "0.4"
1769    
1770     static struct {
1771     - struct completion stop;
1772     - int running;
1773     - struct timer_list timer;
1774     - int queue;
1775     - int default_ticks;
1776     unsigned long inuse;
1777     } rc32434_wdt_device;
1778    
1779     static struct integ __iomem *wdt_reg;
1780     -static int ticks = 100 * HZ;
1781    
1782     static int expect_close;
1783     -static int timeout;
1784     +
1785     +/* Board internal clock speed in Hz,
1786     + * the watchdog timer ticks at. */
1787     +extern unsigned int idt_cpu_freq;
1788     +
1789     +/* translate wtcompare value to seconds and vice versa */
1790     +#define WTCOMP2SEC(x) (x / idt_cpu_freq)
1791     +#define SEC2WTCOMP(x) (x * idt_cpu_freq)
1792     +
1793     +/* Use a default timeout of 20s. This should be
1794     + * safe for CPU clock speeds up to 400MHz, as
1795     + * ((2 ^ 32) - 1) / (400MHz / 2) = 21s. */
1796     +#define WATCHDOG_TIMEOUT 20
1797     +
1798     +static int timeout = WATCHDOG_TIMEOUT;
1799    
1800     static int nowayout = WATCHDOG_NOWAYOUT;
1801     module_param(nowayout, int, 0);
1802     MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
1803     __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
1804    
1805     +/* apply or and nand masks to data read from addr and write back */
1806     +#define SET_BITS(addr, or, nand) \
1807     + writel((readl(&addr) | or) & ~nand, &addr)
1808    
1809     static void rc32434_wdt_start(void)
1810     {
1811     - u32 val;
1812     -
1813     - if (!rc32434_wdt_device.inuse) {
1814     - writel(0, &wdt_reg->wtcount);
1815     + u32 or, nand;
1816    
1817     - val = RC32434_ERR_WRE;
1818     - writel(readl(&wdt_reg->errcs) | val, &wdt_reg->errcs);
1819     + /* zero the counter before enabling */
1820     + writel(0, &wdt_reg->wtcount);
1821    
1822     - val = RC32434_WTC_EN;
1823     - writel(readl(&wdt_reg->wtc) | val, &wdt_reg->wtc);
1824     - }
1825     - rc32434_wdt_device.running++;
1826     -}
1827     + /* don't generate a non-maskable interrupt,
1828     + * do a warm reset instead */
1829     + nand = 1 << RC32434_ERR_WNE;
1830     + or = 1 << RC32434_ERR_WRE;
1831    
1832     -static void rc32434_wdt_stop(void)
1833     -{
1834     - u32 val;
1835     + /* reset the ERRCS timeout bit in case it's set */
1836     + nand |= 1 << RC32434_ERR_WTO;
1837    
1838     - if (rc32434_wdt_device.running) {
1839     + SET_BITS(wdt_reg->errcs, or, nand);
1840    
1841     - val = ~RC32434_WTC_EN;
1842     - writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc);
1843     + /* reset WTC timeout bit and enable WDT */
1844     + nand = 1 << RC32434_WTC_TO;
1845     + or = 1 << RC32434_WTC_EN;
1846    
1847     - val = ~RC32434_ERR_WRE;
1848     - writel(readl(&wdt_reg->errcs) & val, &wdt_reg->errcs);
1849     + SET_BITS(wdt_reg->wtc, or, nand);
1850     +}
1851    
1852     - rc32434_wdt_device.running = 0;
1853     - }
1854     +static void rc32434_wdt_stop(void)
1855     +{
1856     + /* Disable WDT */
1857     + SET_BITS(wdt_reg->wtc, 0, 1 << RC32434_WTC_EN);
1858     }
1859    
1860     -static void rc32434_wdt_set(int new_timeout)
1861     +static int rc32434_wdt_set(int new_timeout)
1862     {
1863     - u32 cmp = new_timeout * HZ;
1864     - u32 state, val;
1865     + int max_to = WTCOMP2SEC((u32)-1);
1866    
1867     + if (new_timeout < 0 || new_timeout > max_to) {
1868     + printk(KERN_ERR KBUILD_MODNAME
1869     + ": timeout value must be between 0 and %d",
1870     + max_to);
1871     + return -EINVAL;
1872     + }
1873     timeout = new_timeout;
1874     - /*
1875     - * store and disable WTC
1876     - */
1877     - state = (u32)(readl(&wdt_reg->wtc) & RC32434_WTC_EN);
1878     - val = ~RC32434_WTC_EN;
1879     - writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc);
1880     -
1881     - writel(0, &wdt_reg->wtcount);
1882     - writel(cmp, &wdt_reg->wtcompare);
1883     -
1884     - /*
1885     - * restore WTC
1886     - */
1887     -
1888     - writel(readl(&wdt_reg->wtc) | state, &wdt_reg);
1889     -}
1890     + writel(SEC2WTCOMP(timeout), &wdt_reg->wtcompare);
1891    
1892     -static void rc32434_wdt_reset(void)
1893     -{
1894     - ticks = rc32434_wdt_device.default_ticks;
1895     + return 0;
1896     }
1897    
1898     -static void rc32434_wdt_update(unsigned long unused)
1899     +static void rc32434_wdt_ping(void)
1900     {
1901     - if (rc32434_wdt_device.running)
1902     - ticks--;
1903     -
1904     writel(0, &wdt_reg->wtcount);
1905     -
1906     - if (rc32434_wdt_device.queue && ticks)
1907     - mod_timer(&rc32434_wdt_device.timer,
1908     - jiffies + RC32434_WDT_INTERVAL);
1909     - else
1910     - complete(&rc32434_wdt_device.stop);
1911     }
1912    
1913     static int rc32434_wdt_open(struct inode *inode, struct file *file)
1914     @@ -141,19 +126,23 @@ static int rc32434_wdt_open(struct inode *inode, struct file *file)
1915     if (nowayout)
1916     __module_get(THIS_MODULE);
1917    
1918     + rc32434_wdt_start();
1919     + rc32434_wdt_ping();
1920     +
1921     return nonseekable_open(inode, file);
1922     }
1923    
1924     static int rc32434_wdt_release(struct inode *inode, struct file *file)
1925     {
1926     - if (expect_close && nowayout == 0) {
1927     + if (expect_close == 42) {
1928     rc32434_wdt_stop();
1929     printk(KERN_INFO KBUILD_MODNAME ": disabling watchdog timer\n");
1930     module_put(THIS_MODULE);
1931     - } else
1932     + } else {
1933     printk(KERN_CRIT KBUILD_MODNAME
1934     ": device closed unexpectedly. WDT will not stop !\n");
1935     -
1936     + rc32434_wdt_ping();
1937     + }
1938     clear_bit(0, &rc32434_wdt_device.inuse);
1939     return 0;
1940     }
1941     @@ -173,10 +162,10 @@ static ssize_t rc32434_wdt_write(struct file *file, const char *data,
1942     if (get_user(c, data + i))
1943     return -EFAULT;
1944     if (c == 'V')
1945     - expect_close = 1;
1946     + expect_close = 42;
1947     }
1948     }
1949     - rc32434_wdt_update(0);
1950     + rc32434_wdt_ping();
1951     return len;
1952     }
1953     return 0;
1954     @@ -196,11 +185,11 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
1955     };
1956     switch (cmd) {
1957     case WDIOC_KEEPALIVE:
1958     - rc32434_wdt_reset();
1959     + rc32434_wdt_ping();
1960     break;
1961     case WDIOC_GETSTATUS:
1962     case WDIOC_GETBOOTSTATUS:
1963     - value = readl(&wdt_reg->wtcount);
1964     + value = 0;
1965     if (copy_to_user(argp, &value, sizeof(int)))
1966     return -EFAULT;
1967     break;
1968     @@ -217,6 +206,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
1969     break;
1970     case WDIOS_DISABLECARD:
1971     rc32434_wdt_stop();
1972     + break;
1973     default:
1974     return -EINVAL;
1975     }
1976     @@ -224,11 +214,9 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
1977     case WDIOC_SETTIMEOUT:
1978     if (copy_from_user(&new_timeout, argp, sizeof(int)))
1979     return -EFAULT;
1980     - if (new_timeout < 1)
1981     + if (rc32434_wdt_set(new_timeout))
1982     return -EINVAL;
1983     - if (new_timeout > MAX_TIMEOUT)
1984     - return -EINVAL;
1985     - rc32434_wdt_set(new_timeout);
1986     + /* Fall through */
1987     case WDIOC_GETTIMEOUT:
1988     return copy_to_user(argp, &timeout, sizeof(int));
1989     default:
1990     @@ -253,15 +241,15 @@ static struct miscdevice rc32434_wdt_miscdev = {
1991     .fops = &rc32434_wdt_fops,
1992     };
1993    
1994     -static char banner[] = KERN_INFO KBUILD_MODNAME
1995     +static char banner[] __devinitdata = KERN_INFO KBUILD_MODNAME
1996     ": Watchdog Timer version " VERSION ", timer margin: %d sec\n";
1997    
1998     -static int rc32434_wdt_probe(struct platform_device *pdev)
1999     +static int __devinit rc32434_wdt_probe(struct platform_device *pdev)
2000     {
2001     int ret;
2002     struct resource *r;
2003    
2004     - r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb500_wdt_res");
2005     + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb532_wdt_res");
2006     if (!r) {
2007     printk(KERN_ERR KBUILD_MODNAME
2008     "failed to retrieve resources\n");
2009     @@ -276,24 +264,12 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
2010     }
2011    
2012     ret = misc_register(&rc32434_wdt_miscdev);
2013     -
2014     if (ret < 0) {
2015     printk(KERN_ERR KBUILD_MODNAME
2016     "failed to register watchdog device\n");
2017     goto unmap;
2018     }
2019    
2020     - init_completion(&rc32434_wdt_device.stop);
2021     - rc32434_wdt_device.queue = 0;
2022     -
2023     - clear_bit(0, &rc32434_wdt_device.inuse);
2024     -
2025     - setup_timer(&rc32434_wdt_device.timer, rc32434_wdt_update, 0L);
2026     -
2027     - rc32434_wdt_device.default_ticks = ticks;
2028     -
2029     - rc32434_wdt_start();
2030     -
2031     printk(banner, timeout);
2032    
2033     return 0;
2034     @@ -303,23 +279,17 @@ unmap:
2035     return ret;
2036     }
2037    
2038     -static int rc32434_wdt_remove(struct platform_device *pdev)
2039     +static int __devexit rc32434_wdt_remove(struct platform_device *pdev)
2040     {
2041     - if (rc32434_wdt_device.queue) {
2042     - rc32434_wdt_device.queue = 0;
2043     - wait_for_completion(&rc32434_wdt_device.stop);
2044     - }
2045     misc_deregister(&rc32434_wdt_miscdev);
2046     -
2047     iounmap(wdt_reg);
2048     -
2049     return 0;
2050     }
2051    
2052     static struct platform_driver rc32434_wdt = {
2053     .probe = rc32434_wdt_probe,
2054     - .remove = rc32434_wdt_remove,
2055     - .driver = {
2056     + .remove = __devexit_p(rc32434_wdt_remove),
2057     + .driver = {
2058     .name = "rc32434_wdt",
2059     }
2060     };
2061     diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
2062     index 06e521a..088e9ae 100644
2063     --- a/fs/cifs/CHANGES
2064     +++ b/fs/cifs/CHANGES
2065     @@ -1,3 +1,5 @@
2066     +Fix oops in cifs_dfs_ref.c when prefixpath is not reachable when using DFS.
2067     +
2068     Version 1.54
2069     ------------
2070     Fix premature write failure on congested networks (we would give up
2071     diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
2072     index 252fdc0..89fac77 100644
2073     --- a/fs/cifs/sess.c
2074     +++ b/fs/cifs/sess.c
2075     @@ -228,7 +228,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
2076    
2077     kfree(ses->serverOS);
2078     /* UTF-8 string will not grow more than four times as big as UCS-16 */
2079     - ses->serverOS = kzalloc(4 * len, GFP_KERNEL);
2080     + ses->serverOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
2081     if (ses->serverOS != NULL)
2082     cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp);
2083     data += 2 * (len + 1);
2084     @@ -241,7 +241,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
2085     return rc;
2086    
2087     kfree(ses->serverNOS);
2088     - ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */
2089     + ses->serverNOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
2090     if (ses->serverNOS != NULL) {
2091     cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len,
2092     nls_cp);
2093     diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
2094     index c8f8d59..61cb48f 100644
2095     --- a/fs/compat_ioctl.c
2096     +++ b/fs/compat_ioctl.c
2097     @@ -1938,6 +1938,8 @@ ULONG_IOCTL(SET_BITMAP_FILE)
2098     /* Big K */
2099     COMPATIBLE_IOCTL(PIO_FONT)
2100     COMPATIBLE_IOCTL(GIO_FONT)
2101     +COMPATIBLE_IOCTL(PIO_CMAP)
2102     +COMPATIBLE_IOCTL(GIO_CMAP)
2103     ULONG_IOCTL(KDSIGACCEPT)
2104     COMPATIBLE_IOCTL(KDGETKEYCODE)
2105     COMPATIBLE_IOCTL(KDSETKEYCODE)
2106     diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2107     index 85f58af..f613d57 100644
2108     --- a/fs/ext4/ext4.h
2109     +++ b/fs/ext4/ext4.h
2110     @@ -860,7 +860,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
2111     {
2112     unsigned len = le16_to_cpu(dlen);
2113    
2114     - if (len == EXT4_MAX_REC_LEN)
2115     + if (len == EXT4_MAX_REC_LEN || len == 0)
2116     return 1 << 16;
2117     return len;
2118     }
2119     diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
2120     index b994854..cce841f 100644
2121     --- a/fs/ext4/ialloc.c
2122     +++ b/fs/ext4/ialloc.c
2123     @@ -702,6 +702,13 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
2124    
2125     if (sbi->s_log_groups_per_flex) {
2126     ret2 = find_group_flex(sb, dir, &group);
2127     + if (ret2 == -1) {
2128     + ret2 = find_group_other(sb, dir, &group);
2129     + if (ret2 == 0 && printk_ratelimit())
2130     + printk(KERN_NOTICE "ext4: find_group_flex "
2131     + "failed, fallback succeeded dir %lu\n",
2132     + dir->i_ino);
2133     + }
2134     goto got_group;
2135     }
2136    
2137     diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2138     index 6e7f085..b233ade 100644
2139     --- a/fs/ext4/inode.c
2140     +++ b/fs/ext4/inode.c
2141     @@ -46,8 +46,10 @@
2142     static inline int ext4_begin_ordered_truncate(struct inode *inode,
2143     loff_t new_size)
2144     {
2145     - return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode,
2146     - new_size);
2147     + return jbd2_journal_begin_ordered_truncate(
2148     + EXT4_SB(inode->i_sb)->s_journal,
2149     + &EXT4_I(inode)->jinode,
2150     + new_size);
2151     }
2152    
2153     static void ext4_invalidatepage(struct page *page, unsigned long offset);
2154     @@ -1370,6 +1372,10 @@ retry:
2155     goto out;
2156     }
2157    
2158     + /* We cannot recurse into the filesystem as the transaction is already
2159     + * started */
2160     + flags |= AOP_FLAG_NOFS;
2161     +
2162     page = grab_cache_page_write_begin(mapping, index, flags);
2163     if (!page) {
2164     ext4_journal_stop(handle);
2165     @@ -1379,7 +1385,7 @@ retry:
2166     *pagep = page;
2167    
2168     ret = block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
2169     - ext4_get_block);
2170     + ext4_get_block);
2171    
2172     if (!ret && ext4_should_journal_data(inode)) {
2173     ret = walk_page_buffers(handle, page_buffers(page),
2174     @@ -2463,6 +2469,9 @@ retry:
2175     ret = PTR_ERR(handle);
2176     goto out;
2177     }
2178     + /* We cannot recurse into the filesystem as the transaction is already
2179     + * started */
2180     + flags |= AOP_FLAG_NOFS;
2181    
2182     page = grab_cache_page_write_begin(mapping, index, flags);
2183     if (!page) {
2184     diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
2185     index dbf6c0e..39d7cc1 100644
2186     --- a/fs/ext4/mballoc.c
2187     +++ b/fs/ext4/mballoc.c
2188     @@ -3802,6 +3802,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
2189     pa->pa_free = pa->pa_len;
2190     atomic_set(&pa->pa_count, 1);
2191     spin_lock_init(&pa->pa_lock);
2192     + INIT_LIST_HEAD(&pa->pa_inode_list);
2193     + INIT_LIST_HEAD(&pa->pa_group_list);
2194     pa->pa_deleted = 0;
2195     pa->pa_linear = 0;
2196    
2197     @@ -3860,6 +3862,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
2198     atomic_set(&pa->pa_count, 1);
2199     spin_lock_init(&pa->pa_lock);
2200     INIT_LIST_HEAD(&pa->pa_inode_list);
2201     + INIT_LIST_HEAD(&pa->pa_group_list);
2202     pa->pa_deleted = 0;
2203     pa->pa_linear = 1;
2204    
2205     @@ -4569,23 +4572,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
2206     pa->pa_free -= ac->ac_b_ex.fe_len;
2207     pa->pa_len -= ac->ac_b_ex.fe_len;
2208     spin_unlock(&pa->pa_lock);
2209     - /*
2210     - * We want to add the pa to the right bucket.
2211     - * Remove it from the list and while adding
2212     - * make sure the list to which we are adding
2213     - * doesn't grow big.
2214     - */
2215     - if (likely(pa->pa_free)) {
2216     - spin_lock(pa->pa_obj_lock);
2217     - list_del_rcu(&pa->pa_inode_list);
2218     - spin_unlock(pa->pa_obj_lock);
2219     - ext4_mb_add_n_trim(ac);
2220     - }
2221     }
2222     - ext4_mb_put_pa(ac, ac->ac_sb, pa);
2223     }
2224     if (ac->alloc_semp)
2225     up_read(ac->alloc_semp);
2226     + if (pa) {
2227     + /*
2228     + * We want to add the pa to the right bucket.
2229     + * Remove it from the list and while adding
2230     + * make sure the list to which we are adding
2231     + * doesn't grow big. We need to release
2232     + * alloc_semp before calling ext4_mb_add_n_trim()
2233     + */
2234     + if (pa->pa_linear && likely(pa->pa_free)) {
2235     + spin_lock(pa->pa_obj_lock);
2236     + list_del_rcu(&pa->pa_inode_list);
2237     + spin_unlock(pa->pa_obj_lock);
2238     + ext4_mb_add_n_trim(ac);
2239     + }
2240     + ext4_mb_put_pa(ac, ac->ac_sb, pa);
2241     + }
2242     if (ac->ac_bitmap_page)
2243     page_cache_release(ac->ac_bitmap_page);
2244     if (ac->ac_buddy_page)
2245     diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
2246     index f2a9cf4..9aa0fbe 100644
2247     --- a/fs/ext4/migrate.c
2248     +++ b/fs/ext4/migrate.c
2249     @@ -480,7 +480,7 @@ int ext4_ext_migrate(struct inode *inode)
2250     + 1);
2251     if (IS_ERR(handle)) {
2252     retval = PTR_ERR(handle);
2253     - goto err_out;
2254     + return retval;
2255     }
2256     tmp_inode = ext4_new_inode(handle,
2257     inode->i_sb->s_root->d_inode,
2258     @@ -488,8 +488,7 @@ int ext4_ext_migrate(struct inode *inode)
2259     if (IS_ERR(tmp_inode)) {
2260     retval = -ENOMEM;
2261     ext4_journal_stop(handle);
2262     - tmp_inode = NULL;
2263     - goto err_out;
2264     + return retval;
2265     }
2266     i_size_write(tmp_inode, i_size_read(inode));
2267     /*
2268     @@ -617,8 +616,7 @@ err_out:
2269    
2270     ext4_journal_stop(handle);
2271    
2272     - if (tmp_inode)
2273     - iput(tmp_inode);
2274     + iput(tmp_inode);
2275    
2276     return retval;
2277     }
2278     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
2279     index 5e4491d..db2642a 100644
2280     --- a/fs/ext4/super.c
2281     +++ b/fs/ext4/super.c
2282     @@ -2950,14 +2950,14 @@ static void ext4_write_super(struct super_block *sb)
2283    
2284     static int ext4_sync_fs(struct super_block *sb, int wait)
2285     {
2286     - int ret = 0;
2287     + tid_t target;
2288    
2289     sb->s_dirt = 0;
2290     - if (wait)
2291     - ret = ext4_force_commit(sb);
2292     - else
2293     - jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL);
2294     - return ret;
2295     + if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target)) {
2296     + if (wait)
2297     + jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target);
2298     + }
2299     + return 0;
2300     }
2301    
2302     /*
2303     diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
2304     index c8616a0..6caa023 100644
2305     --- a/fs/fs-writeback.c
2306     +++ b/fs/fs-writeback.c
2307     @@ -274,6 +274,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
2308     int ret;
2309    
2310     BUG_ON(inode->i_state & I_SYNC);
2311     + WARN_ON(inode->i_state & I_NEW);
2312    
2313     /* Set I_SYNC, reset I_DIRTY */
2314     dirty = inode->i_state & I_DIRTY;
2315     @@ -298,6 +299,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
2316     }
2317    
2318     spin_lock(&inode_lock);
2319     + WARN_ON(inode->i_state & I_NEW);
2320     inode->i_state &= ~I_SYNC;
2321     if (!(inode->i_state & I_FREEING)) {
2322     if (!(inode->i_state & I_DIRTY) &&
2323     @@ -470,6 +472,11 @@ void generic_sync_sb_inodes(struct super_block *sb,
2324     break;
2325     }
2326    
2327     + if (inode->i_state & I_NEW) {
2328     + requeue_io(inode);
2329     + continue;
2330     + }
2331     +
2332     if (wbc->nonblocking && bdi_write_congested(bdi)) {
2333     wbc->encountered_congestion = 1;
2334     if (!sb_is_blkdev_sb(sb))
2335     @@ -531,7 +538,7 @@ void generic_sync_sb_inodes(struct super_block *sb,
2336     list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
2337     struct address_space *mapping;
2338    
2339     - if (inode->i_state & (I_FREEING|I_WILL_FREE))
2340     + if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW))
2341     continue;
2342     mapping = inode->i_mapping;
2343     if (mapping->nrpages == 0)
2344     diff --git a/fs/inode.c b/fs/inode.c
2345     index 0487ddb..7b2acc1 100644
2346     --- a/fs/inode.c
2347     +++ b/fs/inode.c
2348     @@ -339,6 +339,7 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose)
2349     invalidate_inode_buffers(inode);
2350     if (!atomic_read(&inode->i_count)) {
2351     list_move(&inode->i_list, dispose);
2352     + WARN_ON(inode->i_state & I_NEW);
2353     inode->i_state |= I_FREEING;
2354     count++;
2355     continue;
2356     @@ -440,6 +441,7 @@ static void prune_icache(int nr_to_scan)
2357     continue;
2358     }
2359     list_move(&inode->i_list, &freeable);
2360     + WARN_ON(inode->i_state & I_NEW);
2361     inode->i_state |= I_FREEING;
2362     nr_pruned++;
2363     }
2364     @@ -595,6 +597,7 @@ void unlock_new_inode(struct inode *inode)
2365     * just created it (so there can be no old holders
2366     * that haven't tested I_LOCK).
2367     */
2368     + WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW));
2369     inode->i_state &= ~(I_LOCK|I_NEW);
2370     wake_up_inode(inode);
2371     }
2372     @@ -1041,6 +1044,7 @@ void generic_delete_inode(struct inode *inode)
2373    
2374     list_del_init(&inode->i_list);
2375     list_del_init(&inode->i_sb_list);
2376     + WARN_ON(inode->i_state & I_NEW);
2377     inode->i_state |= I_FREEING;
2378     inodes_stat.nr_inodes--;
2379     spin_unlock(&inode_lock);
2380     @@ -1082,16 +1086,19 @@ static void generic_forget_inode(struct inode *inode)
2381     spin_unlock(&inode_lock);
2382     return;
2383     }
2384     + WARN_ON(inode->i_state & I_NEW);
2385     inode->i_state |= I_WILL_FREE;
2386     spin_unlock(&inode_lock);
2387     write_inode_now(inode, 1);
2388     spin_lock(&inode_lock);
2389     + WARN_ON(inode->i_state & I_NEW);
2390     inode->i_state &= ~I_WILL_FREE;
2391     inodes_stat.nr_unused--;
2392     hlist_del_init(&inode->i_hash);
2393     }
2394     list_del_init(&inode->i_list);
2395     list_del_init(&inode->i_sb_list);
2396     + WARN_ON(inode->i_state & I_NEW);
2397     inode->i_state |= I_FREEING;
2398     inodes_stat.nr_inodes--;
2399     spin_unlock(&inode_lock);
2400     diff --git a/fs/inotify.c b/fs/inotify.c
2401     index 7bbed1b..213546b 100644
2402     --- a/fs/inotify.c
2403     +++ b/fs/inotify.c
2404     @@ -156,7 +156,7 @@ static int inotify_handle_get_wd(struct inotify_handle *ih,
2405     int ret;
2406    
2407     do {
2408     - if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL)))
2409     + if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS)))
2410     return -ENOSPC;
2411     ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd);
2412     } while (ret == -EAGAIN);
2413     diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
2414     index 52d2bee..ecb2603 100644
2415     --- a/fs/jbd2/journal.c
2416     +++ b/fs/jbd2/journal.c
2417     @@ -430,7 +430,7 @@ int __jbd2_log_space_left(journal_t *journal)
2418     }
2419    
2420     /*
2421     - * Called under j_state_lock. Returns true if a transaction was started.
2422     + * Called under j_state_lock. Returns true if a transaction commit was started.
2423     */
2424     int __jbd2_log_start_commit(journal_t *journal, tid_t target)
2425     {
2426     @@ -498,7 +498,8 @@ int jbd2_journal_force_commit_nested(journal_t *journal)
2427    
2428     /*
2429     * Start a commit of the current running transaction (if any). Returns true
2430     - * if a transaction was started, and fills its tid in at *ptid
2431     + * if a transaction is going to be committed (or is currently already
2432     + * committing), and fills its tid in at *ptid
2433     */
2434     int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
2435     {
2436     @@ -508,15 +509,19 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
2437     if (journal->j_running_transaction) {
2438     tid_t tid = journal->j_running_transaction->t_tid;
2439    
2440     - ret = __jbd2_log_start_commit(journal, tid);
2441     - if (ret && ptid)
2442     + __jbd2_log_start_commit(journal, tid);
2443     + /* There's a running transaction and we've just made sure
2444     + * it's commit has been scheduled. */
2445     + if (ptid)
2446     *ptid = tid;
2447     - } else if (journal->j_committing_transaction && ptid) {
2448     + ret = 1;
2449     + } else if (journal->j_committing_transaction) {
2450     /*
2451     * If ext3_write_super() recently started a commit, then we
2452     * have to wait for completion of that transaction
2453     */
2454     - *ptid = journal->j_committing_transaction->t_tid;
2455     + if (ptid)
2456     + *ptid = journal->j_committing_transaction->t_tid;
2457     ret = 1;
2458     }
2459     spin_unlock(&journal->j_state_lock);
2460     diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
2461     index e5d5405..92d77c9 100644
2462     --- a/fs/jbd2/transaction.c
2463     +++ b/fs/jbd2/transaction.c
2464     @@ -2049,26 +2049,46 @@ done:
2465     }
2466    
2467     /*
2468     - * This function must be called when inode is journaled in ordered mode
2469     - * before truncation happens. It starts writeout of truncated part in
2470     - * case it is in the committing transaction so that we stand to ordered
2471     - * mode consistency guarantees.
2472     + * File truncate and transaction commit interact with each other in a
2473     + * non-trivial way. If a transaction writing data block A is
2474     + * committing, we cannot discard the data by truncate until we have
2475     + * written them. Otherwise if we crashed after the transaction with
2476     + * write has committed but before the transaction with truncate has
2477     + * committed, we could see stale data in block A. This function is a
2478     + * helper to solve this problem. It starts writeout of the truncated
2479     + * part in case it is in the committing transaction.
2480     + *
2481     + * Filesystem code must call this function when inode is journaled in
2482     + * ordered mode before truncation happens and after the inode has been
2483     + * placed on orphan list with the new inode size. The second condition
2484     + * avoids the race that someone writes new data and we start
2485     + * committing the transaction after this function has been called but
2486     + * before a transaction for truncate is started (and furthermore it
2487     + * allows us to optimize the case where the addition to orphan list
2488     + * happens in the same transaction as write --- we don't have to write
2489     + * any data in such case).
2490     */
2491     -int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,
2492     +int jbd2_journal_begin_ordered_truncate(journal_t *journal,
2493     + struct jbd2_inode *jinode,
2494     loff_t new_size)
2495     {
2496     - journal_t *journal;
2497     - transaction_t *commit_trans;
2498     + transaction_t *inode_trans, *commit_trans;
2499     int ret = 0;
2500    
2501     - if (!inode->i_transaction && !inode->i_next_transaction)
2502     + /* This is a quick check to avoid locking if not necessary */
2503     + if (!jinode->i_transaction)
2504     goto out;
2505     - journal = inode->i_transaction->t_journal;
2506     + /* Locks are here just to force reading of recent values, it is
2507     + * enough that the transaction was not committing before we started
2508     + * a transaction adding the inode to orphan list */
2509     spin_lock(&journal->j_state_lock);
2510     commit_trans = journal->j_committing_transaction;
2511     spin_unlock(&journal->j_state_lock);
2512     - if (inode->i_transaction == commit_trans) {
2513     - ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping,
2514     + spin_lock(&journal->j_list_lock);
2515     + inode_trans = jinode->i_transaction;
2516     + spin_unlock(&journal->j_list_lock);
2517     + if (inode_trans == commit_trans) {
2518     + ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,
2519     new_size, LLONG_MAX);
2520     if (ret)
2521     jbd2_journal_abort(journal, ret);
2522     diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
2523     index 6ca08ad..1fc1e92 100644
2524     --- a/fs/jffs2/readinode.c
2525     +++ b/fs/jffs2/readinode.c
2526     @@ -220,7 +220,7 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
2527     struct jffs2_tmp_dnode_info *tn)
2528     {
2529     uint32_t fn_end = tn->fn->ofs + tn->fn->size;
2530     - struct jffs2_tmp_dnode_info *this;
2531     + struct jffs2_tmp_dnode_info *this, *ptn;
2532    
2533     dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw));
2534    
2535     @@ -251,11 +251,18 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
2536     if (this) {
2537     /* If the node is coincident with another at a lower address,
2538     back up until the other node is found. It may be relevant */
2539     - while (this->overlapped)
2540     - this = tn_prev(this);
2541     -
2542     - /* First node should never be marked overlapped */
2543     - BUG_ON(!this);
2544     + while (this->overlapped) {
2545     + ptn = tn_prev(this);
2546     + if (!ptn) {
2547     + /*
2548     + * We killed a node which set the overlapped
2549     + * flags during the scan. Fix it up.
2550     + */
2551     + this->overlapped = 0;
2552     + break;
2553     + }
2554     + this = ptn;
2555     + }
2556     dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole");
2557     }
2558    
2559     @@ -360,7 +367,17 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
2560     }
2561     if (!this->overlapped)
2562     break;
2563     - this = tn_prev(this);
2564     +
2565     + ptn = tn_prev(this);
2566     + if (!ptn) {
2567     + /*
2568     + * We killed a node which set the overlapped
2569     + * flags during the scan. Fix it up.
2570     + */
2571     + this->overlapped = 0;
2572     + break;
2573     + }
2574     + this = ptn;
2575     }
2576     }
2577    
2578     @@ -456,8 +473,15 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c,
2579     eat_last(&rii->tn_root, &last->rb);
2580     ver_insert(&ver_root, last);
2581    
2582     - if (unlikely(last->overlapped))
2583     - continue;
2584     + if (unlikely(last->overlapped)) {
2585     + if (pen)
2586     + continue;
2587     + /*
2588     + * We killed a node which set the overlapped
2589     + * flags during the scan. Fix it up.
2590     + */
2591     + last->overlapped = 0;
2592     + }
2593    
2594     /* Now we have a bunch of nodes in reverse version
2595     order, in the tree at ver_root. Most of the time,
2596     diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
2597     index 29e20c6..8463dd3 100644
2598     --- a/fs/proc/proc_misc.c
2599     +++ b/fs/proc/proc_misc.c
2600     @@ -797,7 +797,7 @@ static struct file_operations proc_kpagecount_operations = {
2601     #define KPF_RECLAIM 9
2602     #define KPF_BUDDY 10
2603    
2604     -#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
2605     +#define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)
2606    
2607     static ssize_t kpageflags_read(struct file *file, char __user *buf,
2608     size_t count, loff_t *ppos)
2609     @@ -824,7 +824,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
2610     else
2611     kflags = ppage->flags;
2612    
2613     - uflags = kpf_copy_bit(KPF_LOCKED, PG_locked, kflags) |
2614     + uflags = kpf_copy_bit(kflags, KPF_LOCKED, PG_locked) |
2615     kpf_copy_bit(kflags, KPF_ERROR, PG_error) |
2616     kpf_copy_bit(kflags, KPF_REFERENCED, PG_referenced) |
2617     kpf_copy_bit(kflags, KPF_UPTODATE, PG_uptodate) |
2618     diff --git a/fs/seq_file.c b/fs/seq_file.c
2619     index ef4d497..0712add 100644
2620     --- a/fs/seq_file.c
2621     +++ b/fs/seq_file.c
2622     @@ -48,8 +48,16 @@ int seq_open(struct file *file, const struct seq_operations *op)
2623     */
2624     file->f_version = 0;
2625    
2626     - /* SEQ files support lseek, but not pread/pwrite */
2627     - file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
2628     + /*
2629     + * seq_files support lseek() and pread(). They do not implement
2630     + * write() at all, but we clear FMODE_PWRITE here for historical
2631     + * reasons.
2632     + *
2633     + * If a client of seq_files a) implements file.write() and b) wishes to
2634     + * support pwrite() then that client will need to implement its own
2635     + * file.open() which calls seq_open() and then sets FMODE_PWRITE.
2636     + */
2637     + file->f_mode &= ~FMODE_PWRITE;
2638     return 0;
2639     }
2640     EXPORT_SYMBOL(seq_open);
2641     @@ -131,6 +139,22 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
2642     int err = 0;
2643    
2644     mutex_lock(&m->lock);
2645     +
2646     + /* Don't assume *ppos is where we left it */
2647     + if (unlikely(*ppos != m->read_pos)) {
2648     + m->read_pos = *ppos;
2649     + while ((err = traverse(m, *ppos)) == -EAGAIN)
2650     + ;
2651     + if (err) {
2652     + /* With prejudice... */
2653     + m->read_pos = 0;
2654     + m->version = 0;
2655     + m->index = 0;
2656     + m->count = 0;
2657     + goto Done;
2658     + }
2659     + }
2660     +
2661     /*
2662     * seq_file->op->..m_start/m_stop/m_next may do special actions
2663     * or optimisations based on the file->f_version, so we want to
2664     @@ -230,8 +254,10 @@ Fill:
2665     Done:
2666     if (!copied)
2667     copied = err;
2668     - else
2669     + else {
2670     *ppos += copied;
2671     + m->read_pos += copied;
2672     + }
2673     file->f_version = m->version;
2674     mutex_unlock(&m->lock);
2675     return copied;
2676     @@ -266,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
2677     if (offset < 0)
2678     break;
2679     retval = offset;
2680     - if (offset != file->f_pos) {
2681     + if (offset != m->read_pos) {
2682     while ((retval=traverse(m, offset)) == -EAGAIN)
2683     ;
2684     if (retval) {
2685     /* with extreme prejudice... */
2686     file->f_pos = 0;
2687     + m->read_pos = 0;
2688     m->version = 0;
2689     m->index = 0;
2690     m->count = 0;
2691     } else {
2692     + m->read_pos = offset;
2693     retval = file->f_pos = offset;
2694     }
2695     }
2696     diff --git a/fs/timerfd.c b/fs/timerfd.c
2697     index ee211df..43feb6d 100644
2698     --- a/fs/timerfd.c
2699     +++ b/fs/timerfd.c
2700     @@ -188,10 +188,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
2701     BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
2702     BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
2703    
2704     - if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
2705     - return -EINVAL;
2706     - if (clockid != CLOCK_MONOTONIC &&
2707     - clockid != CLOCK_REALTIME)
2708     + if ((flags & ~TFD_CREATE_FLAGS) ||
2709     + (clockid != CLOCK_MONOTONIC &&
2710     + clockid != CLOCK_REALTIME))
2711     return -EINVAL;
2712    
2713     ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
2714     @@ -203,7 +202,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
2715     hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS);
2716    
2717     ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
2718     - flags & (O_CLOEXEC | O_NONBLOCK));
2719     + flags & TFD_SHARED_FCNTL_FLAGS);
2720     if (ufd < 0)
2721     kfree(ctx);
2722    
2723     @@ -221,7 +220,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
2724     if (copy_from_user(&ktmr, utmr, sizeof(ktmr)))
2725     return -EFAULT;
2726    
2727     - if (!timespec_valid(&ktmr.it_value) ||
2728     + if ((flags & ~TFD_SETTIME_FLAGS) ||
2729     + !timespec_valid(&ktmr.it_value) ||
2730     !timespec_valid(&ktmr.it_interval))
2731     return -EINVAL;
2732    
2733     diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
2734     index ac5d541..6c5b409 100644
2735     --- a/include/asm-mips/compat.h
2736     +++ b/include/asm-mips/compat.h
2737     @@ -3,6 +3,8 @@
2738     /*
2739     * Architecture specific compatibility types
2740     */
2741     +#include <linux/seccomp.h>
2742     +#include <linux/thread_info.h>
2743     #include <linux/types.h>
2744     #include <asm/page.h>
2745     #include <asm/ptrace.h>
2746     @@ -218,4 +220,9 @@ struct compat_shmid64_ds {
2747     compat_ulong_t __unused2;
2748     };
2749    
2750     +static inline int is_compat_task(void)
2751     +{
2752     + return test_thread_flag(TIF_32BIT);
2753     +}
2754     +
2755     #endif /* _ASM_COMPAT_H */
2756     diff --git a/include/asm-mips/seccomp.h b/include/asm-mips/seccomp.h
2757     index 36ed440..a6772e9 100644
2758     --- a/include/asm-mips/seccomp.h
2759     +++ b/include/asm-mips/seccomp.h
2760     @@ -1,6 +1,5 @@
2761     #ifndef __ASM_SECCOMP_H
2762    
2763     -#include <linux/thread_info.h>
2764     #include <linux/unistd.h>
2765    
2766     #define __NR_seccomp_read __NR_read
2767     diff --git a/include/asm-x86/mmzone_32.h b/include/asm-x86/mmzone_32.h
2768     index eb77583..8132319 100644
2769     --- a/include/asm-x86/mmzone_32.h
2770     +++ b/include/asm-x86/mmzone_32.h
2771     @@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void)
2772     get_memcfg_numa_flat();
2773     }
2774    
2775     -extern int early_pfn_to_nid(unsigned long pfn);
2776     -
2777     extern void resume_map_numa_kva(pgd_t *pgd);
2778    
2779     #else /* !CONFIG_NUMA */
2780     diff --git a/include/asm-x86/mmzone_64.h b/include/asm-x86/mmzone_64.h
2781     index 594bd0d..ca3f5b1 100644
2782     --- a/include/asm-x86/mmzone_64.h
2783     +++ b/include/asm-x86/mmzone_64.h
2784     @@ -41,8 +41,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
2785     #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
2786     NODE_DATA(nid)->node_spanned_pages)
2787    
2788     -extern int early_pfn_to_nid(unsigned long pfn);
2789     -
2790     #ifdef CONFIG_NUMA_EMU
2791     #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024)
2792     #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
2793     diff --git a/include/asm-x86/seccomp_32.h b/include/asm-x86/seccomp_32.h
2794     index 36e71c5..5846ab6 100644
2795     --- a/include/asm-x86/seccomp_32.h
2796     +++ b/include/asm-x86/seccomp_32.h
2797     @@ -1,12 +1,6 @@
2798     #ifndef _ASM_SECCOMP_H
2799     #define _ASM_SECCOMP_H
2800    
2801     -#include <linux/thread_info.h>
2802     -
2803     -#ifdef TIF_32BIT
2804     -#error "unexpected TIF_32BIT on i386"
2805     -#endif
2806     -
2807     #include <linux/unistd.h>
2808    
2809     #define __NR_seccomp_read __NR_read
2810     diff --git a/include/asm-x86/seccomp_64.h b/include/asm-x86/seccomp_64.h
2811     index 76cfe69..2199b54 100644
2812     --- a/include/asm-x86/seccomp_64.h
2813     +++ b/include/asm-x86/seccomp_64.h
2814     @@ -1,14 +1,6 @@
2815     #ifndef _ASM_SECCOMP_H
2816     #define _ASM_SECCOMP_H
2817    
2818     -#include <linux/thread_info.h>
2819     -
2820     -#ifdef TIF_32BIT
2821     -#error "unexpected TIF_32BIT on x86_64"
2822     -#else
2823     -#define TIF_32BIT TIF_IA32
2824     -#endif
2825     -
2826     #include <linux/unistd.h>
2827     #include <asm/ia32_unistd.h>
2828    
2829     diff --git a/include/linux/fs.h b/include/linux/fs.h
2830     index d1b3e22..909e13e 100644
2831     --- a/include/linux/fs.h
2832     +++ b/include/linux/fs.h
2833     @@ -63,18 +63,23 @@ extern int dir_notify_enable;
2834     #define MAY_ACCESS 16
2835     #define MAY_OPEN 32
2836    
2837     -#define FMODE_READ 1
2838     -#define FMODE_WRITE 2
2839     -
2840     -/* Internal kernel extensions */
2841     -#define FMODE_LSEEK 4
2842     -#define FMODE_PREAD 8
2843     -#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
2844     -
2845     -/* File is being opened for execution. Primary users of this flag are
2846     - distributed filesystems that can use it to achieve correct ETXTBUSY
2847     - behavior for cross-node execution/opening_for_writing of files */
2848     -#define FMODE_EXEC 16
2849     +/*
2850     + * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
2851     + * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
2852     + */
2853     +
2854     +/* file is open for reading */
2855     +#define FMODE_READ (1)
2856     +/* file is open for writing */
2857     +#define FMODE_WRITE (2)
2858     +/* file is seekable */
2859     +#define FMODE_LSEEK (4)
2860     +/* file can be accessed using pread */
2861     +#define FMODE_PREAD (8)
2862     +/* file can be accessed using pwrite */
2863     +#define FMODE_PWRITE (16)
2864     +/* File is opened for execution with sys_execve / sys_uselib */
2865     +#define FMODE_EXEC (32)
2866    
2867     #define RW_MASK 1
2868     #define RWA_MASK 2
2869     diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
2870     index 0e1bd70..df4137e 100644
2871     --- a/include/linux/jbd2.h
2872     +++ b/include/linux/jbd2.h
2873     @@ -1075,7 +1075,8 @@ extern int jbd2_journal_clear_err (journal_t *);
2874     extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
2875     extern int jbd2_journal_force_commit(journal_t *);
2876     extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
2877     -extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
2878     +extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
2879     + struct jbd2_inode *inode, loff_t new_size);
2880     extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
2881     extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
2882    
2883     diff --git a/include/linux/mm.h b/include/linux/mm.h
2884     index 856d52a..2a75579 100644
2885     --- a/include/linux/mm.h
2886     +++ b/include/linux/mm.h
2887     @@ -1027,10 +1027,23 @@ extern void free_bootmem_with_active_regions(int nid,
2888     typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
2889     extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
2890     extern void sparse_memory_present_with_active_regions(int nid);
2891     -#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
2892     -extern int early_pfn_to_nid(unsigned long pfn);
2893     -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
2894     #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
2895     +
2896     +#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
2897     + !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
2898     +static inline int __early_pfn_to_nid(unsigned long pfn)
2899     +{
2900     + return 0;
2901     +}
2902     +#else
2903     +/* please see mm/page_alloc.c */
2904     +extern int __meminit early_pfn_to_nid(unsigned long pfn);
2905     +#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
2906     +/* there is a per-arch backend function. */
2907     +extern int __meminit __early_pfn_to_nid(unsigned long pfn);
2908     +#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
2909     +#endif
2910     +
2911     extern void set_dma_reserve(unsigned long new_dma_reserve);
2912     extern void memmap_init_zone(unsigned long, int, unsigned long,
2913     unsigned long, enum memmap_context);
2914     diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
2915     index 428328a..803fc9d 100644
2916     --- a/include/linux/mmzone.h
2917     +++ b/include/linux/mmzone.h
2918     @@ -978,7 +978,7 @@ void sparse_init(void);
2919     #endif /* CONFIG_SPARSEMEM */
2920    
2921     #ifdef CONFIG_NODES_SPAN_OTHER_NODES
2922     -#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
2923     +bool early_pfn_in_nid(unsigned long pfn, int nid);
2924     #else
2925     #define early_pfn_in_nid(pfn, nid) (1)
2926     #endif
2927     diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
2928     index e7e7c7d..ba91fe1 100644
2929     --- a/include/linux/pci_ids.h
2930     +++ b/include/linux/pci_ids.h
2931     @@ -1432,6 +1432,7 @@
2932     #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
2933     #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
2934     #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
2935     +#define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1
2936     #define PCI_DEVICE_ID_NEO_2DB9 0x00C8
2937     #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9
2938     #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
2939     @@ -2283,6 +2284,9 @@
2940     #define PCI_DEVICE_ID_INTEL_82378 0x0484
2941     #define PCI_DEVICE_ID_INTEL_I960 0x0960
2942     #define PCI_DEVICE_ID_INTEL_I960RM 0x0962
2943     +#define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062
2944     +#define PCI_DEVICE_ID_INTEL_82573E_SOL 0x1085
2945     +#define PCI_DEVICE_ID_INTEL_82573L_SOL 0x108F
2946     #define PCI_DEVICE_ID_INTEL_82815_MC 0x1130
2947     #define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132
2948     #define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
2949     diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
2950     index a1783b2..19d6ca9 100644
2951     --- a/include/linux/seq_file.h
2952     +++ b/include/linux/seq_file.h
2953     @@ -19,6 +19,7 @@ struct seq_file {
2954     size_t from;
2955     size_t count;
2956     loff_t index;
2957     + loff_t read_pos;
2958     u64 version;
2959     struct mutex lock;
2960     const struct seq_operations *op;
2961     diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
2962     index 3b2f6c0..d05ad88 100644
2963     --- a/include/linux/serial_core.h
2964     +++ b/include/linux/serial_core.h
2965     @@ -285,6 +285,7 @@ struct uart_port {
2966     #define UPF_HARDPPS_CD ((__force upf_t) (1 << 11))
2967     #define UPF_LOW_LATENCY ((__force upf_t) (1 << 13))
2968     #define UPF_BUGGY_UART ((__force upf_t) (1 << 14))
2969     +#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
2970     #define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16))
2971     #define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
2972     #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
2973     diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
2974     index 9099237..2dc6958 100644
2975     --- a/include/linux/skbuff.h
2976     +++ b/include/linux/skbuff.h
2977     @@ -395,15 +395,6 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
2978     void *here);
2979     extern void skb_under_panic(struct sk_buff *skb, int len,
2980     void *here);
2981     -extern void skb_truesize_bug(struct sk_buff *skb);
2982     -
2983     -static inline void skb_truesize_check(struct sk_buff *skb)
2984     -{
2985     - int len = sizeof(struct sk_buff) + skb->len;
2986     -
2987     - if (unlikely((int)skb->truesize < len))
2988     - skb_truesize_bug(skb);
2989     -}
2990    
2991     extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
2992     int getfrag(void *from, char *to, int offset,
2993     diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
2994     index 86cb050..2d07929 100644
2995     --- a/include/linux/timerfd.h
2996     +++ b/include/linux/timerfd.h
2997     @@ -11,13 +11,21 @@
2998     /* For O_CLOEXEC and O_NONBLOCK */
2999     #include <linux/fcntl.h>
3000    
3001     -/* Flags for timerfd_settime. */
3002     +/*
3003     + * CAREFUL: Check include/asm-generic/fcntl.h when defining
3004     + * new flags, since they might collide with O_* ones. We want
3005     + * to re-use O_* flags that couldn't possibly have a meaning
3006     + * from eventfd, in order to leave a free define-space for
3007     + * shared O_* flags.
3008     + */
3009     #define TFD_TIMER_ABSTIME (1 << 0)
3010     -
3011     -/* Flags for timerfd_create. */
3012     #define TFD_CLOEXEC O_CLOEXEC
3013     #define TFD_NONBLOCK O_NONBLOCK
3014    
3015     +#define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)
3016     +/* Flags for timerfd_create. */
3017     +#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS
3018     +/* Flags for timerfd_settime. */
3019     +#define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME
3020    
3021     #endif /* _LINUX_TIMERFD_H */
3022     -
3023     diff --git a/include/net/sock.h b/include/net/sock.h
3024     index 06c5259..df43f56 100644
3025     --- a/include/net/sock.h
3026     +++ b/include/net/sock.h
3027     @@ -777,7 +777,6 @@ static inline void sk_mem_uncharge(struct sock *sk, int size)
3028    
3029     static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
3030     {
3031     - skb_truesize_check(skb);
3032     sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
3033     sk->sk_wmem_queued -= skb->truesize;
3034     sk_mem_uncharge(sk, skb->truesize);
3035     diff --git a/kernel/fork.c b/kernel/fork.c
3036     index 42fb5b0..843ce75 100644
3037     --- a/kernel/fork.c
3038     +++ b/kernel/fork.c
3039     @@ -1137,10 +1137,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
3040     #endif
3041     clear_all_latency_tracing(p);
3042    
3043     - /* Our parent execution domain becomes current domain
3044     - These must match for thread signalling to apply */
3045     - p->parent_exec_id = p->self_exec_id;
3046     -
3047     /* ok, now we should be set up.. */
3048     p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL);
3049     p->pdeath_signal = 0;
3050     @@ -1178,10 +1174,13 @@ static struct task_struct *copy_process(unsigned long clone_flags,
3051     set_task_cpu(p, smp_processor_id());
3052    
3053     /* CLONE_PARENT re-uses the old parent */
3054     - if (clone_flags & (CLONE_PARENT|CLONE_THREAD))
3055     + if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
3056     p->real_parent = current->real_parent;
3057     - else
3058     + p->parent_exec_id = current->parent_exec_id;
3059     + } else {
3060     p->real_parent = current;
3061     + p->parent_exec_id = current->self_exec_id;
3062     + }
3063    
3064     spin_lock(&current->sighand->siglock);
3065    
3066     diff --git a/kernel/seccomp.c b/kernel/seccomp.c
3067     index ad64fcb..57d4b13 100644
3068     --- a/kernel/seccomp.c
3069     +++ b/kernel/seccomp.c
3070     @@ -8,6 +8,7 @@
3071    
3072     #include <linux/seccomp.h>
3073     #include <linux/sched.h>
3074     +#include <linux/compat.h>
3075    
3076     /* #define SECCOMP_DEBUG 1 */
3077     #define NR_SECCOMP_MODES 1
3078     @@ -22,7 +23,7 @@ static int mode1_syscalls[] = {
3079     0, /* null terminated */
3080     };
3081    
3082     -#ifdef TIF_32BIT
3083     +#ifdef CONFIG_COMPAT
3084     static int mode1_syscalls_32[] = {
3085     __NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32,
3086     0, /* null terminated */
3087     @@ -37,8 +38,8 @@ void __secure_computing(int this_syscall)
3088     switch (mode) {
3089     case 1:
3090     syscall = mode1_syscalls;
3091     -#ifdef TIF_32BIT
3092     - if (test_thread_flag(TIF_32BIT))
3093     +#ifdef CONFIG_COMPAT
3094     + if (is_compat_task())
3095     syscall = mode1_syscalls_32;
3096     #endif
3097     do {
3098     diff --git a/kernel/tsacct.c b/kernel/tsacct.c
3099     index 8ebcd85..5275fba 100644
3100     --- a/kernel/tsacct.c
3101     +++ b/kernel/tsacct.c
3102     @@ -120,8 +120,10 @@ void acct_update_integrals(struct task_struct *tsk)
3103     if (likely(tsk->mm)) {
3104     cputime_t time, dtime;
3105     struct timeval value;
3106     + unsigned long flags;
3107     u64 delta;
3108    
3109     + local_irq_save(flags);
3110     time = tsk->stime + tsk->utime;
3111     dtime = cputime_sub(time, tsk->acct_timexpd);
3112     jiffies_to_timeval(cputime_to_jiffies(dtime), &value);
3113     @@ -129,10 +131,12 @@ void acct_update_integrals(struct task_struct *tsk)
3114     delta = delta * USEC_PER_SEC + value.tv_usec;
3115    
3116     if (delta == 0)
3117     - return;
3118     + goto out;
3119     tsk->acct_timexpd = time;
3120     tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
3121     tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
3122     + out:
3123     + local_irq_restore(flags);
3124     }
3125     }
3126    
3127     diff --git a/mm/page_alloc.c b/mm/page_alloc.c
3128     index 51daae5..4205f7f 100644
3129     --- a/mm/page_alloc.c
3130     +++ b/mm/page_alloc.c
3131     @@ -2949,7 +2949,7 @@ static int __meminit next_active_region_index_in_nid(int index, int nid)
3132     * was used and there are no special requirements, this is a convenient
3133     * alternative
3134     */
3135     -int __meminit early_pfn_to_nid(unsigned long pfn)
3136     +int __meminit __early_pfn_to_nid(unsigned long pfn)
3137     {
3138     int i;
3139    
3140     @@ -2960,10 +2960,33 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
3141     if (start_pfn <= pfn && pfn < end_pfn)
3142     return early_node_map[i].nid;
3143     }
3144     + /* This is a memory hole */
3145     + return -1;
3146     +}
3147     +#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3148     +
3149     +int __meminit early_pfn_to_nid(unsigned long pfn)
3150     +{
3151     + int nid;
3152    
3153     + nid = __early_pfn_to_nid(pfn);
3154     + if (nid >= 0)
3155     + return nid;
3156     + /* just returns 0 */
3157     return 0;
3158     }
3159     -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
3160     +
3161     +#ifdef CONFIG_NODES_SPAN_OTHER_NODES
3162     +bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
3163     +{
3164     + int nid;
3165     +
3166     + nid = __early_pfn_to_nid(pfn);
3167     + if (nid >= 0 && nid != node)
3168     + return false;
3169     + return true;
3170     +}
3171     +#endif
3172    
3173     /* Basic iterator support to walk early_node_map[] */
3174     #define for_each_active_range_index_in_nid(i, nid) \
3175     diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
3176     index 6a9a6cd..9abd450 100644
3177     --- a/net/bridge/br_netfilter.c
3178     +++ b/net/bridge/br_netfilter.c
3179     @@ -101,6 +101,18 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
3180     pppoe_proto(skb) == htons(PPP_IPV6) && \
3181     brnf_filter_pppoe_tagged)
3182    
3183     +static void fake_update_pmtu(struct dst_entry *dst, u32 mtu)
3184     +{
3185     +}
3186     +
3187     +static struct dst_ops fake_dst_ops = {
3188     + .family = AF_INET,
3189     + .protocol = __constant_htons(ETH_P_IP),
3190     + .update_pmtu = fake_update_pmtu,
3191     + .entry_size = sizeof(struct rtable),
3192     + .entries = ATOMIC_INIT(0),
3193     +};
3194     +
3195     /*
3196     * Initialize bogus route table used to keep netfilter happy.
3197     * Currently, we fill in the PMTU entry because netfilter
3198     @@ -117,6 +129,7 @@ void br_netfilter_rtable_init(struct net_bridge *br)
3199     rt->u.dst.path = &rt->u.dst;
3200     rt->u.dst.metrics[RTAX_MTU - 1] = 1500;
3201     rt->u.dst.flags = DST_NOXFRM;
3202     + rt->u.dst.ops = &fake_dst_ops;
3203     }
3204    
3205     static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)
3206     diff --git a/net/core/skbuff.c b/net/core/skbuff.c
3207     index 53425fa..0675991 100644
3208     --- a/net/core/skbuff.c
3209     +++ b/net/core/skbuff.c
3210     @@ -143,14 +143,6 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
3211     BUG();
3212     }
3213    
3214     -void skb_truesize_bug(struct sk_buff *skb)
3215     -{
3216     - printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
3217     - "len=%u, sizeof(sk_buff)=%Zd\n",
3218     - skb->truesize, skb->len, sizeof(struct sk_buff));
3219     -}
3220     -EXPORT_SYMBOL(skb_truesize_bug);
3221     -
3222     /* Allocate a new skbuff. We do this ourselves so we can fill in a few
3223     * 'private' fields and also do memory statistics to find all the
3224     * [BEEP] leaks.
3225     diff --git a/net/core/sock.c b/net/core/sock.c
3226     index b1b2f22..93adc5c 100644
3227     --- a/net/core/sock.c
3228     +++ b/net/core/sock.c
3229     @@ -695,7 +695,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
3230     if (len < 0)
3231     return -EINVAL;
3232    
3233     - v.val = 0;
3234     + memset(&v, 0, sizeof(v));
3235    
3236     switch(optname) {
3237     case SO_DEBUG:
3238     @@ -1136,7 +1136,6 @@ void sock_rfree(struct sk_buff *skb)
3239     {
3240     struct sock *sk = skb->sk;
3241    
3242     - skb_truesize_check(skb);
3243     atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
3244     sk_mem_uncharge(skb->sk, skb->truesize);
3245     }
3246     diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
3247     index 89b4183..89e0cc1 100644
3248     --- a/security/selinux/netlabel.c
3249     +++ b/security/selinux/netlabel.c
3250     @@ -236,11 +236,12 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)
3251     if (!S_ISSOCK(inode->i_mode) ||
3252     ((mask & (MAY_WRITE | MAY_APPEND)) == 0))
3253     return 0;
3254     -
3255     sock = SOCKET_I(inode);
3256     sk = sock->sk;
3257     + if (sk == NULL)
3258     + return 0;
3259     sksec = sk->sk_security;
3260     - if (sksec->nlbl_state != NLBL_REQUIRE)
3261     + if (sksec == NULL || sksec->nlbl_state != NLBL_REQUIRE)
3262     return 0;
3263    
3264     local_bh_disable();
3265     @@ -339,8 +340,10 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock,
3266     lock_sock(sk);
3267     rc = netlbl_sock_getattr(sk, &secattr);
3268     release_sock(sk);
3269     - if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
3270     + if (rc == 0)
3271     rc = -EACCES;
3272     + else if (rc == -ENOMSG)
3273     + rc = 0;
3274     netlbl_secattr_destroy(&secattr);
3275     }
3276    
3277     diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c
3278     index 14dfb31..bc9d87d 100644
3279     --- a/sound/core/oss/rate.c
3280     +++ b/sound/core/oss/rate.c
3281     @@ -157,7 +157,7 @@ static void resample_shrink(struct snd_pcm_plugin *plugin,
3282     while (dst_frames1 > 0) {
3283     S1 = S2;
3284     if (src_frames1-- > 0) {
3285     - S1 = *src;
3286     + S2 = *src;
3287     src += src_step;
3288     }
3289     if (pos & ~R_MASK) {
3290     diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
3291     index 3f00ddf..c7c54e7 100644
3292     --- a/sound/pci/aw2/aw2-alsa.c
3293     +++ b/sound/pci/aw2/aw2-alsa.c
3294     @@ -165,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444);
3295     MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");
3296    
3297     static struct pci_device_id snd_aw2_ids[] = {
3298     - {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID,
3299     + {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0,
3300     0, 0, 0},
3301     {0}
3302     };
3303     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3304     index db9c702..3b5c6c2 100644
3305     --- a/sound/pci/hda/patch_realtek.c
3306     +++ b/sound/pci/hda/patch_realtek.c
3307     @@ -6630,6 +6630,7 @@ static int patch_alc882(struct hda_codec *codec)
3308     case 0x106b2800: /* AppleTV */
3309     board_config = ALC885_IMAC24;
3310     break;
3311     + case 0x106b00a0: /* MacBookPro3,1 - Another revision */
3312     case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
3313     case 0x106b2c00: /* Macbook Pro rev3 */
3314     case 0x106b3600: /* Macbook 3.1 */
3315     diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
3316     index 82a7814..01d7b75 100644
3317     --- a/sound/pci/oxygen/virtuoso.c
3318     +++ b/sound/pci/oxygen/virtuoso.c
3319     @@ -26,7 +26,7 @@
3320     * SPI 0 -> 1st PCM1796 (front)
3321     * SPI 1 -> 2nd PCM1796 (surround)
3322     * SPI 2 -> 3rd PCM1796 (center/LFE)
3323     - * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
3324     + * SPI 4 -> 4th PCM1796 (back)
3325     *
3326     * GPIO 2 -> M0 of CS5381
3327     * GPIO 3 -> M1 of CS5381
3328     @@ -142,12 +142,6 @@ struct xonar_data {
3329     static void pcm1796_write(struct oxygen *chip, unsigned int codec,
3330     u8 reg, u8 value)
3331     {
3332     - /*
3333     - * We don't want to do writes on SPI 4 because the EEPROM, which shares
3334     - * the same pin, might get confused and broken. We'd better take care
3335     - * that the driver works with the default register values ...
3336     - */
3337     -#if 0
3338     /* maps ALSA channel pair number to SPI output */
3339     static const u8 codec_map[4] = {
3340     0, 1, 2, 4
3341     @@ -158,7 +152,6 @@ static void pcm1796_write(struct oxygen *chip, unsigned int codec,
3342     (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
3343     OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
3344     (reg << 8) | value);
3345     -#endif
3346     }
3347    
3348     static void cs4398_write(struct oxygen *chip, u8 reg, u8 value)
3349     @@ -546,9 +539,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
3350    
3351     static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
3352     {
3353     - if (!strncmp(template->name, "Master Playback ", 16))
3354     - /* disable volume/mute because they would require SPI writes */
3355     - return 1;
3356     if (!strncmp(template->name, "CD Capture ", 11))
3357     /* CD in is actually connected to the video in pin */
3358     template->private_value ^= AC97_CD ^ AC97_VIDEO;
3359     @@ -598,8 +588,9 @@ static const struct oxygen_model xonar_models[] = {
3360     .dac_volume_min = 0x0f,
3361     .dac_volume_max = 0xff,
3362     .misc_flags = OXYGEN_MISC_MIDI,
3363     - .function_flags = OXYGEN_FUNCTION_SPI,
3364     - .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
3365     + .function_flags = OXYGEN_FUNCTION_SPI |
3366     + OXYGEN_FUNCTION_ENABLE_SPI_4_5,
3367     + .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
3368     .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
3369     },
3370     [MODEL_D2X] = {
3371     @@ -628,8 +619,9 @@ static const struct oxygen_model xonar_models[] = {
3372     .dac_volume_min = 0x0f,
3373     .dac_volume_max = 0xff,
3374     .misc_flags = OXYGEN_MISC_MIDI,
3375     - .function_flags = OXYGEN_FUNCTION_SPI,
3376     - .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
3377     + .function_flags = OXYGEN_FUNCTION_SPI |
3378     + OXYGEN_FUNCTION_ENABLE_SPI_4_5,
3379     + .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
3380     .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
3381     },
3382     [MODEL_D1] = {
3383     diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
3384     index 7a1a8c8..1710623 100644
3385     --- a/sound/usb/usbaudio.c
3386     +++ b/sound/usb/usbaudio.c
3387     @@ -2516,7 +2516,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
3388     * build the rate table and bitmap flags
3389     */
3390     int r, idx;
3391     - unsigned int nonzero_rates = 0;
3392    
3393     fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
3394     if (fp->rate_table == NULL) {
3395     @@ -2524,24 +2523,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
3396     return -1;
3397     }
3398    
3399     - fp->nr_rates = nr_rates;
3400     - fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
3401     + fp->nr_rates = 0;
3402     + fp->rate_min = fp->rate_max = 0;
3403     for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
3404     unsigned int rate = combine_triple(&fmt[idx]);
3405     + if (!rate)
3406     + continue;
3407     /* C-Media CM6501 mislabels its 96 kHz altsetting */
3408     if (rate == 48000 && nr_rates == 1 &&
3409     - chip->usb_id == USB_ID(0x0d8c, 0x0201) &&
3410     + (chip->usb_id == USB_ID(0x0d8c, 0x0201) ||
3411     + chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
3412     fp->altsetting == 5 && fp->maxpacksize == 392)
3413     rate = 96000;
3414     - fp->rate_table[r] = rate;
3415     - nonzero_rates |= rate;
3416     - if (rate < fp->rate_min)
3417     + fp->rate_table[fp->nr_rates] = rate;
3418     + if (!fp->rate_min || rate < fp->rate_min)
3419     fp->rate_min = rate;
3420     - else if (rate > fp->rate_max)
3421     + if (!fp->rate_max || rate > fp->rate_max)
3422     fp->rate_max = rate;
3423     fp->rates |= snd_pcm_rate_to_rate_bit(rate);
3424     + fp->nr_rates++;
3425     }
3426     - if (!nonzero_rates) {
3427     + if (!fp->nr_rates) {
3428     hwc_debug("All rates were zero. Skipping format!\n");
3429     return -1;
3430     }
3431     diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
3432     index 6676a17..940ae5a 100644
3433     --- a/sound/usb/usbmidi.c
3434     +++ b/sound/usb/usbmidi.c
3435     @@ -1583,6 +1583,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
3436     }
3437    
3438     ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
3439     + ep_info.out_interval = 0;
3440     ep_info.out_cables = endpoint->out_cables & 0x5555;
3441     err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
3442     if (err < 0)