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