Magellan Linux

Annotation of /trunk/kernel26-magellan/patches-2.6.31-r2/0105-2.6.31.6-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 936 - (hide annotations) (download)
Tue Nov 17 22:49:38 2009 UTC (14 years, 6 months ago) by niro
File size: 112356 byte(s)
-2.6.31-magellan-r2:
-using linux-2.6.31.6

1 niro 936 diff --git a/Documentation/dontdiff b/Documentation/dontdiff
2     index 88519da..e1efc40 100644
3     --- a/Documentation/dontdiff
4     +++ b/Documentation/dontdiff
5     @@ -152,7 +152,6 @@ piggy.gz
6     piggyback
7     pnmtologo
8     ppc_defs.h*
9     -promcon_tbl.c
10     pss_boot.h
11     qconf
12     raid6altivec*.c
13     diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
14     index b9d6568..1e0c712 100644
15     --- a/arch/alpha/kernel/vmlinux.lds.S
16     +++ b/arch/alpha/kernel/vmlinux.lds.S
17     @@ -1,4 +1,5 @@
18     #include <asm-generic/vmlinux.lds.h>
19     +#include <asm/thread_info.h>
20     #include <asm/page.h>
21    
22     OUTPUT_FORMAT("elf64-alpha")
23     diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
24     index fb87c08..2de41c0 100644
25     --- a/arch/m68k/Kconfig
26     +++ b/arch/m68k/Kconfig
27     @@ -555,7 +555,7 @@ config HPAPCI
28    
29     config MVME147_SCC
30     bool "SCC support for MVME147 serial ports"
31     - depends on MVME147
32     + depends on MVME147 && BROKEN
33     help
34     This is the driver for the serial ports on the Motorola MVME147
35     boards. Everyone using one of these boards should say Y here.
36     @@ -570,14 +570,14 @@ config SERIAL167
37    
38     config MVME162_SCC
39     bool "SCC support for MVME162 serial ports"
40     - depends on MVME16x
41     + depends on MVME16x && BROKEN
42     help
43     This is the driver for the serial ports on the Motorola MVME162 and
44     172 boards. Everyone using one of these boards should say Y here.
45    
46     config BVME6000_SCC
47     bool "SCC support for BVME6000 serial ports"
48     - depends on BVME6000
49     + depends on BVME6000 && BROKEN
50     help
51     This is the driver for the serial ports on the BVME4000 and BVME6000
52     boards from BVM Ltd. Everyone using one of these boards should say
53     diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
54     index e961221..eecd2a9 100644
55     --- a/arch/mips/kernel/Makefile
56     +++ b/arch/mips/kernel/Makefile
57     @@ -2,6 +2,8 @@
58     # Makefile for the Linux/MIPS kernel.
59     #
60    
61     +CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
62     +
63     extra-y := head.o init_task.o vmlinux.lds
64    
65     obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
66     diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
67     index 576f8fb..b245f46 100644
68     --- a/arch/mips/kernel/vmlinux.lds.S
69     +++ b/arch/mips/kernel/vmlinux.lds.S
70     @@ -10,15 +10,15 @@ PHDRS {
71     note PT_NOTE FLAGS(4); /* R__ */
72     }
73    
74     -ifdef CONFIG_32BIT
75     - ifdef CONFIG_CPU_LITTLE_ENDIAN
76     +#ifdef CONFIG_32BIT
77     + #ifdef CONFIG_CPU_LITTLE_ENDIAN
78     jiffies = jiffies_64;
79     - else
80     + #else
81     jiffies = jiffies_64 + 4;
82     - endif
83     -else
84     + #endif
85     +#else
86     jiffies = jiffies_64;
87     -endif
88     +#endif
89    
90     SECTIONS
91     {
92     diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
93     index 65c585b..08d94e4 100644
94     --- a/arch/powerpc/platforms/powermac/cpufreq_32.c
95     +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
96     @@ -44,14 +44,6 @@
97     */
98     #undef DEBUG_FREQ
99    
100     -/*
101     - * There is a problem with the core cpufreq code on SMP kernels,
102     - * it won't recalculate the Bogomips properly
103     - */
104     -#ifdef CONFIG_SMP
105     -#warning "WARNING, CPUFREQ not recommended on SMP kernels"
106     -#endif
107     -
108     extern void low_choose_7447a_dfs(int dfs);
109     extern void low_choose_750fx_pll(int pll);
110     extern void low_sleep_handler(void);
111     diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
112     index 21226b7..414ca98 100644
113     --- a/arch/powerpc/platforms/powermac/low_i2c.c
114     +++ b/arch/powerpc/platforms/powermac/low_i2c.c
115     @@ -540,8 +540,11 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
116     /* Make sure IRQ is disabled */
117     kw_write_reg(reg_ier, 0);
118    
119     - /* Request chip interrupt */
120     - if (request_irq(host->irq, kw_i2c_irq, 0, "keywest i2c", host))
121     + /* Request chip interrupt. We set IRQF_TIMER because we don't
122     + * want that interrupt disabled between the 2 passes of driver
123     + * suspend or we'll have issues running the pfuncs
124     + */
125     + if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host))
126     host->irq = NO_IRQ;
127    
128     printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
129     diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
130     index 04cdd32..e81403b 100644
131     --- a/arch/powerpc/platforms/powermac/pci.c
132     +++ b/arch/powerpc/platforms/powermac/pci.c
133     @@ -1286,3 +1286,64 @@ static void fixup_k2_sata(struct pci_dev* dev)
134     }
135     DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 0x0240, fixup_k2_sata);
136    
137     +/*
138     + * On U4 (aka CPC945) the PCIe root complex "P2P" bridge resource ranges aren't
139     + * configured by the firmware. The bridge itself seems to ignore them but it
140     + * causes problems with Linux which then re-assigns devices below the bridge,
141     + * thus changing addresses of those devices from what was in the device-tree,
142     + * which sucks when those are video cards using offb
143     + *
144     + * We could just mark it transparent but I prefer fixing up the resources to
145     + * properly show what's going on here, as I have some doubts about having them
146     + * badly configured potentially being an issue for DMA.
147     + *
148     + * We leave PIO alone, it seems to be fine
149     + *
150     + * Oh and there's another funny bug. The OF properties advertize the region
151     + * 0xf1000000..0xf1ffffff as being forwarded as memory space. But that's
152     + * actually not true, this region is the memory mapped config space. So we
153     + * also need to filter it out or we'll map things in the wrong place.
154     + */
155     +static void fixup_u4_pcie(struct pci_dev* dev)
156     +{
157     + struct pci_controller *host = pci_bus_to_host(dev->bus);
158     + struct resource *region = NULL;
159     + u32 reg;
160     + int i;
161     +
162     + /* Only do that on PowerMac */
163     + if (!machine_is(powermac))
164     + return;
165     +
166     + /* Find the largest MMIO region */
167     + for (i = 0; i < 3; i++) {
168     + struct resource *r = &host->mem_resources[i];
169     + if (!(r->flags & IORESOURCE_MEM))
170     + continue;
171     + /* Skip the 0xf0xxxxxx..f2xxxxxx regions, we know they
172     + * are reserved by HW for other things
173     + */
174     + if (r->start >= 0xf0000000 && r->start < 0xf3000000)
175     + continue;
176     + if (!region || (r->end - r->start) >
177     + (region->end - region->start))
178     + region = r;
179     + }
180     + /* Nothing found, bail */
181     + if (region == 0)
182     + return;
183     +
184     + /* Print things out */
185     + printk(KERN_INFO "PCI: Fixup U4 PCIe bridge range: %pR\n", region);
186     +
187     + /* Fixup bridge config space. We know it's a Mac, resource aren't
188     + * offset so let's just blast them as-is. We also know that they
189     + * fit in 32 bits
190     + */
191     + reg = ((region->start >> 16) & 0xfff0) | (region->end & 0xfff00000);
192     + pci_write_config_dword(dev, PCI_MEMORY_BASE, reg);
193     + pci_write_config_dword(dev, PCI_PREF_BASE_UPPER32, 0);
194     + pci_write_config_dword(dev, PCI_PREF_LIMIT_UPPER32, 0);
195     + pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0);
196     +}
197     +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie);
198     diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
199     index 6d4da7b..937a38e 100644
200     --- a/arch/powerpc/platforms/powermac/smp.c
201     +++ b/arch/powerpc/platforms/powermac/smp.c
202     @@ -408,7 +408,7 @@ static void __init smp_psurge_setup_cpu(int cpu_nr)
203     /* reset the entry point so if we get another intr we won't
204     * try to startup again */
205     out_be32(psurge_start, 0x100);
206     - if (setup_irq(30, &psurge_irqaction))
207     + if (setup_irq(irq_create_mapping(NULL, 30), &psurge_irqaction))
208     printk(KERN_ERR "Couldn't get primary IPI interrupt");
209     }
210    
211     diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
212     index bf2e1ac..1164c34 100644
213     --- a/arch/powerpc/platforms/pseries/msi.c
214     +++ b/arch/powerpc/platforms/pseries/msi.c
215     @@ -432,8 +432,6 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
216     /* Read config space back so we can restore after reset */
217     read_msi_msg(virq, &msg);
218     entry->msg = msg;
219     -
220     - unmask_msi_irq(virq);
221     }
222    
223     return 0;
224     diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
225     index 419f8a6..b9bf0ee 100644
226     --- a/arch/powerpc/platforms/pseries/xics.c
227     +++ b/arch/powerpc/platforms/pseries/xics.c
228     @@ -18,6 +18,7 @@
229     #include <linux/init.h>
230     #include <linux/radix-tree.h>
231     #include <linux/cpu.h>
232     +#include <linux/msi.h>
233     #include <linux/of.h>
234    
235     #include <asm/firmware.h>
236     @@ -219,6 +220,14 @@ static void xics_unmask_irq(unsigned int virq)
237    
238     static unsigned int xics_startup(unsigned int virq)
239     {
240     + /*
241     + * The generic MSI code returns with the interrupt disabled on the
242     + * card, using the MSI mask bits. Firmware doesn't appear to unmask
243     + * at that level, so we do it here by hand.
244     + */
245     + if (irq_to_desc(virq)->msi_desc)
246     + unmask_msi_irq(virq);
247     +
248     /* unmask it */
249     xics_unmask_irq(virq);
250     return 0;
251     diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
252     index adf5f27..cb3c72c 100644
253     --- a/arch/sparc/kernel/ldc.c
254     +++ b/arch/sparc/kernel/ldc.c
255     @@ -1242,13 +1242,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name)
256     snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
257    
258     err = request_irq(lp->cfg.rx_irq, ldc_rx,
259     - IRQF_SAMPLE_RANDOM | IRQF_SHARED,
260     + IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
261     lp->rx_irq_name, lp);
262     if (err)
263     return err;
264    
265     err = request_irq(lp->cfg.tx_irq, ldc_tx,
266     - IRQF_SAMPLE_RANDOM | IRQF_SHARED,
267     + IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
268     lp->tx_irq_name, lp);
269     if (err) {
270     free_irq(lp->cfg.rx_irq, lp);
271     diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
272     index 998cadb..0ace49b 100644
273     --- a/arch/sparc/kernel/setup_32.c
274     +++ b/arch/sparc/kernel/setup_32.c
275     @@ -263,8 +263,6 @@ void __init setup_arch(char **cmdline_p)
276    
277     #ifdef CONFIG_DUMMY_CONSOLE
278     conswitchp = &dummy_con;
279     -#elif defined(CONFIG_PROM_CONSOLE)
280     - conswitchp = &prom_con;
281     #endif
282     boot_flags_init(*cmdline_p);
283    
284     diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
285     index f2bcfd2..2118033 100644
286     --- a/arch/sparc/kernel/setup_64.c
287     +++ b/arch/sparc/kernel/setup_64.c
288     @@ -295,8 +295,6 @@ void __init setup_arch(char **cmdline_p)
289    
290     #ifdef CONFIG_DUMMY_CONSOLE
291     conswitchp = &dummy_con;
292     -#elif defined(CONFIG_PROM_CONSOLE)
293     - conswitchp = &prom_con;
294     #endif
295    
296     idprom_init();
297     diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
298     index d76b026..b09502d 100644
299     --- a/arch/x86/ia32/ia32entry.S
300     +++ b/arch/x86/ia32/ia32entry.S
301     @@ -204,7 +204,7 @@ sysexit_from_sys_call:
302     movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */
303     .endm
304    
305     - .macro auditsys_exit exit,ebpsave=RBP
306     + .macro auditsys_exit exit
307     testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
308     jnz ia32_ret_from_sys_call
309     TRACE_IRQS_ON
310     @@ -217,7 +217,6 @@ sysexit_from_sys_call:
311     call audit_syscall_exit
312     GET_THREAD_INFO(%r10)
313     movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
314     - movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */
315     movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
316     cli
317     TRACE_IRQS_OFF
318     @@ -351,7 +350,7 @@ cstar_auditsys:
319     jmp cstar_dispatch
320    
321     sysretl_audit:
322     - auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */
323     + auditsys_exit sysretl_from_sys_call
324     #endif
325    
326     cstar_tracesys:
327     diff --git a/arch/x86/include/asm/amd_iommu.h b/arch/x86/include/asm/amd_iommu.h
328     index bdf96f1..9dbd403 100644
329     --- a/arch/x86/include/asm/amd_iommu.h
330     +++ b/arch/x86/include/asm/amd_iommu.h
331     @@ -30,6 +30,7 @@ extern irqreturn_t amd_iommu_int_handler(int irq, void *data);
332     extern void amd_iommu_flush_all_domains(void);
333     extern void amd_iommu_flush_all_devices(void);
334     extern void amd_iommu_shutdown(void);
335     +extern void amd_iommu_apply_erratum_63(u16 devid);
336     #else
337     static inline int amd_iommu_init(void) { return -ENODEV; }
338     static inline void amd_iommu_detect(void) { }
339     diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
340     index 03a0cbd..ca1fe39 100644
341     --- a/arch/x86/include/asm/uv/uv_hub.h
342     +++ b/arch/x86/include/asm/uv/uv_hub.h
343     @@ -18,6 +18,8 @@
344     #include <asm/types.h>
345     #include <asm/percpu.h>
346     #include <asm/uv/uv_mmrs.h>
347     +#include <asm/irq_vectors.h>
348     +#include <asm/io_apic.h>
349    
350    
351     /*
352     @@ -420,9 +422,14 @@ static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
353     static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
354     {
355     unsigned long val;
356     + unsigned long dmode = dest_Fixed;
357     +
358     + if (vector == NMI_VECTOR)
359     + dmode = dest_NMI;
360    
361     val = (1UL << UVH_IPI_INT_SEND_SHFT) |
362     ((apicid) << UVH_IPI_INT_APIC_ID_SHFT) |
363     + (dmode << UVH_IPI_INT_DELIVERY_MODE_SHFT) |
364     (vector << UVH_IPI_INT_VECTOR_SHFT);
365     uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
366     }
367     diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
368     index 4607241..f5cb46a 100644
369     --- a/arch/x86/kernel/amd_iommu.c
370     +++ b/arch/x86/kernel/amd_iommu.c
371     @@ -1112,6 +1112,8 @@ static void __detach_device(struct protection_domain *domain, u16 devid)
372     amd_iommu_dev_table[devid].data[1] = 0;
373     amd_iommu_dev_table[devid].data[2] = 0;
374    
375     + amd_iommu_apply_erratum_63(devid);
376     +
377     /* decrease reference counter */
378     domain->dev_cnt -= 1;
379    
380     diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
381     index c1b17e9..1e423b2 100644
382     --- a/arch/x86/kernel/amd_iommu_init.c
383     +++ b/arch/x86/kernel/amd_iommu_init.c
384     @@ -240,7 +240,7 @@ static void iommu_feature_enable(struct amd_iommu *iommu, u8 bit)
385     writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
386     }
387    
388     -static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
389     +static void iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
390     {
391     u32 ctrl;
392    
393     @@ -509,6 +509,26 @@ static void set_dev_entry_bit(u16 devid, u8 bit)
394     amd_iommu_dev_table[devid].data[i] |= (1 << _bit);
395     }
396    
397     +static int get_dev_entry_bit(u16 devid, u8 bit)
398     +{
399     + int i = (bit >> 5) & 0x07;
400     + int _bit = bit & 0x1f;
401     +
402     + return (amd_iommu_dev_table[devid].data[i] & (1 << _bit)) >> _bit;
403     +}
404     +
405     +
406     +void amd_iommu_apply_erratum_63(u16 devid)
407     +{
408     + int sysmgt;
409     +
410     + sysmgt = get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT1) |
411     + (get_dev_entry_bit(devid, DEV_ENTRY_SYSMGT2) << 1);
412     +
413     + if (sysmgt == 0x01)
414     + set_dev_entry_bit(devid, DEV_ENTRY_IW);
415     +}
416     +
417     /* Writes the specific IOMMU for a device into the rlookup table */
418     static void __init set_iommu_for_device(struct amd_iommu *iommu, u16 devid)
419     {
420     @@ -537,6 +557,8 @@ static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu,
421     if (flags & ACPI_DEVFLAG_LINT1)
422     set_dev_entry_bit(devid, DEV_ENTRY_LINT1_PASS);
423    
424     + amd_iommu_apply_erratum_63(devid);
425     +
426     set_iommu_for_device(iommu, devid);
427     }
428    
429     diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
430     index 6011593..055e394 100644
431     --- a/arch/x86/kernel/apic/x2apic_uv_x.c
432     +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
433     @@ -352,14 +352,14 @@ static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
434    
435     for (i = 0; i < ARRAY_SIZE(redir_addrs); i++) {
436     alias.v = uv_read_local_mmr(redir_addrs[i].alias);
437     - if (alias.s.base == 0) {
438     + if (alias.s.enable && alias.s.base == 0) {
439     *size = (1UL << alias.s.m_alias);
440     redirect.v = uv_read_local_mmr(redir_addrs[i].redirect);
441     *base = (unsigned long)redirect.s.dest_base << DEST_SHIFT;
442     return;
443     }
444     }
445     - BUG();
446     + *base = *size = 0;
447     }
448    
449     enum map_type {map_wb, map_uc};
450     @@ -609,12 +609,12 @@ void __init uv_system_init(void)
451     uv_cpu_hub_info(cpu)->lowmem_remap_base = lowmem_redir_base;
452     uv_cpu_hub_info(cpu)->lowmem_remap_top = lowmem_redir_size;
453     uv_cpu_hub_info(cpu)->m_val = m_val;
454     - uv_cpu_hub_info(cpu)->n_val = m_val;
455     + uv_cpu_hub_info(cpu)->n_val = n_val;
456     uv_cpu_hub_info(cpu)->numa_blade_id = blade;
457     uv_cpu_hub_info(cpu)->blade_processor_id = lcpu;
458     uv_cpu_hub_info(cpu)->pnode = pnode;
459     uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask;
460     - uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
461     + uv_cpu_hub_info(cpu)->gpa_mask = (1UL << (m_val + n_val)) - 1;
462     uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
463     uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
464     uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
465     diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
466     index 5957a93..600e724 100644
467     --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
468     +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
469     @@ -34,20 +34,31 @@
470     /* How long to wait between reporting thermal events */
471     #define CHECK_INTERVAL (300 * HZ)
472    
473     -static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES;
474     -static DEFINE_PER_CPU(unsigned long, thermal_throttle_count);
475     -static DEFINE_PER_CPU(bool, thermal_throttle_active);
476     +/*
477     + * Current thermal throttling state:
478     + */
479     +struct thermal_state {
480     + bool is_throttled;
481     +
482     + u64 next_check;
483     + unsigned long throttle_count;
484     + unsigned long last_throttle_count;
485     +};
486     +
487     +static DEFINE_PER_CPU(struct thermal_state, thermal_state);
488    
489     -static atomic_t therm_throt_en = ATOMIC_INIT(0);
490     +static atomic_t therm_throt_en = ATOMIC_INIT(0);
491    
492     #ifdef CONFIG_SYSFS
493     #define define_therm_throt_sysdev_one_ro(_name) \
494     static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL)
495    
496     #define define_therm_throt_sysdev_show_func(name) \
497     -static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \
498     - struct sysdev_attribute *attr, \
499     - char *buf) \
500     + \
501     +static ssize_t therm_throt_sysdev_show_##name( \
502     + struct sys_device *dev, \
503     + struct sysdev_attribute *attr, \
504     + char *buf) \
505     { \
506     unsigned int cpu = dev->id; \
507     ssize_t ret; \
508     @@ -55,7 +66,7 @@ static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \
509     preempt_disable(); /* CPU hotplug */ \
510     if (cpu_online(cpu)) \
511     ret = sprintf(buf, "%lu\n", \
512     - per_cpu(thermal_throttle_##name, cpu)); \
513     + per_cpu(thermal_state, cpu).name); \
514     else \
515     ret = 0; \
516     preempt_enable(); \
517     @@ -63,11 +74,11 @@ static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \
518     return ret; \
519     }
520    
521     -define_therm_throt_sysdev_show_func(count);
522     -define_therm_throt_sysdev_one_ro(count);
523     +define_therm_throt_sysdev_show_func(throttle_count);
524     +define_therm_throt_sysdev_one_ro(throttle_count);
525    
526     static struct attribute *thermal_throttle_attrs[] = {
527     - &attr_count.attr,
528     + &attr_throttle_count.attr,
529     NULL
530     };
531    
532     @@ -93,33 +104,39 @@ static struct attribute_group thermal_throttle_attr_group = {
533     * 1 : Event should be logged further, and a message has been
534     * printed to the syslog.
535     */
536     -static int therm_throt_process(int curr)
537     +static int therm_throt_process(bool is_throttled)
538     {
539     - unsigned int cpu = smp_processor_id();
540     - __u64 tmp_jiffs = get_jiffies_64();
541     - bool was_throttled = __get_cpu_var(thermal_throttle_active);
542     - bool is_throttled = __get_cpu_var(thermal_throttle_active) = curr;
543     + struct thermal_state *state;
544     + unsigned int this_cpu;
545     + bool was_throttled;
546     + u64 now;
547     +
548     + this_cpu = smp_processor_id();
549     + now = get_jiffies_64();
550     + state = &per_cpu(thermal_state, this_cpu);
551     +
552     + was_throttled = state->is_throttled;
553     + state->is_throttled = is_throttled;
554    
555     if (is_throttled)
556     - __get_cpu_var(thermal_throttle_count)++;
557     + state->throttle_count++;
558    
559     - if (!(was_throttled ^ is_throttled) &&
560     - time_before64(tmp_jiffs, __get_cpu_var(next_check)))
561     + if (time_before64(now, state->next_check) &&
562     + state->throttle_count != state->last_throttle_count)
563     return 0;
564    
565     - __get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL;
566     + state->next_check = now + CHECK_INTERVAL;
567     + state->last_throttle_count = state->throttle_count;
568    
569     /* if we just entered the thermal event */
570     if (is_throttled) {
571     - printk(KERN_CRIT "CPU%d: Temperature above threshold, "
572     - "cpu clock throttled (total events = %lu)\n",
573     - cpu, __get_cpu_var(thermal_throttle_count));
574     + printk(KERN_CRIT "CPU%d: Temperature above threshold, cpu clock throttled (total events = %lu)\n", this_cpu, state->throttle_count);
575    
576     add_taint(TAINT_MACHINE_CHECK);
577     return 1;
578     }
579     if (was_throttled) {
580     - printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu);
581     + printk(KERN_INFO "CPU%d: Temperature/speed normal\n", this_cpu);
582     return 1;
583     }
584    
585     @@ -213,7 +230,7 @@ static void intel_thermal_interrupt(void)
586     __u64 msr_val;
587    
588     rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
589     - if (therm_throt_process(msr_val & THERM_STATUS_PROCHOT))
590     + if (therm_throt_process((msr_val & THERM_STATUS_PROCHOT) != 0))
591     mce_log_therm_throt_event(msr_val);
592     }
593    
594     diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
595     index 5cb5725..0bc204d 100644
596     --- a/arch/x86/kernel/e820.c
597     +++ b/arch/x86/kernel/e820.c
598     @@ -1378,8 +1378,8 @@ static unsigned long ram_alignment(resource_size_t pos)
599     if (mb < 16)
600     return 1024*1024;
601    
602     - /* To 32MB for anything above that */
603     - return 32*1024*1024;
604     + /* To 64MB for anything above that */
605     + return 64*1024*1024;
606     }
607    
608     #define MAX_RESOURCE_SIZE ((resource_size_t)-1)
609     diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
610     index 77b9689..9848980 100644
611     --- a/arch/x86/kernel/tlb_uv.c
612     +++ b/arch/x86/kernel/tlb_uv.c
613     @@ -843,8 +843,8 @@ static int __init uv_bau_init(void)
614     GFP_KERNEL, cpu_to_node(cur_cpu));
615    
616     uv_bau_retry_limit = 1;
617     - uv_nshift = uv_hub_info->n_val;
618     - uv_mmask = (1UL << uv_hub_info->n_val) - 1;
619     + uv_nshift = uv_hub_info->m_val;
620     + uv_mmask = (1UL << uv_hub_info->m_val) - 1;
621     nblades = uv_num_possible_blades();
622    
623     uv_bau_table_bases = (struct bau_control **)
624     diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
625     index 21f68e0..5c8bfff 100644
626     --- a/arch/x86/kvm/i8254.c
627     +++ b/arch/x86/kvm/i8254.c
628     @@ -116,7 +116,7 @@ static s64 __kpit_elapsed(struct kvm *kvm)
629     * itself with the initial count and continues counting
630     * from there.
631     */
632     - remaining = hrtimer_expires_remaining(&ps->pit_timer.timer);
633     + remaining = hrtimer_get_remaining(&ps->pit_timer.timer);
634     elapsed = ps->pit_timer.period - ktime_to_ns(remaining);
635     elapsed = mod_64(elapsed, ps->pit_timer.period);
636    
637     diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
638     index b225176..9a65123 100644
639     --- a/arch/x86/kvm/lapic.c
640     +++ b/arch/x86/kvm/lapic.c
641     @@ -464,7 +464,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
642     if (apic_get_reg(apic, APIC_TMICT) == 0)
643     return 0;
644    
645     - remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer);
646     + remaining = hrtimer_get_remaining(&apic->lapic_timer.timer);
647     if (ktime_to_ns(remaining) < 0)
648     remaining = ktime_set(0, 0);
649    
650     diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
651     index 8aafb62..26e454c 100644
652     --- a/arch/x86/kvm/x86.c
653     +++ b/arch/x86/kvm/x86.c
654     @@ -949,6 +949,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
655     case MSR_P6_EVNTSEL0:
656     case MSR_P6_EVNTSEL1:
657     case MSR_K7_EVNTSEL0:
658     + case MSR_K8_INT_PENDING_MSG:
659     data = 0;
660     break;
661     case MSR_MTRRcap:
662     @@ -3761,7 +3762,7 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
663     return kvm_write_guest(vcpu->kvm, gpa, seg_desc, 8);
664     }
665    
666     -static u32 get_tss_base_addr(struct kvm_vcpu *vcpu,
667     +static gpa_t get_tss_base_addr(struct kvm_vcpu *vcpu,
668     struct desc_struct *seg_desc)
669     {
670     u32 base_addr;
671     diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
672     index 3839a0f..a11a115 100644
673     --- a/arch/x86/xen/enlighten.c
674     +++ b/arch/x86/xen/enlighten.c
675     @@ -178,6 +178,7 @@ static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
676     static void xen_cpuid(unsigned int *ax, unsigned int *bx,
677     unsigned int *cx, unsigned int *dx)
678     {
679     + unsigned maskebx = ~0;
680     unsigned maskecx = ~0;
681     unsigned maskedx = ~0;
682    
683     @@ -185,9 +186,16 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
684     * Mask out inconvenient features, to try and disable as many
685     * unsupported kernel subsystems as possible.
686     */
687     - if (*ax == 1) {
688     + switch (*ax) {
689     + case 1:
690     maskecx = cpuid_leaf1_ecx_mask;
691     maskedx = cpuid_leaf1_edx_mask;
692     + break;
693     +
694     + case 0xb:
695     + /* Suppress extended topology stuff */
696     + maskebx = 0;
697     + break;
698     }
699    
700     asm(XEN_EMULATE_PREFIX "cpuid"
701     @@ -197,6 +205,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
702     "=d" (*dx)
703     : "0" (*ax), "2" (*cx));
704    
705     + *bx &= maskebx;
706     *cx &= maskecx;
707     *dx &= maskedx;
708     }
709     diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
710     index 55b5b90..97fad29 100644
711     --- a/drivers/acpi/pci_root.c
712     +++ b/drivers/acpi/pci_root.c
713     @@ -400,6 +400,17 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
714    
715     pbus = pdev->subordinate;
716     pci_dev_put(pdev);
717     +
718     + /*
719     + * This function may be called for a non-PCI device that has a
720     + * PCI parent (eg. a disk under a PCI SATA controller). In that
721     + * case pdev->subordinate will be NULL for the parent.
722     + */
723     + if (!pbus) {
724     + dev_dbg(&pdev->dev, "Not a PCI-to-PCI bridge\n");
725     + pdev = NULL;
726     + break;
727     + }
728     }
729     out:
730     list_for_each_entry_safe(node, tmp, &device_list, node)
731     diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
732     index 781435d..5dd702c 100644
733     --- a/drivers/acpi/scan.c
734     +++ b/drivers/acpi/scan.c
735     @@ -1264,16 +1264,6 @@ acpi_add_single_object(struct acpi_device **child,
736     acpi_device_set_id(device, parent, handle, type);
737    
738     /*
739     - * The ACPI device is attached to acpi handle before getting
740     - * the power/wakeup/peformance flags. Otherwise OS can't get
741     - * the corresponding ACPI device by the acpi handle in the course
742     - * of getting the power/wakeup/performance flags.
743     - */
744     - result = acpi_device_set_context(device, type);
745     - if (result)
746     - goto end;
747     -
748     - /*
749     * Power Management
750     * ----------------
751     */
752     @@ -1303,6 +1293,8 @@ acpi_add_single_object(struct acpi_device **child,
753     goto end;
754     }
755    
756     + if ((result = acpi_device_set_context(device, type)))
757     + goto end;
758    
759     result = acpi_device_register(device, parent);
760    
761     diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
762     index 289c4f8..b2526e4 100644
763     --- a/drivers/ata/ahci.c
764     +++ b/drivers/ata/ahci.c
765     @@ -433,7 +433,8 @@ static const struct ata_port_info ahci_port_info[] = {
766     [board_ahci_sb600] =
767     {
768     AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL |
769     - AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255),
770     + AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
771     + AHCI_HFLAG_SECT255),
772     .flags = AHCI_FLAG_COMMON,
773     .pio_mask = ATA_PIO4,
774     .udma_mask = ATA_UDMA6,
775     @@ -2602,51 +2603,6 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
776     }
777     }
778    
779     -/*
780     - * SB600 ahci controller on ASUS M2A-VM can't do 64bit DMA with older
781     - * BIOS. The oldest version known to be broken is 0901 and working is
782     - * 1501 which was released on 2007-10-26. Force 32bit DMA on anything
783     - * older than 1501. Please read bko#9412 for more info.
784     - */
785     -static bool ahci_asus_m2a_vm_32bit_only(struct pci_dev *pdev)
786     -{
787     - static const struct dmi_system_id sysids[] = {
788     - {
789     - .ident = "ASUS M2A-VM",
790     - .matches = {
791     - DMI_MATCH(DMI_BOARD_VENDOR,
792     - "ASUSTeK Computer INC."),
793     - DMI_MATCH(DMI_BOARD_NAME, "M2A-VM"),
794     - },
795     - },
796     - { }
797     - };
798     - const char *cutoff_mmdd = "10/26";
799     - const char *date;
800     - int year;
801     -
802     - if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) ||
803     - !dmi_check_system(sysids))
804     - return false;
805     -
806     - /*
807     - * Argh.... both version and date are free form strings.
808     - * Let's hope they're using the same date format across
809     - * different versions.
810     - */
811     - date = dmi_get_system_info(DMI_BIOS_DATE);
812     - year = dmi_get_year(DMI_BIOS_DATE);
813     - if (date && strlen(date) >= 10 && date[2] == '/' && date[5] == '/' &&
814     - (year > 2007 ||
815     - (year == 2007 && strncmp(date, cutoff_mmdd, 5) >= 0)))
816     - return false;
817     -
818     - dev_printk(KERN_WARNING, &pdev->dev, "ASUS M2A-VM: BIOS too old, "
819     - "forcing 32bit DMA, update BIOS\n");
820     -
821     - return true;
822     -}
823     -
824     static bool ahci_broken_system_poweroff(struct pci_dev *pdev)
825     {
826     static const struct dmi_system_id broken_systems[] = {
827     @@ -2857,10 +2813,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
828     if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
829     hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
830    
831     - /* apply ASUS M2A_VM quirk */
832     - if (ahci_asus_m2a_vm_32bit_only(pdev))
833     - hpriv->flags |= AHCI_HFLAG_32BIT_ONLY;
834     -
835     if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
836     pci_intx(pdev, 1);
837    
838     diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
839     index e71149b..4143943 100644
840     --- a/drivers/ata/libata-core.c
841     +++ b/drivers/ata/libata-core.c
842     @@ -5008,12 +5008,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
843     qc->flags |= ATA_QCFLAG_FAILED;
844    
845     if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
846     - if (!ata_tag_internal(qc->tag)) {
847     - /* always fill result TF for failed qc */
848     - fill_result_tf(qc);
849     + /* always fill result TF for failed qc */
850     + fill_result_tf(qc);
851     +
852     + if (!ata_tag_internal(qc->tag))
853     ata_qc_schedule_eh(qc);
854     - return;
855     - }
856     + else
857     + __ata_qc_complete(qc);
858     + return;
859     }
860    
861     /* read result TF if requested */
862     diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
863     index c644fec..1652b91 100644
864     --- a/drivers/ata/libata-eh.c
865     +++ b/drivers/ata/libata-eh.c
866     @@ -2849,12 +2849,14 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
867     * device detection messages backwards.
868     */
869     ata_for_each_dev(dev, link, ALL) {
870     - if (!(new_mask & (1 << dev->devno)) ||
871     - dev->class == ATA_DEV_PMP)
872     + if (!(new_mask & (1 << dev->devno)))
873     continue;
874    
875     dev->class = ehc->classes[dev->devno];
876    
877     + if (dev->class == ATA_DEV_PMP)
878     + continue;
879     +
880     ehc->i.flags |= ATA_EHI_PRINTINFO;
881     rc = ata_dev_configure(dev);
882     ehc->i.flags &= ~ATA_EHI_PRINTINFO;
883     diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
884     index f49814d..3bbed83 100644
885     --- a/drivers/ata/pata_sc1200.c
886     +++ b/drivers/ata/pata_sc1200.c
887     @@ -235,8 +235,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
888     .udma_mask = ATA_UDMA2,
889     .port_ops = &sc1200_port_ops
890     };
891     - /* Can't enable port 2 yet, see top comments */
892     - const struct ata_port_info *ppi[] = { &info, };
893     + const struct ata_port_info *ppi[] = { &info, NULL };
894    
895     return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL);
896     }
897     diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
898     index 45657ca..88984b8 100644
899     --- a/drivers/ata/pata_via.c
900     +++ b/drivers/ata/pata_via.c
901     @@ -111,7 +111,7 @@ static const struct via_isa_bridge {
902     { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
903     { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
904     { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
905     - { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
906     + { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
907     { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
908     { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
909     { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
910     diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
911     index 86a4058..1eb4e02 100644
912     --- a/drivers/ata/sata_nv.c
913     +++ b/drivers/ata/sata_nv.c
914     @@ -1594,9 +1594,21 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
915     !ata_dev_enabled(link->device))
916     sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
917     NULL, NULL);
918     - else if (!(ehc->i.flags & ATA_EHI_QUIET))
919     - ata_link_printk(link, KERN_INFO,
920     - "nv: skipping hardreset on occupied port\n");
921     + else {
922     + const unsigned long *timing = sata_ehc_deb_timing(ehc);
923     + int rc;
924     +
925     + if (!(ehc->i.flags & ATA_EHI_QUIET))
926     + ata_link_printk(link, KERN_INFO, "nv: skipping "
927     + "hardreset on occupied port\n");
928     +
929     + /* make sure the link is online */
930     + rc = sata_link_resume(link, timing, deadline);
931     + /* whine about phy resume failure but proceed */
932     + if (rc && rc != -EOPNOTSUPP)
933     + ata_link_printk(link, KERN_WARNING, "failed to resume "
934     + "link (errno=%d)\n", rc);
935     + }
936    
937     /* device signature acquisition is unreliable */
938     return -EAGAIN;
939     diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
940     index bdd43c7..02efd9a 100644
941     --- a/drivers/ata/sata_via.c
942     +++ b/drivers/ata/sata_via.c
943     @@ -93,7 +93,6 @@ static const struct pci_device_id svia_pci_tbl[] = {
944     { PCI_VDEVICE(VIA, 0x7372), vt6420 },
945     { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */
946     { PCI_VDEVICE(VIA, 0x9000), vt8251 },
947     - { PCI_VDEVICE(VIA, 0x9040), vt8251 },
948    
949     { } /* terminate list */
950     };
951     diff --git a/drivers/base/driver.c b/drivers/base/driver.c
952     index 8ae0f63..2b7f5bc 100644
953     --- a/drivers/base/driver.c
954     +++ b/drivers/base/driver.c
955     @@ -236,7 +236,7 @@ int driver_register(struct device_driver *drv)
956     put_driver(other);
957     printk(KERN_ERR "Error: Driver '%s' is already registered, "
958     "aborting...\n", drv->name);
959     - return -EEXIST;
960     + return -EBUSY;
961     }
962    
963     ret = bus_add_driver(drv);
964     diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
965     index 6a06913..a95b553 100644
966     --- a/drivers/char/Kconfig
967     +++ b/drivers/char/Kconfig
968     @@ -323,7 +323,7 @@ config SPECIALIX
969    
970     config SX
971     tristate "Specialix SX (and SI) card support"
972     - depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
973     + depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) && BROKEN
974     help
975     This is a driver for the SX and SI multiport serial cards.
976     Please read the file <file:Documentation/serial/sx.txt> for details.
977     @@ -334,7 +334,7 @@ config SX
978    
979     config RIO
980     tristate "Specialix RIO system support"
981     - depends on SERIAL_NONSTANDARD
982     + depends on SERIAL_NONSTANDARD && BROKEN
983     help
984     This is a driver for the Specialix RIO, a smart serial card which
985     drives an outboard box that can support up to 128 ports. Product
986     @@ -395,7 +395,7 @@ config NOZOMI
987    
988     config A2232
989     tristate "Commodore A2232 serial support (EXPERIMENTAL)"
990     - depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
991     + depends on EXPERIMENTAL && ZORRO && BROKEN
992     ---help---
993     This option supports the 2232 7-port serial card shipped with the
994     Amiga 2000 and other Zorro-bus machines, dating from 1989. At
995     diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
996     index 6cf88b6..6a45365 100644
997     --- a/drivers/char/agp/intel-agp.c
998     +++ b/drivers/char/agp/intel-agp.c
999     @@ -36,6 +36,8 @@
1000     #define PCI_DEVICE_ID_INTEL_Q35_IG 0x29B2
1001     #define PCI_DEVICE_ID_INTEL_Q33_HB 0x29D0
1002     #define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2
1003     +#define PCI_DEVICE_ID_INTEL_B43_HB 0x2E40
1004     +#define PCI_DEVICE_ID_INTEL_B43_IG 0x2E42
1005     #define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40
1006     #define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42
1007     #define PCI_DEVICE_ID_INTEL_IGD_E_HB 0x2E00
1008     @@ -81,6 +83,7 @@
1009     agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
1010     agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB || \
1011     agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G41_HB || \
1012     + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_B43_HB || \
1013     agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_D_HB || \
1014     agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_M_HB || \
1015     agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGDNG_MA_HB)
1016     @@ -1232,6 +1235,7 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
1017     case PCI_DEVICE_ID_INTEL_Q45_HB:
1018     case PCI_DEVICE_ID_INTEL_G45_HB:
1019     case PCI_DEVICE_ID_INTEL_G41_HB:
1020     + case PCI_DEVICE_ID_INTEL_B43_HB:
1021     case PCI_DEVICE_ID_INTEL_IGDNG_D_HB:
1022     case PCI_DEVICE_ID_INTEL_IGDNG_M_HB:
1023     case PCI_DEVICE_ID_INTEL_IGDNG_MA_HB:
1024     @@ -2208,6 +2212,8 @@ static const struct intel_driver_description {
1025     "Q45/Q43", NULL, &intel_i965_driver },
1026     { PCI_DEVICE_ID_INTEL_G45_HB, PCI_DEVICE_ID_INTEL_G45_IG, 0,
1027     "G45/G43", NULL, &intel_i965_driver },
1028     + { PCI_DEVICE_ID_INTEL_B43_HB, PCI_DEVICE_ID_INTEL_B43_IG, 0,
1029     + "B43", NULL, &intel_i965_driver },
1030     { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, 0,
1031     "G41", NULL, &intel_i965_driver },
1032     { PCI_DEVICE_ID_INTEL_IGDNG_D_HB, PCI_DEVICE_ID_INTEL_IGDNG_D_IG, 0,
1033     @@ -2408,6 +2414,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
1034     ID(PCI_DEVICE_ID_INTEL_Q45_HB),
1035     ID(PCI_DEVICE_ID_INTEL_G45_HB),
1036     ID(PCI_DEVICE_ID_INTEL_G41_HB),
1037     + ID(PCI_DEVICE_ID_INTEL_B43_HB),
1038     ID(PCI_DEVICE_ID_INTEL_IGDNG_D_HB),
1039     ID(PCI_DEVICE_ID_INTEL_IGDNG_M_HB),
1040     ID(PCI_DEVICE_ID_INTEL_IGDNG_MA_HB),
1041     diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
1042     index eba999f..ae453cc 100644
1043     --- a/drivers/char/hvc_xen.c
1044     +++ b/drivers/char/hvc_xen.c
1045     @@ -55,7 +55,7 @@ static inline void notify_daemon(void)
1046     notify_remote_via_evtchn(xen_start_info->console.domU.evtchn);
1047     }
1048    
1049     -static int write_console(uint32_t vtermno, const char *data, int len)
1050     +static int __write_console(const char *data, int len)
1051     {
1052     struct xencons_interface *intf = xencons_interface();
1053     XENCONS_RING_IDX cons, prod;
1054     @@ -76,6 +76,29 @@ static int write_console(uint32_t vtermno, const char *data, int len)
1055     return sent;
1056     }
1057    
1058     +static int write_console(uint32_t vtermno, const char *data, int len)
1059     +{
1060     + int ret = len;
1061     +
1062     + /*
1063     + * Make sure the whole buffer is emitted, polling if
1064     + * necessary. We don't ever want to rely on the hvc daemon
1065     + * because the most interesting console output is when the
1066     + * kernel is crippled.
1067     + */
1068     + while (len) {
1069     + int sent = __write_console(data, len);
1070     +
1071     + data += sent;
1072     + len -= sent;
1073     +
1074     + if (unlikely(len))
1075     + HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
1076     + }
1077     +
1078     + return ret;
1079     +}
1080     +
1081     static int read_console(uint32_t vtermno, char *buf, int len)
1082     {
1083     struct xencons_interface *intf = xencons_interface();
1084     diff --git a/drivers/char/vt.c b/drivers/char/vt.c
1085     index 404f4c1..6aa88f5 100644
1086     --- a/drivers/char/vt.c
1087     +++ b/drivers/char/vt.c
1088     @@ -2948,9 +2948,6 @@ int __init vty_init(const struct file_operations *console_fops)
1089     panic("Couldn't register console driver\n");
1090     kbd_init();
1091     console_map_init();
1092     -#ifdef CONFIG_PROM_CONSOLE
1093     - prom_con_init();
1094     -#endif
1095     #ifdef CONFIG_MDA_CONSOLE
1096     mda_console_init();
1097     #endif
1098     diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
1099     index 8504a21..910c49d 100644
1100     --- a/drivers/cpuidle/cpuidle.c
1101     +++ b/drivers/cpuidle/cpuidle.c
1102     @@ -75,8 +75,11 @@ static void cpuidle_idle_call(void)
1103     #endif
1104     /* ask the governor for the next state */
1105     next_state = cpuidle_curr_governor->select(dev);
1106     - if (need_resched())
1107     + if (need_resched()) {
1108     + local_irq_enable();
1109     return;
1110     + }
1111     +
1112     target_state = &dev->states[next_state];
1113    
1114     /* enter the state and update stats */
1115     diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
1116     index 5b4f87e..88b3eff 100644
1117     --- a/drivers/gpu/drm/i915/i915_drv.h
1118     +++ b/drivers/gpu/drm/i915/i915_drv.h
1119     @@ -854,6 +854,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1120     (dev)->pci_device == 0x2E12 || \
1121     (dev)->pci_device == 0x2E22 || \
1122     (dev)->pci_device == 0x2E32 || \
1123     + (dev)->pci_device == 0x2E42 || \
1124     (dev)->pci_device == 0x0042 || \
1125     (dev)->pci_device == 0x0046)
1126    
1127     @@ -866,6 +867,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1128     (dev)->pci_device == 0x2E12 || \
1129     (dev)->pci_device == 0x2E22 || \
1130     (dev)->pci_device == 0x2E32 || \
1131     + (dev)->pci_device == 0x2E42 || \
1132     IS_GM45(dev))
1133    
1134     #define IS_IGDG(dev) ((dev)->pci_device == 0xa001)
1135     diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
1136     index 106a1ae..c017fa1 100644
1137     --- a/drivers/gpu/drm/i915/i915_reg.h
1138     +++ b/drivers/gpu/drm/i915/i915_reg.h
1139     @@ -1616,6 +1616,11 @@
1140     #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
1141     #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
1142     #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
1143     +#define PIPE_BPC_MASK (7 << 5) /* Ironlake */
1144     +#define PIPE_8BPC (0 << 5)
1145     +#define PIPE_10BPC (1 << 5)
1146     +#define PIPE_6BPC (2 << 5)
1147     +#define PIPE_12BPC (3 << 5)
1148    
1149     #define DSPARB 0x70030
1150     #define DSPARB_CSTART_MASK (0x7f << 7)
1151     @@ -1866,6 +1871,11 @@
1152     #define PFA_CTL_1 0x68080
1153     #define PFB_CTL_1 0x68880
1154     #define PF_ENABLE (1<<31)
1155     +#define PF_FILTER_MASK (3<<23)
1156     +#define PF_FILTER_PROGRAMMED (0<<23)
1157     +#define PF_FILTER_MED_3x3 (1<<23)
1158     +#define PF_FILTER_EDGE_ENHANCE (2<<23)
1159     +#define PF_FILTER_EDGE_SOFTEN (3<<23)
1160     #define PFA_WIN_SZ 0x68074
1161     #define PFB_WIN_SZ 0x68874
1162     #define PFA_WIN_POS 0x68070
1163     @@ -1985,11 +1995,11 @@
1164     #define DREF_CPU_SOURCE_OUTPUT_MASK (3<<13)
1165     #define DREF_SSC_SOURCE_DISABLE (0<<11)
1166     #define DREF_SSC_SOURCE_ENABLE (2<<11)
1167     -#define DREF_SSC_SOURCE_MASK (2<<11)
1168     +#define DREF_SSC_SOURCE_MASK (3<<11)
1169     #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9)
1170     #define DREF_NONSPREAD_CK505_ENABLE (1<<9)
1171     #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9)
1172     -#define DREF_NONSPREAD_SOURCE_MASK (2<<9)
1173     +#define DREF_NONSPREAD_SOURCE_MASK (3<<9)
1174     #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7)
1175     #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7)
1176     #define DREF_SSC4_DOWNSPREAD (0<<6)
1177     diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
1178     index 8b5af29..318ba47 100644
1179     --- a/drivers/gpu/drm/i915/intel_display.c
1180     +++ b/drivers/gpu/drm/i915/intel_display.c
1181     @@ -1213,7 +1213,7 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
1182     /* Enable panel fitting for LVDS */
1183     if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
1184     temp = I915_READ(pf_ctl_reg);
1185     - I915_WRITE(pf_ctl_reg, temp | PF_ENABLE);
1186     + I915_WRITE(pf_ctl_reg, temp | PF_ENABLE | PF_FILTER_MED_3x3);
1187    
1188     /* currently full aspect */
1189     I915_WRITE(pf_win_pos, 0);
1190     @@ -1764,7 +1764,7 @@ fdi_reduce_ratio(u32 *num, u32 *den)
1191     #define LINK_N 0x80000
1192    
1193     static void
1194     -igdng_compute_m_n(int bytes_per_pixel, int nlanes,
1195     +igdng_compute_m_n(int bits_per_pixel, int nlanes,
1196     int pixel_clock, int link_clock,
1197     struct fdi_m_n *m_n)
1198     {
1199     @@ -1774,7 +1774,8 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes,
1200    
1201     temp = (u64) DATA_N * pixel_clock;
1202     temp = div_u64(temp, link_clock);
1203     - m_n->gmch_m = div_u64(temp * bytes_per_pixel, nlanes);
1204     + m_n->gmch_m = div_u64(temp * bits_per_pixel, nlanes);
1205     + m_n->gmch_m >>= 3; /* convert to bytes_per_pixel */
1206     m_n->gmch_n = DATA_N;
1207     fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n);
1208    
1209     @@ -2396,7 +2397,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1210    
1211     /* FDI link */
1212     if (IS_IGDNG(dev)) {
1213     - int lane, link_bw;
1214     + int lane, link_bw, bpp;
1215     /* eDP doesn't require FDI link, so just set DP M/N
1216     according to current link config */
1217     if (is_edp) {
1218     @@ -2415,10 +2416,72 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
1219     lane = 4;
1220     link_bw = 270000;
1221     }
1222     - igdng_compute_m_n(3, lane, target_clock,
1223     +
1224     + /* determine panel color depth */
1225     + temp = I915_READ(pipeconf_reg);
1226     +
1227     + switch (temp & PIPE_BPC_MASK) {
1228     + case PIPE_8BPC:
1229     + bpp = 24;
1230     + break;
1231     + case PIPE_10BPC:
1232     + bpp = 30;
1233     + break;
1234     + case PIPE_6BPC:
1235     + bpp = 18;
1236     + break;
1237     + case PIPE_12BPC:
1238     + bpp = 36;
1239     + break;
1240     + default:
1241     + DRM_ERROR("unknown pipe bpc value\n");
1242     + bpp = 24;
1243     + }
1244     +
1245     + igdng_compute_m_n(bpp, lane, target_clock,
1246     link_bw, &m_n);
1247     }
1248    
1249     + /* Ironlake: try to setup display ref clock before DPLL
1250     + * enabling. This is only under driver's control after
1251     + * PCH B stepping, previous chipset stepping should be
1252     + * ignoring this setting.
1253     + */
1254     + if (IS_IGDNG(dev)) {
1255     + temp = I915_READ(PCH_DREF_CONTROL);
1256     + /* Always enable nonspread source */
1257     + temp &= ~DREF_NONSPREAD_SOURCE_MASK;
1258     + temp |= DREF_NONSPREAD_SOURCE_ENABLE;
1259     + I915_WRITE(PCH_DREF_CONTROL, temp);
1260     + POSTING_READ(PCH_DREF_CONTROL);
1261     +
1262     + temp &= ~DREF_SSC_SOURCE_MASK;
1263     + temp |= DREF_SSC_SOURCE_ENABLE;
1264     + I915_WRITE(PCH_DREF_CONTROL, temp);
1265     + POSTING_READ(PCH_DREF_CONTROL);
1266     +
1267     + udelay(200);
1268     +
1269     + if (is_edp) {
1270     + if (dev_priv->lvds_use_ssc) {
1271     + temp |= DREF_SSC1_ENABLE;
1272     + I915_WRITE(PCH_DREF_CONTROL, temp);
1273     + POSTING_READ(PCH_DREF_CONTROL);
1274     +
1275     + udelay(200);
1276     +
1277     + temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
1278     + temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD;
1279     + I915_WRITE(PCH_DREF_CONTROL, temp);
1280     + POSTING_READ(PCH_DREF_CONTROL);
1281     + } else {
1282     + temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;
1283     + I915_WRITE(PCH_DREF_CONTROL, temp);
1284     + POSTING_READ(PCH_DREF_CONTROL);
1285     + }
1286     + }
1287     + }
1288     +
1289     if (IS_IGD(dev))
1290     fp = (1 << clock.n) << 16 | clock.m1 << 8 | clock.m2;
1291     else
1292     diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
1293     index 9157247..231a6a5 100644
1294     --- a/drivers/hwmon/it87.c
1295     +++ b/drivers/hwmon/it87.c
1296     @@ -1028,12 +1028,11 @@ static int __init it87_find(unsigned short *address,
1297     chip_type, *address, sio_data->revision);
1298    
1299     /* Read GPIO config and VID value from LDN 7 (GPIO) */
1300     - if (chip_type != IT8705F_DEVID) {
1301     + if (sio_data->type != it87) {
1302     int reg;
1303    
1304     superio_select(GPIO);
1305     - if ((chip_type == it8718) ||
1306     - (chip_type == it8720))
1307     + if (sio_data->type == it8718 || sio_data->type == it8720)
1308     sio_data->vid_value = superio_inb(IT87_SIO_VID_REG);
1309    
1310     reg = superio_inb(IT87_SIO_PINX2_REG);
1311     diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
1312     index 19984bf..c65e245 100644
1313     --- a/drivers/input/mouse/synaptics.c
1314     +++ b/drivers/input/mouse/synaptics.c
1315     @@ -652,6 +652,16 @@ static const struct dmi_system_id toshiba_dmi_table[] = {
1316     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1317     DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"),
1318     },
1319     +
1320     + },
1321     + {
1322     + .ident = "Toshiba Portege M300",
1323     + .matches = {
1324     + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1325     + DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
1326     + DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
1327     + },
1328     +
1329     },
1330     { }
1331     };
1332     diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
1333     index b40fb9b..6f308a4 100644
1334     --- a/drivers/macintosh/via-pmu.c
1335     +++ b/drivers/macintosh/via-pmu.c
1336     @@ -405,7 +405,11 @@ static int __init via_pmu_start(void)
1337     printk(KERN_ERR "via-pmu: can't map interrupt\n");
1338     return -ENODEV;
1339     }
1340     - if (request_irq(irq, via_pmu_interrupt, 0, "VIA-PMU", (void *)0)) {
1341     + /* We set IRQF_TIMER because we don't want the interrupt to be disabled
1342     + * between the 2 passes of driver suspend, we control our own disabling
1343     + * for that one
1344     + */
1345     + if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) {
1346     printk(KERN_ERR "via-pmu: can't request irq %d\n", irq);
1347     return -ENODEV;
1348     }
1349     @@ -419,7 +423,7 @@ static int __init via_pmu_start(void)
1350     gpio_irq = irq_of_parse_and_map(gpio_node, 0);
1351    
1352     if (gpio_irq != NO_IRQ) {
1353     - if (request_irq(gpio_irq, gpio1_interrupt, 0,
1354     + if (request_irq(gpio_irq, gpio1_interrupt, IRQF_TIMER,
1355     "GPIO1 ADB", (void *)0))
1356     printk(KERN_ERR "pmu: can't get irq %d"
1357     " (GPIO1)\n", gpio_irq);
1358     @@ -925,8 +929,7 @@ proc_write_options(struct file *file, const char __user *buffer,
1359    
1360     #ifdef CONFIG_ADB
1361     /* Send an ADB command */
1362     -static int
1363     -pmu_send_request(struct adb_request *req, int sync)
1364     +static int pmu_send_request(struct adb_request *req, int sync)
1365     {
1366     int i, ret;
1367    
1368     @@ -1005,16 +1008,11 @@ pmu_send_request(struct adb_request *req, int sync)
1369     }
1370    
1371     /* Enable/disable autopolling */
1372     -static int
1373     -pmu_adb_autopoll(int devs)
1374     +static int __pmu_adb_autopoll(int devs)
1375     {
1376     struct adb_request req;
1377    
1378     - if ((vias == NULL) || (!pmu_fully_inited) || !pmu_has_adb)
1379     - return -ENXIO;
1380     -
1381     if (devs) {
1382     - adb_dev_map = devs;
1383     pmu_request(&req, NULL, 5, PMU_ADB_CMD, 0, 0x86,
1384     adb_dev_map >> 8, adb_dev_map);
1385     pmu_adb_flags = 2;
1386     @@ -1027,9 +1025,17 @@ pmu_adb_autopoll(int devs)
1387     return 0;
1388     }
1389    
1390     +static int pmu_adb_autopoll(int devs)
1391     +{
1392     + if ((vias == NULL) || (!pmu_fully_inited) || !pmu_has_adb)
1393     + return -ENXIO;
1394     +
1395     + adb_dev_map = devs;
1396     + return __pmu_adb_autopoll(devs);
1397     +}
1398     +
1399     /* Reset the ADB bus */
1400     -static int
1401     -pmu_adb_reset_bus(void)
1402     +static int pmu_adb_reset_bus(void)
1403     {
1404     struct adb_request req;
1405     int save_autopoll = adb_dev_map;
1406     @@ -1038,13 +1044,13 @@ pmu_adb_reset_bus(void)
1407     return -ENXIO;
1408    
1409     /* anyone got a better idea?? */
1410     - pmu_adb_autopoll(0);
1411     + __pmu_adb_autopoll(0);
1412    
1413     - req.nbytes = 5;
1414     + req.nbytes = 4;
1415     req.done = NULL;
1416     req.data[0] = PMU_ADB_CMD;
1417     - req.data[1] = 0;
1418     - req.data[2] = ADB_BUSRESET;
1419     + req.data[1] = ADB_BUSRESET;
1420     + req.data[2] = 0;
1421     req.data[3] = 0;
1422     req.data[4] = 0;
1423     req.reply_len = 0;
1424     @@ -1056,7 +1062,7 @@ pmu_adb_reset_bus(void)
1425     pmu_wait_complete(&req);
1426    
1427     if (save_autopoll != 0)
1428     - pmu_adb_autopoll(save_autopoll);
1429     + __pmu_adb_autopoll(save_autopoll);
1430    
1431     return 0;
1432     }
1433     diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
1434     index 556acff..932d1b1 100644
1435     --- a/drivers/md/dm-exception-store.c
1436     +++ b/drivers/md/dm-exception-store.c
1437     @@ -155,7 +155,8 @@ static int set_chunk_size(struct dm_exception_store *store,
1438     char *value;
1439    
1440     chunk_size_ulong = simple_strtoul(chunk_size_arg, &value, 10);
1441     - if (*chunk_size_arg == '\0' || *value != '\0') {
1442     + if (*chunk_size_arg == '\0' || *value != '\0' ||
1443     + chunk_size_ulong > UINT_MAX) {
1444     *error = "Invalid chunk size";
1445     return -EINVAL;
1446     }
1447     @@ -171,34 +172,35 @@ static int set_chunk_size(struct dm_exception_store *store,
1448     */
1449     chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9);
1450    
1451     - return dm_exception_store_set_chunk_size(store, chunk_size_ulong,
1452     + return dm_exception_store_set_chunk_size(store,
1453     + (unsigned) chunk_size_ulong,
1454     error);
1455     }
1456    
1457     int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
1458     - unsigned long chunk_size_ulong,
1459     + unsigned chunk_size,
1460     char **error)
1461     {
1462     /* Check chunk_size is a power of 2 */
1463     - if (!is_power_of_2(chunk_size_ulong)) {
1464     + if (!is_power_of_2(chunk_size)) {
1465     *error = "Chunk size is not a power of 2";
1466     return -EINVAL;
1467     }
1468    
1469     /* Validate the chunk size against the device block size */
1470     - if (chunk_size_ulong % (bdev_logical_block_size(store->cow->bdev) >> 9)) {
1471     + if (chunk_size % (bdev_logical_block_size(store->cow->bdev) >> 9)) {
1472     *error = "Chunk size is not a multiple of device blocksize";
1473     return -EINVAL;
1474     }
1475    
1476     - if (chunk_size_ulong > INT_MAX >> SECTOR_SHIFT) {
1477     + if (chunk_size > INT_MAX >> SECTOR_SHIFT) {
1478     *error = "Chunk size is too high";
1479     return -EINVAL;
1480     }
1481    
1482     - store->chunk_size = chunk_size_ulong;
1483     - store->chunk_mask = chunk_size_ulong - 1;
1484     - store->chunk_shift = ffs(chunk_size_ulong) - 1;
1485     + store->chunk_size = chunk_size;
1486     + store->chunk_mask = chunk_size - 1;
1487     + store->chunk_shift = ffs(chunk_size) - 1;
1488    
1489     return 0;
1490     }
1491     @@ -251,7 +253,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
1492    
1493     r = set_chunk_size(tmp_store, argv[2], &ti->error);
1494     if (r)
1495     - goto bad_cow;
1496     + goto bad_ctr;
1497    
1498     r = type->ctr(tmp_store, 0, NULL);
1499     if (r) {
1500     diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
1501     index 812c718..8a223a4 100644
1502     --- a/drivers/md/dm-exception-store.h
1503     +++ b/drivers/md/dm-exception-store.h
1504     @@ -101,9 +101,9 @@ struct dm_exception_store {
1505     struct dm_dev *cow;
1506    
1507     /* Size of data blocks saved - must be a power of 2 */
1508     - chunk_t chunk_size;
1509     - chunk_t chunk_mask;
1510     - chunk_t chunk_shift;
1511     + unsigned chunk_size;
1512     + unsigned chunk_mask;
1513     + unsigned chunk_shift;
1514    
1515     void *context;
1516     };
1517     @@ -169,7 +169,7 @@ int dm_exception_store_type_register(struct dm_exception_store_type *type);
1518     int dm_exception_store_type_unregister(struct dm_exception_store_type *type);
1519    
1520     int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
1521     - unsigned long chunk_size_ulong,
1522     + unsigned chunk_size,
1523     char **error);
1524    
1525     int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
1526     diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c
1527     index 652bd33..7ac2c14 100644
1528     --- a/drivers/md/dm-log-userspace-base.c
1529     +++ b/drivers/md/dm-log-userspace-base.c
1530     @@ -156,7 +156,7 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti,
1531     }
1532    
1533     /* The ptr value is sufficient for local unique id */
1534     - lc->luid = (uint64_t)lc;
1535     + lc->luid = (unsigned long)lc;
1536    
1537     lc->ti = ti;
1538    
1539     diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
1540     index d5b2e08..0c74642 100644
1541     --- a/drivers/md/dm-snap-persistent.c
1542     +++ b/drivers/md/dm-snap-persistent.c
1543     @@ -284,12 +284,13 @@ static int read_header(struct pstore *ps, int *new_snapshot)
1544     {
1545     int r;
1546     struct disk_header *dh;
1547     - chunk_t chunk_size;
1548     + unsigned chunk_size;
1549     int chunk_size_supplied = 1;
1550     char *chunk_err;
1551    
1552     /*
1553     - * Use default chunk size (or hardsect_size, if larger) if none supplied
1554     + * Use default chunk size (or logical_block_size, if larger)
1555     + * if none supplied
1556     */
1557     if (!ps->store->chunk_size) {
1558     ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS,
1559     @@ -334,10 +335,9 @@ static int read_header(struct pstore *ps, int *new_snapshot)
1560     return 0;
1561    
1562     if (chunk_size_supplied)
1563     - DMWARN("chunk size %llu in device metadata overrides "
1564     - "table chunk size of %llu.",
1565     - (unsigned long long)chunk_size,
1566     - (unsigned long long)ps->store->chunk_size);
1567     + DMWARN("chunk size %u in device metadata overrides "
1568     + "table chunk size of %u.",
1569     + chunk_size, ps->store->chunk_size);
1570    
1571     /* We had a bogus chunk_size. Fix stuff up. */
1572     free_area(ps);
1573     @@ -345,8 +345,8 @@ static int read_header(struct pstore *ps, int *new_snapshot)
1574     r = dm_exception_store_set_chunk_size(ps->store, chunk_size,
1575     &chunk_err);
1576     if (r) {
1577     - DMERR("invalid on-disk chunk size %llu: %s.",
1578     - (unsigned long long)chunk_size, chunk_err);
1579     + DMERR("invalid on-disk chunk size %u: %s.",
1580     + chunk_size, chunk_err);
1581     return r;
1582     }
1583    
1584     diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
1585     index 57f1bf7..3a3ba46 100644
1586     --- a/drivers/md/dm-snap.c
1587     +++ b/drivers/md/dm-snap.c
1588     @@ -296,6 +296,7 @@ static void __insert_origin(struct origin *o)
1589     */
1590     static int register_snapshot(struct dm_snapshot *snap)
1591     {
1592     + struct dm_snapshot *l;
1593     struct origin *o, *new_o;
1594     struct block_device *bdev = snap->origin->bdev;
1595    
1596     @@ -319,7 +320,11 @@ static int register_snapshot(struct dm_snapshot *snap)
1597     __insert_origin(o);
1598     }
1599    
1600     - list_add_tail(&snap->list, &o->snapshots);
1601     + /* Sort the list according to chunk size, largest-first smallest-last */
1602     + list_for_each_entry(l, &o->snapshots, list)
1603     + if (l->store->chunk_size < snap->store->chunk_size)
1604     + break;
1605     + list_add_tail(&snap->list, &l->list);
1606    
1607     up_write(&_origins_lock);
1608     return 0;
1609     @@ -668,6 +673,11 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1610     bio_list_init(&s->queued_bios);
1611     INIT_WORK(&s->queued_bios_work, flush_queued_bios);
1612    
1613     + if (!s->store->chunk_size) {
1614     + ti->error = "Chunk size not set";
1615     + goto bad_load_and_register;
1616     + }
1617     +
1618     /* Add snapshot to the list of snapshots for this origin */
1619     /* Exceptions aren't triggered till snapshot_resume() is called */
1620     if (register_snapshot(s)) {
1621     @@ -951,7 +961,7 @@ static void start_copy(struct dm_snap_pending_exception *pe)
1622    
1623     src.bdev = bdev;
1624     src.sector = chunk_to_sector(s->store, pe->e.old_chunk);
1625     - src.count = min(s->store->chunk_size, dev_size - src.sector);
1626     + src.count = min((sector_t)s->store->chunk_size, dev_size - src.sector);
1627    
1628     dest.bdev = s->store->cow->bdev;
1629     dest.sector = chunk_to_sector(s->store, pe->e.new_chunk);
1630     @@ -1142,6 +1152,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
1631     unsigned sz = 0;
1632     struct dm_snapshot *snap = ti->private;
1633    
1634     + down_write(&snap->lock);
1635     +
1636     switch (type) {
1637     case STATUSTYPE_INFO:
1638     if (!snap->valid)
1639     @@ -1173,6 +1185,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
1640     break;
1641     }
1642    
1643     + up_write(&snap->lock);
1644     +
1645     return 0;
1646     }
1647    
1648     @@ -1388,7 +1402,7 @@ static void origin_resume(struct dm_target *ti)
1649     struct dm_dev *dev = ti->private;
1650     struct dm_snapshot *snap;
1651     struct origin *o;
1652     - chunk_t chunk_size = 0;
1653     + unsigned chunk_size = 0;
1654    
1655     down_read(&_origins_lock);
1656     o = __lookup_origin(dev->bdev);
1657     @@ -1465,7 +1479,7 @@ static int __init dm_snapshot_init(void)
1658     r = dm_register_target(&snapshot_target);
1659     if (r) {
1660     DMERR("snapshot target register failed %d", r);
1661     - return r;
1662     + goto bad_register_snapshot_target;
1663     }
1664    
1665     r = dm_register_target(&origin_target);
1666     @@ -1522,6 +1536,9 @@ bad2:
1667     dm_unregister_target(&origin_target);
1668     bad1:
1669     dm_unregister_target(&snapshot_target);
1670     +
1671     +bad_register_snapshot_target:
1672     + dm_exception_store_exit();
1673     return r;
1674     }
1675    
1676     diff --git a/drivers/md/dm.c b/drivers/md/dm.c
1677     index b4845b1..ae087b0 100644
1678     --- a/drivers/md/dm.c
1679     +++ b/drivers/md/dm.c
1680     @@ -47,6 +47,7 @@ struct dm_io {
1681     atomic_t io_count;
1682     struct bio *bio;
1683     unsigned long start_time;
1684     + spinlock_t endio_lock;
1685     };
1686    
1687     /*
1688     @@ -576,8 +577,12 @@ static void dec_pending(struct dm_io *io, int error)
1689     struct mapped_device *md = io->md;
1690    
1691     /* Push-back supersedes any I/O errors */
1692     - if (error && !(io->error > 0 && __noflush_suspending(md)))
1693     - io->error = error;
1694     + if (unlikely(error)) {
1695     + spin_lock_irqsave(&io->endio_lock, flags);
1696     + if (!(io->error > 0 && __noflush_suspending(md)))
1697     + io->error = error;
1698     + spin_unlock_irqrestore(&io->endio_lock, flags);
1699     + }
1700    
1701     if (atomic_dec_and_test(&io->io_count)) {
1702     if (io->error == DM_ENDIO_REQUEUE) {
1703     @@ -1224,6 +1229,7 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
1704     atomic_set(&ci.io->io_count, 1);
1705     ci.io->bio = bio;
1706     ci.io->md = md;
1707     + spin_lock_init(&ci.io->endio_lock);
1708     ci.sector = bio->bi_sector;
1709     ci.sector_count = bio_sectors(bio);
1710     if (unlikely(bio_empty_barrier(bio)))
1711     @@ -1819,6 +1825,7 @@ static struct mapped_device *alloc_dev(int minor)
1712     bad_bdev:
1713     destroy_workqueue(md->wq);
1714     bad_thread:
1715     + del_gendisk(md->disk);
1716     put_disk(md->disk);
1717     bad_disk:
1718     blk_cleanup_queue(md->queue);
1719     diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
1720     index 9cbf95b..de530d9 100644
1721     --- a/drivers/misc/sgi-gru/gruprocfs.c
1722     +++ b/drivers/misc/sgi-gru/gruprocfs.c
1723     @@ -161,14 +161,15 @@ static int options_show(struct seq_file *s, void *p)
1724     static ssize_t options_write(struct file *file, const char __user *userbuf,
1725     size_t count, loff_t *data)
1726     {
1727     - unsigned long val;
1728     - char buf[80];
1729     + char buf[20];
1730    
1731     - if (strncpy_from_user(buf, userbuf, sizeof(buf) - 1) < 0)
1732     + if (count >= sizeof(buf))
1733     + return -EINVAL;
1734     + if (copy_from_user(buf, userbuf, count))
1735     return -EFAULT;
1736     - buf[count - 1] = '\0';
1737     - if (!strict_strtoul(buf, 10, &val))
1738     - gru_options = val;
1739     + buf[count] = '\0';
1740     + if (strict_strtoul(buf, 0, &gru_options))
1741     + return -EINVAL;
1742    
1743     return count;
1744     }
1745     diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1746     index aa1be1f..7029d53 100644
1747     --- a/drivers/net/bonding/bond_main.c
1748     +++ b/drivers/net/bonding/bond_main.c
1749     @@ -691,7 +691,7 @@ static int bond_check_dev_link(struct bonding *bond,
1750     struct net_device *slave_dev, int reporting)
1751     {
1752     const struct net_device_ops *slave_ops = slave_dev->netdev_ops;
1753     - static int (*ioctl)(struct net_device *, struct ifreq *, int);
1754     + int (*ioctl)(struct net_device *, struct ifreq *, int);
1755     struct ifreq ifr;
1756     struct mii_ioctl_data *mii;
1757    
1758     diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
1759     index 31e5599..dcde92d 100644
1760     --- a/drivers/net/wireless/b43/rfkill.c
1761     +++ b/drivers/net/wireless/b43/rfkill.c
1762     @@ -33,7 +33,8 @@ bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
1763     & B43_MMIO_RADIO_HWENABLED_HI_MASK))
1764     return 1;
1765     } else {
1766     - if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
1767     + if (b43_status(dev) >= B43_STAT_STARTED &&
1768     + b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
1769     & B43_MMIO_RADIO_HWENABLED_LO_MASK)
1770     return 1;
1771     }
1772     diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
1773     index 2b8d40b..a13f678 100644
1774     --- a/drivers/net/wireless/iwlwifi/iwl-rx.c
1775     +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
1776     @@ -239,33 +239,51 @@ void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1777     struct iwl_rx_queue *rxq = &priv->rxq;
1778     struct list_head *element;
1779     struct iwl_rx_mem_buffer *rxb;
1780     + struct sk_buff *skb;
1781     unsigned long flags;
1782    
1783     while (1) {
1784     spin_lock_irqsave(&rxq->lock, flags);
1785     -
1786     if (list_empty(&rxq->rx_used)) {
1787     spin_unlock_irqrestore(&rxq->lock, flags);
1788     return;
1789     }
1790     - element = rxq->rx_used.next;
1791     - rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1792     - list_del(element);
1793     -
1794     spin_unlock_irqrestore(&rxq->lock, flags);
1795    
1796     + if (rxq->free_count > RX_LOW_WATERMARK)
1797     + priority |= __GFP_NOWARN;
1798     /* Alloc a new receive buffer */
1799     - rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
1800     + skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
1801     priority);
1802    
1803     - if (!rxb->skb) {
1804     - IWL_CRIT(priv, "Can not allocate SKB buffers\n");
1805     + if (!skb) {
1806     + if (net_ratelimit())
1807     + IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n");
1808     + if ((rxq->free_count <= RX_LOW_WATERMARK) &&
1809     + net_ratelimit())
1810     + IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
1811     + priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
1812     + rxq->free_count);
1813     /* We don't reschedule replenish work here -- we will
1814     * call the restock method and if it still needs
1815     * more buffers it will schedule replenish */
1816     break;
1817     }
1818    
1819     + spin_lock_irqsave(&rxq->lock, flags);
1820     +
1821     + if (list_empty(&rxq->rx_used)) {
1822     + spin_unlock_irqrestore(&rxq->lock, flags);
1823     + dev_kfree_skb_any(skb);
1824     + return;
1825     + }
1826     + element = rxq->rx_used.next;
1827     + rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1828     + list_del(element);
1829     +
1830     + spin_unlock_irqrestore(&rxq->lock, flags);
1831     +
1832     + rxb->skb = skb;
1833     /* Get physical address of RB/SKB */
1834     rxb->real_dma_addr = pci_map_single(
1835     priv->pci_dev,
1836     diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
1837     index 054d6c7..4fac582 100644
1838     --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
1839     +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
1840     @@ -1196,6 +1196,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1841     struct iwl_rx_queue *rxq = &priv->rxq;
1842     struct list_head *element;
1843     struct iwl_rx_mem_buffer *rxb;
1844     + struct sk_buff *skb;
1845     unsigned long flags;
1846    
1847     while (1) {
1848     @@ -1205,25 +1206,39 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1849     spin_unlock_irqrestore(&rxq->lock, flags);
1850     return;
1851     }
1852     -
1853     - element = rxq->rx_used.next;
1854     - rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1855     - list_del(element);
1856     spin_unlock_irqrestore(&rxq->lock, flags);
1857    
1858     + if (rxq->free_count > RX_LOW_WATERMARK)
1859     + priority |= __GFP_NOWARN;
1860     /* Alloc a new receive buffer */
1861     - rxb->skb =
1862     - alloc_skb(priv->hw_params.rx_buf_size,
1863     - priority);
1864     - if (!rxb->skb) {
1865     + skb = alloc_skb(priv->hw_params.rx_buf_size, priority);
1866     + if (!skb) {
1867     if (net_ratelimit())
1868     - IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
1869     + IWL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n");
1870     + if ((rxq->free_count <= RX_LOW_WATERMARK) &&
1871     + net_ratelimit())
1872     + IWL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n",
1873     + priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
1874     + rxq->free_count);
1875     /* We don't reschedule replenish work here -- we will
1876     * call the restock method and if it still needs
1877     * more buffers it will schedule replenish */
1878     break;
1879     }
1880    
1881     + spin_lock_irqsave(&rxq->lock, flags);
1882     + if (list_empty(&rxq->rx_used)) {
1883     + spin_unlock_irqrestore(&rxq->lock, flags);
1884     + dev_kfree_skb_any(skb);
1885     + return;
1886     + }
1887     + element = rxq->rx_used.next;
1888     + rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1889     + list_del(element);
1890     + spin_unlock_irqrestore(&rxq->lock, flags);
1891     +
1892     + rxb->skb = skb;
1893     +
1894     /* If radiotap head is required, reserve some headroom here.
1895     * The physical head count is a variable rx_stats->phy_count.
1896     * We reserve 4 bytes here. Plus these extra bytes, the
1897     diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
1898     index 1844c5a..3a9a8c1 100644
1899     --- a/drivers/net/wireless/libertas/if_usb.c
1900     +++ b/drivers/net/wireless/libertas/if_usb.c
1901     @@ -507,7 +507,7 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
1902     /* Fill the receive configuration URB and initialise the Rx call back */
1903     usb_fill_bulk_urb(cardp->rx_urb, cardp->udev,
1904     usb_rcvbulkpipe(cardp->udev, cardp->ep_in),
1905     - (void *) (skb->tail + (size_t) IPFIELD_ALIGN_OFFSET),
1906     + skb->data + IPFIELD_ALIGN_OFFSET,
1907     MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn,
1908     cardp);
1909    
1910     diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
1911     index 698b11b..8c67a48 100644
1912     --- a/drivers/net/wireless/ray_cs.c
1913     +++ b/drivers/net/wireless/ray_cs.c
1914     @@ -2878,7 +2878,7 @@ static int write_essid(struct file *file, const char __user *buffer,
1915     unsigned long count, void *data)
1916     {
1917     static char proc_essid[33];
1918     - int len = count;
1919     + unsigned int len = count;
1920    
1921     if (len > 32)
1922     len = 32;
1923     diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
1924     index 934d4be..698d75c 100644
1925     --- a/drivers/pcmcia/cs.c
1926     +++ b/drivers/pcmcia/cs.c
1927     @@ -98,10 +98,13 @@ EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
1928     * These functions check for the appropriate struct pcmcia_soket arrays,
1929     * and pass them to the low-level functions pcmcia_{suspend,resume}_socket
1930     */
1931     +static int socket_early_resume(struct pcmcia_socket *skt);
1932     +static int socket_late_resume(struct pcmcia_socket *skt);
1933     static int socket_resume(struct pcmcia_socket *skt);
1934     static int socket_suspend(struct pcmcia_socket *skt);
1935    
1936     -int pcmcia_socket_dev_suspend(struct device *dev)
1937     +static void pcmcia_socket_dev_run(struct device *dev,
1938     + int (*cb)(struct pcmcia_socket *))
1939     {
1940     struct pcmcia_socket *socket;
1941    
1942     @@ -110,29 +113,34 @@ int pcmcia_socket_dev_suspend(struct device *dev)
1943     if (socket->dev.parent != dev)
1944     continue;
1945     mutex_lock(&socket->skt_mutex);
1946     - socket_suspend(socket);
1947     + cb(socket);
1948     mutex_unlock(&socket->skt_mutex);
1949     }
1950     up_read(&pcmcia_socket_list_rwsem);
1951     +}
1952    
1953     +int pcmcia_socket_dev_suspend(struct device *dev)
1954     +{
1955     + pcmcia_socket_dev_run(dev, socket_suspend);
1956     return 0;
1957     }
1958     EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
1959    
1960     -int pcmcia_socket_dev_resume(struct device *dev)
1961     +void pcmcia_socket_dev_early_resume(struct device *dev)
1962     {
1963     - struct pcmcia_socket *socket;
1964     + pcmcia_socket_dev_run(dev, socket_early_resume);
1965     +}
1966     +EXPORT_SYMBOL(pcmcia_socket_dev_early_resume);
1967    
1968     - down_read(&pcmcia_socket_list_rwsem);
1969     - list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
1970     - if (socket->dev.parent != dev)
1971     - continue;
1972     - mutex_lock(&socket->skt_mutex);
1973     - socket_resume(socket);
1974     - mutex_unlock(&socket->skt_mutex);
1975     - }
1976     - up_read(&pcmcia_socket_list_rwsem);
1977     +void pcmcia_socket_dev_late_resume(struct device *dev)
1978     +{
1979     + pcmcia_socket_dev_run(dev, socket_late_resume);
1980     +}
1981     +EXPORT_SYMBOL(pcmcia_socket_dev_late_resume);
1982    
1983     +int pcmcia_socket_dev_resume(struct device *dev)
1984     +{
1985     + pcmcia_socket_dev_run(dev, socket_resume);
1986     return 0;
1987     }
1988     EXPORT_SYMBOL(pcmcia_socket_dev_resume);
1989     @@ -546,29 +554,24 @@ static int socket_suspend(struct pcmcia_socket *skt)
1990     return 0;
1991     }
1992    
1993     -/*
1994     - * Resume a socket. If a card is present, verify its CIS against
1995     - * our cached copy. If they are different, the card has been
1996     - * replaced, and we need to tell the drivers.
1997     - */
1998     -static int socket_resume(struct pcmcia_socket *skt)
1999     +static int socket_early_resume(struct pcmcia_socket *skt)
2000     {
2001     - int ret;
2002     -
2003     - if (!(skt->state & SOCKET_SUSPEND))
2004     - return -EBUSY;
2005     -
2006     skt->socket = dead_socket;
2007     skt->ops->init(skt);
2008     skt->ops->set_socket(skt, &skt->socket);
2009     + if (skt->state & SOCKET_PRESENT)
2010     + skt->resume_status = socket_setup(skt, resume_delay);
2011     + return 0;
2012     +}
2013    
2014     +static int socket_late_resume(struct pcmcia_socket *skt)
2015     +{
2016     if (!(skt->state & SOCKET_PRESENT)) {
2017     skt->state &= ~SOCKET_SUSPEND;
2018     return socket_insert(skt);
2019     }
2020    
2021     - ret = socket_setup(skt, resume_delay);
2022     - if (ret == 0) {
2023     + if (skt->resume_status == 0) {
2024     /*
2025     * FIXME: need a better check here for cardbus cards.
2026     */
2027     @@ -596,6 +599,20 @@ static int socket_resume(struct pcmcia_socket *skt)
2028     return 0;
2029     }
2030    
2031     +/*
2032     + * Resume a socket. If a card is present, verify its CIS against
2033     + * our cached copy. If they are different, the card has been
2034     + * replaced, and we need to tell the drivers.
2035     + */
2036     +static int socket_resume(struct pcmcia_socket *skt)
2037     +{
2038     + if (!(skt->state & SOCKET_SUSPEND))
2039     + return -EBUSY;
2040     +
2041     + socket_early_resume(skt);
2042     + return socket_late_resume(skt);
2043     +}
2044     +
2045     static void socket_remove(struct pcmcia_socket *skt)
2046     {
2047     dev_printk(KERN_NOTICE, &skt->dev,
2048     diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
2049     index f728a45..bcebffb 100644
2050     --- a/drivers/pcmcia/yenta_socket.c
2051     +++ b/drivers/pcmcia/yenta_socket.c
2052     @@ -1275,16 +1275,26 @@ static int yenta_dev_resume_noirq(struct device *dev)
2053     if (socket->type && socket->type->restore_state)
2054     socket->type->restore_state(socket);
2055    
2056     - return pcmcia_socket_dev_resume(dev);
2057     + pcmcia_socket_dev_early_resume(dev);
2058     + return 0;
2059     +}
2060     +
2061     +static int yenta_dev_resume(struct device *dev)
2062     +{
2063     + pcmcia_socket_dev_late_resume(dev);
2064     + return 0;
2065     }
2066    
2067     static struct dev_pm_ops yenta_pm_ops = {
2068     .suspend_noirq = yenta_dev_suspend_noirq,
2069     .resume_noirq = yenta_dev_resume_noirq,
2070     + .resume = yenta_dev_resume,
2071     .freeze_noirq = yenta_dev_suspend_noirq,
2072     .thaw_noirq = yenta_dev_resume_noirq,
2073     + .thaw = yenta_dev_resume,
2074     .poweroff_noirq = yenta_dev_suspend_noirq,
2075     .restore_noirq = yenta_dev_resume_noirq,
2076     + .restore = yenta_dev_resume,
2077     };
2078    
2079     #define YENTA_PM_OPS (&yenta_pm_ops)
2080     diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
2081     index b6af63c..4967643 100644
2082     --- a/drivers/scsi/dpt_i2o.c
2083     +++ b/drivers/scsi/dpt_i2o.c
2084     @@ -1918,6 +1918,10 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
2085     }
2086     size = size>>16;
2087     size *= 4;
2088     + if (size > MAX_MESSAGE_SIZE) {
2089     + rcode = -EINVAL;
2090     + goto cleanup;
2091     + }
2092     /* Copy in the user's I2O command */
2093     if (copy_from_user (msg, user_msg, size)) {
2094     rcode = -EFAULT;
2095     diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
2096     index e7108e7..7b5ff09 100644
2097     --- a/drivers/serial/8250_pci.c
2098     +++ b/drivers/serial/8250_pci.c
2099     @@ -1561,6 +1561,7 @@ enum pci_board_num_t {
2100     pbn_exar_XR17C152,
2101     pbn_exar_XR17C154,
2102     pbn_exar_XR17C158,
2103     + pbn_exar_ibm_saturn,
2104     pbn_pasemi_1682M,
2105     pbn_ni8430_2,
2106     pbn_ni8430_4,
2107     @@ -2146,6 +2147,13 @@ static struct pciserial_board pci_boards[] __devinitdata = {
2108     .base_baud = 921600,
2109     .uart_offset = 0x200,
2110     },
2111     + [pbn_exar_ibm_saturn] = {
2112     + .flags = FL_BASE0,
2113     + .num_ports = 1,
2114     + .base_baud = 921600,
2115     + .uart_offset = 0x200,
2116     + },
2117     +
2118     /*
2119     * PA Semi PWRficient PA6T-1682M on-chip UART
2120     */
2121     @@ -2649,6 +2657,9 @@ static struct pci_device_id serial_pci_tbl[] = {
2122     PCI_SUBVENDOR_ID_CONNECT_TECH,
2123     PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
2124     pbn_b0_8_1843200_200 },
2125     + { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
2126     + PCI_VENDOR_ID_IBM, PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT,
2127     + 0, 0, pbn_exar_ibm_saturn },
2128    
2129     { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
2130     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2131     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2132     index 20b0788..7c99185 100644
2133     --- a/drivers/usb/serial/option.c
2134     +++ b/drivers/usb/serial/option.c
2135     @@ -166,6 +166,7 @@ static int option_resume(struct usb_serial *serial);
2136     #define HUAWEI_PRODUCT_E143D 0x143D
2137     #define HUAWEI_PRODUCT_E143E 0x143E
2138     #define HUAWEI_PRODUCT_E143F 0x143F
2139     +#define HUAWEI_PRODUCT_E14AC 0x14AC
2140    
2141     #define QUANTA_VENDOR_ID 0x0408
2142     #define QUANTA_PRODUCT_Q101 0xEA02
2143     @@ -315,6 +316,9 @@ static int option_resume(struct usb_serial *serial);
2144     #define QISDA_PRODUCT_H20_4515 0x4515
2145     #define QISDA_PRODUCT_H20_4519 0x4519
2146    
2147     +/* TLAYTECH PRODUCTS */
2148     +#define TLAYTECH_VENDOR_ID 0x20B9
2149     +#define TLAYTECH_PRODUCT_TEU800 0x1682
2150    
2151     /* TOSHIBA PRODUCTS */
2152     #define TOSHIBA_VENDOR_ID 0x0930
2153     @@ -328,6 +332,9 @@ static int option_resume(struct usb_serial *serial);
2154     #define ALCATEL_VENDOR_ID 0x1bbb
2155     #define ALCATEL_PRODUCT_X060S 0x0000
2156    
2157     +/* Airplus products */
2158     +#define AIRPLUS_VENDOR_ID 0x1011
2159     +#define AIRPLUS_PRODUCT_MCD650 0x3198
2160    
2161     static struct usb_device_id option_ids[] = {
2162     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
2163     @@ -426,6 +433,7 @@ static struct usb_device_id option_ids[] = {
2164     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
2165     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
2166     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
2167     + { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) },
2168     { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
2169     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */
2170     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */
2171     @@ -588,6 +596,8 @@ static struct usb_device_id option_ids[] = {
2172     { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
2173     { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
2174     { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
2175     + { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
2176     + { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
2177     { } /* Terminating entry */
2178     };
2179     MODULE_DEVICE_TABLE(usb, option_ids);
2180     diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
2181     index f48d05e..c5fbaa5 100644
2182     --- a/drivers/usb/serial/sierra.c
2183     +++ b/drivers/usb/serial/sierra.c
2184     @@ -287,6 +287,8 @@ static int sierra_send_setup(struct usb_serial_port *port)
2185     struct sierra_port_private *portdata;
2186     __u16 interface = 0;
2187     int val = 0;
2188     + int do_send = 0;
2189     + int retval;
2190    
2191     dev_dbg(&port->dev, "%s\n", __func__);
2192    
2193     @@ -305,10 +307,7 @@ static int sierra_send_setup(struct usb_serial_port *port)
2194     */
2195     if (port->interrupt_in_urb) {
2196     /* send control message */
2197     - return usb_control_msg(serial->dev,
2198     - usb_rcvctrlpipe(serial->dev, 0),
2199     - 0x22, 0x21, val, interface,
2200     - NULL, 0, USB_CTRL_SET_TIMEOUT);
2201     + do_send = 1;
2202     }
2203     }
2204    
2205     @@ -320,12 +319,18 @@ static int sierra_send_setup(struct usb_serial_port *port)
2206     interface = 1;
2207     else if (port->bulk_out_endpointAddress == 5)
2208     interface = 2;
2209     - return usb_control_msg(serial->dev,
2210     - usb_rcvctrlpipe(serial->dev, 0),
2211     - 0x22, 0x21, val, interface,
2212     - NULL, 0, USB_CTRL_SET_TIMEOUT);
2213     +
2214     + do_send = 1;
2215     }
2216     - return 0;
2217     + if (!do_send)
2218     + return 0;
2219     +
2220     + usb_autopm_get_interface(serial->interface);
2221     + retval = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
2222     + 0x22, 0x21, val, interface, NULL, 0, USB_CTRL_SET_TIMEOUT);
2223     + usb_autopm_put_interface(serial->interface);
2224     +
2225     + return retval;
2226     }
2227    
2228     static void sierra_set_termios(struct tty_struct *tty,
2229     diff --git a/drivers/video/console/.gitignore b/drivers/video/console/.gitignore
2230     deleted file mode 100644
2231     index 0c258b4..0000000
2232     --- a/drivers/video/console/.gitignore
2233     +++ /dev/null
2234     @@ -1,2 +0,0 @@
2235     -# conmakehash generated file
2236     -promcon_tbl.c
2237     diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
2238     index 2f50a80..979b5a1 100644
2239     --- a/drivers/video/console/Kconfig
2240     +++ b/drivers/video/console/Kconfig
2241     @@ -67,16 +67,9 @@ config SGI_NEWPORT_CONSOLE
2242    
2243     # bool 'IODC console' CONFIG_IODC_CONSOLE
2244    
2245     -config PROM_CONSOLE
2246     - bool "PROM console"
2247     - depends on SPARC
2248     - help
2249     - Say Y to build a console driver for Sun machines that uses the
2250     - terminal emulation built into their console PROMS.
2251     -
2252     config DUMMY_CONSOLE
2253     bool
2254     - depends on PROM_CONSOLE!=y || VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y
2255     + depends on VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y
2256     default y
2257    
2258     config DUMMY_CONSOLE_COLUMNS
2259     diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
2260     index ac46cc3..a862e91 100644
2261     --- a/drivers/video/console/Makefile
2262     +++ b/drivers/video/console/Makefile
2263     @@ -22,7 +22,6 @@ font-objs += $(font-objs-y)
2264    
2265     obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o
2266     obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o font.o
2267     -obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o
2268     obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o font.o
2269     obj-$(CONFIG_VGA_CONSOLE) += vgacon.o
2270     obj-$(CONFIG_MDA_CONSOLE) += mdacon.o
2271     @@ -40,14 +39,3 @@ obj-$(CONFIG_FB_STI) += sticore.o font.o
2272     ifeq ($(CONFIG_USB_SISUSBVGA_CON),y)
2273     obj-$(CONFIG_USB_SISUSBVGA) += font.o
2274     endif
2275     -
2276     -# Targets that kbuild needs to know about
2277     -targets := promcon_tbl.c
2278     -
2279     -quiet_cmd_conmakehash = CNMKHSH $@
2280     - cmd_conmakehash = scripts/conmakehash $< | \
2281     - sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \
2282     - -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@
2283     -
2284     -$(obj)/promcon_tbl.c: $(src)/prom.uni
2285     - $(call cmd,conmakehash)
2286     diff --git a/drivers/video/console/prom.uni b/drivers/video/console/prom.uni
2287     deleted file mode 100644
2288     index 58f9c04..0000000
2289     --- a/drivers/video/console/prom.uni
2290     +++ /dev/null
2291     @@ -1,11 +0,0 @@
2292     -#
2293     -# Unicode mapping table for font in Sun PROM
2294     -#
2295     -#
2296     -0x20-0x7e idem
2297     -0xa0-0xff idem
2298     -#
2299     -0x7c U+2502
2300     -0x2d U+2500
2301     -0x2b U+250c U+2510 U+2514 U+2518 U+251c U+2524 U+252c U+2534 U+253c
2302     -0xa4 U+fffd
2303     diff --git a/drivers/video/console/promcon.c b/drivers/video/console/promcon.c
2304     deleted file mode 100644
2305     index ae02e4e..0000000
2306     --- a/drivers/video/console/promcon.c
2307     +++ /dev/null
2308     @@ -1,598 +0,0 @@
2309     -/* $Id: 0105-2.6.31.6-all-fixes.patch,v 1.1 2009-11-17 22:49:06 niro Exp $
2310     - * Console driver utilizing PROM sun terminal emulation
2311     - *
2312     - * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
2313     - * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
2314     - */
2315     -
2316     -#include <linux/module.h>
2317     -#include <linux/kernel.h>
2318     -#include <linux/errno.h>
2319     -#include <linux/string.h>
2320     -#include <linux/mm.h>
2321     -#include <linux/slab.h>
2322     -#include <linux/delay.h>
2323     -#include <linux/console.h>
2324     -#include <linux/vt_kern.h>
2325     -#include <linux/selection.h>
2326     -#include <linux/fb.h>
2327     -#include <linux/init.h>
2328     -#include <linux/kd.h>
2329     -
2330     -#include <asm/oplib.h>
2331     -#include <asm/uaccess.h>
2332     -
2333     -static short pw = 80 - 1, ph = 34 - 1;
2334     -static short px, py;
2335     -static unsigned long promcon_uni_pagedir[2];
2336     -
2337     -extern u8 promfont_unicount[];
2338     -extern u16 promfont_unitable[];
2339     -
2340     -#define PROMCON_COLOR 0
2341     -
2342     -#if PROMCON_COLOR
2343     -#define inverted(s) ((((s) & 0x7700) == 0x0700) ? 0 : 1)
2344     -#else
2345     -#define inverted(s) (((s) & 0x0800) ? 1 : 0)
2346     -#endif
2347     -
2348     -static __inline__ void
2349     -promcon_puts(char *buf, int cnt)
2350     -{
2351     - prom_printf("%*.*s", cnt, cnt, buf);
2352     -}
2353     -
2354     -static int
2355     -promcon_start(struct vc_data *conp, char *b)
2356     -{
2357     - unsigned short *s = (unsigned short *)
2358     - (conp->vc_origin + py * conp->vc_size_row + (px << 1));
2359     - u16 cs;
2360     -
2361     - cs = scr_readw(s);
2362     - if (px == pw) {
2363     - unsigned short *t = s - 1;
2364     - u16 ct = scr_readw(t);
2365     -
2366     - if (inverted(cs) && inverted(ct))
2367     - return sprintf(b, "\b\033[7m%c\b\033[@%c\033[m", cs,
2368     - ct);
2369     - else if (inverted(cs))
2370     - return sprintf(b, "\b\033[7m%c\033[m\b\033[@%c", cs,
2371     - ct);
2372     - else if (inverted(ct))
2373     - return sprintf(b, "\b%c\b\033[@\033[7m%c\033[m", cs,
2374     - ct);
2375     - else
2376     - return sprintf(b, "\b%c\b\033[@%c", cs, ct);
2377     - }
2378     -
2379     - if (inverted(cs))
2380     - return sprintf(b, "\033[7m%c\033[m\b", cs);
2381     - else
2382     - return sprintf(b, "%c\b", cs);
2383     -}
2384     -
2385     -static int
2386     -promcon_end(struct vc_data *conp, char *b)
2387     -{
2388     - unsigned short *s = (unsigned short *)
2389     - (conp->vc_origin + py * conp->vc_size_row + (px << 1));
2390     - char *p = b;
2391     - u16 cs;
2392     -
2393     - b += sprintf(b, "\033[%d;%dH", py + 1, px + 1);
2394     -
2395     - cs = scr_readw(s);
2396     - if (px == pw) {
2397     - unsigned short *t = s - 1;
2398     - u16 ct = scr_readw(t);
2399     -
2400     - if (inverted(cs) && inverted(ct))
2401     - b += sprintf(b, "\b%c\b\033[@\033[7m%c\033[m", cs, ct);
2402     - else if (inverted(cs))
2403     - b += sprintf(b, "\b%c\b\033[@%c", cs, ct);
2404     - else if (inverted(ct))
2405     - b += sprintf(b, "\b\033[7m%c\b\033[@%c\033[m", cs, ct);
2406     - else
2407     - b += sprintf(b, "\b\033[7m%c\033[m\b\033[@%c", cs, ct);
2408     - return b - p;
2409     - }
2410     -
2411     - if (inverted(cs))
2412     - b += sprintf(b, "%c\b", cs);
2413     - else
2414     - b += sprintf(b, "\033[7m%c\033[m\b", cs);
2415     - return b - p;
2416     -}
2417     -
2418     -const char *promcon_startup(void)
2419     -{
2420     - const char *display_desc = "PROM";
2421     - int node;
2422     - char buf[40];
2423     -
2424     - node = prom_getchild(prom_root_node);
2425     - node = prom_searchsiblings(node, "options");
2426     - if (prom_getproperty(node, "screen-#columns", buf, 40) != -1) {
2427     - pw = simple_strtoul(buf, NULL, 0);
2428     - if (pw < 10 || pw > 256)
2429     - pw = 80;
2430     - pw--;
2431     - }
2432     - if (prom_getproperty(node, "screen-#rows", buf, 40) != -1) {
2433     - ph = simple_strtoul(buf, NULL, 0);
2434     - if (ph < 10 || ph > 256)
2435     - ph = 34;
2436     - ph--;
2437     - }
2438     - promcon_puts("\033[H\033[J", 6);
2439     - return display_desc;
2440     -}
2441     -
2442     -static void
2443     -promcon_init_unimap(struct vc_data *conp)
2444     -{
2445     - mm_segment_t old_fs = get_fs();
2446     - struct unipair *p, *p1;
2447     - u16 *q;
2448     - int i, j, k;
2449     -
2450     - p = kmalloc(256*sizeof(struct unipair), GFP_KERNEL);
2451     - if (!p) return;
2452     -
2453     - q = promfont_unitable;
2454     - p1 = p;
2455     - k = 0;
2456     - for (i = 0; i < 256; i++)
2457     - for (j = promfont_unicount[i]; j; j--) {
2458     - p1->unicode = *q++;
2459     - p1->fontpos = i;
2460     - p1++;
2461     - k++;
2462     - }
2463     - set_fs(KERNEL_DS);
2464     - con_clear_unimap(conp, NULL);
2465     - con_set_unimap(conp, k, p);
2466     - con_protect_unimap(conp, 1);
2467     - set_fs(old_fs);
2468     - kfree(p);
2469     -}
2470     -
2471     -static void
2472     -promcon_init(struct vc_data *conp, int init)
2473     -{
2474     - unsigned long p;
2475     -
2476     - conp->vc_can_do_color = PROMCON_COLOR;
2477     - if (init) {
2478     - conp->vc_cols = pw + 1;
2479     - conp->vc_rows = ph + 1;
2480     - }
2481     - p = *conp->vc_uni_pagedir_loc;
2482     - if (conp->vc_uni_pagedir_loc == &conp->vc_uni_pagedir ||
2483     - !--conp->vc_uni_pagedir_loc[1])
2484     - con_free_unimap(conp);
2485     - conp->vc_uni_pagedir_loc = promcon_uni_pagedir;
2486     - promcon_uni_pagedir[1]++;
2487     - if (!promcon_uni_pagedir[0] && p) {
2488     - promcon_init_unimap(conp);
2489     - }
2490     - if (!init) {
2491     - if (conp->vc_cols != pw + 1 || conp->vc_rows != ph + 1)
2492     - vc_resize(conp, pw + 1, ph + 1);
2493     - }
2494     -}
2495     -
2496     -static void
2497     -promcon_deinit(struct vc_data *conp)
2498     -{
2499     - /* When closing the last console, reset video origin */
2500     - if (!--promcon_uni_pagedir[1])
2501     - con_free_unimap(conp);
2502     - conp->vc_uni_pagedir_loc = &conp->vc_uni_pagedir;
2503     - con_set_default_unimap(conp);
2504     -}
2505     -
2506     -static int
2507     -promcon_switch(struct vc_data *conp)
2508     -{
2509     - return 1;
2510     -}
2511     -
2512     -static unsigned short *
2513     -promcon_repaint_line(unsigned short *s, unsigned char *buf, unsigned char **bp)
2514     -{
2515     - int cnt = pw + 1;
2516     - int attr = -1;
2517     - unsigned char *b = *bp;
2518     -
2519     - while (cnt--) {
2520     - u16 c = scr_readw(s);
2521     - if (attr != inverted(c)) {
2522     - attr = inverted(c);
2523     - if (attr) {
2524     - strcpy (b, "\033[7m");
2525     - b += 4;
2526     - } else {
2527     - strcpy (b, "\033[m");
2528     - b += 3;
2529     - }
2530     - }
2531     - *b++ = c;
2532     - s++;
2533     - if (b - buf >= 224) {
2534     - promcon_puts(buf, b - buf);
2535     - b = buf;
2536     - }
2537     - }
2538     - *bp = b;
2539     - return s;
2540     -}
2541     -
2542     -static void
2543     -promcon_putcs(struct vc_data *conp, const unsigned short *s,
2544     - int count, int y, int x)
2545     -{
2546     - unsigned char buf[256], *b = buf;
2547     - unsigned short attr = scr_readw(s);
2548     - unsigned char save;
2549     - int i, last = 0;
2550     -
2551     - if (console_blanked)
2552     - return;
2553     -
2554     - if (count <= 0)
2555     - return;
2556     -
2557     - b += promcon_start(conp, b);
2558     -
2559     - if (x + count >= pw + 1) {
2560     - if (count == 1) {
2561     - x -= 1;
2562     - save = scr_readw((unsigned short *)(conp->vc_origin
2563     - + y * conp->vc_size_row
2564     - + (x << 1)));
2565     -
2566     - if (px != x || py != y) {
2567     - b += sprintf(b, "\033[%d;%dH", y + 1, x + 1);
2568     - px = x;
2569     - py = y;
2570     - }
2571     -
2572     - if (inverted(attr))
2573     - b += sprintf(b, "\033[7m%c\033[m", scr_readw(s++));
2574     - else
2575     - b += sprintf(b, "%c", scr_readw(s++));
2576     -
2577     - strcpy(b, "\b\033[@");
2578     - b += 4;
2579     -
2580     - if (inverted(save))
2581     - b += sprintf(b, "\033[7m%c\033[m", save);
2582     - else
2583     - b += sprintf(b, "%c", save);
2584     -
2585     - px++;
2586     -
2587     - b += promcon_end(conp, b);
2588     - promcon_puts(buf, b - buf);
2589     - return;
2590     - } else {
2591     - last = 1;
2592     - count = pw - x - 1;
2593     - }
2594     - }
2595     -
2596     - if (inverted(attr)) {
2597     - strcpy(b, "\033[7m");
2598     - b += 4;
2599     - }
2600     -
2601     - if (px != x || py != y) {
2602     - b += sprintf(b, "\033[%d;%dH", y + 1, x + 1);
2603     - px = x;
2604     - py = y;
2605     - }
2606     -
2607     - for (i = 0; i < count; i++) {
2608     - if (b - buf >= 224) {
2609     - promcon_puts(buf, b - buf);
2610     - b = buf;
2611     - }
2612     - *b++ = scr_readw(s++);
2613     - }
2614     -
2615     - px += count;
2616     -
2617     - if (last) {
2618     - save = scr_readw(s++);
2619     - b += sprintf(b, "%c\b\033[@%c", scr_readw(s++), save);
2620     - px++;
2621     - }
2622     -
2623     - if (inverted(attr)) {
2624     - strcpy(b, "\033[m");
2625     - b += 3;
2626     - }
2627     -
2628     - b += promcon_end(conp, b);
2629     - promcon_puts(buf, b - buf);
2630     -}
2631     -
2632     -static void
2633     -promcon_putc(struct vc_data *conp, int c, int y, int x)
2634     -{
2635     - unsigned short s;
2636     -
2637     - if (console_blanked)
2638     - return;
2639     -
2640     - scr_writew(c, &s);
2641     - promcon_putcs(conp, &s, 1, y, x);
2642     -}
2643     -
2644     -static void
2645     -promcon_clear(struct vc_data *conp, int sy, int sx, int height, int width)
2646     -{
2647     - unsigned char buf[256], *b = buf;
2648     - int i, j;
2649     -
2650     - if (console_blanked)
2651     - return;
2652     -
2653     - b += promcon_start(conp, b);
2654     -
2655     - if (!sx && width == pw + 1) {
2656     -
2657     - if (!sy && height == ph + 1) {
2658     - strcpy(b, "\033[H\033[J");
2659     - b += 6;
2660     - b += promcon_end(conp, b);
2661     - promcon_puts(buf, b - buf);
2662     - return;
2663     - } else if (sy + height == ph + 1) {
2664     - b += sprintf(b, "\033[%dH\033[J", sy + 1);
2665     - b += promcon_end(conp, b);
2666     - promcon_puts(buf, b - buf);
2667     - return;
2668     - }
2669     -
2670     - b += sprintf(b, "\033[%dH", sy + 1);
2671     - for (i = 1; i < height; i++) {
2672     - strcpy(b, "\033[K\n");
2673     - b += 4;
2674     - }
2675     -
2676     - strcpy(b, "\033[K");
2677     - b += 3;
2678     -
2679     - b += promcon_end(conp, b);
2680     - promcon_puts(buf, b - buf);
2681     - return;
2682     -
2683     - } else if (sx + width == pw + 1) {
2684     -
2685     - b += sprintf(b, "\033[%d;%dH", sy + 1, sx + 1);
2686     - for (i = 1; i < height; i++) {
2687     - strcpy(b, "\033[K\n");
2688     - b += 4;
2689     - }
2690     -
2691     - strcpy(b, "\033[K");
2692     - b += 3;
2693     -
2694     - b += promcon_end(conp, b);
2695     - promcon_puts(buf, b - buf);
2696     - return;
2697     - }
2698     -
2699     - for (i = sy + 1; i <= sy + height; i++) {
2700     - b += sprintf(b, "\033[%d;%dH", i, sx + 1);
2701     - for (j = 0; j < width; j++)
2702     - *b++ = ' ';
2703     - if (b - buf + width >= 224) {
2704     - promcon_puts(buf, b - buf);
2705     - b = buf;
2706     - }
2707     - }
2708     -
2709     - b += promcon_end(conp, b);
2710     - promcon_puts(buf, b - buf);
2711     -}
2712     -
2713     -static void
2714     -promcon_bmove(struct vc_data *conp, int sy, int sx, int dy, int dx,
2715     - int height, int width)
2716     -{
2717     - char buf[256], *b = buf;
2718     -
2719     - if (console_blanked)
2720     - return;
2721     -
2722     - b += promcon_start(conp, b);
2723     - if (sy == dy && height == 1) {
2724     - if (dx > sx && dx + width == conp->vc_cols)
2725     - b += sprintf(b, "\033[%d;%dH\033[%d@\033[%d;%dH",
2726     - sy + 1, sx + 1, dx - sx, py + 1, px + 1);
2727     - else if (dx < sx && sx + width == conp->vc_cols)
2728     - b += sprintf(b, "\033[%d;%dH\033[%dP\033[%d;%dH",
2729     - dy + 1, dx + 1, sx - dx, py + 1, px + 1);
2730     -
2731     - b += promcon_end(conp, b);
2732     - promcon_puts(buf, b - buf);
2733     - return;
2734     - }
2735     -
2736     - /*
2737     - * FIXME: What to do here???
2738     - * Current console.c should not call it like that ever.
2739     - */
2740     - prom_printf("\033[7mFIXME: bmove not handled\033[m\n");
2741     -}
2742     -
2743     -static void
2744     -promcon_cursor(struct vc_data *conp, int mode)
2745     -{
2746     - char buf[32], *b = buf;
2747     -
2748     - switch (mode) {
2749     - case CM_ERASE:
2750     - break;
2751     -
2752     - case CM_MOVE:
2753     - case CM_DRAW:
2754     - b += promcon_start(conp, b);
2755     - if (px != conp->vc_x || py != conp->vc_y) {
2756     - px = conp->vc_x;
2757     - py = conp->vc_y;
2758     - b += sprintf(b, "\033[%d;%dH", py + 1, px + 1);
2759     - }
2760     - promcon_puts(buf, b - buf);
2761     - break;
2762     - }
2763     -}
2764     -
2765     -static int
2766     -promcon_blank(struct vc_data *conp, int blank, int mode_switch)
2767     -{
2768     - if (blank) {
2769     - promcon_puts("\033[H\033[J\033[7m \033[m\b", 15);
2770     - return 0;
2771     - } else {
2772     - /* Let console.c redraw */
2773     - return 1;
2774     - }
2775     -}
2776     -
2777     -static int
2778     -promcon_scroll(struct vc_data *conp, int t, int b, int dir, int count)
2779     -{
2780     - unsigned char buf[256], *p = buf;
2781     - unsigned short *s;
2782     - int i;
2783     -
2784     - if (console_blanked)
2785     - return 0;
2786     -
2787     - p += promcon_start(conp, p);
2788     -
2789     - switch (dir) {
2790     - case SM_UP:
2791     - if (b == ph + 1) {
2792     - p += sprintf(p, "\033[%dH\033[%dM", t + 1, count);
2793     - px = 0;
2794     - py = t;
2795     - p += promcon_end(conp, p);
2796     - promcon_puts(buf, p - buf);
2797     - break;
2798     - }
2799     -
2800     - s = (unsigned short *)(conp->vc_origin
2801     - + (t + count) * conp->vc_size_row);
2802     -
2803     - p += sprintf(p, "\033[%dH", t + 1);
2804     -
2805     - for (i = t; i < b - count; i++)
2806     - s = promcon_repaint_line(s, buf, &p);
2807     -
2808     - for (; i < b - 1; i++) {
2809     - strcpy(p, "\033[K\n");
2810     - p += 4;
2811     - if (p - buf >= 224) {
2812     - promcon_puts(buf, p - buf);
2813     - p = buf;
2814     - }
2815     - }
2816     -
2817     - strcpy(p, "\033[K");
2818     - p += 3;
2819     -
2820     - p += promcon_end(conp, p);
2821     - promcon_puts(buf, p - buf);
2822     - break;
2823     -
2824     - case SM_DOWN:
2825     - if (b == ph + 1) {
2826     - p += sprintf(p, "\033[%dH\033[%dL", t + 1, count);
2827     - px = 0;
2828     - py = t;
2829     - p += promcon_end(conp, p);
2830     - promcon_puts(buf, p - buf);
2831     - break;
2832     - }
2833     -
2834     - s = (unsigned short *)(conp->vc_origin + t * conp->vc_size_row);
2835     -
2836     - p += sprintf(p, "\033[%dH", t + 1);
2837     -
2838     - for (i = t; i < t + count; i++) {
2839     - strcpy(p, "\033[K\n");
2840     - p += 4;
2841     - if (p - buf >= 224) {
2842     - promcon_puts(buf, p - buf);
2843     - p = buf;
2844     - }
2845     - }
2846     -
2847     - for (; i < b; i++)
2848     - s = promcon_repaint_line(s, buf, &p);
2849     -
2850     - p += promcon_end(conp, p);
2851     - promcon_puts(buf, p - buf);
2852     - break;
2853     - }
2854     -
2855     - return 0;
2856     -}
2857     -
2858     -#if !(PROMCON_COLOR)
2859     -static u8 promcon_build_attr(struct vc_data *conp, u8 _color, u8 _intensity,
2860     - u8 _blink, u8 _underline, u8 _reverse, u8 _italic)
2861     -{
2862     - return (_reverse) ? 0xf : 0x7;
2863     -}
2864     -#endif
2865     -
2866     -/*
2867     - * The console 'switch' structure for the VGA based console
2868     - */
2869     -
2870     -static int promcon_dummy(void)
2871     -{
2872     - return 0;
2873     -}
2874     -
2875     -#define DUMMY (void *) promcon_dummy
2876     -
2877     -const struct consw prom_con = {
2878     - .owner = THIS_MODULE,
2879     - .con_startup = promcon_startup,
2880     - .con_init = promcon_init,
2881     - .con_deinit = promcon_deinit,
2882     - .con_clear = promcon_clear,
2883     - .con_putc = promcon_putc,
2884     - .con_putcs = promcon_putcs,
2885     - .con_cursor = promcon_cursor,
2886     - .con_scroll = promcon_scroll,
2887     - .con_bmove = promcon_bmove,
2888     - .con_switch = promcon_switch,
2889     - .con_blank = promcon_blank,
2890     - .con_set_palette = DUMMY,
2891     - .con_scrolldelta = DUMMY,
2892     -#if !(PROMCON_COLOR)
2893     - .con_build_attr = promcon_build_attr,
2894     -#endif
2895     -};
2896     -
2897     -void __init prom_con_init(void)
2898     -{
2899     -#ifdef CONFIG_DUMMY_CONSOLE
2900     - if (conswitchp == &dummy_con)
2901     - take_over_console(&prom_con, 0, MAX_NR_CONSOLES-1, 1);
2902     - else
2903     -#endif
2904     - if (conswitchp == &prom_con)
2905     - promcon_init_unimap(vc_cons[fg_console].d);
2906     -}
2907     diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
2908     index a882f26..0ffff9e 100644
2909     --- a/drivers/virtio/virtio_ring.c
2910     +++ b/drivers/virtio/virtio_ring.c
2911     @@ -281,6 +281,9 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
2912     return NULL;
2913     }
2914    
2915     + /* Only get used array entries after they have been exposed by host. */
2916     + rmb();
2917     +
2918     i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id;
2919     *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len;
2920    
2921     diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
2922     index 1e8f02f..d3c824d 100644
2923     --- a/drivers/watchdog/riowd.c
2924     +++ b/drivers/watchdog/riowd.c
2925     @@ -206,7 +206,7 @@ static int __devinit riowd_probe(struct of_device *op,
2926    
2927     dev_set_drvdata(&op->dev, p);
2928     riowd_device = p;
2929     - err = 0;
2930     + return 0;
2931    
2932     out_iounmap:
2933     of_iounmap(&op->resource[0], p->regs, 2);
2934     diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
2935     index 1f3345d..1b056d4 100644
2936     --- a/fs/cifs/connect.c
2937     +++ b/fs/cifs/connect.c
2938     @@ -1556,7 +1556,8 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2939    
2940     out_err:
2941     if (tcp_ses) {
2942     - kfree(tcp_ses->hostname);
2943     + if (!IS_ERR(tcp_ses->hostname))
2944     + kfree(tcp_ses->hostname);
2945     if (tcp_ses->ssocket)
2946     sock_release(tcp_ses->ssocket);
2947     kfree(tcp_ses);
2948     diff --git a/fs/fuse/file.c b/fs/fuse/file.c
2949     index cbc4640..899870a 100644
2950     --- a/fs/fuse/file.c
2951     +++ b/fs/fuse/file.c
2952     @@ -1063,7 +1063,8 @@ ssize_t fuse_direct_io(struct file *file, const char __user *buf,
2953     break;
2954     }
2955     }
2956     - fuse_put_request(fc, req);
2957     + if (!IS_ERR(req))
2958     + fuse_put_request(fc, req);
2959     if (res > 0)
2960     *ppos = pos;
2961    
2962     @@ -1599,7 +1600,7 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov,
2963     kaddr += copy;
2964     }
2965    
2966     - kunmap(map);
2967     + kunmap(page);
2968     }
2969    
2970     return 0;
2971     diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
2972     index 175d08e..bed78ac 100644
2973     --- a/fs/hfsplus/wrapper.c
2974     +++ b/fs/hfsplus/wrapper.c
2975     @@ -99,6 +99,10 @@ int hfsplus_read_wrapper(struct super_block *sb)
2976    
2977     if (hfsplus_get_last_session(sb, &part_start, &part_size))
2978     return -EINVAL;
2979     + if ((u64)part_start + part_size > 0x100000000ULL) {
2980     + pr_err("hfs: volumes larger than 2TB are not supported yet\n");
2981     + return -EINVAL;
2982     + }
2983     while (1) {
2984     bh = sb_bread512(sb, part_start + HFSPLUS_VOLHEAD_SECTOR, vhdr);
2985     if (!bh)
2986     diff --git a/fs/nfs/client.c b/fs/nfs/client.c
2987     index 8d25ccb..bdd76b9 100644
2988     --- a/fs/nfs/client.c
2989     +++ b/fs/nfs/client.c
2990     @@ -1171,7 +1171,7 @@ static int nfs4_init_client(struct nfs_client *clp,
2991     1, flags & NFS_MOUNT_NORESVPORT);
2992     if (error < 0)
2993     goto error;
2994     - memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
2995     + strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
2996    
2997     error = nfs_idmap_new(clp);
2998     if (error < 0) {
2999     diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
3000     index 32062c3..7cb2985 100644
3001     --- a/fs/nfs/dir.c
3002     +++ b/fs/nfs/dir.c
3003     @@ -1536,6 +1536,8 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
3004     old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
3005     dentry->d_parent->d_name.name, dentry->d_name.name);
3006    
3007     + nfs_inode_return_delegation(inode);
3008     +
3009     d_drop(dentry);
3010     error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
3011     if (error == 0) {
3012     diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
3013     index e4e089a..1af78ff 100644
3014     --- a/fs/nfs/direct.c
3015     +++ b/fs/nfs/direct.c
3016     @@ -457,6 +457,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
3017     };
3018     struct rpc_task_setup task_setup_data = {
3019     .rpc_client = NFS_CLIENT(inode),
3020     + .rpc_message = &msg,
3021     .callback_ops = &nfs_write_direct_ops,
3022     .workqueue = nfsiod_workqueue,
3023     .flags = RPC_TASK_ASYNC,
3024     diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3025     index 6917311..2aa2396 100644
3026     --- a/fs/nfs/nfs4proc.c
3027     +++ b/fs/nfs/nfs4proc.c
3028     @@ -71,12 +71,17 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
3029     /* Prevent leaks of NFSv4 errors into userland */
3030     static int nfs4_map_errors(int err)
3031     {
3032     - if (err < -1000) {
3033     + if (err >= -1000)
3034     + return err;
3035     + switch (err) {
3036     + case -NFS4ERR_RESOURCE:
3037     + return -EREMOTEIO;
3038     + default:
3039     dprintk("%s could not handle NFSv4 error %d\n",
3040     __func__, -err);
3041     - return -EIO;
3042     + break;
3043     }
3044     - return err;
3045     + return -EIO;
3046     }
3047    
3048     /*
3049     @@ -3033,9 +3038,6 @@ static void nfs4_renew_done(struct rpc_task *task, void *data)
3050     if (time_before(clp->cl_last_renewal,timestamp))
3051     clp->cl_last_renewal = timestamp;
3052     spin_unlock(&clp->cl_lock);
3053     - dprintk("%s calling put_rpccred on rpc_cred %p\n", __func__,
3054     - task->tk_msg.rpc_cred);
3055     - put_rpccred(task->tk_msg.rpc_cred);
3056     }
3057    
3058     static const struct rpc_call_ops nfs4_renew_ops = {
3059     @@ -4850,7 +4852,6 @@ void nfs41_sequence_call_done(struct rpc_task *task, void *data)
3060     nfs41_sequence_free_slot(clp, task->tk_msg.rpc_resp);
3061     dprintk("%s rpc_cred %p\n", __func__, task->tk_msg.rpc_cred);
3062    
3063     - put_rpccred(task->tk_msg.rpc_cred);
3064     kfree(task->tk_msg.rpc_argp);
3065     kfree(task->tk_msg.rpc_resp);
3066    
3067     diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
3068     index e27c6ce..0156c01 100644
3069     --- a/fs/nfs/nfs4renewd.c
3070     +++ b/fs/nfs/nfs4renewd.c
3071     @@ -127,12 +127,6 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
3072     }
3073    
3074     void
3075     -nfs4_renewd_prepare_shutdown(struct nfs_server *server)
3076     -{
3077     - cancel_delayed_work(&server->nfs_client->cl_renewd);
3078     -}
3079     -
3080     -void
3081     nfs4_kill_renewd(struct nfs_client *clp)
3082     {
3083     cancel_delayed_work_sync(&clp->cl_renewd);
3084     diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
3085     index 617273e..f4c9e1a 100644
3086     --- a/fs/nfs/nfs4xdr.c
3087     +++ b/fs/nfs/nfs4xdr.c
3088     @@ -5406,7 +5406,6 @@ static struct {
3089     { NFS4ERR_SERVERFAULT, -ESERVERFAULT },
3090     { NFS4ERR_BADTYPE, -EBADTYPE },
3091     { NFS4ERR_LOCKED, -EAGAIN },
3092     - { NFS4ERR_RESOURCE, -EREMOTEIO },
3093     { NFS4ERR_SYMLINK, -ELOOP },
3094     { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP },
3095     { NFS4ERR_DEADLOCK, -EDEADLK },
3096     diff --git a/fs/nfs/super.c b/fs/nfs/super.c
3097     index 0b4cbdc..9848169 100644
3098     --- a/fs/nfs/super.c
3099     +++ b/fs/nfs/super.c
3100     @@ -1323,6 +1323,7 @@ static int nfs_parse_mount_options(char *raw,
3101     default:
3102     dfprintk(MOUNT, "NFS: unrecognized "
3103     "transport protocol\n");
3104     + kfree(string);
3105     return 0;
3106     }
3107     break;
3108     @@ -2669,7 +2670,6 @@ static void nfs4_kill_super(struct super_block *sb)
3109     dprintk("--> %s\n", __func__);
3110     nfs_super_return_all_delegations(sb);
3111     kill_anon_super(sb);
3112     - nfs4_renewd_prepare_shutdown(server);
3113     nfs_fscache_release_super_cookie(sb);
3114     nfs_free_server(server);
3115     dprintk("<-- %s\n", __func__);
3116     diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
3117     index 5be2c8b..862ad29 100644
3118     --- a/fs/nilfs2/btnode.c
3119     +++ b/fs/nilfs2/btnode.c
3120     @@ -276,8 +276,7 @@ void nilfs_btnode_commit_change_key(struct address_space *btnc,
3121     "invalid oldkey %lld (newkey=%lld)",
3122     (unsigned long long)oldkey,
3123     (unsigned long long)newkey);
3124     - if (!test_set_buffer_dirty(obh) && TestSetPageDirty(opage))
3125     - BUG();
3126     + nilfs_btnode_mark_dirty(obh);
3127    
3128     spin_lock_irq(&btnc->tree_lock);
3129     radix_tree_delete(&btnc->page_tree, oldkey);
3130     diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
3131     index c8a07c6..3165d85 100644
3132     --- a/fs/notify/inode_mark.c
3133     +++ b/fs/notify/inode_mark.c
3134     @@ -324,11 +324,11 @@ int fsnotify_add_mark(struct fsnotify_mark_entry *entry,
3135     spin_lock(&group->mark_lock);
3136     spin_lock(&inode->i_lock);
3137    
3138     - entry->group = group;
3139     - entry->inode = inode;
3140     -
3141     lentry = fsnotify_find_mark_entry(group, inode);
3142     if (!lentry) {
3143     + entry->group = group;
3144     + entry->inode = inode;
3145     +
3146     hlist_add_head(&entry->i_list, &inode->i_fsnotify_mark_entries);
3147     list_add(&entry->g_list, &group->mark_entries);
3148    
3149     diff --git a/fs/pipe.c b/fs/pipe.c
3150     index 52c4151..ae17d02 100644
3151     --- a/fs/pipe.c
3152     +++ b/fs/pipe.c
3153     @@ -777,36 +777,55 @@ pipe_rdwr_release(struct inode *inode, struct file *filp)
3154     static int
3155     pipe_read_open(struct inode *inode, struct file *filp)
3156     {
3157     - /* We could have perhaps used atomic_t, but this and friends
3158     - below are the only places. So it doesn't seem worthwhile. */
3159     + int ret = -ENOENT;
3160     +
3161     mutex_lock(&inode->i_mutex);
3162     - inode->i_pipe->readers++;
3163     +
3164     + if (inode->i_pipe) {
3165     + ret = 0;
3166     + inode->i_pipe->readers++;
3167     + }
3168     +
3169     mutex_unlock(&inode->i_mutex);
3170    
3171     - return 0;
3172     + return ret;
3173     }
3174    
3175     static int
3176     pipe_write_open(struct inode *inode, struct file *filp)
3177     {
3178     + int ret = -ENOENT;
3179     +
3180     mutex_lock(&inode->i_mutex);
3181     - inode->i_pipe->writers++;
3182     +
3183     + if (inode->i_pipe) {
3184     + ret = 0;
3185     + inode->i_pipe->writers++;
3186     + }
3187     +
3188     mutex_unlock(&inode->i_mutex);
3189    
3190     - return 0;
3191     + return ret;
3192     }
3193    
3194     static int
3195     pipe_rdwr_open(struct inode *inode, struct file *filp)
3196     {
3197     + int ret = -ENOENT;
3198     +
3199     mutex_lock(&inode->i_mutex);
3200     - if (filp->f_mode & FMODE_READ)
3201     - inode->i_pipe->readers++;
3202     - if (filp->f_mode & FMODE_WRITE)
3203     - inode->i_pipe->writers++;
3204     +
3205     + if (inode->i_pipe) {
3206     + ret = 0;
3207     + if (filp->f_mode & FMODE_READ)
3208     + inode->i_pipe->readers++;
3209     + if (filp->f_mode & FMODE_WRITE)
3210     + inode->i_pipe->writers++;
3211     + }
3212     +
3213     mutex_unlock(&inode->i_mutex);
3214    
3215     - return 0;
3216     + return ret;
3217     }
3218    
3219     /*
3220     diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
3221     index 8535084..3f6e545 100644
3222     --- a/include/drm/drm_pciids.h
3223     +++ b/include/drm/drm_pciids.h
3224     @@ -552,6 +552,7 @@
3225     {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3226     {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3227     {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3228     + {0x8086, 0x2e42, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3229     {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3230     {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3231     {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
3232     diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
3233     index 6547c3c..82a9124 100644
3234     --- a/include/linux/moduleparam.h
3235     +++ b/include/linux/moduleparam.h
3236     @@ -37,7 +37,6 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
3237     typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
3238    
3239     /* Flag bits for kernel_param.flags */
3240     -#define KPARAM_KMALLOCED 1
3241     #define KPARAM_ISBOOL 2
3242    
3243     struct kernel_param {
3244     diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
3245     index 73b46b6..dc4cc29 100644
3246     --- a/include/linux/pci_ids.h
3247     +++ b/include/linux/pci_ids.h
3248     @@ -479,6 +479,9 @@
3249     #define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361
3250     #define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252
3251    
3252     +#define PCI_SUBVENDOR_ID_IBM 0x1014
3253     +#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4
3254     +
3255     #define PCI_VENDOR_ID_UNISYS 0x1018
3256     #define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C
3257    
3258     @@ -877,6 +880,7 @@
3259     #define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051
3260     #define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058
3261     #define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059
3262     +#define PCI_DEVICE_ID_APPLE_U4_PCIE 0x005b
3263     #define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066
3264     #define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069
3265     #define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a
3266     diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
3267     index 56677eb..fbc0146 100644
3268     --- a/include/pcmcia/ss.h
3269     +++ b/include/pcmcia/ss.h
3270     @@ -262,6 +262,8 @@ struct pcmcia_socket {
3271     struct device dev;
3272     /* data internal to the socket driver */
3273     void *driver_data;
3274     + /* status of the card during resume from a system sleep state */
3275     + int resume_status;
3276     };
3277    
3278    
3279     @@ -280,6 +282,8 @@ extern struct pccard_resource_ops pccard_nonstatic_ops;
3280    
3281     /* socket drivers are expected to use these callbacks in their .drv struct */
3282     extern int pcmcia_socket_dev_suspend(struct device *dev);
3283     +extern void pcmcia_socket_dev_early_resume(struct device *dev);
3284     +extern void pcmcia_socket_dev_late_resume(struct device *dev);
3285     extern int pcmcia_socket_dev_resume(struct device *dev);
3286    
3287     /* socket drivers use this callback in their IRQ handler */
3288     diff --git a/kernel/futex.c b/kernel/futex.c
3289     index 59a2f4d..c0a020f 100644
3290     --- a/kernel/futex.c
3291     +++ b/kernel/futex.c
3292     @@ -150,7 +150,8 @@ static struct futex_hash_bucket *hash_futex(union futex_key *key)
3293     */
3294     static inline int match_futex(union futex_key *key1, union futex_key *key2)
3295     {
3296     - return (key1->both.word == key2->both.word
3297     + return (key1 && key2
3298     + && key1->both.word == key2->both.word
3299     && key1->both.ptr == key2->both.ptr
3300     && key1->both.offset == key2->both.offset);
3301     }
3302     @@ -1027,7 +1028,6 @@ static inline
3303     void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
3304     struct futex_hash_bucket *hb)
3305     {
3306     - drop_futex_key_refs(&q->key);
3307     get_futex_key_refs(key);
3308     q->key = *key;
3309    
3310     @@ -1225,6 +1225,7 @@ retry_private:
3311     */
3312     if (ret == 1) {
3313     WARN_ON(pi_state);
3314     + drop_count++;
3315     task_count++;
3316     ret = get_futex_value_locked(&curval2, uaddr2);
3317     if (!ret)
3318     @@ -1303,6 +1304,7 @@ retry_private:
3319     if (ret == 1) {
3320     /* We got the lock. */
3321     requeue_pi_wake_futex(this, &key2, hb2);
3322     + drop_count++;
3323     continue;
3324     } else if (ret) {
3325     /* -EDEADLK */
3326     @@ -1767,6 +1769,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
3327     current->timer_slack_ns);
3328     }
3329    
3330     +retry:
3331     /* Prepare to wait on uaddr. */
3332     ret = futex_wait_setup(uaddr, val, fshared, &q, &hb);
3333     if (ret)
3334     @@ -1784,9 +1787,14 @@ static int futex_wait(u32 __user *uaddr, int fshared,
3335     goto out_put_key;
3336    
3337     /*
3338     - * We expect signal_pending(current), but another thread may
3339     - * have handled it for us already.
3340     + * We expect signal_pending(current), but we might be the
3341     + * victim of a spurious wakeup as well.
3342     */
3343     + if (!signal_pending(current)) {
3344     + put_futex_key(fshared, &q.key);
3345     + goto retry;
3346     + }
3347     +
3348     ret = -ERESTARTSYS;
3349     if (!abs_time)
3350     goto out_put_key;
3351     @@ -2094,9 +2102,11 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
3352     */
3353     plist_del(&q->list, &q->list.plist);
3354    
3355     + /* Handle spurious wakeups gracefully */
3356     + ret = -EWOULDBLOCK;
3357     if (timeout && !timeout->task)
3358     ret = -ETIMEDOUT;
3359     - else
3360     + else if (signal_pending(current))
3361     ret = -ERESTARTNOINTR;
3362     }
3363     return ret;
3364     diff --git a/kernel/params.c b/kernel/params.c
3365     index 7f6912c..f04a1e7 100644
3366     --- a/kernel/params.c
3367     +++ b/kernel/params.c
3368     @@ -217,15 +217,11 @@ int param_set_charp(const char *val, struct kernel_param *kp)
3369     return -ENOSPC;
3370     }
3371    
3372     - if (kp->flags & KPARAM_KMALLOCED)
3373     - kfree(*(char **)kp->arg);
3374     -
3375     /* This is a hack. We can't need to strdup in early boot, and we
3376     * don't need to; this mangled commandline is preserved. */
3377     if (slab_is_available()) {
3378     - kp->flags |= KPARAM_KMALLOCED;
3379     *(char **)kp->arg = kstrdup(val, GFP_KERNEL);
3380     - if (!kp->arg)
3381     + if (!*(char **)kp->arg)
3382     return -ENOMEM;
3383     } else
3384     *(const char **)kp->arg = val;
3385     @@ -303,6 +299,7 @@ static int param_array(const char *name,
3386     unsigned int min, unsigned int max,
3387     void *elem, int elemsize,
3388     int (*set)(const char *, struct kernel_param *kp),
3389     + u16 flags,
3390     unsigned int *num)
3391     {
3392     int ret;
3393     @@ -312,6 +309,7 @@ static int param_array(const char *name,
3394     /* Get the name right for errors. */
3395     kp.name = name;
3396     kp.arg = elem;
3397     + kp.flags = flags;
3398    
3399     /* No equals sign? */
3400     if (!val) {
3401     @@ -357,7 +355,8 @@ int param_array_set(const char *val, struct kernel_param *kp)
3402     unsigned int temp_num;
3403    
3404     return param_array(kp->name, val, 1, arr->max, arr->elem,
3405     - arr->elemsize, arr->set, arr->num ?: &temp_num);
3406     + arr->elemsize, arr->set, kp->flags,
3407     + arr->num ?: &temp_num);
3408     }
3409    
3410     int param_array_get(char *buffer, struct kernel_param *kp)
3411     @@ -604,11 +603,7 @@ void module_param_sysfs_remove(struct module *mod)
3412    
3413     void destroy_params(const struct kernel_param *params, unsigned num)
3414     {
3415     - unsigned int i;
3416     -
3417     - for (i = 0; i < num; i++)
3418     - if (params[i].flags & KPARAM_KMALLOCED)
3419     - kfree(*(char **)params[i].arg);
3420     + /* FIXME: This should free kmalloced charp parameters. It doesn't. */
3421     }
3422    
3423     static void __init kernel_add_sysfs_param(const char *name,
3424     diff --git a/mm/mempolicy.c b/mm/mempolicy.c
3425     index 7dd9d9f..4545d59 100644
3426     --- a/mm/mempolicy.c
3427     +++ b/mm/mempolicy.c
3428     @@ -1024,7 +1024,7 @@ static long do_mbind(unsigned long start, unsigned long len,
3429    
3430     err = migrate_prep();
3431     if (err)
3432     - return err;
3433     + goto mpol_out;
3434     }
3435     {
3436     NODEMASK_SCRATCH(scratch);
3437     @@ -1039,10 +1039,9 @@ static long do_mbind(unsigned long start, unsigned long len,
3438     err = -ENOMEM;
3439     NODEMASK_SCRATCH_FREE(scratch);
3440     }
3441     - if (err) {
3442     - mpol_put(new);
3443     - return err;
3444     - }
3445     + if (err)
3446     + goto mpol_out;
3447     +
3448     vma = check_range(mm, start, end, nmask,
3449     flags | MPOL_MF_INVERT, &pagelist);
3450    
3451     @@ -1058,9 +1057,11 @@ static long do_mbind(unsigned long start, unsigned long len,
3452    
3453     if (!err && nr_failed && (flags & MPOL_MF_STRICT))
3454     err = -EIO;
3455     - }
3456     + } else
3457     + putback_lru_pages(&pagelist);
3458    
3459     up_write(&mm->mmap_sem);
3460     + mpol_out:
3461     mpol_put(new);
3462     return err;
3463     }
3464     diff --git a/mm/nommu.c b/mm/nommu.c
3465     index 82fedca..10cdd4c 100644
3466     --- a/mm/nommu.c
3467     +++ b/mm/nommu.c
3468     @@ -1384,9 +1384,11 @@ share:
3469     error_just_free:
3470     up_write(&nommu_region_sem);
3471     error:
3472     - fput(region->vm_file);
3473     + if (region->vm_file)
3474     + fput(region->vm_file);
3475     kmem_cache_free(vm_region_jar, region);
3476     - fput(vma->vm_file);
3477     + if (vma->vm_file)
3478     + fput(vma->vm_file);
3479     if (vma->vm_flags & VM_EXECUTABLE)
3480     removed_exe_file_vma(vma->vm_mm);
3481     kmem_cache_free(vm_area_cachep, vma);
3482     diff --git a/mm/swapfile.c b/mm/swapfile.c
3483     index 8ffdc0d..b47ccd7 100644
3484     --- a/mm/swapfile.c
3485     +++ b/mm/swapfile.c
3486     @@ -1149,8 +1149,7 @@ static int try_to_unuse(unsigned int type)
3487     } else
3488     retval = unuse_mm(mm, entry, page);
3489    
3490     - if (set_start_mm &&
3491     - swap_count(*swap_map) < swcount) {
3492     + if (set_start_mm && *swap_map < swcount) {
3493     mmput(new_start_mm);
3494     atomic_inc(&mm->mm_users);
3495     new_start_mm = mm;
3496     diff --git a/mm/vmscan.c b/mm/vmscan.c
3497     index 94e86dd..95f35a7 100644
3498     --- a/mm/vmscan.c
3499     +++ b/mm/vmscan.c
3500     @@ -1298,7 +1298,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
3501     * IO, plus JVM can create lots of anon VM_EXEC pages,
3502     * so we ignore them here.
3503     */
3504     - if ((vm_flags & VM_EXEC) && !PageAnon(page)) {
3505     + if ((vm_flags & VM_EXEC) && page_is_file_cache(page)) {
3506     list_add(&page->lru, &l_active);
3507     continue;
3508     }
3509     diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
3510     index 3f47276..88b0648 100644
3511     --- a/net/mac80211/cfg.c
3512     +++ b/net/mac80211/cfg.c
3513     @@ -87,6 +87,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
3514     if (!dev)
3515     return -ENODEV;
3516    
3517     + if (netif_running(dev))
3518     + return -EBUSY;
3519     +
3520     if (!nl80211_type_check(type))
3521     return -EINVAL;
3522    
3523     @@ -96,9 +99,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
3524     if (ret)
3525     return ret;
3526    
3527     - if (netif_running(sdata->dev))
3528     - return -EBUSY;
3529     -
3530     if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
3531     ieee80211_sdata_set_mesh_id(sdata,
3532     params->mesh_id_len,
3533     diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
3534     index 98576d4..e5d720e 100644
3535     --- a/net/mac80211/tx.c
3536     +++ b/net/mac80211/tx.c
3537     @@ -1478,7 +1478,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
3538     if (sdata->vif.type != NL80211_IFTYPE_AP)
3539     continue;
3540     if (compare_ether_addr(sdata->dev->dev_addr,
3541     - hdr->addr2)) {
3542     + hdr->addr2) == 0) {
3543     dev_hold(sdata->dev);
3544     dev_put(odev);
3545     osdata = sdata;
3546     diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
3547     index 09cdcdf..b83ac88 100644
3548     --- a/net/sched/cls_api.c
3549     +++ b/net/sched/cls_api.c
3550     @@ -348,7 +348,7 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp,
3551     tcm = NLMSG_DATA(nlh);
3552     tcm->tcm_family = AF_UNSPEC;
3553     tcm->tcm__pad1 = 0;
3554     - tcm->tcm__pad1 = 0;
3555     + tcm->tcm__pad2 = 0;
3556     tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex;
3557     tcm->tcm_parent = tp->classid;
3558     tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
3559     diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
3560     index 51ab497..fc820cd 100644
3561     --- a/net/unix/af_unix.c
3562     +++ b/net/unix/af_unix.c
3563     @@ -1074,6 +1074,8 @@ restart:
3564     err = -ECONNREFUSED;
3565     if (other->sk_state != TCP_LISTEN)
3566     goto out_unlock;
3567     + if (other->sk_shutdown & RCV_SHUTDOWN)
3568     + goto out_unlock;
3569    
3570     if (unix_recvq_full(other)) {
3571     err = -EAGAIN;
3572     diff --git a/scripts/Makefile b/scripts/Makefile
3573     index 9dd5b25..842dbc2 100644
3574     --- a/scripts/Makefile
3575     +++ b/scripts/Makefile
3576     @@ -10,7 +10,6 @@
3577     hostprogs-$(CONFIG_KALLSYMS) += kallsyms
3578     hostprogs-$(CONFIG_LOGO) += pnmtologo
3579     hostprogs-$(CONFIG_VT) += conmakehash
3580     -hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
3581     hostprogs-$(CONFIG_IKCONFIG) += bin2c
3582    
3583     always := $(hostprogs-y) $(hostprogs-m)
3584     diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
3585     index 7f09fb8..667aecd 100644
3586     --- a/security/keys/keyctl.c
3587     +++ b/security/keys/keyctl.c
3588     @@ -860,7 +860,7 @@ static long get_instantiation_keyring(key_serial_t ringid,
3589     /* otherwise specify the destination keyring recorded in the
3590     * authorisation key (any KEY_SPEC_*_KEYRING) */
3591     if (ringid >= KEY_SPEC_REQUESTOR_KEYRING) {
3592     - *_dest_keyring = rka->dest_keyring;
3593     + *_dest_keyring = key_get(rka->dest_keyring);
3594     return 0;
3595     }
3596    
3597     diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
3598     index cc84a83..56d1bd8 100644
3599     --- a/sound/pci/ice1712/ice1724.c
3600     +++ b/sound/pci/ice1712/ice1724.c
3601     @@ -643,7 +643,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
3602     (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) {
3603     /* running? we cannot change the rate now... */
3604     spin_unlock_irqrestore(&ice->reg_lock, flags);
3605     - return -EBUSY;
3606     + return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY;
3607     }
3608     if (!force && is_pro_rate_locked(ice)) {
3609     spin_unlock_irqrestore(&ice->reg_lock, flags);
3610     diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
3611     index 2884baf..198c750 100644
3612     --- a/virt/kvm/kvm_main.c
3613     +++ b/virt/kvm/kvm_main.c
3614     @@ -2590,8 +2590,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
3615     int r;
3616     int cpu;
3617    
3618     - kvm_init_debug();
3619     -
3620     r = kvm_arch_init(opaque);
3621     if (r)
3622     goto out_fail;
3623     @@ -2658,6 +2656,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
3624     kvm_preempt_ops.sched_in = kvm_sched_in;
3625     kvm_preempt_ops.sched_out = kvm_sched_out;
3626    
3627     + kvm_init_debug();
3628     +
3629     return 0;
3630    
3631     out_free:
3632     @@ -2679,7 +2679,6 @@ out_free_0:
3633     __free_page(bad_page);
3634     out:
3635     kvm_arch_exit();
3636     - kvm_exit_debug();
3637     out_fail:
3638     return r;
3639     }
3640     @@ -2688,6 +2687,7 @@ EXPORT_SYMBOL_GPL(kvm_init);
3641     void kvm_exit(void)
3642     {
3643     kvm_trace_cleanup();
3644     + kvm_exit_debug();
3645     misc_deregister(&kvm_dev);
3646     kmem_cache_destroy(kvm_vcpu_cache);
3647     sysdev_unregister(&kvm_sysdev);
3648     @@ -2697,7 +2697,6 @@ void kvm_exit(void)
3649     on_each_cpu(hardware_disable, NULL, 1);
3650     kvm_arch_hardware_unsetup();
3651     kvm_arch_exit();
3652     - kvm_exit_debug();
3653     free_cpumask_var(cpus_hardware_enabled);
3654     __free_page(bad_page);
3655     }