Magellan Linux

Annotation of /trunk/kernel26-alx/patches-2.6.21-r14/0104-2.6.21.5-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 447 - (hide annotations) (download)
Tue Jan 22 17:55:52 2008 UTC (16 years, 3 months ago) by niro
File size: 73410 byte(s)
-2.6.21-alx-r14 - fixed some natsemi errors on wys terminals

1 niro 447 diff --git a/Documentation/hrtimer/timer_stats.txt b/Documentation/hrtimer/timer_stats.txt
2     index 27f782e..22b0814 100644
3     --- a/Documentation/hrtimer/timer_stats.txt
4     +++ b/Documentation/hrtimer/timer_stats.txt
5     @@ -2,9 +2,10 @@ timer_stats - timer usage statistics
6     ------------------------------------
7    
8     timer_stats is a debugging facility to make the timer (ab)usage in a Linux
9     -system visible to kernel and userspace developers. It is not intended for
10     -production usage as it adds significant overhead to the (hr)timer code and the
11     -(hr)timer data structures.
12     +system visible to kernel and userspace developers. If enabled in the config
13     +but not used it has almost zero runtime overhead, and a relatively small
14     +data structure overhead. Even if collection is enabled runtime all the
15     +locking is per-CPU and lookup is hashed.
16    
17     timer_stats should be used by kernel and userspace developers to verify that
18     their code does not make unduly use of timers. This helps to avoid unnecessary
19     diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
20     index 17d7345..cbb4751 100644
21     --- a/arch/i386/kernel/hpet.c
22     +++ b/arch/i386/kernel/hpet.c
23     @@ -226,7 +226,8 @@ int __init hpet_enable(void)
24     {
25     unsigned long id;
26     uint64_t hpet_freq;
27     - u64 tmp;
28     + u64 tmp, start, now;
29     + cycle_t t1;
30    
31     if (!is_hpet_capable())
32     return 0;
33     @@ -273,6 +274,27 @@ int __init hpet_enable(void)
34     /* Start the counter */
35     hpet_start_counter();
36    
37     + /* Verify whether hpet counter works */
38     + t1 = read_hpet();
39     + rdtscll(start);
40     +
41     + /*
42     + * We don't know the TSC frequency yet, but waiting for
43     + * 200000 TSC cycles is safe:
44     + * 4 GHz == 50us
45     + * 1 GHz == 200us
46     + */
47     + do {
48     + rep_nop();
49     + rdtscll(now);
50     + } while ((now - start) < 200000UL);
51     +
52     + if (t1 == read_hpet()) {
53     + printk(KERN_WARNING
54     + "HPET counter not counting. HPET disabled\n");
55     + goto out_nohpet;
56     + }
57     +
58     /* Initialize and register HPET clocksource
59     *
60     * hpet period is in femto seconds per cycle
61     diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c
62     index 3514b41..e33f51a 100644
63     --- a/arch/i386/kernel/reboot.c
64     +++ b/arch/i386/kernel/reboot.c
65     @@ -88,6 +88,14 @@ static int __init set_bios_reboot(struct dmi_system_id *d)
66     }
67    
68     static struct dmi_system_id __initdata reboot_dmi_table[] = {
69     + { /* Handle problems with rebooting on Dell E520's */
70     + .callback = set_bios_reboot,
71     + .ident = "Dell E520",
72     + .matches = {
73     + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
74     + DMI_MATCH(DMI_PRODUCT_NAME, "Dell DM061"),
75     + },
76     + },
77     { /* Handle problems with rebooting on Dell 1300's */
78     .callback = set_bios_reboot,
79     .ident = "Dell PowerEdge 1300",
80     diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
81     index 8fda7be..bd00876 100644
82     --- a/arch/i386/oprofile/nmi_int.c
83     +++ b/arch/i386/oprofile/nmi_int.c
84     @@ -131,7 +131,6 @@ static void nmi_save_registers(void * dummy)
85     {
86     int cpu = smp_processor_id();
87     struct op_msrs * msrs = &cpu_msrs[cpu];
88     - model->fill_in_addresses(msrs);
89     nmi_cpu_save_registers(msrs);
90     }
91    
92     @@ -155,7 +154,7 @@ static int allocate_msrs(void)
93     size_t counters_size = sizeof(struct op_msr) * model->num_counters;
94    
95     int i;
96     - for_each_online_cpu(i) {
97     + for_each_possible_cpu(i) {
98     cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL);
99     if (!cpu_msrs[i].counters) {
100     success = 0;
101     @@ -195,6 +194,7 @@ static struct notifier_block profile_exceptions_nb = {
102     static int nmi_setup(void)
103     {
104     int err=0;
105     + int cpu;
106    
107     if (!allocate_msrs())
108     return -ENOMEM;
109     @@ -207,6 +207,19 @@ static int nmi_setup(void)
110     /* We need to serialize save and setup for HT because the subset
111     * of msrs are distinct for save and setup operations
112     */
113     +
114     + /* Assume saved/restored counters are the same on all CPUs */
115     + model->fill_in_addresses(&cpu_msrs[0]);
116     + for_each_possible_cpu (cpu) {
117     + if (cpu != 0) {
118     + memcpy(cpu_msrs[cpu].counters, cpu_msrs[0].counters,
119     + sizeof(struct op_msr) * model->num_counters);
120     +
121     + memcpy(cpu_msrs[cpu].controls, cpu_msrs[0].controls,
122     + sizeof(struct op_msr) * model->num_controls);
123     + }
124     +
125     + }
126     on_each_cpu(nmi_save_registers, NULL, 0, 1);
127     on_each_cpu(nmi_cpu_setup, NULL, 0, 1);
128     nmi_enabled = 1;
129     diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
130     index baea10a..06459ae 100644
131     --- a/arch/sparc64/kernel/head.S
132     +++ b/arch/sparc64/kernel/head.S
133     @@ -653,33 +653,54 @@ setup_tba:
134     restore
135     sparc64_boot_end:
136    
137     -#include "ktlb.S"
138     -#include "tsb.S"
139     #include "etrap.S"
140     #include "rtrap.S"
141     #include "winfixup.S"
142     #include "entry.S"
143     #include "sun4v_tlb_miss.S"
144     #include "sun4v_ivec.S"
145     +#include "ktlb.S"
146     +#include "tsb.S"
147    
148     /*
149     * The following skip makes sure the trap table in ttable.S is aligned
150     * on a 32K boundary as required by the v9 specs for TBA register.
151     *
152     * We align to a 32K boundary, then we have the 32K kernel TSB,
153     - * then the 32K aligned trap table.
154     + * the 64K kernel 4MB TSB, and then the 32K aligned trap table.
155     */
156     1:
157     .skip 0x4000 + _start - 1b
158    
159     +! 0x0000000000408000
160     +
161     .globl swapper_tsb
162     swapper_tsb:
163     .skip (32 * 1024)
164    
165     -! 0x0000000000408000
166     + .globl swapper_4m_tsb
167     +swapper_4m_tsb:
168     + .skip (64 * 1024)
169     +
170     +! 0x0000000000420000
171    
172     + /* Some care needs to be exercised if you try to move the
173     + * location of the trap table relative to other things. For
174     + * one thing there are br* instructions in some of the
175     + * trap table entires which branch back to code in ktlb.S
176     + * Those instructions can only handle a signed 16-bit
177     + * displacement.
178     + *
179     + * There is a binutils bug (bugzilla #4558) which causes
180     + * the relocation overflow checks for such instructions to
181     + * not be done correctly. So bintuils will not notice the
182     + * error and will instead write junk into the relocation and
183     + * you'll have an unbootable kernel.
184     + */
185     #include "ttable.S"
186    
187     +! 0x0000000000428000
188     +
189     #include "systbls.S"
190    
191     .data
192     diff --git a/arch/sparc64/kernel/itlb_miss.S b/arch/sparc64/kernel/itlb_miss.S
193     index ad46e20..5a8377b 100644
194     --- a/arch/sparc64/kernel/itlb_miss.S
195     +++ b/arch/sparc64/kernel/itlb_miss.S
196     @@ -11,12 +11,12 @@
197     /* ITLB ** ICACHE line 2: TSB compare and TLB load */
198     bne,pn %xcc, tsb_miss_itlb ! Miss
199     mov FAULT_CODE_ITLB, %g3
200     - andcc %g5, _PAGE_EXEC_4U, %g0 ! Executable?
201     + sethi %hi(_PAGE_EXEC_4U), %g4
202     + andcc %g5, %g4, %g0 ! Executable?
203     be,pn %xcc, tsb_do_fault
204     nop ! Delay slot, fill me
205     stxa %g5, [%g0] ASI_ITLB_DATA_IN ! Load TLB
206     retry ! Trap done
207     - nop
208    
209     /* ITLB ** ICACHE line 3: */
210     nop
211     diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
212     index ec22cd6..f6fd073 100644
213     --- a/arch/sparc64/kernel/pci_sun4v.c
214     +++ b/arch/sparc64/kernel/pci_sun4v.c
215     @@ -12,6 +12,7 @@
216     #include <linux/percpu.h>
217     #include <linux/irq.h>
218     #include <linux/msi.h>
219     +#include <linux/log2.h>
220    
221     #include <asm/pbm.h>
222     #include <asm/iommu.h>
223     @@ -996,9 +997,8 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
224     {
225     struct pci_iommu *iommu = pbm->iommu;
226     struct property *prop;
227     - unsigned long num_tsb_entries, sz;
228     + unsigned long num_tsb_entries, sz, tsbsize;
229     u32 vdma[2], dma_mask, dma_offset;
230     - int tsbsize;
231    
232     prop = of_find_property(pbm->prom_node, "virtual-dma", NULL);
233     if (prop) {
234     @@ -1012,31 +1012,15 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
235     vdma[1] = 0x80000000;
236     }
237    
238     - dma_mask = vdma[0];
239     - switch (vdma[1]) {
240     - case 0x20000000:
241     - dma_mask |= 0x1fffffff;
242     - tsbsize = 64;
243     - break;
244     -
245     - case 0x40000000:
246     - dma_mask |= 0x3fffffff;
247     - tsbsize = 128;
248     - break;
249     -
250     - case 0x80000000:
251     - dma_mask |= 0x7fffffff;
252     - tsbsize = 256;
253     - break;
254     -
255     - default:
256     - prom_printf("PCI-SUN4V: strange virtual-dma size.\n");
257     - prom_halt();
258     + if ((vdma[0] | vdma[1]) & ~IO_PAGE_MASK) {
259     + prom_printf("PCI-SUN4V: strange virtual-dma[%08x:%08x].\n",
260     + vdma[0], vdma[1]);
261     + prom_halt();
262     };
263    
264     - tsbsize *= (8 * 1024);
265     -
266     - num_tsb_entries = tsbsize / sizeof(iopte_t);
267     + dma_mask = (roundup_pow_of_two(vdma[1]) - 1UL);
268     + num_tsb_entries = vdma[1] / IO_PAGE_SIZE;
269     + tsbsize = num_tsb_entries * sizeof(iopte_t);
270    
271     dma_offset = vdma[0];
272    
273     @@ -1047,7 +1031,7 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
274     iommu->dma_addr_mask = dma_mask;
275    
276     /* Allocate and initialize the free area map. */
277     - sz = num_tsb_entries / 8;
278     + sz = (num_tsb_entries + 7) / 8;
279     sz = (sz + 7UL) & ~7UL;
280     iommu->arena.map = kzalloc(sz, GFP_KERNEL);
281     if (!iommu->arena.map) {
282     diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
283     index f146071..c034d12 100644
284     --- a/arch/sparc64/mm/init.c
285     +++ b/arch/sparc64/mm/init.c
286     @@ -60,8 +60,11 @@ unsigned long kern_linear_pte_xor[2] __read_mostly;
287     unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)];
288    
289     #ifndef CONFIG_DEBUG_PAGEALLOC
290     -/* A special kernel TSB for 4MB and 256MB linear mappings. */
291     -struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES];
292     +/* A special kernel TSB for 4MB and 256MB linear mappings.
293     + * Space is allocated for this right after the trap table
294     + * in arch/sparc64/kernel/head.S
295     + */
296     +extern struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES];
297     #endif
298    
299     #define MAX_BANKS 32
300     diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
301     index 5178eba..c2502fe 100644
302     --- a/arch/um/os-Linux/start_up.c
303     +++ b/arch/um/os-Linux/start_up.c
304     @@ -144,9 +144,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
305     int exit_with = WEXITSTATUS(status);
306     if (exit_with == 2)
307     non_fatal("check_ptrace : child exited with status 2. "
308     - "Serious trouble happening! Try updating "
309     - "your host skas patch!\nDisabling SYSEMU "
310     - "support.");
311     + "\nDisabling SYSEMU support.\n");
312     non_fatal("check_ptrace : child exited with exitcode %d, while "
313     "expecting %d; status 0x%x\n", exit_with,
314     exitcode, status);
315     @@ -209,6 +207,7 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
316     static void __init check_sysemu(void)
317     {
318     void *stack;
319     + unsigned long regs[MAX_REG_NR];
320     int pid, n, status, count=0;
321    
322     non_fatal("Checking syscall emulation patch for ptrace...");
323     @@ -225,11 +224,20 @@ static void __init check_sysemu(void)
324     fatal("check_sysemu : expected SIGTRAP, got status = %d",
325     status);
326    
327     - n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
328     - os_getpid());
329     - if(n < 0)
330     - fatal_perror("check_sysemu : failed to modify system call "
331     - "return");
332     + if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
333     + fatal_perror("check_sysemu : PTRACE_GETREGS failed");
334     + if(PT_SYSCALL_NR(regs) != __NR_getpid){
335     + non_fatal("check_sysemu got system call number %d, "
336     + "expected %d...", PT_SYSCALL_NR(regs), __NR_getpid);
337     + goto fail;
338     + }
339     +
340     + n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid());
341     + if(n < 0){
342     + non_fatal("check_sysemu : failed to modify system call "
343     + "return");
344     + goto fail;
345     + }
346    
347     if (stop_ptraced_child(pid, stack, 0, 0) < 0)
348     goto fail_stopped;
349     diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
350     index ec31534..6fd126a 100644
351     --- a/arch/x86_64/mm/init.c
352     +++ b/arch/x86_64/mm/init.c
353     @@ -776,3 +776,9 @@ int in_gate_area_no_task(unsigned long addr)
354     {
355     return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
356     }
357     +
358     +void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
359     +{
360     + return __alloc_bootmem_core(pgdat->bdata, size,
361     + SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
362     +}
363     diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
364     index 8fcd6a1..a2efae8 100644
365     --- a/drivers/acpi/numa.c
366     +++ b/drivers/acpi/numa.c
367     @@ -40,19 +40,19 @@ static nodemask_t nodes_found_map = NODE_MASK_NONE;
368     #define NID_INVAL -1
369    
370     /* maps to convert between proximity domain and logical node ID */
371     -int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS]
372     +static int pxm_to_node_map[MAX_PXM_DOMAINS]
373     = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL };
374     -int __cpuinitdata node_to_pxm_map[MAX_NUMNODES]
375     +static int node_to_pxm_map[MAX_NUMNODES]
376     = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
377    
378     -int __cpuinit pxm_to_node(int pxm)
379     +int pxm_to_node(int pxm)
380     {
381     if (pxm < 0)
382     return NID_INVAL;
383     return pxm_to_node_map[pxm];
384     }
385    
386     -int __cpuinit node_to_pxm(int node)
387     +int node_to_pxm(int node)
388     {
389     if (node < 0)
390     return PXM_INVAL;
391     diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
392     index fd27227..efd87d3 100644
393     --- a/drivers/ata/ahci.c
394     +++ b/drivers/ata/ahci.c
395     @@ -170,6 +170,7 @@ enum {
396     AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */
397     AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */
398     AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */
399     + AHCI_FLAG_32BIT_ONLY = (1 << 28), /* force 32bit */
400     };
401    
402     struct ahci_cmd_hdr {
403     @@ -370,7 +371,8 @@ static const struct ata_port_info ahci_port_info[] = {
404     .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
405     ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
406     ATA_FLAG_SKIP_D2H_BSY |
407     - AHCI_FLAG_IGN_SERR_INTERNAL,
408     + AHCI_FLAG_IGN_SERR_INTERNAL |
409     + AHCI_FLAG_32BIT_ONLY,
410     .pio_mask = 0x1f, /* pio0-4 */
411     .udma_mask = 0x7f, /* udma0-6 ; FIXME */
412     .port_ops = &ahci_ops,
413     @@ -1579,6 +1581,12 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent)
414     probe_ent->n_ports = cap_n_ports;
415    
416     using_dac = hpriv->cap & HOST_CAP_64;
417     + if (using_dac && (probe_ent->port_flags & AHCI_FLAG_32BIT_ONLY)) {
418     + dev_printk(KERN_INFO, &pdev->dev,
419     + "controller can't do 64bit DMA, forcing 32bit\n");
420     + using_dac = 0;
421     + }
422     +
423     if (using_dac &&
424     !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
425     rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
426     diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
427     index 65a725c..e0da175 100644
428     --- a/drivers/block/cciss.c
429     +++ b/drivers/block/cciss.c
430     @@ -3405,13 +3405,39 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
431     return -1;
432     }
433    
434     -static void cciss_remove_one(struct pci_dev *pdev)
435     +static void cciss_shutdown(struct pci_dev *pdev)
436     {
437     ctlr_info_t *tmp_ptr;
438     - int i, j;
439     + int i;
440     char flush_buf[4];
441     int return_code;
442    
443     + tmp_ptr = pci_get_drvdata(pdev);
444     + if (tmp_ptr == NULL)
445     + return;
446     + i = tmp_ptr->ctlr;
447     + if (hba[i] == NULL)
448     + return;
449     +
450     + /* Turn board interrupts off and send the flush cache command */
451     + /* sendcmd will turn off interrupt, and send the flush...
452     + * To write all data in the battery backed cache to disks */
453     + memset(flush_buf, 0, 4);
454     + return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 0, 0, 0, NULL,
455     + TYPE_CMD);
456     + if (return_code == IO_OK) {
457     + printk(KERN_INFO "Completed flushing cache on controller %d\n", i);
458     + } else {
459     + printk(KERN_WARNING "Error flushing cache on controller %d\n", i);
460     + }
461     + free_irq(hba[i]->intr[2], hba[i]);
462     +}
463     +
464     +static void __devexit cciss_remove_one(struct pci_dev *pdev)
465     +{
466     + ctlr_info_t *tmp_ptr;
467     + int i, j;
468     +
469     if (pci_get_drvdata(pdev) == NULL) {
470     printk(KERN_ERR "cciss: Unable to remove device \n");
471     return;
472     @@ -3442,18 +3468,7 @@ static void cciss_remove_one(struct pci_dev *pdev)
473    
474     cciss_unregister_scsi(i); /* unhook from SCSI subsystem */
475    
476     - /* Turn board interrupts off and send the flush cache command */
477     - /* sendcmd will turn off interrupt, and send the flush...
478     - * To write all data in the battery backed cache to disks */
479     - memset(flush_buf, 0, 4);
480     - return_code = sendcmd(CCISS_CACHE_FLUSH, i, flush_buf, 4, 0, 0, 0, NULL,
481     - TYPE_CMD);
482     - if (return_code == IO_OK) {
483     - printk(KERN_INFO "Completed flushing cache on controller %d\n", i);
484     - } else {
485     - printk(KERN_WARNING "Error flushing cache on controller %d\n", i);
486     - }
487     - free_irq(hba[i]->intr[2], hba[i]);
488     + cciss_shutdown(pdev);
489    
490     #ifdef CONFIG_PCI_MSI
491     if (hba[i]->msix_vector)
492     @@ -3486,7 +3501,7 @@ static struct pci_driver cciss_pci_driver = {
493     .probe = cciss_init_one,
494     .remove = __devexit_p(cciss_remove_one),
495     .id_table = cciss_pci_device_id, /* id_table */
496     - .shutdown = cciss_remove_one,
497     + .shutdown = cciss_shutdown,
498     };
499    
500     /*
501     diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
502     index 16dc5d1..ab39503 100644
503     --- a/drivers/char/cyclades.c
504     +++ b/drivers/char/cyclades.c
505     @@ -1103,6 +1103,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
506    
507     if (data & info->ignore_status_mask) {
508     info->icount.rx++;
509     + spin_unlock(&cinfo->card_lock);
510     return;
511     }
512     if (tty_buffer_request_room(tty, 1)) {
513     diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
514     index 6ac3ca4..5a6c649 100644
515     --- a/drivers/char/n_tty.c
516     +++ b/drivers/char/n_tty.c
517     @@ -1191,6 +1191,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
518     is_current_pgrp_orphaned())
519     return -EIO;
520     kill_pgrp(task_pgrp(current), SIGTTIN, 1);
521     + set_thread_flag(TIF_SIGPENDING);
522     return -ERESTARTSYS;
523     }
524     }
525     diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
526     index 7a32df5..2000120 100644
527     --- a/drivers/char/tty_io.c
528     +++ b/drivers/char/tty_io.c
529     @@ -1121,7 +1121,8 @@ int tty_check_change(struct tty_struct * tty)
530     return 0;
531     if (is_current_pgrp_orphaned())
532     return -EIO;
533     - (void) kill_pgrp(task_pgrp(current), SIGTTOU, 1);
534     + kill_pgrp(task_pgrp(current), SIGTTOU, 1);
535     + set_thread_flag(TIF_SIGPENDING);
536     return -ERESTARTSYS;
537     }
538    
539     diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
540     index ab6fa27..cf9d344 100644
541     --- a/drivers/ide/pci/hpt366.c
542     +++ b/drivers/ide/pci/hpt366.c
543     @@ -1,5 +1,5 @@
544     /*
545     - * linux/drivers/ide/pci/hpt366.c Version 1.02 Apr 18, 2007
546     + * linux/drivers/ide/pci/hpt366.c Version 1.03 May 4, 2007
547     *
548     * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
549     * Portions Copyright (C) 2001 Sun Microsystems, Inc.
550     @@ -1527,7 +1527,12 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
551     if (rev > 2)
552     goto init_single;
553    
554     + /*
555     + * HPT36x chips are single channel and
556     + * do not seem to have the channel enable bit...
557     + */
558     d->channels = 1;
559     + d->enablebits[0].reg = 0;
560    
561     if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) {
562     u8 pin1 = 0, pin2 = 0;
563     diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
564     index 03e44b3..6c81951 100644
565     --- a/drivers/ieee1394/eth1394.c
566     +++ b/drivers/ieee1394/eth1394.c
567     @@ -584,10 +584,9 @@ static void ether1394_add_host (struct hpsb_host *host)
568     }
569    
570     SET_MODULE_OWNER(dev);
571     -#if 0
572     - /* FIXME - Is this the correct parent device anyway? */
573     - SET_NETDEV_DEV(dev, &host->device);
574     -#endif
575     +
576     + /* This used to be &host->device in Linux 2.6.20 and before. */
577     + SET_NETDEV_DEV(dev, host->device.parent);
578    
579     priv = netdev_priv(dev);
580    
581     diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
582     index db9cca3..23411ab 100644
583     --- a/drivers/input/serio/i8042.c
584     +++ b/drivers/input/serio/i8042.c
585     @@ -526,6 +526,33 @@ static irqreturn_t __devinit i8042_aux_test_irq(int irq, void *dev_id)
586     return IRQ_HANDLED;
587     }
588    
589     +/*
590     + * i8042_toggle_aux - enables or disables AUX port on i8042 via command and
591     + * verifies success by readinng CTR. Used when testing for presence of AUX
592     + * port.
593     + */
594     +static int __devinit i8042_toggle_aux(int on)
595     +{
596     + unsigned char param;
597     + int i;
598     +
599     + if (i8042_command(&param,
600     + on ? I8042_CMD_AUX_ENABLE : I8042_CMD_AUX_DISABLE))
601     + return -1;
602     +
603     + /* some chips need some time to set the I8042_CTR_AUXDIS bit */
604     + for (i = 0; i < 100; i++) {
605     + udelay(50);
606     +
607     + if (i8042_command(&param, I8042_CMD_CTL_RCTR))
608     + return -1;
609     +
610     + if (!(param & I8042_CTR_AUXDIS) == on)
611     + return 0;
612     + }
613     +
614     + return -1;
615     +}
616    
617     /*
618     * i8042_check_aux() applies as much paranoia as it can at detecting
619     @@ -580,16 +607,12 @@ static int __devinit i8042_check_aux(void)
620     * Bit assignment test - filters out PS/2 i8042's in AT mode
621     */
622    
623     - if (i8042_command(&param, I8042_CMD_AUX_DISABLE))
624     - return -1;
625     - if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (~param & I8042_CTR_AUXDIS)) {
626     + if (i8042_toggle_aux(0)) {
627     printk(KERN_WARNING "Failed to disable AUX port, but continuing anyway... Is this a SiS?\n");
628     printk(KERN_WARNING "If AUX port is really absent please use the 'i8042.noaux' option.\n");
629     }
630    
631     - if (i8042_command(&param, I8042_CMD_AUX_ENABLE))
632     - return -1;
633     - if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (param & I8042_CTR_AUXDIS))
634     + if (i8042_toggle_aux(1))
635     return -1;
636    
637     /*
638     diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
639     index e61e0ef..fd563a9 100644
640     --- a/drivers/md/bitmap.c
641     +++ b/drivers/md/bitmap.c
642     @@ -255,19 +255,25 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde
643    
644     }
645    
646     -static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait)
647     +static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
648     {
649     mdk_rdev_t *rdev;
650     struct list_head *tmp;
651     + mddev_t *mddev = bitmap->mddev;
652    
653     ITERATE_RDEV(mddev, rdev, tmp)
654     if (test_bit(In_sync, &rdev->flags)
655     - && !test_bit(Faulty, &rdev->flags))
656     + && !test_bit(Faulty, &rdev->flags)) {
657     + int size = PAGE_SIZE;
658     + if (page->index == bitmap->file_pages-1)
659     + size = roundup(bitmap->last_page_size,
660     + bdev_hardsect_size(rdev->bdev));
661     md_super_write(mddev, rdev,
662     - (rdev->sb_offset<<1) + offset
663     + (rdev->sb_offset<<1) + bitmap->offset
664     + page->index * (PAGE_SIZE/512),
665     - PAGE_SIZE,
666     + size,
667     page);
668     + }
669    
670     if (wait)
671     md_super_wait(mddev);
672     @@ -282,7 +288,7 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait)
673     struct buffer_head *bh;
674    
675     if (bitmap->file == NULL)
676     - return write_sb_page(bitmap->mddev, bitmap->offset, page, wait);
677     + return write_sb_page(bitmap, page, wait);
678    
679     bh = page_buffers(page);
680    
681     @@ -923,6 +929,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
682     }
683    
684     bitmap->filemap[bitmap->file_pages++] = page;
685     + bitmap->last_page_size = count;
686     }
687     paddr = kmap_atomic(page, KM_USER0);
688     if (bitmap->flags & BITMAP_HOSTENDIAN)
689     diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
690     index dfe3214..2c404f7 100644
691     --- a/drivers/md/raid0.c
692     +++ b/drivers/md/raid0.c
693     @@ -415,7 +415,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
694     raid0_conf_t *conf = mddev_to_conf(mddev);
695     struct strip_zone *zone;
696     mdk_rdev_t *tmp_dev;
697     - unsigned long chunk;
698     + sector_t chunk;
699     sector_t block, rsect;
700     const int rw = bio_data_dir(bio);
701    
702     @@ -470,7 +470,6 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
703    
704     sector_div(x, zone->nb_dev);
705     chunk = x;
706     - BUG_ON(x != (sector_t)chunk);
707    
708     x = block >> chunksize_bits;
709     tmp_dev = zone->dev[sector_div(x, zone->nb_dev)];
710     diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
711     index 464feaf..622a329 100644
712     --- a/drivers/media/dvb/ttpci/budget-ci.c
713     +++ b/drivers/media/dvb/ttpci/budget-ci.c
714     @@ -926,7 +926,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struc
715     band = 1;
716     } else if (tuner_frequency < 200000000) {
717     cp = 6;
718     - band = 2;
719     + band = 1;
720     } else if (tuner_frequency < 290000000) {
721     cp = 3;
722     band = 2;
723     diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
724     index b28a915..de907d9 100644
725     --- a/drivers/net/e1000/e1000_main.c
726     +++ b/drivers/net/e1000/e1000_main.c
727     @@ -1153,13 +1153,16 @@ e1000_probe(struct pci_dev *pdev,
728     !e1000_check_mng_mode(&adapter->hw))
729     e1000_get_hw_control(adapter);
730    
731     - strcpy(netdev->name, "eth%d");
732     - if ((err = register_netdev(netdev)))
733     - goto err_register;
734     -
735     /* tell the stack to leave us alone until e1000_open() is called */
736     netif_carrier_off(netdev);
737     netif_stop_queue(netdev);
738     +#ifdef CONFIG_E1000_NAPI
739     + netif_poll_disable(netdev);
740     +#endif
741     +
742     + strcpy(netdev->name, "eth%d");
743     + if ((err = register_netdev(netdev)))
744     + goto err_register;
745    
746     DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
747    
748     diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
749     index 3d20115..2de13cf 100644
750     --- a/drivers/net/tg3.c
751     +++ b/drivers/net/tg3.c
752     @@ -64,8 +64,8 @@
753    
754     #define DRV_MODULE_NAME "tg3"
755     #define PFX DRV_MODULE_NAME ": "
756     -#define DRV_MODULE_VERSION "3.75.1"
757     -#define DRV_MODULE_RELDATE "May 7, 2007"
758     +#define DRV_MODULE_VERSION "3.75.2"
759     +#define DRV_MODULE_RELDATE "June 5, 2007"
760    
761     #define TG3_DEF_MAC_MODE 0
762     #define TG3_DEF_RX_MODE 0
763     @@ -10942,6 +10942,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
764     * upon subsystem IDs.
765     */
766     if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
767     + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
768     !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
769     tp->tg3_flags |= (TG3_FLAG_USE_MI_INTERRUPT |
770     TG3_FLAG_USE_LINKCHG_REG);
771     diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
772     index 87ee3ee..e0e936a 100644
773     --- a/drivers/net/wireless/zd1211rw/zd_chip.c
774     +++ b/drivers/net/wireless/zd1211rw/zd_chip.c
775     @@ -67,11 +67,12 @@ static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size)
776     i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i);
777     i += scnprintf(buffer+i, size-i, " ");
778     i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i);
779     - i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c", chip->pa_type,
780     + i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c%c", chip->pa_type,
781     chip->patch_cck_gain ? 'g' : '-',
782     chip->patch_cr157 ? '7' : '-',
783     chip->patch_6m_band_edge ? '6' : '-',
784     - chip->new_phy_layout ? 'N' : '-');
785     + chip->new_phy_layout ? 'N' : '-',
786     + chip->al2230s_bit ? 'S' : '-');
787     return i;
788     }
789    
790     diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
791     index f50cff3..e6d604b 100644
792     --- a/drivers/net/wireless/zd1211rw/zd_rf.c
793     +++ b/drivers/net/wireless/zd1211rw/zd_rf.c
794     @@ -34,7 +34,7 @@ static const char *rfs[] = {
795     [AL2210_RF] = "AL2210_RF",
796     [MAXIM_NEW_RF] = "MAXIM_NEW_RF",
797     [UW2453_RF] = "UW2453_RF",
798     - [AL2230S_RF] = "AL2230S_RF",
799     + [UNKNOWN_A_RF] = "UNKNOWN_A_RF",
800     [RALINK_RF] = "RALINK_RF",
801     [INTERSIL_RF] = "INTERSIL_RF",
802     [RF2959_RF] = "RF2959_RF",
803     diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h
804     index a57732e..ee8ac3a 100644
805     --- a/drivers/net/wireless/zd1211rw/zd_rf.h
806     +++ b/drivers/net/wireless/zd1211rw/zd_rf.h
807     @@ -26,7 +26,7 @@
808     #define AL2210_RF 0x7
809     #define MAXIM_NEW_RF 0x8
810     #define UW2453_RF 0x9
811     -#define AL2230S_RF 0xa
812     +#define UNKNOWN_A_RF 0xa
813     #define RALINK_RF 0xb
814     #define INTERSIL_RF 0xc
815     #define RF2959_RF 0xd
816     diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
817     index 5235a78..85a9ad2 100644
818     --- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
819     +++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
820     @@ -59,6 +59,18 @@ static const struct zd_ioreq16 zd1211b_ioreqs_shared_1[] = {
821     { CR240, 0x57 }, { CR9, 0xe0 },
822     };
823    
824     +static const struct zd_ioreq16 ioreqs_init_al2230s[] = {
825     + { CR47, 0x1e }, /* MARK_002 */
826     + { CR106, 0x22 },
827     + { CR107, 0x2a }, /* MARK_002 */
828     + { CR109, 0x13 }, /* MARK_002 */
829     + { CR118, 0xf8 }, /* MARK_002 */
830     + { CR119, 0x12 }, { CR122, 0xe0 },
831     + { CR128, 0x10 }, /* MARK_001 from 0xe->0x10 */
832     + { CR129, 0x0e }, /* MARK_001 from 0xd->0x0e */
833     + { CR130, 0x10 }, /* MARK_001 from 0xb->0x0d */
834     +};
835     +
836     static int zd1211b_al2230_finalize_rf(struct zd_chip *chip)
837     {
838     int r;
839     @@ -90,7 +102,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
840     int r;
841     struct zd_chip *chip = zd_rf_to_chip(rf);
842    
843     - static const struct zd_ioreq16 ioreqs[] = {
844     + static const struct zd_ioreq16 ioreqs_init[] = {
845     { CR15, 0x20 }, { CR23, 0x40 }, { CR24, 0x20 },
846     { CR26, 0x11 }, { CR28, 0x3e }, { CR29, 0x00 },
847     { CR44, 0x33 }, { CR106, 0x2a }, { CR107, 0x1a },
848     @@ -117,10 +129,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
849     { CR119, 0x10 }, { CR120, 0x4f }, { CR121, 0x77 },
850     { CR122, 0xe0 }, { CR137, 0x88 }, { CR252, 0xff },
851     { CR253, 0xff },
852     + };
853    
854     - /* These following happen separately in the vendor driver */
855     - { },
856     -
857     + static const struct zd_ioreq16 ioreqs_pll[] = {
858     /* shdnb(PLL_ON)=0 */
859     { CR251, 0x2f },
860     /* shdnb(PLL_ON)=1 */
861     @@ -128,7 +139,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
862     { CR138, 0x28 }, { CR203, 0x06 },
863     };
864    
865     - static const u32 rv[] = {
866     + static const u32 rv1[] = {
867     /* Channel 1 */
868     0x03f790,
869     0x033331,
870     @@ -137,6 +148,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
871     0x0b3331,
872     0x03b812,
873     0x00fff3,
874     + };
875     +
876     + static const u32 rv2[] = {
877     0x000da4,
878     0x0f4dc5, /* fix freq shift, 0x04edc5 */
879     0x0805b6,
880     @@ -148,8 +162,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
881     0x0bdffc,
882     0x00000d,
883     0x00500f,
884     + };
885    
886     - /* These writes happen separately in the vendor driver */
887     + static const u32 rv3[] = {
888     0x00d00f,
889     0x004c0f,
890     0x00540f,
891     @@ -157,11 +172,38 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
892     0x00500f,
893     };
894    
895     - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
896     + r = zd_iowrite16a_locked(chip, ioreqs_init, ARRAY_SIZE(ioreqs_init));
897     if (r)
898     return r;
899    
900     - r = zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS);
901     + if (chip->al2230s_bit) {
902     + r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
903     + ARRAY_SIZE(ioreqs_init_al2230s));
904     + if (r)
905     + return r;
906     + }
907     +
908     + r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS);
909     + if (r)
910     + return r;
911     +
912     + /* improve band edge for AL2230S */
913     + if (chip->al2230s_bit)
914     + r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
915     + else
916     + r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
917     + if (r)
918     + return r;
919     +
920     + r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS);
921     + if (r)
922     + return r;
923     +
924     + r = zd_iowrite16a_locked(chip, ioreqs_pll, ARRAY_SIZE(ioreqs_pll));
925     + if (r)
926     + return r;
927     +
928     + r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS);
929     if (r)
930     return r;
931    
932     @@ -227,7 +269,9 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
933     0x481dc0,
934     0xcfff00,
935     0x25a000,
936     + };
937    
938     + static const u32 rv2[] = {
939     /* To improve AL2230 yield, improve phase noise, 4713 */
940     0x25a000,
941     0xa3b2f0,
942     @@ -250,7 +294,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
943     { CR251, 0x7f }, /* shdnb(PLL_ON)=1 */
944     };
945    
946     - static const u32 rv2[] = {
947     + static const u32 rv3[] = {
948     /* To improve AL2230 yield, 4713 */
949     0xf01b00,
950     0xf01e00,
951     @@ -269,18 +313,37 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
952     r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1));
953     if (r)
954     return r;
955     +
956     + if (chip->al2230s_bit) {
957     + r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
958     + ARRAY_SIZE(ioreqs_init_al2230s));
959     + if (r)
960     + return r;
961     + }
962     +
963     r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3);
964     if (r)
965     return r;
966     r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1));
967     if (r)
968     return r;
969     - r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
970     +
971     + if (chip->al2230s_bit)
972     + r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS);
973     + else
974     + r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS);
975     if (r)
976     return r;
977     +
978     r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2));
979     if (r)
980     return r;
981     + r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
982     + if (r)
983     + return r;
984     + r = zd_rfwritev_cr_locked(chip, rv3, ARRAY_SIZE(rv3));
985     + if (r)
986     + return r;
987     r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3));
988     if (r)
989     return r;
990     @@ -358,12 +421,6 @@ int zd_rf_init_al2230(struct zd_rf *rf)
991     {
992     struct zd_chip *chip = zd_rf_to_chip(rf);
993    
994     - if (chip->al2230s_bit) {
995     - dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
996     - "supported by this driver.\n");
997     - return -ENODEV;
998     - }
999     -
1000     rf->switch_radio_off = al2230_switch_radio_off;
1001     if (chip->is_zd1211b) {
1002     rf->init_hw = zd1211b_al2230_init_hw;
1003     diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1004     index 5af9125..e2d81af 100644
1005     --- a/drivers/pci/quirks.c
1006     +++ b/drivers/pci/quirks.c
1007     @@ -1751,6 +1751,7 @@ static void __init quirk_disable_all_msi(struct pci_dev *dev)
1008     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
1009     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1010     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1011     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1012    
1013     /* Disable MSI on chipsets that are known to not support it */
1014     static void __devinit quirk_disable_msi(struct pci_dev *dev)
1015     diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
1016     index 39ecd0d..1eca9cd 100644
1017     --- a/drivers/scsi/aacraid/aacraid.h
1018     +++ b/drivers/scsi/aacraid/aacraid.h
1019     @@ -1840,6 +1840,7 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype);
1020     int aac_get_adapter_info(struct aac_dev* dev);
1021     int aac_send_shutdown(struct aac_dev *dev);
1022     int aac_probe_container(struct aac_dev *dev, int cid);
1023     +int aac_rx_deliver_producer(struct fib * fib);
1024     extern int numacb;
1025     extern int acbsize;
1026     extern char aac_driver_version[];
1027     diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
1028     index d242e26..4431a5d 100644
1029     --- a/drivers/scsi/aacraid/rx.c
1030     +++ b/drivers/scsi/aacraid/rx.c
1031     @@ -378,7 +378,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
1032     *
1033     * Will send a fib, returning 0 if successful.
1034     */
1035     -static int aac_rx_deliver_producer(struct fib * fib)
1036     +int aac_rx_deliver_producer(struct fib * fib)
1037     {
1038     struct aac_dev *dev = fib->dev;
1039     struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue];
1040     diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
1041     index 6f1a178..06744f0 100644
1042     --- a/drivers/scsi/aacraid/sa.c
1043     +++ b/drivers/scsi/aacraid/sa.c
1044     @@ -5,7 +5,7 @@
1045     * based on the old aacraid driver that is..
1046     * Adaptec aacraid device driver for Linux.
1047     *
1048     - * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com)
1049     + * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
1050     *
1051     * This program is free software; you can redistribute it and/or modify
1052     * it under the terms of the GNU General Public License as published by
1053     @@ -368,6 +368,7 @@ int aac_sa_init(struct aac_dev *dev)
1054     dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
1055     dev->a_ops.adapter_check_health = aac_sa_check_health;
1056     dev->a_ops.adapter_intr = aac_sa_intr;
1057     + dev->a_ops.adapter_deliver = aac_rx_deliver_producer;
1058     dev->a_ops.adapter_ioremap = aac_sa_ioremap;
1059    
1060     /*
1061     diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
1062     index e35d9ab..b45ba53 100644
1063     --- a/drivers/serial/suncore.c
1064     +++ b/drivers/serial/suncore.c
1065     @@ -30,9 +30,9 @@ void
1066     sunserial_console_termios(struct console *con)
1067     {
1068     char mode[16], buf[16], *s;
1069     - char *mode_prop = "ttyX-mode";
1070     - char *cd_prop = "ttyX-ignore-cd";
1071     - char *dtr_prop = "ttyX-rts-dtr-off";
1072     + char mode_prop[] = "ttyX-mode";
1073     + char cd_prop[] = "ttyX-ignore-cd";
1074     + char dtr_prop[] = "ttyX-rts-dtr-off";
1075     char *ssp_console_modes_prop = "ssp-console-modes";
1076     int baud, bits, stop, cflag;
1077     char parity;
1078     diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1079     index 217a3d6..2f17468 100644
1080     --- a/drivers/usb/core/message.c
1081     +++ b/drivers/usb/core/message.c
1082     @@ -221,15 +221,10 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
1083    
1084     if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
1085     USB_ENDPOINT_XFER_INT) {
1086     - int interval;
1087     -
1088     - if (usb_dev->speed == USB_SPEED_HIGH)
1089     - interval = 1 << min(15, ep->desc.bInterval - 1);
1090     - else
1091     - interval = ep->desc.bInterval;
1092     pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30);
1093     usb_fill_int_urb(urb, usb_dev, pipe, data, len,
1094     - usb_api_blocking_completion, NULL, interval);
1095     + usb_api_blocking_completion, NULL,
1096     + ep->desc.bInterval);
1097     } else
1098     usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
1099     usb_api_blocking_completion, NULL);
1100     diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
1101     index 395cced..fec4d25 100644
1102     --- a/drivers/video/neofb.c
1103     +++ b/drivers/video/neofb.c
1104     @@ -1285,34 +1285,36 @@ static int neofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
1105     if (regno >= fb->cmap.len || regno > 255)
1106     return -EINVAL;
1107    
1108     - switch (fb->var.bits_per_pixel) {
1109     - case 8:
1110     + if (fb->var.bits_per_pixel <= 8) {
1111     outb(regno, 0x3c8);
1112    
1113     outb(red >> 10, 0x3c9);
1114     outb(green >> 10, 0x3c9);
1115     outb(blue >> 10, 0x3c9);
1116     - break;
1117     - case 16:
1118     - ((u32 *) fb->pseudo_palette)[regno] =
1119     + } else if (regno < 16) {
1120     + switch (fb->var.bits_per_pixel) {
1121     + case 16:
1122     + ((u32 *) fb->pseudo_palette)[regno] =
1123     ((red & 0xf800)) | ((green & 0xfc00) >> 5) |
1124     ((blue & 0xf800) >> 11);
1125     - break;
1126     - case 24:
1127     - ((u32 *) fb->pseudo_palette)[regno] =
1128     + break;
1129     + case 24:
1130     + ((u32 *) fb->pseudo_palette)[regno] =
1131     ((red & 0xff00) << 8) | ((green & 0xff00)) |
1132     ((blue & 0xff00) >> 8);
1133     - break;
1134     + break;
1135     #ifdef NO_32BIT_SUPPORT_YET
1136     - case 32:
1137     - ((u32 *) fb->pseudo_palette)[regno] =
1138     + case 32:
1139     + ((u32 *) fb->pseudo_palette)[regno] =
1140     ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) |
1141     ((green & 0xff00)) | ((blue & 0xff00) >> 8);
1142     - break;
1143     + break;
1144     #endif
1145     - default:
1146     - return 1;
1147     + default:
1148     + return 1;
1149     + }
1150     }
1151     +
1152     return 0;
1153     }
1154    
1155     diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
1156     index 8b1c5d8..57c3b1c 100644
1157     --- a/fs/compat_ioctl.c
1158     +++ b/fs/compat_ioctl.c
1159     @@ -1178,6 +1178,7 @@ static int vt_check(struct file *file)
1160     {
1161     struct tty_struct *tty;
1162     struct inode *inode = file->f_path.dentry->d_inode;
1163     + struct vc_data *vc;
1164    
1165     if (file->f_op->ioctl != tty_ioctl)
1166     return -EINVAL;
1167     @@ -1188,12 +1189,16 @@ static int vt_check(struct file *file)
1168    
1169     if (tty->driver->ioctl != vt_ioctl)
1170     return -EINVAL;
1171     -
1172     +
1173     + vc = (struct vc_data *)tty->driver_data;
1174     + if (!vc_cons_allocated(vc->vc_num)) /* impossible? */
1175     + return -ENOIOCTLCMD;
1176     +
1177     /*
1178     * To have permissions to do most of the vt ioctls, we either have
1179     - * to be the owner of the tty, or super-user.
1180     + * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
1181     */
1182     - if (current->signal->tty == tty || capable(CAP_SYS_ADMIN))
1183     + if (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))
1184     return 1;
1185     return 0;
1186     }
1187     @@ -1294,16 +1299,28 @@ static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
1188     struct unimapdesc32 tmp;
1189     struct unimapdesc32 __user *user_ud = compat_ptr(arg);
1190     int perm = vt_check(file);
1191     -
1192     - if (perm < 0) return perm;
1193     + struct vc_data *vc;
1194     +
1195     + if (perm < 0)
1196     + return perm;
1197     if (copy_from_user(&tmp, user_ud, sizeof tmp))
1198     return -EFAULT;
1199     + if (tmp.entries)
1200     + if (!access_ok(VERIFY_WRITE, compat_ptr(tmp.entries),
1201     + tmp.entry_ct*sizeof(struct unipair)))
1202     + return -EFAULT;
1203     + vc = ((struct tty_struct *)file->private_data)->driver_data;
1204     switch (cmd) {
1205     case PIO_UNIMAP:
1206     - if (!perm) return -EPERM;
1207     - return con_set_unimap(vc_cons[fg_console].d, tmp.entry_ct, compat_ptr(tmp.entries));
1208     + if (!perm)
1209     + return -EPERM;
1210     + return con_set_unimap(vc, tmp.entry_ct,
1211     + compat_ptr(tmp.entries));
1212     case GIO_UNIMAP:
1213     - return con_get_unimap(vc_cons[fg_console].d, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries));
1214     + if (!perm && fg_console != vc->vc_num)
1215     + return -EPERM;
1216     + return con_get_unimap(vc, tmp.entry_ct, &(user_ud->entry_ct),
1217     + compat_ptr(tmp.entries));
1218     }
1219     return 0;
1220     }
1221     diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
1222     index 8890eba..bd5a772 100644
1223     --- a/fs/fuse/dir.c
1224     +++ b/fs/fuse/dir.c
1225     @@ -485,7 +485,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode,
1226     static int fuse_create(struct inode *dir, struct dentry *entry, int mode,
1227     struct nameidata *nd)
1228     {
1229     - if (nd && (nd->flags & LOOKUP_CREATE)) {
1230     + if (nd && (nd->flags & LOOKUP_OPEN)) {
1231     int err = fuse_create_open(dir, entry, mode, nd);
1232     if (err != -ENOSYS)
1233     return err;
1234     diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
1235     index f8bf8da..461460d 100644
1236     --- a/fs/ntfs/inode.c
1237     +++ b/fs/ntfs/inode.c
1238     @@ -141,7 +141,7 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na)
1239     if (!ni->name)
1240     return -ENOMEM;
1241     memcpy(ni->name, na->name, i);
1242     - ni->name[i] = 0;
1243     + ni->name[na->name_len] = 0;
1244     }
1245     return 0;
1246     }
1247     diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
1248     index 1049f2a..13a7c5b 100644
1249     --- a/include/acpi/acpi_numa.h
1250     +++ b/include/acpi/acpi_numa.h
1251     @@ -11,11 +11,8 @@
1252     #define MAX_PXM_DOMAINS (256) /* Old pxm spec is defined 8 bit */
1253     #endif
1254    
1255     -extern int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS];
1256     -extern int __cpuinitdata node_to_pxm_map[MAX_NUMNODES];
1257     -
1258     -extern int __cpuinit pxm_to_node(int);
1259     -extern int __cpuinit node_to_pxm(int);
1260     +extern int pxm_to_node(int);
1261     +extern int node_to_pxm(int);
1262     extern int __cpuinit acpi_map_pxm_to_node(int);
1263     extern void __cpuinit acpi_unmap_pxm_to_node(int);
1264    
1265     diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h
1266     index ab55ffc..76e4299 100644
1267     --- a/include/asm-sparc64/tsb.h
1268     +++ b/include/asm-sparc64/tsb.h
1269     @@ -271,7 +271,7 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
1270     #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
1271     sethi %hi(swapper_4m_tsb), REG1; \
1272     or REG1, %lo(swapper_4m_tsb), REG1; \
1273     - and TAG, (KERNEL_TSB_NENTRIES - 1), REG2; \
1274     + and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \
1275     sllx REG2, 4, REG2; \
1276     add REG1, REG2, REG2; \
1277     KTSB_LOAD_QUAD(REG2, REG3); \
1278     diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
1279     index 81c07cd..9543a55 100644
1280     --- a/include/linux/bootmem.h
1281     +++ b/include/linux/bootmem.h
1282     @@ -59,6 +59,7 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
1283     unsigned long align,
1284     unsigned long goal,
1285     unsigned long limit);
1286     +extern void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size);
1287    
1288     #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
1289     extern void reserve_bootmem(unsigned long addr, unsigned long size);
1290     diff --git a/include/linux/mii.h b/include/linux/mii.h
1291     index beddc6d..151b7e0 100644
1292     --- a/include/linux/mii.h
1293     +++ b/include/linux/mii.h
1294     @@ -56,8 +56,8 @@
1295     #define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
1296     #define BMSR_RESV 0x00c0 /* Unused... */
1297     #define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */
1298     -#define BMSR_100FULL2 0x0200 /* Can do 100BASE-T2 HDX */
1299     -#define BMSR_100HALF2 0x0400 /* Can do 100BASE-T2 FDX */
1300     +#define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */
1301     +#define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */
1302     #define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
1303     #define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
1304     #define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
1305     diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
1306     index 600308f..db2ba30 100644
1307     --- a/include/linux/pci_ids.h
1308     +++ b/include/linux/pci_ids.h
1309     @@ -1287,6 +1287,7 @@
1310     #define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
1311     #define PCI_DEVICE_ID_VIA_P4M890 0x0327
1312     #define PCI_DEVICE_ID_VIA_VT3336 0x0336
1313     +#define PCI_DEVICE_ID_VIA_VT3351 0x0351
1314     #define PCI_DEVICE_ID_VIA_8371_0 0x0391
1315     #define PCI_DEVICE_ID_VIA_8501_0 0x0501
1316     #define PCI_DEVICE_ID_VIA_82C561 0x0561
1317     @@ -2259,11 +2260,11 @@
1318     #define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
1319     #define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
1320     #define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910
1321     -#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2911
1322     +#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2917
1323     #define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912
1324     #define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913
1325     #define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
1326     -#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2915
1327     +#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919
1328     #define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
1329     #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
1330     #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
1331     diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
1332     index 6db9a4c..dd5a05d 100644
1333     --- a/include/linux/raid/bitmap.h
1334     +++ b/include/linux/raid/bitmap.h
1335     @@ -232,6 +232,7 @@ struct bitmap {
1336     struct page **filemap; /* list of cache pages for the file */
1337     unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
1338     unsigned long file_pages; /* number of pages in the file */
1339     + int last_page_size; /* bytes in the last page */
1340    
1341     unsigned long flags;
1342    
1343     diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
1344     index 2a7b38d..1a76bda 100644
1345     --- a/include/linux/workqueue.h
1346     +++ b/include/linux/workqueue.h
1347     @@ -162,7 +162,7 @@ extern struct workqueue_struct *__create_workqueue(const char *name,
1348     int singlethread,
1349     int freezeable);
1350     #define create_workqueue(name) __create_workqueue((name), 0, 0)
1351     -#define create_freezeable_workqueue(name) __create_workqueue((name), 0, 1)
1352     +#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1)
1353     #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0)
1354    
1355     extern void destroy_workqueue(struct workqueue_struct *wq);
1356     diff --git a/include/net/af_unix.h b/include/net/af_unix.h
1357     index c0398f5..65f49fd 100644
1358     --- a/include/net/af_unix.h
1359     +++ b/include/net/af_unix.h
1360     @@ -62,13 +62,11 @@ struct unix_skb_parms {
1361     #define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
1362     #define UNIXSID(skb) (&UNIXCB((skb)).secid)
1363    
1364     -#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
1365     -#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
1366     -#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock)
1367     -#define unix_state_wlock_nested(s) \
1368     +#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
1369     +#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
1370     +#define unix_state_lock_nested(s) \
1371     spin_lock_nested(&unix_sk(s)->lock, \
1372     SINGLE_DEPTH_NESTING)
1373     -#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
1374    
1375     #ifdef __KERNEL__
1376     /* The AF_UNIX socket */
1377     diff --git a/kernel/sched.c b/kernel/sched.c
1378     index b9a6837..a3993b9 100644
1379     --- a/kernel/sched.c
1380     +++ b/kernel/sched.c
1381     @@ -4545,9 +4545,7 @@ int __sched cond_resched_softirq(void)
1382     BUG_ON(!in_softirq());
1383    
1384     if (need_resched() && system_state == SYSTEM_RUNNING) {
1385     - raw_local_irq_disable();
1386     - _local_bh_enable();
1387     - raw_local_irq_enable();
1388     + local_bh_enable();
1389     __cond_resched();
1390     local_bh_disable();
1391     return 1;
1392     diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
1393     index eadfce2..8001d37 100644
1394     --- a/kernel/time/tick-broadcast.c
1395     +++ b/kernel/time/tick-broadcast.c
1396     @@ -243,11 +243,18 @@ void tick_broadcast_on_off(unsigned long reason, int *oncpu)
1397     {
1398     int cpu = get_cpu();
1399    
1400     - if (cpu == *oncpu)
1401     - tick_do_broadcast_on_off(&reason);
1402     - else
1403     - smp_call_function_single(*oncpu, tick_do_broadcast_on_off,
1404     - &reason, 1, 1);
1405     + if (!cpu_isset(*oncpu, cpu_online_map)) {
1406     + printk(KERN_ERR "tick-braodcast: ignoring broadcast for "
1407     + "offline CPU #%d\n", *oncpu);
1408     + } else {
1409     +
1410     + if (cpu == *oncpu)
1411     + tick_do_broadcast_on_off(&reason);
1412     + else
1413     + smp_call_function_single(*oncpu,
1414     + tick_do_broadcast_on_off,
1415     + &reason, 1, 1);
1416     + }
1417     put_cpu();
1418     }
1419    
1420     diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
1421     index f4fc867..d9a864f 100644
1422     --- a/kernel/time/tick-sched.c
1423     +++ b/kernel/time/tick-sched.c
1424     @@ -167,9 +167,15 @@ void tick_nohz_stop_sched_tick(void)
1425     goto end;
1426    
1427     cpu = smp_processor_id();
1428     - if (unlikely(local_softirq_pending()))
1429     - printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
1430     - local_softirq_pending());
1431     + if (unlikely(local_softirq_pending())) {
1432     + static int ratelimit;
1433     +
1434     + if (ratelimit < 10) {
1435     + printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
1436     + local_softirq_pending());
1437     + ratelimit++;
1438     + }
1439     + }
1440    
1441     now = ktime_get();
1442     /*
1443     diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c
1444     index 1bc4882..73ddbeb 100644
1445     --- a/kernel/time/timer_stats.c
1446     +++ b/kernel/time/timer_stats.c
1447     @@ -117,21 +117,6 @@ static struct entry entries[MAX_ENTRIES];
1448    
1449     static atomic_t overflow_count;
1450    
1451     -static void reset_entries(void)
1452     -{
1453     - nr_entries = 0;
1454     - memset(entries, 0, sizeof(entries));
1455     - atomic_set(&overflow_count, 0);
1456     -}
1457     -
1458     -static struct entry *alloc_entry(void)
1459     -{
1460     - if (nr_entries >= MAX_ENTRIES)
1461     - return NULL;
1462     -
1463     - return entries + nr_entries++;
1464     -}
1465     -
1466     /*
1467     * The entries are in a hash-table, for fast lookup:
1468     */
1469     @@ -149,6 +134,22 @@ static struct entry *alloc_entry(void)
1470    
1471     static struct entry *tstat_hash_table[TSTAT_HASH_SIZE] __read_mostly;
1472    
1473     +static void reset_entries(void)
1474     +{
1475     + nr_entries = 0;
1476     + memset(entries, 0, sizeof(entries));
1477     + memset(tstat_hash_table, 0, sizeof(tstat_hash_table));
1478     + atomic_set(&overflow_count, 0);
1479     +}
1480     +
1481     +static struct entry *alloc_entry(void)
1482     +{
1483     + if (nr_entries >= MAX_ENTRIES)
1484     + return NULL;
1485     +
1486     + return entries + nr_entries++;
1487     +}
1488     +
1489     static int match_entries(struct entry *entry1, struct entry *entry2)
1490     {
1491     return entry1->timer == entry2->timer &&
1492     @@ -202,12 +203,15 @@ static struct entry *tstat_lookup(struct entry *entry, char *comm)
1493     if (curr) {
1494     *curr = *entry;
1495     curr->count = 0;
1496     + curr->next = NULL;
1497     memcpy(curr->comm, comm, TASK_COMM_LEN);
1498     +
1499     + smp_mb(); /* Ensure that curr is initialized before insert */
1500     +
1501     if (prev)
1502     prev->next = curr;
1503     else
1504     *head = curr;
1505     - curr->next = NULL;
1506     }
1507     out_unlock:
1508     spin_unlock(&table_lock);
1509     @@ -232,10 +236,15 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
1510     /*
1511     * It doesnt matter which lock we take:
1512     */
1513     - spinlock_t *lock = &per_cpu(lookup_lock, raw_smp_processor_id());
1514     + spinlock_t *lock;
1515     struct entry *entry, input;
1516     unsigned long flags;
1517    
1518     + if (likely(!active))
1519     + return;
1520     +
1521     + lock = &per_cpu(lookup_lock, raw_smp_processor_id());
1522     +
1523     input.timer = timer;
1524     input.start_func = startf;
1525     input.expire_func = timerf;
1526     @@ -364,6 +373,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf,
1527     if (!active) {
1528     reset_entries();
1529     time_start = ktime_get();
1530     + smp_mb();
1531     active = 1;
1532     }
1533     break;
1534     diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
1535     index 3f3e740..c93a502 100644
1536     --- a/lib/Kconfig.debug
1537     +++ b/lib/Kconfig.debug
1538     @@ -143,7 +143,10 @@ config TIMER_STATS
1539     reprogrammed. The statistics can be read from /proc/timer_stats.
1540     The statistics collection is started by writing 1 to /proc/timer_stats,
1541     writing 0 stops it. This feature is useful to collect information
1542     - about timer usage patterns in kernel and userspace.
1543     + about timer usage patterns in kernel and userspace. This feature
1544     + is lightweight if enabled in the kernel config but not activated
1545     + (it defaults to deactivated on bootup and will only be activated
1546     + if some application like powertop activates it explicitly).
1547    
1548     config DEBUG_SLAB
1549     bool "Debug slab memory allocations"
1550     diff --git a/mm/sparse.c b/mm/sparse.c
1551     index ac26eb0..faa08e2 100644
1552     --- a/mm/sparse.c
1553     +++ b/mm/sparse.c
1554     @@ -209,6 +209,12 @@ static int sparse_init_one_section(struct mem_section *ms,
1555     return 1;
1556     }
1557    
1558     +__attribute__((weak))
1559     +void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
1560     +{
1561     + return NULL;
1562     +}
1563     +
1564     static struct page *sparse_early_mem_map_alloc(unsigned long pnum)
1565     {
1566     struct page *map;
1567     @@ -219,6 +225,11 @@ static struct page *sparse_early_mem_map_alloc(unsigned long pnum)
1568     if (map)
1569     return map;
1570    
1571     + map = alloc_bootmem_high_node(NODE_DATA(nid),
1572     + sizeof(struct page) * PAGES_PER_SECTION);
1573     + if (map)
1574     + return map;
1575     +
1576     map = alloc_bootmem_node(NODE_DATA(nid),
1577     sizeof(struct page) * PAGES_PER_SECTION);
1578     if (map)
1579     diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
1580     index 71f5cfb..2f6e1ea 100644
1581     --- a/net/bluetooth/hci_sock.c
1582     +++ b/net/bluetooth/hci_sock.c
1583     @@ -656,7 +656,8 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
1584     /* Detach sockets from device */
1585     read_lock(&hci_sk_list.lock);
1586     sk_for_each(sk, node, &hci_sk_list.head) {
1587     - lock_sock(sk);
1588     + local_bh_disable();
1589     + bh_lock_sock_nested(sk);
1590     if (hci_pi(sk)->hdev == hdev) {
1591     hci_pi(sk)->hdev = NULL;
1592     sk->sk_err = EPIPE;
1593     @@ -665,7 +666,8 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
1594    
1595     hci_dev_put(hdev);
1596     }
1597     - release_sock(sk);
1598     + bh_unlock_sock(sk);
1599     + local_bh_enable();
1600     }
1601     read_unlock(&hci_sk_list.lock);
1602     }
1603     diff --git a/net/core/dev.c b/net/core/dev.c
1604     index 4dc93cc..0caddcf 100644
1605     --- a/net/core/dev.c
1606     +++ b/net/core/dev.c
1607     @@ -3135,7 +3135,6 @@ void netdev_run_todo(void)
1608     continue;
1609     }
1610    
1611     - netdev_unregister_sysfs(dev);
1612     dev->reg_state = NETREG_UNREGISTERED;
1613    
1614     netdev_wait_allrefs(dev);
1615     @@ -3146,11 +3145,11 @@ void netdev_run_todo(void)
1616     BUG_TRAP(!dev->ip6_ptr);
1617     BUG_TRAP(!dev->dn_ptr);
1618    
1619     - /* It must be the very last action,
1620     - * after this 'dev' may point to freed up memory.
1621     - */
1622     if (dev->destructor)
1623     dev->destructor(dev);
1624     +
1625     + /* Free network device */
1626     + kobject_put(&dev->dev.kobj);
1627     }
1628    
1629     out:
1630     @@ -3305,6 +3304,9 @@ void unregister_netdevice(struct net_device *dev)
1631     /* Notifier chain MUST detach us from master device. */
1632     BUG_TRAP(!dev->master);
1633    
1634     + /* Remove entries from sysfs */
1635     + netdev_unregister_sysfs(dev);
1636     +
1637     /* Finish processing unregister after unlock */
1638     net_set_todo(dev);
1639    
1640     diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
1641     index 4cbb129..1fb7aec 100644
1642     --- a/net/core/net-sysfs.c
1643     +++ b/net/core/net-sysfs.c
1644     @@ -451,9 +451,15 @@ static struct class net_class = {
1645     #endif
1646     };
1647    
1648     +/* Delete sysfs entries but hold kobject reference until after all
1649     + * netdev references are gone.
1650     + */
1651     void netdev_unregister_sysfs(struct net_device * net)
1652     {
1653     - device_del(&(net->dev));
1654     + struct device *dev = &(net->dev);
1655     +
1656     + kobject_get(&dev->kobj);
1657     + device_del(dev);
1658     }
1659    
1660     /* Create sysfs entries for network device. */
1661     diff --git a/net/core/sock.c b/net/core/sock.c
1662     index 27c4f62..a36a965 100644
1663     --- a/net/core/sock.c
1664     +++ b/net/core/sock.c
1665     @@ -204,7 +204,19 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
1666     return -EINVAL;
1667     if (copy_from_user(&tv, optval, sizeof(tv)))
1668     return -EFAULT;
1669     -
1670     + if (tv.tv_usec < 0 || tv.tv_usec >= USEC_PER_SEC)
1671     + return -EDOM;
1672     +
1673     + if (tv.tv_sec < 0) {
1674     + static int warned = 0;
1675     + *timeo_p = 0;
1676     + if (warned < 10 && net_ratelimit())
1677     + warned++;
1678     + printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
1679     + "tries to set negative timeout\n",
1680     + current->comm, current->pid);
1681     + return 0;
1682     + }
1683     *timeo_p = MAX_SCHEDULE_TIMEOUT;
1684     if (tv.tv_sec == 0 && tv.tv_usec == 0)
1685     return 0;
1686     diff --git a/net/core/utils.c b/net/core/utils.c
1687     index 07236c1..24c30c1 100644
1688     --- a/net/core/utils.c
1689     +++ b/net/core/utils.c
1690     @@ -137,16 +137,16 @@ int in4_pton(const char *src, int srclen,
1691     while(1) {
1692     int c;
1693     c = xdigit2bin(srclen > 0 ? *s : '\0', delim);
1694     - if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM))) {
1695     + if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK))) {
1696     goto out;
1697     }
1698     - if (c & (IN6PTON_DOT | IN6PTON_DELIM)) {
1699     + if (c & (IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK)) {
1700     if (w == 0)
1701     goto out;
1702     *d++ = w & 0xff;
1703     w = 0;
1704     i++;
1705     - if (c & IN6PTON_DELIM) {
1706     + if (c & (IN6PTON_DELIM | IN6PTON_COLON_MASK)) {
1707     if (i != 4)
1708     goto out;
1709     break;
1710     diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
1711     index 9e8ef50..5fc4a05 100644
1712     --- a/net/ipv4/Kconfig
1713     +++ b/net/ipv4/Kconfig
1714     @@ -43,11 +43,11 @@ config IP_ADVANCED_ROUTER
1715     asymmetric routing (packets from you to a host take a different path
1716     than packets from that host to you) or if you operate a non-routing
1717     host which has several IP addresses on different interfaces. To turn
1718     - rp_filter off use:
1719     + rp_filter on use:
1720    
1721     - echo 0 > /proc/sys/net/ipv4/conf/<device>/rp_filter
1722     + echo 1 > /proc/sys/net/ipv4/conf/<device>/rp_filter
1723     or
1724     - echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
1725     + echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
1726    
1727     If unsure, say N here.
1728    
1729     diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
1730     index 4b7a0d9..03d9659 100644
1731     --- a/net/ipv4/icmp.c
1732     +++ b/net/ipv4/icmp.c
1733     @@ -513,9 +513,15 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
1734    
1735     saddr = iph->daddr;
1736     if (!(rt->rt_flags & RTCF_LOCAL)) {
1737     - if (sysctl_icmp_errors_use_inbound_ifaddr)
1738     - saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK);
1739     - else
1740     + struct net_device *dev = NULL;
1741     +
1742     + if (rt->fl.iif && sysctl_icmp_errors_use_inbound_ifaddr)
1743     + dev = dev_get_by_index(rt->fl.iif);
1744     +
1745     + if (dev) {
1746     + saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
1747     + dev_put(dev);
1748     + } else
1749     saddr = 0;
1750     }
1751    
1752     diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
1753     index 43fb160..fbe7714 100644
1754     --- a/net/ipv4/inet_connection_sock.c
1755     +++ b/net/ipv4/inet_connection_sock.c
1756     @@ -31,10 +31,8 @@ EXPORT_SYMBOL(inet_csk_timer_bug_msg);
1757    
1758     /*
1759     * This array holds the first and last local port number.
1760     - * For high-usage systems, use sysctl to change this to
1761     - * 32768-61000
1762     */
1763     -int sysctl_local_port_range[2] = { 1024, 4999 };
1764     +int sysctl_local_port_range[2] = { 32768, 61000 };
1765    
1766     int inet_csk_bind_conflict(const struct sock *sk,
1767     const struct inet_bind_bucket *tb)
1768     diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
1769     index 824c6b9..5055190 100644
1770     --- a/net/ipv4/tcp.c
1771     +++ b/net/ipv4/tcp.c
1772     @@ -2445,13 +2445,10 @@ void __init tcp_init(void)
1773     order++)
1774     ;
1775     if (order >= 4) {
1776     - sysctl_local_port_range[0] = 32768;
1777     - sysctl_local_port_range[1] = 61000;
1778     tcp_death_row.sysctl_max_tw_buckets = 180000;
1779     sysctl_tcp_max_orphans = 4096 << (order - 4);
1780     sysctl_max_syn_backlog = 1024;
1781     } else if (order < 3) {
1782     - sysctl_local_port_range[0] = 1024 * (3 - order);
1783     tcp_death_row.sysctl_max_tw_buckets >>= (3 - order);
1784     sysctl_tcp_max_orphans >>= (3 - order);
1785     sysctl_max_syn_backlog = 128;
1786     diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
1787     index 78e80de..9fcf6d8 100644
1788     --- a/net/ipv4/xfrm4_input.c
1789     +++ b/net/ipv4/xfrm4_input.c
1790     @@ -138,10 +138,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
1791     nf_reset(skb);
1792    
1793     if (decaps) {
1794     - if (!(skb->dev->flags&IFF_LOOPBACK)) {
1795     - dst_release(skb->dst);
1796     - skb->dst = NULL;
1797     - }
1798     + dst_release(skb->dst);
1799     + skb->dst = NULL;
1800     netif_rx(skb);
1801     return 0;
1802     } else {
1803     diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
1804     index ceb4376..5115574 100644
1805     --- a/net/ipv4/xfrm4_mode_tunnel.c
1806     +++ b/net/ipv4/xfrm4_mode_tunnel.c
1807     @@ -84,6 +84,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
1808     top_iph->saddr = x->props.saddr.a4;
1809     top_iph->daddr = x->id.daddr.a4;
1810    
1811     + skb->protocol = htons(ETH_P_IP);
1812     +
1813     memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
1814     return 0;
1815     }
1816     diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
1817     index 268f476..5983c54 100644
1818     --- a/net/ipv6/ip6_fib.c
1819     +++ b/net/ipv6/ip6_fib.c
1820     @@ -619,14 +619,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
1821    
1822     ins = &fn->leaf;
1823    
1824     - if (fn->fn_flags&RTN_TL_ROOT &&
1825     - fn->leaf == &ip6_null_entry &&
1826     - !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){
1827     - fn->leaf = rt;
1828     - rt->u.dst.rt6_next = NULL;
1829     - goto out;
1830     - }
1831     -
1832     for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) {
1833     /*
1834     * Search for duplicates
1835     diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
1836     index 31f651f..c53c0d3 100644
1837     --- a/net/ipv6/xfrm6_input.c
1838     +++ b/net/ipv6/xfrm6_input.c
1839     @@ -104,10 +104,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
1840     nf_reset(skb);
1841    
1842     if (decaps) {
1843     - if (!(skb->dev->flags&IFF_LOOPBACK)) {
1844     - dst_release(skb->dst);
1845     - skb->dst = NULL;
1846     - }
1847     + dst_release(skb->dst);
1848     + skb->dst = NULL;
1849     netif_rx(skb);
1850     return -1;
1851     } else {
1852     diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
1853     index 0bc866c..8741bcd 100644
1854     --- a/net/ipv6/xfrm6_mode_tunnel.c
1855     +++ b/net/ipv6/xfrm6_mode_tunnel.c
1856     @@ -80,6 +80,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
1857     top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT);
1858     ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
1859     ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
1860     + skb->protocol = htons(ETH_P_IPV6);
1861     return 0;
1862     }
1863    
1864     diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
1865     index 6069716..f464c43 100644
1866     --- a/net/unix/af_unix.c
1867     +++ b/net/unix/af_unix.c
1868     @@ -175,11 +175,11 @@ static struct sock *unix_peer_get(struct sock *s)
1869     {
1870     struct sock *peer;
1871    
1872     - unix_state_rlock(s);
1873     + unix_state_lock(s);
1874     peer = unix_peer(s);
1875     if (peer)
1876     sock_hold(peer);
1877     - unix_state_runlock(s);
1878     + unix_state_unlock(s);
1879     return peer;
1880     }
1881    
1882     @@ -370,7 +370,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
1883     unix_remove_socket(sk);
1884    
1885     /* Clear state */
1886     - unix_state_wlock(sk);
1887     + unix_state_lock(sk);
1888     sock_orphan(sk);
1889     sk->sk_shutdown = SHUTDOWN_MASK;
1890     dentry = u->dentry;
1891     @@ -379,7 +379,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
1892     u->mnt = NULL;
1893     state = sk->sk_state;
1894     sk->sk_state = TCP_CLOSE;
1895     - unix_state_wunlock(sk);
1896     + unix_state_unlock(sk);
1897    
1898     wake_up_interruptible_all(&u->peer_wait);
1899    
1900     @@ -387,12 +387,12 @@ static int unix_release_sock (struct sock *sk, int embrion)
1901    
1902     if (skpair!=NULL) {
1903     if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
1904     - unix_state_wlock(skpair);
1905     + unix_state_lock(skpair);
1906     /* No more writes */
1907     skpair->sk_shutdown = SHUTDOWN_MASK;
1908     if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
1909     skpair->sk_err = ECONNRESET;
1910     - unix_state_wunlock(skpair);
1911     + unix_state_unlock(skpair);
1912     skpair->sk_state_change(skpair);
1913     read_lock(&skpair->sk_callback_lock);
1914     sk_wake_async(skpair,1,POLL_HUP);
1915     @@ -449,7 +449,7 @@ static int unix_listen(struct socket *sock, int backlog)
1916     err = -EINVAL;
1917     if (!u->addr)
1918     goto out; /* No listens on an unbound socket */
1919     - unix_state_wlock(sk);
1920     + unix_state_lock(sk);
1921     if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
1922     goto out_unlock;
1923     if (backlog > sk->sk_max_ack_backlog)
1924     @@ -463,7 +463,7 @@ static int unix_listen(struct socket *sock, int backlog)
1925     err = 0;
1926    
1927     out_unlock:
1928     - unix_state_wunlock(sk);
1929     + unix_state_unlock(sk);
1930     out:
1931     return err;
1932     }
1933     @@ -859,6 +859,31 @@ out_mknod_parent:
1934     goto out_up;
1935     }
1936    
1937     +static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)
1938     +{
1939     + if (unlikely(sk1 == sk2) || !sk2) {
1940     + unix_state_lock(sk1);
1941     + return;
1942     + }
1943     + if (sk1 < sk2) {
1944     + unix_state_lock(sk1);
1945     + unix_state_lock_nested(sk2);
1946     + } else {
1947     + unix_state_lock(sk2);
1948     + unix_state_lock_nested(sk1);
1949     + }
1950     +}
1951     +
1952     +static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
1953     +{
1954     + if (unlikely(sk1 == sk2) || !sk2) {
1955     + unix_state_unlock(sk1);
1956     + return;
1957     + }
1958     + unix_state_unlock(sk1);
1959     + unix_state_unlock(sk2);
1960     +}
1961     +
1962     static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
1963     int alen, int flags)
1964     {
1965     @@ -878,11 +903,19 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
1966     !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0)
1967     goto out;
1968    
1969     +restart:
1970     other=unix_find_other(sunaddr, alen, sock->type, hash, &err);
1971     if (!other)
1972     goto out;
1973    
1974     - unix_state_wlock(sk);
1975     + unix_state_double_lock(sk, other);
1976     +
1977     + /* Apparently VFS overslept socket death. Retry. */
1978     + if (sock_flag(other, SOCK_DEAD)) {
1979     + unix_state_double_unlock(sk, other);
1980     + sock_put(other);
1981     + goto restart;
1982     + }
1983    
1984     err = -EPERM;
1985     if (!unix_may_send(sk, other))
1986     @@ -897,7 +930,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
1987     * 1003.1g breaking connected state with AF_UNSPEC
1988     */
1989     other = NULL;
1990     - unix_state_wlock(sk);
1991     + unix_state_double_lock(sk, other);
1992     }
1993    
1994     /*
1995     @@ -906,19 +939,19 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
1996     if (unix_peer(sk)) {
1997     struct sock *old_peer = unix_peer(sk);
1998     unix_peer(sk)=other;
1999     - unix_state_wunlock(sk);
2000     + unix_state_double_unlock(sk, other);
2001    
2002     if (other != old_peer)
2003     unix_dgram_disconnected(sk, old_peer);
2004     sock_put(old_peer);
2005     } else {
2006     unix_peer(sk)=other;
2007     - unix_state_wunlock(sk);
2008     + unix_state_double_unlock(sk, other);
2009     }
2010     return 0;
2011    
2012     out_unlock:
2013     - unix_state_wunlock(sk);
2014     + unix_state_double_unlock(sk, other);
2015     sock_put(other);
2016     out:
2017     return err;
2018     @@ -937,7 +970,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
2019     (skb_queue_len(&other->sk_receive_queue) >
2020     other->sk_max_ack_backlog);
2021    
2022     - unix_state_runlock(other);
2023     + unix_state_unlock(other);
2024    
2025     if (sched)
2026     timeo = schedule_timeout(timeo);
2027     @@ -995,11 +1028,11 @@ restart:
2028     goto out;
2029    
2030     /* Latch state of peer */
2031     - unix_state_rlock(other);
2032     + unix_state_lock(other);
2033    
2034     /* Apparently VFS overslept socket death. Retry. */
2035     if (sock_flag(other, SOCK_DEAD)) {
2036     - unix_state_runlock(other);
2037     + unix_state_unlock(other);
2038     sock_put(other);
2039     goto restart;
2040     }
2041     @@ -1049,18 +1082,18 @@ restart:
2042     goto out_unlock;
2043     }
2044    
2045     - unix_state_wlock_nested(sk);
2046     + unix_state_lock_nested(sk);
2047    
2048     if (sk->sk_state != st) {
2049     - unix_state_wunlock(sk);
2050     - unix_state_runlock(other);
2051     + unix_state_unlock(sk);
2052     + unix_state_unlock(other);
2053     sock_put(other);
2054     goto restart;
2055     }
2056    
2057     err = security_unix_stream_connect(sock, other->sk_socket, newsk);
2058     if (err) {
2059     - unix_state_wunlock(sk);
2060     + unix_state_unlock(sk);
2061     goto out_unlock;
2062     }
2063    
2064     @@ -1097,7 +1130,7 @@ restart:
2065     smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */
2066     unix_peer(sk) = newsk;
2067    
2068     - unix_state_wunlock(sk);
2069     + unix_state_unlock(sk);
2070    
2071     /* take ten and and send info to listening sock */
2072     spin_lock(&other->sk_receive_queue.lock);
2073     @@ -1106,14 +1139,14 @@ restart:
2074     * is installed to listening socket. */
2075     atomic_inc(&newu->inflight);
2076     spin_unlock(&other->sk_receive_queue.lock);
2077     - unix_state_runlock(other);
2078     + unix_state_unlock(other);
2079     other->sk_data_ready(other, 0);
2080     sock_put(other);
2081     return 0;
2082    
2083     out_unlock:
2084     if (other)
2085     - unix_state_runlock(other);
2086     + unix_state_unlock(other);
2087    
2088     out:
2089     if (skb)
2090     @@ -1179,10 +1212,10 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags)
2091     wake_up_interruptible(&unix_sk(sk)->peer_wait);
2092    
2093     /* attach accepted sock to socket */
2094     - unix_state_wlock(tsk);
2095     + unix_state_lock(tsk);
2096     newsock->state = SS_CONNECTED;
2097     sock_graft(tsk, newsock);
2098     - unix_state_wunlock(tsk);
2099     + unix_state_unlock(tsk);
2100     return 0;
2101    
2102     out:
2103     @@ -1209,7 +1242,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
2104     }
2105    
2106     u = unix_sk(sk);
2107     - unix_state_rlock(sk);
2108     + unix_state_lock(sk);
2109     if (!u->addr) {
2110     sunaddr->sun_family = AF_UNIX;
2111     sunaddr->sun_path[0] = 0;
2112     @@ -1220,7 +1253,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
2113     *uaddr_len = addr->len;
2114     memcpy(sunaddr, addr->name, *uaddr_len);
2115     }
2116     - unix_state_runlock(sk);
2117     + unix_state_unlock(sk);
2118     sock_put(sk);
2119     out:
2120     return err;
2121     @@ -1338,7 +1371,7 @@ restart:
2122     goto out_free;
2123     }
2124    
2125     - unix_state_rlock(other);
2126     + unix_state_lock(other);
2127     err = -EPERM;
2128     if (!unix_may_send(sk, other))
2129     goto out_unlock;
2130     @@ -1348,20 +1381,20 @@ restart:
2131     * Check with 1003.1g - what should
2132     * datagram error
2133     */
2134     - unix_state_runlock(other);
2135     + unix_state_unlock(other);
2136     sock_put(other);
2137    
2138     err = 0;
2139     - unix_state_wlock(sk);
2140     + unix_state_lock(sk);
2141     if (unix_peer(sk) == other) {
2142     unix_peer(sk)=NULL;
2143     - unix_state_wunlock(sk);
2144     + unix_state_unlock(sk);
2145    
2146     unix_dgram_disconnected(sk, other);
2147     sock_put(other);
2148     err = -ECONNREFUSED;
2149     } else {
2150     - unix_state_wunlock(sk);
2151     + unix_state_unlock(sk);
2152     }
2153    
2154     other = NULL;
2155     @@ -1398,14 +1431,14 @@ restart:
2156     }
2157    
2158     skb_queue_tail(&other->sk_receive_queue, skb);
2159     - unix_state_runlock(other);
2160     + unix_state_unlock(other);
2161     other->sk_data_ready(other, len);
2162     sock_put(other);
2163     scm_destroy(siocb->scm);
2164     return len;
2165    
2166     out_unlock:
2167     - unix_state_runlock(other);
2168     + unix_state_unlock(other);
2169     out_free:
2170     kfree_skb(skb);
2171     out:
2172     @@ -1495,14 +1528,14 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
2173     goto out_err;
2174     }
2175    
2176     - unix_state_rlock(other);
2177     + unix_state_lock(other);
2178    
2179     if (sock_flag(other, SOCK_DEAD) ||
2180     (other->sk_shutdown & RCV_SHUTDOWN))
2181     goto pipe_err_free;
2182    
2183     skb_queue_tail(&other->sk_receive_queue, skb);
2184     - unix_state_runlock(other);
2185     + unix_state_unlock(other);
2186     other->sk_data_ready(other, size);
2187     sent+=size;
2188     }
2189     @@ -1513,7 +1546,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
2190     return sent;
2191    
2192     pipe_err_free:
2193     - unix_state_runlock(other);
2194     + unix_state_unlock(other);
2195     kfree_skb(skb);
2196     pipe_err:
2197     if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL))
2198     @@ -1642,7 +1675,7 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
2199     {
2200     DEFINE_WAIT(wait);
2201    
2202     - unix_state_rlock(sk);
2203     + unix_state_lock(sk);
2204    
2205     for (;;) {
2206     prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
2207     @@ -1655,14 +1688,14 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
2208     break;
2209    
2210     set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
2211     - unix_state_runlock(sk);
2212     + unix_state_unlock(sk);
2213     timeo = schedule_timeout(timeo);
2214     - unix_state_rlock(sk);
2215     + unix_state_lock(sk);
2216     clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
2217     }
2218    
2219     finish_wait(sk->sk_sleep, &wait);
2220     - unix_state_runlock(sk);
2221     + unix_state_unlock(sk);
2222     return timeo;
2223     }
2224    
2225     @@ -1817,12 +1850,12 @@ static int unix_shutdown(struct socket *sock, int mode)
2226     mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN);
2227    
2228     if (mode) {
2229     - unix_state_wlock(sk);
2230     + unix_state_lock(sk);
2231     sk->sk_shutdown |= mode;
2232     other=unix_peer(sk);
2233     if (other)
2234     sock_hold(other);
2235     - unix_state_wunlock(sk);
2236     + unix_state_unlock(sk);
2237     sk->sk_state_change(sk);
2238    
2239     if (other &&
2240     @@ -1834,9 +1867,9 @@ static int unix_shutdown(struct socket *sock, int mode)
2241     peer_mode |= SEND_SHUTDOWN;
2242     if (mode&SEND_SHUTDOWN)
2243     peer_mode |= RCV_SHUTDOWN;
2244     - unix_state_wlock(other);
2245     + unix_state_lock(other);
2246     other->sk_shutdown |= peer_mode;
2247     - unix_state_wunlock(other);
2248     + unix_state_unlock(other);
2249     other->sk_state_change(other);
2250     read_lock(&other->sk_callback_lock);
2251     if (peer_mode == SHUTDOWN_MASK)
2252     @@ -1974,7 +2007,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
2253     else {
2254     struct sock *s = v;
2255     struct unix_sock *u = unix_sk(s);
2256     - unix_state_rlock(s);
2257     + unix_state_lock(s);
2258    
2259     seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu",
2260     s,
2261     @@ -2002,7 +2035,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
2262     for ( ; i < len; i++)
2263     seq_putc(seq, u->addr->name->sun_path[i]);
2264     }
2265     - unix_state_runlock(s);
2266     + unix_state_unlock(s);
2267     seq_putc(seq, '\n');
2268     }
2269    
2270     diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
2271     index 1672cac..632da27 100644
2272     --- a/sound/pci/hda/hda_intel.c
2273     +++ b/sound/pci/hda/hda_intel.c
2274     @@ -198,6 +198,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
2275     #define RIRB_INT_MASK 0x05
2276    
2277     /* STATESTS int mask: SD2,SD1,SD0 */
2278     +#define AZX_MAX_CODECS 3
2279     #define STATESTS_INT_MASK 0x07
2280    
2281     /* SD_CTL bits */
2282     @@ -978,7 +979,7 @@ static unsigned int azx_max_codecs[] __devinitdata = {
2283     static int __devinit azx_codec_create(struct azx *chip, const char *model)
2284     {
2285     struct hda_bus_template bus_temp;
2286     - int c, codecs, err;
2287     + int c, codecs, audio_codecs, err;
2288    
2289     memset(&bus_temp, 0, sizeof(bus_temp));
2290     bus_temp.private_data = chip;
2291     @@ -990,16 +991,30 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model)
2292     if ((err = snd_hda_bus_new(chip->card, &bus_temp, &chip->bus)) < 0)
2293     return err;
2294    
2295     - codecs = 0;
2296     - for (c = 0; c < azx_max_codecs[chip->driver_type]; c++) {
2297     + codecs = audio_codecs = 0;
2298     + for (c = 0; c < AZX_MAX_CODECS; c++) {
2299     if ((chip->codec_mask & (1 << c)) & probe_mask) {
2300     - err = snd_hda_codec_new(chip->bus, c, NULL);
2301     + struct hda_codec *codec;
2302     + err = snd_hda_codec_new(chip->bus, c, &codec);
2303     if (err < 0)
2304     continue;
2305     codecs++;
2306     + if (codec->afg)
2307     + audio_codecs++;
2308     }
2309     }
2310     - if (! codecs) {
2311     + if (!audio_codecs) {
2312     + /* probe additional slots if no codec is found */
2313     + for (; c < azx_max_codecs[chip->driver_type]; c++) {
2314     + if ((chip->codec_mask & (1 << c)) & probe_mask) {
2315     + err = snd_hda_codec_new(chip->bus, c, NULL);
2316     + if (err < 0)
2317     + continue;
2318     + codecs++;
2319     + }
2320     + }
2321     + }
2322     + if (!codecs) {
2323     snd_printk(KERN_ERR SFX "no codecs initialized\n");
2324     return -ENXIO;
2325     }
2326     diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
2327     index 7073e8e..28684ee 100644
2328     --- a/sound/soc/codecs/wm8750.c
2329     +++ b/sound/soc/codecs/wm8750.c
2330     @@ -808,7 +808,7 @@ static int wm8750_init(struct snd_soc_device *socdev)
2331     codec->dai = &wm8750_dai;
2332     codec->num_dai = 1;
2333     codec->reg_cache_size = sizeof(wm8750_reg);
2334     - codec->reg_cache = kmemdup(wm8750_reg, sizeof(wm8750_reg), GFP_KRENEL);
2335     + codec->reg_cache = kmemdup(wm8750_reg, sizeof(wm8750_reg), GFP_KERNEL);
2336     if (codec->reg_cache == NULL)
2337     return -ENOMEM;
2338    
2339     diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
2340     index 8582620..8fcbe93 100644
2341     --- a/sound/usb/usbquirks.h
2342     +++ b/sound/usb/usbquirks.h
2343     @@ -40,6 +40,29 @@
2344     .bInterfaceClass = USB_CLASS_VENDOR_SPEC
2345    
2346     /*
2347     + * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface
2348     + * class matches do not take effect without an explicit ID match.
2349     + */
2350     +{
2351     + .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2352     + USB_DEVICE_ID_MATCH_INT_CLASS |
2353     + USB_DEVICE_ID_MATCH_INT_SUBCLASS,
2354     + .idVendor = 0x046d,
2355     + .idProduct = 0x08f0,
2356     + .bInterfaceClass = USB_CLASS_AUDIO,
2357     + .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
2358     +},
2359     +{
2360     + .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2361     + USB_DEVICE_ID_MATCH_INT_CLASS |
2362     + USB_DEVICE_ID_MATCH_INT_SUBCLASS,
2363     + .idVendor = 0x046d,
2364     + .idProduct = 0x08f6,
2365     + .bInterfaceClass = USB_CLASS_AUDIO,
2366     + .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
2367     +},
2368     +
2369     +/*
2370     * Yamaha devices
2371     */
2372