Magellan Linux

Annotation of /trunk/kernel26-alx/patches-2.6.27-r3/0108-2.6.27.9-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1176 - (hide annotations) (download)
Thu Oct 14 15:11:06 2010 UTC (13 years, 7 months ago) by niro
File size: 106337 byte(s)
-2.6.27-alx-r3: new magellan 0.5.2 kernel
1 niro 1176 diff --git a/arch/powerpc/kernel/cpu_setup_44x.S b/arch/powerpc/kernel/cpu_setup_44x.S
2     index 80cac98..f812452 100644
3     --- a/arch/powerpc/kernel/cpu_setup_44x.S
4     +++ b/arch/powerpc/kernel/cpu_setup_44x.S
5     @@ -35,6 +35,7 @@ _GLOBAL(__setup_cpu_440grx)
6     _GLOBAL(__setup_cpu_460ex)
7     _GLOBAL(__setup_cpu_460gt)
8     b __init_fpu_44x
9     +_GLOBAL(__setup_cpu_440x5)
10     _GLOBAL(__setup_cpu_440gx)
11     _GLOBAL(__setup_cpu_440spe)
12     b __fixup_440A_mcheck
13     diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
14     index 25c273c..2b88cae 100644
15     --- a/arch/powerpc/kernel/cputable.c
16     +++ b/arch/powerpc/kernel/cputable.c
17     @@ -39,6 +39,7 @@ extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
18     extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec);
19     extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);
20     extern void __setup_cpu_440spe(unsigned long offset, struct cpu_spec* spec);
21     +extern void __setup_cpu_440x5(unsigned long offset, struct cpu_spec* spec);
22     extern void __setup_cpu_460ex(unsigned long offset, struct cpu_spec* spec);
23     extern void __setup_cpu_460gt(unsigned long offset, struct cpu_spec* spec);
24     extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
25     @@ -1463,6 +1464,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
26     .cpu_user_features = COMMON_USER_BOOKE,
27     .icache_bsize = 32,
28     .dcache_bsize = 32,
29     + .cpu_setup = __setup_cpu_440x5,
30     + .machine_check = machine_check_440A,
31     .platform = "ppc440",
32     },
33     { /* 460EX */
34     diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
35     index efb3964..c0d86e1 100644
36     --- a/arch/powerpc/platforms/cell/smp.c
37     +++ b/arch/powerpc/platforms/cell/smp.c
38     @@ -54,8 +54,8 @@
39     #endif
40    
41     /*
42     - * The primary thread of each non-boot processor is recorded here before
43     - * smp init.
44     + * The Primary thread of each non-boot processor was started from the OF client
45     + * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
46     */
47     static cpumask_t of_spin_map;
48    
49     @@ -208,11 +208,7 @@ void __init smp_init_cell(void)
50     /* Mark threads which are still spinning in hold loops. */
51     if (cpu_has_feature(CPU_FTR_SMT)) {
52     for_each_present_cpu(i) {
53     - if (i % 2 == 0)
54     - /*
55     - * Even-numbered logical cpus correspond to
56     - * primary threads.
57     - */
58     + if (cpu_thread_in_core(i) == 0)
59     cpu_set(i, of_spin_map);
60     }
61     } else {
62     diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
63     index 9d8f8c8..c9337c7 100644
64     --- a/arch/powerpc/platforms/pseries/smp.c
65     +++ b/arch/powerpc/platforms/pseries/smp.c
66     @@ -52,8 +52,8 @@
67    
68    
69     /*
70     - * The primary thread of each non-boot processor is recorded here before
71     - * smp init.
72     + * The Primary thread of each non-boot processor was started from the OF client
73     + * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
74     */
75     static cpumask_t of_spin_map;
76    
77     @@ -191,8 +191,7 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
78     static int smp_pSeries_cpu_bootable(unsigned int nr)
79     {
80     /* Special case - we inhibit secondary thread startup
81     - * during boot if the user requests it. Odd-numbered
82     - * cpus are assumed to be secondary threads.
83     + * during boot if the user requests it.
84     */
85     if (system_state < SYSTEM_RUNNING &&
86     cpu_has_feature(CPU_FTR_SMT) &&
87     @@ -229,11 +228,7 @@ static void __init smp_init_pseries(void)
88     /* Mark threads which are still spinning in hold loops. */
89     if (cpu_has_feature(CPU_FTR_SMT)) {
90     for_each_present_cpu(i) {
91     - if (i % 2 == 0)
92     - /*
93     - * Even-numbered logical cpus correspond to
94     - * primary threads.
95     - */
96     + if (cpu_thread_in_core(i) == 0)
97     cpu_set(i, of_spin_map);
98     }
99     } else {
100     diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
101     index f6299cc..b24e1d0 100644
102     --- a/arch/powerpc/sysdev/mpic.c
103     +++ b/arch/powerpc/sysdev/mpic.c
104     @@ -1271,6 +1271,7 @@ void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count)
105     void __init mpic_init(struct mpic *mpic)
106     {
107     int i;
108     + int cpu;
109    
110     BUG_ON(mpic->num_sources == 0);
111    
112     @@ -1313,6 +1314,11 @@ void __init mpic_init(struct mpic *mpic)
113    
114     mpic_pasemi_msi_init(mpic);
115    
116     + if (mpic->flags & MPIC_PRIMARY)
117     + cpu = hard_smp_processor_id();
118     + else
119     + cpu = 0;
120     +
121     for (i = 0; i < mpic->num_sources; i++) {
122     /* start with vector = source number, and masked */
123     u32 vecpri = MPIC_VECPRI_MASK | i |
124     @@ -1323,8 +1329,7 @@ void __init mpic_init(struct mpic *mpic)
125     continue;
126     /* init hw */
127     mpic_irq_write(i, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
128     - mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION),
129     - 1 << hard_smp_processor_id());
130     + mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
131     }
132    
133     /* Init spurious vector */
134     diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
135     index 296ef30..c64e767 100644
136     --- a/arch/sparc/include/asm/uaccess_64.h
137     +++ b/arch/sparc/include/asm/uaccess_64.h
138     @@ -265,8 +265,8 @@ extern long __strnlen_user(const char __user *, long len);
139    
140     #define strlen_user __strlen_user
141     #define strnlen_user __strnlen_user
142     -#define __copy_to_user_inatomic __copy_to_user
143     -#define __copy_from_user_inatomic __copy_from_user
144     +#define __copy_to_user_inatomic ___copy_to_user
145     +#define __copy_from_user_inatomic ___copy_from_user
146    
147     #endif /* __ASSEMBLY__ */
148    
149     diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
150     index 80dad76..83b4725 100644
151     --- a/arch/sparc64/kernel/pci.c
152     +++ b/arch/sparc64/kernel/pci.c
153     @@ -1017,6 +1017,7 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
154    
155     for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
156     struct resource *rp = &pdev->resource[i];
157     + resource_size_t aligned_end;
158    
159     /* Active? */
160     if (!rp->flags)
161     @@ -1034,8 +1035,15 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
162     continue;
163     }
164    
165     + /* Align the resource end to the next page address.
166     + * PAGE_SIZE intentionally added instead of (PAGE_SIZE - 1),
167     + * because actually we need the address of the next byte
168     + * after rp->end.
169     + */
170     + aligned_end = (rp->end + PAGE_SIZE) & PAGE_MASK;
171     +
172     if ((rp->start <= user_paddr) &&
173     - (user_paddr + user_size) <= (rp->end + 1UL))
174     + (user_paddr + user_size) <= aligned_end)
175     break;
176     }
177    
178     diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
179     index 10306e4..2df5b9b 100644
180     --- a/arch/sparc64/kernel/ptrace.c
181     +++ b/arch/sparc64/kernel/ptrace.c
182     @@ -1014,7 +1014,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
183     break;
184    
185     case PTRACE_SETFPREGS64:
186     - ret = copy_regset_to_user(child, view, REGSET_FP,
187     + ret = copy_regset_from_user(child, view, REGSET_FP,
188     0 * sizeof(u64),
189     33 * sizeof(u64),
190     fps);
191     diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc64/kernel/visemul.c
192     index c3fd647..a4428fd 100644
193     --- a/arch/sparc64/kernel/visemul.c
194     +++ b/arch/sparc64/kernel/visemul.c
195     @@ -131,7 +131,7 @@
196     #define VIS_OPF_SHIFT 5
197     #define VIS_OPF_MASK (0x1ff << VIS_OPF_SHIFT)
198    
199     -#define RS1(INSN) (((INSN) >> 24) & 0x1f)
200     +#define RS1(INSN) (((INSN) >> 14) & 0x1f)
201     #define RS2(INSN) (((INSN) >> 0) & 0x1f)
202     #define RD(INSN) (((INSN) >> 25) & 0x1f)
203    
204     @@ -445,7 +445,7 @@ static void pdist(struct pt_regs *regs, unsigned int insn)
205     unsigned long i;
206    
207     rs1 = fpd_regval(f, RS1(insn));
208     - rs2 = fpd_regval(f, RS1(insn));
209     + rs2 = fpd_regval(f, RS2(insn));
210     rd = fpd_regaddr(f, RD(insn));
211    
212     rd_val = *rd;
213     @@ -807,6 +807,8 @@ int vis_emul(struct pt_regs *regs, unsigned int insn)
214     if (get_user(insn, (u32 __user *) pc))
215     return -EFAULT;
216    
217     + save_and_clear_fpu();
218     +
219     opf = (insn & VIS_OPF_MASK) >> VIS_OPF_SHIFT;
220     switch (opf) {
221     default:
222     diff --git a/arch/sparc64/lib/user_fixup.c b/arch/sparc64/lib/user_fixup.c
223     index 19d1fdb..05a361b 100644
224     --- a/arch/sparc64/lib/user_fixup.c
225     +++ b/arch/sparc64/lib/user_fixup.c
226     @@ -24,7 +24,7 @@ static unsigned long compute_size(unsigned long start, unsigned long size, unsig
227     if (fault_addr < start || fault_addr >= end) {
228     *offset = 0;
229     } else {
230     - *offset = start - fault_addr;
231     + *offset = fault_addr - start;
232     size = end - fault_addr;
233     }
234     return size;
235     diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
236     index 19d579d..8f44ebb 100644
237     --- a/arch/um/drivers/mconsole_kern.c
238     +++ b/arch/um/drivers/mconsole_kern.c
239     @@ -16,6 +16,8 @@
240     #include <linux/slab.h>
241     #include <linux/syscalls.h>
242     #include <linux/utsname.h>
243     +#include <linux/socket.h>
244     +#include <linux/un.h>
245     #include <linux/workqueue.h>
246     #include <linux/mutex.h>
247     #include <asm/uaccess.h>
248     @@ -785,7 +787,7 @@ static int __init mconsole_init(void)
249     /* long to avoid size mismatch warnings from gcc */
250     long sock;
251     int err;
252     - char file[256];
253     + char file[UNIX_PATH_MAX];
254    
255     if (umid_file_name("mconsole", file, sizeof(file)))
256     return -1;
257     diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
258     index 73deaff..759e8da 100644
259     --- a/arch/x86/kernel/hpet.c
260     +++ b/arch/x86/kernel/hpet.c
261     @@ -283,7 +283,7 @@ static int hpet_legacy_next_event(unsigned long delta,
262     * what we wrote hit the chip before we compare it to the
263     * counter.
264     */
265     - WARN_ON((u32)hpet_readl(HPET_T0_CMP) != cnt);
266     + WARN_ON_ONCE((u32)hpet_readl(HPET_T0_CMP) != cnt);
267    
268     return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0;
269     }
270     diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
271     index d3746ef..1adbb3e 100644
272     --- a/arch/x86/mm/init_64.c
273     +++ b/arch/x86/mm/init_64.c
274     @@ -721,12 +721,12 @@ int arch_add_memory(int nid, u64 start, u64 size)
275     unsigned long nr_pages = size >> PAGE_SHIFT;
276     int ret;
277    
278     - last_mapped_pfn = init_memory_mapping(start, start + size-1);
279     + last_mapped_pfn = init_memory_mapping(start, start + size);
280     if (last_mapped_pfn > max_pfn_mapped)
281     max_pfn_mapped = last_mapped_pfn;
282    
283     ret = __add_pages(zone, start_pfn, nr_pages);
284     - WARN_ON(1);
285     + WARN_ON_ONCE(ret);
286    
287     return ret;
288     }
289     diff --git a/block/bsg.c b/block/bsg.c
290     index 0aae8d7..9cfbea8 100644
291     --- a/block/bsg.c
292     +++ b/block/bsg.c
293     @@ -202,6 +202,8 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
294     rq->timeout = q->sg_timeout;
295     if (!rq->timeout)
296     rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
297     + if (rq->timeout < BLK_MIN_SG_TIMEOUT)
298     + rq->timeout = BLK_MIN_SG_TIMEOUT;
299    
300     return 0;
301     }
302     diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
303     index ec4b7f2..dd3281a 100644
304     --- a/block/scsi_ioctl.c
305     +++ b/block/scsi_ioctl.c
306     @@ -208,6 +208,8 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
307     rq->timeout = q->sg_timeout;
308     if (!rq->timeout)
309     rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
310     + if (rq->timeout < BLK_MIN_SG_TIMEOUT)
311     + rq->timeout = BLK_MIN_SG_TIMEOUT;
312    
313     return 0;
314     }
315     diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
316     index 235a138..b0d40aa 100644
317     --- a/drivers/acpi/osl.c
318     +++ b/drivers/acpi/osl.c
319     @@ -1261,34 +1261,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
320     return (AE_OK);
321     }
322    
323     -/**
324     - * acpi_dmi_dump - dump DMI slots needed for blacklist entry
325     - *
326     - * Returns 0 on success
327     - */
328     -static int acpi_dmi_dump(void)
329     -{
330     -
331     - if (!dmi_available)
332     - return -1;
333     -
334     - printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
335     - dmi_get_system_info(DMI_SYS_VENDOR));
336     - printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
337     - dmi_get_system_info(DMI_PRODUCT_NAME));
338     - printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
339     - dmi_get_system_info(DMI_PRODUCT_VERSION));
340     - printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
341     - dmi_get_system_info(DMI_BOARD_NAME));
342     - printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
343     - dmi_get_system_info(DMI_BIOS_VENDOR));
344     - printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
345     - dmi_get_system_info(DMI_BIOS_DATE));
346     -
347     - return 0;
348     -}
349     -
350     -
351     /******************************************************************************
352     *
353     * FUNCTION: acpi_os_validate_interface
354     @@ -1315,14 +1287,6 @@ acpi_os_validate_interface (char *interface)
355     osi_linux.cmdline ? " via cmdline" :
356     osi_linux.dmi ? " via DMI" : "");
357    
358     - if (!osi_linux.dmi) {
359     - if (acpi_dmi_dump())
360     - printk(KERN_NOTICE PREFIX
361     - "[please extract dmidecode output]\n");
362     - printk(KERN_NOTICE PREFIX
363     - "Please send DMI info above to "
364     - "linux-acpi@vger.kernel.org\n");
365     - }
366     if (!osi_linux.known && !osi_linux.cmdline) {
367     printk(KERN_NOTICE PREFIX
368     "If \"acpi_osi=%sLinux\" works better, "
369     diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
370     index 4751909..3706469 100644
371     --- a/drivers/acpi/sleep/main.c
372     +++ b/drivers/acpi/sleep/main.c
373     @@ -60,6 +60,18 @@ void __init acpi_old_suspend_ordering(void)
374     old_suspend_ordering = true;
375     }
376    
377     +/*
378     + * According to the ACPI specification the BIOS should make sure that ACPI is
379     + * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
380     + * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
381     + * on such systems during resume. Unfortunately that doesn't help in
382     + * particularly pathological cases in which SCI_EN has to be set directly on
383     + * resume, although the specification states very clearly that this flag is
384     + * owned by the hardware. The set_sci_en_on_resume variable will be set in such
385     + * cases.
386     + */
387     +static bool set_sci_en_on_resume;
388     +
389     /**
390     * acpi_pm_disable_gpes - Disable the GPEs.
391     */
392     @@ -201,7 +213,11 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
393     }
394    
395     /* If ACPI is not enabled by the BIOS, we need to enable it here. */
396     - acpi_enable();
397     + if (set_sci_en_on_resume)
398     + acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1);
399     + else
400     + acpi_enable();
401     +
402     /* Reprogram control registers and execute _BFS */
403     acpi_leave_sleep_state_prep(acpi_state);
404    
405     @@ -289,6 +305,12 @@ static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
406     return 0;
407     }
408    
409     +static int __init init_set_sci_en_on_resume(const struct dmi_system_id *d)
410     +{
411     + set_sci_en_on_resume = true;
412     + return 0;
413     +}
414     +
415     static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
416     {
417     .callback = init_old_suspend_ordering,
418     @@ -306,6 +328,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
419     DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
420     },
421     },
422     + {
423     + .callback = init_set_sci_en_on_resume,
424     + .ident = "Apple MacBook 1,1",
425     + .matches = {
426     + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
427     + DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),
428     + },
429     + },
430     + {
431     + .callback = init_set_sci_en_on_resume,
432     + .ident = "Apple MacMini 1,1",
433     + .matches = {
434     + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
435     + DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
436     + },
437     + },
438     {},
439     };
440     #endif /* CONFIG_SUSPEND */
441     diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
442     index 2a4c516..bb26a26 100644
443     --- a/drivers/ata/libata-sff.c
444     +++ b/drivers/ata/libata-sff.c
445     @@ -1227,10 +1227,19 @@ fsm_start:
446     /* ATA PIO protocol */
447     if (unlikely((status & ATA_DRQ) == 0)) {
448     /* handle BSY=0, DRQ=0 as error */
449     - if (likely(status & (ATA_ERR | ATA_DF)))
450     + if (likely(status & (ATA_ERR | ATA_DF))) {
451     /* device stops HSM for abort/error */
452     qc->err_mask |= AC_ERR_DEV;
453     - else {
454     +
455     + /* If diagnostic failed and this is
456     + * IDENTIFY, it's likely a phantom
457     + * device. Mark hint.
458     + */
459     + if (qc->dev->horkage &
460     + ATA_HORKAGE_DIAGNOSTIC)
461     + qc->err_mask |=
462     + AC_ERR_NODEV_HINT;
463     + } else {
464     /* HSM violation. Let EH handle this.
465     * Phantom devices also trigger this
466     * condition. Mark hint.
467     diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
468     index 31d08b6..b899d91 100644
469     --- a/drivers/char/applicom.c
470     +++ b/drivers/char/applicom.c
471     @@ -712,8 +712,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
472    
473     IndexCard = adgl->num_card-1;
474    
475     - if(cmd != 0 && cmd != 6 &&
476     - ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
477     + if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
478     static int warncount = 10;
479     if (warncount) {
480     printk( KERN_WARNING "APPLICOM driver IOCTL, bad board number %d\n",(int)IndexCard+1);
481     @@ -832,8 +831,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
482     }
483     break;
484     default:
485     - printk(KERN_INFO "APPLICOM driver ioctl, unknown function code %d\n",cmd) ;
486     - ret = -EINVAL;
487     + ret = -ENOTTY;
488     break;
489     }
490     Dummy = readb(apbs[IndexCard].RamIO + VERS);
491     diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
492     index 887072f..cd2e3b8 100644
493     --- a/drivers/edac/cell_edac.c
494     +++ b/drivers/edac/cell_edac.c
495     @@ -9,6 +9,7 @@
496     */
497     #undef DEBUG
498    
499     +#include <linux/edac.h>
500     #include <linux/module.h>
501     #include <linux/init.h>
502     #include <linux/platform_device.h>
503     @@ -164,6 +165,8 @@ static int __devinit cell_edac_probe(struct platform_device *pdev)
504     if (regs == NULL)
505     return -ENODEV;
506    
507     + edac_op_state = EDAC_OPSTATE_POLL;
508     +
509     /* Get channel population */
510     reg = in_be64(&regs->mic_mnt_cfg);
511     dev_dbg(&pdev->dev, "MIC_MNT_CFG = 0x%016lx\n", reg);
512     diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
513     index 49144cb..e87956a 100644
514     --- a/drivers/hid/usbhid/hid-quirks.c
515     +++ b/drivers/hid/usbhid/hid-quirks.c
516     @@ -83,6 +83,7 @@
517     #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232
518     #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
519     #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
520     +#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
521     #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
522    
523     #define USB_VENDOR_ID_ASUS 0x0b05
524     @@ -458,6 +459,7 @@ static const struct hid_blacklist {
525     { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL },
526    
527     { USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM, HID_QUIRK_HIDDEV },
528     + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT },
529     { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT },
530     { USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE, HID_QUIRK_HIDDEV | HID_QUIRK_IGNORE_HIDINPUT },
531     { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV, HID_QUIRK_HIDINPUT },
532     diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
533     index 5aafe24..29e6863 100644
534     --- a/drivers/input/serio/i8042-x86ia64io.h
535     +++ b/drivers/input/serio/i8042-x86ia64io.h
536     @@ -135,6 +135,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
537     DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
538     },
539     },
540     + {
541     + .ident = "Blue FB5601",
542     + .matches = {
543     + DMI_MATCH(DMI_SYS_VENDOR, "blue"),
544     + DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
545     + DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
546     + },
547     + },
548     { }
549     };
550    
551     @@ -322,6 +330,27 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
552     DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
553     },
554     },
555     + {
556     + .ident = "IBM 2656",
557     + .matches = {
558     + DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
559     + DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
560     + },
561     + },
562     + {
563     + .ident = "Dell XPS M1530",
564     + .matches = {
565     + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
566     + DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
567     + },
568     + },
569     + {
570     + .ident = "Compal HEL80I",
571     + .matches = {
572     + DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
573     + DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
574     + },
575     + },
576     { }
577     };
578    
579     diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
580     index 2711404..b1a694b 100644
581     --- a/drivers/net/cxgb3/adapter.h
582     +++ b/drivers/net/cxgb3/adapter.h
583     @@ -285,6 +285,7 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_status,
584    
585     void t3_sge_start(struct adapter *adap);
586     void t3_sge_stop(struct adapter *adap);
587     +void t3_stop_sge_timers(struct adapter *adap);
588     void t3_free_sge_resources(struct adapter *adap);
589     void t3_sge_err_intr_handler(struct adapter *adapter);
590     irq_handler_t t3_intr_handler(struct adapter *adap, int polling);
591     diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
592     index 5447f3e..d355c82 100644
593     --- a/drivers/net/cxgb3/cxgb3_main.c
594     +++ b/drivers/net/cxgb3/cxgb3_main.c
595     @@ -479,6 +479,7 @@ static int setup_sge_qsets(struct adapter *adap)
596     irq_idx,
597     &adap->params.sge.qset[qset_idx], ntxq, dev);
598     if (err) {
599     + t3_stop_sge_timers(adap);
600     t3_free_sge_resources(adap);
601     return err;
602     }
603     @@ -2449,6 +2450,9 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev,
604     test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
605     offload_close(&adapter->tdev);
606    
607     + /* Stop SGE timers */
608     + t3_stop_sge_timers(adapter);
609     +
610     adapter->flags &= ~FULL_INIT_DONE;
611    
612     pci_disable_device(pdev);
613     @@ -2801,6 +2805,7 @@ static void __devexit remove_one(struct pci_dev *pdev)
614     if (test_bit(i, &adapter->registered_device_map))
615     unregister_netdev(adapter->port[i]);
616    
617     + t3_stop_sge_timers(adapter);
618     t3_free_sge_resources(adapter);
619     cxgb_disable_msi(adapter);
620    
621     diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
622     index 1b0861d..52f4138 100644
623     --- a/drivers/net/cxgb3/sge.c
624     +++ b/drivers/net/cxgb3/sge.c
625     @@ -603,9 +603,6 @@ static void t3_free_qset(struct adapter *adapter, struct sge_qset *q)
626     int i;
627     struct pci_dev *pdev = adapter->pdev;
628    
629     - if (q->tx_reclaim_timer.function)
630     - del_timer_sync(&q->tx_reclaim_timer);
631     -
632     for (i = 0; i < SGE_RXQ_PER_SET; ++i)
633     if (q->fl[i].desc) {
634     spin_lock_irq(&adapter->sge.reg_lock);
635     @@ -1937,38 +1934,6 @@ static inline int lro_frame_ok(const struct cpl_rx_pkt *p)
636     eh->h_proto == htons(ETH_P_IP) && ih->ihl == (sizeof(*ih) >> 2);
637     }
638    
639     -#define TCP_FLAG_MASK (TCP_FLAG_CWR | TCP_FLAG_ECE | TCP_FLAG_URG |\
640     - TCP_FLAG_ACK | TCP_FLAG_PSH | TCP_FLAG_RST |\
641     - TCP_FLAG_SYN | TCP_FLAG_FIN)
642     -#define TSTAMP_WORD ((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |\
643     - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)
644     -
645     -/**
646     - * lro_segment_ok - check if a TCP segment is eligible for LRO
647     - * @tcph: the TCP header of the packet
648     - *
649     - * Returns true if a TCP packet is eligible for LRO. This requires that
650     - * the packet have only the ACK flag set and no TCP options besides
651     - * time stamps.
652     - */
653     -static inline int lro_segment_ok(const struct tcphdr *tcph)
654     -{
655     - int optlen;
656     -
657     - if (unlikely((tcp_flag_word(tcph) & TCP_FLAG_MASK) != TCP_FLAG_ACK))
658     - return 0;
659     -
660     - optlen = (tcph->doff << 2) - sizeof(*tcph);
661     - if (optlen) {
662     - const u32 *opt = (const u32 *)(tcph + 1);
663     -
664     - if (optlen != TCPOLEN_TSTAMP_ALIGNED ||
665     - *opt != htonl(TSTAMP_WORD) || !opt[2])
666     - return 0;
667     - }
668     - return 1;
669     -}
670     -
671     static int t3_get_lro_header(void **eh, void **iph, void **tcph,
672     u64 *hdr_flags, void *priv)
673     {
674     @@ -1981,9 +1946,6 @@ static int t3_get_lro_header(void **eh, void **iph, void **tcph,
675     *iph = (struct iphdr *)((struct ethhdr *)*eh + 1);
676     *tcph = (struct tcphdr *)((struct iphdr *)*iph + 1);
677    
678     - if (!lro_segment_ok(*tcph))
679     - return -1;
680     -
681     *hdr_flags = LRO_IPV4 | LRO_TCP;
682     return 0;
683     }
684     @@ -3043,6 +3005,24 @@ err:
685     }
686    
687     /**
688     + * t3_stop_sge_timers - stop SGE timer call backs
689     + * @adap: the adapter
690     + *
691     + * Stops each SGE queue set's timer call back
692     + */
693     +void t3_stop_sge_timers(struct adapter *adap)
694     +{
695     + int i;
696     +
697     + for (i = 0; i < SGE_QSETS; ++i) {
698     + struct sge_qset *q = &adap->sge.qs[i];
699     +
700     + if (q->tx_reclaim_timer.function)
701     + del_timer_sync(&q->tx_reclaim_timer);
702     + }
703     +}
704     +
705     +/**
706     * t3_free_sge_resources - free SGE resources
707     * @adap: the adapter
708     *
709     diff --git a/drivers/net/niu.c b/drivers/net/niu.c
710     index e3be81e..6f9809e 100644
711     --- a/drivers/net/niu.c
712     +++ b/drivers/net/niu.c
713     @@ -51,8 +51,7 @@ MODULE_VERSION(DRV_MODULE_VERSION);
714     #ifndef readq
715     static u64 readq(void __iomem *reg)
716     {
717     - return (((u64)readl(reg + 0x4UL) << 32) |
718     - (u64)readl(reg));
719     + return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32);
720     }
721    
722     static void writeq(u64 val, void __iomem *reg)
723     diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
724     index ff175e8..de80ba4 100644
725     --- a/drivers/net/pppol2tp.c
726     +++ b/drivers/net/pppol2tp.c
727     @@ -1353,6 +1353,7 @@ static int pppol2tp_release(struct socket *sock)
728     kfree_skb(skb);
729     sock_put(sk);
730     }
731     + sock_put(sk);
732     }
733    
734     release_sock(sk);
735     diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
736     index 851f5b8..aa6fda1 100644
737     --- a/drivers/pci/pcie/aspm.c
738     +++ b/drivers/pci/pcie/aspm.c
739     @@ -16,6 +16,7 @@
740     #include <linux/pm.h>
741     #include <linux/init.h>
742     #include <linux/slab.h>
743     +#include <linux/jiffies.h>
744     #include <linux/pci-aspm.h>
745     #include "../pci.h"
746    
747     @@ -161,11 +162,12 @@ static void pcie_check_clock_pm(struct pci_dev *pdev)
748     */
749     static void pcie_aspm_configure_common_clock(struct pci_dev *pdev)
750     {
751     - int pos, child_pos;
752     + int pos, child_pos, i = 0;
753     u16 reg16 = 0;
754     struct pci_dev *child_dev;
755     int same_clock = 1;
756     -
757     + unsigned long start_jiffies;
758     + u16 child_regs[8], parent_reg;
759     /*
760     * all functions of a slot should have the same Slot Clock
761     * Configuration, so just check one function
762     @@ -191,16 +193,19 @@ static void pcie_aspm_configure_common_clock(struct pci_dev *pdev)
763     child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
764     pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKCTL,
765     &reg16);
766     + child_regs[i] = reg16;
767     if (same_clock)
768     reg16 |= PCI_EXP_LNKCTL_CCC;
769     else
770     reg16 &= ~PCI_EXP_LNKCTL_CCC;
771     pci_write_config_word(child_dev, child_pos + PCI_EXP_LNKCTL,
772     reg16);
773     + i++;
774     }
775    
776     /* Configure upstream component */
777     pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
778     + parent_reg = reg16;
779     if (same_clock)
780     reg16 |= PCI_EXP_LNKCTL_CCC;
781     else
782     @@ -212,12 +217,30 @@ static void pcie_aspm_configure_common_clock(struct pci_dev *pdev)
783     pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
784    
785     /* Wait for link training end */
786     - while (1) {
787     + /* break out after waiting for 1 second */
788     + start_jiffies = jiffies;
789     + while ((jiffies - start_jiffies) < HZ) {
790     pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
791     if (!(reg16 & PCI_EXP_LNKSTA_LT))
792     break;
793     cpu_relax();
794     }
795     + /* training failed -> recover */
796     + if ((jiffies - start_jiffies) >= HZ) {
797     + dev_printk (KERN_ERR, &pdev->dev, "ASPM: Could not configure"
798     + " common clock\n");
799     + i = 0;
800     + list_for_each_entry(child_dev, &pdev->subordinate->devices,
801     + bus_list) {
802     + child_pos = pci_find_capability(child_dev,
803     + PCI_CAP_ID_EXP);
804     + pci_write_config_word(child_dev,
805     + child_pos + PCI_EXP_LNKCTL,
806     + child_regs[i]);
807     + i++;
808     + }
809     + pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, parent_reg);
810     + }
811     }
812    
813     /*
814     diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
815     index b703b09..e423fd9 100644
816     --- a/drivers/pci/slot.c
817     +++ b/drivers/pci/slot.c
818     @@ -243,6 +243,7 @@ placeholder:
819     __func__, pci_domain_nr(parent), parent->number, slot_nr);
820    
821     out:
822     + kfree(slot_name);
823     up_write(&pci_bus_sem);
824     return slot;
825     err:
826     diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
827     index 9fd7bb9..7cc7bf5 100644
828     --- a/drivers/pnp/base.h
829     +++ b/drivers/pnp/base.h
830     @@ -147,7 +147,7 @@ char *pnp_resource_type_name(struct resource *res);
831     void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
832    
833     void pnp_free_resources(struct pnp_dev *dev);
834     -int pnp_resource_type(struct resource *res);
835     +unsigned long pnp_resource_type(struct resource *res);
836    
837     struct pnp_resource {
838     struct list_head list;
839     diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
840     index 0bdf9b8..d15e2b7 100644
841     --- a/drivers/pnp/quirks.c
842     +++ b/drivers/pnp/quirks.c
843     @@ -245,7 +245,7 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
844     */
845     for_each_pci_dev(pdev) {
846     for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
847     - unsigned int type;
848     + unsigned long type;
849    
850     type = pci_resource_flags(pdev, i) &
851     (IORESOURCE_IO | IORESOURCE_MEM);
852     diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
853     index 4cfe3a1..dbae23a 100644
854     --- a/drivers/pnp/resource.c
855     +++ b/drivers/pnp/resource.c
856     @@ -467,14 +467,14 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
857     #endif
858     }
859    
860     -int pnp_resource_type(struct resource *res)
861     +unsigned long pnp_resource_type(struct resource *res)
862     {
863     return res->flags & (IORESOURCE_IO | IORESOURCE_MEM |
864     IORESOURCE_IRQ | IORESOURCE_DMA);
865     }
866    
867     struct resource *pnp_get_resource(struct pnp_dev *dev,
868     - unsigned int type, unsigned int num)
869     + unsigned long type, unsigned int num)
870     {
871     struct pnp_resource *pnp_res;
872     struct resource *res;
873     diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
874     index e5e0cfe..bdc4d4e 100644
875     --- a/drivers/spi/spidev.c
876     +++ b/drivers/spi/spidev.c
877     @@ -598,7 +598,9 @@ static int spidev_probe(struct spi_device *spi)
878     }
879     mutex_unlock(&device_list_lock);
880    
881     - if (status != 0)
882     + if (status == 0)
883     + spi_set_drvdata(spi, spidev);
884     + else
885     kfree(spidev);
886    
887     return status;
888     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
889     index 73f8277..b205311 100644
890     --- a/drivers/usb/serial/option.c
891     +++ b/drivers/usb/serial/option.c
892     @@ -79,38 +79,36 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
893     #define OPTION_PRODUCT_VIPER 0x6600
894     #define OPTION_PRODUCT_VIPER_BUS 0x6601
895     #define OPTION_PRODUCT_GT_MAX_READY 0x6701
896     -#define OPTION_PRODUCT_GT_MAX 0x6711
897     #define OPTION_PRODUCT_FUJI_MODEM_LIGHT 0x6721
898     #define OPTION_PRODUCT_FUJI_MODEM_GT 0x6741
899     #define OPTION_PRODUCT_FUJI_MODEM_EX 0x6761
900     -#define OPTION_PRODUCT_FUJI_NETWORK_LIGHT 0x6731
901     -#define OPTION_PRODUCT_FUJI_NETWORK_GT 0x6751
902     -#define OPTION_PRODUCT_FUJI_NETWORK_EX 0x6771
903     #define OPTION_PRODUCT_KOI_MODEM 0x6800
904     -#define OPTION_PRODUCT_KOI_NETWORK 0x6811
905     #define OPTION_PRODUCT_SCORPION_MODEM 0x6901
906     -#define OPTION_PRODUCT_SCORPION_NETWORK 0x6911
907     #define OPTION_PRODUCT_ETNA_MODEM 0x7001
908     -#define OPTION_PRODUCT_ETNA_NETWORK 0x7011
909     #define OPTION_PRODUCT_ETNA_MODEM_LITE 0x7021
910     #define OPTION_PRODUCT_ETNA_MODEM_GT 0x7041
911     #define OPTION_PRODUCT_ETNA_MODEM_EX 0x7061
912     -#define OPTION_PRODUCT_ETNA_NETWORK_LITE 0x7031
913     -#define OPTION_PRODUCT_ETNA_NETWORK_GT 0x7051
914     -#define OPTION_PRODUCT_ETNA_NETWORK_EX 0x7071
915     #define OPTION_PRODUCT_ETNA_KOI_MODEM 0x7100
916     -#define OPTION_PRODUCT_ETNA_KOI_NETWORK 0x7111
917    
918     #define HUAWEI_VENDOR_ID 0x12D1
919     #define HUAWEI_PRODUCT_E600 0x1001
920     #define HUAWEI_PRODUCT_E220 0x1003
921     #define HUAWEI_PRODUCT_E220BIS 0x1004
922     #define HUAWEI_PRODUCT_E1401 0x1401
923     +#define HUAWEI_PRODUCT_E1402 0x1402
924     #define HUAWEI_PRODUCT_E1403 0x1403
925     +#define HUAWEI_PRODUCT_E1404 0x1404
926     #define HUAWEI_PRODUCT_E1405 0x1405
927     #define HUAWEI_PRODUCT_E1406 0x1406
928     +#define HUAWEI_PRODUCT_E1407 0x1407
929     #define HUAWEI_PRODUCT_E1408 0x1408
930     #define HUAWEI_PRODUCT_E1409 0x1409
931     +#define HUAWEI_PRODUCT_E140A 0x140A
932     +#define HUAWEI_PRODUCT_E140B 0x140B
933     +#define HUAWEI_PRODUCT_E140C 0x140C
934     +#define HUAWEI_PRODUCT_E140D 0x140D
935     +#define HUAWEI_PRODUCT_E140E 0x140E
936     +#define HUAWEI_PRODUCT_E140F 0x140F
937     #define HUAWEI_PRODUCT_E1410 0x1410
938     #define HUAWEI_PRODUCT_E1411 0x1411
939     #define HUAWEI_PRODUCT_E1412 0x1412
940     @@ -121,9 +119,52 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
941     #define HUAWEI_PRODUCT_E1417 0x1417
942     #define HUAWEI_PRODUCT_E1418 0x1418
943     #define HUAWEI_PRODUCT_E1419 0x1419
944     +#define HUAWEI_PRODUCT_E141A 0x141A
945     +#define HUAWEI_PRODUCT_E141B 0x141B
946     +#define HUAWEI_PRODUCT_E141C 0x141C
947     +#define HUAWEI_PRODUCT_E141D 0x141D
948     +#define HUAWEI_PRODUCT_E141E 0x141E
949     +#define HUAWEI_PRODUCT_E141F 0x141F
950     +#define HUAWEI_PRODUCT_E1420 0x1420
951     +#define HUAWEI_PRODUCT_E1421 0x1421
952     +#define HUAWEI_PRODUCT_E1422 0x1422
953     +#define HUAWEI_PRODUCT_E1423 0x1423
954     +#define HUAWEI_PRODUCT_E1424 0x1424
955     +#define HUAWEI_PRODUCT_E1425 0x1425
956     +#define HUAWEI_PRODUCT_E1426 0x1426
957     +#define HUAWEI_PRODUCT_E1427 0x1427
958     +#define HUAWEI_PRODUCT_E1428 0x1428
959     +#define HUAWEI_PRODUCT_E1429 0x1429
960     +#define HUAWEI_PRODUCT_E142A 0x142A
961     +#define HUAWEI_PRODUCT_E142B 0x142B
962     +#define HUAWEI_PRODUCT_E142C 0x142C
963     +#define HUAWEI_PRODUCT_E142D 0x142D
964     +#define HUAWEI_PRODUCT_E142E 0x142E
965     +#define HUAWEI_PRODUCT_E142F 0x142F
966     +#define HUAWEI_PRODUCT_E1430 0x1430
967     +#define HUAWEI_PRODUCT_E1431 0x1431
968     +#define HUAWEI_PRODUCT_E1432 0x1432
969     +#define HUAWEI_PRODUCT_E1433 0x1433
970     +#define HUAWEI_PRODUCT_E1434 0x1434
971     +#define HUAWEI_PRODUCT_E1435 0x1435
972     +#define HUAWEI_PRODUCT_E1436 0x1436
973     +#define HUAWEI_PRODUCT_E1437 0x1437
974     +#define HUAWEI_PRODUCT_E1438 0x1438
975     +#define HUAWEI_PRODUCT_E1439 0x1439
976     +#define HUAWEI_PRODUCT_E143A 0x143A
977     +#define HUAWEI_PRODUCT_E143B 0x143B
978     +#define HUAWEI_PRODUCT_E143C 0x143C
979     +#define HUAWEI_PRODUCT_E143D 0x143D
980     +#define HUAWEI_PRODUCT_E143E 0x143E
981     +#define HUAWEI_PRODUCT_E143F 0x143F
982    
983     #define NOVATELWIRELESS_VENDOR_ID 0x1410
984    
985     +/* YISO PRODUCTS */
986     +
987     +#define YISO_VENDOR_ID 0x0EAB
988     +#define YISO_PRODUCT_U893 0xC893
989     +
990     /* MERLIN EVDO PRODUCTS */
991     #define NOVATELWIRELESS_PRODUCT_V640 0x1100
992     #define NOVATELWIRELESS_PRODUCT_V620 0x1110
993     @@ -183,6 +224,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
994     #define ONDA_VENDOR_ID 0x19d2
995     #define ONDA_PRODUCT_MSA501HS 0x0001
996     #define ONDA_PRODUCT_ET502HS 0x0002
997     +#define ONDA_PRODUCT_MT503HS 0x0200
998    
999     #define BANDRICH_VENDOR_ID 0x1A8D
1000     #define BANDRICH_PRODUCT_C100_1 0x1002
1001     @@ -218,8 +260,19 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
1002     /* ZTE PRODUCTS */
1003     #define ZTE_VENDOR_ID 0x19d2
1004     #define ZTE_PRODUCT_MF628 0x0015
1005     +#define ZTE_PRODUCT_MF626 0x0031
1006     #define ZTE_PRODUCT_CDMA_TECH 0xfffe
1007    
1008     +/* Ericsson products */
1009     +#define ERICSSON_VENDOR_ID 0x0bdb
1010     +#define ERICSSON_PRODUCT_F3507G 0x1900
1011     +
1012     +/* Pantech products */
1013     +#define PANTECH_VENDOR_ID 0x106c
1014     +#define PANTECH_PRODUCT_PC5740 0x3701
1015     +#define PANTECH_PRODUCT_PC5750 0x3702 /* PX-500 */
1016     +#define PANTECH_PRODUCT_UM150 0x3711
1017     +
1018     static struct usb_device_id option_ids[] = {
1019     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
1020     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
1021     @@ -235,36 +288,34 @@ static struct usb_device_id option_ids[] = {
1022     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER) },
1023     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER_BUS) },
1024     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX_READY) },
1025     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX) },
1026     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_LIGHT) },
1027     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_GT) },
1028     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_EX) },
1029     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_LIGHT) },
1030     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_GT) },
1031     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_EX) },
1032     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_MODEM) },
1033     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_NETWORK) },
1034     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_MODEM) },
1035     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_NETWORK) },
1036     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM) },
1037     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK) },
1038     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_LITE) },
1039     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_GT) },
1040     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) },
1041     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_LITE) },
1042     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_GT) },
1043     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) },
1044     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) },
1045     - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
1046     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
1047     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
1048     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
1049     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) },
1050     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1402, 0xff, 0xff, 0xff) },
1051     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) },
1052     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1404, 0xff, 0xff, 0xff) },
1053     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) },
1054     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) },
1055     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1407, 0xff, 0xff, 0xff) },
1056     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) },
1057     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) },
1058     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140A, 0xff, 0xff, 0xff) },
1059     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140B, 0xff, 0xff, 0xff) },
1060     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140C, 0xff, 0xff, 0xff) },
1061     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140D, 0xff, 0xff, 0xff) },
1062     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140E, 0xff, 0xff, 0xff) },
1063     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140F, 0xff, 0xff, 0xff) },
1064     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) },
1065     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) },
1066     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) },
1067     @@ -275,6 +326,44 @@ static struct usb_device_id option_ids[] = {
1068     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) },
1069     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) },
1070     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) },
1071     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141A, 0xff, 0xff, 0xff) },
1072     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141B, 0xff, 0xff, 0xff) },
1073     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141C, 0xff, 0xff, 0xff) },
1074     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141D, 0xff, 0xff, 0xff) },
1075     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141E, 0xff, 0xff, 0xff) },
1076     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141F, 0xff, 0xff, 0xff) },
1077     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1420, 0xff, 0xff, 0xff) },
1078     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1421, 0xff, 0xff, 0xff) },
1079     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1422, 0xff, 0xff, 0xff) },
1080     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1423, 0xff, 0xff, 0xff) },
1081     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1424, 0xff, 0xff, 0xff) },
1082     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1425, 0xff, 0xff, 0xff) },
1083     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1426, 0xff, 0xff, 0xff) },
1084     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1427, 0xff, 0xff, 0xff) },
1085     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1428, 0xff, 0xff, 0xff) },
1086     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1429, 0xff, 0xff, 0xff) },
1087     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142A, 0xff, 0xff, 0xff) },
1088     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142B, 0xff, 0xff, 0xff) },
1089     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142C, 0xff, 0xff, 0xff) },
1090     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142D, 0xff, 0xff, 0xff) },
1091     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142E, 0xff, 0xff, 0xff) },
1092     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142F, 0xff, 0xff, 0xff) },
1093     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1430, 0xff, 0xff, 0xff) },
1094     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1431, 0xff, 0xff, 0xff) },
1095     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1432, 0xff, 0xff, 0xff) },
1096     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1433, 0xff, 0xff, 0xff) },
1097     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1434, 0xff, 0xff, 0xff) },
1098     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1435, 0xff, 0xff, 0xff) },
1099     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1436, 0xff, 0xff, 0xff) },
1100     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1437, 0xff, 0xff, 0xff) },
1101     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1438, 0xff, 0xff, 0xff) },
1102     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1439, 0xff, 0xff, 0xff) },
1103     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143A, 0xff, 0xff, 0xff) },
1104     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143B, 0xff, 0xff, 0xff) },
1105     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143C, 0xff, 0xff, 0xff) },
1106     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
1107     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
1108     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
1109     { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
1110     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */
1111     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */
1112     @@ -318,12 +407,48 @@ static struct usb_device_id option_ids[] = {
1113     { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
1114     { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
1115     { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
1116     - { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
1117     + { USB_DEVICE(DELL_VENDOR_ID, 0x8147) }, /* Dell Wireless 5530 Mobile Broadband (3G HSPA) Mini-Card */
1118     + { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
1119     { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
1120     { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
1121     { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
1122     { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) },
1123     { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) },
1124     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0003) },
1125     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0004) },
1126     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0005) },
1127     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0006) },
1128     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0007) },
1129     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0008) },
1130     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0009) },
1131     + { USB_DEVICE(ONDA_VENDOR_ID, 0x000a) },
1132     + { USB_DEVICE(ONDA_VENDOR_ID, 0x000b) },
1133     + { USB_DEVICE(ONDA_VENDOR_ID, 0x000c) },
1134     + { USB_DEVICE(ONDA_VENDOR_ID, 0x000d) },
1135     + { USB_DEVICE(ONDA_VENDOR_ID, 0x000e) },
1136     + { USB_DEVICE(ONDA_VENDOR_ID, 0x000f) },
1137     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0010) },
1138     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0011) },
1139     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0012) },
1140     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0013) },
1141     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0014) },
1142     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0015) },
1143     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0016) },
1144     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0017) },
1145     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0018) },
1146     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0019) },
1147     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0020) },
1148     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0021) },
1149     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0022) },
1150     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0023) },
1151     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0024) },
1152     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0025) },
1153     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0026) },
1154     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0027) },
1155     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0028) },
1156     + { USB_DEVICE(ONDA_VENDOR_ID, 0x0029) },
1157     + { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MT503HS) },
1158     + { USB_DEVICE(YISO_VENDOR_ID, YISO_PRODUCT_U893) },
1159     { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) },
1160     { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
1161     { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1004) },
1162     @@ -347,8 +472,13 @@ static struct usb_device_id option_ids[] = {
1163     { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
1164     { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
1165     { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
1166     + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) },
1167     { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
1168     { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
1169     + { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) },
1170     + { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5740) },
1171     + { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5750) },
1172     + { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_UM150) },
1173     { } /* Terminating entry */
1174     };
1175     MODULE_DEVICE_TABLE(usb, option_ids);
1176     diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1177     index ccebf89..e61f2bf 100644
1178     --- a/drivers/usb/storage/unusual_devs.h
1179     +++ b/drivers/usb/storage/unusual_devs.h
1180     @@ -167,6 +167,13 @@ UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600,
1181     US_SC_DEVICE, US_PR_DEVICE, NULL,
1182     US_FL_FIX_CAPACITY ),
1183    
1184     +/* Patch for Nokia 5310 capacity */
1185     +UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591,
1186     + "Nokia",
1187     + "5310",
1188     + US_SC_DEVICE, US_PR_DEVICE, NULL,
1189     + US_FL_FIX_CAPACITY ),
1190     +
1191     /* Reported by Mario Rettig <mariorettig@web.de> */
1192     UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
1193     "Nokia",
1194     @@ -233,14 +240,14 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x0370,
1195     US_FL_MAX_SECTORS_64 ),
1196    
1197     /* Reported by Cedric Godin <cedric@belbone.be> */
1198     -UNUSUAL_DEV( 0x0421, 0x04b9, 0x0551, 0x0551,
1199     +UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x0551,
1200     "Nokia",
1201     "5300",
1202     US_SC_DEVICE, US_PR_DEVICE, NULL,
1203     US_FL_FIX_CAPACITY ),
1204    
1205     /* Reported by Richard Nauber <RichardNauber@web.de> */
1206     -UNUSUAL_DEV( 0x0421, 0x04fa, 0x0601, 0x0601,
1207     +UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
1208     "Nokia",
1209     "6300",
1210     US_SC_DEVICE, US_PR_DEVICE, NULL,
1211     @@ -253,6 +260,14 @@ UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591,
1212     US_SC_DEVICE, US_PR_DEVICE, NULL,
1213     US_FL_FIX_CAPACITY ),
1214    
1215     +/* Submitted by Ricky Wong Yung Fei <evilbladewarrior@gmail.com> */
1216     +/* Nokia 7610 Supernova - Too many sectors reported in usb storage mode */
1217     +UNUSUAL_DEV( 0x0421, 0x00f5, 0x0000, 0x0470,
1218     + "Nokia",
1219     + "7610 Supernova",
1220     + US_SC_DEVICE, US_PR_DEVICE, NULL,
1221     + US_FL_FIX_CAPACITY ),
1222     +
1223     /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
1224     UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
1225     "SMSC",
1226     @@ -303,6 +318,18 @@ UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
1227     US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0),
1228     #endif
1229    
1230     +/* Reported by Tamas Kerecsen <kerecsen@bigfoot.com>
1231     + * Obviously the PROM has not been customized by the VAR;
1232     + * the Vendor and Product string descriptors are:
1233     + * Generic Mass Storage (PROTOTYPE--Remember to change idVendor)
1234     + * Generic Manufacturer (PROTOTYPE--Remember to change idVendor)
1235     + */
1236     +UNUSUAL_DEV( 0x045e, 0xffff, 0x0000, 0x0000,
1237     + "Mitac",
1238     + "GPS",
1239     + US_SC_DEVICE, US_PR_DEVICE, NULL,
1240     + US_FL_MAX_SECTORS_64 ),
1241     +
1242     /*
1243     * This virtual floppy is found in Sun equipment (x4600, x4200m2, etc.)
1244     * Reported by Pete Zaitcev <zaitcev@redhat.com>
1245     @@ -333,6 +360,13 @@ UNUSUAL_DEV( 0x0482, 0x0103, 0x0100, 0x0100,
1246     "Finecam S5",
1247     US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY),
1248    
1249     +/* Patch submitted by Jens Taprogge <jens.taprogge@taprogge.org> */
1250     +UNUSUAL_DEV( 0x0482, 0x0107, 0x0100, 0x0100,
1251     + "Kyocera",
1252     + "CONTAX SL300R T*",
1253     + US_SC_DEVICE, US_PR_DEVICE, NULL,
1254     + US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE),
1255     +
1256     /* Reported by Paul Stewart <stewart@wetlogic.net>
1257     * This entry is needed because the device reports Sub=ff */
1258     UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
1259     @@ -355,6 +389,13 @@ UNUSUAL_DEV( 0x04b0, 0x0401, 0x0200, 0x0200,
1260     US_SC_DEVICE, US_PR_DEVICE, NULL,
1261     US_FL_FIX_CAPACITY),
1262    
1263     +/* Reported by Tobias Kunze Briseno <t-linux@fictive.com> */
1264     +UNUSUAL_DEV( 0x04b0, 0x0403, 0x0200, 0x0200,
1265     + "NIKON",
1266     + "NIKON DSC D2H",
1267     + US_SC_DEVICE, US_PR_DEVICE, NULL,
1268     + US_FL_FIX_CAPACITY),
1269     +
1270     /* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */
1271     UNUSUAL_DEV( 0x04b0, 0x0409, 0x0100, 0x0100,
1272     "NIKON",
1273     @@ -411,6 +452,13 @@ UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100,
1274     US_SC_DEVICE, US_PR_DEVICE, NULL,
1275     US_FL_FIX_CAPACITY),
1276    
1277     +/* Reported by paul ready <lxtwin@homecall.co.uk> */
1278     +UNUSUAL_DEV( 0x04b0, 0x0419, 0x0100, 0x0200,
1279     + "NIKON",
1280     + "NIKON DSC D300",
1281     + US_SC_DEVICE, US_PR_DEVICE, NULL,
1282     + US_FL_FIX_CAPACITY),
1283     +
1284     /* Reported by Doug Maxey (dwm@austin.ibm.com) */
1285     UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
1286     "IBM",
1287     @@ -1635,97 +1683,332 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100,
1288     /* Reported by fangxiaozhi <huananhu@huawei.com>
1289     * This brings the HUAWEI data card devices into multi-port mode
1290     */
1291     -UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000,
1292     +UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000,
1293     + "HUAWEI MOBILE",
1294     + "Mass Storage",
1295     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1296     + 0),
1297     +UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
1298     + "HUAWEI MOBILE",
1299     + "Mass Storage",
1300     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1301     + 0),
1302     +UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000,
1303     + "HUAWEI MOBILE",
1304     + "Mass Storage",
1305     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1306     + 0),
1307     +UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000,
1308     + "HUAWEI MOBILE",
1309     + "Mass Storage",
1310     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1311     + 0),
1312     +UNUSUAL_DEV( 0x12d1, 0x1402, 0x0000, 0x0000,
1313     + "HUAWEI MOBILE",
1314     + "Mass Storage",
1315     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1316     + 0),
1317     +UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000,
1318     + "HUAWEI MOBILE",
1319     + "Mass Storage",
1320     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1321     + 0),
1322     +UNUSUAL_DEV( 0x12d1, 0x1404, 0x0000, 0x0000,
1323     + "HUAWEI MOBILE",
1324     + "Mass Storage",
1325     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1326     + 0),
1327     +UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000,
1328     + "HUAWEI MOBILE",
1329     + "Mass Storage",
1330     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1331     + 0),
1332     +UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000,
1333     + "HUAWEI MOBILE",
1334     + "Mass Storage",
1335     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1336     + 0),
1337     +UNUSUAL_DEV( 0x12d1, 0x1407, 0x0000, 0x0000,
1338     + "HUAWEI MOBILE",
1339     + "Mass Storage",
1340     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1341     + 0),
1342     +UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000,
1343     + "HUAWEI MOBILE",
1344     + "Mass Storage",
1345     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1346     + 0),
1347     +UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000,
1348     + "HUAWEI MOBILE",
1349     + "Mass Storage",
1350     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1351     + 0),
1352     +UNUSUAL_DEV( 0x12d1, 0x140A, 0x0000, 0x0000,
1353     + "HUAWEI MOBILE",
1354     + "Mass Storage",
1355     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1356     + 0),
1357     +UNUSUAL_DEV( 0x12d1, 0x140B, 0x0000, 0x0000,
1358     + "HUAWEI MOBILE",
1359     + "Mass Storage",
1360     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1361     + 0),
1362     +UNUSUAL_DEV( 0x12d1, 0x140C, 0x0000, 0x0000,
1363     + "HUAWEI MOBILE",
1364     + "Mass Storage",
1365     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1366     + 0),
1367     +UNUSUAL_DEV( 0x12d1, 0x140D, 0x0000, 0x0000,
1368     + "HUAWEI MOBILE",
1369     + "Mass Storage",
1370     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1371     + 0),
1372     +UNUSUAL_DEV( 0x12d1, 0x140E, 0x0000, 0x0000,
1373     + "HUAWEI MOBILE",
1374     + "Mass Storage",
1375     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1376     + 0),
1377     +UNUSUAL_DEV( 0x12d1, 0x140F, 0x0000, 0x0000,
1378     + "HUAWEI MOBILE",
1379     + "Mass Storage",
1380     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1381     + 0),
1382     +UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000,
1383     + "HUAWEI MOBILE",
1384     + "Mass Storage",
1385     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1386     + 0),
1387     +UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000,
1388     + "HUAWEI MOBILE",
1389     + "Mass Storage",
1390     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1391     + 0),
1392     +UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000,
1393     + "HUAWEI MOBILE",
1394     + "Mass Storage",
1395     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1396     + 0),
1397     +UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000,
1398     + "HUAWEI MOBILE",
1399     + "Mass Storage",
1400     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1401     + 0),
1402     +UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000,
1403     + "HUAWEI MOBILE",
1404     + "Mass Storage",
1405     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1406     + 0),
1407     +UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000,
1408     + "HUAWEI MOBILE",
1409     + "Mass Storage",
1410     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1411     + 0),
1412     +UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000,
1413     + "HUAWEI MOBILE",
1414     + "Mass Storage",
1415     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1416     + 0),
1417     +UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000,
1418     + "HUAWEI MOBILE",
1419     + "Mass Storage",
1420     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1421     + 0),
1422     +UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000,
1423     + "HUAWEI MOBILE",
1424     + "Mass Storage",
1425     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1426     + 0),
1427     +UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000,
1428     + "HUAWEI MOBILE",
1429     + "Mass Storage",
1430     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1431     + 0),
1432     +UNUSUAL_DEV( 0x12d1, 0x141A, 0x0000, 0x0000,
1433     + "HUAWEI MOBILE",
1434     + "Mass Storage",
1435     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1436     + 0),
1437     +UNUSUAL_DEV( 0x12d1, 0x141B, 0x0000, 0x0000,
1438     + "HUAWEI MOBILE",
1439     + "Mass Storage",
1440     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1441     + 0),
1442     +UNUSUAL_DEV( 0x12d1, 0x141C, 0x0000, 0x0000,
1443     + "HUAWEI MOBILE",
1444     + "Mass Storage",
1445     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1446     + 0),
1447     +UNUSUAL_DEV( 0x12d1, 0x141D, 0x0000, 0x0000,
1448     + "HUAWEI MOBILE",
1449     + "Mass Storage",
1450     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1451     + 0),
1452     +UNUSUAL_DEV( 0x12d1, 0x141E, 0x0000, 0x0000,
1453     + "HUAWEI MOBILE",
1454     + "Mass Storage",
1455     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1456     + 0),
1457     +UNUSUAL_DEV( 0x12d1, 0x141F, 0x0000, 0x0000,
1458     + "HUAWEI MOBILE",
1459     + "Mass Storage",
1460     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1461     + 0),
1462     +UNUSUAL_DEV( 0x12d1, 0x1420, 0x0000, 0x0000,
1463     + "HUAWEI MOBILE",
1464     + "Mass Storage",
1465     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1466     + 0),
1467     +UNUSUAL_DEV( 0x12d1, 0x1421, 0x0000, 0x0000,
1468     + "HUAWEI MOBILE",
1469     + "Mass Storage",
1470     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1471     + 0),
1472     +UNUSUAL_DEV( 0x12d1, 0x1422, 0x0000, 0x0000,
1473     + "HUAWEI MOBILE",
1474     + "Mass Storage",
1475     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1476     + 0),
1477     +UNUSUAL_DEV( 0x12d1, 0x1423, 0x0000, 0x0000,
1478     + "HUAWEI MOBILE",
1479     + "Mass Storage",
1480     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1481     + 0),
1482     +UNUSUAL_DEV( 0x12d1, 0x1424, 0x0000, 0x0000,
1483     + "HUAWEI MOBILE",
1484     + "Mass Storage",
1485     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1486     + 0),
1487     +UNUSUAL_DEV( 0x12d1, 0x1425, 0x0000, 0x0000,
1488     + "HUAWEI MOBILE",
1489     + "Mass Storage",
1490     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1491     + 0),
1492     +UNUSUAL_DEV( 0x12d1, 0x1426, 0x0000, 0x0000,
1493     + "HUAWEI MOBILE",
1494     + "Mass Storage",
1495     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1496     + 0),
1497     +UNUSUAL_DEV( 0x12d1, 0x1427, 0x0000, 0x0000,
1498     "HUAWEI MOBILE",
1499     "Mass Storage",
1500     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1501     0),
1502     -UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
1503     +UNUSUAL_DEV( 0x12d1, 0x1428, 0x0000, 0x0000,
1504     "HUAWEI MOBILE",
1505     "Mass Storage",
1506     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1507     0),
1508     -UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000,
1509     +UNUSUAL_DEV( 0x12d1, 0x1429, 0x0000, 0x0000,
1510     "HUAWEI MOBILE",
1511     "Mass Storage",
1512     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1513     0),
1514     -UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000,
1515     +UNUSUAL_DEV( 0x12d1, 0x142A, 0x0000, 0x0000,
1516     "HUAWEI MOBILE",
1517     "Mass Storage",
1518     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1519     0),
1520     -UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000,
1521     +UNUSUAL_DEV( 0x12d1, 0x142B, 0x0000, 0x0000,
1522     "HUAWEI MOBILE",
1523     "Mass Storage",
1524     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1525     0),
1526     -UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000,
1527     +UNUSUAL_DEV( 0x12d1, 0x142C, 0x0000, 0x0000,
1528     "HUAWEI MOBILE",
1529     "Mass Storage",
1530     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1531     0),
1532     -UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000,
1533     +UNUSUAL_DEV( 0x12d1, 0x142D, 0x0000, 0x0000,
1534     "HUAWEI MOBILE",
1535     "Mass Storage",
1536     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1537     0),
1538     -UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000,
1539     +UNUSUAL_DEV( 0x12d1, 0x142E, 0x0000, 0x0000,
1540     "HUAWEI MOBILE",
1541     "Mass Storage",
1542     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1543     0),
1544     -UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000,
1545     +UNUSUAL_DEV( 0x12d1, 0x142F, 0x0000, 0x0000,
1546     "HUAWEI MOBILE",
1547     "Mass Storage",
1548     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1549     0),
1550     -UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000,
1551     +UNUSUAL_DEV( 0x12d1, 0x1430, 0x0000, 0x0000,
1552     "HUAWEI MOBILE",
1553     "Mass Storage",
1554     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1555     0),
1556     -UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000,
1557     +UNUSUAL_DEV( 0x12d1, 0x1431, 0x0000, 0x0000,
1558     "HUAWEI MOBILE",
1559     "Mass Storage",
1560     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1561     0),
1562     -UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000,
1563     +UNUSUAL_DEV( 0x12d1, 0x1432, 0x0000, 0x0000,
1564     "HUAWEI MOBILE",
1565     "Mass Storage",
1566     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1567     0),
1568     -UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000,
1569     +UNUSUAL_DEV( 0x12d1, 0x1433, 0x0000, 0x0000,
1570     "HUAWEI MOBILE",
1571     "Mass Storage",
1572     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1573     0),
1574     -UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000,
1575     +UNUSUAL_DEV( 0x12d1, 0x1434, 0x0000, 0x0000,
1576     "HUAWEI MOBILE",
1577     "Mass Storage",
1578     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1579     0),
1580     -UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000,
1581     +UNUSUAL_DEV( 0x12d1, 0x1435, 0x0000, 0x0000,
1582     "HUAWEI MOBILE",
1583     "Mass Storage",
1584     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1585     0),
1586     -UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000,
1587     +UNUSUAL_DEV( 0x12d1, 0x1436, 0x0000, 0x0000,
1588     "HUAWEI MOBILE",
1589     "Mass Storage",
1590     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1591     0),
1592     -UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000,
1593     +UNUSUAL_DEV( 0x12d1, 0x1437, 0x0000, 0x0000,
1594     "HUAWEI MOBILE",
1595     "Mass Storage",
1596     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1597     0),
1598     -UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000,
1599     +UNUSUAL_DEV( 0x12d1, 0x1438, 0x0000, 0x0000,
1600     "HUAWEI MOBILE",
1601     "Mass Storage",
1602     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1603     0),
1604     -UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000,
1605     +UNUSUAL_DEV( 0x12d1, 0x1439, 0x0000, 0x0000,
1606     + "HUAWEI MOBILE",
1607     + "Mass Storage",
1608     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1609     + 0),
1610     +UNUSUAL_DEV( 0x12d1, 0x143A, 0x0000, 0x0000,
1611     + "HUAWEI MOBILE",
1612     + "Mass Storage",
1613     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1614     + 0),
1615     +UNUSUAL_DEV( 0x12d1, 0x143B, 0x0000, 0x0000,
1616     + "HUAWEI MOBILE",
1617     + "Mass Storage",
1618     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1619     + 0),
1620     +UNUSUAL_DEV( 0x12d1, 0x143C, 0x0000, 0x0000,
1621     + "HUAWEI MOBILE",
1622     + "Mass Storage",
1623     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1624     + 0),
1625     +UNUSUAL_DEV( 0x12d1, 0x143D, 0x0000, 0x0000,
1626     + "HUAWEI MOBILE",
1627     + "Mass Storage",
1628     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1629     + 0),
1630     +UNUSUAL_DEV( 0x12d1, 0x143E, 0x0000, 0x0000,
1631     + "HUAWEI MOBILE",
1632     + "Mass Storage",
1633     + US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1634     + 0),
1635     +UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000,
1636     "HUAWEI MOBILE",
1637     "Mass Storage",
1638     US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1639     @@ -1834,6 +2117,15 @@ UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010,
1640     US_SC_DEVICE, US_PR_DEVICE, NULL,
1641     US_FL_FIX_CAPACITY ),
1642    
1643     +/* Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
1644     + * Mio Moov 330
1645     + */
1646     +UNUSUAL_DEV( 0x3340, 0xffff, 0x0000, 0x0000,
1647     + "Mitac",
1648     + "Mio DigiWalker USB Sync",
1649     + US_SC_DEVICE,US_PR_DEVICE,NULL,
1650     + US_FL_MAX_SECTORS_64 ),
1651     +
1652     /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */
1653     UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100,
1654     "iRiver",
1655     diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
1656     index 05a2810..8782ec1 100644
1657     --- a/drivers/watchdog/ib700wdt.c
1658     +++ b/drivers/watchdog/ib700wdt.c
1659     @@ -154,7 +154,7 @@ static int ibwdt_set_heartbeat(int t)
1660     return -EINVAL;
1661    
1662     for (i = 0x0F; i > -1; i--)
1663     - if (wd_times[i] > t)
1664     + if (wd_times[i] >= t)
1665     break;
1666     wd_margin = i;
1667     return 0;
1668     diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c
1669     index f9c88d0..32fb00b 100644
1670     --- a/fs/binfmt_em86.c
1671     +++ b/fs/binfmt_em86.c
1672     @@ -43,7 +43,7 @@ static int load_em86(struct linux_binprm *bprm,struct pt_regs *regs)
1673     return -ENOEXEC;
1674     }
1675    
1676     - bprm->sh_bang = 1; /* Well, the bang-shell is implicit... */
1677     + bprm->recursion_depth++; /* Well, the bang-shell is implicit... */
1678     allow_write_access(bprm->file);
1679     fput(bprm->file);
1680     bprm->file = NULL;
1681     diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
1682     index 8d7e88e..f2744ab 100644
1683     --- a/fs/binfmt_misc.c
1684     +++ b/fs/binfmt_misc.c
1685     @@ -117,7 +117,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1686     goto _ret;
1687    
1688     retval = -ENOEXEC;
1689     - if (bprm->misc_bang)
1690     + if (bprm->recursion_depth > BINPRM_MAX_RECURSION)
1691     goto _ret;
1692    
1693     /* to keep locking time low, we copy the interpreter string */
1694     @@ -197,7 +197,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1695     if (retval < 0)
1696     goto _error;
1697    
1698     - bprm->misc_bang = 1;
1699     + bprm->recursion_depth++;
1700    
1701     retval = search_binary_handler (bprm, regs);
1702     if (retval < 0)
1703     diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
1704     index 9e3963f..0834350 100644
1705     --- a/fs/binfmt_script.c
1706     +++ b/fs/binfmt_script.c
1707     @@ -22,14 +22,15 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs)
1708     char interp[BINPRM_BUF_SIZE];
1709     int retval;
1710    
1711     - if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang))
1712     + if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') ||
1713     + (bprm->recursion_depth > BINPRM_MAX_RECURSION))
1714     return -ENOEXEC;
1715     /*
1716     * This section does the #! interpretation.
1717     * Sorta complicated, but hopefully it will work. -TYT
1718     */
1719    
1720     - bprm->sh_bang = 1;
1721     + bprm->recursion_depth++;
1722     allow_write_access(bprm->file);
1723     fput(bprm->file);
1724     bprm->file = NULL;
1725     diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
1726     index 6e2be4a..223647f 100644
1727     --- a/fs/cifs/connect.c
1728     +++ b/fs/cifs/connect.c
1729     @@ -128,7 +128,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
1730     struct mid_q_entry *mid_entry;
1731    
1732     spin_lock(&GlobalMid_Lock);
1733     - if (kthread_should_stop()) {
1734     + if (server->tcpStatus == CifsExiting) {
1735     /* the demux thread will exit normally
1736     next time through the loop */
1737     spin_unlock(&GlobalMid_Lock);
1738     @@ -182,7 +182,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
1739     spin_unlock(&GlobalMid_Lock);
1740     up(&server->tcpSem);
1741    
1742     - while ((!kthread_should_stop()) && (server->tcpStatus != CifsGood)) {
1743     + while ((server->tcpStatus != CifsExiting) &&
1744     + (server->tcpStatus != CifsGood)) {
1745     try_to_freeze();
1746     if (server->addr.sockAddr6.sin6_family == AF_INET6) {
1747     rc = ipv6_connect(&server->addr.sockAddr6,
1748     @@ -200,7 +201,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
1749     } else {
1750     atomic_inc(&tcpSesReconnectCount);
1751     spin_lock(&GlobalMid_Lock);
1752     - if (!kthread_should_stop())
1753     + if (server->tcpStatus != CifsExiting)
1754     server->tcpStatus = CifsGood;
1755     server->sequence_number = 0;
1756     spin_unlock(&GlobalMid_Lock);
1757     @@ -355,7 +356,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
1758     GFP_KERNEL);
1759    
1760     set_freezable();
1761     - while (!kthread_should_stop()) {
1762     + while (server->tcpStatus != CifsExiting) {
1763     if (try_to_freeze())
1764     continue;
1765     if (bigbuf == NULL) {
1766     @@ -396,7 +397,7 @@ incomplete_rcv:
1767     kernel_recvmsg(csocket, &smb_msg,
1768     &iov, 1, pdu_length, 0 /* BB other flags? */);
1769    
1770     - if (kthread_should_stop()) {
1771     + if (server->tcpStatus == CifsExiting) {
1772     break;
1773     } else if (server->tcpStatus == CifsNeedReconnect) {
1774     cFYI(1, ("Reconnect after server stopped responding"));
1775     @@ -527,7 +528,7 @@ incomplete_rcv:
1776     total_read += length) {
1777     length = kernel_recvmsg(csocket, &smb_msg, &iov, 1,
1778     pdu_length - total_read, 0);
1779     - if (kthread_should_stop() ||
1780     + if ((server->tcpStatus == CifsExiting) ||
1781     (length == -EINTR)) {
1782     /* then will exit */
1783     reconnect = 2;
1784     @@ -661,14 +662,6 @@ multi_t2_fnd:
1785     spin_unlock(&GlobalMid_Lock);
1786     wake_up_all(&server->response_q);
1787    
1788     - /* don't exit until kthread_stop is called */
1789     - set_current_state(TASK_UNINTERRUPTIBLE);
1790     - while (!kthread_should_stop()) {
1791     - schedule();
1792     - set_current_state(TASK_UNINTERRUPTIBLE);
1793     - }
1794     - set_current_state(TASK_RUNNING);
1795     -
1796     /* check if we have blocked requests that need to free */
1797     /* Note that cifs_max_pending is normally 50, but
1798     can be set at module install time to as little as two */
1799     @@ -764,6 +757,7 @@ multi_t2_fnd:
1800     read_unlock(&cifs_tcp_ses_lock);
1801    
1802     kfree(server->hostname);
1803     + task_to_wake = xchg(&server->tsk, NULL);
1804     kfree(server);
1805    
1806     length = atomic_dec_return(&tcpSesAllocCount);
1807     @@ -771,6 +765,16 @@ multi_t2_fnd:
1808     mempool_resize(cifs_req_poolp, length + cifs_min_rcv,
1809     GFP_KERNEL);
1810    
1811     + /* if server->tsk was NULL then wait for a signal before exiting */
1812     + if (!task_to_wake) {
1813     + set_current_state(TASK_INTERRUPTIBLE);
1814     + while (!signal_pending(current)) {
1815     + schedule();
1816     + set_current_state(TASK_INTERRUPTIBLE);
1817     + }
1818     + set_current_state(TASK_RUNNING);
1819     + }
1820     +
1821     return 0;
1822     }
1823    
1824     @@ -2310,7 +2314,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1825     /* on error free sesinfo and tcon struct if needed */
1826     mount_fail_check:
1827     if (rc) {
1828     - /* If find_unc succeeded then rc == 0 so we can not end */
1829     + /* If find_unc succeeded then rc == 0 so we can not end */
1830     /* up accidently freeing someone elses tcon struct */
1831     if (tcon)
1832     cifs_put_tcon(tcon);
1833     @@ -3715,8 +3719,10 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
1834     cERROR(1, ("Send error in SessSetup = %d", rc));
1835     } else {
1836     cFYI(1, ("CIFS Session Established successfully"));
1837     + spin_lock(&GlobalMid_Lock);
1838     pSesInfo->status = CifsGood;
1839     pSesInfo->need_reconnect = false;
1840     + spin_unlock(&GlobalMid_Lock);
1841     }
1842    
1843     ss_err_exit:
1844     diff --git a/fs/exec.c b/fs/exec.c
1845     index cecee50..b266ace 100644
1846     --- a/fs/exec.c
1847     +++ b/fs/exec.c
1848     @@ -1164,6 +1164,7 @@ EXPORT_SYMBOL(remove_arg_zero);
1849     */
1850     int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1851     {
1852     + unsigned int depth = bprm->recursion_depth;
1853     int try,retval;
1854     struct linux_binfmt *fmt;
1855     #ifdef __alpha__
1856     @@ -1224,8 +1225,15 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1857     continue;
1858     read_unlock(&binfmt_lock);
1859     retval = fn(bprm, regs);
1860     + /*
1861     + * Restore the depth counter to its starting value
1862     + * in this call, so we don't have to rely on every
1863     + * load_binary function to restore it on return.
1864     + */
1865     + bprm->recursion_depth = depth;
1866     if (retval >= 0) {
1867     - tracehook_report_exec(fmt, bprm, regs);
1868     + if (depth == 0)
1869     + tracehook_report_exec(fmt, bprm, regs);
1870     put_binfmt(fmt);
1871     allow_write_access(bprm->file);
1872     if (bprm->file)
1873     diff --git a/fs/fcntl.c b/fs/fcntl.c
1874     index ac4f7db..549daf8 100644
1875     --- a/fs/fcntl.c
1876     +++ b/fs/fcntl.c
1877     @@ -19,6 +19,7 @@
1878     #include <linux/signal.h>
1879     #include <linux/rcupdate.h>
1880     #include <linux/pid_namespace.h>
1881     +#include <linux/smp_lock.h>
1882    
1883     #include <asm/poll.h>
1884     #include <asm/siginfo.h>
1885     @@ -175,6 +176,11 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
1886     if (error)
1887     return error;
1888    
1889     + /*
1890     + * We still need a lock here for now to keep multiple FASYNC calls
1891     + * from racing with each other.
1892     + */
1893     + lock_kernel();
1894     if ((arg ^ filp->f_flags) & FASYNC) {
1895     if (filp->f_op && filp->f_op->fasync) {
1896     error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
1897     @@ -185,6 +191,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
1898    
1899     filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK);
1900     out:
1901     + unlock_kernel();
1902     return error;
1903     }
1904    
1905     diff --git a/fs/ioctl.c b/fs/ioctl.c
1906     index 7db32b3..612e0b2 100644
1907     --- a/fs/ioctl.c
1908     +++ b/fs/ioctl.c
1909     @@ -123,11 +123,9 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp,
1910    
1911     /* Did FASYNC state change ? */
1912     if ((flag ^ filp->f_flags) & FASYNC) {
1913     - if (filp->f_op && filp->f_op->fasync) {
1914     - lock_kernel();
1915     + if (filp->f_op && filp->f_op->fasync)
1916     error = filp->f_op->fasync(fd, filp, on);
1917     - unlock_kernel();
1918     - } else
1919     + else
1920     error = -ENOTTY;
1921     }
1922     if (error)
1923     @@ -163,11 +161,17 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1924     break;
1925    
1926     case FIONBIO:
1927     + /* BKL needed to avoid races tweaking f_flags */
1928     + lock_kernel();
1929     error = ioctl_fionbio(filp, argp);
1930     + unlock_kernel();
1931     break;
1932    
1933     case FIOASYNC:
1934     + /* BKL needed to avoid races tweaking f_flags */
1935     + lock_kernel();
1936     error = ioctl_fioasync(fd, filp, argp);
1937     + unlock_kernel();
1938     break;
1939    
1940     case FIOQSIZE:
1941     diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c
1942     index a5432bb..fe85219 100644
1943     --- a/fs/jbd/checkpoint.c
1944     +++ b/fs/jbd/checkpoint.c
1945     @@ -93,7 +93,8 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
1946     int ret = 0;
1947     struct buffer_head *bh = jh2bh(jh);
1948    
1949     - if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) {
1950     + if (jh->b_jlist == BJ_None && !buffer_locked(bh) &&
1951     + !buffer_dirty(bh) && !buffer_write_io_error(bh)) {
1952     JBUFFER_TRACE(jh, "remove from checkpoint list");
1953     ret = __journal_remove_checkpoint(jh) + 1;
1954     jbd_unlock_bh_state(bh);
1955     @@ -160,21 +161,25 @@ static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh)
1956     * buffers. Note that we take the buffers in the opposite ordering
1957     * from the one in which they were submitted for IO.
1958     *
1959     + * Return 0 on success, and return <0 if some buffers have failed
1960     + * to be written out.
1961     + *
1962     * Called with j_list_lock held.
1963     */
1964     -static void __wait_cp_io(journal_t *journal, transaction_t *transaction)
1965     +static int __wait_cp_io(journal_t *journal, transaction_t *transaction)
1966     {
1967     struct journal_head *jh;
1968     struct buffer_head *bh;
1969     tid_t this_tid;
1970     int released = 0;
1971     + int ret = 0;
1972    
1973     this_tid = transaction->t_tid;
1974     restart:
1975     /* Did somebody clean up the transaction in the meanwhile? */
1976     if (journal->j_checkpoint_transactions != transaction ||
1977     transaction->t_tid != this_tid)
1978     - return;
1979     + return ret;
1980     while (!released && transaction->t_checkpoint_io_list) {
1981     jh = transaction->t_checkpoint_io_list;
1982     bh = jh2bh(jh);
1983     @@ -194,6 +199,9 @@ restart:
1984     spin_lock(&journal->j_list_lock);
1985     goto restart;
1986     }
1987     + if (unlikely(buffer_write_io_error(bh)))
1988     + ret = -EIO;
1989     +
1990     /*
1991     * Now in whatever state the buffer currently is, we know that
1992     * it has been written out and so we can drop it from the list
1993     @@ -203,6 +211,8 @@ restart:
1994     journal_remove_journal_head(bh);
1995     __brelse(bh);
1996     }
1997     +
1998     + return ret;
1999     }
2000    
2001     #define NR_BATCH 64
2002     @@ -226,7 +236,8 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count)
2003     * Try to flush one buffer from the checkpoint list to disk.
2004     *
2005     * Return 1 if something happened which requires us to abort the current
2006     - * scan of the checkpoint list.
2007     + * scan of the checkpoint list. Return <0 if the buffer has failed to
2008     + * be written out.
2009     *
2010     * Called with j_list_lock held and drops it if 1 is returned
2011     * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it
2012     @@ -256,6 +267,9 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
2013     log_wait_commit(journal, tid);
2014     ret = 1;
2015     } else if (!buffer_dirty(bh)) {
2016     + ret = 1;
2017     + if (unlikely(buffer_write_io_error(bh)))
2018     + ret = -EIO;
2019     J_ASSERT_JH(jh, !buffer_jbddirty(bh));
2020     BUFFER_TRACE(bh, "remove from checkpoint");
2021     __journal_remove_checkpoint(jh);
2022     @@ -263,7 +277,6 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
2023     jbd_unlock_bh_state(bh);
2024     journal_remove_journal_head(bh);
2025     __brelse(bh);
2026     - ret = 1;
2027     } else {
2028     /*
2029     * Important: we are about to write the buffer, and
2030     @@ -295,6 +308,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
2031     * to disk. We submit larger chunks of data at once.
2032     *
2033     * The journal should be locked before calling this function.
2034     + * Called with j_checkpoint_mutex held.
2035     */
2036     int log_do_checkpoint(journal_t *journal)
2037     {
2038     @@ -318,6 +332,7 @@ int log_do_checkpoint(journal_t *journal)
2039     * OK, we need to start writing disk blocks. Take one transaction
2040     * and write it.
2041     */
2042     + result = 0;
2043     spin_lock(&journal->j_list_lock);
2044     if (!journal->j_checkpoint_transactions)
2045     goto out;
2046     @@ -334,7 +349,7 @@ restart:
2047     int batch_count = 0;
2048     struct buffer_head *bhs[NR_BATCH];
2049     struct journal_head *jh;
2050     - int retry = 0;
2051     + int retry = 0, err;
2052    
2053     while (!retry && transaction->t_checkpoint_list) {
2054     struct buffer_head *bh;
2055     @@ -347,6 +362,8 @@ restart:
2056     break;
2057     }
2058     retry = __process_buffer(journal, jh, bhs,&batch_count);
2059     + if (retry < 0 && !result)
2060     + result = retry;
2061     if (!retry && (need_resched() ||
2062     spin_needbreak(&journal->j_list_lock))) {
2063     spin_unlock(&journal->j_list_lock);
2064     @@ -371,14 +388,18 @@ restart:
2065     * Now we have cleaned up the first transaction's checkpoint
2066     * list. Let's clean up the second one
2067     */
2068     - __wait_cp_io(journal, transaction);
2069     + err = __wait_cp_io(journal, transaction);
2070     + if (!result)
2071     + result = err;
2072     }
2073     out:
2074     spin_unlock(&journal->j_list_lock);
2075     - result = cleanup_journal_tail(journal);
2076     if (result < 0)
2077     - return result;
2078     - return 0;
2079     + journal_abort(journal, result);
2080     + else
2081     + result = cleanup_journal_tail(journal);
2082     +
2083     + return (result < 0) ? result : 0;
2084     }
2085    
2086     /*
2087     @@ -394,8 +415,9 @@ out:
2088     * This is the only part of the journaling code which really needs to be
2089     * aware of transaction aborts. Checkpointing involves writing to the
2090     * main filesystem area rather than to the journal, so it can proceed
2091     - * even in abort state, but we must not update the journal superblock if
2092     - * we have an abort error outstanding.
2093     + * even in abort state, but we must not update the super block if
2094     + * checkpointing may have failed. Otherwise, we would lose some metadata
2095     + * buffers which should be written-back to the filesystem.
2096     */
2097    
2098     int cleanup_journal_tail(journal_t *journal)
2099     @@ -404,6 +426,9 @@ int cleanup_journal_tail(journal_t *journal)
2100     tid_t first_tid;
2101     unsigned long blocknr, freed;
2102    
2103     + if (is_journal_aborted(journal))
2104     + return 1;
2105     +
2106     /* OK, work out the oldest transaction remaining in the log, and
2107     * the log block it starts at.
2108     *
2109     diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
2110     index aa7143a..9e4fa52 100644
2111     --- a/fs/jbd/journal.c
2112     +++ b/fs/jbd/journal.c
2113     @@ -1121,9 +1121,12 @@ recovery_error:
2114     *
2115     * Release a journal_t structure once it is no longer in use by the
2116     * journaled object.
2117     + * Return <0 if we couldn't clean up the journal.
2118     */
2119     -void journal_destroy(journal_t *journal)
2120     +int journal_destroy(journal_t *journal)
2121     {
2122     + int err = 0;
2123     +
2124     /* Wait for the commit thread to wake up and die. */
2125     journal_kill_thread(journal);
2126    
2127     @@ -1146,11 +1149,16 @@ void journal_destroy(journal_t *journal)
2128     J_ASSERT(journal->j_checkpoint_transactions == NULL);
2129     spin_unlock(&journal->j_list_lock);
2130    
2131     - /* We can now mark the journal as empty. */
2132     - journal->j_tail = 0;
2133     - journal->j_tail_sequence = ++journal->j_transaction_sequence;
2134     if (journal->j_sb_buffer) {
2135     - journal_update_superblock(journal, 1);
2136     + if (!is_journal_aborted(journal)) {
2137     + /* We can now mark the journal as empty. */
2138     + journal->j_tail = 0;
2139     + journal->j_tail_sequence =
2140     + ++journal->j_transaction_sequence;
2141     + journal_update_superblock(journal, 1);
2142     + } else {
2143     + err = -EIO;
2144     + }
2145     brelse(journal->j_sb_buffer);
2146     }
2147    
2148     @@ -1160,6 +1168,8 @@ void journal_destroy(journal_t *journal)
2149     journal_destroy_revoke(journal);
2150     kfree(journal->j_wbuf);
2151     kfree(journal);
2152     +
2153     + return err;
2154     }
2155    
2156    
2157     @@ -1359,10 +1369,16 @@ int journal_flush(journal_t *journal)
2158     spin_lock(&journal->j_list_lock);
2159     while (!err && journal->j_checkpoint_transactions != NULL) {
2160     spin_unlock(&journal->j_list_lock);
2161     + mutex_lock(&journal->j_checkpoint_mutex);
2162     err = log_do_checkpoint(journal);
2163     + mutex_unlock(&journal->j_checkpoint_mutex);
2164     spin_lock(&journal->j_list_lock);
2165     }
2166     spin_unlock(&journal->j_list_lock);
2167     +
2168     + if (is_journal_aborted(journal))
2169     + return -EIO;
2170     +
2171     cleanup_journal_tail(journal);
2172    
2173     /* Finally, mark the journal as really needing no recovery.
2174     @@ -1384,7 +1400,7 @@ int journal_flush(journal_t *journal)
2175     J_ASSERT(journal->j_head == journal->j_tail);
2176     J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence);
2177     spin_unlock(&journal->j_state_lock);
2178     - return err;
2179     + return 0;
2180     }
2181    
2182     /**
2183     diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
2184     index 43bc5e5..db5e982 100644
2185     --- a/fs/jbd/recovery.c
2186     +++ b/fs/jbd/recovery.c
2187     @@ -223,7 +223,7 @@ do { \
2188     */
2189     int journal_recover(journal_t *journal)
2190     {
2191     - int err;
2192     + int err, err2;
2193     journal_superblock_t * sb;
2194    
2195     struct recovery_info info;
2196     @@ -261,7 +261,10 @@ int journal_recover(journal_t *journal)
2197     journal->j_transaction_sequence = ++info.end_transaction;
2198    
2199     journal_clear_revoke(journal);
2200     - sync_blockdev(journal->j_fs_dev);
2201     + err2 = sync_blockdev(journal->j_fs_dev);
2202     + if (!err)
2203     + err = err2;
2204     +
2205     return err;
2206     }
2207    
2208     diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
2209     index f3ada04..8b84227 100644
2210     --- a/fs/proc/task_mmu.c
2211     +++ b/fs/proc/task_mmu.c
2212     @@ -563,9 +563,9 @@ static u64 swap_pte_to_pagemap_entry(pte_t pte)
2213     return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT);
2214     }
2215    
2216     -static unsigned long pte_to_pagemap_entry(pte_t pte)
2217     +static u64 pte_to_pagemap_entry(pte_t pte)
2218     {
2219     - unsigned long pme = 0;
2220     + u64 pme = 0;
2221     if (is_swap_pte(pte))
2222     pme = PM_PFRAME(swap_pte_to_pagemap_entry(pte))
2223     | PM_PSHIFT(PAGE_SHIFT) | PM_SWAP;
2224     diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
2225     index d700dac..c903130 100644
2226     --- a/fs/xfs/xfs_rename.c
2227     +++ b/fs/xfs/xfs_rename.c
2228     @@ -212,7 +212,7 @@ xfs_rename(
2229     if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
2230     (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
2231     error = XFS_ERROR(EXDEV);
2232     - xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
2233     + xfs_rename_unlock4(inodes, XFS_ILOCK_EXCL);
2234     xfs_trans_cancel(tp, cancel_flags);
2235     goto std_return;
2236     }
2237     diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
2238     index 826f623..12413a1 100644
2239     --- a/include/linux/binfmts.h
2240     +++ b/include/linux/binfmts.h
2241     @@ -36,6 +36,7 @@ struct linux_binprm{
2242     unsigned long p; /* current top of mem */
2243     unsigned int sh_bang:1,
2244     misc_bang:1;
2245     + unsigned int recursion_depth;
2246     struct file * file;
2247     int e_uid, e_gid;
2248     kernel_cap_t cap_post_exec_permitted;
2249     @@ -58,6 +59,7 @@ struct linux_binprm{
2250     #define BINPRM_FLAGS_EXECFD_BIT 1
2251     #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
2252    
2253     +#define BINPRM_MAX_RECURSION 4
2254    
2255     /*
2256     * This structure defines the functions that are used to load the binary formats that
2257     diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
2258     index 53ea933..73f4532 100644
2259     --- a/include/linux/blkdev.h
2260     +++ b/include/linux/blkdev.h
2261     @@ -623,6 +623,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
2262     * default timeout for SG_IO if none specified
2263     */
2264     #define BLK_DEFAULT_SG_TIMEOUT (60 * HZ)
2265     +#define BLK_MIN_SG_TIMEOUT (7 * HZ)
2266    
2267     #ifdef CONFIG_BOUNCE
2268     extern int init_emergency_isa_pool(void);
2269     diff --git a/include/linux/jbd.h b/include/linux/jbd.h
2270     index 07a9b52..0be86be 100644
2271     --- a/include/linux/jbd.h
2272     +++ b/include/linux/jbd.h
2273     @@ -908,7 +908,7 @@ extern int journal_set_features
2274     (journal_t *, unsigned long, unsigned long, unsigned long);
2275     extern int journal_create (journal_t *);
2276     extern int journal_load (journal_t *journal);
2277     -extern void journal_destroy (journal_t *);
2278     +extern int journal_destroy (journal_t *);
2279     extern int journal_recover (journal_t *journal);
2280     extern int journal_wipe (journal_t *, int);
2281     extern int journal_skip_recovery (journal_t *);
2282     diff --git a/include/linux/pnp.h b/include/linux/pnp.h
2283     index be764e5..53b70fd 100644
2284     --- a/include/linux/pnp.h
2285     +++ b/include/linux/pnp.h
2286     @@ -22,9 +22,11 @@ struct pnp_dev;
2287     * Resource Management
2288     */
2289     #ifdef CONFIG_PNP
2290     -struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
2291     +struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned long type,
2292     + unsigned int num);
2293     #else
2294     -static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num)
2295     +static inline struct resource *pnp_get_resource(struct pnp_dev *dev,
2296     + unsigned long type, unsigned int num)
2297     {
2298     return NULL;
2299     }
2300     diff --git a/kernel/fork.c b/kernel/fork.c
2301     index 7ce2ebe..d8ad2c6 100644
2302     --- a/kernel/fork.c
2303     +++ b/kernel/fork.c
2304     @@ -313,17 +313,20 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
2305     file = tmp->vm_file;
2306     if (file) {
2307     struct inode *inode = file->f_path.dentry->d_inode;
2308     + struct address_space *mapping = file->f_mapping;
2309     +
2310     get_file(file);
2311     if (tmp->vm_flags & VM_DENYWRITE)
2312     atomic_dec(&inode->i_writecount);
2313     -
2314     - /* insert tmp into the share list, just after mpnt */
2315     - spin_lock(&file->f_mapping->i_mmap_lock);
2316     + spin_lock(&mapping->i_mmap_lock);
2317     + if (tmp->vm_flags & VM_SHARED)
2318     + mapping->i_mmap_writable++;
2319     tmp->vm_truncate_count = mpnt->vm_truncate_count;
2320     - flush_dcache_mmap_lock(file->f_mapping);
2321     + flush_dcache_mmap_lock(mapping);
2322     + /* insert tmp into the share list, just after mpnt */
2323     vma_prio_tree_add(tmp, mpnt);
2324     - flush_dcache_mmap_unlock(file->f_mapping);
2325     - spin_unlock(&file->f_mapping->i_mmap_lock);
2326     + flush_dcache_mmap_unlock(mapping);
2327     + spin_unlock(&mapping->i_mmap_lock);
2328     }
2329    
2330     /*
2331     diff --git a/kernel/sched.c b/kernel/sched.c
2332     index a992cbe..92c0a70 100644
2333     --- a/kernel/sched.c
2334     +++ b/kernel/sched.c
2335     @@ -6500,7 +6500,9 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
2336     req = list_entry(rq->migration_queue.next,
2337     struct migration_req, list);
2338     list_del_init(&req->list);
2339     + spin_unlock_irq(&rq->lock);
2340     complete(&req->done);
2341     + spin_lock_irq(&rq->lock);
2342     }
2343     spin_unlock_irq(&rq->lock);
2344     break;
2345     @@ -6802,15 +6804,17 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
2346     struct sched_domain *tmp;
2347    
2348     /* Remove the sched domains which do not contribute to scheduling. */
2349     - for (tmp = sd; tmp; tmp = tmp->parent) {
2350     + for (tmp = sd; tmp; ) {
2351     struct sched_domain *parent = tmp->parent;
2352     if (!parent)
2353     break;
2354     +
2355     if (sd_parent_degenerate(tmp, parent)) {
2356     tmp->parent = parent->parent;
2357     if (parent->parent)
2358     parent->parent->child = tmp;
2359     - }
2360     + } else
2361     + tmp = tmp->parent;
2362     }
2363    
2364     if (sd && sd_degenerate(sd)) {
2365     diff --git a/net/atm/svc.c b/net/atm/svc.c
2366     index de1e4f2..8fb54dc 100644
2367     --- a/net/atm/svc.c
2368     +++ b/net/atm/svc.c
2369     @@ -293,7 +293,10 @@ static int svc_listen(struct socket *sock,int backlog)
2370     error = -EINVAL;
2371     goto out;
2372     }
2373     - vcc_insert_socket(sk);
2374     + if (test_bit(ATM_VF_LISTEN, &vcc->flags)) {
2375     + error = -EADDRINUSE;
2376     + goto out;
2377     + }
2378     set_bit(ATM_VF_WAITING, &vcc->flags);
2379     prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
2380     sigd_enq(vcc,as_listen,NULL,NULL,&vcc->local);
2381     @@ -307,6 +310,7 @@ static int svc_listen(struct socket *sock,int backlog)
2382     goto out;
2383     }
2384     set_bit(ATM_VF_LISTEN,&vcc->flags);
2385     + vcc_insert_socket(sk);
2386     sk->sk_max_ack_backlog = backlog > 0 ? backlog : ATM_BACKLOG_DEFAULT;
2387     error = -sk->sk_err;
2388     out:
2389     diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
2390     index 57e26fa..915e6b7 100644
2391     --- a/net/ipv4/udp.c
2392     +++ b/net/ipv4/udp.c
2393     @@ -302,7 +302,7 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
2394     return result;
2395     }
2396    
2397     -static inline struct sock *udp_v4_mcast_next(struct sock *sk,
2398     +static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk,
2399     __be16 loc_port, __be32 loc_addr,
2400     __be16 rmt_port, __be32 rmt_addr,
2401     int dif)
2402     @@ -314,7 +314,8 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk,
2403     sk_for_each_from(s, node) {
2404     struct inet_sock *inet = inet_sk(s);
2405    
2406     - if (s->sk_hash != hnum ||
2407     + if (!net_eq(sock_net(s), net) ||
2408     + s->sk_hash != hnum ||
2409     (inet->daddr && inet->daddr != rmt_addr) ||
2410     (inet->dport != rmt_port && inet->dport) ||
2411     (inet->rcv_saddr && inet->rcv_saddr != loc_addr) ||
2412     @@ -1097,15 +1098,16 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
2413     read_lock(&udp_hash_lock);
2414     sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]);
2415     dif = skb->dev->ifindex;
2416     - sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
2417     + sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
2418     if (sk) {
2419     struct sock *sknext = NULL;
2420    
2421     do {
2422     struct sk_buff *skb1 = skb;
2423    
2424     - sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr,
2425     - uh->source, saddr, dif);
2426     + sknext = udp_v4_mcast_next(net, sk_next(sk), uh->dest,
2427     + daddr, uh->source, saddr,
2428     + dif);
2429     if (sknext)
2430     skb1 = skb_clone(skb, GFP_ATOMIC);
2431    
2432     diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
2433     index a6aecf7..e53d101 100644
2434     --- a/net/ipv6/udp.c
2435     +++ b/net/ipv6/udp.c
2436     @@ -313,7 +313,7 @@ drop:
2437     return -1;
2438     }
2439    
2440     -static struct sock *udp_v6_mcast_next(struct sock *sk,
2441     +static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk,
2442     __be16 loc_port, struct in6_addr *loc_addr,
2443     __be16 rmt_port, struct in6_addr *rmt_addr,
2444     int dif)
2445     @@ -325,7 +325,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
2446     sk_for_each_from(s, node) {
2447     struct inet_sock *inet = inet_sk(s);
2448    
2449     - if (sock_net(s) != sock_net(sk))
2450     + if (!net_eq(sock_net(s), net))
2451     continue;
2452    
2453     if (s->sk_hash == num && s->sk_family == PF_INET6) {
2454     @@ -368,14 +368,14 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
2455     read_lock(&udp_hash_lock);
2456     sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]);
2457     dif = inet6_iif(skb);
2458     - sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
2459     + sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
2460     if (!sk) {
2461     kfree_skb(skb);
2462     goto out;
2463     }
2464    
2465     sk2 = sk;
2466     - while ((sk2 = udp_v6_mcast_next(sk_next(sk2), uh->dest, daddr,
2467     + while ((sk2 = udp_v6_mcast_next(net, sk_next(sk2), uh->dest, daddr,
2468     uh->source, saddr, dif))) {
2469     struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC);
2470     if (buff) {
2471     diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
2472     index b0785ef..8e66fe0 100644
2473     --- a/net/unix/af_unix.c
2474     +++ b/net/unix/af_unix.c
2475     @@ -2230,7 +2230,7 @@ static int unix_net_init(struct net *net)
2476     #endif
2477     error = 0;
2478     out:
2479     - return 0;
2480     + return error;
2481     }
2482    
2483     static void unix_net_exit(struct net *net)
2484     diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
2485     index 2f283ea..de5ee8f 100644
2486     --- a/sound/pci/emu10k1/emu10k1_main.c
2487     +++ b/sound/pci/emu10k1/emu10k1_main.c
2488     @@ -1464,6 +1464,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
2489     .ca0151_chip = 1,
2490     .spk71 = 1,
2491     .spdif_bug = 1,
2492     + .invert_shared_spdif = 1, /* digital/analog switch swapped */
2493     .ac97_chip = 1} ,
2494     {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
2495     .driver = "Audigy2", .name = "Audigy 2 ZS [SB0350]",
2496     @@ -1473,6 +1474,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
2497     .ca0151_chip = 1,
2498     .spk71 = 1,
2499     .spdif_bug = 1,
2500     + .invert_shared_spdif = 1, /* digital/analog switch swapped */
2501     .ac97_chip = 1} ,
2502     {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102,
2503     .driver = "Audigy2", .name = "Audigy 2 ZS [2001]",
2504     @@ -1482,6 +1484,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
2505     .ca0151_chip = 1,
2506     .spk71 = 1,
2507     .spdif_bug = 1,
2508     + .invert_shared_spdif = 1, /* digital/analog switch swapped */
2509     .ac97_chip = 1} ,
2510     /* Audigy 2 */
2511     /* Tested by James@superbug.co.uk 3rd July 2005 */
2512     diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
2513     index 1e5aff5..2fe4ea1 100644
2514     --- a/sound/pci/hda/hda_proc.c
2515     +++ b/sound/pci/hda/hda_proc.c
2516     @@ -216,7 +216,7 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
2517     unsigned int caps, val;
2518    
2519     caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
2520     - snd_iprintf(buffer, " Pincap 0x08%x:", caps);
2521     + snd_iprintf(buffer, " Pincap 0x%08x:", caps);
2522     if (caps & AC_PINCAP_IN)
2523     snd_iprintf(buffer, " IN");
2524     if (caps & AC_PINCAP_OUT)
2525     diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
2526     index e8003d9..cb13307 100644
2527     --- a/sound/pci/hda/patch_analog.c
2528     +++ b/sound/pci/hda/patch_analog.c
2529     @@ -2247,8 +2247,12 @@ static struct hda_verb ad1988_spdif_init_verbs[] = {
2530    
2531     /* AD1989 has no ADC -> SPDIF route */
2532     static struct hda_verb ad1989_spdif_init_verbs[] = {
2533     - /* SPDIF out pin */
2534     + /* SPDIF-1 out pin */
2535     + {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2536     {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
2537     + /* SPDIF-2/HDMI out pin */
2538     + {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2539     + {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
2540     { }
2541     };
2542    
2543     @@ -2868,6 +2872,7 @@ static struct snd_pci_quirk ad1988_cfg_tbl[] = {
2544     SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
2545     SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
2546     SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG),
2547     + SND_PCI_QUIRK(0x1043, 0x8311, "Asus P5Q-Premium/Pro", AD1988_6STACK_DIG),
2548     {}
2549     };
2550    
2551     @@ -3842,6 +3847,9 @@ static const char *ad1884a_models[AD1884A_MODELS] = {
2552    
2553     static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
2554     SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
2555     + SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE),
2556     + SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP),
2557     + SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP),
2558     SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD),
2559     {}
2560     };
2561     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2562     index 6602516..a1a3a34 100644
2563     --- a/sound/pci/hda/patch_realtek.c
2564     +++ b/sound/pci/hda/patch_realtek.c
2565     @@ -100,6 +100,7 @@ enum {
2566     ALC262_BENQ_T31,
2567     ALC262_ULTRA,
2568     ALC262_LENOVO_3000,
2569     + ALC262_NEC,
2570     ALC262_AUTO,
2571     ALC262_MODEL_LAST /* last tag */
2572     };
2573     @@ -291,6 +292,13 @@ struct alc_spec {
2574     /* for PLL fix */
2575     hda_nid_t pll_nid;
2576     unsigned int pll_coef_idx, pll_coef_bit;
2577     +
2578     +#ifdef SND_HDA_NEEDS_RESUME
2579     +#define ALC_MAX_PINS 16
2580     + unsigned int num_pins;
2581     + hda_nid_t pin_nids[ALC_MAX_PINS];
2582     + unsigned int pin_cfgs[ALC_MAX_PINS];
2583     +#endif
2584     };
2585    
2586     /*
2587     @@ -2722,6 +2730,64 @@ static void alc_free(struct hda_codec *codec)
2588     codec->spec = NULL; /* to be sure */
2589     }
2590    
2591     +#ifdef SND_HDA_NEEDS_RESUME
2592     +static void store_pin_configs(struct hda_codec *codec)
2593     +{
2594     + struct alc_spec *spec = codec->spec;
2595     + hda_nid_t nid, end_nid;
2596     +
2597     + end_nid = codec->start_nid + codec->num_nodes;
2598     + for (nid = codec->start_nid; nid < end_nid; nid++) {
2599     + unsigned int wid_caps = get_wcaps(codec, nid);
2600     + unsigned int wid_type =
2601     + (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
2602     + if (wid_type != AC_WID_PIN)
2603     + continue;
2604     + if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
2605     + break;
2606     + spec->pin_nids[spec->num_pins] = nid;
2607     + spec->pin_cfgs[spec->num_pins] =
2608     + snd_hda_codec_read(codec, nid, 0,
2609     + AC_VERB_GET_CONFIG_DEFAULT, 0);
2610     + spec->num_pins++;
2611     + }
2612     +}
2613     +
2614     +static void resume_pin_configs(struct hda_codec *codec)
2615     +{
2616     + struct alc_spec *spec = codec->spec;
2617     + int i;
2618     +
2619     + for (i = 0; i < spec->num_pins; i++) {
2620     + hda_nid_t pin_nid = spec->pin_nids[i];
2621     + unsigned int pin_config = spec->pin_cfgs[i];
2622     + snd_hda_codec_write(codec, pin_nid, 0,
2623     + AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
2624     + pin_config & 0x000000ff);
2625     + snd_hda_codec_write(codec, pin_nid, 0,
2626     + AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
2627     + (pin_config & 0x0000ff00) >> 8);
2628     + snd_hda_codec_write(codec, pin_nid, 0,
2629     + AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
2630     + (pin_config & 0x00ff0000) >> 16);
2631     + snd_hda_codec_write(codec, pin_nid, 0,
2632     + AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
2633     + pin_config >> 24);
2634     + }
2635     +}
2636     +
2637     +static int alc_resume(struct hda_codec *codec)
2638     +{
2639     + resume_pin_configs(codec);
2640     + codec->patch_ops.init(codec);
2641     + snd_hda_codec_resume_amp(codec);
2642     + snd_hda_codec_resume_cache(codec);
2643     + return 0;
2644     +}
2645     +#else
2646     +#define store_pin_configs(codec)
2647     +#endif
2648     +
2649     /*
2650     */
2651     static struct hda_codec_ops alc_patch_ops = {
2652     @@ -2730,6 +2796,9 @@ static struct hda_codec_ops alc_patch_ops = {
2653     .init = alc_init,
2654     .free = alc_free,
2655     .unsol_event = alc_unsol_event,
2656     +#ifdef SND_HDA_NEEDS_RESUME
2657     + .resume = alc_resume,
2658     +#endif
2659     #ifdef CONFIG_SND_HDA_POWER_SAVE
2660     .check_power_status = alc_check_power_status,
2661     #endif
2662     @@ -3776,6 +3845,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
2663     spec->num_mux_defs = 1;
2664     spec->input_mux = &spec->private_imux;
2665    
2666     + store_pin_configs(codec);
2667     return 1;
2668     }
2669    
2670     @@ -5124,6 +5194,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
2671     }
2672     spec->num_mixers++;
2673    
2674     + store_pin_configs(codec);
2675     return 1;
2676     }
2677    
2678     @@ -6554,6 +6625,7 @@ static int patch_alc882(struct hda_codec *codec)
2679     board_config = ALC885_MACPRO;
2680     break;
2681     case 0x106b1000: /* iMac 24 */
2682     + case 0x106b2800: /* AppleTV */
2683     board_config = ALC885_IMAC24;
2684     break;
2685     case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
2686     @@ -6563,7 +6635,8 @@ static int patch_alc882(struct hda_codec *codec)
2687     break;
2688     default:
2689     /* ALC889A is handled better as ALC888-compatible */
2690     - if (codec->revision_id == 0x100103) {
2691     + if (codec->revision_id == 0x100101 ||
2692     + codec->revision_id == 0x100103) {
2693     alc_free(codec);
2694     return patch_alc883(codec);
2695     }
2696     @@ -7940,6 +8013,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
2697     static struct snd_pci_quirk alc883_cfg_tbl[] = {
2698     SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
2699     SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
2700     + SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
2701     SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
2702     SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
2703     SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
2704     @@ -7990,6 +8064,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
2705     SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2706     SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2707     SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
2708     + SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
2709     SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
2710     SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
2711     SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
2712     @@ -8948,6 +9023,41 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
2713     }
2714    
2715     /*
2716     + * nec model
2717     + * 0x15 = headphone
2718     + * 0x16 = internal speaker
2719     + * 0x18 = external mic
2720     + */
2721     +
2722     +static struct snd_kcontrol_new alc262_nec_mixer[] = {
2723     + HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2724     + HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
2725     +
2726     + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2727     + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2728     + HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2729     +
2730     + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2731     + HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2732     + { } /* end */
2733     +};
2734     +
2735     +static struct hda_verb alc262_nec_verbs[] = {
2736     + /* Unmute Speaker */
2737     + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2738     +
2739     + /* Headphone */
2740     + {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2741     + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2742     +
2743     + /* External mic to headphone */
2744     + {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2745     + /* External mic to speaker */
2746     + {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2747     + {}
2748     +};
2749     +
2750     +/*
2751     * fujitsu model
2752     * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
2753     * 0x1b = port replicator headphone out
2754     @@ -9693,6 +9803,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
2755     if (err < 0)
2756     return err;
2757    
2758     + store_pin_configs(codec);
2759     return 1;
2760     }
2761    
2762     @@ -9731,11 +9842,13 @@ static const char *alc262_models[ALC262_MODEL_LAST] = {
2763     [ALC262_SONY_ASSAMD] = "sony-assamd",
2764     [ALC262_ULTRA] = "ultra",
2765     [ALC262_LENOVO_3000] = "lenovo-3000",
2766     + [ALC262_NEC] = "nec",
2767     [ALC262_AUTO] = "auto",
2768     };
2769    
2770     static struct snd_pci_quirk alc262_cfg_tbl[] = {
2771     SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
2772     + SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
2773     SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC),
2774     SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC),
2775     SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC),
2776     @@ -9946,6 +10059,16 @@ static struct alc_config_preset alc262_presets[] = {
2777     .input_mux = &alc262_fujitsu_capture_source,
2778     .unsol_event = alc262_lenovo_3000_unsol_event,
2779     },
2780     + [ALC262_NEC] = {
2781     + .mixers = { alc262_nec_mixer },
2782     + .init_verbs = { alc262_nec_verbs },
2783     + .num_dacs = ARRAY_SIZE(alc262_dac_nids),
2784     + .dac_nids = alc262_dac_nids,
2785     + .hp_nid = 0x03,
2786     + .num_channel_mode = ARRAY_SIZE(alc262_modes),
2787     + .channel_mode = alc262_modes,
2788     + .input_mux = &alc262_capture_source,
2789     + },
2790     };
2791    
2792     static int patch_alc262(struct hda_codec *codec)
2793     @@ -10712,6 +10835,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
2794     if (err < 0)
2795     return err;
2796    
2797     + store_pin_configs(codec);
2798     return 1;
2799     }
2800    
2801     @@ -10758,6 +10882,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
2802     SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
2803     SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA),
2804     SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA),
2805     + SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA),
2806     SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
2807     SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
2808     SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
2809     @@ -10990,6 +11115,14 @@ static hda_nid_t alc269_adc_nids[1] = {
2810     0x08,
2811     };
2812    
2813     +static hda_nid_t alc269_capsrc_nids[1] = {
2814     + 0x23,
2815     +};
2816     +
2817     +/* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
2818     + * not a mux!
2819     + */
2820     +
2821     static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
2822     .num_items = 2,
2823     .items = {
2824     @@ -11356,6 +11489,10 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
2825     spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs;
2826     spec->num_mux_defs = 1;
2827     spec->input_mux = &spec->private_imux;
2828     + /* set default input source */
2829     + snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
2830     + 0, AC_VERB_SET_CONNECT_SEL,
2831     + spec->input_mux->items[0].index);
2832    
2833     err = alc_auto_add_mic_boost(codec);
2834     if (err < 0)
2835     @@ -11364,6 +11501,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
2836     spec->mixers[spec->num_mixers] = alc269_capture_mixer;
2837     spec->num_mixers++;
2838    
2839     + store_pin_configs(codec);
2840     return 1;
2841     }
2842    
2843     @@ -11488,6 +11626,7 @@ static int patch_alc269(struct hda_codec *codec)
2844    
2845     spec->adc_nids = alc269_adc_nids;
2846     spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
2847     + spec->capsrc_nids = alc269_capsrc_nids;
2848    
2849     codec->patch_ops = alc_patch_ops;
2850     if (board_config == ALC269_AUTO)
2851     @@ -12431,6 +12570,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
2852     spec->mixers[spec->num_mixers] = alc861_capture_mixer;
2853     spec->num_mixers++;
2854    
2855     + store_pin_configs(codec);
2856     return 1;
2857     }
2858    
2859     @@ -13542,6 +13682,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
2860     if (err < 0)
2861     return err;
2862    
2863     + store_pin_configs(codec);
2864     return 1;
2865     }
2866    
2867     @@ -14789,6 +14930,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
2868    
2869     spec->mixers[spec->num_mixers] = alc662_capture_mixer;
2870     spec->num_mixers++;
2871     +
2872     + store_pin_configs(codec);
2873     return 1;
2874     }
2875    
2876     @@ -14846,6 +14989,9 @@ static int patch_alc662(struct hda_codec *codec)
2877     if (codec->vendor_id == 0x10ec0663) {
2878     spec->stream_name_analog = "ALC663 Analog";
2879     spec->stream_name_digital = "ALC663 Digital";
2880     + } else if (codec->vendor_id == 0x10ec0272) {
2881     + spec->stream_name_analog = "ALC272 Analog";
2882     + spec->stream_name_digital = "ALC272 Digital";
2883     } else {
2884     spec->stream_name_analog = "ALC662 Analog";
2885     spec->stream_name_digital = "ALC662 Digital";
2886     @@ -14883,6 +15029,7 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
2887     { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
2888     { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
2889     { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
2890     + { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
2891     { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
2892     .patch = patch_alc861 },
2893     { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
2894     @@ -14896,9 +15043,12 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
2895     { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
2896     { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
2897     { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
2898     + { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
2899     + .patch = patch_alc882 }, /* should be patch_alc883() in future */
2900     { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
2901     .patch = patch_alc882 }, /* should be patch_alc883() in future */
2902     { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
2903     + { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
2904     { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
2905     { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
2906     {} /* terminator */
2907     diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
2908     index 732ce13..1d96aed 100644
2909     --- a/sound/pci/hda/patch_sigmatel.c
2910     +++ b/sound/pci/hda/patch_sigmatel.c
2911     @@ -105,6 +105,7 @@ enum {
2912     STAC_MACBOOK_PRO_V2,
2913     STAC_IMAC_INTEL,
2914     STAC_IMAC_INTEL_20,
2915     + STAC_ECS_202,
2916     STAC_922X_DELL_D81,
2917     STAC_922X_DELL_D82,
2918     STAC_922X_DELL_M81,
2919     @@ -547,8 +548,8 @@ static struct hda_verb dell_eq_core_init[] = {
2920     { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
2921     /* setup audio connections */
2922     { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
2923     - { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
2924     - { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},
2925     + { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02},
2926     + { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01},
2927     /* setup adcs to point to mixer */
2928     { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
2929     { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
2930     @@ -1310,7 +1311,7 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
2931     SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2932     "DFI LanParty", STAC_92HD73XX_REF),
2933     SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
2934     - "unknown Dell", STAC_DELL_M6),
2935     + "Dell Studio 1535", STAC_DELL_M6),
2936     SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
2937     "unknown Dell", STAC_DELL_M6),
2938     SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
2939     @@ -1323,6 +1324,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
2940     "unknown Dell", STAC_DELL_M6),
2941     SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
2942     "unknown Dell", STAC_DELL_M6),
2943     + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
2944     + "Dell Studio 15", STAC_DELL_M6),
2945     {} /* terminator */
2946     };
2947    
2948     @@ -1478,6 +1481,11 @@ static unsigned int intel_mac_v5_pin_configs[10] = {
2949     0x400000fc, 0x400000fb,
2950     };
2951    
2952     +static unsigned int ecs202_pin_configs[10] = {
2953     + 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
2954     + 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
2955     + 0x9037012e, 0x40e000f2,
2956     +};
2957    
2958     static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
2959     [STAC_D945_REF] = ref922x_pin_configs,
2960     @@ -1496,6 +1504,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
2961     [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs,
2962     [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs,
2963     [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs,
2964     + [STAC_ECS_202] = ecs202_pin_configs,
2965     [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs,
2966     [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs,
2967     [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs,
2968     @@ -1519,6 +1528,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
2969     [STAC_MACBOOK_PRO_V2] = "macbook-pro",
2970     [STAC_IMAC_INTEL] = "imac-intel",
2971     [STAC_IMAC_INTEL_20] = "imac-intel-20",
2972     + [STAC_ECS_202] = "ecs202",
2973     [STAC_922X_DELL_D81] = "dell-d81",
2974     [STAC_922X_DELL_D82] = "dell-d82",
2975     [STAC_922X_DELL_M81] = "dell-m81",
2976     @@ -1605,6 +1615,33 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
2977     "unknown Dell", STAC_922X_DELL_D81),
2978     SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
2979     "Dell XPS M1210", STAC_922X_DELL_M82),
2980     + /* ECS/PC Chips boards */
2981     + SND_PCI_QUIRK(0x1019, 0x2144,
2982     + "ECS/PC chips", STAC_ECS_202),
2983     + SND_PCI_QUIRK(0x1019, 0x2608,
2984     + "ECS/PC chips", STAC_ECS_202),
2985     + SND_PCI_QUIRK(0x1019, 0x2633,
2986     + "ECS/PC chips P17G/1333", STAC_ECS_202),
2987     + SND_PCI_QUIRK(0x1019, 0x2811,
2988     + "ECS/PC chips", STAC_ECS_202),
2989     + SND_PCI_QUIRK(0x1019, 0x2812,
2990     + "ECS/PC chips", STAC_ECS_202),
2991     + SND_PCI_QUIRK(0x1019, 0x2813,
2992     + "ECS/PC chips", STAC_ECS_202),
2993     + SND_PCI_QUIRK(0x1019, 0x2814,
2994     + "ECS/PC chips", STAC_ECS_202),
2995     + SND_PCI_QUIRK(0x1019, 0x2815,
2996     + "ECS/PC chips", STAC_ECS_202),
2997     + SND_PCI_QUIRK(0x1019, 0x2816,
2998     + "ECS/PC chips", STAC_ECS_202),
2999     + SND_PCI_QUIRK(0x1019, 0x2817,
3000     + "ECS/PC chips", STAC_ECS_202),
3001     + SND_PCI_QUIRK(0x1019, 0x2818,
3002     + "ECS/PC chips", STAC_ECS_202),
3003     + SND_PCI_QUIRK(0x1019, 0x2819,
3004     + "ECS/PC chips", STAC_ECS_202),
3005     + SND_PCI_QUIRK(0x1019, 0x2820,
3006     + "ECS/PC chips", STAC_ECS_202),
3007     {} /* terminator */
3008     };
3009    
3010     @@ -2468,7 +2505,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
3011     }
3012     }
3013    
3014     - if (cfg->hp_outs > 1) {
3015     + if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
3016     err = stac92xx_add_control(spec,
3017     STAC_CTL_WIDGET_HP_SWITCH,
3018     "Headphone as Line Out Switch", 0);